bluepyemodel.evaluation.evaluator

Evaluator module.

Functions

add_recordings_to_evaluator(cell_evaluator, vars)

Add a recording for each new variable for each protocol in cell evaluator.

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

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

define_RMP_protocol(efeatures[, ...])

Define the resting membrane potential protocol

define_Rin_protocol(efeatures[, amp, ...])

Define the input resistance protocol

define_efeature(feature_config[, protocol, ...])

Define an efeature from a configuration dictionary

define_efeatures(...)

Instantiate several Protocols

define_fitness_calculator(features)

Creates the objectives calculator.

define_holding_protocol(efeatures[, ...])

Define the search holding current protocol

define_location(definition)

define_optimisation_protocol(...[, ...])

Create a meta protocol in charge of running the other protocols.

define_preprotocols(efeatures, location, ...)

Returns a dict containing the preprotocols

define_protocol(protocol_configuration[, ...])

Create a protocol.

define_protocols(...)

Instantiate several efeatures

define_recording(recording_conf[, ...])

Create a recording from a configuration dictionary

define_threshold_based_optimisation_protocol(...)

Create a meta protocol in charge of running the other protocols.

define_threshold_protocol(efeatures[, ...])

Define the search threshold current protocol

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

Get NrnSimulator

add_recordings_to_evaluator(cell_evaluator, vars, use_fixed_dt_recordings=False)

Add a recording for each new variable for each protocol in cell evaluator.

create_evaluator(cell_model, fitness_calculator_configuration, pipeline_settings, stochasticity=None, timeout=None, include_validation_protocols=False, mechanisms_directory=None, 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.

  • pipeline_settings (EModelPipelineSettings) – 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.

  • mechanisms_directory (str or Path) – path to the directory containing the mechanisms.

  • use_fixed_dt_recordings (bool) – used for legacy currentscape to record at a fixed dt of 0.1 ms.

Returns:

CellEvaluator

define_RMP_protocol(efeatures, stimulus_duration=500.0, location=<bluepyopt.ephys.locations.NrnSeclistCompLocation object>, output_key='bpo_rmp', rmp_prot_name='RMPProtocol', recording_name=None)

Define the resting membrane potential protocol

define_Rin_protocol(efeatures, amp=-0.02, stimulus_delay=500.0, stimulus_duration=500.0, totduration=1000.0, location=<bluepyopt.ephys.locations.NrnSeclistCompLocation object>, output_key='bpo_rin', hold_key='bpo_holding_current', hold_prot_name='SearchHoldingCurrent', rin_prot_name='RinProtocol', recording_name=None)

Define the input resistance protocol

define_efeature(feature_config, protocol=None, global_efel_settings=None)

Define an efeature from a configuration dictionary

define_efeatures(fitness_calculator_configuration, include_validation_protocols, protocols, efel_settings)

Instantiate several Protocols

define_fitness_calculator(features)

Creates the objectives calculator.

Parameters:

features (list) – list of EFeature.

Returns:

ObjectivesCalculator

define_holding_protocol(efeatures, strict_bounds=False, max_depth=7, stimulus_duration=500.0, location=<bluepyopt.ephys.locations.NrnSeclistCompLocation object>, output_key='bpo_holding_current', hold_prot_name='SearchHoldingCurrent', recording_name=None)

Define the search holding current protocol

define_optimisation_protocol(fitness_calculator_configuration, include_validation_protocols=False, stochasticity=True, efel_settings=None, use_fixed_dt_recordings=False, dt=None)

Create a meta protocol in charge of running the other protocols.

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

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

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

  • efel_settings (dict) – eFEl settings.

  • use_fixed_dt_recordings (bool) – used for legacy currentscape to record at a fixed dt of 0.1 ms.

  • dt (float) – NEURON dt for fixed time step simulation. If None, variable dt will be used.

define_preprotocols(efeatures, location, fitness_calculator_configuration, strict_holding_bounds=False, max_depth_holding_search=7, current_precision=0.01, max_threshold_voltage=-30, spikecount_timeout=50, max_depth_threshold_search=10, efel_thresh_for_thres_search=None, rmp_key='bpo_rmp', hold_key='bpo_holding_current', rin_key='bpo_rin', thres_key='bpo_threshold_current', rmp_prot_name='RMPProtocol', hold_prot_name='SearchHoldingCurrent', rin_prot_name='RinProtocol', thres_prot_name='SearchThresholdCurrent', recording_name=None, no_holding=False)

Returns a dict containing the preprotocols

define_protocol(protocol_configuration, stochasticity=False, use_fixed_dt_recordings=False, dt=None)

Create a protocol.

Parameters:
  • protocol_configuration (ProtocolConfiguration) – configuration of the protocol

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

  • use_fixed_dt_recordings (bool) – used for legacy currentscape to record at a fixed dt of 0.1 ms. However, Simulations will be run based on dt.

  • dt (float) – NEURON dt for fixed time step simulation. If None, variable dt will be used.

Returns:

Protocol

define_protocols(fitness_calculator_configuration, include_validation_protocols, stochasticity, use_fixed_dt_recordings, dt)

Instantiate several efeatures

define_recording(recording_conf, use_fixed_dt_recordings=False)

Create a recording from a configuration dictionary

Parameters:
  • recording_conf (dict) – configuration of the recording. Must contain the type of the recording as well as information about the location of the recording (see function define_location).

  • use_fixed_dt_recordings (bool) – used for legacy currentscape to record at a fixed dt of 0.1 ms.

Returns:

FixedDtRecordingCustom or LooseDtRecordingCustom or FixedDtRecordingStimulus or LooseDtRecordingStimulus

define_threshold_based_optimisation_protocol(fitness_calculator_configuration, include_validation_protocols=False, stochasticity=True, ais_recording=False, efel_settings=None, current_precision=0.01, max_threshold_voltage=-30, strict_holding_bounds=True, use_fixed_dt_recordings=False, max_depth_holding_search=7, max_depth_threshold_search=10, spikecount_timeout=50, efel_threshold_for_threshold_search=None, dt=None)

Create a meta protocol in charge of running the other protocols.

The amplitude of the “threshold_protocols” depend on the computation of the current threshold.

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

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

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

  • ais_recording (bool) – if True all the soma recording will be at the first axonal section.

  • efel_settings (dict) – eFEl settings.

  • current_precision (float) – size of search interval in current to stop the search

  • max_threshold_voltage (float) – maximum voltage at which the SearchThresholdProtocol will search for the rheobase.

  • strict_holding_bounds (bool) – to adaptively enlarge bounds if holding current is outside when set to False

  • use_fixed_dt_recordings (bool) – used for legacy currentscape to record at a fixed dt of 0.1 ms.

  • max_depth_holding_search (int) – maximum depth for the binary search for the holding current

  • max_depth_threshold_search (int) – maximum depth for the binary search for the threshold current

  • spikecount_timeout (float) – timeout for spikecount computation, if timeout is reached, we set spikecount=2 as if many spikes were present, to speed up bisection search.

  • efel_threshold_for_threshold_search – spike threshold for the efel settings to use in SearchThresholdCurrent protocol. Set to None to keep the default value (currently -20 mV in efel)

  • dt (float) – NEURON dt for fixed time step simulation. If None, variable dt will be used.

define_threshold_protocol(efeatures, current_precision=0.01, max_threshold_voltage=-30, step_delay=500.0, step_duration=2000.0, totduration=3000.0, spikecount_timeout=50, max_depth=10, location=<bluepyopt.ephys.locations.NrnSeclistCompLocation object>, no_spikes=True, efel_threshold=None, output_key='bpo_threshold_current', hold_key='bpo_holding_current', rmp_key='bpo_rmp', rin_key='bpo_rin', hold_prot_name='SearchHoldingCurrent', rmp_prot_name='RMPProtocol', rin_prot_name='RinProtocol', thres_prot_name='SearchThresholdCurrent')

Define the search threshold current protocol

get_simulator(stochasticity, cell_model, dt=None, mechanisms_directory=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) – NEURON dt for fixed time step simulation. If None, variable dt will be used.

  • mechanisms_directory (str or Path) – path to the directory containing the mechanisms

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