bmtool 0.7.1.4__py3-none-any.whl → 0.7.1.5__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 +21 -8
- bmtool/analysis/spikes.py +10 -12
- {bmtool-0.7.1.4.dist-info → bmtool-0.7.1.5.dist-info}/METADATA +1 -1
- {bmtool-0.7.1.4.dist-info → bmtool-0.7.1.5.dist-info}/RECORD +8 -8
- {bmtool-0.7.1.4.dist-info → bmtool-0.7.1.5.dist-info}/WHEEL +1 -1
- {bmtool-0.7.1.4.dist-info → bmtool-0.7.1.5.dist-info}/entry_points.txt +0 -0
- {bmtool-0.7.1.4.dist-info → bmtool-0.7.1.5.dist-info}/licenses/LICENSE +0 -0
- {bmtool-0.7.1.4.dist-info → bmtool-0.7.1.5.dist-info}/top_level.txt +0 -0
bmtool/analysis/entrainment.py
CHANGED
@@ -714,7 +714,17 @@ def calculate_spike_rate_power_correlation(
|
|
714
714
|
return correlation_results, frequencies
|
715
715
|
|
716
716
|
|
717
|
-
def get_spikes_in_cycle(
|
717
|
+
def get_spikes_in_cycle(
|
718
|
+
spike_df,
|
719
|
+
lfp_data,
|
720
|
+
spike_fs=1000,
|
721
|
+
lfp_fs=400,
|
722
|
+
filter_method="butter",
|
723
|
+
lowcut=None,
|
724
|
+
highcut=None,
|
725
|
+
bandwidth=2.0,
|
726
|
+
freq_of_interest=None,
|
727
|
+
):
|
718
728
|
"""
|
719
729
|
Analyze spike timing relative to oscillation phases.
|
720
730
|
|
@@ -733,12 +743,15 @@ def get_spikes_in_cycle(spike_df, lfp_data, spike_fs=1000, lfp_fs=400, band=(30,
|
|
733
743
|
phase_data : dict
|
734
744
|
Dictionary containing phase values for each spike and neuron population
|
735
745
|
"""
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
746
|
+
phase = get_lfp_phase(
|
747
|
+
lfp_data=lfp_data,
|
748
|
+
fs=lfp_fs,
|
749
|
+
filter_method=filter_method,
|
750
|
+
lowcut=lowcut,
|
751
|
+
highcut=highcut,
|
752
|
+
bandwidth=bandwidth,
|
753
|
+
freq_of_interest=freq_of_interest,
|
754
|
+
)
|
742
755
|
|
743
756
|
# Get unique neuron populations
|
744
757
|
neuron_pops = spike_df["pop_name"].unique()
|
@@ -763,4 +776,4 @@ def get_spikes_in_cycle(spike_df, lfp_data, spike_fs=1000, lfp_fs=400, band=(30,
|
|
763
776
|
valid_samples = spike_indices[valid_indices]
|
764
777
|
phase_data[pop] = phase[valid_samples]
|
765
778
|
|
766
|
-
return phase_data
|
779
|
+
return phase_data
|
bmtool/analysis/spikes.py
CHANGED
@@ -401,7 +401,7 @@ def compare_firing_over_times(
|
|
401
401
|
|
402
402
|
|
403
403
|
def find_bursting_cells(
|
404
|
-
df: pd.DataFrame,
|
404
|
+
df: pd.DataFrame, isi_threshold: float = 10, burst_count_threshold: int = 1
|
405
405
|
) -> pd.DataFrame:
|
406
406
|
"""
|
407
407
|
Finds bursting cells in a population based on a time difference threshold.
|
@@ -410,10 +410,10 @@ def find_bursting_cells(
|
|
410
410
|
----------
|
411
411
|
df : pd.DataFrame
|
412
412
|
DataFrame containing spike data with columns for timestamps, node_ids, and pop_name
|
413
|
-
|
413
|
+
isi_threshold : float, optional
|
414
414
|
Time difference threshold in milliseconds to identify bursts
|
415
|
-
|
416
|
-
|
415
|
+
burst_count_threshold : int, optional
|
416
|
+
Number of bursts required to identify a bursting cell
|
417
417
|
|
418
418
|
Returns
|
419
419
|
-------
|
@@ -425,10 +425,11 @@ def find_bursting_cells(
|
|
425
425
|
diff_df["time_diff"] = df.groupby("node_ids")["timestamps"].diff()
|
426
426
|
|
427
427
|
# Create a column indicating whether each time difference is a burst
|
428
|
-
diff_df["is_burst_instance"] = diff_df["time_diff"] <
|
428
|
+
diff_df["is_burst_instance"] = diff_df["time_diff"] < isi_threshold
|
429
429
|
|
430
430
|
# Group by node_ids and check if any row has a burst instance
|
431
|
-
|
431
|
+
# check if there are enough bursts
|
432
|
+
burst_summary = diff_df.groupby("node_ids")["is_burst_instance"].sum() >= burst_count_threshold
|
432
433
|
|
433
434
|
# Convert to a DataFrame with reset index
|
434
435
|
burst_cells = burst_summary.reset_index(name="is_burst")
|
@@ -442,14 +443,11 @@ def find_bursting_cells(
|
|
442
443
|
)
|
443
444
|
|
444
445
|
# Add "_bursters" suffix only to those cells
|
445
|
-
|
446
|
-
burst_cells.loc[burst_mask, "pop_name"] = (
|
447
|
-
burst_cells.loc[burst_mask, "pop_name"] + "_bursters"
|
448
|
-
)
|
446
|
+
burst_cells.loc[burst_mask, "pop_name"] = burst_cells.loc[burst_mask, "pop_name"] + "_bursters"
|
449
447
|
|
450
|
-
for pop in burst_cells["pop_name"].unique():
|
448
|
+
for pop in sorted(burst_cells["pop_name"].unique()):
|
451
449
|
print(
|
452
|
-
f"Number of
|
450
|
+
f"Number of cells in {pop}: {burst_cells[burst_cells['pop_name'] == pop]['node_ids'].nunique()}"
|
453
451
|
)
|
454
452
|
|
455
453
|
return burst_cells
|
@@ -8,10 +8,10 @@ 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=PM4Do8Cl248Y2kIXLRFLPmUB_mH38Yhl8CUDDcunGq0,28241
|
12
12
|
bmtool/analysis/lfp.py,sha256=S2JvxkjcK3-EH93wCrhqNSFY6cX7fOq74pz64ibHKrc,26556
|
13
13
|
bmtool/analysis/netcon_reports.py,sha256=VnPZNKPaQA7oh1q9cIatsqQudm4cOtzNtbGPXoiDCD0,2909
|
14
|
-
bmtool/analysis/spikes.py,sha256=
|
14
|
+
bmtool/analysis/spikes.py,sha256=IHxV7_X8ojh4NDVBjzHCzfHF8muPPef2UtH3yqYre78,17091
|
15
15
|
bmtool/bmplot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
bmtool/bmplot/connections.py,sha256=P1JBG4xCbLVq4sfQuUE6c3dO949qajrjdQcrazdmDS4,53861
|
17
17
|
bmtool/bmplot/entrainment.py,sha256=VSlZvcSeXLr5OxGvmWcGU4s7JS7vOL38lq1XC69O_AE,6926
|
@@ -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.
|
30
|
-
bmtool-0.7.1.
|
31
|
-
bmtool-0.7.1.
|
32
|
-
bmtool-0.7.1.
|
33
|
-
bmtool-0.7.1.
|
34
|
-
bmtool-0.7.1.
|
29
|
+
bmtool-0.7.1.5.dist-info/licenses/LICENSE,sha256=qrXg2jj6kz5d0EnN11hllcQt2fcWVNumx0xNbV05nyM,1068
|
30
|
+
bmtool-0.7.1.5.dist-info/METADATA,sha256=pvpABD7P2ytzO08EYUC8HrbUTg_fk8pc67mBaEvi7-M,3577
|
31
|
+
bmtool-0.7.1.5.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
32
|
+
bmtool-0.7.1.5.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
|
33
|
+
bmtool-0.7.1.5.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
|
34
|
+
bmtool-0.7.1.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|