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

WCS failure: CRVAL is truncated significantly #4612

Closed
keflavich opened this issue Feb 18, 2016 · 3 comments
Closed

WCS failure: CRVAL is truncated significantly #4612

keflavich opened this issue Feb 18, 2016 · 3 comments

Comments

@keflavich
Copy link
Contributor

probably related to #4555

wcs.to_header is dramatically truncating the celestial CRVAL in this header:

SIMPLE  =                    T /Standard FITS
BITPIX  =                  -32 /Floating point (32 bit)
NAXIS   =                    3
NAXIS1  =                  256
NAXIS2  =                  256
NAXIS3  =                  150
EXTEND  =                    T
BSCALE  =   1.000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
BZERO   =   0.000000000000E+00
BTYPE   = 'Intensity'
COMMENT   1 blank line
BUNIT   = 'JY/BEAM '           /Brightness (pixel) unit
EQUINOX =   2.000000000000E+03
RADESYS = 'FK5     '
LONPOLE =   1.800000000000E+02
LATPOLE =  -5.186266666667E+01
PC01_01 =   1.000000000000E+00
PC02_01 =   0.000000000000E+00
PC03_01 =   0.000000000000E+00
PC01_02 =   0.000000000000E+00
PC02_02 =   1.000000000000E+00
PC03_02 =   0.000000000000E+00
PC01_03 =   0.000000000000E+00
PC02_03 =   0.000000000000E+00
PC03_03 =   1.000000000000E+00
CTYPE1  = 'RA---SIN'
CRVAL1  =   2.409303333333E+02
CDELT1  =  -2.222222222222E-05
CRPIX1  =   1.290000000000E+02
CUNIT1  = 'deg     '
CTYPE2  = 'DEC--SIN'
CRVAL2  =  -5.186266666667E+01
CDELT2  =   2.222222222222E-05
CRPIX2  =   1.290000000000E+02
CUNIT2  = 'deg     '
CTYPE3  = 'FREQ    '
CRVAL3  =   2.563000222540E+11
CDELT3  =   8.549244424438E+05
CRPIX3  =   1.000000000000E+00
CUNIT3  = 'Hz      '
PV2_1   =   0.000000000000E+00
PV2_2   =   0.000000000000E+00
RESTFRQ =   2.562999000000E+11 /Rest Frequency (Hz)
SPECSYS = 'LSRK    '           /Spectral reference frame
ALTRVAL =  -1.429997716196E+02 /Alternate frequency reference value
ALTRPIX =   1.000000000000E+00 /Alternate frequency reference pixel
VELREF  =                  257 /1 LSR, 2 HEL, 3 OBS, +256 Radio
COMMENT casacore non-standard usage: 4 LSD, 5 GEO, 6 SOU, 7 GAL
TELESCOP= 'ALMA    '
DATE-OBS= '2015-01-03T14:21:52.416000'
TIMESYS = 'UTC     '
OBSRA   =   2.409303333333E+02
OBSDEC  =  -5.186266666667E+01
OBSGEO-X=   2.225142180269E+06
OBSGEO-Y=  -5.440307370349E+06
OBSGEO-Z=  -2.481029851874E+06
DATE    = '2015-11-11T16:43:54.590000' /Date FITS file was written
ORIGIN  = 'CASA 4.2.2 (prerelease r30986)'
CASAMBM =                    T /CASA multiple BEAMS table present
END
w = wcs.WCS(fits.Header.fromtextfile('test.hdr'))
w.to_header()

yields:

WCSAXES =                    3 / Number of coordinate axes
CRPIX1  =                129.0 / Pixel coordinate of reference point
CRPIX2  =                129.0 / Pixel coordinate of reference point
CRPIX3  =                  1.0 / Pixel coordinate of reference point
CDELT1  =  -2.222222222222E-05 / [deg] Coordinate increment at reference point
CDELT2  =   2.222222222222E-05 / [deg] Coordinate increment at reference point
CDELT3  =   8.549244424438E+05 / [Hz] Coordinate increment at reference point
CUNIT1  = 'deg'                / Units of coordinate increment and value
CUNIT2  = 'deg'                / Units of coordinate increment and value
CUNIT3  = 'Hz'                 / Units of coordinate increment and value
CTYPE1  = 'RA---SIN'           / Right ascension, orthographic/synthesis project
CTYPE2  = 'DEC--SIN'           / Declination, orthographic/synthesis projection
CTYPE3  = 'FREQ'               / Frequency (linear)
CRVAL1  =                240.9 / [deg] Coordinate value at reference point
CRVAL2  =                -51.9 / [deg] Coordinate value at reference point
CRVAL3  =       256300022254.0 / [Hz] Coordinate value at reference point
PV2_1   =                  0.0 / SIN projection parameter
PV2_2   =                  0.0 / SIN projection parameter
LONPOLE =                180.0 / [deg] Native longitude of celestial pole
LATPOLE =       -51.8626666667 / [deg] Native latitude of celestial pole
RESTFRQ =       256299900000.0 / [Hz] Line rest frequency
RADESYS = 'FK5'                / Equatorial coordinate system
EQUINOX =               2000.0 / [yr] Equinox of equatorial coordinates
SPECSYS = 'LSRK'               / Reference frame of spectral coordinates
OBSGEO-X=        2225142.18027 / [m] ITRF observatory X-coordinate
OBSGEO-Y=       -5440307.37035 / [m] ITRF observatory Y-coordinate
OBSGEO-Z=       -2481029.85187 / [m] ITRF observatory Z-coordinate
MJD-OBS =        57025.5985233 / [d] MJD of observation matching DATE-OBS
DATE-OBS= '2015-01-03T14:21:52.416000' / ISO-8601 observation date matching MJD-

Look at CRVAL:
CRVAL1 = 2.409303333333E+02 to

CRVAL1 = 240.9

In [26]: w.to_header()['CRVAL1'] - w.wcs.crval[0]
Out[26]: -0.030333333300006871

Issue was originally identified from radio-astro-tools/spectral-cube#280

@keflavich
Copy link
Contributor Author

...sorry, this appears to be fixed on master, I hadn't pulled the latest.

@keflavich
Copy link
Contributor Author

I would guess this PR fixed it

@astrofrog
Copy link
Member

By the way, this is an issue in Astropy 1.1.x but not 1.0.x

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

2 participants