[AstroPy] pywcs problem

Stefan Schwarzburg stefan.schwarzburg at googlemail.com
Thu Jul 3 10:51:59 EDT 2008


Hi,
I have a problem with pywcs. I tried to get a feeling for the library by
playing around with it.
At the end of the email, there is my modified "test", which is taken from
here "http://stsdas.stsci.edu/astrolib/pywcs-1.0a1-4.3_api/"

Now when I let this test run, I get the following output:
>-------------------USING TEST HEADER-------------------
>
>
>
>
>
>
>
>
>
>[[ 99.322   36.3123]]

To me this seems rather strange, since in the testheader, there is this part
here:
CRPIX1  =                151.0 / Reference pixel on axis 1
CRPIX2  =                151.0 / Reference pixel on axis 2
CRVAL1  =              279.322 / Value at ref. pixel on axis 1
CRVAL2  =              -7.3123 / Value at ref. pixel on axis 2

and my test uses [150,150] as test pixel position.
Should I not get something like:~ [[279, -7]] ?

I hope someone can help me here.

Thanks,
Stefan



#!/usr/bin/env python
import numpy
import pywcs
import pyfits
import sys

print "-------------------USING TEST HEADER-------------------"
h = """
SIMPLE  =                    T / file does conform to FITS standard
BITPIX  =                  -32 / number of bits per data pixel
NAXIS   =                    2 / number of data axes
NAXIS1  =                  301 / length of data axis 1
NAXIS2  =                  301 / length of data axis 2
EXTEND  =                    T / FITS dataset may contain extensions
COMMENT   FITS (Flexible Image Transport System) format is defined in
'Astronomy
COMMENT   and Astrophysics', volume 376, page 359; bibcode:
2001A&A...376..359H
CTYPE1  = 'RA---CAR'           / Type of co-ordinate on axis 1
CTYPE2  = 'DEC--CAR'           / Type of co-ordinate on axis 2
CRPIX1  =                151.0 / Reference pixel on axis 1
CRPIX2  =                151.0 / Reference pixel on axis 2
CRVAL1  =              279.322 / Value at ref. pixel on axis 1
CRVAL2  =              -7.3123 / Value at ref. pixel on axis 2
CDELT1  =                -0.02 / Pixel size on axis 1
CDELT2  =                 0.02 / Pixel size on axis 2
MJD-OBS =     51544.4992571308 / Modified Julian Date of observation
DATE-OBS= '2000-01-01T11:58:55.816'/ Date of observation
RADESYS = 'FK5     '           / Reference frame for RA/DEC values
EQUINOX =               2000.0 / [yr] Epoch of reference equinox
OBJECT  = 'SOMETHING'
BUNIT   = 'Count   '
BSCALE  =                  1.0
BZERO   =                  0.0
"""

wcs = pywcs.WCS(h)

# Print out the "name" of the WCS, as defined in the FITS header
print wcs.name

# Some interesting pixel coordinates
pixcrd = numpy.array([[150,150]], numpy.double)

# Convert pixel coordinates to world coordinates
world = wcs.pixel2world(pixcrd)
print world
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20080703/ee7b6418/attachment.html>


More information about the AstroPy mailing list