bmtool 0.7.1__py3-none-any.whl → 0.7.1.1__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.
- bmtool/analysis/entrainment.py +48 -12
- {bmtool-0.7.1.dist-info → bmtool-0.7.1.1.dist-info}/METADATA +1 -1
- {bmtool-0.7.1.dist-info → bmtool-0.7.1.1.dist-info}/RECORD +7 -7
- {bmtool-0.7.1.dist-info → bmtool-0.7.1.1.dist-info}/WHEEL +0 -0
- {bmtool-0.7.1.dist-info → bmtool-0.7.1.1.dist-info}/entry_points.txt +0 -0
- {bmtool-0.7.1.dist-info → bmtool-0.7.1.1.dist-info}/licenses/LICENSE +0 -0
- {bmtool-0.7.1.dist-info → bmtool-0.7.1.1.dist-info}/top_level.txt +0 -0
bmtool/analysis/entrainment.py
CHANGED
@@ -180,7 +180,18 @@ def calculate_spike_lfp_plv(
|
|
180
180
|
spike_indices = np.round(spike_times_seconds * lfp_fs).astype(int)
|
181
181
|
|
182
182
|
# Filter indices to ensure they're within bounds of the LFP signal
|
183
|
-
|
183
|
+
if isinstance(lfp_data, xr.DataArray):
|
184
|
+
if filtered_lfp_phase is not None:
|
185
|
+
valid_indices = align_spike_times_with_lfp(
|
186
|
+
lfp=filtered_lfp_phase, timestamps=spike_indices
|
187
|
+
)
|
188
|
+
else:
|
189
|
+
valid_indices = align_spike_times_with_lfp(lfp=lfp_data, timestamps=spike_indices)
|
190
|
+
elif isinstance(lfp_data, np.ndarray):
|
191
|
+
if filtered_lfp_phase is not None:
|
192
|
+
valid_indices = [idx for idx in spike_indices if 0 <= idx < len(filtered_lfp_phase)]
|
193
|
+
else:
|
194
|
+
valid_indices = [idx for idx in spike_indices if 0 <= idx < len(lfp_data)]
|
184
195
|
|
185
196
|
if len(valid_indices) <= 1:
|
186
197
|
return 0
|
@@ -200,7 +211,10 @@ def calculate_spike_lfp_plv(
|
|
200
211
|
instantaneous_phase = filtered_lfp_phase
|
201
212
|
|
202
213
|
# Get phases at spike times
|
203
|
-
|
214
|
+
if isinstance(instantaneous_phase, xr.DataArray):
|
215
|
+
spike_phases = instantaneous_phase.sel(time=valid_indices).values
|
216
|
+
else:
|
217
|
+
spike_phases = instantaneous_phase[valid_indices]
|
204
218
|
|
205
219
|
# Number of spikes
|
206
220
|
N = len(spike_phases)
|
@@ -311,10 +325,18 @@ def calculate_ppc(
|
|
311
325
|
spike_indices = np.round(spike_times_seconds * lfp_fs).astype(int)
|
312
326
|
|
313
327
|
# Filter indices to ensure they're within bounds of the LFP signal
|
314
|
-
if
|
315
|
-
|
316
|
-
|
317
|
-
|
328
|
+
if isinstance(lfp_data, xr.DataArray):
|
329
|
+
if filtered_lfp_phase is not None:
|
330
|
+
valid_indices = align_spike_times_with_lfp(
|
331
|
+
lfp=filtered_lfp_phase, timestamps=spike_indices
|
332
|
+
)
|
333
|
+
else:
|
334
|
+
valid_indices = align_spike_times_with_lfp(lfp=lfp_data, timestamps=spike_indices)
|
335
|
+
elif isinstance(lfp_data, np.ndarray):
|
336
|
+
if filtered_lfp_phase is not None:
|
337
|
+
valid_indices = [idx for idx in spike_indices if 0 <= idx < len(filtered_lfp_phase)]
|
338
|
+
else:
|
339
|
+
valid_indices = [idx for idx in spike_indices if 0 <= idx < len(lfp_data)]
|
318
340
|
|
319
341
|
if len(valid_indices) <= 1:
|
320
342
|
return 0
|
@@ -334,7 +356,10 @@ def calculate_ppc(
|
|
334
356
|
instantaneous_phase = filtered_lfp_phase
|
335
357
|
|
336
358
|
# Get phases at spike times
|
337
|
-
|
359
|
+
if isinstance(instantaneous_phase, xr.DataArray):
|
360
|
+
spike_phases = instantaneous_phase.sel(time=valid_indices).values
|
361
|
+
else:
|
362
|
+
spike_phases = instantaneous_phase[valid_indices]
|
338
363
|
|
339
364
|
n_spikes = len(spike_phases)
|
340
365
|
|
@@ -418,10 +443,18 @@ def calculate_ppc2(
|
|
418
443
|
spike_indices = np.round(spike_times_seconds * lfp_fs).astype(int)
|
419
444
|
|
420
445
|
# Filter indices to ensure they're within bounds of the LFP signal
|
421
|
-
if
|
422
|
-
|
423
|
-
|
424
|
-
|
446
|
+
if isinstance(lfp_data, xr.DataArray):
|
447
|
+
if filtered_lfp_phase is not None:
|
448
|
+
valid_indices = align_spike_times_with_lfp(
|
449
|
+
lfp=filtered_lfp_phase, timestamps=spike_indices
|
450
|
+
)
|
451
|
+
else:
|
452
|
+
valid_indices = align_spike_times_with_lfp(lfp=lfp_data, timestamps=spike_indices)
|
453
|
+
elif isinstance(lfp_data, np.ndarray):
|
454
|
+
if filtered_lfp_phase is not None:
|
455
|
+
valid_indices = [idx for idx in spike_indices if 0 <= idx < len(filtered_lfp_phase)]
|
456
|
+
else:
|
457
|
+
valid_indices = [idx for idx in spike_indices if 0 <= idx < len(lfp_data)]
|
425
458
|
|
426
459
|
if len(valid_indices) <= 1:
|
427
460
|
return 0
|
@@ -441,7 +474,10 @@ def calculate_ppc2(
|
|
441
474
|
instantaneous_phase = filtered_lfp_phase
|
442
475
|
|
443
476
|
# Get phases at spike times
|
444
|
-
|
477
|
+
if isinstance(instantaneous_phase, xr.DataArray):
|
478
|
+
spike_phases = instantaneous_phase.sel(time=valid_indices).values
|
479
|
+
else:
|
480
|
+
spike_phases = instantaneous_phase[valid_indices]
|
445
481
|
# Calculate PPC2 according to Vinck et al. (2010), Equation 6
|
446
482
|
n = len(spike_phases)
|
447
483
|
|
@@ -8,7 +8,7 @@ bmtool/plot_commands.py,sha256=Dxm_RaT4CtHnfsltTtUopJ4KVbfhxtktEB_b7bFEXII,12716
|
|
8
8
|
bmtool/singlecell.py,sha256=I2yolbAnNC8qpnRkNdnDCLidNW7CktmBuRrcowMZJ3A,45041
|
9
9
|
bmtool/synapses.py,sha256=wlRY7IixefPzafqG6k2sPIK4s6PLG9Kct-oCaVR29wA,64269
|
10
10
|
bmtool/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
bmtool/analysis/entrainment.py,sha256=
|
11
|
+
bmtool/analysis/entrainment.py,sha256=Nzrt1pKHEDzrx9TYnsE0sbevxl4iht1fymA29khq8Pg,26841
|
12
12
|
bmtool/analysis/lfp.py,sha256=S2JvxkjcK3-EH93wCrhqNSFY6cX7fOq74pz64ibHKrc,26556
|
13
13
|
bmtool/analysis/netcon_reports.py,sha256=VnPZNKPaQA7oh1q9cIatsqQudm4cOtzNtbGPXoiDCD0,2909
|
14
14
|
bmtool/analysis/spikes.py,sha256=ScP4EeX2QuEd_FXyj3W0WWgZKvZwwneuWuKFe3xwaCY,15115
|
@@ -26,9 +26,9 @@ bmtool/util/commands.py,sha256=Nn-R-4e9g8ZhSPZvTkr38xeKRPfEMANB9Lugppj82UI,68564
|
|
26
26
|
bmtool/util/util.py,sha256=owce5BEusZO_8T5x05N2_B583G26vWAy7QX29V0Pj0Y,62818
|
27
27
|
bmtool/util/neuron/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
28
|
bmtool/util/neuron/celltuner.py,sha256=lokRLUM1rsdSYBYrNbLBBo39j14mm8TBNVNRnSlhHCk,94868
|
29
|
-
bmtool-0.7.1.dist-info/licenses/LICENSE,sha256=qrXg2jj6kz5d0EnN11hllcQt2fcWVNumx0xNbV05nyM,1068
|
30
|
-
bmtool-0.7.1.dist-info/METADATA,sha256=
|
31
|
-
bmtool-0.7.1.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
32
|
-
bmtool-0.7.1.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
|
33
|
-
bmtool-0.7.1.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
|
34
|
-
bmtool-0.7.1.dist-info/RECORD,,
|
29
|
+
bmtool-0.7.1.1.dist-info/licenses/LICENSE,sha256=qrXg2jj6kz5d0EnN11hllcQt2fcWVNumx0xNbV05nyM,1068
|
30
|
+
bmtool-0.7.1.1.dist-info/METADATA,sha256=ONMkDOU2sGv2xzC9jbP5z9HdGFI2HGO_2fwS6cIBj3w,3623
|
31
|
+
bmtool-0.7.1.1.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
32
|
+
bmtool-0.7.1.1.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
|
33
|
+
bmtool-0.7.1.1.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
|
34
|
+
bmtool-0.7.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|