How to compute distortions for calculating Ra/Dec from pixel coordinates in a fits image ?

67 views
Skip to first unread message

Paul Evangelopoulos

unread,
Jun 17, 2024, 3:09:39 PMJun 17
to astrometry
Hello,

I need to compute ra/dec from pixel position in astrometry.net solved image for use in an app I am building that makes use of the Astrometry.Net api.

By using these formulas that I found in an internet discussion

delta_RA = CD1_1 * (x - CRPIX1) + CD1_2 * (y - CRPIX2)
delta_Dec = CD2_1 * (x - CRPIX1) + CD2_2 * (y - CRPIX2)

RA = CRVAL1 + delta_RA
Dec = CRVAL2 + delta_Dec


I managed to compute coordinates but I noticed that in some cases i.e high declination, the results are incorrect due to calculation inaccuracies.

I need the additional formulas to make these corrections for distortions but I do not know how to proceed.

Also, I tried to include astrometry.net code that makes these corrections in my own program but without success. My app is written in C#.

Do you know how to add the needed corrections (formulas or code) ?

Thank you

Dustin Lang

unread,
Jun 17, 2024, 3:35:15 PMJun 17
to Paul Evangelopoulos, astrometry
That formula is not correct.  The delta-RA,Dec part is correct, those are called "intermediate world coordinates", but then you have to do a projection operation around the CRVAL point.

In the astrometry.net code, we go from pixels to IWC, then IWC to x,y,z unit-sphere coordinates (xyz), then to RA,Dec.

iwc2xyzarr is the projection;

cheers,
dustin


--
You received this message because you are subscribed to the Google Groups "astrometry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to astrometry+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/astrometry/a807e1b5-7148-44cc-a62f-88b44f55e222n%40googlegroups.com.

Paul Evangelopoulos

unread,
Jun 17, 2024, 4:57:30 PMJun 17
to astrometry
Thank you Dustin for your reply!

My understanding is that I must use the following functions to get Ra/Dec from pixel values

void tan_pixelxy2iwc(const tan_t* tan, double px, double py, double *iwcx, double* iwcy)
void tan_iwc2radec(const tan_t* tan, double x, double y, double *p_ra, double *p_dec)

Can you please clarify what is the value of  const tan_t* tan argument ?

Paul

Dustin Lang

unread,
Jun 17, 2024, 5:01:23 PMJun 17
to Paul Evangelopoulos, astrometry
tan_t is the TAN (tangent-plane) WCS header, defined here.

For a typical TAN WCS header, the "anbool sin" would be false - TAN projection rather than SIN.

cheers,
dustin

Paul Evangelopoulos

unread,
Jun 18, 2024, 3:11:43 PMJun 18
to astrometry
Hi Dustin,

I finally managed to port the astrometry code to c# and from some tests that I made so far it works without problem. 

cheers

Paul

Reply all
Reply to author
Forward
0 new messages