bluepyemodel.model.neuron_model_configuration

Neuron Model Configuration

Classes

NeuronModelConfiguration([parameters, ...])

A neuron model configuration, which includes the model's parameters, distributions, mechanisms and a morphology.

class NeuronModelConfiguration(parameters=None, mechanisms=None, distributions=None, morphology=None, available_mechanisms=None, available_morphologies=None, morph_modifiers=None, extra_mech_ids=None)

Bases: object

A neuron model configuration, which includes the model’s parameters, distributions, mechanisms and a morphology.

Creates a model configuration, which includes the model parameters, distributions, mechanisms and a morphology.

WARNING: If you create a new NeuronModelConfiguration, do not specify the parameters, mechanisms, distributions and morphology here at instantiation. Instead, create an empty configuration and then use the class method: add_distribution, add_parameter, etc. Example:

.. code-block::

    config = NeuronModelConfiguration()
    config.add_parameter(parameter_name, locations, value, mechanism)
    config.morphology = MorphologyConfiguration(morph_name, format=".swc")
Parameters:
  • parameters (list of dict) – contains the description of the parameters of the model in the format returned by the method as_dict of the ParameterConfiguration class.

  • mechanisms (list of dict) – contains the description of the mechanisms of the model in the format returned by the method as_dict of the MechanismConfiguration class.

  • distributions (list of dict) – contains the description of the distributions of the model in the format returned by the method as_dict of the DistributionConfiguration class.

  • morphology (dict) – contains the description of the morphology of the model in the format returned by the method as_dict of the morphology class.

  • available_mechanisms (list of MechanismConfiguration) – list of the names ( and optionally versions) of the available mechanisms in the ./mechanisms directory for the local access point or on Nexus for the Nexus access point.

  • available_morphologies (list of str) – list of the names of the available morphology in the ./morphology directory for the local access point or on Nexus for the Nexus access point.

  • morph_modifiers (list of str or list of list) –

    If str, name of the morph modifier to use from bluepyemodel.evaluation.modifiers. If List of morphology modifiers. Each modifier is defined by a list that includes the following elements: 1. The path to the file that contains the modifier. 2. The name of the function that applies the modifier. 3. Optionally, a “hoc_string” that represents the hoc code for the modifier. For example, morph_modifiers could be defined as follows:

    morph_modifiers = [["path_to_module",
                        "name_of_function",
                        "hoc_string"], ...].
    

    If the “hoc_string” is not provided, the system will search within the specified module for a string that matches the function name appended with “_hoc”. If None, the default modifier will replace the axon with a tappered axon initial segment (replace_axon_with_taper). If you do not wish to use any modifier, set the present argument to []. If ["bluepyopt_replace_axon"], the replace_axon function from bluepyopt.ephys.morphologies.NrnFileMorphology will be used and no other morph modifiers will be used.

  • extra_mech_ids (list of 2-d tuples) –

    extra nexus ids and types to add to related nexus ids. Must have shape:

    extra_mech_ids = [
        ("id1", "type1"),
        ("id2", "type2"),
        ...
    ]
    

add_distribution(distribution_name, function, parameters=None, morphology_dependent_parameters=None, soma_ref_location=0.5)

Add a channel distribution to the configuration

Parameters:
  • distribution_name (str) – name of the distribution.

  • function (str) – python function of the distribution as a string. Will be executed using the python “eval” method.

  • parameters (list of str) – names of the parameters that parametrize the above function (no need to include the parameter “distance”). (Optional).

  • morphology_dependent_parameters (list of str)

  • soma_ref_location (float) – location along the soma used as origin from which to compute the distances. Expressed as a fraction (between 0.0 and 1.0). (Optional).

add_mechanism(mechanism_name, locations, stochastic=None, version=None, temperature=None, ljp_corrected=None, auto_parameter=False, id=None)

Add a mechanism to the configuration. This function should rarely be called directly as mechanisms are added automatically when using add_parameters. But it might be needed if a mechanism is not associated to any parameters.

Parameters:
  • mechanism_name (str) – name of the mechanism.

  • locations (str or list of str) – sections of the neuron on which this mechanism will be instantiated.

  • stochastic (bool) – Can the mechanisms behave stochastically (optional).

  • version (str) – version id of the mod file.

  • temperature (int) – temperature associated with the mechanism if any

  • ljp_corrected (bool) – whether the mechanims is ljp corrected

  • auto_parameter (bool) – if True, will automatically add the parameters of the mechanism

  • known. (if they are)

  • id (str) – Nexus ID of the mechanism.

add_parameter(parameter_name, locations, value, mechanism=None, distribution_name=None, stochastic=None, auto_mechanism=False)

Add a parameter to the configuration

Parameters:
  • parameter_name (str) – name of the parameter. If related to a mechanisms, has to match the name of the parameter in the mod file.

  • locations (str or list of str) – sections of the neuron on which these parameters will be instantiated.

  • value (float or list of two floats) – if float, set the value of the parameter. If list of two floats, sets the upper and lower bound between which the parameter will be optimised.

  • mechanism (name) – name of the mechanism to which the parameter relates (optional).

  • distribution_name (str) – name of the distribution followed by the parameter. Distributions have to be added before adding the parameters that uses them.

  • stochastic (bool) – Can the mechanisms to which the parameter relates behave stochastically (optional).

  • auto_mechanism (bool) – if True, will automatically add the mechanism associated to the parameter. Attention! auto_mechanism cannot handle mechanism version, temperature and ljp correction.

as_dict()

Returns the configuration as dict of parameters, mechanisms and a list of mechanism names

property distribution_names

Returns the names of all the distributions registered

init_from_dict(configuration_dict, morphology, auto_mechanism=False)

Instantiate the object from its dictionary form

init_from_legacy_dict(parameters, morphology)

Instantiate the object from its legacy dictionary form

is_mechanism_available(mechanism_name, version=None, temperature=None, ljp_corrected=None)

Is the mechanism part of the mechanisms available

property mechanism_names

Returns the names of all the mechanisms used in the model

remove_mechanism(mechanism_name, locations=None)

Remove a mechanism from the configuration and all the associated parameters

remove_parameter(parameter_name, locations=None)

Remove a parameter from the configuration. If locations is None or [], the whole parameter will be removed. WARNING: that does not remove automatically the mechanism which might be still use by other parameter

select_morphology(morphology_name=None, morphology_path=None, morphology_format=None, seclist_names=None, secarray_names=None, section_index=None)

Select the morphology on which the neuron model will be based. Its name has to be part of the availabel morphologies.

Parameters:
  • morphology_name (str) – name of the morphology. Optional if morphology_path is informed.

  • morphology_path (str) – path to the morphology file. If morphology_name is informed, has to match the stem of the morphology_path. Optional if morphology_name is informed.

  • morphology_format (str) – format of the morphology (asc or swc). If morphology_path is informed, has to match its suffix. Optional if morphology_format is informed.

  • seclist_names (list) – Names of the lists of sections ([‘somatic’, …]) (optional).

  • secarray_names (list) – names of the sections ([‘soma’, …]) (optional).

  • section_index (int) – index to a specific section, used for non-somatic recordings (optional).

set_parameter_distribution(parameter_name, location, distribution_name)

Set the distribution of a parameter

set_parameter_value(parameter_name, location, value)

Set the value of a parameter

property used_distribution_names

Returns the names of all the distributions used in the model