bluecellulab.analysis.inject_sequence¶
Module for injecting a sequence of protocols to the cell.
Functions
|
Apply multiple stimuli to the cell on isolated processes. |
|
Creates a cell from template parameters, applies a stimulus, and records the response. |
|
Creates a cell from template parameters, applies a stimulus, and records the response. |
Classes
|
A tuple of the current, voltage and time recordings with optional spike recordings. |
|
Allowed values for the StimulusName. |
- class bluecellulab.analysis.inject_sequence.Recording(current: np.ndarray, voltage: np.ndarray, time: np.ndarray, spike: np.ndarray | None = None)[source]¶
A tuple of the current, voltage and time recordings with optional spike recordings.
-
current:
ndarray¶ Alias for field number 0
-
spike:
Optional[ndarray]¶ Alias for field number 3
-
time:
ndarray¶ Alias for field number 2
-
voltage:
ndarray¶ Alias for field number 1
-
current:
- class bluecellulab.analysis.inject_sequence.StimulusName(*values)[source]¶
Allowed values for the StimulusName.
- bluecellulab.analysis.inject_sequence.apply_multiple_stimuli(cell, stimulus_name, amplitudes, threshold_based=True, section_name=None, segment=0.5, n_processes=None, cvode=True, add_hypamp=True)[source]¶
Apply multiple stimuli to the cell on isolated processes.
- Parameters:
cell (
Cell) – The cell to which the stimuli are applied.stimulus_name (
StimulusName) – The name of the stimulus to apply.amplitudes (
Sequence[float]) – The amplitudes of the stimuli to apply.threshold_based (
bool) – Whether to consider amplitudes to be threshold percentages or to be raw amplitudes.section_name (
Optional[str]) – Section name of the cell where the stimuli are applied. If None, the stimuli are applied at the soma[0] of the cell.segment (
float) – The segment of the section where the stimuli are applied.n_processes (
Optional[int]) – The number of processes to use for running the stimuli.cvode (
bool) – True to use variable time-steps. False for fixed time-steps.add_hypamp (
bool) – True to add the cell’s holding current stimulus
- Return type:
Dict[str,Recording]- Returns:
A dictionary where the keys are the names of the stimuli and the values are the recordings of the cell’s response to each stimulus.
- Raises:
ValueError – If the stimulus name is not recognized.
- bluecellulab.analysis.inject_sequence.run_multirecordings_stimulus(template_params, stimulus, section, segment, cvode=True, add_hypamp=True, recording_locations=[('soma[0]', 0.5)], enable_spike_detection=False, threshold_spike_detection=-20.0)[source]¶
Creates a cell from template parameters, applies a stimulus, and records the response.
This function simulates the electrical activity of a neuronal cell model by injecting a stimulus into a specified section and segment, recording the voltage response, and optionally detecting spikes.
- Parameters:
template_params (TemplateParams) – Parameters required to create the cell from a specified template, including morphology and mechanisms.
stimulus (Stimulus) – The stimulus waveform to inject, defined by time and current arrays.
section (str) – Name of the section of the cell where the stimulus is applied. (e.g. soma[0])
segment (float) – The normalized position (0.0 to 1.0) along the injecting section where the stimulus is applied.
cvode (bool, optional) – Whether to use variable time-step integration. Defaults to True.
add_hypamp (bool, optional) – If True, adds a hyperpolarizing stimulus before applying the main stimulus. Defaults to True.
recording_location (list) – List of tuples containing the name of the section of the cell where voltage is recorded and the normalized position (0.0 to 1.0) along the recording section where voltage is recorded. (e.g. [(“soma[0]”, 0.5), (“dend[0]”, 0.5)])
enable_spike_detection (bool, optional) – If True, enables spike detection at the recording location. Defaults to False.
threshold_spike_detection (float, optional) – The voltage threshold (mV) for spike detection. Defaults to -20 mV.
recording_locations (
list[tuple[str,float]])
- Returns:
- Recording objects containing the following:
current (np.ndarray): The injected current waveform (nA).
voltage (np.ndarray): The recorded membrane potential (mV) over time.
time (np.ndarray): The simulation time points (ms).
spike (np.ndarray or None): The detected spikes, if spike detection is enabled.
- Return type:
list[Recording]
- Raises:
ValueError – If the time, current, and voltage arrays do not have the same length, or if the specified sections or segments are not found in the cell model.
- bluecellulab.analysis.inject_sequence.run_stimulus(template_params, stimulus, section, segment, cvode=True, add_hypamp=True, recording_section='soma[0]', recording_segment=0.5, enable_spike_detection=False, threshold_spike_detection=-20.0)[source]¶
Creates a cell from template parameters, applies a stimulus, and records the response.
This function simulates the electrical activity of a neuronal cell model by injecting a stimulus into a specified section and segment, recording the voltage response, and optionally detecting spikes.
- Parameters:
template_params (TemplateParams) – Parameters required to create the cell from a specified template, including morphology and mechanisms.
stimulus (Stimulus) – The stimulus waveform to inject, defined by time and current arrays.
section (str) – Name of the section of the cell where the stimulus is applied. (e.g. soma[0])
segment (float) – The normalized position (0.0 to 1.0) along the injecting section where the stimulus is applied.
cvode (bool, optional) – Whether to use variable time-step integration. Defaults to True.
add_hypamp (bool, optional) – If True, adds a hyperpolarizing stimulus before applying the main stimulus. Defaults to True.
recording_section (str) – Name of the section of the cell where voltage is recorded.
recording_segment (float) – The normalized position (0.0 to 1.0) along the recording section where voltage is recorded.
enable_spike_detection (bool, optional) – If True, enables spike detection at the recording location. Defaults to False.
threshold_spike_detection (float, optional) – The voltage threshold (mV) for spike detection. Defaults to -20 mV.
- Returns:
- A Recording object containing the following:
current (np.ndarray): The injected current waveform (nA).
voltage (np.ndarray): The recorded membrane potential (mV) over time.
time (np.ndarray): The simulation time points (ms).
spike (np.ndarray or None): The detected spikes, if spike detection is enabled.
- Return type:
- Raises:
ValueError – If the time, current, and voltage arrays do not have the same length, or if the specified sections or segments are not found in the cell model.