Incorrect results with calibrations in sub-budgets
Here is a test case involving calibrations and sub-budgets:
from gwinc import nb
from numpy import ones_like
class C1(nb.Calibration):
def calc(self):
return 900*ones_like(self.freq)
class C2(nb.Calibration):
def calc(self):
return ones_like(self.freq)
class N1(nb.Noise):
def calc(self):
return ones_like(self.freq)
class N2(nb.Noise):
def calc(self):
return 4*ones_like(self.freq)
class SB(nb.Budget):
noises = [(N1, C1), N2]
class B(nb.Budget):
noises = [ SB, ]
calibrations = [ C2, ]
Save as B/__init__.py
, run as python3 -m gwinc B SB.
Expected result: noises N1
and N2
both have magnitudes near 1/rtHz. But N1
is calibrated with C1
which applies a large multiplicative factor, so it should dwarf N2
in the sub-budget plot.
Actual result: apparently C1
is applied to both N1
and N2
?
However, you do get a correct result if you comment out the calibration C2
in the parent budget.