seemoo-lab / pyshimmer Goto Github PK
View Code? Open in Web Editor NEWpyshimmer provides a Python API to work with the wearable sensor devices produced by Shimmer.
License: GNU General Public License v3.0
pyshimmer provides a Python API to work with the wearable sensor devices produced by Shimmer.
License: GNU General Public License v3.0
Hi, I'm trying to deploying and end to end system, so I don't want that the user interact with Consensys or other Shimmer software.
The data I'm downloading it through the dock station.
Following your examples I could access to the raw data, but I can't access to the calibration one. Can you help me?
Hi thank you for this code. Could you explain how this could be intergrated with PyLSL to set up data streaming?
This would be a great merge with the LSL project to combine GSR with other sensors.
Hi, thanks for the great work with this API.
We are trying to integrate shimmer with a Psychopy https://www.psychopy.org/ experiment where we present some images and want to record the physiological signals using the shimmer kit.
Is there a way to send a "trigger"/ event marker using the API, such that I can synchronise the image presentation with the recording afterwards?
I hope this makes sense
After successful firmware flashing, and rfcomm bind,
The test code provides below error.
'device reports readiness to read but returned no data'.
Should I do something between binding and run the testcode provided in repository?
Dear Lukas,
first thank you for this library, I have been looking for a long time for a simpler way to access the shimmer via python.
One thing is missing is the possibility to set configure the Shimmer before starting to stream.
One should be able to select which channels are active (e.g., AC13, RAW GSR, SRC, etc) and the streaming frequency.
Maybe the features is already there, if that's the case, could you please provide me a snippet on how to use it?
Thank you!
Dario
Hello,
Thank you for your impressive work on Shimmer devices.
I would like to know if you were able to test the compatibility of pyshimmer with the new version of the LogAndStream v0.16.000 firmware.
I await your feedback before updating my IMUs.
Thank you in advance,
Sincerely
Hey,
I followed the instructions of the readme. I also patched LogAndStream Firmware on my Shimmer3 EXG.
Everything work till the example Program of the BT API. I am working on an Ubuntu 18.04.4 LTS.
I got the Error:
My name is: Shimmer_86A5
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/pyshimmer/bluetooth/bt_api.py", line 294, in _run_readloop
self._bluetooth.process_single_input_event()
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/pyshimmer/bluetooth/bt_api.py", line 206, in process_single_input_event
self._process_data_packet()
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/pyshimmer/bluetooth/bt_api.py", line 148, in _process_data_packet
cb(packet)
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/test_hallo.py", line 26, in handler
cur_value = pkt[EChannelType.INTERNAL_ADC_13]
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/pyshimmer/bluetooth/bt_commands.py", line 60, in getitem
return self._values[item]
KeyError: <EChannelType.INTERNAL_ADC_13: 19>
After that i have to keyinterrupt the session:
Traceback (most recent call last):
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/test_hallo.py", line 43, in
shim_dev.stop_streaming()
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/pyshimmer/bluetooth/bt_api.py", line 480, in stop_streaming
self._process_and_wait(StopStreamingCommand())
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/pyshimmer/bluetooth/bt_api.py", line 301, in _process_and_wait
compl_obj.wait()
File "/home/z-fcc/PycharmProjects/Test/pyshimmer/pyshimmer/bluetooth/bt_api.py", line 50, in wait
self.__event.wait()
File "/usr/lib/python3.8/threading.py", line 558, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.8/threading.py", line 302, in wait
waiter.acquire()
KeyboardInterrupt
I can't find the mistake by my own. Can you help me pls?
Dear StudentofGermany
Hello lumagi,
I use your Python API for my Shimmer3 EXG Unit and it works well. Thank you for that :)
Now I want to get the data from the Shimmer SD with Consensys. Sometimes it works, but more often an error occur.
Also I use your Reader API, but with the reader API the data have a different shape, like the streaming data. And i would prefer to have the data in the shape of the output from Consensys.
Could it be that the data got damaged or not closed with the Python API? Even if i use the stop() and shutdown() command?
Best StudentofGermany
Hi Lukas,
I think the realign
functionality when loading data is incorrect. From my understanding it does the following right now:
If the original timestamps are assumed to be correct, keeping the total number of observations in the second step will lead to an too early final timestamp. Instead, the correct approach would be to impute missing timestamps and interpolate new sensor values. Otherwise, if the timestamps are assumed to be incorrect, interpolating the sensor values in the third steps is wrong.
Working with the raw data from the Shimmer devices, I have made the following observations:
Using this observations, my current approach is to disable the realign
functionality, drop the first sample and impute missing values by linear interpolation as outlined below.
import pandas as pd
import numpy as np
from pyshimmer import ShimmerReader, EChannelType
with open("ECG.sb3", "rb") as ecg_file:
ecg_reader = ShimmerReader(ecg_file, realign=False)
ecg_reader.load_file_data()
ecg_fs = ecg_reader.sample_rate
# convert to pandas dataframe and drop the first sample
ecg_df = pd.DataFrame({
"ecg1": ecg_reader[EChannelType.EXG_ADS1292R_1_CH1_24BIT][1:],
"ecg2": ecg_reader[EChannelType.EXG_ADS1292R_1_CH2_24BIT][1:],
}, index=ecg_reader[EChannelType.TIMESTAMP][1:])
# add empty rows for the missing timestamps and interpolate the sensor values
ecg_ts = pd.Index(np.arange(ecg_df.index[0], ecg_df.index[-1], 1/ecg_fs), name="timestamps")
ecg_df = ecg_df.reindex(ecg_ts).reset_index().interpolate()
Concluding, I think it would be better to remove the realign
functionality and let the users decide on how to deal with the presumably missing observations. Though, it may be helpful to raise a warning on detecting such gaps in the recording and, in particular, on detecting those which are are not an integer multiple of the sample time.
Cheers,
Matthias
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.