Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementing a new assertion test for the Gaintemplate fitting #617

Open
wants to merge 1 commit into
base: toast3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions src/toast/tests/template_gain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from ..templates import GainTemplate
from ..utils import rate_from_times
from ._helpers import create_outdir, create_satellite_data, close_data
from .mpi import MPITestCase

from .mpi import MPITestCase

class TemplateGainTest(MPITestCase):
def setUp(self):
Expand Down Expand Up @@ -59,13 +59,13 @@ def test_gainfit(self):
stokes_weights=weights,
noise_model=noise_model.noise_model,
)

poly_order = 0
# set up a gain fluctuation template
tmpl = GainTemplate(
noise_model=None,
# noise_model=noise_model.noise_model,
template_name=template,
order=1,
order=poly_order,
)
tmatrix = ops.TemplateMatrix(templates=[tmpl])

Expand All @@ -77,11 +77,17 @@ def test_gainfit(self):
template_matrix=tmatrix,
)
calibration.apply(data)

for ob in data.obs:
for det in ob.local_detectors:
np.testing.assert_allclose(
ob.detdata["calibrated"][det], np.ones(ob.n_local_samples)
)
#import pdb; pdb.set_trace()


gain_fitted_amplitudes = calibration.template_matrix.templates[0].data['Calibrate_solve_amplitudes']
n_gain_amplitudes = gain_fitted_amplitudes['GainTemplate'] .n_global
np.testing.assert_allclose(
gain_fitted_amplitudes , np.ones(n_gain_amplitudes) )

#for ob in data.obs:
# for det in ob.local_detectors:
# np.testing.assert_allclose(
# ob.detdata["calibrated"][det], np.ones(ob.n_local_samples) )

close_data(data)