emodelrunner.GUI_utils.simulator

Class containing simulation for the GUI.

Functions

get_holding_data(holdings, stimulus_data, ...)

Extract holding data from StepProtocol json dict and add amplitude to a holding list.

get_pos_and_color(sec, seg_pos, syn_type)

Returns the position and the synaptic type (0 for inhib.

get_step_data(steps, step, default_step)

Extract step data from StepProtocol json dict and add amplitude to a step list.

section_coordinate_3d(sec, seg_pos)

Returns the 3d coordinates of a point in a section.

Classes

NeuronSimulation([config_path])

Class containing BPO cell, simulation & protocol.

class emodelrunner.GUI_utils.simulator.NeuronSimulation(config_path='config/config_allsteps.ini')[source]

Bases: object

Class containing BPO cell, simulation & protocol.

config

dictionary containing configuration data

Type:

dict

cell_path

path to cell repo. should be “.”

Type:

str

total_duration

duration of cell simulation (ms)

Type:

float

steps

default step stimuli (nA)

Type:

list of floats

hypamps

default holding stimuli (nA)

Type:

list of floats

step_stim

selected step stimulus (nA)

Type:

float

hypamp

selected holding stimulus (nA)

Type:

float

step_delay

delay before applying step stimulus (ms)

Type:

float

step_duration

duration of step stimulus (ms)

Type:

float

hold_step_delay

delay of holding stimulus (ms)

Type:

float

hold_step_duration

duration of holding stimulus (ms)

Type:

float

available_pre_mtypes

all synapses pre_mtypes {mtypeidx: mtype_name, …}

Type:

dict

pre_mtypes

selected pre_mtypes to run [mtypeidx, …]

Type:

list of int

netstim_params

netstim parameters for synapses of each mtype {mtypeidx:[start, interval, number, noise]}

Type:

dict

syn_start

default time (ms) at which the synapse starts firing

Type:

int

syn_interval

default interval (ms) between two synapse firing

Type:

int

syn_nmb_of_spikes

default number of synapse firing

Type:

int

syn_noise

default synapse noise

Type:

int

protocol

BluePyOpt-based Protocol

Type:

ephys.protocols.SweepProtocol

cell

BluePyOpt-based cell

Type:

CellModelCustom

release_params

optimised cell parameters to fill in the cell’s free parameters

Type:

dict

sim

BluePyOpt simulator can access neuron data from it

Type:

ephys.simulators.NrnSimulator

syn_display_data

synapse data (position and type) for display syn_display_data[pre_mtype] = [x,y,z,type], type=0 if inhib, type=1 if excit

Type:

dict

create_cell_custom()[source]

Create a cell.

Returns:

cell model

Return type:

emodelrunner.cell.CellModelCustom

destroy()[source]

Destroy cell & protocol.

get_syn_stim()[source]

Create synapse stimuli.

Returns:

synapse stimuli

Return type:

emodelrunner.synapses.stimuli.NrnNetStimStimulusCustom

get_voltage()[source]

Returns voltage response.

Returns:

a tuple containing

  • ndarray: the time response

  • ndarray: the voltage response

instantiate()[source]

Instantiate cell, simulation & protocol.

load_available_pre_mtypes()[source]

Load the list of pre mtype cells to which are connected the synapses.

Returns:

mtypes of cells connected to the synapses

Return type:

dict

load_cell_sim()[source]

Load BPO cell & simulation.

load_protocol(protocol_name='protocol')[source]

Load BPO protocol.

Parameters:

protocol_name (str) – protocol name to use in BluePyOpt classes. Does not have an effect on the simulation

load_protocol_params(total_duration=3000, step_delay=700, step_duration=2000, hold_step_delay=0, hold_step_duration=3000, default_step=0, default_holding=0)[source]

Load default protocol params.

Parameters:
  • total_duration (float) – default value for duration of cell simulation (ms) if no StepProtocol is found

  • step_delay (float) – default value for delay before applying step stimulus (ms) if no StepProtocol is found

  • step_duration (float) – default value for duration of step stimulus (ms) if no StepProtocol is found

  • hold_step_delay (float) – default value for delay of holding stimulus (ms) if no StepProtocol is found

  • hold_step_duration (float) – default value for duration of holding stimulus (ms) if no StepProtocol is found

  • default_step (float) – default value for custom step amplitude (nA)

  • default_holding (float) – default value for custom holding amplitude (nA)

load_synapse_display_data()[source]

Load dict containing x,y,z of each synapse & inhib/excit.

load_synapse_params(syn_start=0, syn_interval=0, syn_nmb_of_spikes=0, syn_noise=0)[source]

Load default synapse params.

Parameters:
  • syn_start (int) – default time (ms) at which the synapse starts firing

  • syn_interval (int) – default interval (ms) between two synapse firing

  • syn_nmb_of_spikes (int) – default number of synapse firing

  • syn_noise (int) – default synapse noise

emodelrunner.GUI_utils.simulator.get_holding_data(holdings, stimulus_data, total_duration, default_holding)[source]

Extract holding data from StepProtocol json dict and add amplitude to a holding list.

Parameters:
  • holdings (list) – list of holding amplitudes (nA) to be updated

  • stimulus_data (dict) – stimulus dict from protocol json file containing holding data

  • total_duration (float) – total duration of the step (ms)

  • default_holding (float) – default value for the custom holding entry

Returns:

a tuple containing

  • float: delay of the holding stimulus (ms)

  • float: duration of the holding stimulus (ms)

emodelrunner.GUI_utils.simulator.get_pos_and_color(sec, seg_pos, syn_type)[source]

Returns the position and the synaptic type (0 for inhib. or 1 for excit.).

Parameters:
  • sec – neuron section

  • seg_pos (float) – postion of the segment os the section (should be between 0 and 1)

  • syn_type (int) – synaptic type. excitatory if >=100, inhibitory if <100

Returns:

first 3 numbers are the position, fourth is the synaptic type, None if pos not found

Return type:

list

emodelrunner.GUI_utils.simulator.get_step_data(steps, step, default_step)[source]

Extract step data from StepProtocol json dict and add amplitude to a step list.

Parameters:
  • steps (list) – list of step amplitudes (nA) to be updated

  • step (dict or list of dicts) – step from which to extract step data

  • default_step (float) – default value for the custom step entry (nA)

Returns:

a tuple containing

  • float: total duration of the step (ms)

  • float: delay of the step (ms)

  • float: duration of the step (ms)

emodelrunner.GUI_utils.simulator.section_coordinate_3d(sec, seg_pos)[source]

Returns the 3d coordinates of a point in a section.

Parameters:
  • sec – neuron section

  • seg_pos (float) – postion of the segment os the section (should be between 0 and 1)

Returns:

3d coordinates of a point in a section, or None if not found

Return type:

list