From 1575ddb2b322255722b2ecfcb76c4cfb83783d46 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 12 Nov 2024 12:41:00 +0100 Subject: [PATCH] .. --- doc/conf.py | 5 ++- petab_select/candidate_space.py | 11 +++--- petab_select/model.py | 2 +- petab_select/model_subspace.py | 69 +++++++++++++++++---------------- pyproject.toml | 1 - 5 files changed, 46 insertions(+), 42 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 6cf2db10..c6b3b7a3 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -2,9 +2,12 @@ # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +from __future__ import annotations import inspect +import sphinx + # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information @@ -73,5 +76,5 @@ def autodoc_skip_member(app, what, name, obj, skip, options): return None -def setup(app: "sphinx.application.Sphinx"): +def setup(app: sphinx.application.Sphinx): app.connect("autodoc-skip-member", autodoc_skip_member, priority=0) diff --git a/petab_select/candidate_space.py b/petab_select/candidate_space.py index 57084766..a3433871 100644 --- a/petab_select/candidate_space.py +++ b/petab_select/candidate_space.py @@ -690,8 +690,8 @@ def __init__( if predecessor_model is None: predecessor_model = VIRTUAL_INITIAL_MODEL super().__init__( - method=Method.FORWARD if self.direction == 1 else Method.BACKWARD, *args, + method=Method.FORWARD if self.direction == 1 else Method.BACKWARD, predecessor_model=predecessor_model, **kwargs, ) @@ -976,8 +976,8 @@ def __init__( ] super().__init__( - method=self.method, *args, + method=self.method, predecessor_model=predecessor_model, **kwargs, ) @@ -990,7 +990,8 @@ def __init__( and (Method.LATERAL,) not in self.method_scheme ): raise ValueError( - "Please provide a method to switch to after a lateral search, if not enabling the `consecutive_laterals` option." + "Please provide a method to switch to after a lateral search, " + "if not enabling the `consecutive_laterals` option." ) if self.n_reattempts: @@ -1401,8 +1402,8 @@ def __init__( Maximal allowed number of swap moves. If 0 then there is no maximum. """ super().__init__( - method=Method.LATERAL, *args, + method=Method.LATERAL, predecessor_model=predecessor_model, **kwargs, ) @@ -1453,8 +1454,8 @@ def __init__(self, *args, **kwargs): # 'brute force candidate space.' # ) super().__init__( - method=Method.BRUTE_FORCE, *args, + method=Method.BRUTE_FORCE, **kwargs, ) diff --git a/petab_select/model.py b/petab_select/model.py index 4c978b4e..d1c00c20 100644 --- a/petab_select/model.py +++ b/petab_select/model.py @@ -1001,7 +1001,7 @@ def hash_model_subspace_indices(model_subspace_indices: list[int]) -> str: for index in model_subspace_indices ) except KeyError: - return MODEL_SUBSPACE_INDICES_HAS_HASH_DELIMITER.join( + return MODEL_SUBSPACE_INDICES_HASH_DELIMITER.join( str(i) for i in model_subspace_indices ) diff --git a/petab_select/model_subspace.py b/petab_select/model_subspace.py index 216ea0e4..fa0afe53 100644 --- a/petab_select/model_subspace.py +++ b/petab_select/model_subspace.py @@ -923,41 +923,42 @@ def get_estimated( The parameter IDs. """ raise NotImplementedError - parameters = [] - for parameter_id, parameter_value in self.parameters_all.items(): - if additional_parameters.get(parameter_id, None) == ESTIMATE: - parameters.append(parameter_id) - continue - - if parameter_id in additional_parameters: - # Presumably not estimated. - continue - old_estimated_all = { - parameter_id - for parameter_id, parameter_values in self.parameters_all.items() - if - ( - # Predecessor model sets the parameter to be estimated - ( - candidate_space.predecessor_model.parameters.get( - parameter_id, None - ) - == ESTIMATE - ) - or ( - # Predecessor model takes the default PEtab parameter - parameter_id - not in candidate_space.predecessor_model.parameters - and - # And the default PEtab parameter is estimated - # The PEtab problem of this subspace and the - # `candidate_space` is the same, as verified earlier with - # `self.check_compatibility_stepwise_method`. - self.petab_parameters[parameter_id] == [ESTIMATE] - ) - ) - } + # parameters = [] + # for parameter_id, parameter_value in self.parameters_all.items(): + # if additional_parameters.get(parameter_id, None) == ESTIMATE: + # parameters.append(parameter_id) + # continue + # + # if parameter_id in additional_parameters: + # # Presumably not estimated. + # continue + # + # old_estimated_all = { + # parameter_id + # for parameter_id, parameter_values in self.parameters_all.items() + # if + # ( + # # Predecessor model sets the parameter to be estimated + # ( + # candidate_space.predecessor_model.parameters.get( + # parameter_id, None + # ) + # == ESTIMATE + # ) + # or ( + # # Predecessor model takes the default PEtab parameter + # parameter_id + # not in candidate_space.predecessor_model.parameters + # and + # # And the default PEtab parameter is estimated + # # The PEtab problem of this subspace and the + # # `candidate_space` is the same, as verified earlier with + # # `self.check_compatibility_stepwise_method`. + # self.petab_parameters[parameter_id] == [ESTIMATE] + # ) + # ) + # } def __len__(self) -> int: """Get the number of models in this subspace.""" diff --git a/pyproject.toml b/pyproject.toml index 2ea55d2a..5d534f83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,6 @@ lint.ignore = [ "S301", # pickle module used "S102", # Use of exec detected "S307", # Use of possibly insecure function - "B026", # Star-arg unpacking after a keyword argument "B006", "E722", "B904",