Skip to content

Commit

Permalink
add current_precision to the emodel_settings
Browse files Browse the repository at this point in the history
Change-Id: I37bc2ba549d707b8a719e3c90c6eccf73bed761b
  • Loading branch information
Jaquier Aurélien Tristan committed Jul 9, 2024
1 parent 77237a8 commit 7c4ece3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bluepyemodel/emodel_pipeline/emodel_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def __init__(
neuron_dt=None,
cvode_minstep=0.0,
use_params_for_seed=True,
current_precision=1e-2,
max_threshold_voltage=-30,
strict_holding_bounds=True,
max_depth_holding_search=7,
Expand Down Expand Up @@ -268,6 +269,8 @@ def __init__(
cvode_minstep (float): minimum time step allowed when using cvode.
use_params_for_seed (bool): use a hashed version of the parameter
dictionary as a seed for the simulator
current_precision (float): size of search interval in current to stop the search
in SearchThresholdProtocol
max_threshold_voltage (float): upper bound for the voltage during the
search for the threshold or rheobase current (see SearchThresholdProtocol).
strict_holding_bounds (bool): if True, the minimum and maximum values for the current
Expand Down Expand Up @@ -305,6 +308,7 @@ def __init__(
self.minimum_protocol_delay = minimum_protocol_delay

# Settings related to the evaluator
self.current_precision = current_precision
self.max_threshold_voltage = max_threshold_voltage
self.threshold_efeature_std = threshold_efeature_std
self.max_depth_holding_search = max_depth_holding_search
Expand Down
10 changes: 10 additions & 0 deletions bluepyemodel/evaluation/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ def define_holding_protocol(

def define_threshold_protocol(
efeatures,
current_precision=1e-2,
max_threshold_voltage=-30,
step_delay=500.0,
step_duration=2000.0,
Expand Down Expand Up @@ -497,6 +498,7 @@ def define_threshold_protocol(
name=thres_prot_name,
location=location,
target_threshold=target_current[0],
current_precision=current_precision,
max_threshold_voltage=max_threshold_voltage,
stimulus_delay=step_delay,
stimulus_duration=step_duration,
Expand Down Expand Up @@ -626,6 +628,7 @@ def define_preprotocols(
fitness_calculator_configuration,
strict_holding_bounds=False,
max_depth_holding_search=7,
current_precision=1e-2,
max_threshold_voltage=-30,
spikecount_timeout=50,
max_depth_threshold_search=10,
Expand Down Expand Up @@ -685,6 +688,7 @@ def define_preprotocols(
)
threshold_prot = define_threshold_protocol(
efeatures,
current_precision,
max_threshold_voltage,
fitness_calculator_configuration.search_threshold_step_delay,
fitness_calculator_configuration.search_threshold_step_duration,
Expand Down Expand Up @@ -717,6 +721,7 @@ def define_threshold_based_optimisation_protocol(
stochasticity=True,
ais_recording=False,
efel_settings=None,
current_precision=1e-2,
max_threshold_voltage=-30,
strict_holding_bounds=True,
use_fixed_dt_recordings=False,
Expand All @@ -740,6 +745,7 @@ def define_threshold_based_optimisation_protocol(
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
Expand Down Expand Up @@ -789,6 +795,7 @@ def define_threshold_based_optimisation_protocol(
fitness_calculator_configuration=fitness_calculator_configuration,
strict_holding_bounds=strict_holding_bounds,
max_depth_holding_search=max_depth_holding_search,
current_precision=current_precision,
max_threshold_voltage=max_threshold_voltage,
spikecount_timeout=spikecount_timeout,
max_depth_threshold_search=max_depth_threshold_search,
Expand Down Expand Up @@ -820,6 +827,7 @@ def define_threshold_based_optimisation_protocol(
fitness_calculator_configuration=fitness_calculator_configuration,
strict_holding_bounds=strict_holding_bounds,
max_depth_holding_search=max_depth_holding_search,
current_precision=current_precision,
max_threshold_voltage=max_threshold_voltage,
spikecount_timeout=spikecount_timeout,
max_depth_threshold_search=max_depth_threshold_search,
Expand Down Expand Up @@ -847,6 +855,7 @@ def define_threshold_based_optimisation_protocol(
fitness_calculator_configuration=fitness_calculator_configuration,
strict_holding_bounds=strict_holding_bounds,
max_depth_holding_search=max_depth_holding_search,
current_precision=current_precision,
max_threshold_voltage=max_threshold_voltage,
spikecount_timeout=spikecount_timeout,
max_depth_threshold_search=max_depth_threshold_search,
Expand Down Expand Up @@ -976,6 +985,7 @@ def create_evaluator(
include_validation_protocols,
stochasticity=stochasticity,
efel_settings=pipeline_settings.efel_settings,
current_precision=pipeline_settings.current_precision,
max_threshold_voltage=pipeline_settings.max_threshold_voltage,
strict_holding_bounds=pipeline_settings.strict_holding_bounds,
use_fixed_dt_recordings=use_fixed_dt_recordings,
Expand Down
2 changes: 1 addition & 1 deletion bluepyemodel/evaluation/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def __init__(
name,
location,
target_threshold=None,
current_precision=2e-3,
current_precision=1e-2,
stimulus_delay=500.0,
stimulus_duration=2000.0,
stimulus_totduration=3000.0,
Expand Down
3 changes: 3 additions & 0 deletions examples/memodel/memodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ def update_memodel(
access_token=access_token,
)

# update settings for better threshold precision
access_point.pipeline_settings.current_precision = 2e-3

# get cell evaluator with 'new' morphology
cell_evaluator = get_cell_evaluator(access_point, morph_name, morph_format, morph_id)

Expand Down

0 comments on commit 7c4ece3

Please sign in to comment.