Skip to content
Snippets Groups Projects
Commit 3462a97d authored by Jameson Rollins's avatar Jameson Rollins
Browse files

nb: fix to allow implicit use of budget "freq" attribute if available

this was a bug that it wasn't using a defined freq attribute if it was
available and a freq argument was not provided at initialization.
parent 868b5296
No related branches found
No related tags found
No related merge requests found
...@@ -218,7 +218,7 @@ class Budget(Noise): ...@@ -218,7 +218,7 @@ class Budget(Noise):
references = [] references = []
"""List of reference noise classes, or (ref, cal) tuples""" """List of reference noise classes, or (ref, cal) tuples"""
def __init__(self, *args, noises=None, **kwargs): def __init__(self, freq=None, noises=None, **kwargs):
"""Initialize Budget object. """Initialize Budget object.
See BudgetItem for base initialization arguments. See BudgetItem for base initialization arguments.
...@@ -228,15 +228,20 @@ class Budget(Noise): ...@@ -228,15 +228,20 @@ class Budget(Noise):
be used to filter the noises initialized in this budget. be used to filter the noises initialized in this budget.
""" """
super().__init__(*args, **kwargs) super().__init__(freq, **kwargs)
# store args and kwargs for later use # store kwargs for later use
self.args = args
self.kwargs = kwargs self.kwargs = kwargs
# FIXME: special casing the IFO here, in case it's defined as # record the frequency array as a kwarg if it's definied as a
# a class attribute rather than passed at initialization. we # class attribute
# do this because we're not defining a standard way to extract if freq is not None:
# IFO variables that get passed around in a reasonable way. self.kwargs['freq'] = freq
# how can we clarify this? else:
self.kwargs['freq'] = getattr(self, 'freq', None)
# FIXME: special casing the ifo kwarg here, in case it's
# defined as a class attribute rather than passed at
# initialization. we do this because we're not defining a
# standard way to extract IFO variables that get passed around
# in a reasonable way. how can we clarify this?
if 'ifo' not in kwargs and getattr(self, 'ifo', None): if 'ifo' not in kwargs and getattr(self, 'ifo', None):
self.kwargs['ifo'] = getattr(self, 'ifo', None) self.kwargs['ifo'] = getattr(self, 'ifo', None)
# all noise objects keyed by name # all noise objects keyed by name
...@@ -274,7 +279,6 @@ class Budget(Noise): ...@@ -274,7 +279,6 @@ class Budget(Noise):
noise = nc noise = nc
cals = [] cals = []
noise_obj = noise( noise_obj = noise(
*self.args,
**self.kwargs **self.kwargs
) )
name = noise_obj.name name = noise_obj.name
...@@ -288,7 +292,6 @@ class Budget(Noise): ...@@ -288,7 +292,6 @@ class Budget(Noise):
def __add_calibration(self, cal, noises): def __add_calibration(self, cal, noises):
cal_obj = cal( cal_obj = cal(
*self.args,
**self.kwargs **self.kwargs
) )
name = cal_obj.name name = cal_obj.name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment