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

TEST: Coron3 fit update and unpin numpy #8799

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------

Expand Down
14 changes: 8 additions & 6 deletions jwst/coron/imageregistration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions jwst/regtest/test_miri_coron3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
5 changes: 3 additions & 2 deletions jwst/regtest/test_nircam_coron3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"crds>=11.17.14",
"drizzle>=1.15.0",
"gwcs>=0.21.0,<0.23.0",
"numpy>=1.22,<2.0",
"numpy>=1.22",
"opencv-python-headless>=4.6.0.66",
"photutils>=1.5.0",
"psutil>=5.7.2",
Expand Down
Loading