Create an HSTWCS object using a pyfits HDUList and an extension number
fobj = pyfits.open('some_file.fits')
w = wcsutil.HSTWCS(fobj, 3)
Create an HSTWCS object using a qualified file name.
w = wcsutil.HSTWCS('j9irw4b1q_flt.fits[sci,1]')
Create an HSTWCS object using a file name and an extension number.
w = wcsutil.HSTWCS('j9irw4b1q_flt.fits', ext=2)
Create an HSTWCS object from WCS with key ‘O’.
w = wcsutil.HSTWCS('j9irw4b1q_flt.fits', ext=2, wcskey='O')
Create a template HSTWCS object for a DEFAULT object.
w = wcsutil.HSTWCS(instrument='DEFAULT')
All coordinate transformation functions accept input coordinates as 2D numpy arrays or 2 sequences of X and Y coordinates.
inpix = np.array([[1., 2.], [1,3], [1,4], [1,5]])
or
X = [1.,1.,1.,1.]
Y = np.array([2.,3.,4.,5.])
In addition all transformation functions require an origin parameter which specifies if the coordinates are 0 or 1 based. For example in FITS and Fortran, coordinates start from 1, while in Python and C, the index of the first image pixel is (0,0).
outpix=w1.all_pix2sky(inpix,1)
outpix=w1.all_pix2sky(X, Y,1)
dpx = w.det2im(inpix,1)
spx = w.sip_pix2foc(dpx, 1)
lutpx = w.p4_pix2foc(dpx,1)
fpix = dpx + (spx-dpx) +(lutpx-dpx)
wpix = w.wcs_pix2sky(fpix, 1)