Welcome to iraf.net Friday, May 03 2024 @ 09:55 AM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 CRPIX Shifting
   
Nostril585129
 01/21/2009 07:40AM (Read 5197 times)  
+----
Newbie

Status: offline


Registered: 12/09/2008
Posts: 9
I am attempting to use the WCS reference pixels within an image header (CRPIX1 / CRPIX2) in order to help perform an xyxymatch between two images. By using the difference in the WCS reference pixels in both the CRPIX1 and CRPIX2, I was attempting to make a guess for xyxymatch's xin and yin. However, upon fooling around, this is what I have found.While the image shift is always equal in magnitude to the WCS shift, they are always in different directions. The magnitude of their shift vectors will be equal but not their orientation. For Example:[b:4f23490240]Image 1[/b:4f23490240]
[color=red:4f23490240]CRPIX1: 508
CRPIX2: 508[/color:4f23490240]
[color=blue:4f23490240]Test Point X-Coordinate: 817
Test Point Y-Coordinate: 384[/color:4f23490240][b:4f23490240]Image 2[/b:4f23490240]
[color=red:4f23490240]CRPIX1: 519.08
CRPIX2: 517.91[/color:4f23490240]
[color=blue:4f23490240]Test Point X-Coordinate: 831
Test Point Y-Coordinate: 390[/color:4f23490240][b:4f23490240]Total Shifts[/b:4f23490240]
[color=red:4f23490240]CRPIX: 14.87 pixels at 41.8 degrees East of North[/color:4f23490240]
[color=blue:4f23490240]Test Point: 15.23 pixels at 23.2 degrees East of North[/color:4f23490240]I know that the magnitudes are only not equal due to rough test point estimates (larger samples prove the magnitudes to always be near equal), but the degrees are just way off. Is this because CRPIX does not align itself with the x and y coordinates? Does the CRPIX coordinate system shift throughout the night as the sky moves? Does anyone have any suggestions as to how to make xyxymatch work automatically between two images (seeing how xyxymatch needs an initial guess to get the images close before trying to match up stars)?Thanks so much for the help. Everyone here is always a life-saver!
-Mike

 
Profile Email
 Quote
jturner
 01/21/2009 07:40AM  
+++++
Active Member

Status: offline


Registered: 12/29/2005
Posts: 165
Hi Mike,[quote:396990728d="Nostril585129"][b:396990728d]Total Shifts[/b:396990728d]
[color=red:396990728d]CRPIX: 14.87 pixels at 41.8 degrees East of North[/color:396990728d]
[color=blue:396990728d]Test Point: 15.23 pixels at 23.2 degrees East of North[/color:396990728d]I know that the magnitudes are only not equal due to rough test point estimates (larger samples prove the magnitudes to always be near equal), but the degrees are just way off. Is this because CRPIX does not align itself with the x and y coordinates? Does the CRPIX coordinate system shift throughout the night as the sky moves?[/quote:396990728d]
The CRPIX values are the reference pixels for the [b:396990728d]WCS[/b:396990728d] zero point (most likely the pixels corresponding to the nominal RA and Dec for the observation). WCS axes are generally not aligned with x and y but typically RA and Dec. The rotation between world co-ordinates and pixel rows/columns is specified by the keywords CD1_1 etc. CD1_1 is the variation of the first WCS co-ordinate with the first image axis, CD1_2 is the variation of the first WCS co-ordinate with the second image axis and so on. These keywords make up the elements of an affine transformation matrix, but normally there is no skew and the transformation is just a scaling and rotation. You can read more about the WCS representations here: http://fits.gsfc.nasa.gov/fits_wcs.htmlDon't worry about the more complex representations discussed in those papers. If your CTYPE keywords are RA--TAN and DEC--TAN then the transformation is fairly straightforward.Cheers,James.

 
Profile Email
 Quote
jturner
 01/21/2009 07:40AM  
+++++
Active Member

Status: offline


Registered: 12/29/2005
Posts: 165
PS. As you'll see from those papers, sometimes CDELT, CROTA or PC are used instead of CD1_1 etc. It depends on the instrument that wrote the headers, but the CD matrix is what I come across most often.

 
Profile Email
 Quote
Nostril585129
 01/21/2009 07:40AM  
+----
Newbie

Status: offline


Registered: 12/09/2008
Posts: 9
In particular, I'm trying to use CRPIX1 and CRPIX2 in the headers to
determine a rough shift between any two frames and then sending that rough
shift info to IRAF to do a precise mapping with xyxymatch, geomap, etc. If
IRAF gets a good first guess to the actual shift value, it is quite good at
matching the frames. However, I've found that my initial shifts based on CRPIX1/2 alone are sometimes not very good (off by 40 or more pixels).What I am hoping for is a way to tell just from the FITS headers that a
given image should be shifted roughly deltaX pixels in the X direction and
deltaY pixels in the Y direction from a reference image. Is there a best way to get precise pointing info from the headers? Or at least a way to determine pointing offsets between any two frames.Here's what I've noticed in the headers:
RA and DEC don't change between the frames in the dither set.
CD1_1, CD1_2, CD2_1, CD2_2 don't change between the frames either.
CRPIX1 and CRPIX2 change between the frames, but (to me) not in a consistent
way.I'm wondering if TELROT plays into this at all. Do you know the units of
TELROT?Thanks for any help you can throw my way.

 
Profile Email
 Quote
fitz
 01/21/2009 07:40AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
The thing to remember about FITS WCS is that the CRPIX keywords are the image coordinates corresponding to the CRVAL wcs coordinates, i.e. you can only use a difference in CRPIX as an initial shift if the CRVAL keywords are the same between the two images. In general, RA and DEC keywords (and TELROT) come from the telescope control system and have no reliable meaning in the WCS, they could be the telescope pointing, the nominal object position, center of the FOV, etc. CRVAL is the ra/dec at the CRPIX position in the image, the CD matrix represents the scale/rotation as James mentioned. To quickly compute the scale and rotation you can use the equations[code:1:c89f4ff3ca]
scale = 3600. * sqrt ((cd11**2+cd21**2+cd12**2+cd22**2)/2.)
xrot = abs (datan ( cd21, cd11))
yrot = abs (datan (-cd12, cd22))
rot = (xrot + yrot) / 2.0
[/code:1:c89f4ff3ca]This gives a scale in arcsec/pixel and rotation in degrees. If you want to do this the long way you can use these values to determine a pixel shift given the CRVAL/CRPIX in each image.Another method is to use the SKYCTRAN task to compute the ra/dec for a known coordinate, and assuming the rotations are similar, the offset is a simple matter of scale. For example,[code:1:c89f4ff3ca]
print ("1.0 1.0") | skyctran STDIN STDOUT "imgname logical" "imgname world"
[/code:1:c89f4ff3ca]will print the coords of the lower-left corner of an image. Do this for each image, just compute the offset and divide by the scale (in degrees) to get the pixel shift. You can use the central pixel just as easily. Hope this helps.-Mike

 
Profile Email
 Quote
Nostril585129
 01/21/2009 07:40AM  
+----
Newbie

Status: offline


Registered: 12/09/2008
Posts: 9
So I have just found out that the image header's have been written incorrectly all long, so the WCS data is not too useful. Thanks for your help though Mike. I think I'm going to try a different plan of attack Smile

 
Profile Email
 Quote
   
Content generated in: 0.16 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login