[bug] [factorisation] removed remaining validity checks is_valid
This commit is contained in:
+12
-17
@@ -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:
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user