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

ResampleStep fails for custom wcs #9225

Open
braingram opened this issue Feb 26, 2025 · 0 comments
Open

ResampleStep fails for custom wcs #9225

braingram opened this issue Feb 26, 2025 · 0 comments

Comments

@braingram
Copy link
Collaborator

Providing a custom wcs (in this case a wcs from a cal file) results in an exception:

from jwst.resample import ResampleStep
import asdf

# point this to the corresponding regtest file
cal_filename = "~/jwst-pipeline/dev/nircam/image/jw01069002001_01101_00001_nrca5_cal.fits"
m = dm.open(cal_filename)
wcs = m.meta.wcs
asdf.AsdfFile({"wcs": wcs}).write_to("custom_wcs.asdf")

step = ResampleStep(output_wcs="custom_wcs.asdf")
result = step(m)

Produces an exception:

Traceback (most recent call last):
  File "/Users/bgraham/projects/src/jwst/resample_to_cal.py", line 13, in <module>
    result = step(m)
             ^^^^^^^
  File "/Users/bgraham/projects/src/jwst/jwst/stpipe/core.py", line 159, in __call__
    return super().__call__(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bgraham/.pyenv/versions/jwst/lib/python3.12/site-packages/stpipe/step.py", line 585, in __call__
    return self.run(*args)
           ^^^^^^^^^^^^^^^
  File "/Users/bgraham/projects/src/jwst/jwst/stpipe/core.py", line 141, in run
    result = super().run(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bgraham/.pyenv/versions/jwst/lib/python3.12/site-packages/stpipe/step.py", line 507, in run
    step_result = self.process(*args)
                  ^^^^^^^^^^^^^^^^^^^
  File "/Users/bgraham/projects/src/jwst/jwst/resample/resample_step.py", line 123, in process
    result = resamp.resample_many_to_one()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bgraham/projects/src/jwst/jwst/resample/resample.py", line 621, in resample_many_to_one
    self.finalize()
  File "/Users/bgraham/projects/src/jwst/jwst/resample/resample.py", line 462, in finalize
    self.update_fits_wcsinfo(self.output_jwst_model)
  File "/Users/bgraham/projects/src/jwst/jwst/resample/resample.py", line 645, in update_fits_wcsinfo
    model.meta.wcsinfo.cdelt1 = transform[3].factor.value
                                ^^^^^^^^^^^^^^^^^^^
AttributeError: 'Shift' object has no attribute 'factor'

The exception occurs on jwst main (current commit 7545a60) and on 1.17.1 (no earlier versions were tested).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant