bluecellulab.tools¶
Module for calculating certain properties of Neurons.
Functions
|
Calculate the steady state voltage at a certain current step. |
|
Subprocess wrapper of calculate_SS_voltage. |
|
Calculate the input resistance at rest of the cell. |
|
Calculate the upper bound threshold current. |
|
Calculate the rheobase by first computing the upper bound threshold current. |
Return true if NEURON simulator topology command is empty. |
|
|
Compute the threshold current and the input resistance of the cell. |
|
Search current necessary to bring cell to -85 mV. |
|
Detect if there is a spike in the voltage trace. |
|
Detect if there is a spike at a certain step level. |
|
Detect if there is a spike at a certain step level. |
|
Calculate the holding current necessary for a given holding voltage. |
|
Subprocess wrapper of holding_current. |
|
|
|
Search current necessary to bring cell to -85 mV. |
|
Search current necessary to reach threshold. |
|
Return True if template_name can be run with cvode. |
|
Validate a single section and segment position. |
- bluecellulab.tools.calculate_SS_voltage(template_path, morphology_path, template_format, emodel_properties, step_level, check_for_spiking=False, spike_threshold=-20.0, section='soma[0]', segx=0.5)[source]¶
Calculate the steady state voltage at a certain current step.
- Parameters:
template_path (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
EmodelProperties|None)step_level (
float)section (
str)segx (
float)
- Return type:
float
- bluecellulab.tools.calculate_SS_voltage_subprocess(template_path, morphology_path, template_format, emodel_properties, step_level, check_for_spiking, spike_threshold, section='soma[0]', segx=0.5)[source]¶
Subprocess wrapper of calculate_SS_voltage.
This code should be run in a separate process. If check_for_spiking is True, this function will return None if the cell spikes from 100ms to the end of the simulation indicating no steady state was reached.
- Parameters:
template_path (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
EmodelProperties|None)step_level (
float)check_for_spiking (
bool)spike_threshold (
float)section (
str)segx (
float)
- Return type:
float
- bluecellulab.tools.calculate_input_resistance(template_path, morphology_path, template_format, emodel_properties, current_delta=-0.02, section='soma[0]', segx=0.5)[source]¶
Calculate the input resistance at rest of the cell.
- Parameters:
template_path (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
EmodelProperties|None)current_delta (
float)section (
str)segx (
float)
- Return type:
float
- bluecellulab.tools.calculate_max_thresh_current(cell, threshold_voltage=-20.0, section='soma[0]', segx=0.5)[source]¶
Calculate the upper bound threshold current.
- Parameters:
cell (bluecellulab.cell.Cell) – The initialized cell model.
threshold_voltage (float, optional) – Voltage threshold for spike detection. Default is -20.0 mV.
section (str, optional) – The section where current is injected.
segx (float, optional) – Fractional location within the section for current injection.
- Returns:
The upper bound threshold current.
- Return type:
float
- bluecellulab.tools.calculate_rheobase(cell, threshold_voltage=-20.0, threshold_search_stim_start=300.0, threshold_search_stim_stop=1000.0, section='soma[0]', segx=0.5)[source]¶
Calculate the rheobase by first computing the upper bound threshold current.
- Parameters:
cell (bluecellulab.cell.Cell) – The initialized cell model.
threshold_voltage (float, optional) – Voltage threshold for spike detection. Default is -20.0 mV.
threshold_search_stim_start (float, optional) – Start time for threshold search stimulation (in ms). Default is 300.0 ms.
threshold_search_stim_stop (float, optional) – Stop time for threshold search stimulation (in ms). Default is 1000.0 ms.
section (str, optional) – The section where current is injected.
segx (float, optional) – Fractional location within the section for current injection.
- Returns:
The rheobase current.
- Return type:
float
- bluecellulab.tools.check_empty_topology()[source]¶
Return true if NEURON simulator topology command is empty.
- Return type:
bool
- bluecellulab.tools.compute_memodel_properties(cell, spike_threshold_voltage=-30, v_init=-80.0, celsius=34.0)[source]¶
Compute the threshold current and the input resistance of the cell.
- Parameters:
cell (Cell) – The cell model to compute properties for.
spike_threshold_voltage (float, optional) – Voltage threshold for spike detection. Default is -30 mV.
v_init (float, optional) – Initial membrane potential. Default is -80 mV.
celsius (float, optional) – Temperature in Celsius. Default is 34.0 C.
- bluecellulab.tools.detect_hyp_current(template_path, morphology_path, template_format, emodel_properties, target_voltage)[source]¶
Search current necessary to bring cell to -85 mV.
Compared to using NEURON’s SEClamp object, the binary search better replicates what experimentalists use
- Parameters:
template_path (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
EmodelProperties|None)target_voltage (
float)
- Return type:
float
- bluecellulab.tools.detect_spike(voltage, step_thresh=-20.0)[source]¶
Detect if there is a spike in the voltage trace.
- Parameters:
voltage (
ndarray)step_thresh (
float)
- Return type:
bool
- bluecellulab.tools.detect_spike_step(template_path, morphology_path, template_format, emodel_properties, hyp_level, inj_start, inj_stop, step_level, section='soma[0]', segx=0.5, step_thresh=-20.0)[source]¶
Detect if there is a spike at a certain step level.
- Parameters:
template_path (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
EmodelProperties|None)hyp_level (
float)inj_start (
float)inj_stop (
float)step_level (
float)section (
str)segx (
float)step_thresh (
float)
- Return type:
bool
- bluecellulab.tools.detect_spike_step_subprocess(template_path, morphology_path, template_format, emodel_properties, hyp_level, inj_start, inj_stop, step_level, section='soma[0]', segx=0.5, step_thresh=-20.0)[source]¶
Detect if there is a spike at a certain step level.
- Parameters:
template_path (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
EmodelProperties|None)hyp_level (
float)inj_start (
float)inj_stop (
float)step_level (
float)section (
str)segx (
float)step_thresh (
float)
- Return type:
bool
- bluecellulab.tools.holding_current(v_hold, cell_id, circuit_path, enable_ttx=False)[source]¶
Calculate the holding current necessary for a given holding voltage.
- Parameters:
v_hold (
float)cell_id (
int|tuple[str,int])circuit_path (
str|Path)
- Return type:
Tuple[float,float]
- bluecellulab.tools.holding_current_subprocess(v_hold, enable_ttx, cell_kwargs)[source]¶
Subprocess wrapper of holding_current.
- bluecellulab.tools.search_hyp_current(template_path, morphology_path, template_format, emodel_properties, target_voltage, min_current, max_current)[source]¶
Search current necessary to bring cell to -85 mV.
- Parameters:
template_path (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
Optional[EmodelProperties])target_voltage (
float)min_current (
float)max_current (
float)
- Return type:
float
- bluecellulab.tools.search_threshold_current(template_name, morphology_path, template_format, emodel_properties, hyp_level, inj_start, inj_stop, min_current, max_current, current_precision=0.01, section='soma[0]', segx=0.5, step_thresh=-20.0)[source]¶
Search current necessary to reach threshold.
- Parameters:
template_name (
str|Path)morphology_path (
str|Path)template_format (
str)emodel_properties (
EmodelProperties|None)hyp_level (
float)inj_start (
float)inj_stop (
float)min_current (
float)max_current (
float)current_precision (
float)section (
str)segx (
float)step_thresh (
float)
- bluecellulab.tools.template_accepts_cvode(template_name)[source]¶
Return True if template_name can be run with cvode.
- Parameters:
template_name (
str|Path)- Return type:
bool
- bluecellulab.tools.validate_section_and_segment(cell, section_name, segment_position)[source]¶
Validate a single section and segment position.
- Parameters:
cell (
Cell) – The cell model to validate against.section_name (
str) – The name of the section to validate (e.g., ‘soma’, ‘axon[1]’).segment_position (
float) – The position within the section (e.g., 0.5 for the middle).
- Raises:
ValueError – If the section or position is invalid.