From 5b091f1ebcb6e4de3e2fb26f781b90f4b3412c1b Mon Sep 17 00:00:00 2001 From: GIUSEPPE PUGLISI Date: Sun, 4 Dec 2022 23:55:24 -0800 Subject: [PATCH] implementing a new assertion test --- src/toast/tests/template_gain.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/toast/tests/template_gain.py b/src/toast/tests/template_gain.py index b02d3afce..9a83090d1 100644 --- a/src/toast/tests/template_gain.py +++ b/src/toast/tests/template_gain.py @@ -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): @@ -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]) @@ -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)