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.1.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.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: edge-ml-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 8c2d2649ff92a491c242280bc269663dbd7bc93bbf9bcb0e435260ed0510f98a
MD5 b8168f001fc029e8fe820a147f0ab012
BLAKE2b-256 4f4ddef27ef05d0e834d9d6e9ce41b4262badf14979f14d71ffce9f7b5f6835e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edge_ml-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b6796d6e5d1b52e3d7cbb2cb0673e8870f69d23542966053bc9330f0dd3eab9
MD5 ed616eebfc81db2e2c7af32224e0c9fd
BLAKE2b-256 46e6f382e42ffe83cb89e5ebf46d32e65d4ee2d224f74ba7f984f7a7ec82f850

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