py-neuromodulation 0.1.3__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.3
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
@@ -130,7 +130,7 @@ Find the documentation here neuromodulation.github.io/py_neuromodulation/ for ex
130
130
  Installation
131
131
  ============
132
132
 
133
- 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:
134
134
 
135
135
  .. code-block::
136
136
 
@@ -140,7 +140,7 @@ Alternatively you can also clone the pacakge and install it using `uv <https://d
140
140
 
141
141
  .. code-block::
142
142
 
143
- uv python install 3.10
143
+ uv python install 3.12
144
144
  uv venv
145
145
  . .venv/bin/activate
146
146
  uv sync
@@ -170,7 +170,7 @@ Basic Usage
170
170
  stream = nm.Stream(sfreq=sfreq, data=data, sampling_rate_features_hz=sampling_rate_features_hz)
171
171
  features = stream.run()
172
172
 
173
- 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.
174
174
 
175
175
  Contact information
176
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.3.dist-info/METADATA,sha256=AKcHisB9DBcm-PDWCjw746YkK0itHLoezHp8e4ruY8U,7743
106
- py_neuromodulation-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
107
- py_neuromodulation-0.1.3.dist-info/entry_points.txt,sha256=hImSrCn9vJcwocoeehqNyJ-qj5Hgfrg2o6MPAnIaAa0,60
108
- py_neuromodulation-0.1.3.dist-info/licenses/LICENSE,sha256=EMBwuBRPBo-WkHSjqxZ55E6j95gKNBZ8x30pt-VGfrM,1118
109
- py_neuromodulation-0.1.3.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,,