emodel_generalisation.model.access_point

Access point module.

Functions

get_mechanism_currents(mech_file)

Parse the mech mod file to get the mechanism ion and non-specific currents if any.

get_mechanism_suffix(mech_file)

Parse the mech mod file to get the mechanism suffix.

Classes

AccessPoint([emodel_dir, final_path, ...])

Custom modifications of BPEM LocalAcessPoint class.

DistributionConfiguration(name[, function, ...])

Contains all the information related to the definition and configuration of a parameter distribution

MechanismConfiguration(name, location[, ...])

Contains the information related to the definition and configuration of a mechanism

MorphologyConfiguration([name, path, ...])

Morphology configuration

NeuronModelConfiguration([parameters, ...])

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

ParameterConfiguration(name, location, value)

Contains all the information related to the definition and configuration of a parameter

class emodel_generalisation.model.access_point.AccessPoint(emodel_dir=None, final_path=None, recipes_path=None, legacy_dir_structure=False, with_seeds=False, nexus_config=None, mech_path='mechanisms')

Bases: object

Custom modifications of BPEM LocalAcessPoint class.

get_available_mechanisms()

Get the list of names of the available mechanisms

get_calculator_configuration(emodel, record_ions_and_currents=False)

Get the configuration of the fitness calculator (efeatures and protocols)

get_configuration(emodel)

Get the configuration of the model, including parameters, mechanisms and distributions

get_ion_currents_concentrations()

Get all ion currents and ion concentrations.

Returns:

(list of str): current (ion and non-specific) names for all available mechanisms (list of str): ionic concentration names for all available mechanisms

Return type:

tuple containing

get_json(emodel, recipe_entry)

Helper function to load a json using path in recipe.

get_mechanisms_directory()

Return the path to the directory containing the mechanisms for the current emodel

get_morphologies(emodel)

Get the name and path to the morphologies from the recipes.

Returns:

[{‘name’: morph_name, ‘path’: ‘morph_path’}]. Might contain the additional entries “seclist_names” and “secarray_names” if they are present in the recipes.

Return type:

morphology_definition (list)

get_recipes(emodel)

Load the recipes from a json file for an emodel.

property recipes

Cache mechanism to better handle large recipes in non-legacy setting.

class emodel_generalisation.model.access_point.DistributionConfiguration(name, function=None, parameters=None, morphology_dependent_parameters=None, soma_ref_location=0.5, comment=None)

Bases: object

Contains all the information related to the definition and configuration of a parameter distribution

class emodel_generalisation.model.access_point.MechanismConfiguration(name, location, stochastic=None, version=None, parameters=None, ion_currents=None, nonspecific_currents=None, ionic_concentrations=None)

Bases: object

Contains the information related to the definition and configuration of a mechanism

get_current()

Return the ion current names.

class emodel_generalisation.model.access_point.MorphologyConfiguration(name=None, path=None, format=None, seclist_names=None, secarray_names=None, section_index=None)

Bases: object

Morphology configuration

class emodel_generalisation.model.access_point.NeuronModelConfiguration(parameters=None, mechanisms=None, distributions=None, morphology=None, available_mechanisms=None, morph_modifiers=None)

Bases: object

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

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, auto_parameter=False)
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.

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

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

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.

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)

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)

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 available 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

class emodel_generalisation.model.access_point.ParameterConfiguration(name, location, value, distribution='uniform', mechanism=None)

Bases: object

Contains all the information related to the definition and configuration of a parameter

emodel_generalisation.model.access_point.get_mechanism_currents(mech_file)

Parse the mech mod file to get the mechanism ion and non-specific currents if any.

emodel_generalisation.model.access_point.get_mechanism_suffix(mech_file)

Parse the mech mod file to get the mechanism suffix.