emodelrunner.protocols.create_protocols

Protocol creation functions & custom protocol classes.

Functions

create_protocols_object(apical_point_isec, ...)

Return a dict containing protocols.

define_pairsim_protocols(postcell, ...[, ...])

Create stimuli and protocols to run glusynapse cell.

define_synapse_plasticity_protocols(cell, ...)

Create stimuli and protocols to run glusynapse cell.

set_sscx_main_protocol_efeatures(...)

Set the efeatures of the main protocol.

set_thalamus_main_protocol_efeatures(...)

Set the efeatures of the main thalamus protocol.

Classes

ProtocolBuilder(protocols)

Class representing the protocols applied in SSCX.

class emodelrunner.protocols.create_protocols.ProtocolBuilder(protocols)[source]

Bases: object

Class representing the protocols applied in SSCX.

protocols

the protocols to apply to the cell

Type:

bluepyopt.ephys.protocols.SequenceProtocol

get_ephys_protocols()[source]

Returns the list of ephys protocol objects.

Returns:

the protocols to apply to the cell

Return type:

bluepyopt.ephys.protocols.SequenceProtocol

get_stim_currents(responses, dt)[source]

Generates the currents injected by protocols.

Parameters:
  • responses (dict) – the responses to the protocols run

  • dt (float) – timestep of the generated currents (ms)

Returns:

the currents of the protocols.

If the MainProtocol was used, only the RMP protocol, ‘pre-protocols’ and ‘other protocols’ currents are returned

Return type:

dict

get_thalamus_stim_currents(responses, mtype, dt)[source]

Returns the currents injected by thalamus protocols.

Parameters:
  • responses (dict) – protocol responses

  • mtype (str) – mtype to index the responses

  • dt (float) – timestep of the generated currents (ms)

Raises:

KeyError – when “dep” holding or threshold current is missing

Returns:

the generated currents in a dict.

Return type:

dict

classmethod using_sscx_protocols(add_synapses, prot_args, cell=None)[source]

Creates the object with the sscx protocols.

Parameters:
  • add_synapses (bool) – whether to add synapses to the cell

  • prot_args (ProtArgs) – config data relative to protocols

  • cell (CellModelCustom) – cell model

Returns:

the object with the sscx protocols

Return type:

ProtocolBuilder

classmethod using_thalamus_protocols(add_synapses, prot_args, cell=None)[source]

Creates the object with the thalamus protocols.

Parameters:
  • add_synapses (bool) – whether to add synapses to the cell

  • prot_args (ProtArgs) – config data relative to protocols

  • cell (CellModelCustom) – cell model

Returns:

the object with the thalamus protocols

Return type:

ProtocolBuilder

emodelrunner.protocols.create_protocols.create_protocols_object(apical_point_isec, prot_path, package_type, features_path='', mtype='', syn_locs=None, stochkv_det=None)[source]

Return a dict containing protocols.

Parameters:
  • apical_point_isec (int) – section index of the apical point Set to -1 no apical point is used in any extra recordings

  • prot_path (str) – path to the protocols file

  • package_type (Enum) – enum denoting the package type

  • features_path (str) – path to the features file

  • mtype (str) – morphology name to be used as prefix in output filenames

  • syn_locs (list) – list of synapse locations

  • stochkv_det (bool) – set if stochastic or deterministic

Raises:

ValueError – if the package type is not supported

Returns:

sequence protocol containing all the protocols

Return type:

ephys.protocols.SequenceProtocol

emodelrunner.protocols.create_protocols.define_pairsim_protocols(postcell, presyn_prot_name, postsyn_prot_name, cvode_active, synrecs, tstop, fastforward, presyn_stim_args, stim_path='protocols/stimuli.json')[source]

Create stimuli and protocols to run glusynapse cell.

Parameters:
  • postcell (CellModelCustom) – post-synaptic cell model

  • presyn_prot_name (str) – presynaptic protocol name to be passed on to Recording and Protocol classes

  • postsyn_prot_name (str) – postsynaptic protocol name to be passed on to Recording and Protocol classes

  • cvode_active (bool) – whether to activate the adaptative time step

  • synrecs (list of str) – the extra synapse variables to record

  • tstop (float) – total duration of the simulation (ms)

  • fastforward (float) – time at which to enable synapse fast-forwarding (ms)

  • presyn_stim_args (PresynStimArgs) – presynaptic stimulus configuration data

  • stim_path (str) – path to the pulse stimuli file

Returns:

pair simulation synapse plasticity protocols

Return type:

synplas_protocols.SweepProtocolPairSim

emodelrunner.protocols.create_protocols.define_synapse_plasticity_protocols(cell, pre_spike_train, protocol_name, cvode_active, synrecs, tstop, fastforward, stim_path='protocols/stimuli.json')[source]

Create stimuli and protocols to run glusynapse cell.

Parameters:
  • cell (CellModelCustom) – post-synaptic cell model

  • pre_spike_train (list) – times at which the synapses fire (ms)

  • protocol_name (str) – protocol name to be passed on to Recording and Protocol classes

  • cvode_active (bool) – whether to activate the adaptative time step

  • synrecs (list of str) – the extra synapse variables to record

  • tstop (float) – total duration of the simulation (ms)

  • fastforward (float) – time at which to enable synapse fast-forwarding (ms)

  • stim_path (str) – path to the pulse stimuli file

Returns:

synapse plasticity protocols

Return type:

synplas_protocols.SweepProtocolCustom

emodelrunner.protocols.create_protocols.set_sscx_main_protocol_efeatures(protocols_dict, efeatures, prefix)[source]

Set the efeatures of the main protocol.

Parameters:
  • protocols_dict (dict) – contains all protocols to be run If this function is called, should contain the MainProtocol and the associated protocols (RinHoldCurrent, ThresholdDetection)

  • efeatures (dict) – contains the efeatures

  • prefix (str) – prefix used in naming responses, features, recordings, etc.

emodelrunner.protocols.create_protocols.set_thalamus_main_protocol_efeatures(protocols_dict, efeatures, prefix)[source]

Set the efeatures of the main thalamus protocol.

Parameters:
  • protocols_dict (dict) – contains all protocols to be run If this function is called, should contain the MainProtocol and the associated protocols (RinHoldCurrent, ThresholdDetection)

  • efeatures (dict) – contains the efeatures

  • prefix (str) – prefix used in naming responses, features, recordings, etc.