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

Support FITS files with distortion maps when given as file name #477

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

svank
Copy link
Contributor

@svank svank commented Nov 7, 2024

When the input data for a reprojection is provided by its filename (reproject_adaptive('my_file.fits', target_frame...)), if the file has WCS distortion tables, the call fails because, when a WCS is created from the file's header, the HDUList needs to be provided so the distortion labels can be loaded. This PR takes a stab at ensuring the HDUList is provided as needed.

The failure before this PR is

----> 1 reproject.reproject_adaptive(files[0], frame)

File ~/miniconda3/lib/python3.12/site-packages/reproject/adaptive/high_level.py:228, in reproject_adaptive(input_data, output_projection, shape_out, hdu_in, center_jacobian, despike_jacobian, roundtrip_coords, conserve_flux, kernel, kernel_width, sample_region_width, boundary_mode, boundary_fill_value, boundary_ignore_threshold, x_cyclic, y_cyclic, bad_value_mode, bad_fill_value, output_array, output_footprint, return_footprint, block_size, parallel, return_type)

File ~/miniconda3/lib/python3.12/site-packages/reproject/utils.py:102, in parse_input_data(input_data, hdu_in)

File ~/miniconda3/lib/python3.12/site-packages/reproject/utils.py:112, in parse_input_data(input_data, hdu_in)

File ~/miniconda3/lib/python3.12/site-packages/reproject/utils.py:114, in parse_input_data(input_data, hdu_in)

File ~/miniconda3/lib/python3.12/site-packages/astropy/wcs/wcs.py:521, in WCS.__init__(self, header, fobj, key, minerr, relax, naxis, keysel, colsel, fix, translate_units, _do_set)

File ~/miniconda3/lib/python3.12/site-packages/astropy/wcs/wcs.py:1082, in WCS._read_distortion_kw(self, header, fobj, dist, err)

ValueError: an astropy.io.fits.HDUList is required for Lookup table distortion.

@svank svank force-pushed the images-with-distortion-maps branch from f850495 to e177c2e Compare November 7, 2024 17:08
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.90%. Comparing base (1e5c275) to head (e177c2e).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #477   +/-   ##
=======================================
  Coverage   90.90%   90.90%           
=======================================
  Files          25       25           
  Lines        1077     1077           
=======================================
  Hits          979      979           
  Misses         98       98           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

1 participant