spike_analysiscoreSpikeDetectionCreastTrough

SpikeDetectionCreastTrough

class spike_analysis.core.SpikeDetectionCreastTrough(reader_object, lim_creast='minimum', lim_trough='minimum', max_creast_trough_interval=2.0, tdelta=1.0, stimulus_period=1, stimulus_period_offset=0, upper_creast_threshold=np.inf, cellid='__no_cellid_assigned__', spike_time_mode='latest')

Detects spikes by creast and trough amplitude.

Parameters:
  • reader_object (LabViewReader) – Reader object with get_voltage_traces and get_stim_times method, e.g. ReaderSmr

  • lim_creast (float|str) – threshold above which a creast of a spike is detected as such. Needs to be float, "minimum", or "zero". If “minimum” or “zero” is chosen, the threashold will be set based on the histogram of all creasts. If “minimum” is chosen, lim_creast will be set to the first minimum in the histogram above or equal to 0.4mV. If “zero” is chosen, lim_creast will be set to the first empty bin.

  • lim_trough (float|str) – want to use a negative value. lim creast and lim_trough need to be both floats, both “zero” or both “minimum”.

  • max_creast_trough_interval (float) – Maximum interval between creast and trough such that a spike is recognized.

  • tdelta (float) – minimum interval between spikes

  • stimulus_period (int) – number of stimuli applied per trial. E.g., for paired pulse stimuli, it should be 2.

  • stimulus_period_offse (int) – Number of stimulus that initiates first trial.

  • cellid (str) – name to be used in spike times dataframe

Attributes:

lim_creast

lim_creast used for spike detection (if “minimum” or “zero” was defined, this will be the numeric value used)

Type:

float|str

lim_trough

lim_trough used for spike detection (if “minimum” or “zero” was defined, this will be the numeric value used)

Type:

float|str

st

spike times dataframe, one row per trial

Type:

pd.DataFrame

spike_times

all extracted spike times, fullfilling creast and trough criterion, filtered such thatthe minimal ISI is above tdelta.

Type:

list

_spike_times_creast

spike times fullfilling creast criterion

Type:

list

_spike_times_trough

spike times fullfilling trough criterion

Type:

list

Methods:

run_analysis()

Runs the spike detection analysis.

_set_creast_trough(lim_creast, lim_trough)

Sets the creast and trough limits based on the given values.

_extract_spike_times()

Extracts spike times from voltage traces.

get_creast_and_trough_ampltidues_by_bins(mode)

Get the creast and trough amplitudes based on the histogram of the creasts and troughs.

get_default_events(show_stim_times, show_trough_candidates)

Returns a list of events to be displayed with the show_events() method.

show_events(events, savepdf, showfig, ylim)

Shows voltage trace, thresholds and events.

get_serialize_dict()

Get a dictionary containing the attributes of the SpikeDetectionCreastTrough object.

save(path)

Saves the SpikeDetectionCreastTrough object to a JSON file.

load(path, init_reader)

static Loads a SpikeDetectionCreastTrough object from a JSON file.

plot_creast_trough_histogram(ax)

skip-doc: