allensdk.internal.model.glif.glif_optimizer_neuron module¶
-
exception
allensdk.internal.model.glif.glif_optimizer_neuron.
GlifBadInitializationException
(message, dv, step)[source]¶ Bases:
Exception
Exception raised when voltage is above threshold at the beginning of a sweep. i.e. probably caused by the optimizer.
-
exception
allensdk.internal.model.glif.glif_optimizer_neuron.
GlifNeuronException
(message, data)[source]¶ Bases:
Exception
Exception for catching simulation errors and reporting intermediate data.
-
class
allensdk.internal.model.glif.glif_optimizer_neuron.
GlifOptimizerNeuron
(*args, **kwargs)[source]¶ Bases:
allensdk.model.glif.glif_neuron.GlifNeuron
Contains methods for running the neuron model in a “forced-spike” paradigm used during optimization.
-
TYPE
= 'GLIF'¶
-
run_until_biological_spike
(self, voltage_t0, threshold_t0, AScurrents_t0, stimulus, response, start_index, after_end_index, bio_spike_time_steps)[source]¶ Run the neuron simulation over a segment of a stimulus given initial conditions for use in the “forced spike” optimization paradigm. [Note: the section of stimulus is meant to be between two biological neuron spikes. Thus the stimulus is during the interspike interval (ISI)]. The model is simulated until either the model spikes or the end of the segment is reached. If the model does not spike, a spike time is extrapolated past the end of the simulation segment.
This function also returns the initial conditions for the subsequent stimulus segment. In the forced spike paradigm there are several ways
Parameters: - voltage_t0 : float
the current voltage of the neuron
- threshold_t0 : float
the current spike threshold level of the neuron
- AScurrents_t0 : np.ndarray
the current state of the afterspike currents in the neuron
- stimulus : np.ndarray
the full stimulus array (not just the segment of data being simulated)
- response : np.ndarray
the full response array (not just the segment of data being simulated)
- start_index : int
index of global stimulus at which to start simulation
- after_end_index : int
index of global stimulus after the last index to be simulated
- bio_spike_time_steps : list
time steps of input spikes
Returns: - dict
- a dictionary containing:
‘voltage’: simulated voltage value ‘threshold’: simulated threshold values ‘AScurrent_matrix’: afterspike current values during the simulation ‘grid_model_spike_time’: model spike time (in units of dt) ‘interpolated_model_spike_time’: model spike time (in units of dt) interpolated between time steps ‘voltage_t0’: reset voltage value to be used in subsequent simulation interval ‘threshold_t0’: reset threshold value to be used in subsequent simulation interval ‘AScurrents_t0’: reset afterspike current value to be used in subsequent simulation interval ‘grid_bio_spike_model_voltage’: model voltage at the time of the input spike ‘grid_bio_spike_model_threshold’: model threshold at the time of the input spike
-
run_with_biological_spikes
(self, stimulus, response, bio_spike_time_steps)[source]¶ Run the neuron simulation over a stimulus, but do not allow the model to spike on its own. Rather, force the simulation to spike and reset at a given set of spike indices. Dynamics rules are applied between spikes regardless of the simulated voltage and threshold values. Reset rules are applied only at input spike times. This is used during optimization to force the model to follow the spikes of biological data. The model is optimized in this way so that history effects due to spiking can be adequately modeled. For example, every time the model spikes a new set of afterspike currents will be initiated. To ensure that afterspike currents can be optimized, we force them to be initiated at the time of the biological spike.
Parameters: - stimulus : np.ndarray
vector of scalar current values
- respones : np.ndarray
vector of scalar voltage values
- bio_spike_time_steps : list
spike time step indices
Returns: - dict
- a dictionary containing:
‘voltage’: simulated voltage values, ‘threshold’: simulated threshold values, ‘AScurrent_matrix’: afterspike currents during the simulation, ‘grid_model_spike_times’: spike times of the model aligned to the simulation grid (when it would have spiked), ‘interpolated_model_spike_times’: spike times of the model linearly interpolated between time steps, ‘grid_ISI’: interspike interval between grid model spike times, ‘interpolated_ISI’: interspike interval between interpolated model spike times, ‘grid_bio_spike_model_voltage’: voltage of the model at biological/input spike times, ‘grid_bio_spike_model_threshold’: voltage of the model at biological/input spike times interpolated between time steps
-
-
allensdk.internal.model.glif.glif_optimizer_neuron.
extrapolate_model_spike_from_endpoints
(neuron, voltage, threshold, voltage_t1, threshold_t1, dt)[source]¶
-
allensdk.internal.model.glif.glif_optimizer_neuron.
extrapolate_model_spike_from_endpoints_single_tau
(neuron, voltage, threshold, voltage_t1, threshold_t1, dt)[source]¶
-
allensdk.internal.model.glif.glif_optimizer_neuron.
extrapolate_spike_time
(dt, num_time_steps, threshold_t0, threshold_t1, voltage_t0, voltage_t1)[source]¶ Given two voltage and threshold values and an interval between them, extrapolate a spike time by intersecting lines the thresholds and voltages.
-
allensdk.internal.model.glif.glif_optimizer_neuron.
extrapolate_spike_voltage
(dt, num_time_steps, threshold_t0, threshold_t1, voltage_t0, voltage_t1)[source]¶ Given two voltage and threshold values and an interval between them, extrapolate a spike time by intersecting lines the thresholds and voltages.
-
allensdk.internal.model.glif.glif_optimizer_neuron.
find_first_model_spike
(voltage, threshold, voltage_t1, threshold_t1, dt)[source]¶
-
allensdk.internal.model.glif.glif_optimizer_neuron.
interpolate_spike_voltage
(dt, time_step, threshold_t0, threshold_t1, voltage_t0, voltage_t1)[source]¶ Given two voltage and threshold values, the dt between them and the initial time step, interpolate a spike time within the dt interval by intersecting the two lines.