Skip to content

Commit

Permalink
fix model hash typing issue (#1548)
Browse files Browse the repository at this point in the history
  • Loading branch information
dilpath authored Jan 22, 2025
1 parent c0339bb commit 109bec9
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions pypesto/select/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import petab.v1 as petab
import petab_select.ui
from petab.v1.C import ESTIMATE, NOMINAL_VALUE
from petab_select import Model, parameter_string_to_value
from petab_select import Model, ModelHash, parameter_string_to_value
from petab_select.constants import PETAB_PROBLEM

from ..history import Hdf5History
Expand Down Expand Up @@ -210,8 +210,24 @@ def __init__(
if self.save_history and self.tmpdir is None:
self.tmpdir = Path.cwd() / "sacess_tmpdir"

def __call__(self, problem: Problem, model_hash: str, **minimize_options):
"""Create then run a problem-specific sacess optimizer."""
def __call__(
self, problem: Problem, model_hash: ModelHash, **minimize_options
):
"""Create then run a problem-specific sacess optimizer.
Parameters
----------
problem:
The pyPESTO problem for the model.
model_hash:
The model hash.
minimize_options:
Passed to :meth:`SacessOptimizer.minimize`.
Returns
-------
The output from :meth:`SacessOptimizer.minimize`.
"""
# create optimizer
ess_init_args = get_default_ess_options(
num_workers=self.num_workers,
Expand All @@ -221,7 +237,7 @@ def __call__(self, problem: Problem, model_hash: str, **minimize_options):
x["local_optimizer"] = self.local_optimizer
model_tmpdir = None
if self.tmpdir is not None:
model_tmpdir = self.tmpdir / model_hash
model_tmpdir = self.tmpdir / str(model_hash)
model_tmpdir.mkdir(exist_ok=False, parents=True)

ess = SacessOptimizer(
Expand Down

0 comments on commit 109bec9

Please sign in to comment.