py-neuromodulation 0.0.4__py3-none-any.whl → 0.0.6__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 (109) hide show
  1. py_neuromodulation/ConnectivityDecoding/_get_grid_hull.m +34 -34
  2. py_neuromodulation/ConnectivityDecoding/_get_grid_whole_brain.py +95 -106
  3. py_neuromodulation/ConnectivityDecoding/_helper_write_connectome.py +107 -119
  4. py_neuromodulation/__init__.py +80 -13
  5. py_neuromodulation/{nm_RMAP.py → analysis/RMAP.py} +496 -531
  6. py_neuromodulation/analysis/__init__.py +4 -0
  7. py_neuromodulation/{nm_decode.py → analysis/decode.py} +918 -992
  8. py_neuromodulation/{nm_analysis.py → analysis/feature_reader.py} +994 -1074
  9. py_neuromodulation/{nm_plots.py → analysis/plots.py} +627 -612
  10. py_neuromodulation/{nm_stats.py → analysis/stats.py} +458 -480
  11. py_neuromodulation/data/README +6 -6
  12. py_neuromodulation/data/dataset_description.json +8 -8
  13. py_neuromodulation/data/participants.json +32 -32
  14. py_neuromodulation/data/participants.tsv +2 -2
  15. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_coordsystem.json +5 -5
  16. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_electrodes.tsv +11 -11
  17. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_channels.tsv +11 -11
  18. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.json +18 -18
  19. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vhdr +35 -35
  20. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vmrk +13 -13
  21. py_neuromodulation/data/sub-testsub/ses-EphysMedOff/sub-testsub_ses-EphysMedOff_scans.tsv +2 -2
  22. py_neuromodulation/default_settings.yaml +241 -0
  23. py_neuromodulation/features/__init__.py +31 -0
  24. py_neuromodulation/features/bandpower.py +165 -0
  25. py_neuromodulation/features/bispectra.py +157 -0
  26. py_neuromodulation/features/bursts.py +297 -0
  27. py_neuromodulation/features/coherence.py +255 -0
  28. py_neuromodulation/features/feature_processor.py +121 -0
  29. py_neuromodulation/features/fooof.py +142 -0
  30. py_neuromodulation/features/hjorth_raw.py +57 -0
  31. py_neuromodulation/features/linelength.py +21 -0
  32. py_neuromodulation/features/mne_connectivity.py +148 -0
  33. py_neuromodulation/features/nolds.py +94 -0
  34. py_neuromodulation/features/oscillatory.py +249 -0
  35. py_neuromodulation/features/sharpwaves.py +432 -0
  36. py_neuromodulation/filter/__init__.py +3 -0
  37. py_neuromodulation/filter/kalman_filter.py +67 -0
  38. py_neuromodulation/filter/kalman_filter_external.py +1890 -0
  39. py_neuromodulation/filter/mne_filter.py +128 -0
  40. py_neuromodulation/filter/notch_filter.py +93 -0
  41. py_neuromodulation/grid_cortex.tsv +40 -40
  42. py_neuromodulation/liblsl/libpugixml.so.1.12 +0 -0
  43. py_neuromodulation/liblsl/linux/bionic_amd64/liblsl.1.16.2.so +0 -0
  44. py_neuromodulation/liblsl/linux/bookworm_amd64/liblsl.1.16.2.so +0 -0
  45. py_neuromodulation/liblsl/linux/focal_amd46/liblsl.1.16.2.so +0 -0
  46. py_neuromodulation/liblsl/linux/jammy_amd64/liblsl.1.16.2.so +0 -0
  47. py_neuromodulation/liblsl/linux/jammy_x86/liblsl.1.16.2.so +0 -0
  48. py_neuromodulation/liblsl/linux/noble_amd64/liblsl.1.16.2.so +0 -0
  49. py_neuromodulation/liblsl/macos/amd64/liblsl.1.16.2.dylib +0 -0
  50. py_neuromodulation/liblsl/macos/arm64/liblsl.1.16.0.dylib +0 -0
  51. py_neuromodulation/liblsl/windows/amd64/liblsl.1.16.2.dll +0 -0
  52. py_neuromodulation/liblsl/windows/x86/liblsl.1.16.2.dll +0 -0
  53. py_neuromodulation/processing/__init__.py +10 -0
  54. py_neuromodulation/{nm_artifacts.py → processing/artifacts.py} +29 -25
  55. py_neuromodulation/processing/data_preprocessor.py +77 -0
  56. py_neuromodulation/processing/filter_preprocessing.py +78 -0
  57. py_neuromodulation/processing/normalization.py +175 -0
  58. py_neuromodulation/{nm_projection.py → processing/projection.py} +370 -394
  59. py_neuromodulation/{nm_rereference.py → processing/rereference.py} +97 -95
  60. py_neuromodulation/{nm_resample.py → processing/resample.py} +56 -50
  61. py_neuromodulation/stream/__init__.py +3 -0
  62. py_neuromodulation/stream/data_processor.py +325 -0
  63. py_neuromodulation/stream/generator.py +53 -0
  64. py_neuromodulation/stream/mnelsl_player.py +94 -0
  65. py_neuromodulation/stream/mnelsl_stream.py +120 -0
  66. py_neuromodulation/stream/settings.py +292 -0
  67. py_neuromodulation/stream/stream.py +427 -0
  68. py_neuromodulation/utils/__init__.py +2 -0
  69. py_neuromodulation/{nm_define_nmchannels.py → utils/channels.py} +305 -302
  70. py_neuromodulation/utils/database.py +149 -0
  71. py_neuromodulation/utils/io.py +378 -0
  72. py_neuromodulation/utils/keyboard.py +52 -0
  73. py_neuromodulation/utils/logging.py +66 -0
  74. py_neuromodulation/utils/types.py +251 -0
  75. {py_neuromodulation-0.0.4.dist-info → py_neuromodulation-0.0.6.dist-info}/METADATA +28 -33
  76. py_neuromodulation-0.0.6.dist-info/RECORD +89 -0
  77. {py_neuromodulation-0.0.4.dist-info → py_neuromodulation-0.0.6.dist-info}/WHEEL +1 -1
  78. {py_neuromodulation-0.0.4.dist-info → py_neuromodulation-0.0.6.dist-info}/licenses/LICENSE +21 -21
  79. py_neuromodulation/FieldTrip.py +0 -589
  80. py_neuromodulation/_write_example_dataset_helper.py +0 -65
  81. py_neuromodulation/nm_EpochStream.py +0 -92
  82. py_neuromodulation/nm_IO.py +0 -417
  83. py_neuromodulation/nm_across_patient_decoding.py +0 -927
  84. py_neuromodulation/nm_bispectra.py +0 -168
  85. py_neuromodulation/nm_bursts.py +0 -198
  86. py_neuromodulation/nm_coherence.py +0 -205
  87. py_neuromodulation/nm_cohortwrapper.py +0 -435
  88. py_neuromodulation/nm_eval_timing.py +0 -239
  89. py_neuromodulation/nm_features.py +0 -116
  90. py_neuromodulation/nm_features_abc.py +0 -39
  91. py_neuromodulation/nm_filter.py +0 -219
  92. py_neuromodulation/nm_filter_preprocessing.py +0 -91
  93. py_neuromodulation/nm_fooof.py +0 -159
  94. py_neuromodulation/nm_generator.py +0 -37
  95. py_neuromodulation/nm_hjorth_raw.py +0 -73
  96. py_neuromodulation/nm_kalmanfilter.py +0 -58
  97. py_neuromodulation/nm_linelength.py +0 -33
  98. py_neuromodulation/nm_mne_connectivity.py +0 -112
  99. py_neuromodulation/nm_nolds.py +0 -93
  100. py_neuromodulation/nm_normalization.py +0 -214
  101. py_neuromodulation/nm_oscillatory.py +0 -448
  102. py_neuromodulation/nm_run_analysis.py +0 -435
  103. py_neuromodulation/nm_settings.json +0 -338
  104. py_neuromodulation/nm_settings.py +0 -68
  105. py_neuromodulation/nm_sharpwaves.py +0 -401
  106. py_neuromodulation/nm_stream_abc.py +0 -218
  107. py_neuromodulation/nm_stream_offline.py +0 -359
  108. py_neuromodulation/utils/_logging.py +0 -24
  109. py_neuromodulation-0.0.4.dist-info/RECORD +0 -72
@@ -1,338 +0,0 @@
1
- {
2
- "sampling_rate_features_hz": 10,
3
- "segment_length_features_ms": 1000,
4
- "preprocessing": [
5
- "raw_resampling",
6
- "notch_filter",
7
- "re_referencing"
8
- ],
9
- "documentation_preprocessing_options": [
10
- "raw_resampling",
11
- "notch_filter",
12
- "re_referencing",
13
- "raw_normalization",
14
- "preprocessing_filter"
15
- ],
16
- "features": {
17
- "raw_hjorth": true,
18
- "return_raw": true,
19
- "bandpass_filter": false,
20
- "stft": false,
21
- "fft": true,
22
- "welch": true,
23
- "sharpwave_analysis": true,
24
- "fooof": false,
25
- "bursts": true,
26
- "linelength": true,
27
- "coherence": false,
28
- "nolds": false,
29
- "mne_connectivity": false,
30
- "bispectrum": false
31
- },
32
- "postprocessing": {
33
- "feature_normalization": true,
34
- "project_cortex": false,
35
- "project_subcortex": false
36
- },
37
- "raw_resampling_settings": {
38
- "resample_freq_hz": 1000
39
- },
40
- "preprocessing_filter": {
41
- "bandstop_filter": true,
42
- "lowpass_filter": true,
43
- "highpass_filter": true,
44
- "bandpass_filter": true,
45
- "bandstop_filter_settings": {
46
- "frequency_low_hz": 100,
47
- "frequency_high_hz": 160
48
- },
49
- "lowpass_filter_settings": {
50
- "frequency_cutoff_hz": 200
51
- },
52
- "highpass_filter_settings": {
53
- "frequency_cutoff_hz": 3
54
- },
55
- "bandpass_filter_settings": {
56
- "frequency_low_hz": 3,
57
- "frequency_high_hz": 200
58
- }
59
- },
60
- "re_referencing_settings": {
61
- "reference": "common"
62
- },
63
- "documentation_normalization_options": [
64
- "mean",
65
- "median",
66
- "zscore",
67
- "zscore-median",
68
- "quantile",
69
- "power",
70
- "robust",
71
- "minmax"
72
- ],
73
- "raw_normalization_settings": {
74
- "normalization_time_s": 30,
75
- "normalization_method": "zscore",
76
- "clip": 3
77
- },
78
- "feature_normalization_settings": {
79
- "normalization_time_s": 30,
80
- "normalization_method": "zscore",
81
- "clip": 3
82
- },
83
- "frequency_ranges_hz": {
84
- "theta": [
85
- 4,
86
- 8
87
- ],
88
- "alpha": [
89
- 8,
90
- 12
91
- ],
92
- "low beta": [
93
- 13,
94
- 20
95
- ],
96
- "high beta": [
97
- 20,
98
- 35
99
- ],
100
- "low gamma": [
101
- 60,
102
- 80
103
- ],
104
- "high gamma": [
105
- 90,
106
- 200
107
- ],
108
- "HFA": [
109
- 200,
110
- 400
111
- ]
112
- },
113
- "fft_settings": {
114
- "windowlength_ms": 1000,
115
- "log_transform": true,
116
- "features": {
117
- "mean": true,
118
- "median": false,
119
- "std": false,
120
- "max": false
121
- },
122
- "return_spectrum": false
123
- },
124
- "welch_settings": {
125
- "windowlength_ms": 1000,
126
- "log_transform": true,
127
- "features": {
128
- "mean": true,
129
- "median": false,
130
- "std": false,
131
- "max": false
132
- },
133
- "return_spectrum": false
134
- },
135
- "stft_settings": {
136
- "windowlength_ms": 500,
137
- "log_transform": true,
138
- "features": {
139
- "mean": true,
140
- "median": false,
141
- "std": false,
142
- "max": false
143
- },
144
- "return_spectrum": false
145
- },
146
- "bandpass_filter_settings": {
147
- "segment_lengths_ms": {
148
- "theta": 1000,
149
- "alpha": 500,
150
- "low beta": 333,
151
- "high beta": 333,
152
- "low gamma": 100,
153
- "high gamma": 100,
154
- "HFA": 100
155
- },
156
- "bandpower_features": {
157
- "activity": true,
158
- "mobility": false,
159
- "complexity": false
160
- },
161
- "log_transform": true,
162
- "kalman_filter": false
163
- },
164
- "kalman_filter_settings": {
165
- "Tp": 0.1,
166
- "sigma_w": 0.7,
167
- "sigma_v": 1,
168
- "frequency_bands": [
169
- "theta",
170
- "alpha",
171
- "low beta",
172
- "high beta",
173
- "low gamma",
174
- "high gamma",
175
- "HFA"
176
- ]
177
- },
178
- "burst_settings": {
179
- "threshold": 75,
180
- "time_duration_s": 30,
181
- "frequency_bands": [
182
- "low beta",
183
- "high beta",
184
- "low gamma"
185
- ],
186
- "burst_features": {
187
- "duration": true,
188
- "amplitude": true,
189
- "burst_rate_per_s": true,
190
- "in_burst": true
191
- }
192
- },
193
- "sharpwave_analysis_settings": {
194
- "sharpwave_features": {
195
- "peak_left": false,
196
- "peak_right": false,
197
- "trough": false,
198
- "width": false,
199
- "prominence": true,
200
- "interval": true,
201
- "decay_time": false,
202
- "rise_time": false,
203
- "sharpness": true,
204
- "rise_steepness": false,
205
- "decay_steepness": false,
206
- "slope_ratio": false
207
- },
208
- "filter_ranges_hz": [
209
- [
210
- 5,
211
- 80
212
- ],
213
- [
214
- 5,
215
- 30
216
- ]
217
- ],
218
- "detect_troughs": {
219
- "estimate": true,
220
- "distance_troughs_ms": 10,
221
- "distance_peaks_ms": 5
222
- },
223
- "detect_peaks": {
224
- "estimate": true,
225
- "distance_troughs_ms": 5,
226
- "distance_peaks_ms": 10
227
- },
228
- "estimator": {
229
- "mean": [
230
- "interval"
231
- ],
232
- "median": null,
233
- "max": [
234
- "prominence",
235
- "sharpness"
236
- ],
237
- "min": null,
238
- "var": null
239
- },
240
- "apply_estimator_between_peaks_and_troughs": true
241
- },
242
- "project_cortex_settings": {
243
- "max_dist_mm": 20
244
- },
245
- "project_subcortex_settings": {
246
- "max_dist_mm": 5
247
- },
248
- "coherence": {
249
- "channels": [
250
- [
251
- "STN_RIGHT_0",
252
- "ECOG_RIGHT_0"
253
- ]
254
- ],
255
- "frequency_bands": [
256
- "high beta"
257
- ],
258
- "features": {
259
- "mean_fband": true,
260
- "max_fband": true,
261
- "max_allfbands": true
262
- },
263
- "method": {
264
- "coh": true,
265
- "icoh": true
266
- }
267
- },
268
- "fooof": {
269
- "aperiodic": {
270
- "exponent": true,
271
- "offset": true,
272
- "knee": true
273
- },
274
- "periodic": {
275
- "center_frequency": false,
276
- "band_width": false,
277
- "height_over_ap": false
278
- },
279
- "windowlength_ms": 800,
280
- "peak_width_limits": [
281
- 0.5,
282
- 12
283
- ],
284
- "max_n_peaks": 3,
285
- "min_peak_height": 0,
286
- "peak_threshold": 2,
287
- "freq_range_hz": [
288
- 2,
289
- 40
290
- ],
291
- "knee": true
292
- },
293
- "nolds_features": {
294
- "sample_entropy": false,
295
- "correlation_dimension": false,
296
- "lyapunov_exponent": true,
297
- "hurst_exponent": false,
298
- "detrended_fluctutaion_analysis": false,
299
- "data": {
300
- "raw": true,
301
- "frequency_bands": [
302
- "low beta"
303
- ]
304
- }
305
- },
306
- "mne_connectiviy": {
307
- "method": "plv",
308
- "mode": "multitaper"
309
- },
310
- "bispectrum": {
311
- "f1s": [
312
- 5,
313
- 35
314
- ],
315
- "f2s": [
316
- 5,
317
- 35
318
- ],
319
- "compute_features_for_whole_fband_range": true,
320
- "frequency_bands": [
321
- "theta",
322
- "alpha",
323
- "low beta",
324
- "high beta"
325
- ],
326
- "components": {
327
- "absolute": true,
328
- "real": true,
329
- "imag": true,
330
- "phase": true
331
- },
332
- "bispectrum_features": {
333
- "mean": true,
334
- "sum": true,
335
- "var": true
336
- }
337
- }
338
- }
@@ -1,68 +0,0 @@
1
- """Module for handling settings."""
2
- import pathlib
3
-
4
- import pandas as pd
5
-
6
- from py_neuromodulation import nm_IO
7
-
8
-
9
- def get_default_settings() -> dict:
10
- """Read default settings from nm_settings.json"""
11
- settings_path = str(
12
- pathlib.Path(__file__).parent.resolve() / "nm_settings.json"
13
- )
14
- return nm_IO.read_settings(settings_path)
15
-
16
-
17
- def reset_settings(
18
- settings: dict,
19
- ) -> dict:
20
- for f in settings["features"]:
21
- settings["features"][f] = False
22
- settings["preprocessing"] = []
23
- for f in settings["postprocessing"]:
24
- settings["postprocessing"][f] = False
25
- return settings
26
-
27
-
28
- def set_settings_fast_compute(
29
- settings: dict,
30
- ) -> dict:
31
- settings = reset_settings(settings)
32
- settings["features"]["fft"] = True
33
- settings["preprocessing"] = [
34
- "raw_resampling",
35
- "notch_filter",
36
- "re_referencing",
37
- ]
38
- settings["postprocessing"]["feature_normalization"] = True
39
- settings["postprocessing"]["project_cortex"] = False
40
- settings["postprocessing"]["project_subcortex"] = False
41
- return settings
42
-
43
-
44
- def test_settings(
45
- settings: dict,
46
- ) -> None:
47
- """Test if settings are specified correctly in nm_settings.json
48
- Parameters
49
- ----------
50
- settings: dict
51
- settings to tests
52
- verbose: boolean
53
- set to True if feedback is desired.
54
- Returns
55
- -------
56
- None
57
- """
58
- s = settings
59
-
60
- assert isinstance(s["sampling_rate_features_hz"], (float, int))
61
-
62
- assert (
63
- isinstance(value, bool) for value in s["features"].values()
64
- ), "features must be a boolean value."
65
-
66
- assert any(
67
- value is True for value in s["features"].values()
68
- ), "Set at least one feature to True."