neurotools.spikes.sta module

Functions for spike-triggered statistics

neurotools.spikes.sta.get_snips(signal, times, window)[source]

Extract snippits of a time series surronding a list of times. Typically used for spike-triggered statistics

Parameters:
  • signal (1D np.array) – Timseries to extract snips from.

  • times (1D np.int32) – Indecies of spiking events (samples) in signal

  • window (positive int) – A region of size 2*window+1 will be extracted around each spike time.

Returns:

snips – Extracted spike-triggered signal snippits.

Return type:

NSPIKES×(2*window+1) np.array

neurotools.spikes.sta.triggered_average(signal, times, window)[source]

Calculate spike-triggered average of a signal.

Parameters:
  • signal (1D np.array) – Timseries to extract snips from.

  • times (1D np.int32) – Indecies of spiking events (samples) in signal

  • window (positive int) – A region of size 2*window+1 will be extracted around each spike time.

Returns:

STA – Spike-triggered average of signal.

Return type:

length 2*window+1 np.array

neurotools.spikes.sta.get_triggered_stats(signal, times, window)[source]

Get a statistical summary of data in length window around time points.

Parameters:
  • signal (1D np.array) – Timseries to extract snips from.

  • times (1D np.int32) – Indecies of spiking events (samples) in signal

  • window (positive int) – A region of size 2*window+1 will be extracted around each spike time.

Returns:

  • means – Means of signal for all time-windows specified in times.

  • standard-deviations – Standard deviation of signal for all time-windows specified in times.

  • standard-erros – Standard errors of the mean of signal for all time-windows specified in times.

neurotools.spikes.sta.fftsta(spikes, x)[source]

Spike triggerd average (STA) via FFT Signal x is z-scored befor calculating the spike-triggered average (a.k.a. reverse correlation). The returned STA is normalized so that the maximum magnitude is 1.

Parameters:
  • spikes (np.array) – 1D spike count vector

  • x (np.array)

Returns:

np.float32

Return type:

normalized spike-triggered average