emodelrunner.protocols.sscx_protocols¶
Ephys protocols for the SSCX packages.
Classes
|
Protocol consisting of ramp and holding current. |
|
Step protocol based on threshold. |
|
Main protocol to fit RatSSCx neuron ephys parameters. |
|
IDRest protocol to fit RatSSCx neuron ephys parameters. |
|
IDRest protocol to fit RatSSCx neuron ephys parameters. |
|
Protocol consisting of step and holding current. |
|
Step protocol based on threshold. |
|
SweepProtocol with generate_current method. |
- class emodelrunner.protocols.sscx_protocols.RampProtocol(name=None, ramp_stimulus=None, holding_stimulus=None, recordings=None, cvode_active=None)[source]¶
Bases:
SweepProtocol
,CurrentOutputKeyMixin
Protocol consisting of ramp and holding current.
- name¶
name of this object
- Type:
str
- stimuli¶
List of all Stimulus objects used in protocol
- Type:
list of Stimuli
- recordings¶
Recording objects used in the protocol
- Type:
list of Recordings
- cvode_active¶
whether to use variable time step
- Type:
bool
- ramp_stimulus¶
ramp Stimulus
- Type:
Stimulus
- holding_stimulus¶
Holding Stimulus
- Type:
Stimulus
- generate_current(threshold_current=None, holding_current=None, dt=0.1)[source]¶
Return current time series.
- Parameters:
threshold_current (float) – the threshold current (nA)
holding_current (float) – the holding current (nA)
dt (float) – timestep of the generated currents (ms)
- Returns:
dict containing the generated current
- property step_delay¶
Time stimulus delay.
- Returns:
time at which the ramp starts (ms)
- property step_duration¶
Time stimulus duration.
- Returns:
duration of the ramp stimulus (ms)
- class emodelrunner.protocols.sscx_protocols.RampThresholdProtocol(name, thresh_perc_start=None, thresh_perc_end=None, ramp_stimulus=None, holding_stimulus=None, recordings=None, cvode_active=None)[source]¶
Bases:
RampProtocol
Step protocol based on threshold.
- name¶
name of this object
- Type:
str
- stimuli¶
List of all Stimulus objects used in protocol
- Type:
list of Stimuli
- recordings¶
Recording objects used in the protocol
- Type:
list of Recordings
- cvode_active¶
whether to use variable time step
- Type:
bool
- ramp_stimulus¶
ramp Stimulus
- Type:
Stimulus
- holding_stimulus¶
Holding Stimulus
- Type:
Stimulus
- thresh_perc_start¶
percentage of the threshold current at which to set the start of the ramp amplitude
- Type:
float
- thresh_perc_end¶
percentage of the threshold current at which to set the end of the ramp amplitude
- Type:
float
- generate_current(threshold_current, holding_current, dt=0.1)[source]¶
Return current time series.
- Parameters:
threshold_current (float) – the threshold current (nA)
holding_current (float) – the holding current (nA)
dt (float) – timestep of the generated currents (ms)
- Returns:
dict containing the generated current
- run(cell_model, param_values, sim=None, isolate=None, timeout=None)[source]¶
Run protocol.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
isolate (bool) – whether to isolate the run in a process with a timeout to avoid bad cells running for too long
timeout (float) – maximum real time (s) the cell is allowed to run when isolated
- Raises:
AttributeError – if the threshold_current is not set to the cell model
- Returns:
dict containing the responses for the ramp protocol
- class emodelrunner.protocols.sscx_protocols.RatSSCxMainProtocol(name, rmp_protocol=None, rmp_efeature=None, rinhold_protocol=None, rin_efeature=None, thdetect_protocol=None, other_protocols=None, pre_protocols=None)[source]¶
Bases:
Protocol
Main protocol to fit RatSSCx neuron ephys parameters.
Pseudo code:
Find resting membrane potential
Find input resistance
Run other protocols:
Find holding current
Find rheobase
Run IDRest
Possibly run other protocols (based on constructor arguments)
Return all the responses
- name¶
name of the protocol
- Type:
str
- rmp_protocol¶
resting membrane potential protocol
- Type:
- rmp_efeature¶
voltage base efeature
- Type:
bluepyopt.ephys.efeatures.eFELFeature
- rinhold_protocol¶
protocol to get the holding current
- rin_efeature¶
ohmic input resistance vb ssse
- Type:
bluepyopt.ephys.efeatures.eFELFeature
- thdetect_protocol¶
protocol to detect threshold current
- other_protocols¶
other protocols to run
- Type:
bluepyopt.ephys.protocols.Protocol
- pre_protocols¶
protocols to run before the ‘other protocols’
- Type:
bluepyopt.ephys.protocols.Protocol
- generate_current(threshold_current=None, holding_current=None, dt=0.1)[source]¶
Generate current for all protocols except rin and threshold detection.
- Parameters:
threshold_current (float) – the threshold current (nA)
holding_current (float) – the holding current (nA)
dt (float) – timestep of the generated currents (ms)
- Returns:
dict containing the generated currents
- run(cell_model, param_values, sim=None, isolate=None)[source]¶
Run protocol.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
isolate (bool) – whether to isolate the run in a process with a timeout to avoid bad cells running for too long
- Returns:
dict containing the responses for all the protocols
- run_other_protocols(responses, cell_model, sim)[source]¶
Run other protocols.
- Parameters:
responses (dict) – responses to be updated
cell_model (bluepyopt.ephys.models.CellModel) – the cell on which to apply the other protocols
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
- class emodelrunner.protocols.sscx_protocols.RatSSCxRinHoldcurrentProtocol(name, rin_protocol_template=None, voltagebase_efeature=None, holdi_estimate_multiplier=2, holdi_precision=0.1, holdi_max_depth=5, prefix=None)[source]¶
Bases:
Protocol
IDRest protocol to fit RatSSCx neuron ephys parameters.
- name¶
name of the protocol
- Type:
str
- rin_protocol_template¶
template for Rin protocol with amplitude for the holding stimulus to be filled
- Type:
- voltagebase_efeature¶
voltage base efeature
- Type:
bluepyopt.ephys.efeatures.eFELFeature
- holdi_estimate_multiplier¶
when searching for holding current amplitude, multiply holding current estimate by this value to get lower bound
- Type:
float
- holdi_precision¶
precision with which to reach holding voltage when searching for holding current
- Type:
float
- holdi_max_depth¶
maximum number of times to compute the holding voltage when searching for holding current if holdi_precision is not reached
- Type:
int
- prefix¶
prefix used in naming responses, features, recordings, etc.
- Type:
str
- rin_efeature¶
ohmic input resistance vb ssse
- Type:
bluepyopt.ephys.efeatures.eFELFeature
- rin_protocol¶
Rin protocol with holding current amplitude
- Type:
- create_rin_protocol(holdi=None)[source]¶
Create threshold protocol.
- Parameters:
holdi (float) – amplitude of holding current (nA)
- Returns:
the Rin protocol with holding current
- Return type:
- run(cell_model, param_values, sim, rmp=None)[source]¶
Run protocol.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
rmp (float) – resting membrane potential (mV)
- Returns:
dict containing the responses for the Rin protocol using holding current
- search_holdi(cell_model, param_values, sim, holding_voltage, rin_noholding, rmp)[source]¶
Find the holding current to hold cell at holding_voltage.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
holding_voltage (float) – experimental mean of the voltage base efeature (mV)
rin_noholding (float) – Rin efeature (ohmic input resistance vb ssse) value when no holding current is applied (mV/nA)
rmp (float) – resting membrane potential (mV)
- Returns:
the holding current (nA) that reproduces the experimental holding voltage
- Return type:
float
- subprotocols()[source]¶
Return subprotocols.
- Returns:
dict containing the Rin protocol and the Rin protocol template
- voltage_base(current, cell_model, param_values, sim=None)[source]¶
Calculate voltage base for certain stimulus current.
- Parameters:
current (float) – amplitude of the holding current to inject (nA)
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
- Returns:
voltage base (mV) of response
- Return type:
float
- class emodelrunner.protocols.sscx_protocols.RatSSCxThresholdDetectionProtocol(name, step_protocol_template=None, max_threshold_voltage=-40, holding_voltage=None, prefix=None)[source]¶
Bases:
Protocol
IDRest protocol to fit RatSSCx neuron ephys parameters.
- name¶
name of the protocol
- Type:
str
- step_protocol_template¶
template for threshold protocol with amplitude for the holding and steps stimuli to be filled
- Type:
- max_threshold_voltage¶
Use this (mV) to get max threshold current upper bound when searching for threshold current
- Type:
float
- short_perc¶
multiply step duration by this value when detecting spikes with short stimulus. Should be < 1. Not actually a percentage (0.1 -> 10%)
- Type:
float
- short_steps¶
the number of short steps to perform to determine the upper bound of the threshold search with long steps
- Type:
int
- holding_voltage¶
experimental mean of the voltage base efeature (mV) of the Rin protocol
- Type:
float
- prefix¶
prefix used in naming responses, features, recordings, etc.
- Type:
str
- create_short_threshold_protocol(holdi=None, step_current=None)[source]¶
Create short threshold protocol.
- Parameters:
holdi (float) – holding current amplitude (nA)
step_current (float) – step current amplitude (nA)
- Returns:
the threshold protocol with shorter step duration and total duration
- Return type:
- create_step_protocol(holdi=0.0, step_current=0.0)[source]¶
Create threshold protocol.
- Parameters:
holdi (float) – holding current amplitude (nA)
step_current (float) – step current amplitude (nA)
- Returns:
the threshold protocol
- Return type:
- detect_spike(cell_model, param_values, sim=None, step_current=None, holdi=None, short=False)[source]¶
Detect if spike is present at current level.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
step_current (float) – step current amplitude (nA)
holdi (float) – holding current amplitude (nA)
short (bool) – whether the protocol step duration should be shorten
- Returns:
True if at least one spike was detected, False otherwise
- Return type:
bool
- max_threshold_current(rin=None)[source]¶
Find the current necessary to get to max_threshold_voltage.
- Parameters:
rin (float) – Rin efeature (ohmic input resistance vb ssse) value (mV/nA)
- Returns:
maximum threshold current (nA)
- Return type:
float
- run(cell_model, sim, holdi, rin)[source]¶
Run protocol.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
holdi (float) – holding current amplitude (nA)
rin (float) – Rin efeature (ohmic input resistance vb ssse) value (mV/nA)
- Returns:
dict containing threshold current
- search_spike_threshold(cell_model, param_values, sim=None, holdi=None, lower_bound=None, upper_bound=None, precision=0.01, max_depth=5)[source]¶
Find the current step spiking threshold.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
holdi (float) – holding current amplitude (nA)
lower_bound (float) – lower bound in which to search for threshold current (nA)
upper_bound (float) – upper bound in which to search for threshold current (nA)
precision (float) – precision with which to compute threshold current (nA)
max_depth (int) – maximum number of times to run the cell when searching for threshold current when precision is not reached
- Returns:
threshold current amplitude (nA)
- Return type:
float
- class emodelrunner.protocols.sscx_protocols.StepProtocol(name=None, step_stimuli=None, holding_stimulus=None, recordings=None, cvode_active=None, stochkv_det=None)[source]¶
Bases:
SweepProtocol
,CurrentOutputKeyMixin
Protocol consisting of step and holding current.
- name¶
name of this object
- Type:
str
- stimuli¶
List of all Stimulus objects used in protocol
- Type:
list of Stimuli
- recordings¶
Recording objects used in the protocol
- Type:
list of Recordings
- cvode_active¶
whether to use variable time step
- Type:
bool
- step_stimuli¶
List of step Stimulus objects used in protocol
- Type:
list of Stimuli
- holding_stimulus¶
Holding Stimulus
- Type:
Stimulus
- stochkv_det¶
set if stochastic or deterministic
- Type:
bool
- generate_current(threshold_current=None, holding_current=None, dt=0.1)[source]¶
Return current time series.
- Parameters:
threshold_current (float) – the threshold current (nA)
holding_current (float) – the holding current (nA)
dt (float) – timestep of the generated currents (ms)
- Returns:
dict containing the generated current
- instantiate(sim=None, cell_model=None)[source]¶
Instantiate.
- Parameters:
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
cell_model (bluepyopt.ephys.CellModel) – cell model
- run(cell_model, param_values, sim=None, isolate=None, timeout=None)[source]¶
Run protocol.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
isolate (bool) – whether to isolate the run in a process with a timeout to avoid bad cells running for too long
timeout (float) – maximum real time (s) the cell is allowed to run when isolated
- Returns:
dict containing the responses for the step protocol
- property step_amplitude¶
Stimuli mean amplitude.
- Returns:
the mean amplitude of the step stimuli (nA)
- property stim_duration¶
Time stimulus duration.
- Returns:
the duration of the stimulus (ms)
- property stim_end¶
Time stimulus ends.
- Returns:
the time at which the stimulus ends (ms)
- property stim_last_start¶
Time stimulus last start.
- Returns:
the time at which the last step stimulus in the list starts (ms)
- property stim_start¶
Time stimulus starts.
- Returns:
the time at which the stimulus starts (ms)
- class emodelrunner.protocols.sscx_protocols.StepThresholdProtocol(name, thresh_perc=None, step_stimuli=None, holding_stimulus=None, recordings=None, cvode_active=None, stochkv_det=None)[source]¶
Bases:
StepProtocol
Step protocol based on threshold.
- name¶
name of this object
- Type:
str
- stimuli¶
List of all Stimulus objects used in protocol
- Type:
list of Stimuli
- recordings¶
Recording objects used in the protocol
- Type:
list of Recordings
- cvode_active¶
whether to use variable time step
- Type:
bool
- step_stimuli¶
List of step Stimulus objects used in protocol
- Type:
list of Stimuli
- holding_stimulus¶
Holding Stimulus
- Type:
Stimulus
- stochkv_det¶
set if stochastic or deterministic
- Type:
bool
- thresh_perc¶
percentage of the threshold current at which to set the step amplitudes
- Type:
float
- generate_current(threshold_current, holding_current, dt=0.1)[source]¶
Return current time series.
- Parameters:
threshold_current (float) – the threshold current (nA)
holding_current (float) – the holding current (nA)
dt (float) – timestep of the generated currents (ms)
- Returns:
dict containing the generated current
- run(cell_model, param_values, sim=None, isolate=None, timeout=None)[source]¶
Run protocol.
- Parameters:
cell_model (bluepyopt.ephys.models.CellModel) – the cell model
param_values (dict) – optimized parameters
sim (bluepyopt.ephys.NrnSimulator) – neuron simulator
isolate (bool) – whether to isolate the run in a process with a timeout to avoid bad cells running for too long
timeout (float) – maximum real time (s) the cell is allowed to run when isolated
- Raises:
AttributeError – if the threshold_current is not set to the cell model
- Returns:
dict containing the responses for the step protocol
- class emodelrunner.protocols.sscx_protocols.SweepProtocolCustom(name=None, stimuli=None, recordings=None, cvode_active=None, deterministic=False)[source]¶
Bases:
SweepProtocol
SweepProtocol with generate_current method.
- name¶
name of this object
- Type:
str
- stimuli¶
List of all Stimulus objects used in protocol
- Type:
list of Stimuli
- recordings¶
Recording objects used in the protocol
- Type:
list of Recordings
- cvode_active¶
whether to use variable time step
- Type:
bool
Args of the parent constructor:
name (str): name of this object
stimuli (list of Stimuli): Stimulus objects used in the protocol
recordings (list of Recordings): Recording objects used in the protocol
cvode_active (bool): whether to use variable time step