From 157f84e9949fbb057a6f14bc14db515db644c048 Mon Sep 17 00:00:00 2001 From: Noe Brucy Date: Tue, 15 Dec 2020 15:56:24 +0100 Subject: [PATCH] [bug] [factorisation] removed remaining validity checks is_valid --- baseprocessor.py | 29 ++++++++++++----------------- plotter.py | 5 ----- postprocessor.py | 1 - 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/baseprocessor.py b/baseprocessor.py index 4185428..c9b019d 100644 --- a/baseprocessor.py +++ b/baseprocessor.py @@ -23,14 +23,12 @@ class Rule: description="", group="", dependencies=[], - is_valid=lambda arg: True, kind="classic", unit=U.none, ): self.postproc = postproc self.process_fn = process self.dependencies = dependencies - self.is_valid_add = is_valid self.group = group self.description = description self.unit = unit @@ -144,21 +142,18 @@ class BaseProcessor: else: name_full = rule.group + "/" + name - if rule.is_valid(arg): - if name_full not in self.just_done: - if self._needs_computation(overwrite, name_full): - self._log("Processing {}".format(name_full)) - data = rule.process(arg, **kwargs) - self._save_data(name_full, data, rule.description, rule.unit) - self._log("Data for {} computed".format(name_full), "SUCCESS") - self.just_done.append(name_full) - return data - else: - self._log( - "Data for {} is already computed, skipping...".format(name_full) - ) - else: - self._log("{} is not valid in this context".format(name_full), "ERROR") + if name_full not in self.just_done: + if self._needs_computation(overwrite, name_full): + self._log("Processing {}".format(name_full)) + data = rule.process(arg, **kwargs) + self._save_data(name_full, data, rule.description, rule.unit) + self._log("Data for {} computed".format(name_full), "SUCCESS") + self.just_done.append(name_full) + return data + else: + self._log( + "Data for {} is already computed, skipping...".format(name_full) + ) def def_rules(self): for rule in self.rules: diff --git a/plotter.py b/plotter.py index c6c5f41..741822b 100644 --- a/plotter.py +++ b/plotter.py @@ -266,11 +266,6 @@ class Plotter(Aggregator, BaseProcessor): else: name_full = name - # Exit if not valid - if not rule.is_valid(arg): - self._log("{} is not valid in this context".format(name_full), "ERROR") - return - # get filetype of the output filetype = filetype_from_ext[self.pp_params.out.ext] diff --git a/postprocessor.py b/postprocessor.py index 135c642..680dbc1 100644 --- a/postprocessor.py +++ b/postprocessor.py @@ -1386,7 +1386,6 @@ class PostProcessor(HDF5Container): "Toomre Q parameter for a Keplerian disk", "/maps", dependencies=["coldens"], - is_valid=lambda _: self.pp_params.disk.enable, ), "sinks": Rule( self,