Skip to content

Commit

Permalink
Fix mis-use of super and change to where aliases live
Browse files Browse the repository at this point in the history
  • Loading branch information
joezuntz committed Jul 11, 2024
1 parent 9875ee7 commit bcb1666
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/rail/core/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def set_data(self, tag, data, path=None, do_read=True):
if isinstance(data, DataHandle):
aliased_tag = data.tag
if tag in self.input_tags():
self.config.aliases[tag] = aliased_tag
self._aliases[tag] = aliased_tag
if data.has_path:
self._inputs[tag] = data.path
arg_data = data.data
Expand Down
2 changes: 1 addition & 1 deletion src/rail/creation/degraders/addRandom.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, args, **kwargs):
Does standard Noisifier initialization
"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)

def _initNoiseModel(self): # pragma: no cover
np.random.seed(self.config.seed)
Expand Down
2 changes: 1 addition & 1 deletion src/rail/creation/degraders/quantityCut.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, args, **kwargs):
Performs standard Degrader initialization as well as defining the cuts
to be applied.
"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.cuts = None
self.set_cuts(self.config["cuts"])

Expand Down
6 changes: 3 additions & 3 deletions src/rail/creation/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Modeler(RailStage): # pragma: no cover

def __init__(self, args, **kwargs):
"""Initialize Modeler"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.model = None

def fit_model(self):
Expand Down Expand Up @@ -58,7 +58,7 @@ class Creator(RailStage): # pragma: no cover

def __init__(self, args, **kwargs):
"""Initialize Creator"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.model = None
if not isinstance(args, dict): # pragma: no cover
args = vars(args)
Expand Down Expand Up @@ -146,7 +146,7 @@ class PosteriorCalculator(RailStage): # pragma: no cover

def __init__(self, args, **kwargs):
"""Initialize PosteriorCalculator"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.model = None
if not isinstance(args, dict): # pragma: no cover
args = vars(args)
Expand Down
2 changes: 1 addition & 1 deletion src/rail/estimation/algos/naive_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class NaiveStackSummarizer(PZSummarizer):
outputs = [("output", QPHandle), ("single_NZ", QPHandle)]

def __init__(self, args, **kwargs):
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.zgrid = None

def run(self):
Expand Down
2 changes: 1 addition & 1 deletion src/rail/estimation/algos/point_est_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PointEstHistSummarizer(PZSummarizer):
outputs = [("output", QPHandle), ("single_NZ", QPHandle)]

def __init__(self, args, **kwargs):
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.zgrid = None
self.bincents = None

Expand Down
2 changes: 1 addition & 1 deletion src/rail/estimation/algos/random_gauss.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class RandomGaussEstimator(CatEstimator):
def __init__(self, args, **kwargs):
"""Constructor:
Do CatEstimator specific initialization"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.zgrid = None

def _process_chunk(self, start, end, data, first):
Expand Down
2 changes: 1 addition & 1 deletion src/rail/estimation/algos/true_nz.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TrueNZHistogrammer(RailStage):
outputs = [("true_NZ", QPHandle)]

def __init__(self, args, **kwargs):
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.zgrid = None
self.bincents = None

Expand Down
2 changes: 1 addition & 1 deletion src/rail/estimation/algos/var_inf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class VarInfStackSummarizer(PZSummarizer):
outputs = [("output", QPHandle), ("single_NZ", QPHandle)]

def __init__(self, args, **kwargs):
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.zgrid = None

def run(self):
Expand Down
4 changes: 2 additions & 2 deletions src/rail/estimation/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CatClassifier(RailStage): # pragma: no cover

def __init__(self, args, **kwargs):
"""Initialize Classifier"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self._output_handle = None
self.model = None
if not isinstance(args, dict): # pragma: no cover
Expand Down Expand Up @@ -116,7 +116,7 @@ def __init__(self, args, **kwargs):
comm : MPI.Comm, optional
MPI communicator for parallel processing.
"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self._output_handle = None

def classify(self, input_data):
Expand Down
2 changes: 1 addition & 1 deletion src/rail/estimation/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CatEstimator(RailStage, PointEstimationMixin):

def __init__(self, args, **kwargs):
"""Initialize Estimator"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self._output_handle = None
self.model = None

Expand Down
4 changes: 2 additions & 2 deletions src/rail/estimation/informer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CatInformer(RailStage):

def __init__(self, args, **kwargs):
"""Initialize Informer that can inform models for redshift estimation"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.model = None

def inform(self, training_data):
Expand Down Expand Up @@ -90,7 +90,7 @@ class PzInformer(RailStage):

def __init__(self, args, **kwargs):
"""Initialize Informer that can inform models for redshift estimation"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.model = None

def inform(self, training_data):
Expand Down
2 changes: 1 addition & 1 deletion src/rail/estimation/summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class SZPZSummarizer(RailStage):

def __init__(self, args, **kwargs):
"""Initialize Estimator that can sample galaxy data."""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self.model = None
# NOTE: open model removed from init, need to put an
# `open_model` call explicitly in the run method for
Expand Down
2 changes: 1 addition & 1 deletion src/rail/evaluation/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluator(RailStage): #pylint: disable=too-many-instance-attributes
metric_base_class = None

def __init__(self, args, **kwargs):
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self._output_handle = None
self._summary_handle = None
self._single_distribution_summary_handle = None
Expand Down
2 changes: 1 addition & 1 deletion src/rail/evaluation/single_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SingleEvaluator(Evaluator): # pylint: disable=too-many-instance-attribute

def __init__(self, args, **kwargs):
"""Initialize Evaluator"""
super().__init__(self, args, **kwargs)
super().__init__(args, **kwargs)
self._input_data_type = QPOrTableHandle.PdfOrValue.unknown
self._truth_data_type = QPOrTableHandle.PdfOrValue.unknown
self._out_table = {}
Expand Down

0 comments on commit bcb1666

Please sign in to comment.