Skip to content

Commit

Permalink
Fix: Fix NO_PROGRESS
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudon committed Mar 13, 2024
1 parent dbcd073 commit c412a48
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions emodel_generalisation/bluecellulab_evaluator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Compute the threshold and holding current using bluecellulab, adapted from BluePyThresh."""

import os
import logging
from copy import copy
from multiprocessing.context import TimeoutError # pylint: disable=redefined-builtin
Expand Down Expand Up @@ -325,4 +327,5 @@ def evaluate_currents(
"timeout": timeout,
"only_rin": only_rin,
},
progress_bar=os.environ.get("NO_PROGRESS", False),
)
3 changes: 2 additions & 1 deletion emodel_generalisation/model/bpopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def calculate_bpo_score(self, responses):

if feature_value is None:
return self.max_score

if self.efel_feature_name == "peak_voltage":
print(feature_value, self.exp_mean, self.exp_std)
return abs(feature_value - self.exp_mean) / self.exp_std

def _construct_efel_trace(self, responses):
Expand Down
19 changes: 11 additions & 8 deletions emodel_generalisation/model/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,9 +1211,9 @@ def _add_legacy_protocol(self, protocol_name, protocol):
if "extra_recordings" in protocol:
for protocol_def in protocol["extra_recordings"]:
recordings.append(protocol_def)
protocol_def[
"name"
] = f"{protocol_name}.{protocol_def['name']}.{protocol_def['var']}"
protocol_def["name"] = (
f"{protocol_name}.{protocol_def['name']}.{protocol_def['var']}"
)

stimulus = deepcopy(protocol["stimuli"]["step"])
if "holding" in protocol["stimuli"]:
Expand Down Expand Up @@ -1806,11 +1806,9 @@ def _single_feature_evaluation(
]:
evaluator.fitness_protocols["main_protocol"].protocols.pop(prot)

evaluator.fitness_protocols[
"main_protocol"
].execution_order = evaluator.fitness_protocols[
"main_protocol"
].compute_execution_order()
evaluator.fitness_protocols["main_protocol"].execution_order = (
evaluator.fitness_protocols["main_protocol"].compute_execution_order()
)

evaluator.cell_model.unfreeze(params)
responses = evaluator.run_protocols(evaluator.fitness_protocols.values(), params)
Expand Down Expand Up @@ -1922,6 +1920,7 @@ def feature_evaluation(
resume=resume,
parallel_factory=parallel_factory,
db_url=db_url,
progress_bar=os.environ.get("NO_PROGRESS", False),
)
.sort_values(by="index")
.set_index("index")
Expand Down Expand Up @@ -2033,6 +2032,7 @@ def evaluate_rin_no_soma(
resume=resume,
parallel_factory=parallel_factory,
db_url=db_url,
progress_bar=os.environ.get("NO_PROGRESS", False),
)


Expand Down Expand Up @@ -2075,6 +2075,7 @@ def evaluate_soma_rin(
resume=resume,
parallel_factory=parallel_factory,
db_url=db_url,
progress_bar=os.environ.get("NO_PROGRESS", False),
)


Expand Down Expand Up @@ -2117,6 +2118,7 @@ def evaluate_ais_rin(
resume=resume,
parallel_factory=parallel_factory,
db_url=db_url,
progress_bar=os.environ.get("NO_PROGRESS", False),
)


Expand Down Expand Up @@ -2157,6 +2159,7 @@ def evaluate_somadend_rin(
resume=resume,
parallel_factory=parallel_factory,
db_url=db_url,
progress_bar=os.environ.get("NO_PROGRESS", False),
)


Expand Down

0 comments on commit c412a48

Please sign in to comment.