Skip to content
Snippets Groups Projects
Commit 5fd28791 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

nb: simplify BudgetItem freq attirbute access

Allows for specifying as a class attribute.
parent 1597e718
No related branches found
No related tags found
1 merge request!64No more precomp
......@@ -52,15 +52,21 @@ class BudgetItem:
##########
def __init__(self, freq, **kwargs):
def __init__(self, freq=None, **kwargs):
"""Initialize budget item.
Primary argument is the evaluation frequency array. Any
keyword arguments provided are simple written as attribute
variables in the initialized object.
The primary argument should be the evaluation frequency array.
If it is not provided, then it is assumed to be a pre-defined
attribute of the BudgetItem class. Any keyword arguments
provided are simple written as attribute variables in the
initialized object.
"""
self.__freq = freq
if freq is not None:
assert isinstance(freq, np.ndarray)
self.freq = freq
elif not hasattr(self, 'freq'):
raise AttributeError("Frequency array not provided or defined.")
for key, val in kwargs.items():
setattr(self, key, val)
......@@ -76,11 +82,6 @@ class BudgetItem:
self.name,
)
@property
def freq(self):
"""Evaluation frequency array supplied at initialization."""
return self.__freq
def interpolate(self, freq, data):
"""Interpolate data to the evaluation frequencies.
......
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