Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select: fix ModelHash incorrect typing in SacessMinimizeMethod #1548

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading