Curate class for processing CBGTC results (in respective files)¶
- analyseur.cbgtc.curate.get_binary_spiketrains(spiketimes_set, window=None, sampling_rate=None, neurons=None)[source]¶
- \[ \begin{align}\begin{aligned}s_i(t_k) = \begin{cases} 1 & \text{if neuron } i \text{fires in bin } t_k \\ 0 & \text{otherwise} \end{cases}\end{aligned}\end{align} \]
where \(t_k = k \Delta t\) and \(\Delta t = 1/\text{sampling\_rate}\).
Returns nested list of spike trains (row-i for neuron ni, column-j for j-th spike time) and its associated yticks (list of neuron labels corresponding to the spike trains).
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()- Parameters:
neurons –
“all” [default] or scalar or range(a, b) or list of neuron ids like [2, 3, 6, 7]
”all” means subset = superset
N (a scalar) means subset of first N neurons in the superset
range(a, b) or [2, 3, 6, 7] means subset of selected neurons
window – Tuple in the form (start_time, end_time); (0, 10) [default]
sampling_rate – 1000/dt = 10000 Hz [default]; sampling_rate ∊ (0, 10000)
- Returns:
3-tuple; nested_list, label_list and times_axis
Use Cases¶
1. Pre-requisites¶
1.1. Import Modules¶
from analyseur.cbgtc.loader import LoadSpikeTimes from analyseur.cbgtc.curate import get_binary_spiketrains
1.2. Load file and get spike times¶
loadST = LoadSpikeTimes("spikes_GPi.csv") spiketimes_superset = loadST.get_spiketimes_superset()
2. Cases¶
2.1. Convert spike times set to nested list of binary spike trains¶
[spiketrains_superlist, neuron_labels, time_axis] = get_binary_spiketrains(spiketimes_superset)
2.2. Get nested list of binary spike trains for desired neurons; specific range¶
neurons = range(30, 62) # neuron id from "n30" to "n62" spiketimes_subset = LoadSpikeTimes.get_spiketimes_subset(spiketimes_superset, neurons=neurons) [spiketrains_nestedlist, neuron_labels, time_axis] = get_binary_spiketrains(spiketimes_subset, neurons="all")
Alternatively,
neurons = range(30, 62) # neuron id from "n30" to "n62" [spiketrains_nestedlist, neuron_labels, time_axis] = get_binary_spiketrains(spiketimes_superset, neurons=neurons)
2.3. Get nested list of binary spike trains for desired neurons; specific list¶
neurons = [1, 2, 3, 6, 9, 10, 11, 21, 31] # neuron ids "n1", "n2", ..., "n21", "n31" spiketimes_subset = LoadSpikeTimes.get_spiketimes_subset(spiketimes_superset, neurons=neurons) [spiketrains_nestedlist, neuron_labels, time_axis] = get_binary_spiketrains(spiketimes_subset, neurons="all")
Alternatively,
neurons = [1, 2, 3, 6, 9, 10, 11, 21, 31] # neuron ids "n1", "n2", ..., "n21", "n31" [spiketrains_nestedlist, neuron_labels, time_axis] = get_binary_spiketrains(spiketimes_superset, neurons=neurons)
2.4. Get nested list of binary spike trains for desired neurons; first N neurons¶
N = 50 # first 50 neurons regardless of the neuron id spiketimes_subset = LoadSpikeTimes.get_spiketimes_subset(spiketimes_superset, neurons=N) [spiketrains_nestedlist, neuron_labels, time_axis] = get_binary_spiketrains(spiketimes_subset, neurons="all")
Alternatively,
N = 50 # first 50 neurons regardless of the neuron id neuron_ids = dict(list(spiketimes_superset.items())[:neurons]).keys() neurons = [int(item[1:]) for item in neuron_ids] [spiketrains_nestedlist, neuron_labels, time_axis] = get_binary_spiketrains(spiketimes_superset, neurons=neurons)
- analyseur.cbgtc.curate.get_desired_spiketimes_subset(spiketimes_set, window=None, neurons=None)[source]¶
Returns nested list of spike times (row-i for neuron ni, column-j for j-th spike time) and its associated yticks (list of neuron labels corresponding to the spike trains).
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()- Parameters:
window – Tuple in the form (start_time, end_time); (0, 10) [default]
neurons –
“all” or scalar or range(a, b) or list of neuron ids like [2, 3, 6, 7]
”all” means subset = superset
N (a scalar) means subset of first N neurons in the superset
range(a, b) or [2, 3, 6, 7] means subset of selected neurons
- Returns:
2-tuple; nested_list and label_list
Use Cases¶
1. Pre-requisites¶
1.1. Import Modules¶
from analyseur.cbgtc.loader import LoadSpikeTimes from analyseur.cbgtc.curate import get_desired_spiketimes_subset
1.2. Load file and get spike times¶
loadST = LoadSpikeTimes("spikes_GPi.csv") spiketimes_superset = loadST.get_spiketimes_superset()
2. Cases¶
2.1. Convert spike times set to nested list of spike times¶
[spiketimes_superlist, _] = get_desired_spiketimes_subset(spiketimes_superset)
2.2. Get nested list of spike times for desired neurons; specific range¶
neurons = range(30, 62) # neuron id from "n30" to "n62" spiketimes_subset = LoadSpikeTimes.get_spiketimes_subset(spiketimes_superset, neurons=neurons) [spiketimes_nestedlist, neuron_labels] = get_desired_spiketimes_subset(spiketimes_subset, neurons="all")
Alternatively,
neurons = range(30, 62) # neuron id from "n30" to "n62" [spiketimes_nestedlist, neuron_labels] = get_desired_spiketimes_subset(spiketimes_superset, neurons=neurons)
2.3. Get nested list of spike times for desired neurons; specific list¶
neurons = [1, 2, 3, 6, 9, 10, 11, 21, 31] # neuron ids "n1", "n2", ..., "n21", "n31" spiketimes_subset = LoadSpikeTimes.get_spiketimes_subset(spiketimes_superset, neurons=neurons) [spiketimes_nestedlist, neuron_labels] = get_desired_spiketimes_subset(spiketimes_subset, neurons="all")
Alternatively,
neurons = [1, 2, 3, 6, 9, 10, 11, 21, 31] # neuron ids "n1", "n2", ..., "n21", "n31" [spiketimes_nestedlist, neuron_labels] = get_desired_spiketimes_subset(spiketimes_superset, neurons=neurons)
2.4. Get nested list of spike times for desired neurons; first N neurons¶
N = 50 # first 50 neurons regardless of the neuron id spiketimes_subset = LoadSpikeTimes.get_spiketimes_subset(spiketimes_superset, neurons=N) [spiketimes_nestedlist, neuron_labels] = get_desired_spiketimes_subset(spiketimes_subset, neurons="all")
Alternatively,
N = 50 # first 50 neurons regardless of the neuron id neuron_ids = dict(list(spiketimes_superset.items())[:neurons]).keys() neurons = [int(item[1:]) for item in neuron_ids] [spiketimes_nestedlist, neuron_labels] = get_desired_spiketimes_subset(spiketimes_superset, neurons=neurons)
Comments¶
In 2.2 to 2.4 the alternative method passes the mother set (superset) of spike times.
For 2.2 and 2.3 cases the method choice will depend on the use scenario.
But for 2.4 I prefer the first method (not alternative method) because it is more intuitive.