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.
- py_neuromodulation/ConnectivityDecoding/_get_grid_hull.m +34 -34
- py_neuromodulation/ConnectivityDecoding/_get_grid_whole_brain.py +95 -106
- py_neuromodulation/ConnectivityDecoding/_helper_write_connectome.py +107 -119
- py_neuromodulation/__init__.py +80 -13
- py_neuromodulation/{nm_RMAP.py → analysis/RMAP.py} +496 -531
- py_neuromodulation/analysis/__init__.py +4 -0
- py_neuromodulation/{nm_decode.py → analysis/decode.py} +918 -992
- py_neuromodulation/{nm_analysis.py → analysis/feature_reader.py} +994 -1074
- py_neuromodulation/{nm_plots.py → analysis/plots.py} +627 -612
- py_neuromodulation/{nm_stats.py → analysis/stats.py} +458 -480
- py_neuromodulation/data/README +6 -6
- py_neuromodulation/data/dataset_description.json +8 -8
- py_neuromodulation/data/participants.json +32 -32
- py_neuromodulation/data/participants.tsv +2 -2
- py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_coordsystem.json +5 -5
- py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_space-mni_electrodes.tsv +11 -11
- py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_channels.tsv +11 -11
- py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.json +18 -18
- py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vhdr +35 -35
- py_neuromodulation/data/sub-testsub/ses-EphysMedOff/ieeg/sub-testsub_ses-EphysMedOff_task-gripforce_run-0_ieeg.vmrk +13 -13
- py_neuromodulation/data/sub-testsub/ses-EphysMedOff/sub-testsub_ses-EphysMedOff_scans.tsv +2 -2
- py_neuromodulation/default_settings.yaml +241 -0
- py_neuromodulation/features/__init__.py +31 -0
- py_neuromodulation/features/bandpower.py +165 -0
- py_neuromodulation/features/bispectra.py +157 -0
- py_neuromodulation/features/bursts.py +297 -0
- py_neuromodulation/features/coherence.py +255 -0
- py_neuromodulation/features/feature_processor.py +121 -0
- py_neuromodulation/features/fooof.py +142 -0
- py_neuromodulation/features/hjorth_raw.py +57 -0
- py_neuromodulation/features/linelength.py +21 -0
- py_neuromodulation/features/mne_connectivity.py +148 -0
- py_neuromodulation/features/nolds.py +94 -0
- py_neuromodulation/features/oscillatory.py +249 -0
- py_neuromodulation/features/sharpwaves.py +432 -0
- py_neuromodulation/filter/__init__.py +3 -0
- py_neuromodulation/filter/kalman_filter.py +67 -0
- py_neuromodulation/filter/kalman_filter_external.py +1890 -0
- py_neuromodulation/filter/mne_filter.py +128 -0
- py_neuromodulation/filter/notch_filter.py +93 -0
- py_neuromodulation/grid_cortex.tsv +40 -40
- py_neuromodulation/liblsl/libpugixml.so.1.12 +0 -0
- py_neuromodulation/liblsl/linux/bionic_amd64/liblsl.1.16.2.so +0 -0
- py_neuromodulation/liblsl/linux/bookworm_amd64/liblsl.1.16.2.so +0 -0
- py_neuromodulation/liblsl/linux/focal_amd46/liblsl.1.16.2.so +0 -0
- py_neuromodulation/liblsl/linux/jammy_amd64/liblsl.1.16.2.so +0 -0
- py_neuromodulation/liblsl/linux/jammy_x86/liblsl.1.16.2.so +0 -0
- py_neuromodulation/liblsl/linux/noble_amd64/liblsl.1.16.2.so +0 -0
- py_neuromodulation/liblsl/macos/amd64/liblsl.1.16.2.dylib +0 -0
- py_neuromodulation/liblsl/macos/arm64/liblsl.1.16.0.dylib +0 -0
- py_neuromodulation/liblsl/windows/amd64/liblsl.1.16.2.dll +0 -0
- py_neuromodulation/liblsl/windows/x86/liblsl.1.16.2.dll +0 -0
- py_neuromodulation/processing/__init__.py +10 -0
- py_neuromodulation/{nm_artifacts.py → processing/artifacts.py} +29 -25
- py_neuromodulation/processing/data_preprocessor.py +77 -0
- py_neuromodulation/processing/filter_preprocessing.py +78 -0
- py_neuromodulation/processing/normalization.py +175 -0
- py_neuromodulation/{nm_projection.py → processing/projection.py} +370 -394
- py_neuromodulation/{nm_rereference.py → processing/rereference.py} +97 -95
- py_neuromodulation/{nm_resample.py → processing/resample.py} +56 -50
- py_neuromodulation/stream/__init__.py +3 -0
- py_neuromodulation/stream/data_processor.py +325 -0
- py_neuromodulation/stream/generator.py +53 -0
- py_neuromodulation/stream/mnelsl_player.py +94 -0
- py_neuromodulation/stream/mnelsl_stream.py +120 -0
- py_neuromodulation/stream/settings.py +292 -0
- py_neuromodulation/stream/stream.py +427 -0
- py_neuromodulation/utils/__init__.py +2 -0
- py_neuromodulation/{nm_define_nmchannels.py → utils/channels.py} +305 -302
- py_neuromodulation/utils/database.py +149 -0
- py_neuromodulation/utils/io.py +378 -0
- py_neuromodulation/utils/keyboard.py +52 -0
- py_neuromodulation/utils/logging.py +66 -0
- py_neuromodulation/utils/types.py +251 -0
- {py_neuromodulation-0.0.4.dist-info → py_neuromodulation-0.0.6.dist-info}/METADATA +28 -33
- py_neuromodulation-0.0.6.dist-info/RECORD +89 -0
- {py_neuromodulation-0.0.4.dist-info → py_neuromodulation-0.0.6.dist-info}/WHEEL +1 -1
- {py_neuromodulation-0.0.4.dist-info → py_neuromodulation-0.0.6.dist-info}/licenses/LICENSE +21 -21
- py_neuromodulation/FieldTrip.py +0 -589
- py_neuromodulation/_write_example_dataset_helper.py +0 -65
- py_neuromodulation/nm_EpochStream.py +0 -92
- py_neuromodulation/nm_IO.py +0 -417
- py_neuromodulation/nm_across_patient_decoding.py +0 -927
- py_neuromodulation/nm_bispectra.py +0 -168
- py_neuromodulation/nm_bursts.py +0 -198
- py_neuromodulation/nm_coherence.py +0 -205
- py_neuromodulation/nm_cohortwrapper.py +0 -435
- py_neuromodulation/nm_eval_timing.py +0 -239
- py_neuromodulation/nm_features.py +0 -116
- py_neuromodulation/nm_features_abc.py +0 -39
- py_neuromodulation/nm_filter.py +0 -219
- py_neuromodulation/nm_filter_preprocessing.py +0 -91
- py_neuromodulation/nm_fooof.py +0 -159
- py_neuromodulation/nm_generator.py +0 -37
- py_neuromodulation/nm_hjorth_raw.py +0 -73
- py_neuromodulation/nm_kalmanfilter.py +0 -58
- py_neuromodulation/nm_linelength.py +0 -33
- py_neuromodulation/nm_mne_connectivity.py +0 -112
- py_neuromodulation/nm_nolds.py +0 -93
- py_neuromodulation/nm_normalization.py +0 -214
- py_neuromodulation/nm_oscillatory.py +0 -448
- py_neuromodulation/nm_run_analysis.py +0 -435
- py_neuromodulation/nm_settings.json +0 -338
- py_neuromodulation/nm_settings.py +0 -68
- py_neuromodulation/nm_sharpwaves.py +0 -401
- py_neuromodulation/nm_stream_abc.py +0 -218
- py_neuromodulation/nm_stream_offline.py +0 -359
- py_neuromodulation/utils/_logging.py +0 -24
- py_neuromodulation-0.0.4.dist-info/RECORD +0 -72
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
"""Module for offline data streams."""
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
from joblib import Parallel, delayed
|
|
5
|
-
import numpy as np
|
|
6
|
-
import pandas as pd
|
|
7
|
-
from itertools import count
|
|
8
|
-
import logging
|
|
9
|
-
|
|
10
|
-
logger = logging.getLogger("PynmLogger")
|
|
11
|
-
|
|
12
|
-
import mne
|
|
13
|
-
|
|
14
|
-
from py_neuromodulation import (
|
|
15
|
-
nm_generator,
|
|
16
|
-
nm_IO,
|
|
17
|
-
nm_stream_abc,
|
|
18
|
-
nm_define_nmchannels,
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
_PathLike = str | os.PathLike
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class _OfflineStream(nm_stream_abc.PNStream):
|
|
25
|
-
"""Offline stream base class.
|
|
26
|
-
This class can be inhereted for different types of offline streams, e.g. epoch-based or continuous.
|
|
27
|
-
|
|
28
|
-
Parameters
|
|
29
|
-
----------
|
|
30
|
-
nm_stream_abc : nm_stream_abc.PNStream
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
def _add_target(
|
|
34
|
-
self, feature_series: pd.Series, data: np.ndarray
|
|
35
|
-
) -> pd.Series:
|
|
36
|
-
"""Add target channels to feature series.
|
|
37
|
-
|
|
38
|
-
Parameters
|
|
39
|
-
----------
|
|
40
|
-
feature_series : pd.Series
|
|
41
|
-
data : np.ndarray
|
|
42
|
-
Raw data with shape (n_channels, n_samples). Channels not for feature computation are also included
|
|
43
|
-
|
|
44
|
-
Returns
|
|
45
|
-
-------
|
|
46
|
-
pd.Series
|
|
47
|
-
feature series with target channels added
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
if self.nm_channels["target"].sum() > 0:
|
|
51
|
-
if not self.target_idx_initialized:
|
|
52
|
-
self.target_indexes = self.nm_channels[
|
|
53
|
-
self.nm_channels["target"] == 1
|
|
54
|
-
].index
|
|
55
|
-
self.target_names = self.nm_channels.loc[
|
|
56
|
-
self.target_indexes, "name"
|
|
57
|
-
].to_list()
|
|
58
|
-
self.target_idx_initialized = True
|
|
59
|
-
|
|
60
|
-
for target_idx, target_name in zip(
|
|
61
|
-
self.target_indexes, self.target_names
|
|
62
|
-
):
|
|
63
|
-
feature_series[target_name] = data[target_idx, -1]
|
|
64
|
-
return feature_series
|
|
65
|
-
|
|
66
|
-
def _add_timestamp(
|
|
67
|
-
self, feature_series: pd.Series, cnt_samples: int
|
|
68
|
-
) -> pd.Series:
|
|
69
|
-
"""Add time stamp in ms.
|
|
70
|
-
|
|
71
|
-
Due to normalization run_analysis needs to keep track of the counted
|
|
72
|
-
samples. These are accessed here for time conversion.
|
|
73
|
-
"""
|
|
74
|
-
feature_series["time"] = cnt_samples * 1000 / self.sfreq
|
|
75
|
-
|
|
76
|
-
if self.verbose:
|
|
77
|
-
logging.info(
|
|
78
|
-
str(np.round(feature_series["time"] / 1000, 2))
|
|
79
|
-
+ " seconds of data processed"
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
return feature_series
|
|
83
|
-
|
|
84
|
-
def _handle_data(self, data: np.ndarray | pd.DataFrame) -> np.ndarray:
|
|
85
|
-
names_expected = self.nm_channels["name"].to_list()
|
|
86
|
-
|
|
87
|
-
if isinstance(data, np.ndarray):
|
|
88
|
-
if not len(names_expected) == data.shape[0]:
|
|
89
|
-
raise ValueError(
|
|
90
|
-
"If data is passed as an array, the first dimension must"
|
|
91
|
-
" match the number of channel names in `nm_channels`.\n"
|
|
92
|
-
f" Number of data channels (data.shape[0]): {data.shape[0]}\n"
|
|
93
|
-
f" Length of nm_channels[\"name\"]: {len(names_expected)}."
|
|
94
|
-
)
|
|
95
|
-
return data
|
|
96
|
-
names_data = data.columns.to_list()
|
|
97
|
-
if not (
|
|
98
|
-
len(names_expected) == len(names_data)
|
|
99
|
-
and sorted(names_expected) == sorted(names_data)
|
|
100
|
-
):
|
|
101
|
-
raise ValueError(
|
|
102
|
-
"If data is passed as a DataFrame, the"
|
|
103
|
-
"column names must match the channel names in `nm_channels`.\n"
|
|
104
|
-
f"Input dataframe column names: {names_data}\n"
|
|
105
|
-
f"Expected (from nm_channels[\"name\"]): : {names_expected}."
|
|
106
|
-
)
|
|
107
|
-
return data.to_numpy().transpose()
|
|
108
|
-
|
|
109
|
-
def _check_settings_for_parallel(self):
|
|
110
|
-
"""Check specified settings and raise error if parallel processing is not possible.
|
|
111
|
-
|
|
112
|
-
Raises:
|
|
113
|
-
ValueError: depending on the settings, parallel processing is not possible
|
|
114
|
-
"""
|
|
115
|
-
|
|
116
|
-
if "raw_normalization" in self.settings["preprocessing"]:
|
|
117
|
-
raise ValueError(
|
|
118
|
-
"Parallel processing is not possible with raw_normalization normalization."
|
|
119
|
-
)
|
|
120
|
-
if self.settings["postprocessing"]["feature_normalization"] is True:
|
|
121
|
-
raise ValueError(
|
|
122
|
-
"Parallel processing is not possible with feature normalization."
|
|
123
|
-
)
|
|
124
|
-
if self.settings["features"]["bursts"] is True:
|
|
125
|
-
raise ValueError(
|
|
126
|
-
"Parallel processing is not possible with burst estimation."
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
def _process_batch(self, data_batch, cnt_samples):
|
|
130
|
-
feature_series = self.run_analysis.process(
|
|
131
|
-
data_batch.astype(np.float64)
|
|
132
|
-
)
|
|
133
|
-
feature_series = self._add_timestamp(feature_series, cnt_samples)
|
|
134
|
-
feature_series = self._add_target(
|
|
135
|
-
feature_series=feature_series, data=data_batch
|
|
136
|
-
)
|
|
137
|
-
return feature_series
|
|
138
|
-
|
|
139
|
-
def _run_offline(
|
|
140
|
-
self,
|
|
141
|
-
data: np.ndarray,
|
|
142
|
-
out_path_root: _PathLike | None = None,
|
|
143
|
-
folder_name: str = "sub",
|
|
144
|
-
parallel: bool = False,
|
|
145
|
-
n_jobs: int = -2,
|
|
146
|
-
) -> pd.DataFrame:
|
|
147
|
-
generator = nm_generator.raw_data_generator(
|
|
148
|
-
data=data,
|
|
149
|
-
settings=self.settings,
|
|
150
|
-
sfreq=self.sfreq,
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
sample_add = self.sfreq / self.run_analysis.sfreq_features
|
|
154
|
-
|
|
155
|
-
offset_time = self.settings["segment_length_features_ms"]
|
|
156
|
-
# offset_start = np.ceil(offset_time / 1000 * self.sfreq).astype(int)
|
|
157
|
-
offset_start = offset_time / 1000 * self.sfreq
|
|
158
|
-
|
|
159
|
-
if parallel:
|
|
160
|
-
l_features = Parallel(n_jobs=n_jobs, verbose=10)(
|
|
161
|
-
delayed(self._process_batch)(data_batch, cnt_samples)
|
|
162
|
-
for data_batch, cnt_samples in zip(
|
|
163
|
-
generator, count(offset_start, sample_add)
|
|
164
|
-
)
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
else:
|
|
168
|
-
l_features = []
|
|
169
|
-
cnt_samples = offset_start
|
|
170
|
-
while True:
|
|
171
|
-
data_batch = next(generator, None)
|
|
172
|
-
if data_batch is None:
|
|
173
|
-
break
|
|
174
|
-
feature_series = self.run_analysis.process(
|
|
175
|
-
data_batch.astype(np.float64)
|
|
176
|
-
)
|
|
177
|
-
feature_series = self._add_timestamp(
|
|
178
|
-
feature_series, cnt_samples
|
|
179
|
-
)
|
|
180
|
-
|
|
181
|
-
feature_series = self._add_target(
|
|
182
|
-
feature_series=feature_series, data=data_batch
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
l_features.append(feature_series)
|
|
186
|
-
|
|
187
|
-
cnt_samples += sample_add
|
|
188
|
-
feature_df = pd.DataFrame(l_features)
|
|
189
|
-
|
|
190
|
-
self.save_after_stream(out_path_root, folder_name, feature_df)
|
|
191
|
-
|
|
192
|
-
return feature_df
|
|
193
|
-
|
|
194
|
-
def plot_raw_signal(
|
|
195
|
-
self,
|
|
196
|
-
sfreq: float = None,
|
|
197
|
-
data: np.array = None,
|
|
198
|
-
lowpass: float = None,
|
|
199
|
-
highpass: float = None,
|
|
200
|
-
picks: list = None,
|
|
201
|
-
plot_time: bool = True,
|
|
202
|
-
plot_psd: bool = False,
|
|
203
|
-
) -> None:
|
|
204
|
-
"""Use MNE-RawArray Plot to investigate PSD or raw_signal plot.
|
|
205
|
-
|
|
206
|
-
Parameters
|
|
207
|
-
----------
|
|
208
|
-
sfreq : float
|
|
209
|
-
sampling frequency [Hz]
|
|
210
|
-
data : np.array, optional
|
|
211
|
-
data (n_channels, n_times), by default None
|
|
212
|
-
plot_time : bool, optional
|
|
213
|
-
mne.io.RawArray.plot(), by default True
|
|
214
|
-
plot_psd : bool, optional
|
|
215
|
-
mne.io.RawArray.plot(), by default True
|
|
216
|
-
|
|
217
|
-
Raises
|
|
218
|
-
------
|
|
219
|
-
ValueError
|
|
220
|
-
raise Exception when no data is passed
|
|
221
|
-
"""
|
|
222
|
-
if self.data is None and data is None:
|
|
223
|
-
raise ValueError("No data passed to plot_raw_signal function.")
|
|
224
|
-
|
|
225
|
-
if data is None and self.data is not None:
|
|
226
|
-
data = self.data
|
|
227
|
-
|
|
228
|
-
if sfreq is None:
|
|
229
|
-
sfreq = self.sfreq
|
|
230
|
-
|
|
231
|
-
if self.nm_channels is not None:
|
|
232
|
-
ch_names = self.nm_channels["name"].to_list()
|
|
233
|
-
ch_types = self.nm_channels["type"].to_list()
|
|
234
|
-
else:
|
|
235
|
-
ch_names = [f"ch_{i}" for i in range(data.shape[0])]
|
|
236
|
-
ch_types = ["ecog" for i in range(data.shape[0])]
|
|
237
|
-
|
|
238
|
-
# create mne.RawArray
|
|
239
|
-
info = mne.create_info(
|
|
240
|
-
ch_names=ch_names, sfreq=sfreq, ch_types=ch_types
|
|
241
|
-
)
|
|
242
|
-
raw = mne.io.RawArray(data, info)
|
|
243
|
-
|
|
244
|
-
if picks is not None:
|
|
245
|
-
raw = raw.pick(picks)
|
|
246
|
-
self.raw = raw
|
|
247
|
-
if plot_time:
|
|
248
|
-
raw.plot(highpass=highpass, lowpass=lowpass)
|
|
249
|
-
if plot_psd:
|
|
250
|
-
raw.compute_psd().plot()
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
class Stream(_OfflineStream):
|
|
254
|
-
def __init__(
|
|
255
|
-
self,
|
|
256
|
-
sfreq: int | float,
|
|
257
|
-
data: np.ndarray | pd.DataFrame = None,
|
|
258
|
-
nm_channels: pd.DataFrame | _PathLike = None,
|
|
259
|
-
settings: dict | _PathLike | None = None,
|
|
260
|
-
sampling_rate_features_hz: float = None,
|
|
261
|
-
line_noise: int | float | None = 50,
|
|
262
|
-
path_grids: _PathLike | None = None,
|
|
263
|
-
coord_names: list | None = None,
|
|
264
|
-
coord_list: list | None = None,
|
|
265
|
-
verbose: bool = True,
|
|
266
|
-
) -> None:
|
|
267
|
-
"""Stream initialization
|
|
268
|
-
|
|
269
|
-
Parameters
|
|
270
|
-
----------
|
|
271
|
-
sfreq : int | float
|
|
272
|
-
sampling frequency of data in Hertz
|
|
273
|
-
data : np.ndarray | pd.DataFrame | None, optional
|
|
274
|
-
data to be streamed with shape (n_channels, n_time), by default None
|
|
275
|
-
nm_channels : pd.DataFrame | _PathLike
|
|
276
|
-
parametrization of channels (see nm_define_channels.py for initialization)
|
|
277
|
-
settings : dict | _PathLike | None, optional
|
|
278
|
-
features settings can be a dictionary or path to the nm_settings.json, by default the py_neuromodulation/nm_settings.json are read
|
|
279
|
-
line_noise : int | float | None, optional
|
|
280
|
-
line noise, by default 50
|
|
281
|
-
sampling_rate_features_hz : int | float | None, optional
|
|
282
|
-
feature sampling rate, by default None
|
|
283
|
-
path_grids : _PathLike | None, optional
|
|
284
|
-
path to grid_cortex.tsv and/or gird_subcortex.tsv, by default Non
|
|
285
|
-
coord_names : list | None, optional
|
|
286
|
-
coordinate name in the form [coord_1_name, coord_2_name, etc], by default None
|
|
287
|
-
coord_list : list | None, optional
|
|
288
|
-
coordinates in the form [[coord_1_x, coord_1_y, coord_1_z], [coord_2_x, coord_2_y, coord_2_z],], by default None
|
|
289
|
-
verbose : bool, optional
|
|
290
|
-
log stream computation time information, by default True
|
|
291
|
-
"""
|
|
292
|
-
|
|
293
|
-
if nm_channels is None and data is not None:
|
|
294
|
-
nm_channels = nm_define_nmchannels.get_default_channels_from_data(
|
|
295
|
-
data
|
|
296
|
-
)
|
|
297
|
-
|
|
298
|
-
if nm_channels is None and data is None:
|
|
299
|
-
raise ValueError(
|
|
300
|
-
"Either `nm_channels` or `data` must be passed to `Stream`."
|
|
301
|
-
)
|
|
302
|
-
|
|
303
|
-
super().__init__(
|
|
304
|
-
sfreq,
|
|
305
|
-
nm_channels,
|
|
306
|
-
settings,
|
|
307
|
-
line_noise,
|
|
308
|
-
sampling_rate_features_hz,
|
|
309
|
-
path_grids,
|
|
310
|
-
coord_names,
|
|
311
|
-
coord_list,
|
|
312
|
-
verbose,
|
|
313
|
-
)
|
|
314
|
-
|
|
315
|
-
self.data = data
|
|
316
|
-
|
|
317
|
-
self.target_idx_initialized = False
|
|
318
|
-
|
|
319
|
-
def run(
|
|
320
|
-
self,
|
|
321
|
-
data: np.ndarray | pd.DataFrame = None,
|
|
322
|
-
out_path_root: _PathLike | None = None,
|
|
323
|
-
folder_name: str = "sub",
|
|
324
|
-
parallel: bool = False,
|
|
325
|
-
n_jobs: int = -2,
|
|
326
|
-
) -> pd.DataFrame:
|
|
327
|
-
"""Call run function for offline stream.
|
|
328
|
-
|
|
329
|
-
Parameters
|
|
330
|
-
----------
|
|
331
|
-
data : np.ndarray | pd.DataFrame
|
|
332
|
-
shape (n_channels, n_time)
|
|
333
|
-
out_path_root : _PathLike | None, optional
|
|
334
|
-
Full path to store estimated features, by default None
|
|
335
|
-
If None, data is simply returned and not saved
|
|
336
|
-
folder_name : str, optional
|
|
337
|
-
folder output name, commonly subject or run name, by default "sub"
|
|
338
|
-
|
|
339
|
-
Returns
|
|
340
|
-
-------
|
|
341
|
-
pd.DataFrame
|
|
342
|
-
feature DataFrame
|
|
343
|
-
"""
|
|
344
|
-
|
|
345
|
-
super().run() # reinitialize the stream
|
|
346
|
-
|
|
347
|
-
if data is not None:
|
|
348
|
-
data = self._handle_data(data)
|
|
349
|
-
elif self.data is not None:
|
|
350
|
-
data = self._handle_data(self.data)
|
|
351
|
-
elif self.data is None and data is None:
|
|
352
|
-
raise ValueError("No data passed to run function.")
|
|
353
|
-
|
|
354
|
-
if parallel is True:
|
|
355
|
-
self._check_settings_for_parallel()
|
|
356
|
-
|
|
357
|
-
return self._run_offline(
|
|
358
|
-
data, out_path_root, folder_name, parallel=parallel, n_jobs=n_jobs
|
|
359
|
-
)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
# include the filename in the log output
|
|
4
|
-
# Configure the logger
|
|
5
|
-
logger = logging.getLogger("PynmLogger")
|
|
6
|
-
logger.setLevel(logging.INFO)
|
|
7
|
-
|
|
8
|
-
# Create a file handler and set its level to DEBUG
|
|
9
|
-
file_handler = logging.FileHandler("logfile_pynm.log")
|
|
10
|
-
file_handler.setLevel(logging.INFO)
|
|
11
|
-
|
|
12
|
-
# console_handler = logging.StreamHandler()
|
|
13
|
-
# console_handler.setLevel(logging.DEBUG)
|
|
14
|
-
|
|
15
|
-
# Create a formatter and add it to the handler
|
|
16
|
-
formatter = logging.Formatter(
|
|
17
|
-
"%(asctime)s:%(levelname)s:%(name)s:%(filename)s:%(message)s"
|
|
18
|
-
)
|
|
19
|
-
file_handler.setFormatter(formatter)
|
|
20
|
-
# console_handler.setFormatter(formatter)
|
|
21
|
-
|
|
22
|
-
# Add the file handler to the logger
|
|
23
|
-
logger.addHandler(file_handler)
|
|
24
|
-
# logger.addHandler(console_handler)
|
|
@@ -1,72 +0,0 @@
|
|
|
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,,
|