diff --git a/CHANGES.rst b/CHANGES.rst index cf15011996..dbbb1a5d5b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -46,6 +46,11 @@ badpix_selfcal - Subtract pedestal dark when constructing min array across selfcal exposures for MIRI MRS data. [#8771] +calwebb_coron3 +-------------- + +- Tighten tolerance of psf alignment. [#8717] + calwebb_detector1 ----------------- diff --git a/jwst/coron/imageregistration.py b/jwst/coron/imageregistration.py index 12fc185272..457b7664eb 100644 --- a/jwst/coron/imageregistration.py +++ b/jwst/coron/imageregistration.py @@ -40,7 +40,9 @@ def align_fourierLSQ(reference, target, mask=None): init_pars = [0., 0., 1.] results, _ = optimize.leastsq(shift_subtract, init_pars, - args=(reference, target, mask)) + args=(reference, target, mask), + xtol=1E-15, ftol=1E-15, + ) return results @@ -165,7 +167,7 @@ def align_array(reference, target, mask=None, return_aligned=True): elif len(target.shape) == 3: nslices = target.shape[0] - shifts = np.empty((nslices, 3), dtype=float) + shifts = np.empty((nslices, 3), dtype=np.float64) if return_aligned: aligned = np.empty_like(target) @@ -221,19 +223,19 @@ def align_models(reference, target, mask): # Compute the shifts of the PSF ("target") images relative to # the science ("reference") image in the first integration shifts = align_array( - reference.data[0].astype(np.float64), - target.data.astype(np.float64), + reference.data[0], + target.data, mask=mask.data, return_aligned=False) # Apply the shifts to the PSF images output_model.data = fourier_imshift( - target.data.astype(np.float64), + target.data, -shifts) # Apply the same shifts to the PSF error arrays, if they exist if target.err is not None: output_model.err = fourier_imshift( - target.err.astype(np.float64), + target.err, -shifts) # TODO: in the future we need to add shifts and other info (such as diff --git a/jwst/regtest/test_miri_coron3.py b/jwst/regtest/test_miri_coron3.py index d10af9e65d..ff7e6224d6 100644 --- a/jwst/regtest/test_miri_coron3.py +++ b/jwst/regtest/test_miri_coron3.py @@ -30,7 +30,7 @@ def test_miri_coron3_sci_exp(run_pipeline, suffix, exposure, fitsdiff_default_kw rtdata.output = output rtdata.get_truth("truth/test_miri_coron3/" + output) - fitsdiff_default_kwargs["atol"] = 1e-5 + fitsdiff_default_kwargs["atol"] = 1e-2 diff = FITSDiff(rtdata.output, rtdata.truth, **fitsdiff_default_kwargs) assert diff.identical, diff.report() @@ -45,6 +45,7 @@ def test_miri_coron3_product(run_pipeline, suffix, fitsdiff_default_kwargs): rtdata.output = output rtdata.get_truth("truth/test_miri_coron3/" + output) - fitsdiff_default_kwargs['atol'] = 1e-5 + fitsdiff_default_kwargs['atol'] = 1e-4 + fitsdiff_default_kwargs['rtol'] = 1e-4 diff = FITSDiff(rtdata.output, rtdata.truth, **fitsdiff_default_kwargs) assert diff.identical, diff.report() diff --git a/jwst/regtest/test_nircam_coron3.py b/jwst/regtest/test_nircam_coron3.py index 9c4a77ba46..c69b11881c 100644 --- a/jwst/regtest/test_nircam_coron3.py +++ b/jwst/regtest/test_nircam_coron3.py @@ -32,7 +32,7 @@ def test_nircam_coron3_sci_exp(run_pipeline, suffix, obs, fitsdiff_default_kwarg rtdata.output = output rtdata.get_truth("truth/test_nircam_coron3/" + output) - fitsdiff_default_kwargs["atol"] = 1e-5 + fitsdiff_default_kwargs["atol"] = 1e-2 diff = FITSDiff(rtdata.output, rtdata.truth, **fitsdiff_default_kwargs) assert diff.identical, diff.report() @@ -63,6 +63,7 @@ def test_nircam_coron3_product(run_pipeline, suffix, fitsdiff_default_kwargs): rtdata.output = output rtdata.get_truth("truth/test_nircam_coron3/" + output) - fitsdiff_default_kwargs['atol'] = 1e-5 + fitsdiff_default_kwargs['atol'] = 1e-4 + fitsdiff_default_kwargs['rtol'] = 1e-4 diff = FITSDiff(rtdata.output, rtdata.truth, **fitsdiff_default_kwargs) assert diff.identical, diff.report()