py-neuromodulation 0.1.2__py3-none-any.whl → 0.1.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.
@@ -144,8 +144,14 @@ class SharpwaveAnalyzer(NMFeature):
144
144
  )
145
145
 
146
146
  self.filter_names = [name for name, _ in self.list_filter]
147
- self.filters = np.vstack([filter for _, filter in self.list_filter])
148
- self.filters = np.tile(self.filters[None, :, :], (len(self.ch_names), 1, 1))
147
+ filter_lengths = [len(f) for _, f in self.list_filter]
148
+
149
+ self.equal_filters_lengths = len(set(filter_lengths)) <= 1
150
+ if self.equal_filters_lengths:
151
+ self.filters = np.vstack([f for _, f in self.list_filter])
152
+ self.filters = np.tile(self.filters[None, :, :], (len(self.ch_names), 1, 1))
153
+ else:
154
+ self.filters = [np.tile(f, (len(self.ch_names), 1)) for _, f in self.list_filter]
149
155
 
150
156
  self.used_features = self.sw_settings.sharpwave_features.get_enabled()
151
157
 
@@ -235,8 +241,14 @@ class SharpwaveAnalyzer(NMFeature):
235
241
 
236
242
  from scipy.signal import fftconvolve
237
243
 
238
- data = np.tile(data[:, None, :], (1, len(self.list_filter), 1))
239
- data = fftconvolve(data, self.filters, axes=2, mode="same")
244
+ if self.equal_filters_lengths:
245
+ data = np.tile(data[:, None, :], (1, len(self.list_filter), 1))
246
+ data = fftconvolve(data, self.filters, axes=2, mode="same")
247
+ else:
248
+ len_data = len(data[0])
249
+ conv_results = [fftconvolve(data, f, mode="same") for f in self.filters]
250
+ data = np.concat(conv_results, axis=1)
251
+ data = data.reshape([len(self.ch_names), len(self.filters), len_data])
240
252
 
241
253
  self.filtered_data = (
242
254
  data # TONI: Expose filtered data for example 3, need a better way
@@ -13906,7 +13906,11 @@ const useSessionStore = createStore("session", (set2, get) => ({
13906
13906
  sourceType: null,
13907
13907
  // 'file' or 'lsl'
13908
13908
  isSourceValid: false,
13909
- fileSource: {},
13909
+ fileSource: {
13910
+ name: "",
13911
+ path: "",
13912
+ size: 0
13913
+ },
13910
13914
  // FileInfo object
13911
13915
  lslSource: {
13912
13916
  selectedStream: null,
@@ -14183,7 +14187,7 @@ const useSessionStore = createStore("session", (set2, get) => ({
14183
14187
  sourceType: null,
14184
14188
  isSourceValid: false,
14185
14189
  fileSource: {
14186
- filePath: ""
14190
+ path: ""
14187
14191
  },
14188
14192
  lslSource: {
14189
14193
  streamName: ""
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/charite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>PyNeuromodulation</title>
8
- <script type="module" crossorigin src="/assets/index-_6V8ZfAS.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-B53U6dwc.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/plotly-DTCwMlpS.js">
10
10
  </head>
11
11
  <body>
@@ -1,3 +1,3 @@
1
1
  [log]
2
- level = 0
3
- file = ./lsllog.txt
2
+ level = 6
3
+ file = ./lsllog.txt
@@ -39,7 +39,7 @@ class Stream:
39
39
  path_grids: _PathLike | None = None,
40
40
  coord_names: list | None = None,
41
41
  coord_list: list | None = None,
42
- verbose: bool = True,
42
+ verbose: bool = False,
43
43
  ) -> None:
44
44
  """Stream initialization
45
45
 
@@ -208,6 +208,7 @@ class Stream:
208
208
  simulate_real_time: bool = False,
209
209
  decoder: RealTimeDecoder | None = None,
210
210
  backend_interface: StreamBackendInterface | None = None,
211
+ delete_ind_batch_files_after_stream: bool = True,
211
212
  ) -> "pd.DataFrame":
212
213
  self.is_stream_lsl = is_stream_lsl
213
214
  self.stream_lsl_name = stream_lsl_name
@@ -240,7 +241,8 @@ class Stream:
240
241
  verbose=self.verbose,
241
242
  )
242
243
 
243
- nm.logger.log_to_file(out_dir)
244
+ if self.verbose:
245
+ nm.logger.log_to_file(out_dir)
244
246
 
245
247
  self.generator: Iterator
246
248
  if not is_stream_lsl and data is not None:
@@ -337,6 +339,9 @@ class Stream:
337
339
  self._save_after_stream()
338
340
  self.is_running = False
339
341
 
342
+ if delete_ind_batch_files_after_stream is True:
343
+ file_writer.delete_ind_files()
344
+
340
345
  return feature_df # Timon: We could think of returnader instead
341
346
 
342
347
  def _prepare_raw_data_dict(self, data_batch: np.ndarray) -> dict[str, Any]:
@@ -108,3 +108,11 @@ class MsgPackFileWriter(AbstractFileWriter):
108
108
  with open(outpath, "rb") as f:
109
109
  data = msgpack.unpack(f)
110
110
  data.to_csv(self.csv_path, index=False)
111
+
112
+ def delete_ind_files(self,):
113
+ """
114
+ Delete individual MessagePack files.
115
+ """
116
+ files_msg_pack = list(self.out_dir.glob(f"{self.name}-*.msgpack"))
117
+ for file in files_msg_pack:
118
+ file.unlink()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py_neuromodulation
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Real-time analysis of intracranial neurophysiology recordings.
5
5
  Project-URL: Homepage, https://neuromodulation.github.io/py_neuromodulation/
6
6
  Project-URL: Documentation, https://neuromodulation.github.io/py_neuromodulation/
@@ -35,7 +35,7 @@ Classifier: Development Status :: 2 - Pre-Alpha
35
35
  Classifier: License :: OSI Approved :: MIT License
36
36
  Classifier: Programming Language :: Python
37
37
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
38
- Requires-Python: >=3.11
38
+ Requires-Python: >=3.12
39
39
  Requires-Dist: cbor2>=5.6.4
40
40
  Requires-Dist: fastapi
41
41
  Requires-Dist: fooof
@@ -48,6 +48,7 @@ Requires-Dist: mne-bids>=0.8
48
48
  Requires-Dist: mne-connectivity
49
49
  Requires-Dist: mne-lsl>=1.2.0
50
50
  Requires-Dist: mrmr-selection
51
+ Requires-Dist: msgpack
51
52
  Requires-Dist: msgpack>=1.1.0
52
53
  Requires-Dist: nibabel>=5.3.2
53
54
  Requires-Dist: nolds>=0.6.1
@@ -59,6 +60,7 @@ Requires-Dist: pyarrow>=14.0.2
59
60
  Requires-Dist: pybispectra>=1.2.0
60
61
  Requires-Dist: pydantic>=2.7.3
61
62
  Requires-Dist: pyparrm
63
+ Requires-Dist: pyqt6
62
64
  Requires-Dist: pywebview
63
65
  Requires-Dist: scikit-learn>=0.24.2
64
66
  Requires-Dist: scikit-optimize
@@ -128,7 +130,7 @@ Find the documentation here neuromodulation.github.io/py_neuromodulation/ for ex
128
130
  Installation
129
131
  ============
130
132
 
131
- py_neuromodulation requires at least python 3.10. For installation you can use pip:
133
+ py_neuromodulation requires at least python 3.12. For installation you can use pip:
132
134
 
133
135
  .. code-block::
134
136
 
@@ -138,7 +140,7 @@ Alternatively you can also clone the pacakge and install it using `uv <https://d
138
140
 
139
141
  .. code-block::
140
142
 
141
- uv python install 3.10
143
+ uv python install 3.12
142
144
  uv venv
143
145
  . .venv/bin/activate
144
146
  uv sync
@@ -168,7 +170,7 @@ Basic Usage
168
170
  stream = nm.Stream(sfreq=sfreq, data=data, sampling_rate_features_hz=sampling_rate_features_hz)
169
171
  features = stream.run()
170
172
 
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.
173
+ Check the `Usage <https://neuromodulation.github.io/py_neuromodulation/usage.html>`_ and `First examples <https://neuromodulation.github.io/py_neuromodulation/auto_examples/index.html>`_ for further introduction.
172
174
 
173
175
  Contact information
174
176
  -------------------
@@ -2,7 +2,7 @@ py_neuromodulation/__init__.py,sha256=gu0XWs6bzSMJ7JTu8xxFMCPj6TY0nQ6Q0tuBkK7onR
2
2
  py_neuromodulation/default_settings.yaml,sha256=tEKmC16yQwy1MFMRI8cdshT8tTdZ35DB5SqqlNWES04,6387
3
3
  py_neuromodulation/grid_cortex.tsv,sha256=k2QOkHY1ej3lJ33LD6DOPVlTynzB3s4BYaoQaoUCyYc,643
4
4
  py_neuromodulation/grid_subcortex.tsv,sha256=oCQDYLDdYSa1DAI9ybwECfuzWulFzXqKHyf7oZ1oDBM,25842
5
- py_neuromodulation/lsl_api.cfg,sha256=8j2EMZkPb-T4w3RAXzoDoWL7bwOgk1vMYPYq9Xi0J6o,37
5
+ py_neuromodulation/lsl_api.cfg,sha256=oKJ5S_9mJjLUCuI4i1jZVOOquNebzdCDIMQWv1gwT3U,39
6
6
  py_neuromodulation/run_gui.py,sha256=NW6mjSfgNAHoIcFYOD-kebANTvw3UKr470lLplveicI,700
7
7
  py_neuromodulation/ConnectivityDecoding/Automated Anatomical Labeling 3 (Rolls 2020).nii,sha256=Sp-cjF_AuT0Tlilb5s8lB14hVgkXJiR2uKMS9nOQOeg,902981
8
8
  py_neuromodulation/ConnectivityDecoding/_get_grid_hull.m,sha256=2RPDGotbLsCzDJLFB2JXatJtfOMno9UUBCBnsOuse8A,714
@@ -42,7 +42,7 @@ py_neuromodulation/features/linelength.py,sha256=8BTctvr9Zj8TEK2HLJqi73j_y2Xgt8l
42
42
  py_neuromodulation/features/mne_connectivity.py,sha256=lQHLIXmoyDOWf5agmGMLeq1cQLiG6ud-vYf75CpYTVI,4109
43
43
  py_neuromodulation/features/nolds.py,sha256=jNCKQlIfmcAhmzjTAJMbFPhRuPtYZF5BDzR4qHlLp1k,3374
44
44
  py_neuromodulation/features/oscillatory.py,sha256=KzQQ3EA75G-hJVmL_YBybWTnuNJFZXAM0aBHudr-dvM,7806
45
- py_neuromodulation/features/sharpwaves.py,sha256=scFp1jMfq7Eq5th2JtwWm51RpGr8ogQHKCatzv5ZINI,17970
45
+ py_neuromodulation/features/sharpwaves.py,sha256=UpNsaD77Kf5wY22cEhQ9WMNxiBVxjxzDfcsVqubYgm0,18562
46
46
  py_neuromodulation/filter/__init__.py,sha256=ut1q8daCZoN7lhTKURGpk1X5oKiS3eSNqR7SkZyGDJw,128
47
47
  py_neuromodulation/filter/kalman_filter.py,sha256=-aSAq7KcJ8LUjUThsQtTaIcvz-Qtavik6ltk59j7O-Q,2194
48
48
  py_neuromodulation/filter/kalman_filter_external.py,sha256=_7FFq-1GQY9mNA0EvmaM4wQ46DVkHC9bYFIgiw9b6nY,61367
@@ -57,9 +57,9 @@ py_neuromodulation/gui/backend/app_socket.py,sha256=QeaD1AKd_F2oPDKtpikgcNL3v9v8
57
57
  py_neuromodulation/gui/backend/app_utils.py,sha256=KgnldjqiYosgGGtE7l7LOg-q3_U1Cpz3IlpnkzGuux8,9693
58
58
  py_neuromodulation/gui/backend/app_window.py,sha256=eOk4yjx4qIKYKZhyP8MPlnbZx6OF7DjFgyG8rXjo2vY,6207
59
59
  py_neuromodulation/gui/frontend/charite.svg,sha256=RlvOSsBUuFKePKjkuadbtI1Yv3zZ41nRbfqfEb0h_88,1112
60
- py_neuromodulation/gui/frontend/index.html,sha256=KcUTa9J6SDm0TByHx4jONsKg-71Neb4t6OwLXnkPaZY,470
60
+ py_neuromodulation/gui/frontend/index.html,sha256=-30HoBOEmsPAR1QxJj5L4TpPevYgRyf4VIDR4CtpXU4,470
61
61
  py_neuromodulation/gui/frontend/assets/Figtree-VariableFont_wght-CkXbWBDP.ttf,sha256=_tZBDRp07GKuFOiGalezi5Pedl29EpNUhoJ2lAspjXA,62868
62
- py_neuromodulation/gui/frontend/assets/index-_6V8ZfAS.js,sha256=2w7EYZXY-d-YBFdoMyzJyfzIyds27tV2a5y1-X29lcs,13847236
62
+ py_neuromodulation/gui/frontend/assets/index-B53U6dwc.js,sha256=2-GEEs-bOOec81oVIwiLZyQExQW0qvQy3kSHa2DOjQ0,13847275
63
63
  py_neuromodulation/gui/frontend/assets/plotly-DTCwMlpS.js,sha256=O34l2pwjKay4L9VvYbEvRUuJ8PbvTTQGaPqZUcoao0g,1696475
64
64
  py_neuromodulation/liblsl/libpugixml.so.1.12,sha256=_bCOHUjcnGpDiROg1qjgty8ZQhcKHSnaCIP6SMgw6SY,240248
65
65
  py_neuromodulation/liblsl/linux/bionic_amd64/liblsl.1.16.2.so,sha256=YXFbA23CQqWg6mWhk-73WY9gSx79NtgnBr6UFVByC2I,1033592
@@ -91,19 +91,19 @@ py_neuromodulation/stream/generator.py,sha256=UKLuM8gz2YLBuVQnQNkkOOKhwsyW27ZgvR
91
91
  py_neuromodulation/stream/mnelsl_player.py,sha256=KksAWzr78JPqPlECweWZ7JThoxmTVWGo1_-m-fEL0N4,6351
92
92
  py_neuromodulation/stream/mnelsl_stream.py,sha256=-uHMCNLZwIcjiT9AMGWkJit5GsZjEJYkpki_DoaLzWY,4352
93
93
  py_neuromodulation/stream/settings.py,sha256=--K4NOlR3QNmg4ISgtvC1z_Ucf7MvGChvocck3w6LoI,11832
94
- py_neuromodulation/stream/stream.py,sha256=rpuhBv2W4NyBRy2I8gUoam-8li3oiyd2Ni7TIRHCCu0,16405
94
+ py_neuromodulation/stream/stream.py,sha256=tcIH0tW99qxrMS3GeRF45xe9K3PO6FB8JlYESH5uNDk,16593
95
95
  py_neuromodulation/utils/__init__.py,sha256=Ok3STMpsflCTclJC9C1iQgdT-3HNGMM7U45w5Oespr4,46
96
96
  py_neuromodulation/utils/channels.py,sha256=bDUZZ8MB3T-Kcs6zI52MUmvC8qx9KAH-F9U0GyND79U,10649
97
97
  py_neuromodulation/utils/database.py,sha256=VEFsmbYDQWwaoZKmJCG8oyWoDTbfSiT_p0n7da9_Pn4,4755
98
- py_neuromodulation/utils/file_writer.py,sha256=rflDqcsRat0uAYppYXf_cYqpodZsyiGvz52JAxxULzg,3187
98
+ py_neuromodulation/utils/file_writer.py,sha256=eJLx3hK1-1VHKFXWHl4bPZH-dJ8zplUBLVQPDOa_VgQ,3427
99
99
  py_neuromodulation/utils/io.py,sha256=uE4k3ScspRy_RuWrrV7cdosH4eKxJKAkvnr5KC8SG6A,11515
100
100
  py_neuromodulation/utils/keyboard.py,sha256=swoxYhf4Q3pj50EKALUFt6hREfXnoXq2Z2q01IahPe8,1505
101
101
  py_neuromodulation/utils/logging.py,sha256=eIBFBRaAMb3KJnoxNFiCkMrTGzWwgfeDs8m5iq6FxN8,2178
102
102
  py_neuromodulation/utils/perf.py,sha256=10LYM13iTuWA-il-EMMOyZke3-1gcFEa6WLlHsJLO50,5471
103
103
  py_neuromodulation/utils/pydantic_extensions.py,sha256=nkgq8QHeKSJgmf1cBThBLQ9prdeZZ3_Pyeogs-WnHTA,11030
104
104
  py_neuromodulation/utils/types.py,sha256=hT4U9uj4PhHfu8cO7xE1oXj_KT1uHtP-rNY_cDbofr0,4643
105
- py_neuromodulation-0.1.2.dist-info/METADATA,sha256=B8BA9dpSlZjWGHrQYtTt9FFdWAwFQcUKTiGFk_JqRP8,7699
106
- py_neuromodulation-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
107
- py_neuromodulation-0.1.2.dist-info/entry_points.txt,sha256=hImSrCn9vJcwocoeehqNyJ-qj5Hgfrg2o6MPAnIaAa0,60
108
- py_neuromodulation-0.1.2.dist-info/licenses/LICENSE,sha256=EMBwuBRPBo-WkHSjqxZ55E6j95gKNBZ8x30pt-VGfrM,1118
109
- py_neuromodulation-0.1.2.dist-info/RECORD,,
105
+ py_neuromodulation-0.1.4.dist-info/METADATA,sha256=VHAB6P_4FPz5JZtaJHtI15rXEMRuBbThJX8fKOv8-wE,7733
106
+ py_neuromodulation-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
107
+ py_neuromodulation-0.1.4.dist-info/entry_points.txt,sha256=hImSrCn9vJcwocoeehqNyJ-qj5Hgfrg2o6MPAnIaAa0,60
108
+ py_neuromodulation-0.1.4.dist-info/licenses/LICENSE,sha256=EMBwuBRPBo-WkHSjqxZ55E6j95gKNBZ8x30pt-VGfrM,1118
109
+ py_neuromodulation-0.1.4.dist-info/RECORD,,