astropy: astropy.wcs: presence of keywords like "PV1_5" causes error

I have a FITS file with an SIP transformation, and also, a series of keywords of the form PV?_? (PV1_1, PV1_2, etc). The WCS constructor seems to think these are coordinate transformation parameters. Perhaps it is searching for the SIP coefficients by looking for anything of the form ???_? ?

To reproduce, grab http://supernova.lbl.gov/~kbarbary/tmp/PTF_200906253621_i_p_mask_t084123_u012052003_f02_p002899_c07.fits (17MB) (This is the same example file I used in #257).

>>> from astropy.io import fits
>>> from astropy import wcs
>>> hdulist = fits.open('PTF_200906253621_i_p_mask_t084123_u012052003_f02_p002899_c07.fits')
>>> w = wcs.WCS(hdulist[0].header)
WARNING: FITSFixedWarning: 'celfix' made the change 'PV1_5 : Unrecognized coordinate transformation parameter'. This FITS header contains non-standard content. [astropy.wcs.wcs]
>>> w.wcs.print_contents()
ERROR: InvalidTransformError: ERROR 6 in wcsset() at line 1561 of file astropy/wcs/src/wcslib/C/wcs.c:
PV1_5 : Unrecognized coordinate transformation parameter.
 [unknown]

… or perhaps there is something I don’t know about these PV?_? keywords. But it looks like they are SCAMP-specific and not intended to interact with wcs or SIP transformations.

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 22 (18 by maintainers)

Commits related to this issue

Most upvoted comments

A little note on the exact 8th anniversary of the last comment on this issue (!): Astropy added support for TPV a while ago, but I’ve just discovered that you’ll still get these wcslib complaints about an unrecognized PV1_5 parameter if your header specifies a TAN projection type (or presumably anything other than TPV). If that’s the case, you need to change RA---TAN to RA---TPV, etc.

(Discovered with a FITS file from DASCH.)

New to this thread.

I am trying to make use of the astropy packages for a CFHT MEGACAM images. High precision WCS information in those images is created using a keyword mapping that matches swarp. They raise the PV1_5 error, due to swarps non-standard keywords, but we can’t blame swarp entirely as the standard appears to have been flexible at the time of authorship.

Perhaps, when projection is ‘TAN’ and there are PV?_? values in the header the wcs could apply the swarp usage?

The keyword definitions appear in the CFHT MEGACAM headers:

http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/CFHTSG/821543p.head

The use of the keywords is documented in the MegaPipe paper (Gwyn 2008)

“”“The higher order part of the WCS has no standard representation as of yet but the most common is the PVn_n keywords of M. R. Calabretta et al. (2004, private communication2).”“”

I know that Stephen Gwyn wrote an appendix for the paper that describes how to use the PV?_? keywords but that section was removed at the request of the reviewer.

@mdboom - is this something that might be worth somehow working around? Seeing as how SCAMP is a pretty commonly-used utility, this seems like it would be a nice thing to make work, even if it isn’t quite up-to-spec…