miv_simulator.cells#

Functions

apply_mech_rules(cell, node, mech_name, ...)

Provided a membrane density mechanism, a parameter, a node, and a dict of rules, interprets the provided rules, and applies resulting parameter values to mechanisms in the corresponding section.

connect2target(cell, sec[, loc, param, ...])

Converts analog voltage in the specified section to digital spike output.

connect_nodes(tree, parent, child[, ...])

Connects the given section node to a parent node, and if specified, establishes a connection between their associated hoc sections.

correct_cell_for_spines_cm(cell, env[, verbose])

type cell:

correct_cell_for_spines_g_pas(cell, env[, ...])

If not explicitly modeling spine compartments for excitatory synapses, this method scales g_pas in all dendritic sections proportional to the number of excitatory synapses contained in each section.

correct_node_for_spines_cm(node, env, gid[, ...])

If not explicitly modeling spine compartments for excitatory synapses, this method scales cm in this dendritic section proportional to the number of excitatory synapses contained in the section.

correct_node_for_spines_g_pas(node, env, ...)

If not explicitly modeling spine compartments for excitatory synapses, this method scales g_pas in this dendritic section proportional to the number of excitatory synapses contained in the section.

filter_nodes(cell[, sections, layers, swc_types])

Returns a subset of the nodes of the given cell according to the given criteria.

get_distance_to_node(cell, node[, root, loc])

Returns the distance from the given location on the given node to its connection with a root node.

get_node_children(cell, node[, return_edge_data])

rtype:

List[Union[Any, SectionNode]]

get_node_parent(cell, node[, return_edge_data])

rtype:

Union[Tuple[None, None], Tuple[SectionNode, Dict[str, float]]]

get_soma_xyz(neurotree_dict, swc_type_defs)

import_mech_dict_from_file(cell[, ...])

Imports from a .yaml file a dictionary specifying parameters of NEURON cable properties, density mechanisms, and point processes for each type of section in a BiophysCell.

import_morphology_from_hoc(cell, hoc_cell[, ...])

Append sections from an existing instance of a NEURON cell template to a Python cell wrapper.

init_biophysics(cell[, env, reset_cable, ...])

Consults a dictionary specifying parameters of NEURON cable properties, density mechanisms, and point processes for each type of section in a BiophysCell.

init_cable(cell[, verbose])

rtype:

None

init_circuit_context(env, pop_name, gid[, ...])

rtype:

None

init_spike_detector(cell[, node, distance, ...])

Initializes the spike detector in the given cell according to the given arguments or a spike detector configuration of the mechanism dictionary of the cell, if one exists.

insert_section_node(cell, section_type, ...)

rtype:

SectionNode

insert_section_tree(cell, sec_list, sec_dict)

rtype:

None

is_cell_registered(env, gid)

Returns True if cell gid has already been registered, False otherwise.

load_biophys_cell_dicts(env, pop_name, gid_set)

Loads the data necessary to instantiate BiophysCell into the given dictionary.

make_BRK_cell(env, pop_name, gid[, ...])

type env:

AbstractEnv

make_PR_cell(env, pop_name, gid[, ...])

type env:

AbstractEnv

make_SC_cell(env, pop_name, gid[, ...])

type env:

AbstractEnv

make_biophys_cell(env, population_name, gid)

type env:

AbstractEnv

make_hoc_cell(env, pop_name, gid[, ...])

type env:

AbstractEnv

make_input_cell(env, gid, pop_id, ...[, ...])

Instantiates an input generator according to the given cell template.

make_morph_graph(biophys_cell[, node_filters])

Creates a graph of 3d points that follows the morphological organization of the given neuron.

make_neurotree_hoc_cell(template_class[, ...])

type template_class:

HocObject

make_section_graph(neurotree_dict)

Creates a graph of sections that follows the topological organization of the given neuron.

record_cell(env, pop_name, gid[, ...])

Creates a recording object for the given cell, according to configuration in env.recording_profile.

register_cell(env, pop_name, gid, cell)

Registers a cell in a network environment.

report_topology(env, cell[, node])

Traverse a cell and report topology and number of synapses.

reset_cable_by_node(cell, node[, verbose])

Consults a dictionary specifying parameters of NEURON cable properties such as axial resistance ('Ra'), membrane specific capacitance ('cm'), and a spatial resolution parameter to specify the number of separate segments per section in a BiophysCell :type cell: Union[BiophysCell, SCneuron] :param cell: :class:'BiophysCell' :param node_index: int :type verbose: bool :param verbose: bool

set_mech_param(cell, node, mech_name, ...[, ...])

type node:

SectionNode

update_biophysics_by_sec_type(cell, sec_type)

This method loops through all sections of the specified type, and consults the mechanism dictionary to update mechanism properties.

update_mechanism_by_node(cell, node, mech_name)

This method loops through all the parameters for a single mechanism specified in the mechanism dictionary and calls apply_mech_rules to interpret the rules and set the values for the given node.

Classes

BRKneuron(gid, pop_name[, env, cell_config, ...])

An implementation of a Booth-Rinzel-Kiehn-type reduced biophysical neuron model for simulation in NEURON.

BiophysCell(gid, population_name[, ...])

A Python wrapper for neuronal cell objects specified in the NEURON language hoc.

PRneuron(gid, pop_name[, env, cell_config, ...])

An implementation of a Pinsky-Rinzel-type reduced biophysical neuron model for simulation in NEURON.

SCneuron(gid, pop_name[, env, mech_dict, ...])

Single-compartment biophysical neuron model for simulation in NEURON.

SectionNode(section_type, index, section[, ...])

miv_simulator.cells.make_neurotree_hoc_cell(template_class, gid=0, neurotree_dict={}, section_content=None)[source]#
Parameters:
  • template_class (HocObject) –

  • local_id

  • gid (int) –

  • dataset_path

  • neurotree_dict (Dict[str, Union[ndarray, Dict[str, Union[int, Dict[int, ndarray], ndarray]]]]) –

Return type:

Union[HocObject, Tuple[HocObject, Dict[int, Dict[str, ndarray]]]]

Returns:

hoc cell object

miv_simulator.cells.make_hoc_cell(env, pop_name, gid, neurotree_dict=False)[source]#
Parameters:
  • env (AbstractEnv) –

  • gid (int) –

  • pop_name (str) –

Return type:

HocObject

Returns:

miv_simulator.cells.make_input_cell(env, gid, pop_id, input_source_dict, spike_train_attr_name='t')[source]#

Instantiates an input generator according to the given cell template.

Return type:

HocObject

miv_simulator.cells.make_section_graph(neurotree_dict)[source]#

Creates a graph of sections that follows the topological organization of the given neuron. :type neurotree_dict: :param neurotree_dict: :return: NetworkX.DiGraph

class miv_simulator.cells.BRKneuron(gid, pop_name, env=None, cell_config=None, mech_dict=None)[source]#

Bases: object

An implementation of a Booth-Rinzel-Kiehn-type reduced biophysical neuron model for simulation in NEURON. Conforms to the same API as BiophysCell.

class miv_simulator.cells.PRneuron(gid, pop_name, env=None, cell_config=None, mech_dict=None)[source]#

Bases: object

An implementation of a Pinsky-Rinzel-type reduced biophysical neuron model for simulation in NEURON. Conforms to the same API as BiophysCell.

class miv_simulator.cells.SCneuron(gid, pop_name, env=None, mech_dict=None, mech_file_path=None)[source]#

Bases: object

Single-compartment biophysical neuron model for simulation in NEURON. Conforms to the same API as BiophysCell.

class miv_simulator.cells.BiophysCell(gid, population_name, hoc_cell=None, neurotree_dict=None, mech_file_path=None, mech_dict=None, env=None)[source]#

Bases: object

A Python wrapper for neuronal cell objects specified in the NEURON language hoc.

miv_simulator.cells.get_distance_to_node(cell, node, root=None, loc=None)[source]#

Returns the distance from the given location on the given node to its connection with a root node. :type node: SectionNode :param node: int :type loc: Optional[float] :param loc: float :rtype: float :return: int or float

miv_simulator.cells.connect_nodes(tree, parent, child, parent_loc=1.0, child_loc=0.0, connect_hoc_sections=False)[source]#

Connects the given section node to a parent node, and if specified, establishes a connection between their associated hoc sections. :type parent: SectionNode :param parent: SectionNode :type child: SectionNode :param child: SectionNode :type parent_loc: float :param parent_loc: float in [0,1] : connect to this end of the parent hoc section :type child_loc: float :param child_loc: float in [0,1] : connect this end of the child hoc section :type connect_hoc_sections: bool :param connect_hoc_sections: bool

Return type:

DiGraph

miv_simulator.cells.import_morphology_from_hoc(cell, hoc_cell, section_content=None)[source]#

Append sections from an existing instance of a NEURON cell template to a Python cell wrapper. :type cell: BiophysCell :param cell: :class:’BiophysCell’ :type hoc_cell: HocObject :param hoc_cell: :class:’h.hocObject’: instance of a NEURON cell template

Return type:

None

miv_simulator.cells.import_mech_dict_from_file(cell, mech_file_path=None)[source]#

Imports from a .yaml file a dictionary specifying parameters of NEURON cable properties, density mechanisms, and point processes for each type of section in a BiophysCell. :type cell: :param cell: :class:’BiophysCell’ :type mech_file_path: :param mech_file_path: str (path)

miv_simulator.cells.reset_cable_by_node(cell, node, verbose=True)[source]#

Consults a dictionary specifying parameters of NEURON cable properties such as axial resistance (‘Ra’), membrane specific capacitance (‘cm’), and a spatial resolution parameter to specify the number of separate segments per section in a BiophysCell :type cell: Union[BiophysCell, SCneuron] :param cell: :class:’BiophysCell’ :param node_index: int :type verbose: bool :param verbose: bool

Return type:

None

miv_simulator.cells.connect2target(cell, sec, loc=1.0, param='_ref_v', delay=None, weight=None, threshold=None, target=None)[source]#

Converts analog voltage in the specified section to digital spike output. Initializes and returns an h.NetCon object with voltage as a reference parameter connected to the specified target. :type cell: Union[BiophysCell, SCneuron] :param cell: :class:’BiophysCell’ :type sec: Section :param sec: :class:’h.Section’ :type loc: float :param loc: float :type param: str :param param: str :type delay: Optional[float] :param delay: float :type weight: None :param weight: float :type threshold: Optional[int] :param threshold: float :type target: None :param target: object that can receive spikes :rtype: HocObject :return: :class:’h.NetCon’

miv_simulator.cells.init_spike_detector(cell, node=None, distance=100.0, threshold=-30, delay=0.05, onset_delay=0.0, loc=0.5)[source]#

Initializes the spike detector in the given cell according to the given arguments or a spike detector configuration of the mechanism dictionary of the cell, if one exists.

Parameters:
  • cell (Union[BiophysCell, SCneuron]) – :class:’BiophysCell’

  • node (None) – :class:’SectionNode’

  • distance (float) – float

  • threshold (int) – float

  • delay (float) – float

  • onset_delay (float) – float

  • loc (float) – float

Return type:

HocObject

miv_simulator.cells.update_biophysics_by_sec_type(cell, sec_type, reset_cable=False, verbose=False)[source]#

This method loops through all sections of the specified type, and consults the mechanism dictionary to update mechanism properties. If the reset_cable flag is True, cable parameters are re-initialized first, then the ion channel mechanisms are updated.

Parameters:
  • cell (BiophysCell) – :class:’BiophysCell’

  • sec_type (str) – str

  • reset_cable (bool) – bool

Return type:

None

miv_simulator.cells.update_mechanism_by_node(cell, node, mech_name, mech_content=None, verbose=True)[source]#

This method loops through all the parameters for a single mechanism specified in the mechanism dictionary and calls apply_mech_rules to interpret the rules and set the values for the given node. :type cell: BiophysCell :param cell: :class:’BiophysCell’ :type node: SectionNode :param node: :class:’SectionNode’ :type mech_name: str :param mech_name: str :type mech_content: Optional[Dict[str, Union[Dict[str, float], Dict[str, int]]]] :param mech_content: list of dict :type verbose: bool :param verbose: bool

Return type:

None

miv_simulator.cells.apply_mech_rules(cell, node, mech_name, param_name, rules, point_process_loc=None, verbose=True)[source]#

Provided a membrane density mechanism, a parameter, a node, and a dict of rules, interprets the provided rules, and applies resulting parameter values to mechanisms in the corresponding section.

Parameters:
  • cell (BiophysCell) – :class:’BiophysCell’

  • node (SectionNode) – :class:’SectionNode’

  • mech_name (str) – str

  • param_name (str) – str

  • rules (Dict[str, Union[int, float]]) – dict

  • point_process_loc (Optional[float]) – location in section if mechanism is a point process

  • verbose (bool) – bool

Return type:

None

miv_simulator.cells.set_mech_param(cell, node, mech_name, param_name, baseline, rules, point_process_loc=None)[source]#
Parameters:
  • node (SectionNode) – :class:’SectionNode’

  • mech_name (str) – str

  • param_name (str) – str

  • baseline (Union[int, float]) – float

  • rules (Dict[str, Union[int, float]]) – dict

Return type:

None

miv_simulator.cells.filter_nodes(cell, sections=None, layers=None, swc_types=None)[source]#

Returns a subset of the nodes of the given cell according to the given criteria.

Parameters:
  • cell (BiophysCell) –

  • sections (None) – sequence of int

  • layers (None) – list of enumerated type: layer

  • swc_types (Optional[List[str]]) – list of enumerated type: swc_type

Return type:

List[SectionNode]

Returns:

list of nodes

miv_simulator.cells.report_topology(env, cell, node=None)[source]#

Traverse a cell and report topology and number of synapses. :type cell: BiophysCell :param cell: :type env: AbstractEnv :param env: :type node: Optional[SectionNode] :param node:

Return type:

None

miv_simulator.cells.make_morph_graph(biophys_cell, node_filters={})[source]#

Creates a graph of 3d points that follows the morphological organization of the given neuron. :param neurotree_dict: :return: NetworkX.DiGraph

miv_simulator.cells.load_biophys_cell_dicts(env, pop_name, gid_set, data_file_path=None, load_connections=True, validate_tree=True)[source]#

Loads the data necessary to instantiate BiophysCell into the given dictionary.

Parameters:
  • env (AbstractEnv) – an instance of env.Env

  • pop_name (str) – population name

  • gid – gid

  • data_file_path (None) – str or None

  • load_connections (bool) – bool

  • validate_tree (bool) – bool

Return type:

Dict[int, Dict[str, Union[Dict[str, Union[ndarray, Dict[str, Union[int, Dict[int, ndarray], ndarray]]]], Dict[str, ndarray], Tuple[Dict[str, Dict[str, List[Tuple[int, Tuple[ndarray, Dict[str, List[ndarray]]]]]]], Dict[str, Dict[str, Dict[str, Dict[str, int]]]]], None]]]

Environment can be instantiated as: env = Env(config_file, template_paths, dataset_prefix) :param template_paths: str; colon-separated list of paths to directories containing hoc cell templates :param dataset_prefix: str; path to directory containing required neuroh5 data files

miv_simulator.cells.init_biophysics(cell, env=None, reset_cable=True, correct_cm=False, correct_g_pas=False, reset_mech_dict=False, verbose=True)[source]#

Consults a dictionary specifying parameters of NEURON cable properties, density mechanisms, and point processes for each type of section in a BiophysCell. Traverses through the tree of SHocNode nodes following order of inheritance. Sets membrane mechanism parameters, including gradients and inheritance of parameters from nodes along the path from root. Warning! Do not reset cable after inserting synapses! :type cell: Union[BiophysCell, SCneuron] :param cell: :class:’BiophysCell’ :type env: Optional[AbstractEnv] :param env: :class:’Env’ :type reset_cable: bool :param reset_cable: bool :type correct_cm: bool :param correct_cm: bool :type correct_g_pas: bool :param correct_g_pas: bool :type reset_mech_dict: bool :param reset_mech_dict: bool :type verbose: bool :param verbose: bool

Return type:

None

miv_simulator.cells.correct_node_for_spines_g_pas(node, env, gid, soma_g_pas, verbose=True)[source]#

If not explicitly modeling spine compartments for excitatory synapses, this method scales g_pas in this dendritic section proportional to the number of excitatory synapses contained in the section. :type node: :param node: :class:’SHocNode’ :type env: AbstractEnv :param env: :class:’Env’ :type gid: :param gid: int :type soma_g_pas: :param soma_g_pas: float :type verbose: :param verbose: bool

miv_simulator.cells.correct_node_for_spines_cm(node, env, gid, verbose=True)[source]#

If not explicitly modeling spine compartments for excitatory synapses, this method scales cm in this dendritic section proportional to the number of excitatory synapses contained in the section. :type node: :param node: :class:’SHocNode’ :type env: AbstractEnv :param env: :class:’Env’ :type gid: :param gid: int :type verbose: :param verbose: bool

miv_simulator.cells.correct_cell_for_spines_g_pas(cell, env, verbose=False)[source]#

If not explicitly modeling spine compartments for excitatory synapses, this method scales g_pas in all dendritic sections proportional to the number of excitatory synapses contained in each section. :type cell: :param cell: :class:’BiophysCell’ :type env: AbstractEnv :param env: :class:’Env’ :type verbose: :param verbose: bool

miv_simulator.cells.correct_cell_for_spines_cm(cell, env, verbose=False)[source]#
Parameters:
  • cell – :class:’BiophysCell’

  • env (AbstractEnv) – :class:’Env’

  • verbose – bool

miv_simulator.cells.make_biophys_cell(env, population_name, gid, mech_file_path=None, mech_dict=None, tree_dict=None, load_synapses=False, synapses_dict=None, load_edges=False, connection_graph=None, load_weights=False, weight_dict=None, set_edge_delays=True, bcast_template=True, validate_tree=True, **kwargs)[source]#
Parameters:
  • env (AbstractEnv) – :class:’Env’

  • population_name (str) – str

  • gid (int) – int

  • tree_dict (Optional[Dict[str, Union[ndarray, Dict[str, Union[int, Dict[int, ndarray], ndarray]]]]]) – dict

  • synapses_dict (Optional[Dict[str, ndarray]]) – dict

  • weight_dict (None) – list of dict

  • load_synapses (bool) – bool

  • load_edges (bool) – bool

  • load_weights (bool) – bool

  • set_edge_delays (bool) – bool

  • mech_file_path (None) – str (path)

Return type:

BiophysCell

Returns:

:class:’BiophysCell’

miv_simulator.cells.make_BRK_cell(env, pop_name, gid, mech_file_path=None, mech_dict=None, tree_dict=None, load_synapses=False, synapses_dict=None, load_edges=False, connection_graph=None, load_weights=False, weight_dict=None, set_edge_delays=True, bcast_template=True, **kwargs)[source]#
Parameters:
  • env (AbstractEnv) – :class:’Env’

  • pop_name – str

  • gid – int

  • mech_file_path – str (path)

  • mech_dict – dict

  • synapses_dict – dict

  • weight_dicts – list of dict

  • load_synapses – bool

  • load_edges – bool

  • load_weights – bool

  • set_edge_delays – bool

Returns:

:class:’BRKneuron’

miv_simulator.cells.make_PR_cell(env, pop_name, gid, mech_file_path=None, mech_dict=None, tree_dict=None, load_synapses=False, synapses_dict=None, load_edges=False, connection_graph=None, load_weights=False, weight_dict=None, set_edge_delays=True, bcast_template=True, **kwargs)[source]#
Parameters:
  • env (AbstractEnv) – :class:’Env’

  • pop_name – str

  • gid – int

  • mech_file_path – str (path)

  • mech_dict – dict

  • synapses_dict – dict

  • weight_dicts – list of dict

  • load_synapses – bool

  • load_edges – bool

  • load_weights – bool

  • set_edge_delays – bool

Returns:

:class:’PRneuron’

miv_simulator.cells.make_SC_cell(env, pop_name, gid, mech_file_path=None, mech_dict=None, tree_dict=None, load_synapses=False, synapses_dict=None, load_edges=False, connection_graph=None, load_weights=False, weight_dict=None, set_edge_delays=True, bcast_template=True, **kwargs)[source]#
Parameters:
  • env (AbstractEnv) – :class:’Env’

  • pop_name (str) – str

  • gid (int) – int

  • mech_file_path (None) – str (path)

  • mech_dict (Optional[Dict[str, Dict[str, Dict[str, Union[Dict[str, float], Dict[str, int]]]]]]) – dict

  • synapses_dict (None) – dict

  • weight_dicts – list of dict

  • load_synapses (bool) – bool

  • load_edges (bool) – bool

  • load_weights (bool) – bool

  • set_edge_delays (bool) – bool

Return type:

SCneuron

Returns:

:class:’SCneuron’

miv_simulator.cells.register_cell(env, pop_name, gid, cell)[source]#

Registers a cell in a network environment.

Parameters:
  • env (AbstractEnv) – an instance of the Env class

  • pop_name (str) – population name

  • gid (Union[uint32, int]) – gid

  • cell (Union[HocObject, BiophysCell, SCneuron]) – cell instance

Return type:

None

miv_simulator.cells.is_cell_registered(env, gid)[source]#

Returns True if cell gid has already been registered, False otherwise.

Return type:

int

miv_simulator.cells.record_cell(env, pop_name, gid, recording_profile=None)[source]#

Creates a recording object for the given cell, according to configuration in env.recording_profile.

Return type:

List[Dict[str, Union[str, int, HocObject, float]]]