hpc4cmb / toast

Time Ordered Astrophysics Scalable Tools
Other
44 stars 39 forks source link

Wrong assertion in GainTemplate tests #613

Open giuspugl opened 1 year ago

giuspugl commented 1 year ago

the result detdata key https://github.com/hpc4cmb/toast/blob/44d9f84ecc28752de2028cf3f402891ba34a1049/src/toast/ops/mapmaker.py#L556 should encode the TOD calibrated, i.e. corrected by the gain fluctuations , expressed as the linear combination of Legendre polinomials weighted by the amplitudes estimated by the toast mapmaker. Instead the test https://github.com/hpc4cmb/toast/blob/44d9f84ecc28752de2028cf3f402891ba34a1049/src/toast/tests/template_gain.py#L83 asserts exactly that the result data to be an array of np.ones local samples. What we should compare to be close to 1 should be instead the ops.Calibrate.template_matrix.templates[0].data['calibrator_solve_amplitudes']

giuspugl commented 1 year ago

Also in https://github.com/hpc4cmb/toast/blob/44d9f84ecc28752de2028cf3f402891ba34a1049/src/toast/ops/mapmaker_templates.py#L1009 what we should be dividing is not the template by the uncalibrated signal but the fitted gain amplitudes. Similarly to what we do in https://github.com/hpc4cmb/toast/blob/ddae67de4154067d2317999f6cf6c31dd48ae047/src/toast/todmap/mapmaker.py#L411