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

Uploaded Python 3

File details

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

File metadata

  • Download URL: edge-ml-0.3.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.tar.gz
Algorithm Hash digest
SHA256 2076c1a3b08bebc152bb87d2dde6d05d4d4017bb5787287ef3ef883e9b8b84a8
MD5 a9020764c13ebe69a0d5456b448b093e
BLAKE2b-256 1c55faeffd56b6002039bcbef4e5d303b7ca0c485cb93d41135187246798398b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edge_ml-0.3-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-py3-none-any.whl
Algorithm Hash digest
SHA256 de5e39e4de6fd77fe1586e0bba1da3ad198c0a4045952a1a34150fea71e28a4a
MD5 9ba1bc7eca0f85a89d793b3d39d2a12f
BLAKE2b-256 0d197c729b65024b157751e90f9582fe2abb8bd9eb00b3c4e08f6f4a413757fe

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