diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-openbci-stream.spec | 319 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 321 insertions, 0 deletions
@@ -0,0 +1 @@ +/openbci-stream-1.0.12.tar.gz diff --git a/python-openbci-stream.spec b/python-openbci-stream.spec new file mode 100644 index 0000000..aae091f --- /dev/null +++ b/python-openbci-stream.spec @@ -0,0 +1,319 @@ +%global _empty_manifest_terminate_build 0 +Name: python-openbci-stream +Version: 1.0.12 +Release: 1 +Summary: High level Python module for EEG/EMG/ECG acquisition and distributed streaming for OpenBCI Cyton board. +License: BSD-2-Clause +URL: https://pypi.org/project/openbci-stream/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/4b/25/e857af3c56c468968fc95420bc6354d7d3b0418aaee5c7135f1e172e212b/openbci-stream-1.0.12.tar.gz +BuildArch: noarch + +Requires: python3-ntplib +Requires: python3-tables +Requires: python3-numpy +Requires: python3-mne +Requires: python3-requests +Requires: python3-colorama +Requires: python3-scipy +Requires: python3-kafka-python +Requires: python3-rpyc +Requires: python3-netifaces +Requires: python3-nmap +Requires: python3-pyserial +Requires: python3-systemd-service + +%description +# OpenBCI-Stream +High level Python module for EEG/EMG/ECG acquisition and distributed streaming for OpenBCI Cyton board. + + + + + + + +[](https://openbci-stream.readthedocs.io/en/latest/?badge=latest) +Comprise a set of scripts that deals with the configuration and connection with the board, also is compatible with both connection modes supported by [Cyton](https://shop.openbci.com/products/cyton-biosensing-board-8-channel?variant=38958638542): RFduino (Serial dongle) and Wi-Fi (with the OpenBCI Wi-Fi Shield). These drivers are a stand-alone library that can handle the board from three different endpoints: (i) a [Command-Line Interface](06-command_line_interface.ipynb) (CLI) with simple instructions configure, start and stop data acquisition, debug stream status, and register events markers; (ii) a [Python Module](03-data_acuisition.ipynb) with high-level instructions and asynchronous acquisition; (iii) an object-proxying using Remote Python Call (RPyC) for [distributed implementations](A4-server-based-acquisition.ipynb) that can manipulate the Python modules as if they were local, this last mode needs a daemon running in the remote host that will listen to connections and driving instructions. +The main functionality of the drivers live on to serve real-time and distributed access to data flow, even on single machine implementations, this is achieved by implementing [Kafka](https://kafka.apache.org/) and their capabilities to create multiple topics for classifying the streaming, these topics are used to separate the neurophysiological data from the [event markers](05-stream_markers), so the clients can subscribe to a specific topic for injecting or read content, this means that is possible to implement an event register in a separate process that stream markers for all clients in real-time without handle dense time-series data. A crucial issue that stays on [time synchronization](A4-server-based_acquisition.ipynb#Step-5---Configure-time-server), all systems components in the network should have the same real-time protocol (RTP) server reference. +## Main features + * **Asynchronous acquisition:** Acquisition and deserialization are done in uninterrupted parallel processes. In this way, the sampling rate keeps stable as long as possible. + * **Distributed streaming system:** The acquisition, processing, visualizations, and any other system that needs to be fed with EEG/EMG/ECG real-time data can run with their architecture. + * **Remote board handle:** Same code syntax for developing and debug Cython boards connected to any node in the distributed system. + * **Command-line interface:** A simple interface for handle the start, stop, and access to data stream directly from the command line. + * **Markers/Events handler:** Besides the marker boardmode available in Cyton, a stream channel for the reading and writing of markers is available for use in any development. + * **Multiple boards:** Is possible to use multiple OpenBCI boards just by adding multiple endpoints to the commands. +## Examples +```python +# Acquisition with blocking call +from openbci_stream.acquisition import Cyton +openbci = Cyton('serial', endpoint='/dev/ttyUSB0', capture_stream=True) +# blocking call +openbci.stream(15) # collect data for 15 seconds +# openbci.eeg_time_series +# openbci.aux_time_series +# openbci.timestamp_time_series +``` +```python +# Acquisition with asynchronous call +from openbci_stream.acquisition import Cyton +openbci = Cyton('wifi', endpoint='192.68.1.113', capture_stream=True) +openbci.stream(15) # collect data for 15 seconds +# asynchronous call +openbci.start_stream() +time.sleep(15) # collect data for 15 seconds +openbci.stop_stream() +``` +```python +# Remote acquisition +from openbci_stream.acquisition import Cyton +openbci = Cyton('serial', endpoint='/dev/ttyUSB0', host='192.168.1.1', capture_stream=True) +# blocking call +openbci.stream(15) # collect data for 15 seconds +``` +```python +# Consumer for active streamming +from openbci_stream.acquisition import OpenBCIConsumer +with OpenBCIConsumer() as stream: + for i, message in enumerate(stream): + if message.topic == 'eeg': + print(f"received {message.value['samples']} samples") + if i == 9: + break +``` +```python +# Create stream then consume data +from openbci_stream.acquisition import OpenBCIConsumer +with OpenBCIConsumer(mode='serial', endpoint='/dev/ttyUSB0', streaming_package_size=250) as (stream, openbci): + t0 = time.time() + for i, message in enumerate(stream): + if message.topic == 'eeg': + print(f"{i}: received {message.value['samples']} samples") + t0 = time.time() + if i == 9: + break +``` +```python +# Acquisition with multiple boards +from openbci_stream.acquisition import Cyton +openbci = Cyton('wifi', endpoint=['192.68.1.113', '192.68.1.185'], capture_stream=True) +openbci.stream(15) # collect data for 15 seconds +# asynchronous call +openbci.start_stream() +time.sleep(15) # collect data for 15 seconds +openbci.stop_stream() +``` + +%package -n python3-openbci-stream +Summary: High level Python module for EEG/EMG/ECG acquisition and distributed streaming for OpenBCI Cyton board. +Provides: python-openbci-stream +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-openbci-stream +# OpenBCI-Stream +High level Python module for EEG/EMG/ECG acquisition and distributed streaming for OpenBCI Cyton board. + + + + + + + +[](https://openbci-stream.readthedocs.io/en/latest/?badge=latest) +Comprise a set of scripts that deals with the configuration and connection with the board, also is compatible with both connection modes supported by [Cyton](https://shop.openbci.com/products/cyton-biosensing-board-8-channel?variant=38958638542): RFduino (Serial dongle) and Wi-Fi (with the OpenBCI Wi-Fi Shield). These drivers are a stand-alone library that can handle the board from three different endpoints: (i) a [Command-Line Interface](06-command_line_interface.ipynb) (CLI) with simple instructions configure, start and stop data acquisition, debug stream status, and register events markers; (ii) a [Python Module](03-data_acuisition.ipynb) with high-level instructions and asynchronous acquisition; (iii) an object-proxying using Remote Python Call (RPyC) for [distributed implementations](A4-server-based-acquisition.ipynb) that can manipulate the Python modules as if they were local, this last mode needs a daemon running in the remote host that will listen to connections and driving instructions. +The main functionality of the drivers live on to serve real-time and distributed access to data flow, even on single machine implementations, this is achieved by implementing [Kafka](https://kafka.apache.org/) and their capabilities to create multiple topics for classifying the streaming, these topics are used to separate the neurophysiological data from the [event markers](05-stream_markers), so the clients can subscribe to a specific topic for injecting or read content, this means that is possible to implement an event register in a separate process that stream markers for all clients in real-time without handle dense time-series data. A crucial issue that stays on [time synchronization](A4-server-based_acquisition.ipynb#Step-5---Configure-time-server), all systems components in the network should have the same real-time protocol (RTP) server reference. +## Main features + * **Asynchronous acquisition:** Acquisition and deserialization are done in uninterrupted parallel processes. In this way, the sampling rate keeps stable as long as possible. + * **Distributed streaming system:** The acquisition, processing, visualizations, and any other system that needs to be fed with EEG/EMG/ECG real-time data can run with their architecture. + * **Remote board handle:** Same code syntax for developing and debug Cython boards connected to any node in the distributed system. + * **Command-line interface:** A simple interface for handle the start, stop, and access to data stream directly from the command line. + * **Markers/Events handler:** Besides the marker boardmode available in Cyton, a stream channel for the reading and writing of markers is available for use in any development. + * **Multiple boards:** Is possible to use multiple OpenBCI boards just by adding multiple endpoints to the commands. +## Examples +```python +# Acquisition with blocking call +from openbci_stream.acquisition import Cyton +openbci = Cyton('serial', endpoint='/dev/ttyUSB0', capture_stream=True) +# blocking call +openbci.stream(15) # collect data for 15 seconds +# openbci.eeg_time_series +# openbci.aux_time_series +# openbci.timestamp_time_series +``` +```python +# Acquisition with asynchronous call +from openbci_stream.acquisition import Cyton +openbci = Cyton('wifi', endpoint='192.68.1.113', capture_stream=True) +openbci.stream(15) # collect data for 15 seconds +# asynchronous call +openbci.start_stream() +time.sleep(15) # collect data for 15 seconds +openbci.stop_stream() +``` +```python +# Remote acquisition +from openbci_stream.acquisition import Cyton +openbci = Cyton('serial', endpoint='/dev/ttyUSB0', host='192.168.1.1', capture_stream=True) +# blocking call +openbci.stream(15) # collect data for 15 seconds +``` +```python +# Consumer for active streamming +from openbci_stream.acquisition import OpenBCIConsumer +with OpenBCIConsumer() as stream: + for i, message in enumerate(stream): + if message.topic == 'eeg': + print(f"received {message.value['samples']} samples") + if i == 9: + break +``` +```python +# Create stream then consume data +from openbci_stream.acquisition import OpenBCIConsumer +with OpenBCIConsumer(mode='serial', endpoint='/dev/ttyUSB0', streaming_package_size=250) as (stream, openbci): + t0 = time.time() + for i, message in enumerate(stream): + if message.topic == 'eeg': + print(f"{i}: received {message.value['samples']} samples") + t0 = time.time() + if i == 9: + break +``` +```python +# Acquisition with multiple boards +from openbci_stream.acquisition import Cyton +openbci = Cyton('wifi', endpoint=['192.68.1.113', '192.68.1.185'], capture_stream=True) +openbci.stream(15) # collect data for 15 seconds +# asynchronous call +openbci.start_stream() +time.sleep(15) # collect data for 15 seconds +openbci.stop_stream() +``` + +%package help +Summary: Development documents and examples for openbci-stream +Provides: python3-openbci-stream-doc +%description help +# OpenBCI-Stream +High level Python module for EEG/EMG/ECG acquisition and distributed streaming for OpenBCI Cyton board. + + + + + + + +[](https://openbci-stream.readthedocs.io/en/latest/?badge=latest) +Comprise a set of scripts that deals with the configuration and connection with the board, also is compatible with both connection modes supported by [Cyton](https://shop.openbci.com/products/cyton-biosensing-board-8-channel?variant=38958638542): RFduino (Serial dongle) and Wi-Fi (with the OpenBCI Wi-Fi Shield). These drivers are a stand-alone library that can handle the board from three different endpoints: (i) a [Command-Line Interface](06-command_line_interface.ipynb) (CLI) with simple instructions configure, start and stop data acquisition, debug stream status, and register events markers; (ii) a [Python Module](03-data_acuisition.ipynb) with high-level instructions and asynchronous acquisition; (iii) an object-proxying using Remote Python Call (RPyC) for [distributed implementations](A4-server-based-acquisition.ipynb) that can manipulate the Python modules as if they were local, this last mode needs a daemon running in the remote host that will listen to connections and driving instructions. +The main functionality of the drivers live on to serve real-time and distributed access to data flow, even on single machine implementations, this is achieved by implementing [Kafka](https://kafka.apache.org/) and their capabilities to create multiple topics for classifying the streaming, these topics are used to separate the neurophysiological data from the [event markers](05-stream_markers), so the clients can subscribe to a specific topic for injecting or read content, this means that is possible to implement an event register in a separate process that stream markers for all clients in real-time without handle dense time-series data. A crucial issue that stays on [time synchronization](A4-server-based_acquisition.ipynb#Step-5---Configure-time-server), all systems components in the network should have the same real-time protocol (RTP) server reference. +## Main features + * **Asynchronous acquisition:** Acquisition and deserialization are done in uninterrupted parallel processes. In this way, the sampling rate keeps stable as long as possible. + * **Distributed streaming system:** The acquisition, processing, visualizations, and any other system that needs to be fed with EEG/EMG/ECG real-time data can run with their architecture. + * **Remote board handle:** Same code syntax for developing and debug Cython boards connected to any node in the distributed system. + * **Command-line interface:** A simple interface for handle the start, stop, and access to data stream directly from the command line. + * **Markers/Events handler:** Besides the marker boardmode available in Cyton, a stream channel for the reading and writing of markers is available for use in any development. + * **Multiple boards:** Is possible to use multiple OpenBCI boards just by adding multiple endpoints to the commands. +## Examples +```python +# Acquisition with blocking call +from openbci_stream.acquisition import Cyton +openbci = Cyton('serial', endpoint='/dev/ttyUSB0', capture_stream=True) +# blocking call +openbci.stream(15) # collect data for 15 seconds +# openbci.eeg_time_series +# openbci.aux_time_series +# openbci.timestamp_time_series +``` +```python +# Acquisition with asynchronous call +from openbci_stream.acquisition import Cyton +openbci = Cyton('wifi', endpoint='192.68.1.113', capture_stream=True) +openbci.stream(15) # collect data for 15 seconds +# asynchronous call +openbci.start_stream() +time.sleep(15) # collect data for 15 seconds +openbci.stop_stream() +``` +```python +# Remote acquisition +from openbci_stream.acquisition import Cyton +openbci = Cyton('serial', endpoint='/dev/ttyUSB0', host='192.168.1.1', capture_stream=True) +# blocking call +openbci.stream(15) # collect data for 15 seconds +``` +```python +# Consumer for active streamming +from openbci_stream.acquisition import OpenBCIConsumer +with OpenBCIConsumer() as stream: + for i, message in enumerate(stream): + if message.topic == 'eeg': + print(f"received {message.value['samples']} samples") + if i == 9: + break +``` +```python +# Create stream then consume data +from openbci_stream.acquisition import OpenBCIConsumer +with OpenBCIConsumer(mode='serial', endpoint='/dev/ttyUSB0', streaming_package_size=250) as (stream, openbci): + t0 = time.time() + for i, message in enumerate(stream): + if message.topic == 'eeg': + print(f"{i}: received {message.value['samples']} samples") + t0 = time.time() + if i == 9: + break +``` +```python +# Acquisition with multiple boards +from openbci_stream.acquisition import Cyton +openbci = Cyton('wifi', endpoint=['192.68.1.113', '192.68.1.185'], capture_stream=True) +openbci.stream(15) # collect data for 15 seconds +# asynchronous call +openbci.start_stream() +time.sleep(15) # collect data for 15 seconds +openbci.stop_stream() +``` + +%prep +%autosetup -n openbci-stream-1.0.12 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-openbci-stream -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.12-1 +- Package Spec generated @@ -0,0 +1 @@ +3d0d6e40db0a161c54f6402667bc4ef3 openbci-stream-1.0.12.tar.gz |