astropy / astropy/reproject

reproject_interp with a distortion table

Open
#213 3 comments 0 reactions 1 assignee Claimed by @astrofrog View on GitHub
bug
Dominant language
Python
Stars
127
Forks
74
Avg merge
1d 11h
Merged PRs (30d)
2

Description

Dear all,
Is reproject meant to be able to cope with distortion tables? If yes, I'm having an issue with that:

I have an HDUList as follows, which is the input to reproject_interp:
No. Name Ver Type Cards Dimensions Format
0 PRIMARY 1 PrimaryHDU 34 (1280, 960) uint8
1 WCSDVARR 1 ImageHDU 15 (320, 240) float32
2 WCSDVARR 2 ImageHDU 15 (320, 240) float32

The first HDU contains the image data and a header which points to the distortion tables, and the second and third HDUs are the distortion tables themselves.

This results in:

Traceback (most recent call last):
File "reproject-image.py", line 87, in
array, footprint = reproject_interp(meteor_lens, w[0].header, shape_out=(width, height))
File "c:\Python36\lib\site-packages\astropy\utils\decorators.py", line 521, in wrapper
return function(*args, **kwargs)
File "c:\Python36\lib\site-packages\reproject\interpolation\high_level.py", line 77, in reproject_interp
array_in, wcs_in = parse_input_data(input_data, hdu_in=hdu_in)
File "c:\Python36\lib\site-packages\reproject\utils.py", line 26, in parse_input_data
return parse_input_data(input_data[hdu_in])
File "c:\Python36\lib\site-packages\reproject\utils.py", line 28, in parse_input_data
return input_data.data, WCS(input_data.header)
File "c:\Python36\lib\site-packages\astropy\wcs\wcs.py", line 453, in __init__
header, fobj, dist='CPDIS', err=minerr)
File "c:\Python36\lib\site-packages\astropy\wcs\wcs.py", line 939, in _read_distortion_kw
raise ValueError('an astropy.io.fits.HDUList is '
ValueError: an astropy.io.fits.HDUList is required for Lookup table distortion.

Working back up through the traceback, I can see that fobj is of type None in wcs.py at lines 453 and 939. I can see that at line 28 in utils.py,

If I replace the input to reproject_interp to something with no distortion tables, i.e. just a primary HDU, it works as expected.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.