biosigio 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. biosigio-1.0.0/LICENSE +29 -0
  2. biosigio-1.0.0/PKG-INFO +248 -0
  3. biosigio-1.0.0/README.md +155 -0
  4. biosigio-1.0.0/biosigio/__init__.py +17 -0
  5. biosigio-1.0.0/biosigio/analysis/__init__.py +16 -0
  6. biosigio-1.0.0/biosigio/analysis/signal.py +348 -0
  7. biosigio-1.0.0/biosigio/analysis/verification.py +212 -0
  8. biosigio-1.0.0/biosigio/bids.py +104 -0
  9. biosigio-1.0.0/biosigio/cli.py +433 -0
  10. biosigio-1.0.0/biosigio/core/__init__.py +0 -0
  11. biosigio-1.0.0/biosigio/core/emg.py +869 -0
  12. biosigio-1.0.0/biosigio/core/modality.py +182 -0
  13. biosigio-1.0.0/biosigio/exporters/__init__.py +0 -0
  14. biosigio-1.0.0/biosigio/exporters/edf.py +658 -0
  15. biosigio-1.0.0/biosigio/exporters/tabular.py +51 -0
  16. biosigio-1.0.0/biosigio/exporters/zarr.py +423 -0
  17. biosigio-1.0.0/biosigio/importers/__init__.py +0 -0
  18. biosigio-1.0.0/biosigio/importers/_mne_common.py +89 -0
  19. biosigio-1.0.0/biosigio/importers/base.py +20 -0
  20. biosigio-1.0.0/biosigio/importers/brainvision.py +63 -0
  21. biosigio-1.0.0/biosigio/importers/csv.py +441 -0
  22. biosigio-1.0.0/biosigio/importers/edf.py +219 -0
  23. biosigio-1.0.0/biosigio/importers/eeglab.py +319 -0
  24. biosigio-1.0.0/biosigio/importers/meg.py +73 -0
  25. biosigio-1.0.0/biosigio/importers/neo.py +252 -0
  26. biosigio-1.0.0/biosigio/importers/otb.py +308 -0
  27. biosigio-1.0.0/biosigio/importers/tabular.py +36 -0
  28. biosigio-1.0.0/biosigio/importers/trigno.py +132 -0
  29. biosigio-1.0.0/biosigio/importers/wfdb.py +152 -0
  30. biosigio-1.0.0/biosigio/importers/xdf.py +1026 -0
  31. biosigio-1.0.0/biosigio/importers/zarr.py +138 -0
  32. biosigio-1.0.0/biosigio/tabular_schema.py +180 -0
  33. biosigio-1.0.0/biosigio/tests/__init__.py +0 -0
  34. biosigio-1.0.0/biosigio/tests/test_bids_channels_tsv.py +41 -0
  35. biosigio-1.0.0/biosigio/tests/test_brainvision_importer.py +73 -0
  36. biosigio-1.0.0/biosigio/tests/test_cli.py +208 -0
  37. biosigio-1.0.0/biosigio/tests/test_core.py +611 -0
  38. biosigio-1.0.0/biosigio/tests/test_edf_roundtrip.py +55 -0
  39. biosigio-1.0.0/biosigio/tests/test_edf_scaling.py +294 -0
  40. biosigio-1.0.0/biosigio/tests/test_eeglab_bids_fixture.py +47 -0
  41. biosigio-1.0.0/biosigio/tests/test_eeglab_importer.py +244 -0
  42. biosigio-1.0.0/biosigio/tests/test_exporters.py +884 -0
  43. biosigio-1.0.0/biosigio/tests/test_importer_wfdb.py +149 -0
  44. biosigio-1.0.0/biosigio/tests/test_importers.py +542 -0
  45. biosigio-1.0.0/biosigio/tests/test_lowres.py +232 -0
  46. biosigio-1.0.0/biosigio/tests/test_meg_importer.py +90 -0
  47. biosigio-1.0.0/biosigio/tests/test_modality.py +90 -0
  48. biosigio-1.0.0/biosigio/tests/test_modality_integration.py +79 -0
  49. biosigio-1.0.0/biosigio/tests/test_neo_importer.py +211 -0
  50. biosigio-1.0.0/biosigio/tests/test_recording.py +39 -0
  51. biosigio-1.0.0/biosigio/tests/test_roundtrip.py +205 -0
  52. biosigio-1.0.0/biosigio/tests/test_serialization.py +131 -0
  53. biosigio-1.0.0/biosigio/tests/test_tabular.py +102 -0
  54. biosigio-1.0.0/biosigio/tests/test_verification.py +356 -0
  55. biosigio-1.0.0/biosigio/tests/test_visualization.py +306 -0
  56. biosigio-1.0.0/biosigio/tests/test_xdf_importer.py +498 -0
  57. biosigio-1.0.0/biosigio/tests/test_zarr.py +208 -0
  58. biosigio-1.0.0/biosigio/utils/__init__.py +0 -0
  59. biosigio-1.0.0/biosigio/version.py +14 -0
  60. biosigio-1.0.0/biosigio/visualization/__init__.py +6 -0
  61. biosigio-1.0.0/biosigio/visualization/static.py +324 -0
  62. biosigio-1.0.0/biosigio.egg-info/PKG-INFO +248 -0
  63. biosigio-1.0.0/biosigio.egg-info/SOURCES.txt +67 -0
  64. biosigio-1.0.0/biosigio.egg-info/dependency_links.txt +1 -0
  65. biosigio-1.0.0/biosigio.egg-info/entry_points.txt +2 -0
  66. biosigio-1.0.0/biosigio.egg-info/requires.txt +40 -0
  67. biosigio-1.0.0/biosigio.egg-info/top_level.txt +1 -0
  68. biosigio-1.0.0/pyproject.toml +162 -0
  69. biosigio-1.0.0/setup.cfg +4 -0
biosigio-1.0.0/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Swartz Center for Computational Neuroscience
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.4
2
+ Name: biosigio
3
+ Version: 1.0.0
4
+ Summary: A Python package for EMG data import/export and manipulation with unified interface for various EMG systems
5
+ Author-email: Seyed Yahya Shirazi <shirazi@ieee.org>
6
+ Maintainer-email: Seyed Yahya Shirazi <shirazi@ieee.org>
7
+ License: BSD 3-Clause License
8
+
9
+ Copyright (c) 2024, Swartz Center for Computational Neuroscience
10
+ All rights reserved.
11
+
12
+ Redistribution and use in source and binary forms, with or without
13
+ modification, are permitted provided that the following conditions are met:
14
+
15
+ 1. Redistributions of source code must retain the above copyright notice, this
16
+ list of conditions and the following disclaimer.
17
+
18
+ 2. Redistributions in binary form must reproduce the above copyright notice,
19
+ this list of conditions and the following disclaimer in the documentation
20
+ and/or other materials provided with the distribution.
21
+
22
+ 3. Neither the name of the copyright holder nor the names of its
23
+ contributors may be used to endorse or promote products derived from
24
+ this software without specific prior written permission.
25
+
26
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+
37
+ Project-URL: Homepage, https://github.com/neuromechanist/biosigio
38
+ Project-URL: Documentation, https://neuromechanist.github.io/biosigio/
39
+ Project-URL: Repository, https://github.com/neuromechanist/biosigio
40
+ Project-URL: Issues, https://github.com/neuromechanist/biosigio/issues
41
+ Project-URL: Changelog, https://github.com/neuromechanist/biosigio/releases
42
+ Keywords: emg,electromyography,biosignal,edf,bdf,wfdb,trigno,delsys,neuroscience,signal-processing
43
+ Classifier: Development Status :: 4 - Beta
44
+ Classifier: Intended Audience :: Science/Research
45
+ Classifier: Intended Audience :: Healthcare Industry
46
+ Classifier: License :: OSI Approved :: BSD License
47
+ Classifier: Operating System :: OS Independent
48
+ Classifier: Programming Language :: Python :: 3
49
+ Classifier: Programming Language :: Python :: 3.11
50
+ Classifier: Programming Language :: Python :: 3.12
51
+ Classifier: Programming Language :: Python :: 3.13
52
+ Classifier: Programming Language :: Python :: 3.14
53
+ Classifier: Topic :: Scientific/Engineering
54
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
55
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
56
+ Requires-Python: >=3.11
57
+ Description-Content-Type: text/markdown
58
+ License-File: LICENSE
59
+ Requires-Dist: numpy>=1.20.0
60
+ Requires-Dist: pandas>=1.3.0
61
+ Requires-Dist: scipy>=1.7.0
62
+ Requires-Dist: matplotlib>=3.4.0
63
+ Requires-Dist: pyedflib>=0.1.30
64
+ Requires-Dist: wfdb>=4.0.0
65
+ Requires-Dist: pyxdf>=1.16.0
66
+ Provides-Extra: meg
67
+ Requires-Dist: mne>=1.6; extra == "meg"
68
+ Provides-Extra: arrow
69
+ Requires-Dist: pyarrow>=14; extra == "arrow"
70
+ Provides-Extra: neo
71
+ Requires-Dist: neo>=0.13; extra == "neo"
72
+ Provides-Extra: zarr
73
+ Requires-Dist: zarr>=3; extra == "zarr"
74
+ Provides-Extra: dev
75
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
76
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
77
+ Requires-Dist: ruff>=0.14; extra == "dev"
78
+ Requires-Dist: ty; extra == "dev"
79
+ Requires-Dist: mne>=1.6; extra == "dev"
80
+ Requires-Dist: pyarrow>=14; extra == "dev"
81
+ Requires-Dist: neo>=0.13; extra == "dev"
82
+ Requires-Dist: zarr>=3; extra == "dev"
83
+ Provides-Extra: docs
84
+ Requires-Dist: mkdocs>=1.6.0; extra == "docs"
85
+ Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
86
+ Requires-Dist: mkdocstrings[python]>=1.0.0; extra == "docs"
87
+ Requires-Dist: pymdown-extensions>=10.10.0; extra == "docs"
88
+ Requires-Dist: mkdocs-jupyter>=0.25.0; extra == "docs"
89
+ Requires-Dist: mike>=2.1.0; extra == "docs"
90
+ Provides-Extra: all
91
+ Requires-Dist: biosigio[arrow,dev,docs,meg,neo,zarr]; extra == "all"
92
+ Dynamic: license-file
93
+
94
+ # biosigIO
95
+
96
+ [![PyPI version](https://badge.fury.io/py/biosigio.svg)](https://badge.fury.io/py/biosigio)
97
+ [![Tests](https://github.com/neuromechanist/biosigio/actions/workflows/tests.yml/badge.svg)](https://github.com/neuromechanist/biosigio/actions/workflows/tests.yml)
98
+ [![codecov](https://codecov.io/gh/neuromechanist/biosigio/branch/main/graph/badge.svg?token=63EDIA9TWD)](https://codecov.io/gh/neuromechanist/biosigio)
99
+
100
+ A Python package for biosignal import/export and manipulation across modalities (EEG, EMG, iEEG, MEG, and behavioral/marker streams). biosigIO provides a unified `Recording` interface for loading data from many acquisition systems and archives (EEGLAB, Delsys Trigno, OTB, EDF/BDF, WFDB, XDF, MEG/CTF and BrainVision via MNE, and proprietary electrophysiology such as Intan/Blackrock via python-neo) and exporting it to standardized and serving formats (EDF/BDF, Parquet, Arrow, Zarr) with harmonized metadata.
101
+
102
+ The determination of the EDF/BDF format is based on the dynamic range of the data. If the data is within the range of 16-bit integers (~90dB), the EDF format is used. Otherwise, the BDF format is used. This is to ensure that the data is stored in the most efficient format possible. This determination is made automatically using SVD decomposition and/or FFT to determine the dynamic range of the data. (Alternatively, the user can override the format selection by explicitly indicating their desired format).
103
+
104
+ ## Documentation
105
+
106
+ The documentation including installation instructions, examples, and API reference is available at [https://neuromechanist.github.io/biosigio/](https://neuromechanist.github.io/biosigio/).
107
+
108
+ ## Features
109
+
110
+ - Import biosignal recordings from many systems and archives:
111
+ - EEGLAB set files (supported)
112
+ - Delsys Trigno (supported)
113
+ - OTB Systems (supported)
114
+ - EDF/BDF(+) (supported, including annotations)
115
+ - WFDB (supported, including annotations)
116
+ - XDF/Lab Streaming Layer (supported, multi-stream)
117
+ - MEG: `.fif` and CTF `.ds` via MNE (supported; `meg` extra)
118
+ - BrainVision `.vhdr` via MNE (supported; `meg` extra)
119
+ - Proprietary electrophysiology via python-neo: Intan, Blackrock, Spike2, Plexon, Micromed, Neuralynx (supported; `neo` extra)
120
+ - Generic CSV (supported with auto-detection)
121
+ - Noraxon (planned)
122
+
123
+ - Smart import:
124
+ - Automatic file format detection based on extension
125
+ - Specialized format detection for CSV files
126
+ - Custom importers for system-specific formats
127
+ - Automatic annotation loading (WFDB, planned for EDF+/BDF+ and EEGLAB's .set files)
128
+ - LSL timestamp preservation for XDF files (for synchronization)
129
+
130
+ - Export to standardized formats:
131
+ - EDF/BDF(+) with channels.tsv metadata (automatically selects format based on signal properties, preserves annotations)
132
+
133
+ - Serialization & serving (see [docs](https://neuromechanist.github.io/biosigio/formats/serialization/)):
134
+ - Parquet and Arrow/Feather: lossless columnar round-trip (analytics, fast IPC); requires the `arrow` extra
135
+ - Zarr: cloud-native serving store (one store serves viewing, inference, and training), a derived downsampled copy; requires the `zarr` extra
136
+
137
+ - Data manipulation:
138
+ - Channel selection
139
+ - Metadata handling
140
+ - Event/Annotation handling (access, add)
141
+ - Basic signal visualization
142
+ - Raw data access and modification
143
+
144
+ ## Installation
145
+
146
+ biosigIO uses [UV](https://docs.astral.sh/uv/) for Python environment and package management.
147
+
148
+ ### From PyPI (recommended)
149
+
150
+ ```bash
151
+ uv pip install biosigio
152
+ ```
153
+
154
+ (If your own project is uv-managed, use `uv add biosigio` to track it as a dependency.)
155
+
156
+ ### From source
157
+
158
+ ```bash
159
+ git clone https://github.com/neuromechanist/biosigio.git
160
+ cd biosigio
161
+ uv pip install .
162
+ ```
163
+
164
+ ## Usage
165
+
166
+ ### Basic Example
167
+
168
+ ```python
169
+ from biosigio import Recording
170
+
171
+ # Load data with automatic format detection
172
+ emg = Recording.from_file('data.csv') # Format detected from file extension
173
+
174
+ # Load data with explicit importer
175
+ emg = Recording.from_file('data.csv', importer='trigno')
176
+
177
+ # Plot specific channels
178
+ emg.plot_signals(['EMG1', 'EMG2'])
179
+
180
+ # Export to EDF or BDF (format automatically determined)
181
+ emg.to_edf('output.edf')
182
+ ```
183
+
184
+ ### Generic CSV Import
185
+
186
+ ```python
187
+ # Import a generic CSV file
188
+ emg = Recording.from_file('data.csv', importer='csv',
189
+ sample_frequency=1000, # Required if no time column
190
+ has_header=True, # Whether file has header row
191
+ channel_names=['EMG_L', 'EMG_R', 'ACC_X'])
192
+ ```
193
+
194
+ ### Channel Selection
195
+
196
+ ```python
197
+ # Select specific channels
198
+ subset_emg = emg.select_channels(['EMG1', 'EMG2', 'ACC1'])
199
+
200
+ # Select all channels of a specific type
201
+ emg_only = emg.select_channels(channel_type='EMG')
202
+
203
+ # Plot selected channels
204
+ subset_emg.plot_signals()
205
+ ```
206
+
207
+ ### Metadata Handling
208
+
209
+ ```python
210
+ # Set metadata
211
+ emg.set_metadata('subject', 'S001')
212
+ emg.set_metadata('condition', 'resting')
213
+
214
+ # Get metadata
215
+ subject = emg.get_metadata('subject')
216
+ ```
217
+
218
+ ## Development
219
+
220
+ ### Setup
221
+
222
+ 1. Clone the repository:
223
+ ```bash
224
+ git clone https://github.com/neuromechanist/biosigio.git
225
+ cd biosigio
226
+ ```
227
+
228
+ 2. Install for development (editable install with dev dependencies):
229
+ ```bash
230
+ uv sync --extra dev
231
+ ```
232
+
233
+ ### Running Tests
234
+
235
+ ```bash
236
+ uv run pytest
237
+ ```
238
+
239
+ ## Contributing
240
+
241
+ Contributions are welcome! Please feel free to submit a Pull Request.
242
+
243
+ ## License
244
+
245
+ This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
246
+
247
+ ## Acknowledgment
248
+ This project is partially supported by a Meta Reality Labs gift to @sccn and NIH 5R01NS047293.
@@ -0,0 +1,155 @@
1
+ # biosigIO
2
+
3
+ [![PyPI version](https://badge.fury.io/py/biosigio.svg)](https://badge.fury.io/py/biosigio)
4
+ [![Tests](https://github.com/neuromechanist/biosigio/actions/workflows/tests.yml/badge.svg)](https://github.com/neuromechanist/biosigio/actions/workflows/tests.yml)
5
+ [![codecov](https://codecov.io/gh/neuromechanist/biosigio/branch/main/graph/badge.svg?token=63EDIA9TWD)](https://codecov.io/gh/neuromechanist/biosigio)
6
+
7
+ A Python package for biosignal import/export and manipulation across modalities (EEG, EMG, iEEG, MEG, and behavioral/marker streams). biosigIO provides a unified `Recording` interface for loading data from many acquisition systems and archives (EEGLAB, Delsys Trigno, OTB, EDF/BDF, WFDB, XDF, MEG/CTF and BrainVision via MNE, and proprietary electrophysiology such as Intan/Blackrock via python-neo) and exporting it to standardized and serving formats (EDF/BDF, Parquet, Arrow, Zarr) with harmonized metadata.
8
+
9
+ The determination of the EDF/BDF format is based on the dynamic range of the data. If the data is within the range of 16-bit integers (~90dB), the EDF format is used. Otherwise, the BDF format is used. This is to ensure that the data is stored in the most efficient format possible. This determination is made automatically using SVD decomposition and/or FFT to determine the dynamic range of the data. (Alternatively, the user can override the format selection by explicitly indicating their desired format).
10
+
11
+ ## Documentation
12
+
13
+ The documentation including installation instructions, examples, and API reference is available at [https://neuromechanist.github.io/biosigio/](https://neuromechanist.github.io/biosigio/).
14
+
15
+ ## Features
16
+
17
+ - Import biosignal recordings from many systems and archives:
18
+ - EEGLAB set files (supported)
19
+ - Delsys Trigno (supported)
20
+ - OTB Systems (supported)
21
+ - EDF/BDF(+) (supported, including annotations)
22
+ - WFDB (supported, including annotations)
23
+ - XDF/Lab Streaming Layer (supported, multi-stream)
24
+ - MEG: `.fif` and CTF `.ds` via MNE (supported; `meg` extra)
25
+ - BrainVision `.vhdr` via MNE (supported; `meg` extra)
26
+ - Proprietary electrophysiology via python-neo: Intan, Blackrock, Spike2, Plexon, Micromed, Neuralynx (supported; `neo` extra)
27
+ - Generic CSV (supported with auto-detection)
28
+ - Noraxon (planned)
29
+
30
+ - Smart import:
31
+ - Automatic file format detection based on extension
32
+ - Specialized format detection for CSV files
33
+ - Custom importers for system-specific formats
34
+ - Automatic annotation loading (WFDB, planned for EDF+/BDF+ and EEGLAB's .set files)
35
+ - LSL timestamp preservation for XDF files (for synchronization)
36
+
37
+ - Export to standardized formats:
38
+ - EDF/BDF(+) with channels.tsv metadata (automatically selects format based on signal properties, preserves annotations)
39
+
40
+ - Serialization & serving (see [docs](https://neuromechanist.github.io/biosigio/formats/serialization/)):
41
+ - Parquet and Arrow/Feather: lossless columnar round-trip (analytics, fast IPC); requires the `arrow` extra
42
+ - Zarr: cloud-native serving store (one store serves viewing, inference, and training), a derived downsampled copy; requires the `zarr` extra
43
+
44
+ - Data manipulation:
45
+ - Channel selection
46
+ - Metadata handling
47
+ - Event/Annotation handling (access, add)
48
+ - Basic signal visualization
49
+ - Raw data access and modification
50
+
51
+ ## Installation
52
+
53
+ biosigIO uses [UV](https://docs.astral.sh/uv/) for Python environment and package management.
54
+
55
+ ### From PyPI (recommended)
56
+
57
+ ```bash
58
+ uv pip install biosigio
59
+ ```
60
+
61
+ (If your own project is uv-managed, use `uv add biosigio` to track it as a dependency.)
62
+
63
+ ### From source
64
+
65
+ ```bash
66
+ git clone https://github.com/neuromechanist/biosigio.git
67
+ cd biosigio
68
+ uv pip install .
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ ### Basic Example
74
+
75
+ ```python
76
+ from biosigio import Recording
77
+
78
+ # Load data with automatic format detection
79
+ emg = Recording.from_file('data.csv') # Format detected from file extension
80
+
81
+ # Load data with explicit importer
82
+ emg = Recording.from_file('data.csv', importer='trigno')
83
+
84
+ # Plot specific channels
85
+ emg.plot_signals(['EMG1', 'EMG2'])
86
+
87
+ # Export to EDF or BDF (format automatically determined)
88
+ emg.to_edf('output.edf')
89
+ ```
90
+
91
+ ### Generic CSV Import
92
+
93
+ ```python
94
+ # Import a generic CSV file
95
+ emg = Recording.from_file('data.csv', importer='csv',
96
+ sample_frequency=1000, # Required if no time column
97
+ has_header=True, # Whether file has header row
98
+ channel_names=['EMG_L', 'EMG_R', 'ACC_X'])
99
+ ```
100
+
101
+ ### Channel Selection
102
+
103
+ ```python
104
+ # Select specific channels
105
+ subset_emg = emg.select_channels(['EMG1', 'EMG2', 'ACC1'])
106
+
107
+ # Select all channels of a specific type
108
+ emg_only = emg.select_channels(channel_type='EMG')
109
+
110
+ # Plot selected channels
111
+ subset_emg.plot_signals()
112
+ ```
113
+
114
+ ### Metadata Handling
115
+
116
+ ```python
117
+ # Set metadata
118
+ emg.set_metadata('subject', 'S001')
119
+ emg.set_metadata('condition', 'resting')
120
+
121
+ # Get metadata
122
+ subject = emg.get_metadata('subject')
123
+ ```
124
+
125
+ ## Development
126
+
127
+ ### Setup
128
+
129
+ 1. Clone the repository:
130
+ ```bash
131
+ git clone https://github.com/neuromechanist/biosigio.git
132
+ cd biosigio
133
+ ```
134
+
135
+ 2. Install for development (editable install with dev dependencies):
136
+ ```bash
137
+ uv sync --extra dev
138
+ ```
139
+
140
+ ### Running Tests
141
+
142
+ ```bash
143
+ uv run pytest
144
+ ```
145
+
146
+ ## Contributing
147
+
148
+ Contributions are welcome! Please feel free to submit a Pull Request.
149
+
150
+ ## License
151
+
152
+ This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
153
+
154
+ ## Acknowledgment
155
+ This project is partially supported by a Meta Reality Labs gift to @sccn and NIH 5R01NS047293.
@@ -0,0 +1,17 @@
1
+ """biosigIO: import/export biosignal recordings across formats.
2
+
3
+ The core class is :class:`Recording` (modality-agnostic: EEG/EMG/iEEG/MEG/...).
4
+ """
5
+
6
+ from .core.emg import Recording
7
+ from .exporters.edf import EDFExporter
8
+ from .importers.trigno import TrignoImporter
9
+ from .version import __version__, __version_info__
10
+
11
+ __all__ = [
12
+ "Recording",
13
+ "TrignoImporter",
14
+ "EDFExporter",
15
+ "__version__",
16
+ "__version_info__",
17
+ ]
@@ -0,0 +1,16 @@
1
+ # Signal analysis module
2
+
3
+ from .signal import (
4
+ analyze_signal,
5
+ determine_format_suitability,
6
+ quantization_analysis,
7
+ # Add other signal analysis functions if needed
8
+ )
9
+ from .verification import compare_signals
10
+
11
+ __all__ = [
12
+ "analyze_signal",
13
+ "determine_format_suitability",
14
+ "quantization_analysis",
15
+ "compare_signals", # Add to __all__
16
+ ]