emodel_generalisation.model.evaluation

Evaluation module (adapted from bluepyemodel).

Functions

create_cell_model(name, model_configuration)

Create a cell model based on a morphology, mechanisms and parameters

create_evaluator(cell_model, ...[, ...])

Creates an evaluator for a cell model/protocols/e-feature combo.

define_fitness_calculator(features)

Creates the objectives calculator.

evaluate_ais_rin(morphs_combos_df, access_point)

Compute the input resistance of the ais (axon).

evaluate_rho(morphs_combos_df, access_point)

Compute the input resistances and rho factor.

evaluate_rho_axon(morphs_combos_df, access_point)

Compute the input resistances and rho factor.

evaluate_rin_no_soma(morphs_combos_df, ...)

Compute the input resistance of cell without soma.

evaluate_soma_rin(morphs_combos_df, access_point)

Compute the input resistance of the ais (axon).

evaluate_somadend_rin(morphs_combos_df, ...)

Compute the input resistance of the soma and dentrites.

feature_evaluation(morphs_combos_df, ...[, ...])

Compute the features and the scores on the combos dataframe.

get_emodel_data(access_point, combo, ...)

Gather needed emodel data and build cell model for evaluation.

get_evaluator_from_access_point(emodel, ...)

Create an evaluator for the emodel.

get_simulator(stochasticity, cell_model[, ...])

Get NrnSimulator

rin_evaluation(combo, access_point[, ...])

Evaluating rin protocol as holding -0.02.

single_feature_evaluation(combo[, ...])

Wrapper on top of feature evaluation to have a global timeout

Classes

EFeatureConfiguration(efel_feature_name, ...)

Container for the definition of an EFeature

FitnessCalculatorConfiguration([efeatures, ...])

The goal of this class is to store the results of an efeature extraction (efeatures and protocols) or to contain the results of a previous extraction retrieved from an access point.

ProtocolConfiguration(name, stimuli[, ...])

Container for the definition of a protocol

class emodel_generalisation.model.evaluation.EFeatureConfiguration(efel_feature_name, protocol_name, recording_name, mean, efeature_name=None, efel_settings=None, threshold_efeature_std=None, original_std=None, std=None, sample_size=None, default_std_value=0.001, weight=1.0)

Bases: object

Container for the definition of an EFeature

as_dict()

Dictionary form

property std

Limit the standard deviation with a lower bound equal to a percentage of the mean.

class emodel_generalisation.model.evaluation.FitnessCalculatorConfiguration(efeatures=None, protocols=None, name_rmp_protocol=None, name_rin_protocol=None, threshold_efeature_std=None, default_std_value=0.001, validation_protocols=None, stochasticity=False, ion_variables=None)

Bases: object

The goal of this class is to store the results of an efeature extraction (efeatures and protocols) or to contain the results of a previous extraction retrieved from an access point. This object is used for the creation of the fitness calculator.

as_dict()

Used for the storage of the configuration

check_stochasticity(protocol_name)

Check if stochasticity should be active for a given protocol

init_from_bluepyefe(efeatures, protocols, currents, threshold_efeature_std)

Fill the configuration using the output of BluePyEfe

remove_featureless_protocols()

Remove the protocols that o not have any matching efeatures

class emodel_generalisation.model.evaluation.ProtocolConfiguration(name, stimuli, recordings_from_config=None, recordings=None, validation=False, ion_variables=None, protocol_type='ThresholdBasedProtocol', stochasticity=False)

Bases: object

Container for the definition of a protocol

as_dict()

Dictionary form

emodel_generalisation.model.evaluation.create_cell_model(name, model_configuration, morph_modifiers=None, morph_modifiers_hoc=None, seclist_names=None, secarray_names=None, nseg_frequency=40)

Create a cell model based on a morphology, mechanisms and parameters

Parameters:
  • name (str) – name of the model

  • morphology (dict) – morphology from emodel api .get_morphologies()

  • model_configuration (NeuronModelConfiguration) – Configuration of the neuron model, containing the parameters their locations and the associated mechanisms.

  • morph_modifiers (list) – list of functions to modify morphologies

  • morph_modifiers_hoc (list) – list of hoc functions to modify morphologies

Returns:

CellModel

emodel_generalisation.model.evaluation.create_evaluator(cell_model, fitness_calculator_configuration, settings, stochasticity=None, timeout=None, include_validation_protocols=False, use_fixed_dt_recordings=False)

Creates an evaluator for a cell model/protocols/e-feature combo.

Parameters:
  • cell_model (CellModel) – cell model

  • fitness_calculator_configuration (FitnessCalculatorConfiguration) – configuration of the fitness calculator.

  • settings (dict) – settings for the pipeline.

  • stochasticity (bool) – should the stochastic channels be stochastic or deterministic

  • timeout (float) – maximum time in second during which a protocol is allowed to run

  • include_validation_protocols (bool) – should the validation protocols and validation efeatures be added to the evaluator.

  • use_fixed_dt_recordings (bool) – whether to record at a fixed dt of 0.1 ms.

Returns:

CellEvaluator

emodel_generalisation.model.evaluation.define_fitness_calculator(features)

Creates the objectives calculator.

Parameters:

features (list) – list of EFeature.

Returns:

ObjectivesCalculator

emodel_generalisation.model.evaluation.evaluate_ais_rin(morphs_combos_df, access_point, morphology_path='path', resume=False, db_url=None, parallel_factory=None)

Compute the input resistance of the ais (axon).

Parameters:
  • morphs_combos_df (DataFrame) – each row reprensents a computation

  • access_point (DataAccessPoint) – object which contains API to access emodel data

  • morphology_path (str) – entry from dataframe with morphology paths

  • resume (bool) – if True, it will use only compute the empty rows of the database, if False, it will ecrase or generate the database

  • db_url (str) – filename/url for the sql database

  • parallel_factory (ParallelFactory) – parallel factory instance

Returns:

original combos with computed rin of ais

Return type:

pandas.DataFrame

emodel_generalisation.model.evaluation.evaluate_rho(morphs_combos_df, access_point, morphology_path='path', resume=False, db_url=None, parallel_factory=None)

Compute the input resistances and rho factor.

Parameters:
  • morphs_combos_df (DataFrame) – each row reprensents a computation

  • access_point (DataAccessPoint) – object which contains API to access emodel data

  • morphology_path (str) – entry from dataframe with morphology paths

  • rersume (bool) – if True, it will use only compute the empty rows of the database, if False, it will ecrase or generate the database

  • db_url (str) – filename/url for the sql database

  • parallel_factory (ParallelFactory) – parallel factory instance

Returns:

original combos with computed rho axon

Return type:

pandas.DataFrame

emodel_generalisation.model.evaluation.evaluate_rho_axon(morphs_combos_df, access_point, morphology_path='path', resume=False, db_url=None, parallel_factory=None)

Compute the input resistances and rho factor.

Parameters:
  • morphs_combos_df (DataFrame) – each row reprensents a computation

  • access_point (DataAccessPoint) – object which contains API to access emodel data

  • morphology_path (str) – entry from dataframe with morphology paths

  • rersume (bool) – if True, it will use only compute the empty rows of the database, if False, it will ecrase or generate the database

  • db_url (str) – filename/url for the sql database

  • parallel_factory (ParallelFactory) – parallel factory instance

Returns:

original combos with computed rho axon

Return type:

pandas.DataFrame

emodel_generalisation.model.evaluation.evaluate_rin_no_soma(morphs_combos_df, access_point, morphology_path='path', resume=False, db_url=None, parallel_factory=None)

Compute the input resistance of cell without soma.

Parameters:
  • morphs_combos_df (DataFrame) – each row reprensents a computation

  • access_point (DataAccessPoint) – object which contains API to access emodel data

  • morphology_path (str) – entry from dataframe with morphology paths

  • resume (bool) – if True, it will use only compute the empty rows of the database, if False, it will ecrase or generate the database

  • db_url (str) – filename/url for the sql database

  • parallel_factory (ParallelFactory) – parallel factory instance

Returns:

original combos with computed rin of ais

Return type:

pandas.DataFrame

emodel_generalisation.model.evaluation.evaluate_soma_rin(morphs_combos_df, access_point, morphology_path='path', resume=False, db_url=None, parallel_factory=None)

Compute the input resistance of the ais (axon).

Parameters:
  • morphs_combos_df (DataFrame) – each row reprensents a computation

  • access_point (DataAccessPoint) – object which contains API to access emodel data

  • morphology_path (str) – entry from dataframe with morphology paths

  • resume (bool) – if True, it will use only compute the empty rows of the database, if False, it will ecrase or generate the database

  • db_url (str) – filename/url for the sql database

  • parallel_factory (ParallelFactory) – parallel factory instance

Returns:

original combos with computed rin of ais

Return type:

pandas.DataFrame

emodel_generalisation.model.evaluation.evaluate_somadend_rin(morphs_combos_df, access_point, morphology_path='path', resume=False, db_url=None, parallel_factory=None)

Compute the input resistance of the soma and dentrites.

Parameters:
  • morphs_combos_df (DataFrame) – each row reprensents a computation

  • access_point (DataAccessPoint) – object which contains API to access emodel data

  • morphology_path (str) – entry from dataframe with morphology paths

  • resume (bool) – if True, it will use only compute the empty rows of the database, if False, it will ecrase or generate the database

  • db_url (str) – filename/url for the sql database

  • parallel_factory (ParallelFactory) – parallel factory instance

Returns:

original combos with computed rin or soma+dendrite

Return type:

pandas.DataFrame

emodel_generalisation.model.evaluation.feature_evaluation(morphs_combos_df, access_point, morphology_path='path', resume=False, db_url=None, parallel_factory=None, trace_data_path=None, stochasticity=False, timeout=5000, threshold_only=False, record_ions_and_currents=False)

Compute the features and the scores on the combos dataframe.

Parameters:
  • morphs_combos_df (DataFrame) – each row reprensents a computation

  • access_point (DataAccessPoint) – object which contains API to access emodel data

  • morphology_path (str) – entry from dataframe with morphology paths

  • continu (bool) – if True, it will use only compute the empty rows of the database, if False, it will ecrase or generate the database

  • db_url (str) – filename for the combos sqlite database

  • parallel_factory (ParallelFactory) – parallel factory instance

Returns:

original combos with computed scores and features

Return type:

pandas.DataFrame

emodel_generalisation.model.evaluation.get_emodel_data(access_point, combo, morphology_path, morph_modifiers)

Gather needed emodel data and build cell model for evaluation.

emodel_generalisation.model.evaluation.get_evaluator_from_access_point(emodel, access_point, stochasticity=None, include_validation_protocols=False, timeout=None, use_fixed_dt_recordings=False, record_ions_and_currents=False)

Create an evaluator for the emodel.

Parameters:
  • access_point (DataAccessPoint) – API used to access the database

  • stochasticity (bool) – should channels behave stochastically if they can.

  • include_validation_protocols (bool) – should the validation protocols and validation efeatures be added to the evaluator.

  • timeout (float) – duration (in second) after which the evaluation of a protocol will be interrupted.

  • use_fixed_dt_recordings (bool) – whether to record at a fixed dt of 0.1 ms.

  • record_ions_and_currents (bool) – whether to add the ion and non-specific currents and the ionic concentration to the recordings.

Returns:

bluepyopt.ephys.evaluators.CellEvaluator

emodel_generalisation.model.evaluation.get_simulator(stochasticity, cell_model, dt=None, cvode_minstep=0.0)

Get NrnSimulator

Parameters:
  • stochasticity (bool) – allow the use of simulator for stochastic channels

  • cell_model (CellModel) – used to check if any stochastic channels are present

  • dt (float) – if not None, cvode will be disabled and fixed timesteps used.

  • cvode_minstep (float) – minimum time step allowed for a CVODE step.

emodel_generalisation.model.evaluation.rin_evaluation(combo, access_point, morph_modifiers=None, key='rin', morphology_path='path', stochasticity=False, ais_recording=False)

Evaluating rin protocol as holding -0.02.

emodel_generalisation.model.evaluation.single_feature_evaluation(combo, access_point=None, morphology_path='path', stochasticity=False, trace_data_path=None, timeout=5000, threshold_only=False, record_ions_and_currents=False)

Wrapper on top of feature evaluation to have a global timeout