neo_utils module

neo_utils.getmeanspikerateonepoch(seg, epoch_name)

Compute the mean firing rate on the epoch specified by its name epoch_name

Parameters:
seg : Neo Segment

Input Neo Segment

epoch_name : str

Name of the epoch

Returns:
spkrate_per_epoch : float

Mean spiking rate on the epoch in Hz (n_spikes / epoch_duration)

neo_utils.spiketrainrejectaroundevent(spiketrain, t_event, t_pre, t_post)

Reject spikes around an event, from a Neo SpikeTrain. Reject spikes occuring in the window [t_event-t_pre < t_reject < t_event+t_post].

Parameters:
spiketrain : Neo SpikeTrain

Input Neo SpikeTrain

t_event : float

Time of the event (s)

t_pre : float

Time kept before the event (s)

t_post : float

Time kept after the event (s)

Returns:
spiketrainsel : Neo SpikeTrain

SpikeTrain without the spikes rejected

spiketimesel : array

Time of the selected spikes (all spikes minus the rejected ones)

neo_utils.spiketrainselectaroundevent(spiketrain, t_event, t_pre, t_post, shifttime=1)

Select spikes on a Neo spiketrain occuring before and after an event. Select spikes occuring in the window [t_event-t_pre < t_sel < t_event+t_post]. If shifttime = 1, the spike times are shifted so that t_event is set to 0

Parameters:
spiketrain : Neo SpikeTrain

Input Neo SpikeTrain

t_event : float

Time of the event (s)

t_pre : float

Time kept before the event (s)

t_post : float

Time kept after the event (s)

shifttime : bool

If True, the spike times are shifted so that t=0 at the time of the event, if False, the spike times are not changed

Returns:
spiketrainsel : Neo SpikeTrain

Selected SpikeTrain around the event

spiketimesel : array

Time of the selected spikes, around the event

neo_utils.spiketraintimerejection(spiketrain, t_start, t_stop)

Create a new spiketrain removing the spikes occuring between t_start and t_stop

Parameters:
spiketrain : Neo SpikeTrain

Input Neo SpikeTrain

t_start : float

Starting time of rejection (s)

t_stop : float

Ending time of rejection (s)

Returns:
spiketrainsel : Neo SpikeTrain

Output Neo SpikeTrain

spiketimesel : array

Time of the selected spikes (all spikes minus the rejected ones)

spikerejected_ind : array

Indices of the rejected spikes

neo_utils.spiketraintimesel(spiketrain, t_start, t_stop)

Time selection on a Neo spiketrain. Select the spikes occuring between t_start and t_stop.

Parameters:
spiketrain : Neo SpikeTrain

Input Neo SpikeTrain

t_start : float

Starting time of selection (s)

t_stop : float

Ending time of selection (s)

Returns:
spiketrainsel : Neo SpikeTrain

Output Neo SpikeTrain containing only the selected spikes

spiketimesel : array

Time of the selected spikes