neuro_py.spikes
BurstIndex_Royer_2012(autocorrs)
¶
Calculate the burst index from Royer et al. (2012). The burst index ranges from -1 to 1, where: -1 indicates non-bursty behavior, and 1 indicates bursty behavior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
autocorrs
|
DataFrame
|
Autocorrelograms of spike trains, with time (in seconds) as index and correlation values as columns. |
required |
Returns:
| Type | Description |
|---|---|
list
|
List of burst indices for each autocorrelogram column. |
Notes
The burst index is calculated as: burst_idx = (peak - baseline) / max(peak, baseline)
- Peak is calculated as the maximum of the autocorrelogram between 2-9 ms.
- Baseline is calculated as the mean of the autocorrelogram between 40-50 ms.
Examples:
>>> burst_idx = BurstIndex_Royer_2012(autocorr_df)
Source code in neuro_py/spikes/spike_tools.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
get_spindices(data)
¶
Spike timestamps and IDs from each spike train in a time-sorted DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
Spike times for each spike train, where each element is an array of spike times for a neuron. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Sorted spike times and the corresponding spikes' neuron IDs |
Examples:
>>> spike_trains = [np.array([0.1, 0.2, 0.4]), np.array([0.15, 0.35])]
>>> spikes = get_spindices(spike_trains)
Source code in neuro_py/spikes/spike_tools.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
select_burst_spikes(spikes, mode='bursts', isiBursts=0.006, isiSpikes=0.02)
¶
Discriminate bursts versus single spikes based on inter-spike intervals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spikes
|
ndarray
|
Array of spike times. |
required |
mode
|
str
|
Either 'bursts' (default) or 'single'. |
'bursts'
|
isiBursts
|
float
|
Maximum inter-spike interval for bursts (default = 0.006 seconds). |
0.006
|
isiSpikes
|
float
|
Minimum inter-spike interval for single spikes (default = 0.020 seconds). |
0.02
|
Returns:
| Type | Description |
|---|---|
ndarray
|
A boolean array indicating for each spike whether it matches the criterion. |
Notes
Adapted from: http://fmatoolbox.sourceforge.net/Contents/FMAToolbox/Analyses/SelectSpikes.html
Source code in neuro_py/spikes/spike_tools.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
spindices_to_ndarray(spikes, spike_id=None)
¶
Convert spike times and spike IDs from a DataFrame into a list of arrays, where each array contains the spike times for a given spike train.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spikes
|
DataFrame
|
DataFrame containing 'spike_times' and 'spike_id' columns, sorted by 'spike_times'. |
required |
spike_id
|
list or ndarray
|
List or array of spike IDs to search for in the DataFrame. If None, all spike IDs are used. |
None
|
Returns:
| Type | Description |
|---|---|
List[ndarray]
|
A list of arrays, each containing the spike times for a corresponding spike train. |
Examples:
>>> spike_trains = spindices_to_ndarray(spikes_df, spike_id=[0, 1, 2])
Source code in neuro_py/spikes/spike_tools.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |