Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 635890f

Browse files
author
Tanguy Damart
committed
Minor fix for compatibility
1 parent d6e1f13 commit 635890f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

bluepyopt/ephys/objectivescalculators.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,26 @@ def __init__(
3636

3737
self.objectives = objectives
3838

39-
def calculate_scores(self, responses, cell_model, param_dict):
39+
def calculate_scores(self, responses, cell_model=None, param_dict=None):
4040
"""Calculator the score for every objective"""
4141

4242
scores = {}
4343

44-
cell_model.freeze(param_dict)
44+
if param_dict and cell_model:
45+
cell_model.freeze(param_dict)
4546

4647
for objective in self.objectives:
4748

4849
if issubclass(type(objective), objectives.EFeatureObjective):
4950
scores[objective.name] = objective.calculate_score(responses)
5051
elif issubclass(type(objective), objectives.RuleObjective):
51-
scores[objective.name] = objective.calculate_score(cell_model)
52+
if param_dict and cell_model:
53+
scores[objective.name] = objective.calculate_score(cell_model)
5254
else:
5355
raise Exception('Unknown objective class: {}'.format(type(objective)))
54-
55-
cell_model.unfreeze(param_dict.keys())
56+
57+
if param_dict and cell_model:
58+
cell_model.unfreeze(param_dict.keys())
5659

5760
return scores
5861

bluepyopt/ephys/protocols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def subprotocols(self):
163163

164164
def _run_func(self, cell_model, param_values, sim=None):
165165
"""Run protocols"""
166-
166+
167167
try:
168168
cell_model.freeze(param_values)
169169
cell_model.instantiate(sim=sim)

0 commit comments

Comments
 (0)