bluecellulab.analysis.analysis

Module for analyzing cell simulation results.

Functions

compute_plot_fi_curve(cell[, ...])

Compute and plot the Frequency-Current (F-I) curve for a given cell by injecting a range of currents.

compute_plot_iv_curve(cell[, ...])

Compute and plot the Current-Voltage (I-V) curve for a given cell by injecting a range of currents.

Classes

BPAP(cell)

bluecellulab.analysis.analysis.compute_plot_fi_curve(cell, injecting_section='soma[0]', injecting_segment=0.5, recording_section='soma[0]', recording_segment=0.5, stim_start=100.0, duration=500.0, post_delay=100.0, max_current=0.8, threshold_voltage=-20, nb_bins=11, rheobase=None, show_figure=True, save_figure=False, output_dir='./', output_fname='fi_curve.pdf', n_processes=None, celsius=None, v_init=None)[source]

Compute and plot the Frequency-Current (F-I) curve for a given cell by injecting a range of currents.

This function evaluates the relationship between injected current amplitude and the firing rate of a neuronal cell model. Currents are injected at a specified section and segment, and the number of spikes recorded in the specified recording location is used to construct the F-I curve.

Parameters:
  • cell (bluecellulab.cell.Cell) – The initialized BlueCelluLab cell model.

  • injecting_section (str, optional) – The name of the section where the stimulus is injected. Default is “soma[0]”.

  • injecting_segment (float, optional) – The position along the injecting section (0.0 to 1.0) where the stimulus is applied. Default is 0.5.

  • recording_section (str, optional) – The name of the section where spikes are recorded. Default is “soma[0]”.

  • recording_segment (float, optional) – The position along the recording section (0.0 to 1.0) where spikes are recorded. Default is 0.5.

  • stim_start (float, optional) – The start time of the current injection (in ms). Default is 100.0 ms.

  • duration (float, optional) – The duration of the current injection (in ms). Default is 500.0 ms.

  • post_delay (float, optional) – The delay after the stimulation ends before the simulation stops (in ms). Default is 100.0 ms.

  • max_current (float, optional) – The maximum amplitude of the injected current (in nA). Default is 0.8 nA.

  • threshold_voltage (float, optional) – The voltage threshold (in mV) for detecting a steady-state response. Default is -20 mV.

  • nb_bins (int, optional) – The number of discrete current levels between 0 and max_current. Default is 11.

  • rheobase (float, optional) – The rheobase current (in nA) for the cell. If not provided, it will be calculated using the calculate_rheobase function.

  • show_figure (bool) – Whether to display the figure. Default is True.

  • save_figure (bool) – Whether to save the figure. Default is False.

  • output_dir (str) – The directory to save the figure if save_figure is True. Default is “./”.

  • output_fname (str) – The filename to save the figure as if save_figure is True. Default is “iv_curve.png”.

  • n_processes (int, optional) – The number of processes to use for parallel execution. If None or if it is higher than the number of steps, it will use the number of steps as the number of processes.

  • celsius (float, optional) – Temperature in Celsius.

  • v_init (float, optional) – Initial membrane potential.

Returns:

A tuple containing:
  • list_amp (np.ndarray): The injected current amplitudes (nA).

  • spike_count (np.ndarray): The corresponding spike counts for each current amplitude.

Return type:

tuple

Raises:

ValueError – If the cell object is invalid or the specified sections/segments are not found.

bluecellulab.analysis.analysis.compute_plot_iv_curve(cell, injecting_section='soma[0]', injecting_segment=0.5, recording_section='soma[0]', recording_segment=0.5, stim_start=100.0, duration=500.0, post_delay=100.0, threshold_voltage=-20, nb_bins=11, rheobase=None, show_figure=True, save_figure=False, output_dir='./', output_fname='iv_curve.pdf', n_processes=None, celsius=None, v_init=None)[source]

Compute and plot the Current-Voltage (I-V) curve for a given cell by injecting a range of currents.

This function evaluates the relationship between the injected current amplitude and the resulting steady-state membrane potential of a neuronal cell model. Currents are injected at a specified section and segment, and the steady-state voltage at the recording location is used to construct the I-V curve.

Parameters:
  • cell (bluecellulab.cell.Cell) – The initialized BlueCelluLab cell model.

  • injecting_section (str, optional) – The name of the section where the stimulus is injected. Default is “soma[0]”.

  • injecting_segment (float, optional) – The position along the injecting section (0.0 to 1.0) where the stimulus is applied. Default is 0.5.

  • recording_section (str, optional) – The name of the section where the voltage is recorded. Default is “soma[0]”.

  • recording_segment (float, optional) – The position along the recording section (0.0 to 1.0) where the voltage is recorded. Default is 0.5.

  • stim_start (float, optional) – The start time of the current injection (in ms). Default is 100.0 ms.

  • duration (float, optional) – The duration of the current injection (in ms). Default is 500.0 ms.

  • post_delay (float, optional) – The delay after the stimulation ends before the simulation stops (in ms). Default is 100.0 ms.

  • threshold_voltage (float, optional) – The voltage threshold (in mV) for detecting a steady-state response. Default is -20 mV.

  • nb_bins (int, optional) – The number of discrete current levels between 0 and the maximum current. Default is 11.

  • rheobase (float, optional) – The rheobase current (in nA) for the cell. If not provided, it will be calculated using the calculate_rheobase function.

  • show_figure (bool) – Whether to display the figure. Default is True.

  • save_figure (bool) – Whether to save the figure. Default is False.

  • output_dir (str) – The directory to save the figure if save_figure is True. Default is “./”.

  • output_fname (str) – The filename to save the figure as if save_figure is True. Default is “iv_curve.png”.

  • n_processes (int, optional) – The number of processes to use for parallel execution. If None or if it is higher than the number of steps, it will use the number of steps as the number of processes.

  • celsius (float, optional) – Temperature in Celsius.

  • v_init (float, optional) – Initial membrane potential.

Returns:

A tuple containing:
  • list_amp (np.ndarray): The injected current amplitudes (nA).

  • steady_states (np.ndarray): The corresponding steady-state voltages (mV) recorded at the specified location.

Return type:

tuple

Raises:

ValueError – If the cell object is invalid, the specified sections/segments are not found, or if the simulation results are inconsistent.