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

Noise.run() opportunistically call load()

cache the load status
parent 73cc9a5e
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,7 @@ class BudgetItem:
self.freq = freq
for key, val in kwargs.items():
setattr(self, key, val)
self._loaded = False
@property
def name(self):
......@@ -226,13 +227,17 @@ class Noise(BudgetItem):
calc_trace() in sequence. Keyword arguments are passed to the
update() method.
NOTE: The load status is cached such that subsequent calls to
this method will not re-execute the load() method.
NOTE: The update() method is only run if keyword arguments
(`kwargs`) are supplied, or if the `ifo` attribute has
changed.
"""
self.load()
self.update(**kwargs)
if not self._loaded:
self.load()
self._loaded = True
ifo = kwargs.get('ifo', getattr(self, 'ifo'))
if ifo:
......
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