allensdk.internal.model.glif.threshold_adaptation module

allensdk.internal.model.glif.threshold_adaptation.calc_spike_component_of_threshold_from_multiblip(multi_SS, dt, dv_cutoff, thresh_frac, MAKE_PLOT=False, SHOW_PLOT=False, BLOCK=False, PUBLICATION_PLOT=False)[source]

Calculate the spike components of the threshold by fitting a decaying exponential function to data to threshold versus time since last spike in the multiblip data. The exponential is forced to decay to the local th_inf (calculated as the mean all of the threshold values of the first spikes in each individual triblip stimulus). For each multiblip stimulus in a stimulus set if there is more than one spike the difference in voltages from the first and second spike are plotted versus the separation in time. Note that this algorithm should only be implemented on multiblips sweeps where the neuron spike on the first and second blip. Since there is no easy way to do this, this erroneous data should not be provided to this algorithm (i.e is should be visually checked and eliminated the preprocessor should hold back this data manually for now.)

#TODO: check to see if this is still true. Notes: The standard SDK spike detection algorithm does not work with the multiblip stimulus due to artifacts when the stimulus turns on and off. Please see the find_multiblip_spikes module for more information.

Input:

multi_SS: dictionary
contains multiblip information such as current and stimulus
dt: float
time step in seconds

Returns:

const_to_add_to_thresh_for_reset: float
amplitude of the exponential fit otherwise known as a_spike. Note that this is without any spike cutting
decay_const: float
decay constant of exponential. Note the function fit is a negative exponential which will mean this value will either have to be negated when it is used or the functions used will have to have to include the negative.

thresh_inf: float

allensdk.internal.model.glif.threshold_adaptation.exp_fit_c(t, a1, k1, const)[source]
allensdk.internal.model.glif.threshold_adaptation.exp_force_c(t_const, a1, k1)[source]
allensdk.internal.model.glif.threshold_adaptation.fit_avoltage_bvoltage(x, v_trace_list, El_list, spike_cut_length, all_spikeInd_list, th_inf, dt, a_spike, b_spike, fake=False)[source]

This is a version of fit_avoltage_bvoltage_debug that does not require the th_trace, v_component_of_thresh_trace, and spike_component_of_thresh_trace needed for debugging. A test should be run to make sure the same output comes out from this and the debug function

This function returns the squared error for the difference between the ‘known’ voltage component of the threshold obtained from the biological neuron and the voltage component of the threshold of the model obtained with the input parameters (so that the minimum can be searched for via fmin). The overall threshold is the sum of threshold infinity the spike component of the threshold and the voltage component of the threshold. Therefore threshold infinity and the spike component of the threshold must be subtracted from the threshold of the neuron in order to isolate the voltage component of the threshold. In the evaluation of the model the actual voltage of the neuron is used so that any errors in the other components of the model will not influence the fits here (for example, if a afterspike current was estimated incorrectly)

Notes: * The spike component of the threshold is subtracted from the

voltage which means that the voltage component of the threshold should only be added to rules.
  • b_spike was fit using a negative value in the function therefore the negative is placed in the
    equation.
  • values in this function are in ‘real’ voltage as opposed to voltage
    relative to resting potential.
  • current injection during the spike is not taken into account. This seems reasonable as the
    ion channels are open during this time and injected current may not greatly influence the neuron.
x: numpy array
x[0]=a_voltage input, x[1] is b_voltage_input, x[2] is th_inf
v_trace_list: list of numpy arrays
voltage traces (v_trace, El, and th_inf must be in the same frame of reference)
El_list: list of floats
reversal potential (v_trace, El, and th_inf must be in the same frame of reference)
spike_cut_length: int
number of indicies removed after initiation of a spike
all_spikeInd_list: list of numpy arrays
indicies of spike trains
th_inf: float
threshold infinity (v_trace, El, and th_inf must be in the same frame of reference)
dt: float
size of time step (SI units)
a_spike: float
amplitude of spike component of threshold.
b_spike: float
decay constant in spike component of the threshold
fake: Boolean
if True makes uses the voltage value of spike step-1 because there is not a voltage value at the spike step because it is set to nan in the simulator.
allensdk.internal.model.glif.threshold_adaptation.fit_avoltage_bvoltage_th(x, v_trace_list, El_list, spike_cut_length, all_spikeInd_list, dt, a_spike, b_spike, fake=False)[source]

This is a version of fit_avoltage_bvoltage_th_debug that does not require the th_trace, v_component_of_thresh_trace, and spike_component_of_thresh_trace needed for debugging. A test should be run to make sure the same output comes out from this and the debug function

This function returns the squared error for the difference between the ‘known’ voltage component of the threshold obtained from the biological neuron and the voltage component of the threshold of the model obtained with the input parameters (so that the minimum can be searched for via fmin). The overall threshold is the sum of threshold infinity the spike component of the threshold and the voltage component of the threshold. Therefore threshold infinity and the spike component of the threshold must be subtracted from the threshold of the neuron in order to isolate the voltage component of the threshold. In the evaluation of the model the actual voltage of the neuron is used so that any errors in the other components of the model will not influence the fits here (for example, if a afterspike current was estimated incorrectly)

Notes: * The spike component of the threshold is subtracted from the

voltage which means that the voltage component of the threshold should only be added to rules.
  • b_spike was fit using a negative value in the function therefore the negative is placed in the
    equation.
  • values in this function are in ‘real’ voltage as opposed to voltage
    relative to resting potential.
  • current injection during the spike is not taken into account. This seems reasonable as the
    ion channels are open during this time and injected current may not greatly influence the neuron.
x: numpy array
x[0]=a_voltage input, x[1] is b_voltage_input, x[2] is th_inf
v_trace_list: list of numpy arrays
voltage traces (v_trace, El, and th_inf must be in the same frame of reference)
El_list: list of floats
reversal potential (v_trace, El, and th_inf must be in the same frame of reference)
spike_cut_length: int
number of indicies removed after initiation of a spike
all_spikeInd_list: list of numpy arrays
indicies of spike trains
dt: float
size of time step (SI units)
a_spike: float
amplitude of spike component of threshold.
b_spike: float
decay constant in spike component of the threshold
fake: Boolean
if True makes uses the voltage value of spike step-1 because there is not a voltage value at the spike step because it is set to nan in the simulator.
allensdk.internal.model.glif.threshold_adaptation.get_peaks(voltage, aboveValue=0)[source]

This function was written by Corinne Teeter and calculates the action potential peaks of a voltage equation” inputs

voltage: numpy array of voltages aboveValue: scalar voltage value over which voltage is considered a spike.
outputs:
peakInd: array of indicies of peaks