Skip to main content

Obtain data from edge-ml

from edgeml import DatasetReceiver

1. Create a project

This will also pull the metadata from the server. Here you need the read-key. Make sure there is not trailing / in your URL.

project = DatasetReceiver("https://edge-ml-beta.dmz.teco.edu", "8c051972b56e6b4ad6bd0bf573da580f")
print(project)
Dataset - Name: W_001, ID: 645a255bdd19d537f2a50126, Metadata: {}
Dataset - Name: W_004, ID: 645a255b7d9569d03843a12b, Metadata: {}
Dataset - Name: Square_003, ID: 645a255b2ce253c26b52426c, Metadata: {}
Dataset - Name: Square_004, ID: 645a255b1d6af5e7ed04575f, Metadata: {}
Dataset - Name: Square_002, ID: 645a255bc21261d4cbdc990d, Metadata: {}
Dataset - Name: W_002, ID: 645a255b3ebe0af02b211d5d, Metadata: {}
Dataset - Name: W_003, ID: 645a255b074737af782167e2, Metadata: {}
Dataset - Name: Square_001, ID: 645a255bbacf5ab8ff044304, Metadata: {}
Dataset - Name: edgemlDemo, ID: 64635a79a7a7513e8ac92d32, Metadata: {'langauge': 'python'}
Dataset - Name: edgemlDemo, ID: 64635a7b6fec1d2800b1cd06, Metadata: {'langauge': 'python'}

2. Actually obtain data

Until now, we only have metadata available. We need to pull the actual time-series data using one of the following methods:

We can load the data for a single timeSeries

project.datasets[0].timeSeries[0].loadData()
project.datasets[0].timeSeries[0].data.head()
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
time x
0 1970-01-01 00:10:23.339 -823.0
1 1970-01-01 00:10:23.378 -819.0
2 1970-01-01 00:10:23.418 -770.0
3 1970-01-01 00:10:23.458 -746.0
4 1970-01-01 00:10:23.497 -783.0

For a single dataset

project.datasets[0].loadData()
project.datasets[0].data.head()
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
time x y z Gestures
0 1970-01-01 00:10:23.339 -823.0 -45.0 4025.0
1 1970-01-01 00:10:23.378 -819.0 -158.0 4075.0
2 1970-01-01 00:10:23.418 -770.0 -255.0 4116.0
3 1970-01-01 00:10:23.458 -746.0 -155.0 4059.0
4 1970-01-01 00:10:23.497 -783.0 -104.0 3963.0

Or for all datasets in the project

project.loadData()
project.data[0].head()
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
time x y z Gestures
0 1970-01-01 00:10:23.339 -823.0 -45.0 4025.0
1 1970-01-01 00:10:23.378 -819.0 -158.0 4075.0
2 1970-01-01 00:10:23.418 -770.0 -255.0 4116.0
3 1970-01-01 00:10:23.458 -746.0 -155.0 4059.0
4 1970-01-01 00:10:23.497 -783.0 -104.0 3963.0

Upload data to edge-ml

1. Upload data using timestamps from the device

Here you will need the write-key

from edgeml.edgeml import DatasetCollector
sender = DatasetCollector(url="https://edge-ml-beta.dmz.teco.edu", apiKey="4e6159c9c77124d71f298e93f1ed7254", name="edgemlDemo", useDeviceTime=True, timeSeries=["accX", "accY"], metaData={"langauge": "python"})
import time

for i in range (100):
    await sender.addDataPoint(name="accX", value=i*0.1)
    await sender.addDataPoint(name="accY", value=i*0.5)
    time.sleep(0.01)
sender.onComplete()
True

2. Provide your own timestamps

from edgeml.edgeml import DatasetCollector
sender = DatasetCollector(url="https://edge-ml-beta.dmz.teco.edu", apiKey="4e6159c9c77124d71f298e93f1ed7254", name="edgemlDemo", useDeviceTime=False, timeSeries=["accX", "accY"], metaData={"langauge": "python"})
import time

for i in range (100):
    await sender.addDataPoint(timestamp=i*1000, name="accX", value=i*0.1)
    await sender.addDataPoint(timestamp=i*1000, name="accY", value=i*0.5)
    time.sleep(0.01)
sender.onComplete()
True

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edge-ml-0.3.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

edge_ml-0.3.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file edge-ml-0.3.2.tar.gz.

File metadata

  • Download URL: edge-ml-0.3.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for edge-ml-0.3.2.tar.gz
Algorithm Hash digest
SHA256 cb6d75d6548d87db6f5d7fd6812e5fdb3fb7a500b67bc9a1eafa3a3e6e5924ca
MD5 1c6675c01be6a4ae1a2fb1ddc030fbc8
BLAKE2b-256 47183583249cd69f28e23563b23deb0d8a0579569c0538def8449b2f162db509

See more details on using hashes here.

File details

Details for the file edge_ml-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: edge_ml-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for edge_ml-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eebc71cfb003f20d3e2a6695dbc248b41e6be8bd857a247430813623cb401e0f
MD5 6a607795a335e62c14dd0b719886dcd5
BLAKE2b-256 eea0341046d4b1ed7ec35dd14e11fa59ac8c2ecb507fc8b9ab7732d49c8d5a9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page