[AstroPy] [pywcs] Unit question
James Turner
jturner at gemini.edu
Fri Apr 1 12:24:20 EDT 2011
> h = pyfits.ImageHDU(
> data = hdu.data[int(pix_coords[0][2]):int(pix_coords[1][2])+1,:, :],
> header = hdu.header)
>
> # Here comes the funny stuff
> start = [0, 0, int(pix_coords[0][2])]
> h.header['CRVAL3'] = wcs.wcs_pix2sky([start], 1)[0][2]
>
> The problem here is that "pix2sky" returns the wavelength in meters
> while I want to put it in the unit that was used in the original file.
> Is there an easy way to convert this?
Don't you just need to set CUNIT3 in the header?
See paper I, S2.3:
http://www.atnf.csiro.au/people/mcalabre/WCS/wcs.pdf
Cheers,
James.
More information about the AstroPy
mailing list