[AstroPy] (no subject)

JJ Kavelaars jjk at uvic.ca
Sun Jan 17 12:11:20 EST 2016


Hi Dave,

My understanding is that astropy.wcs examines the header for an extended set of keywords to determine which possible WCS functions to build.  

I see that both CD matrix and CROTA are given. So if those are not identical or one of them is incompletely specified you will have trouble.

Are the CD matrix values in your header (sent in message) the only ones that might be WCS related?  Perhaps there are even more WCS keywords, like 'PV' or SIP values, present?  

WCS keywords are sometimes used in different ways by different people and can lead to this sort of problem.   DS9 (often) silently ignores header keywords that don't make sense and I think it falls through to the CD values when those are available. I think, astropy.wcs spits out an error indicating that some keywords in the header made choosing the appropriate form of the WCS function ambiguous or wrong.  

One can tell astropy to try to fix the WCS ( fix=True) or  delete keywords from the header array to remove the ambiguity.


JJ

> On Jan 15, 2016, at 9:53 AM, Dave Lane <dlane at ap.stmarys.ca> wrote:
> 
> Hi,
> 
> I'm having trouble with 'wcs_world2pix' giving the wrong answers for pixel positions (off by about 10 pixels) compared to other software include including that interpreted by ds9 image display. The optical images were plate-solved by pinpoint (from dc3 dreams). I am getting the error:
> 
>    WARNING: FITSFixedWarning: RADECSYS= 'FK5 ' / Equatorial coordinate system
>    RADECSYS is non-standard, use RADESYSa. [astropy.wcs.wcs]
> 
> Any suggestions on how to proceed?
> 
> --- Dave
> 
> --->>>
> 
> A code snipped is as follows:
> 
> import astropy.io.fits
> from astropy import wcs
> import numpy as np
> from phot import aperphot,hms,dms
> imagelist=["/home/bgo/bgoimages/2015-11-09/observations/processed/VXCYG-102453-V.fit"]
> RAtarget=hms("20:57:20.8")
> DECtarget=dms("+40:10:39")
> imagefile=imagelist[1]        # path to the image
> hdulist = astropy.io.fits.open(imagefile)
> w = wcs.WCS(hdulist['PRIMARY'].header)
> world = np.array([[RAtarget, DECtarget]])
> pix = w.wcs_world2pix(world,1)
> print "Pixel Coordinates: ", pix[0,0], pix[0,1]
> radec = w.wcs_pix2world(pix,1)
> print "RADEC Coordinates: ", radec[0,0], radec[0,1]
> observation=aperphot(imagefile, timekey=None, pos=[pix[0,0], pix[0,1]], dap=[10,15,20], resamp=2,retfull=False)
> print "Aperture flux:", observation.phot
> print "Background:   ", observation.bg
> 
> The pertinent header keys are:
> 
> RADECSYS= 'FK5     '           / Equatorial coordinate system
> RA      = '20 57 22.20'        / [hms J2000] Target right ascension
> DEC     = '+40 19 11.0'        / [dms +N J2000] Target declination
> EQUINOX =               2000.0 / Equatorial coordinates are J2000
> EPOCH   =               2000.0 / (incorrect but needed by old programs)
> PA      =   1.29763632687E+000 / [deg, 0-360 CCW] Position angle of plate
> CTYPE1  = 'RA---TAN'           / X-axis coordinate type
> CRVAL1  =   3.14341739025E+002 / X-axis coordinate value
> CRPIX1  =   7.68000000000E+002 / X-axis reference pixel
> CDELT1  =  -2.59534986961E-004 / [deg/pixel] X-axis plate scale
> CROTA1  =  -1.29763632687E+000 / [deg] Roll angle wrt X-axis
> CTYPE2  = 'DEC--TAN'           / Y-axis coordinate type
> CRVAL2  =   4.03127760707E+001 / Y-axis coordinate value
> CRPIX2  =   7.68000000000E+002 / Y-axis reference pixel
> CDELT2  =  -2.59455750274E-004 / [deg/pixel] Y-Axis Plate scale
> CROTA2  =  -1.29763632687E+000 / [deg] Roll angle wrt Y-axis
> CD1_1   =  -2.59468427764E-004 / Change in RA---TAN along X-Axis
> CD1_2   =  -5.87565834781E-006 / Change in RA---TAN along Y-Axis
> CD2_1   =   5.87745274898E-006 / Change in DEC--TAN along X-Axis
> CD2_2   =  -2.59389211397E-004 / Change in DEC--TAN along Y-Axis
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy




More information about the AstroPy mailing list