From 8ea19bdf71cdcd5a5f0aaf32d2c321166ce8b678 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 12 Nov 2024 11:14:55 +0100 Subject: [PATCH] .. --- petab_select/candidate_space.py | 27 ++++++++++++--------------- petab_select/ui.py | 1 - pyproject.toml | 2 +- setup.py | 1 - 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/petab_select/candidate_space.py b/petab_select/candidate_space.py index 733faced..35aa90f5 100644 --- a/petab_select/candidate_space.py +++ b/petab_select/candidate_space.py @@ -1035,7 +1035,6 @@ def update_after_calibration( **kwargs, ) -> None: """See `CandidateSpace.update_after_calibration`.""" - super().update_after_calibration( *args, iteration_calibrated_models=iteration_calibrated_models, @@ -1073,8 +1072,8 @@ def update_from_iteration_calibrated_models( ) -> bool: """Update ``self.best_models`` with the latest ``iteration_calibrated_models`` and determine if there was a new best model. If so, return - ``False``. ``True`` otherwise.""" - + ``False``. ``True`` otherwise. + """ go_into_switch_method = True for model in iteration_calibrated_models.values(): if ( @@ -1112,7 +1111,8 @@ def update_from_iteration_calibrated_models( def insert_model_into_best_models(self, model_to_insert: Model) -> None: """Inserts a model into the list of best_models which are sorted - w.r.t. the criterion specified.""" + w.r.t. the criterion specified. + """ insert_index = bisect.bisect_left( [ model.get_criterion(self.criterion) @@ -1125,8 +1125,8 @@ def insert_model_into_best_models(self, model_to_insert: Model) -> None: def consider(self, model: Union[Model, None]) -> bool: """Re-define ``consider`` of FAMoS to be the ``consider`` method of the ``inner_candidate_space``. Update all the attributes - changed in the ``consider`` method.""" - + changed in the ``consider`` method. + """ if self.limit.reached(): return False @@ -1157,7 +1157,8 @@ def is_plausible(self, model: Model) -> bool: def check_swap(self, model: Model) -> bool: """Check if parameters that are swapped are contained in the - same swap parameter set.""" + same swap parameter set. + """ if self.method != Method.LATERAL: return True @@ -1177,7 +1178,6 @@ def check_swap(self, model: Model) -> bool: def check_critical(self, model: Model) -> bool: """Check if the model contains all necessary critical parameters""" - estimated_parameters_ids = set(model.get_estimated_parameter_ids_all()) for critical_set in self.critical_parameter_sets: if not estimated_parameters_ids.intersection(set(critical_set)): @@ -1188,8 +1188,8 @@ def switch_method( self, ) -> None: """Switch to the next method with respect to the history - of methods used and the switching scheme in ``self.method_scheme``.""" - + of methods used and the switching scheme in ``self.method_scheme``. + """ previous_method = self.method next_method = previous_method logging.info("SWITCHING", self.method_history) @@ -1248,7 +1248,6 @@ def switch_method( def update_method(self, method: Method): """Update ``self.method`` to ``method``.""" - self.method = method def switch_inner_candidate_space( @@ -1261,7 +1260,6 @@ def switch_inner_candidate_space( excluded_hashes: Hashes of excluded models. """ - # if self.method != Method.MOST_DISTANT: self.inner_candidate_space = self.inner_candidate_spaces[self.method] # reset the next inner candidate space with the current history of all @@ -1275,8 +1273,8 @@ def jump_to_most_distant( self, ): """Jump to most distant model with respect to the history of all - calibrated models.""" - + calibrated models. + """ predecessor_model = self.get_most_distant() logging.info("JUMPING: ", predecessor_model.parameters) @@ -1319,7 +1317,6 @@ def get_most_distant( If not we choose the model in a subspace that has least distance to this complement model. """ - most_distance = 0 most_distant_indices = [] diff --git a/petab_select/ui.py b/petab_select/ui.py index 3a0d11d6..db183e7c 100644 --- a/petab_select/ui.py +++ b/petab_select/ui.py @@ -92,7 +92,6 @@ def start_iteration( :const:`petab_select.constants.MODELS`: The uncalibrated models of the current iteration. """ - """ FIXME(dilpath) - currently takes predecessor model from diff --git a/pyproject.toml b/pyproject.toml index 7bef2696..2de8f22b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ line-length = 79 exclude = ["amici_models"] extend-include = ["*.ipynb"] lint.ignore = [ - # FIXME: we should be able to remive move of those + # FIXME: we should be able to remove move of those "D103", # Missing docstring in public function "S101", # Use of assert detected "E501", # Line too long diff --git a/setup.py b/setup.py index 13c51919..174cdbf1 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,6 @@ def read(fname): def absolute_links(txt): """Replace relative petab github links by absolute links.""" - raw_base = f"(https://raw.githubusercontent.com/{org}/{repo}/main/" embedded_base = f"(https://github.com/{org}/{repo}/tree/main/" # iterate over links