Welcome to iraf.net Friday, April 26 2024 @ 04:57 AM GMT


 Forum Index > Help Desk > Misc New Topic Post Reply
 calculating with WCS keywords...
   
Arp
 02/04/2011 09:54AM (Read 2990 times)  
++---
Junior

Status: offline


Registered: 06/15/2009
Posts: 34
Hello,I am writing a program in java, and as a part of it, I want to calculate pixel coordinates, based on wcs header keywords.
So, I got the rotation matrix CD11 CD12 CD21 CD22 already calculated and saved in the header by another program.
Now I want to use these, the CV and CR values to calculate which pixel coordinates a given ra, dec coordinate has.
to understand it: I denote the rotation matrix bya b = CD11 CD12
c d CD21 CD22
and the keywords are:CV1 = CRVAL1
CV2 = CRVAL2
CR1 = CRPIX1
CR2 = CRPIX2I got the following equation:
x = (d(ra-CV1) - b(dec-CV2) + CR1)/(ad-bc)
y = (-c(ra-CV1) + a(dec-CV2) + CR2)/(ad-bc)I guess the equation should be right. I tested this, but the calculation does not yield the same pixels as DS9. It is right if I enter the CV values, then I correctly get the CR values as the result. But the further I move away from that point, the greater the error in the calculation gets.
I think it might be projection related, but I cant really put my finger on it.
Does somebody know by chance whats wrong?
thx.

 
Profile Email
 Quote
fitz
 02/04/2011 09:54AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
If astrometry were that easy everyone would be doing it 8-) Your equation leaves out all the fun parts of spherical trigonometry and even for a simple TAN projection it makes sense the answers diverge the farther you get from the reference pixel.Google around for the "AST Library" from Starlink as one library to use for doing WCS in Java, there may be others as well (e.g. WCSTOOLS from SAO is a C-based library you might be able to use).

 
Profile Email
 Quote
   
Content generated in: 0.10 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