Skip to content
Snippets Groups Projects
Commit 2c88b04c authored by Kevin Kuns's avatar Kevin Kuns
Browse files

fix bug when updating ifo struct in budget run

parent c0d8fb3b
Branches update-ifo-bugfix
No related tags found
No related merge requests found
Pipeline #326239 passed
......@@ -271,7 +271,7 @@ class Noise(BudgetItem):
ifo_hash = ifo.hash(ifo._orig_keys)
if ifo_hash != getattr(self, '_ifo_hash', 0):
logger.debug("ifo hash change")
kwargs['ifo'] = self.ifo
kwargs['ifo'] = ifo
self._ifo_hash = ifo_hash
if kwargs:
......
"""
"""
import numpy as np
import gwinc
from gwinc import load_budget
from copy import deepcopy
import pytest
def test_load(pprint, tpath_join, fpath_join):
......@@ -12,3 +15,35 @@ def test_load(pprint, tpath_join, fpath_join):
fig = trace.plot()
fig.savefig(tpath_join('budget_{}.pdf'.format(ifo)))
@pytest.mark.logic
@pytest.mark.fast
def test_update_ifo_struct():
"""
Test that the noise is recalculated when the ifo struct is updated
"""
budget = gwinc.load_budget('CE2silica')
tr1 = budget.run()
budget.ifo.Suspension.VHCoupling.theta *= 2
tr2 = budget.run()
assert np.all(
tr2.Seismic.SeismicVertical.asd == 2*tr1.Seismic.SeismicVertical.asd)
@pytest.mark.logic
@pytest.mark.fast
def test_change_ifo_struct():
"""
Test that the noise is recalculated when a new ifo struct is passed to run
"""
budget = gwinc.load_budget('CE2silica')
ifo1 = deepcopy(budget.ifo)
ifo2 = deepcopy(budget.ifo)
ifo2.Suspension.VHCoupling.theta *= 2
tr1 = budget.run(ifo=ifo1)
tr2 = budget.run(ifo=ifo2)
tr3 = budget.run(ifo=ifo1)
assert np.all(tr1.asd == tr3.asd)
assert np.all(
tr2.Seismic.SeismicVertical.asd == 2*tr1.Seismic.SeismicVertical.asd)
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