py-neuromodulation 0.0.3__py3-none-any.whl → 0.0.4__py3-none-any.whl

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 (176) hide show
  1. py_neuromodulation/ConnectivityDecoding/Automated Anatomical Labeling 3 (Rolls 2020).nii +0 -0
  2. py_neuromodulation/ConnectivityDecoding/_get_grid_hull.m +34 -0
  3. py_neuromodulation/ConnectivityDecoding/_get_grid_whole_brain.py +106 -0
  4. py_neuromodulation/ConnectivityDecoding/_helper_write_connectome.py +119 -0
  5. py_neuromodulation/ConnectivityDecoding/mni_coords_cortical_surface.mat +0 -0
  6. py_neuromodulation/ConnectivityDecoding/mni_coords_whole_brain.mat +0 -0
  7. py_neuromodulation/ConnectivityDecoding/rmap_func_all.nii +0 -0
  8. py_neuromodulation/ConnectivityDecoding/rmap_struc.nii +0 -0
  9. py_neuromodulation/data/README +6 -0
  10. py_neuromodulation/data/dataset_description.json +8 -0
  11. py_neuromodulation/data/participants.json +32 -0
  12. py_neuromodulation/data/participants.tsv +2 -0
  13. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_coordsystem.json +5 -0
  14. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_electrodes.tsv +11 -0
  15. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_channels.tsv +11 -0
  16. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.eeg +0 -0
  17. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.json +18 -0
  18. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vhdr +35 -0
  19. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vmrk +13 -0
  20. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/sub-testsub_ses-EphysMedOff_scans.tsv +2 -0
  21. py_neuromodulation/grid_cortex.tsv +40 -0
  22. py_neuromodulation/grid_subcortex.tsv +1429 -0
  23. py_neuromodulation/nm_settings.json +338 -0
  24. py_neuromodulation/nm_stream_offline.py +7 -6
  25. py_neuromodulation/plots/STN_surf.mat +0 -0
  26. py_neuromodulation/plots/Vertices.mat +0 -0
  27. py_neuromodulation/plots/faces.mat +0 -0
  28. py_neuromodulation/plots/grid.mat +0 -0
  29. {py_neuromodulation-0.0.3.dist-info → py_neuromodulation-0.0.4.dist-info}/METADATA +182 -182
  30. py_neuromodulation-0.0.4.dist-info/RECORD +72 -0
  31. {py_neuromodulation-0.0.3.dist-info → py_neuromodulation-0.0.4.dist-info}/WHEEL +1 -2
  32. docs/build/_downloads/09df217f95985497f45d69e2d4bdc5b1/plot_2_example_add_feature.py +0 -68
  33. docs/build/_downloads/3b4900a2b2818ff30362215b76f7d5eb/plot_1_example_BIDS.py +0 -233
  34. docs/build/_downloads/7e92dd2e6cc86b239d14cafad972ae4f/plot_3_example_sharpwave_analysis.py +0 -219
  35. docs/build/_downloads/c2db0bf2b334d541b00662b991682256/plot_6_real_time_demo.py +0 -97
  36. docs/build/_downloads/ce3914826f782cbd1ea8fd024eaf0ac3/plot_5_example_rmap_computing.py +0 -64
  37. docs/build/_downloads/da36848a41e6a3235d91fb7cfb6d59b4/plot_0_first_demo.py +0 -192
  38. docs/build/_downloads/eaa4305c75b19a1e2eea941f742a6331/plot_4_example_gridPointProjection.py +0 -210
  39. docs/build/html/_downloads/09df217f95985497f45d69e2d4bdc5b1/plot_2_example_add_feature.py +0 -68
  40. docs/build/html/_downloads/3b4900a2b2818ff30362215b76f7d5eb/plot_1_example_BIDS.py +0 -239
  41. docs/build/html/_downloads/7e92dd2e6cc86b239d14cafad972ae4f/plot_3_example_sharpwave_analysis.py +0 -219
  42. docs/build/html/_downloads/c2db0bf2b334d541b00662b991682256/plot_6_real_time_demo.py +0 -97
  43. docs/build/html/_downloads/ce3914826f782cbd1ea8fd024eaf0ac3/plot_5_example_rmap_computing.py +0 -64
  44. docs/build/html/_downloads/da36848a41e6a3235d91fb7cfb6d59b4/plot_0_first_demo.py +0 -192
  45. docs/build/html/_downloads/eaa4305c75b19a1e2eea941f742a6331/plot_4_example_gridPointProjection.py +0 -210
  46. docs/source/_build/html/_downloads/09df217f95985497f45d69e2d4bdc5b1/plot_2_example_add_feature.py +0 -76
  47. docs/source/_build/html/_downloads/0d0d0a76e8f648d5d3cbc47da6351932/plot_real_time_demo.py +0 -97
  48. docs/source/_build/html/_downloads/3b4900a2b2818ff30362215b76f7d5eb/plot_1_example_BIDS.py +0 -240
  49. docs/source/_build/html/_downloads/5d73cadc59a8805c47e3b84063afc157/plot_example_BIDS.py +0 -233
  50. docs/source/_build/html/_downloads/7660317fa5a6bfbd12fcca9961457fc4/plot_example_rmap_computing.py +0 -63
  51. docs/source/_build/html/_downloads/7e92dd2e6cc86b239d14cafad972ae4f/plot_3_example_sharpwave_analysis.py +0 -219
  52. docs/source/_build/html/_downloads/839e5b319379f7fd9e867deb00fd797f/plot_example_gridPointProjection.py +0 -210
  53. docs/source/_build/html/_downloads/ae8be19afe5e559f011fc9b138968ba0/plot_first_demo.py +0 -192
  54. docs/source/_build/html/_downloads/b8b06cacc17969d3725a0b6f1d7741c5/plot_example_sharpwave_analysis.py +0 -219
  55. docs/source/_build/html/_downloads/c2db0bf2b334d541b00662b991682256/plot_6_real_time_demo.py +0 -121
  56. docs/source/_build/html/_downloads/c31a86c0b68cb4167d968091ace8080d/plot_example_add_feature.py +0 -68
  57. docs/source/_build/html/_downloads/ce3914826f782cbd1ea8fd024eaf0ac3/plot_5_example_rmap_computing.py +0 -64
  58. docs/source/_build/html/_downloads/da36848a41e6a3235d91fb7cfb6d59b4/plot_0_first_demo.py +0 -189
  59. docs/source/_build/html/_downloads/eaa4305c75b19a1e2eea941f742a6331/plot_4_example_gridPointProjection.py +0 -210
  60. docs/source/auto_examples/plot_0_first_demo.py +0 -189
  61. docs/source/auto_examples/plot_1_example_BIDS.py +0 -240
  62. docs/source/auto_examples/plot_2_example_add_feature.py +0 -76
  63. docs/source/auto_examples/plot_3_example_sharpwave_analysis.py +0 -219
  64. docs/source/auto_examples/plot_4_example_gridPointProjection.py +0 -210
  65. docs/source/auto_examples/plot_5_example_rmap_computing.py +0 -64
  66. docs/source/auto_examples/plot_6_real_time_demo.py +0 -121
  67. docs/source/conf.py +0 -105
  68. examples/plot_0_first_demo.py +0 -189
  69. examples/plot_1_example_BIDS.py +0 -240
  70. examples/plot_2_example_add_feature.py +0 -76
  71. examples/plot_3_example_sharpwave_analysis.py +0 -219
  72. examples/plot_4_example_gridPointProjection.py +0 -210
  73. examples/plot_5_example_rmap_computing.py +0 -64
  74. examples/plot_6_real_time_demo.py +0 -121
  75. packages/realtime_decoding/build/lib/realtime_decoding/__init__.py +0 -4
  76. packages/realtime_decoding/build/lib/realtime_decoding/decoder.py +0 -104
  77. packages/realtime_decoding/build/lib/realtime_decoding/features.py +0 -163
  78. packages/realtime_decoding/build/lib/realtime_decoding/helpers.py +0 -15
  79. packages/realtime_decoding/build/lib/realtime_decoding/run_decoding.py +0 -345
  80. packages/realtime_decoding/build/lib/realtime_decoding/trainer.py +0 -54
  81. packages/tmsi/build/lib/TMSiFileFormats/__init__.py +0 -37
  82. packages/tmsi/build/lib/TMSiFileFormats/file_formats/__init__.py +0 -36
  83. packages/tmsi/build/lib/TMSiFileFormats/file_formats/lsl_stream_writer.py +0 -200
  84. packages/tmsi/build/lib/TMSiFileFormats/file_formats/poly5_file_writer.py +0 -496
  85. packages/tmsi/build/lib/TMSiFileFormats/file_formats/poly5_to_edf_converter.py +0 -236
  86. packages/tmsi/build/lib/TMSiFileFormats/file_formats/xdf_file_writer.py +0 -977
  87. packages/tmsi/build/lib/TMSiFileFormats/file_readers/__init__.py +0 -35
  88. packages/tmsi/build/lib/TMSiFileFormats/file_readers/edf_reader.py +0 -116
  89. packages/tmsi/build/lib/TMSiFileFormats/file_readers/poly5reader.py +0 -294
  90. packages/tmsi/build/lib/TMSiFileFormats/file_readers/xdf_reader.py +0 -229
  91. packages/tmsi/build/lib/TMSiFileFormats/file_writer.py +0 -102
  92. packages/tmsi/build/lib/TMSiPlotters/__init__.py +0 -2
  93. packages/tmsi/build/lib/TMSiPlotters/gui/__init__.py +0 -39
  94. packages/tmsi/build/lib/TMSiPlotters/gui/_plotter_gui.py +0 -234
  95. packages/tmsi/build/lib/TMSiPlotters/gui/plotting_gui.py +0 -440
  96. packages/tmsi/build/lib/TMSiPlotters/plotters/__init__.py +0 -44
  97. packages/tmsi/build/lib/TMSiPlotters/plotters/hd_emg_plotter.py +0 -446
  98. packages/tmsi/build/lib/TMSiPlotters/plotters/impedance_plotter.py +0 -589
  99. packages/tmsi/build/lib/TMSiPlotters/plotters/signal_plotter.py +0 -1326
  100. packages/tmsi/build/lib/TMSiSDK/__init__.py +0 -54
  101. packages/tmsi/build/lib/TMSiSDK/device.py +0 -588
  102. packages/tmsi/build/lib/TMSiSDK/devices/__init__.py +0 -34
  103. packages/tmsi/build/lib/TMSiSDK/devices/saga/TMSi_Device_API.py +0 -1764
  104. packages/tmsi/build/lib/TMSiSDK/devices/saga/__init__.py +0 -34
  105. packages/tmsi/build/lib/TMSiSDK/devices/saga/saga_device.py +0 -1366
  106. packages/tmsi/build/lib/TMSiSDK/devices/saga/saga_types.py +0 -520
  107. packages/tmsi/build/lib/TMSiSDK/devices/saga/xml_saga_config.py +0 -165
  108. packages/tmsi/build/lib/TMSiSDK/error.py +0 -95
  109. packages/tmsi/build/lib/TMSiSDK/sample_data.py +0 -63
  110. packages/tmsi/build/lib/TMSiSDK/sample_data_server.py +0 -99
  111. packages/tmsi/build/lib/TMSiSDK/settings.py +0 -45
  112. packages/tmsi/build/lib/TMSiSDK/tmsi_device.py +0 -111
  113. packages/tmsi/build/lib/__init__.py +0 -4
  114. packages/tmsi/build/lib/apex_sdk/__init__.py +0 -34
  115. packages/tmsi/build/lib/apex_sdk/device/__init__.py +0 -41
  116. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_API.py +0 -1009
  117. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_API_enums.py +0 -239
  118. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_API_structures.py +0 -668
  119. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_device.py +0 -1611
  120. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_dongle.py +0 -38
  121. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_event_reader.py +0 -57
  122. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_structures/apex_channel.py +0 -44
  123. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_structures/apex_config.py +0 -150
  124. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_structures/apex_const.py +0 -36
  125. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_structures/apex_impedance_channel.py +0 -48
  126. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_structures/apex_info.py +0 -108
  127. packages/tmsi/build/lib/apex_sdk/device/devices/apex/apex_structures/dongle_info.py +0 -39
  128. packages/tmsi/build/lib/apex_sdk/device/devices/apex/measurements/download_measurement.py +0 -77
  129. packages/tmsi/build/lib/apex_sdk/device/devices/apex/measurements/eeg_measurement.py +0 -150
  130. packages/tmsi/build/lib/apex_sdk/device/devices/apex/measurements/impedance_measurement.py +0 -129
  131. packages/tmsi/build/lib/apex_sdk/device/threads/conversion_thread.py +0 -59
  132. packages/tmsi/build/lib/apex_sdk/device/threads/sampling_thread.py +0 -57
  133. packages/tmsi/build/lib/apex_sdk/device/tmsi_channel.py +0 -83
  134. packages/tmsi/build/lib/apex_sdk/device/tmsi_device.py +0 -201
  135. packages/tmsi/build/lib/apex_sdk/device/tmsi_device_enums.py +0 -103
  136. packages/tmsi/build/lib/apex_sdk/device/tmsi_dongle.py +0 -43
  137. packages/tmsi/build/lib/apex_sdk/device/tmsi_event_reader.py +0 -50
  138. packages/tmsi/build/lib/apex_sdk/device/tmsi_measurement.py +0 -118
  139. packages/tmsi/build/lib/apex_sdk/sample_data_server/__init__.py +0 -33
  140. packages/tmsi/build/lib/apex_sdk/sample_data_server/event_data.py +0 -44
  141. packages/tmsi/build/lib/apex_sdk/sample_data_server/sample_data.py +0 -50
  142. packages/tmsi/build/lib/apex_sdk/sample_data_server/sample_data_server.py +0 -136
  143. packages/tmsi/build/lib/apex_sdk/tmsi_errors/error.py +0 -126
  144. packages/tmsi/build/lib/apex_sdk/tmsi_sdk.py +0 -113
  145. packages/tmsi/build/lib/apex_sdk/tmsi_utilities/apex/apex_structure_generator.py +0 -134
  146. packages/tmsi/build/lib/apex_sdk/tmsi_utilities/decorators.py +0 -60
  147. packages/tmsi/build/lib/apex_sdk/tmsi_utilities/logger_filter.py +0 -42
  148. packages/tmsi/build/lib/apex_sdk/tmsi_utilities/singleton.py +0 -42
  149. packages/tmsi/build/lib/apex_sdk/tmsi_utilities/support_functions.py +0 -72
  150. packages/tmsi/build/lib/apex_sdk/tmsi_utilities/tmsi_logger.py +0 -98
  151. py_neuromodulation-0.0.3.dist-info/RECORD +0 -188
  152. py_neuromodulation-0.0.3.dist-info/top_level.txt +0 -5
  153. tests/__init__.py +0 -0
  154. tests/conftest.py +0 -117
  155. tests/test_all_examples.py +0 -10
  156. tests/test_all_features.py +0 -63
  157. tests/test_bispectra.py +0 -70
  158. tests/test_bursts.py +0 -105
  159. tests/test_feature_sampling_rates.py +0 -143
  160. tests/test_fooof.py +0 -16
  161. tests/test_initalization_offline_stream.py +0 -41
  162. tests/test_multiprocessing.py +0 -58
  163. tests/test_nan_values.py +0 -29
  164. tests/test_nm_filter.py +0 -95
  165. tests/test_nm_resample.py +0 -63
  166. tests/test_normalization_settings.py +0 -146
  167. tests/test_notch_filter.py +0 -31
  168. tests/test_osc_features.py +0 -424
  169. tests/test_preprocessing_filter.py +0 -151
  170. tests/test_rereference.py +0 -171
  171. tests/test_sampling.py +0 -57
  172. tests/test_settings_change_after_init.py +0 -76
  173. tests/test_sharpwave.py +0 -165
  174. tests/test_target_channel_add.py +0 -100
  175. tests/test_timing.py +0 -80
  176. {py_neuromodulation-0.0.3.dist-info → py_neuromodulation-0.0.4.dist-info/licenses}/LICENSE +0 -0
@@ -1,182 +1,182 @@
1
- Metadata-Version: 2.1
2
- Name: py_neuromodulation
3
- Version: 0.0.3
4
- Summary: Real-time analysis of intracranial neurophysiology recordings.
5
- Author-email: Timon Merk <timon.merk@charite.de>
6
- Maintainer: Timon Merk
7
- License: MIT License
8
-
9
- Copyright (c) 2021 Interventional Cognitive Neuromodulation - Neumann Lab Berlin
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
-
29
- Project-URL: bugtracker, https://github.com/neuromodulation/py_neuromodulation/issues
30
- Project-URL: repository, https://github.com/neuromodulation/py_neuromodulation
31
- Keywords: real-time,eeg,ieeg,dbs,ecog,electrocorticography,deep-brain-stimulation,machine-learning
32
- Classifier: Development Status :: 2 - Pre-Alpha
33
- Classifier: License :: OSI Approved :: MIT License
34
- Classifier: Programming Language :: Python
35
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
36
- Requires-Python: >=3.10
37
- Description-Content-Type: text/x-rst
38
- License-File: LICENSE
39
- Requires-Dist: mne
40
- Requires-Dist: filterpy >=1.4.5
41
- Requires-Dist: fooof
42
- Requires-Dist: imbalanced-learn
43
- Requires-Dist: matplotlib >=3.3.4
44
- Requires-Dist: mne-bids >=0.8
45
- Requires-Dist: mne-connectivity
46
- Requires-Dist: mrmr-selection
47
- Requires-Dist: nolds
48
- Requires-Dist: numpy >=1.21.2
49
- Requires-Dist: pandas >=1.2.2
50
- Requires-Dist: pip
51
- Requires-Dist: pynput
52
- Requires-Dist: pybids
53
- Requires-Dist: scikit-image
54
- Requires-Dist: scikit-learn >=0.24.2
55
- Requires-Dist: scikit-optimize
56
- Requires-Dist: scipy >=1.7.1
57
- Requires-Dist: seaborn >=0.11
58
- Requires-Dist: notebook
59
- Requires-Dist: ipython
60
- Requires-Dist: pybispectra >=1.0.0
61
- Requires-Dist: pyparrm
62
- Requires-Dist: pyarrow >=14.0.2
63
- Requires-Dist: joblib >=1.3.2
64
- Requires-Dist: black >=24.2.0
65
- Requires-Dist: pytest >=8.0.2
66
- Requires-Dist: wget
67
- Provides-Extra: dev
68
- Requires-Dist: black ; extra == 'dev'
69
- Requires-Dist: pytest ; extra == 'dev'
70
- Requires-Dist: pytest-cov ; extra == 'dev'
71
-
72
- py_neuromodulation
73
- ==================
74
-
75
- Analyzing neural data can be a troublesome, trial and error prone,
76
- and beginner unfriendly process. *py_neuromodulation* allows using a simple
77
- interface for extraction of established neurophysiological features and includes commonly applied pre -and postprocessing methods.
78
-
79
- Only **time series data** with a corresponding **sampling frequency** are required for feature extraction.
80
-
81
- The output will be a `pandas.DataFrame <https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html>`_ including different time-resolved computed features. Internally a **stream** get's initialized,
82
- which resembles an *online* data-stream that can in theory also be be used with a hardware acquisition system.
83
-
84
- The following features are currently included:
85
-
86
- * oscillatory: fft, stft or bandpass filtered band power
87
- * `temporal waveform shape <https://www.sciencedirect.com/science/article/pii/S1364661316302182>`_
88
- * `fooof <https://fooof-tools.github.io/fooof/>`_
89
- * `mne_connectivity estimates <https://mne.tools/mne-connectivity/stable/index.html>`_
90
- * `Hjorth parameter <https://en.wikipedia.org/wiki/Hjorth_parameters>`_
91
- * `non-linear dynamical estimates <https://nolds.readthedocs.io/en/latest/>`_
92
- * various burst features
93
- * line length
94
- * and more...
95
-
96
-
97
- Find here the preprint of **py_neuromodulation** called *"Invasive neurophysiology and whole brain connectomics for neural decoding in patients with brain implants"* [1]_.
98
-
99
- The original intention for writing this toolbox was movement decoding from invasive brain signals [2]_.
100
- The application however could be any neural decoding problem.
101
- *py_neuromodulation* offers wrappers around common practice machine learning methods for efficient analysis.
102
-
103
- Find the documentation here http://py-neuromodulation.readthedocs.io for example usage and parametrization.
104
-
105
- Installation
106
- ============
107
-
108
- py_neuromodulation requires at least python 3.10. For installation you can use pip:
109
-
110
- .. code-block::
111
-
112
- pip install py-neuromodulation
113
-
114
-
115
- We recommend however installing the package using `rye <https://rye-up.com/guide/installation/>`_:
116
-
117
- .. code-block::
118
-
119
- git clone https://github.com/neuromodulation/py_neuromodulation.git
120
- rye pin 3.11
121
- rye sync
122
-
123
- And then activating the virtual environment e.g. in Windows using:
124
-
125
- .. code-block::
126
-
127
- .\.venv\Scripts\activate
128
-
129
- Alternatively you can also install the package in a conda environment:
130
-
131
- conda create -n pynm-test python=3.11
132
- conda activate pynm-test
133
-
134
- Then install the packages listed in the `pyproject.toml`:
135
-
136
- .. code-block::
137
-
138
- pip install .
139
-
140
-
141
- Optionally the ipython kernel can be specified for the installed pynm-test conda environment:
142
-
143
- .. code-block::
144
-
145
- ipython kernel install --user --name=pynm-test
146
-
147
- Then *py_neuromodulation* can be imported via:
148
-
149
- .. code-block::
150
-
151
- import py_neuromodulation as nm
152
-
153
- Basic Usage
154
- ===========
155
-
156
- .. code-block:: python
157
-
158
- import py_neuromodulation as nm
159
- import numpy as np
160
-
161
- NUM_CHANNELS = 5
162
- NUM_DATA = 10000
163
- sfreq = 1000 # Hz
164
- sampling_rate_features_hz = 3 # Hz
165
-
166
- data = np.random.random([NUM_CHANNELS, NUM_DATA])
167
-
168
- stream = nm.Stream(sfreq=sfreq, data=data, sampling_rate_features_hz=sampling_rate_features_hz)
169
- features = stream.run()
170
-
171
- Check the `Usage <https://py-neuromodulation.readthedocs.io/en/latest/usage.html>`_ and `First examples <https://py-neuromodulation.readthedocs.io/en/latest/auto_examples/plot_0_first_demo.html>`_ for further introduction.
172
-
173
- Contact information
174
- -------------------
175
- For any question or suggestion please find my contact
176
- information at `my GitHub profile <https://github.com/timonmerk>`_.
177
-
178
- References
179
- ----------
180
-
181
- .. [1] Merk, T. et al. *Invasive neurophysiology and whole brain connectomics for neural decoding in patients with brain implants*, `https://doi.org/10.21203/rs.3.rs-3212709/v1` (2023).
182
- .. [2] Merk, T. et al. *Electrocorticography is superior to subthalamic local field potentials for movement decoding in Parkinson’s disease*. Elife 11, e75126, `https://doi.org/10.7554/eLife.75126` (2022).
1
+ Metadata-Version: 2.3
2
+ Name: py_neuromodulation
3
+ Version: 0.0.4
4
+ Summary: Real-time analysis of intracranial neurophysiology recordings.
5
+ Project-URL: bugtracker, https://github.com/neuromodulation/py_neuromodulation/issues
6
+ Project-URL: repository, https://github.com/neuromodulation/py_neuromodulation
7
+ Author-email: Timon Merk <timon.merk@charite.de>
8
+ Maintainer: Timon Merk
9
+ License: MIT License
10
+
11
+ Copyright (c) 2021 Interventional Cognitive Neuromodulation - Neumann Lab Berlin
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: dbs,deep-brain-stimulation,ecog,eeg,electrocorticography,ieeg,machine-learning,real-time
32
+ Classifier: Development Status :: 2 - Pre-Alpha
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python
35
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
36
+ Requires-Python: >=3.10
37
+ Requires-Dist: black>=24.2.0
38
+ Requires-Dist: filterpy>=1.4.5
39
+ Requires-Dist: fooof
40
+ Requires-Dist: hatch>=1.9.4
41
+ Requires-Dist: imbalanced-learn
42
+ Requires-Dist: ipython
43
+ Requires-Dist: joblib>=1.3.2
44
+ Requires-Dist: matplotlib>=3.3.4
45
+ Requires-Dist: mne
46
+ Requires-Dist: mne-bids>=0.8
47
+ Requires-Dist: mne-connectivity
48
+ Requires-Dist: mrmr-selection
49
+ Requires-Dist: nolds
50
+ Requires-Dist: notebook
51
+ Requires-Dist: numpy>=1.21.2
52
+ Requires-Dist: pandas>=1.2.2
53
+ Requires-Dist: pip
54
+ Requires-Dist: pyarrow>=14.0.2
55
+ Requires-Dist: pybids
56
+ Requires-Dist: pybispectra>=1.0.0
57
+ Requires-Dist: pynput
58
+ Requires-Dist: pyparrm
59
+ Requires-Dist: pytest>=8.0.2
60
+ Requires-Dist: scikit-image
61
+ Requires-Dist: scikit-learn>=0.24.2
62
+ Requires-Dist: scikit-optimize
63
+ Requires-Dist: scipy>=1.7.1
64
+ Requires-Dist: seaborn>=0.11
65
+ Requires-Dist: wget
66
+ Provides-Extra: dev
67
+ Requires-Dist: black; extra == 'dev'
68
+ Requires-Dist: pytest; extra == 'dev'
69
+ Requires-Dist: pytest-cov; extra == 'dev'
70
+ Description-Content-Type: text/x-rst
71
+
72
+ py_neuromodulation
73
+ ==================
74
+
75
+ Analyzing neural data can be a troublesome, trial and error prone,
76
+ and beginner unfriendly process. *py_neuromodulation* allows using a simple
77
+ interface for extraction of established neurophysiological features and includes commonly applied pre -and postprocessing methods.
78
+
79
+ Only **time series data** with a corresponding **sampling frequency** are required for feature extraction.
80
+
81
+ The output will be a `pandas.DataFrame <https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html>`_ including different time-resolved computed features. Internally a **stream** get's initialized,
82
+ which resembles an *online* data-stream that can in theory also be be used with a hardware acquisition system.
83
+
84
+ The following features are currently included:
85
+
86
+ * oscillatory: fft, stft or bandpass filtered band power
87
+ * `temporal waveform shape <https://www.sciencedirect.com/science/article/pii/S1364661316302182>`_
88
+ * `fooof <https://fooof-tools.github.io/fooof/>`_
89
+ * `mne_connectivity estimates <https://mne.tools/mne-connectivity/stable/index.html>`_
90
+ * `Hjorth parameter <https://en.wikipedia.org/wiki/Hjorth_parameters>`_
91
+ * `non-linear dynamical estimates <https://nolds.readthedocs.io/en/latest/>`_
92
+ * various burst features
93
+ * line length
94
+ * and more...
95
+
96
+
97
+ Find here the preprint of **py_neuromodulation** called *"Invasive neurophysiology and whole brain connectomics for neural decoding in patients with brain implants"* [1]_.
98
+
99
+ The original intention for writing this toolbox was movement decoding from invasive brain signals [2]_.
100
+ The application however could be any neural decoding problem.
101
+ *py_neuromodulation* offers wrappers around common practice machine learning methods for efficient analysis.
102
+
103
+ Find the documentation here http://py-neuromodulation.readthedocs.io for example usage and parametrization.
104
+
105
+ Installation
106
+ ============
107
+
108
+ py_neuromodulation requires at least python 3.10. For installation you can use pip:
109
+
110
+ .. code-block::
111
+
112
+ pip install py-neuromodulation
113
+
114
+
115
+ We recommend however installing the package using `rye <https://rye-up.com/guide/installation/>`_:
116
+
117
+ .. code-block::
118
+
119
+ git clone https://github.com/neuromodulation/py_neuromodulation.git
120
+ rye pin 3.11
121
+ rye sync
122
+
123
+ And then activating the virtual environment e.g. in Windows using:
124
+
125
+ .. code-block::
126
+
127
+ .\.venv\Scripts\activate
128
+
129
+ Alternatively you can also install the package in a conda environment:
130
+
131
+ conda create -n pynm-test python=3.11
132
+ conda activate pynm-test
133
+
134
+ Then install the packages listed in the `pyproject.toml`:
135
+
136
+ .. code-block::
137
+
138
+ pip install .
139
+
140
+
141
+ Optionally the ipython kernel can be specified for the installed pynm-test conda environment:
142
+
143
+ .. code-block::
144
+
145
+ ipython kernel install --user --name=pynm-test
146
+
147
+ Then *py_neuromodulation* can be imported via:
148
+
149
+ .. code-block::
150
+
151
+ import py_neuromodulation as nm
152
+
153
+ Basic Usage
154
+ ===========
155
+
156
+ .. code-block:: python
157
+
158
+ import py_neuromodulation as nm
159
+ import numpy as np
160
+
161
+ NUM_CHANNELS = 5
162
+ NUM_DATA = 10000
163
+ sfreq = 1000 # Hz
164
+ sampling_rate_features_hz = 3 # Hz
165
+
166
+ data = np.random.random([NUM_CHANNELS, NUM_DATA])
167
+
168
+ stream = nm.Stream(sfreq=sfreq, data=data, sampling_rate_features_hz=sampling_rate_features_hz)
169
+ features = stream.run()
170
+
171
+ Check the `Usage <https://py-neuromodulation.readthedocs.io/en/latest/usage.html>`_ and `First examples <https://py-neuromodulation.readthedocs.io/en/latest/auto_examples/plot_0_first_demo.html>`_ for further introduction.
172
+
173
+ Contact information
174
+ -------------------
175
+ For any question or suggestion please find my contact
176
+ information at `my GitHub profile <https://github.com/timonmerk>`_.
177
+
178
+ References
179
+ ----------
180
+
181
+ .. [1] Merk, T. et al. *Invasive neurophysiology and whole brain connectomics for neural decoding in patients with brain implants*, `https://doi.org/10.21203/rs.3.rs-3212709/v1` (2023).
182
+ .. [2] Merk, T. et al. *Electrocorticography is superior to subthalamic local field potentials for movement decoding in Parkinson’s disease*. Elife 11, e75126, `https://doi.org/10.7554/eLife.75126` (2022).
@@ -0,0 +1,72 @@
1
+ py_neuromodulation/FieldTrip.py,sha256=cq4BIibMvcpyAHd7U8eEK4AhVSOTrRKXcywtgtc-Mg4,18597
2
+ py_neuromodulation/__init__.py,sha256=3aujkEqF4dzt8WKtK7gaolh782UsR5FFkqcg7fOtze4,296
3
+ py_neuromodulation/_write_example_dataset_helper.py,sha256=b-kG1JiuIhebVSNCrumTOgdXPTmxXkkduCpUFlmMlOg,2530
4
+ py_neuromodulation/grid_cortex.tsv,sha256=DRnJEBwLBqyzCp3UwBL-Us_9h9GyokCorYl0HLsHSLk,683
5
+ py_neuromodulation/grid_subcortex.tsv,sha256=oCQDYLDdYSa1DAI9ybwECfuzWulFzXqKHyf7oZ1oDBM,25842
6
+ py_neuromodulation/nm_EpochStream.py,sha256=fqLNIQRVtcQOMtOyw-omu3KegEs6tWxZI-GQWqdAeG0,2595
7
+ py_neuromodulation/nm_IO.py,sha256=SFOsCMwu2XOYUjFaDauciVkZsq0YG-Vx4rrevqNDd4g,11688
8
+ py_neuromodulation/nm_RMAP.py,sha256=2wHHD9gwW6Y3XZnGUwmDrWHcz7HjwwLqcwwSjADA0-Q,15791
9
+ py_neuromodulation/nm_across_patient_decoding.py,sha256=9Mwu5o5cUAbtSP8BTx4c-BJfJZtk8wsMx_WH0VIegdI,38690
10
+ py_neuromodulation/nm_analysis.py,sha256=ZIuc1cqG5_2DvoTwvSDL88nyYa_XglANq90xUqeSEXM,38528
11
+ py_neuromodulation/nm_artifacts.py,sha256=KZZ68Q13P64vp05vRiLZ9CPmyWurhcB6K0ldY91axCI,692
12
+ py_neuromodulation/nm_bispectra.py,sha256=7XduXwvryckEMlNeRqKLioNK90rW8AZpvA_Z2I7gThI,6322
13
+ py_neuromodulation/nm_bursts.py,sha256=2xMJjluXttjeijm9e7EaaJJ2fcnnX1kLb600TiJvCzY,7710
14
+ py_neuromodulation/nm_coherence.py,sha256=Iy8FtYBb7qaRFGpzHwOK_IA6O4bvtrumcIyS_Umh0aY,7435
15
+ py_neuromodulation/nm_cohortwrapper.py,sha256=eJVCBW745DB5MX7OBVJh2ZAT1vy-3-_2MCHnjrsO9qI,16643
16
+ py_neuromodulation/nm_decode.py,sha256=d15D-l0RUAcW8FfXyDcPaNwRpS9wuq1XK-pWmImPHDg,35645
17
+ py_neuromodulation/nm_define_nmchannels.py,sha256=8rjZoDIwhsIgdqfSxScaJvY9tNGWNLecTLxEmvhHMuE,11074
18
+ py_neuromodulation/nm_eval_timing.py,sha256=JcnLYyxjH8hvNX7rbJ4PEj-NZzqs2NMGOhyuQQuGiYc,8800
19
+ py_neuromodulation/nm_features.py,sha256=IsfN6nFE_f0OPFaHPjFhjPxMO7pKc6pxkylt6V09LEk,3527
20
+ py_neuromodulation/nm_features_abc.py,sha256=6CX8NHbtpGDY-l9K4CUomlRJVZHPmo6KHJX4RJ1YolM,917
21
+ py_neuromodulation/nm_filter.py,sha256=dusgRby4xDxrj62uINuucm0juCwpGb7Lr3iN4IOs8R4,7542
22
+ py_neuromodulation/nm_filter_preprocessing.py,sha256=rR1QKaf9q_7sWB5J129rBTz5H2PO6rvGxMmU86-npi4,3366
23
+ py_neuromodulation/nm_fooof.py,sha256=rOpKyKzTTnMWBplujsw5kzHAvILBGuCjP0q0UozTIiM,6147
24
+ py_neuromodulation/nm_generator.py,sha256=YPa-1X5gCUVSpxTT9upbbY4kjqoVlRd5njQHBjgpAgk,1088
25
+ py_neuromodulation/nm_hjorth_raw.py,sha256=EvXOBr3k9Q5xypv1Gj8GFqa5EJ_wRYNDGgGnXCUekiM,2180
26
+ py_neuromodulation/nm_kalmanfilter.py,sha256=dgs7_XMBpLEE49l6aAVNA4d6ovTS63CZsAI472eG3JA,2006
27
+ py_neuromodulation/nm_linelength.py,sha256=0iZO7j6g7IeprvlEvWG6a_CaUL2p0sQKGiFgDrzYtxk,954
28
+ py_neuromodulation/nm_mne_connectivity.py,sha256=UCgLRQSrzl0OpOhHdUc1iqWr6fPiHZeU0zNeZfaplJE,3907
29
+ py_neuromodulation/nm_nolds.py,sha256=KZr3ZKqvKJkYKh2BMYuuUMkP8hhmJTUgtLZrE8l-DqQ,3660
30
+ py_neuromodulation/nm_normalization.py,sha256=9v3fiNT0HexD9ycp2gB6BPp_ch86kYez_YNI9yB3zGw,7574
31
+ py_neuromodulation/nm_oscillatory.py,sha256=dvxiytWXwd9_gsvroUhDQkQZBTIZzQEhl2XS2QzmOIQ,16476
32
+ py_neuromodulation/nm_plots.py,sha256=B5A91ejZwoxx2YRa3fB6G_fNamdCm27JSOInqF1OfWc,17869
33
+ py_neuromodulation/nm_projection.py,sha256=g8VersyOGiWj3PjR_U6dvLttsp6CHi_GCyYnu_ha8uc,15309
34
+ py_neuromodulation/nm_rereference.py,sha256=SApVkeWdMmMfD1sr77HSs7MW3eQwVHKEhfm-0zyBu9M,3381
35
+ py_neuromodulation/nm_resample.py,sha256=MSMu8gvmrYZ194fAVJdlB_4yEkuGKHgHrLd11zBDRY0,1122
36
+ py_neuromodulation/nm_run_analysis.py,sha256=kZKcVkAbeAhKzoXyFaNK4Vo_aJTTSAVZxxr8y3GMyCc,15046
37
+ py_neuromodulation/nm_settings.json,sha256=KxvvCTJBaY0PmrxpbNJaY-NQc-eI99YX3lJAwQwDVq4,8287
38
+ py_neuromodulation/nm_settings.py,sha256=7d17vwSGrABxQJ7C6x3FqP8kdboUFpm5LrN4djoVlFA,1775
39
+ py_neuromodulation/nm_sharpwaves.py,sha256=mk6DYjO-834aCEk9-x24DP6b1rSA9gC1Jf6in8GPAgA,16891
40
+ py_neuromodulation/nm_stats.py,sha256=wgYk3jzrfSNEZEWdPSpxQcGcsdNs-vhfKvRhMptSbXM,16029
41
+ py_neuromodulation/nm_stream_abc.py,sha256=hQHFVOnCdZiVfq9NyS5npFQ4DFqJUsY4jbaegEhMvgk,7755
42
+ py_neuromodulation/nm_stream_offline.py,sha256=U7CQlaEMNe3uZJq4vqNROuFjOY_sWWN5GjLq-8_W6C4,12484
43
+ py_neuromodulation/ConnectivityDecoding/Automated Anatomical Labeling 3 (Rolls 2020).nii,sha256=Sp-cjF_AuT0Tlilb5s8lB14hVgkXJiR2uKMS9nOQOeg,902981
44
+ py_neuromodulation/ConnectivityDecoding/_get_grid_hull.m,sha256=pI8MWNBSv4um6VsPlQQqOvqqfk5gXj421KWWPUYMNgQ,748
45
+ py_neuromodulation/ConnectivityDecoding/_get_grid_whole_brain.py,sha256=f4nNTStuZuGOGOz4QZMZAdURpWRK0Ljb4eKP1db-kJc,3207
46
+ py_neuromodulation/ConnectivityDecoding/_helper_write_connectome.py,sha256=uOlV_IGoxtoGH6cseSACyDF94HERNH1dUsIMKFvFIkg,3688
47
+ py_neuromodulation/ConnectivityDecoding/mni_coords_cortical_surface.mat,sha256=AZc0mgiAiqXVAxAnfxwICeh-dQX62RfTeRN_knS-i60,11622
48
+ py_neuromodulation/ConnectivityDecoding/mni_coords_whole_brain.mat,sha256=YxT9nrXZ2IECheEhN1SgSsqNyihHUTLuZQ7o5yP4Q-c,29864
49
+ py_neuromodulation/ConnectivityDecoding/rmap_func_all.nii,sha256=WjVA02B2cGNi670_45fdNssspf8GKbkKgRStZ2d4_FU,7221384
50
+ py_neuromodulation/ConnectivityDecoding/rmap_struc.nii,sha256=XsEMjsCxjAsMFvw1_jpQ-wIU2BUuZ_lISPwMa7zDmDk,7221384
51
+ py_neuromodulation/data/README,sha256=Xw-QRZXGq2YefZ3ZDvrK736DruAkFVeaqOn70BzFnPs,714
52
+ py_neuromodulation/data/dataset_description.json,sha256=4LRbbS8x0ifRZhqTNOrtPmm306AmipYnl9duL3OXHrA,130
53
+ py_neuromodulation/data/participants.json,sha256=o24uxJ95GE_b3SAA6nQg6G8Ene6zPL_u02wYT38A8OY,788
54
+ py_neuromodulation/data/participants.tsv,sha256=rPmG1JoJ2O0xbhlLHDJszAK-QSR_7gkSiaykn-HaXvo,79
55
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/sub-testsub_ses-EphysMedOff_scans.tsv,sha256=zu2Ym07qo164jbClxfT3L960-nHQeRo6WG3QmbpNgl0,91
56
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_coordsystem.json,sha256=NzLVNODlEAIDwTk49_YcbOUjWiRMdZ8toZYBpmAWS1A,123
57
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_electrodes.tsv,sha256=eHBvuZa9WJGI5LSid2TBRxzgyacK7AwrFGKEByl3i4w,733
58
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_channels.tsv,sha256=cZSFnJqjRK8mrtTN271U9L6H_Lo2kuUHimhcKcv9xdY,790
59
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.eeg,sha256=NnQeMDrKpeK3lctIZ5Bzh85UMTs5OCUCaivn_NU5rc4,760040
60
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.json,sha256=A0zHnbKXKLBmPly9NshT2B6lsrogFZeIAMXeTzwEYyk,492
61
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vhdr,sha256=hUwxHtbCZMo16-e06xJ1rVqgs1Ac8LtP8_5AmhjeDw8,1023
62
+ py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vmrk,sha256=WV1mN_QGC1WlFh5qcKzXpedyMhtXVHVwgV5v8n1-_Zw,553
63
+ py_neuromodulation/plots/STN_surf.mat,sha256=Hh2nfQRmP0TYIt8SWV-ajKnC8yk7EmBoAj1c6RMoi9g,124526
64
+ py_neuromodulation/plots/Vertices.mat,sha256=k72WB8-0Datt-bRScxcfpp38LBPHV34zzodS49kQAgs,3709780
65
+ py_neuromodulation/plots/faces.mat,sha256=gWSr-9qNxsAPoG8q-muNnaFZHVHGKqnKN0j3Q1JfMk4,2859245
66
+ py_neuromodulation/plots/grid.mat,sha256=G3MYIVcvk8lbf_kKWIe3lZZ4d0QV6HkoLsOFN1A2vhE,775
67
+ py_neuromodulation/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
+ py_neuromodulation/utils/_logging.py,sha256=vADt0XAWSzDAvhuOfaOjyZRSZCA11Pym2wi0uvPIoTo,738
69
+ py_neuromodulation-0.0.4.dist-info/METADATA,sha256=uVW2tGNLA5o_MD5blFmYgAC_ILaM9w9EkIvphS3oOPQ,7049
70
+ py_neuromodulation-0.0.4.dist-info/WHEEL,sha256=osohxoshIHTFJFVPhsi1UkZuLRGMHRXZzwEBW2ezjrc,87
71
+ py_neuromodulation-0.0.4.dist-info/licenses/LICENSE,sha256=V6yfss2JKJxeY-TsaEVqVomfd8ttziMyB9ik5L-BI7o,1139
72
+ py_neuromodulation-0.0.4.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: hatchling 1.24.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1,68 +0,0 @@
1
- """
2
- ===================
3
- Adding New Features
4
- ===================
5
-
6
- """
7
-
8
- import py_neuromodulation as pn
9
- from py_neuromodulation import nm_features_abc
10
- import numpy as np
11
- from typing import Iterable
12
-
13
- # %%
14
- # In this example we will demonstrate how a new feature can be added to the existing feature pipeline.
15
- # This can be done simply by adding an object of the inherited :class:`~nm_features_abc.Feature`
16
- # class to the stream `stream.run_analysis.features.features` list.
17
-
18
- data = np.random.random([1, 1000])
19
-
20
- stream = pn.Stream(sfreq=1000, data=data, sampling_rate_features_hz=10, verbose=False,)
21
-
22
- class NewFeature(nm_features_abc.Feature):
23
-
24
- def __init__(
25
- self, settings: dict, ch_names: Iterable[str], sfreq: float
26
- ) -> None:
27
- self.s = settings
28
- self.ch_names = ch_names
29
-
30
- def calc_feature(self, data: np.array, features_compute: dict) -> dict:
31
- for ch_idx, ch in enumerate(self.ch_names):
32
- features_compute[f"new_feature_{ch}"] = np.mean(data[ch_idx, :])
33
-
34
- return features_compute
35
-
36
- def test_settings():
37
- pass
38
-
39
- newFeature = NewFeature(stream.settings, list(stream.nm_channels["name"]), stream.sfreq)
40
- stream.run_analysis.features.features.append(newFeature)
41
-
42
- features = stream.run_analysis.process(data)
43
- feature_name = f"new_feature_{stream.nm_channels['name'][0]}"
44
-
45
- print(f"{feature_name}: {features[feature_name]}")
46
-
47
- # %%
48
- # This example shows a simple newly instantiated feature class called `NewFeature`.
49
- # The instantiated `newFeature` object could then be added to the existing feature list by calling
50
- # `stream.run_analysis.features.features.append(newFeature)`.
51
- #
52
- # To permanently add a novel feature, the new feature class needs to be added to
53
- # the :class:`~nm_features` class. This can be done by inserting the feature_name in
54
- # in the :class:`~nm_features.Feature` init function:
55
- #
56
- # .. code-block:: python
57
- #
58
- # for feature in s["features"]:
59
- # if s["features"][feature] is False:
60
- # continue
61
- # match feature:
62
- # case "new_feature":
63
- # FeatureClass = nm_new_feature.NewFeature
64
- # ...
65
- #
66
- # The new feature class can then be used by setting the `settings["feature"]["new_feature"]` value in the
67
- # settings to true.
68
- #