PJSR alpha, delta

Enzo De Bernardini

PixInsight Ambassador
Hello,

Is there a PJSR method to get the equatorial celestial coordinates (RA, Dec) of a arbitrary point in a solved image?

I did analyzed some scripts (like AnnotateImage) but they are much more complex than I'm looking for, and I can't quite understand how the values are obtained.

Best regards,

Enzo.
 
Hi Enzo,

The following methods of the ImageWindow object will allow you to convert image coordinates to celestial coordinates and vice versa. Of course, the image window object for which you call these methods must have a valid astrometric solution.

Point ImageWindow.imageToCelestial( Point xy )

Returns a Point object p such that p.x and p.y are, respectively, the right ascension and the declination coordinates corresponding to the specified xy image coordinates in pixels. The returned coordinates are expressed in degrees.

Point ImageWindow.imageToCelestial( Number x, Number y )

This function is equivalent to the above one, but the input image coordinates are specified as two separate scalars x and y.

Array ImageWindow.imageToCelestial( Array xy )

Returns an Array of celestial coordinates corresponding to the specified input list of image coordinates xy. Output coordinates are expressed in degrees. This function makes use of all logical processors available to the core PixInsight application to compute celestial coordinates using multiple concurrent execution threads.

The specified xy array is a sequence of x,y image coordinates in pixel units: x0,y0,x1,y1,...,xN-1,yN-1. The output array is a sequence a0,d0,a1,d1,...,aN-1,dN-1, where ai and di are the right ascension and declination coordinates in degrees corresponding to point xi,yi in image coordinates.

Array ImageWindow.imageToCelestial( Array x, Array y )

This function is equivalent to the previous one, but input image coordinates are specified as two separate arrays x and y.


For the reverse conversion from celestial to image coordinates, the following functions are available:

Point ImageWindow.celestialToImage( Point eqDeg )
Point ImageWindow.celestialToImage( Number alphaDeg, Number deltaDeg )
Array ImageWindow.celestialToImage( Array eqDeg )
Array ImageWindow.celestialToImage( Array alphaDeg, Array deltaDeg )


Each of these functions corresponds to its imageToCelestial counterpart. Input celestial coordinates are expected to be expressed in degrees, and output image coordinates are expressed in pixels.


For completeness, the rest of methods available to control astrometric solutions from JavaScript are the following:

String ImageWindow.astrometricSolutionSummary()

Returns a complete summary of the astrometric solution for an image as plain text in human readable form.

void ImageWindow.clearAstrometricSolution()

Destroys and clears the astrometric solution for an image, if it exists.

void ImageWindow.copyAstrometricSolution( ImageWindow source )

Copies the astrometric solution from the specified source image.

void ImageWindow.setAstrometricSolution( Array keywords, ByteArray controlPoints )

Generates a new astrometric solution using the specified array of FITS header keywords and set of control points, in the format supported by the standard ImageSolver script. Refer to the ImageSolver script for detailed information on the required format for the controlPoints data set.

void ImageWindow.updateAstrometryMetadata()

Regenerates the required XISF image properties and FITS header keywords to support the existing astrometric solution in this image.
 
Back
Top