bluecellulab.circuit_simulation

Ssim class of bluecellulab that loads a circuit simulation to do cell simulations.

Classes

CircuitSimulation(**kwargs)

Class that loads a circuit simulation to do cell simulations.

SSim(**kwargs)

Class that loads a circuit simulation to do cell simulations.

class bluecellulab.circuit_simulation.CircuitSimulation(**kwargs)[source]

Class that loads a circuit simulation to do cell simulations.

create_cell_from_circuit(cell_id)[source]

Create a Cell object from the circuit.

Parameters:

cell_id (CellId)

Return type:

Cell

delete()[source]

Delete CircuitSimulation and all of its attributes.

NEURON objects are explicitly needed to be deleted.

fetch_cell_kwargs(cell_id)[source]

Get the kwargs to instantiate a Cell object.

Parameters:

cell_id (CellId)

Return type:

dict

get_mainsim_time_trace(t_step=None)[source]

Get the time trace from the main simulation.

Parameters:
  • t_step (time step (should be a multiple of report time step T;)

  • default) (equals T by)

  • Returns – One dimentional np.ndarray to represent the times.

Return type:

ndarray

get_mainsim_voltage_trace(cell_id, t_start=None, t_stop=None, t_step=None)[source]

Get the voltage trace from a cell from the main simulation.

Parameters:
  • cell_id (cell id of interest.)

  • t_start (time range of interest,)

  • t_stop (time range of interest,)

  • default. (report time range is used by)

  • t_step (time step (should be a multiple of report time step T;)

  • default) (equals T by)

  • Returns – One dimentional np.ndarray to represent the voltages.

Return type:

ndarray

get_syn_descriptions(cell_id)[source]

Get synapse descriptions dataframe.

Parameters:

cell_id (int | tuple[str, int])

Return type:

DataFrame

get_time()[source]

Get the time vector for the recordings, contains negative times.

The negative times occur as a result of ForwardSkip.

Return type:

ndarray

get_time_trace(t_start=None, t_stop=None, t_step=None)[source]

Get the time vector for the recordings, negative times removed.

Parameters:
  • t_start (time range of interest.)

  • t_stop (time range of interest.)

  • t_step (time step (multiple of report dt; equals dt by default))

  • Returns – 1D np.ndarray representing time points.

Return type:

ndarray

get_voltage_trace(cell_id, t_start=None, t_stop=None, t_step=None)[source]

Get the voltage vector for the cell_id, negative times removed.

Parameters:
  • cell_id (cell id of interest.)

  • t_start (time range of interest,)

  • t_stop (time range of interest,)

  • default. (report time range is used by)

  • t_step (time step (should be a multiple of report time step T;)

  • default) (equals T by)

  • Returns – One dimentional np.ndarray to represent the voltages.

Return type:

ndarray

global_gid(pop, local_id)[source]

Convert a population name and local ID to a global GID.

Parameters:
  • pop (str) – Population name.

  • local_id (int) – Local ID within the population.

Returns:

Global GID.

Return type:

int

Raises:

RuntimeError – If GID namespace is not initialized.

instantiate_gids(cells, add_replay=False, add_stimuli=False, add_synapses=False, add_minis=False, add_noise_stimuli=False, add_hyperpolarizing_stimuli=False, add_relativelinear_stimuli=False, add_pulse_stimuli=False, add_projections=False, intersect_pre_gids=None, interconnect_cells=True, pre_spike_trains=None, add_shotnoise_stimuli=False, add_ornstein_uhlenbeck_stimuli=False, add_sinusoidal_stimuli=False, add_linear_stimuli=False, add_seclamp_stimuli=False, add_subthreshold_stimuli=False)[source]

Instantiate a list of cells.

Parameters:
  • cells (int | tuple[str, int] | list[int | tuple[str, int]]) – List of cell ids. When a single element, it will be converted to a list

  • add_replay (Add presynaptic spiketrains from the large simulation) – If pre_spike_trains is combined with this option the spiketrains will be merged

  • add_stimuli (Add the same stimuli as in the large simulation)

  • add_synapses (bool) – Add the touch-detected synapses, as described by the circuit to the cell (This option only influence the ‘creation’ of synapses, it doesn’t add any connections) Default value is False

  • add_minis (Add synaptic minis to the synapses) – (this requires add_synapses=True) Default value is False

  • add_noise_stimuli (bool) – Process the ‘noise’ stimuli blocks of the simulation config, Setting add_stimuli=True, will automatically set this option to True.

  • add_hyperpolarizing_stimuli (Process the 'hyperpolarizing' stimuli) – blocks of the simulation config. Setting add_stimuli=True, will automatically set this option to True.

  • add_relativelinear_stimuli (Process the 'relativelinear' stimuli) – blocks of the simulation config. Setting add_stimuli=True, will automatically set this option to True.

  • add_pulse_stimuli (Process the 'pulse' stimuli) – blocks of the simulation config. Setting add_stimuli=True, will automatically set this option to True.

  • add_projections (Control whether projection edge populations are considered when adding synapses.) –

    • False (default): intrinsic connectivity only (no projection edge populations)

    • True: intrinsic connectivity + all projection edge populations

    • list[str] | str: Intrinsic connectivity plus the specified projection edge population name(s).

    Note:

    Names refer to SONATA edge population names (SnapCircuit.edges keys).

  • intersect_pre_gids (list of gids) – Only add synapses to the cells if their presynaptic gid is in this list

  • interconnect_cells (When multiple gids are instantiated,) – interconnect the cells with real (non-replay) synapses. When this option is combined with add_replay, replay spiketrains will only be added for those presynaptic cells that are not in the network that’s instantiated. This option requires add_synapses=True

  • pre_spike_trains (A dictionary with keys the presynaptic gids, and) – values the list of spike timings of the presynaptic cells with the given gids. If this option is used in combination with add_replay=True, the spike trains for the same gids will be automatically merged

  • add_shotnoise_stimuli (bool) – Process the ‘shotnoise’ stimuli blocks of the simulation config, Setting add_stimuli=True, will automatically set this option to True.

  • add_ornstein_uhlenbeck_stimuli (bool) – Process the ‘ornstein_uhlenbeck’ stimuli blocks of the simulation config, Setting add_stimuli=True, will automatically set this option to True.

  • add_sinusoidal_stimuli (Process the 'sinusoidal' stimuli) – blocks of the simulation config. Setting add_stimuli=True, will automatically set this option to True.

  • add_linear_stimuli (Process the 'linear' stimuli) – blocks of the simulation config. Setting add_stimuli=True, will automatically set this option to True.

  • add_seclamp_stimuli (Process the 'seclamp' stimuli) – blocks of the simulation config. Setting add_stimuli=True, will automatically set this option to True.

  • add_subthreshold_stimuli (Process the 'subthreshold' stimuli) – blocks of the simulation config. Setting add_stimuli=True, will automatically set this option to True.

static merge_pre_spike_trains(*train_dicts)[source]

Merge presynaptic spike train dicts.

Return type:

dict[CellId, ndarray]

run(t_stop=None, v_init=None, celsius=None, dt=None, forward_skip=True, forward_skip_value=None, cvode=False, show_progress=False)[source]

Simulate the Circuit.

Parameters:
  • t_stop (Optional[float]) – This function will run the simulation until t_stop

  • v_init (Optional[float]) – Voltage initial value when the simulation starts

  • celsius (Optional[float]) – Temperature at which the simulation runs

  • dt (Optional[float]) – Timestep (delta-t) for the simulation

  • forward_skip (bool) – [compatibility/non-sonata] Enable/disable ForwardSkip, when forward_skip_value is None, forward skip will only be enabled if the simulation config has a ForwardSkip value)

  • forward_skip_value (Optional[float]) – [compatibility/non-sonata] Overwrite the ForwardSkip value in the simulation config. If this is set to None, the value in the simulation config is used.

  • cvode (bool) – Force the simulation to run in variable timestep. Not possible when there are stochastic channels in the neuron model. When enabled results from a large network simulation will not be exactly reproduced.

  • show_progress (bool) – Show a progress bar during simulations. When enabled results from a large network simulation will not be exactly reproduced.

Note

Passing dt to run() is deprecated and will be removed in a future release. The simulation timestep used is the one resolved at CircuitSimulation construction (either the explicit dt passed to the constructor or the value from the simulation_config).

class bluecellulab.circuit_simulation.SSim(**kwargs)[source]

Class that loads a circuit simulation to do cell simulations.