# Celestial coordinates of every pixel in the image

I am solving starfield using Astrometry.net, an amazing piece of software I must say. After solving the starfield, Astrometry gives celestial coordinates of centroids of every star in the image, as well as celestial coordinates of those stars from the catalog. Therefore, it can be easily calculated on sky separation between stars in the image and stars in the catalog which can be used to calculate average solving accuracy. However, I would like to know what is the precision of mapping one particular pixel in the image, where no star can be found. I have its coords from Astrometry.net, but I don't have reference coordinates for that pixel from the catalog. Is it possible to know the position of every pixel from the catalog? Does someone have the same problem/task to solve? How would you calculate the average solving accuracy for some random pixel, or in my case, the accuracy of mapping the central pixel in the image?

• If you need just the accuracy, you could compute coordinates for adjacent pixels and estimate? Here are some long answers re converting pixels to coordinates: photo.stackexchange.com/questions/6111/… Jun 13, 2022 at 13:54
• I have coorrdinates for every pixel, which Astrometry.net estimate using star locations. But there is no reference coordinates for those pixels. Thanks for the link, I will look into it. Jun 13, 2022 at 15:50
• OK, I'm missing something: you have coordinates, but not reference coordinates? Jun 14, 2022 at 16:09
• That is true. Astrometry.net gives coordinates interpolated from the coordinates of the stars in the image, therefore for pixels with stars, I have both coordinates, estimated from astrometry and true from catalog. But I don't have reference coordinates for other pixels. And I would like to measure Astrometry.net accuracy of mapping coordinates to the central pixel - center of camera FoV Jun 14, 2022 at 22:12
• @barrycarter I assume that by "reference coordinates" Falco means celestial coordinates (right ascension and declination), while "coordinates for every pixel" means pixel coordinates $x,y =$ (column number, row number) on the image. Jun 15, 2022 at 12:10

What you probably want is the information stored in the WCS header keywords, which are in the wcs.fits table file that astronometry.net generates; it's one of the available downloads on the Results page. (I'm assuming you're using the web interface, but I imagine it's generated by the command-line version of the code, too.)

The relevant keywords that define the "reference pixel" for the image are:

CRPIX1 = image x-coordinate of reference pixel
CRPIX2 = image y-coordinate of reference pixel
CRVAL1 = right ascension in decimal degrees of reference pixel
CRVAL2 = declination in decimal degrees of reference pixel


(Note that in the "Advanced" section of the upload page, you can specify your own desired reference pixel (CRPIX1,CRPIX2) coordinates, in case you want something other than the somewhat arbitrary values that astronmetry.net determines.)

You also need the transformation ("CD") matrix values, which include the effects of both pixel scale and rotation: CD1_1, CD1_2, CD2_1, CD2_2 .

In principle, to compute the celestial coordinates of any pixel $$(x,y)$$, you would do

RA = CRVAL1 + delta_RA
Dec = CRVAL2 + delta_Dec


where the offset values are computed as

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


This is the basic version of WCS computation; higher-order terms can provide better accuracy, especially over a wide field of view. I think astrometry.net includes "SIP distortions" keywords in wcs.fits, which will improve the accuracy, but I'm not familiar with the associated computations. If you really want the extra accuracy, it's probably best to use something like the WCS code in astropy.

To estimate the accuracy, the thing to do would probably to use the pixel coordinates of the stars with known "reference" coordinates (i.e., true RA,Dec) to compute predicted RA,Dec using the WCS parameters, and compare the predicted values to the known values.

• Thank you for your thorough answer, it is a great sum up. Meanwhile, all the steps you mentioned, I am already doing. I familiarize myself with Astrometry.net output, .wcs solution, as well as with .corr file. Maybe I should be using different terminology, my question would be more clear. Anyway, by reference coordinates, I mean true RADec, and those coords can be obtained from the catalog(or index files), but only for the stars. Using the Astrometry .wcs file, and astropy's all_pix2world() function, I can convert any pixel position to a celestial coordinate. Or using CD__ as you described. Jun 19, 2022 at 8:52
• My procedure for estimating solving accuracy is the same as you describe. Once I get from astrometry predicted celestial coords, I can calculate the separation(great circle distance) between that estimated coordinate of a star and the true coordinate(from the catalog, or index file). If I do that for all the detected stars, I can get the average distance between the true and predicted coordinates. And that is fine for now. Jun 19, 2022 at 8:53
• But, what if my starfield only contains stars in one part of the image, but I need coordinates for the whole image? Astrometry would still provide celestial coords for all pixels, but the problem is that for the pixels where are no stars, we don't have true coordinates. And mapping on those pixels could be terrible(extrapolation problem). And then, how to estimate mapping accuracy for those pixels, where we don't have stars(true coordinates)? Jun 19, 2022 at 8:53
• The best you can really do is assume the mean accuracy for the stellar coordinates applies to the whole image. (If you have lots of stars, you could try making maps of the 2D variation in the accuracy -- maybe one side of the image has larger errors in RA than the other -- but that's probably overkill.) Jun 21, 2022 at 15:12