-
Notifications
You must be signed in to change notification settings - Fork 1
WorldCoordinateSolution
WorldCoordinateSolution class for creating, interacting with, and solving the paramaters for World Coordinate Solutions for the FITS image standard.
WorldCoordinateSolution()
Default constructor.
WorldCoordinateSolution(JPFITS.FITSHeader header)
Constructor based on an existing FITS image header which contains FITS standard keywords for a WCS solution. Throws an exception if WCS keywords are not found in the specified header.
PointF[] Grid_RightAscensionLabelLocations
Returns an array of PointF locations created within Grid_MakeWCSGrid for printing labels to the window.
PointF[] Grid_DeclinationLabelLocations
Returns an array of PointF locations created within Grid_MakeWCSGrid for printing labels to the window.
string[] Grid_RightAscensionLabels
Returns an array of Right Ascension sexagesimal values for each grid line from Grid_RightAscensionPoints.
string[] Grid_DeclinationLabels
Returns an array of Right Ascension sexagesimal values for each grid line from Grid_RightAscensionPoints.
PointF[][] Grid_RightAscensionPoints
Returns an array of arrays of PointF's each of which represent grid lines at intervals of Right Ascension.
PointF[][] Grid_DeclinationPoints
Returns an array of arrays of PointF's each of which represent grid lines at intervals of Declination.
double[,] CD_Matrix
Gets or Sets the column-major CD matrix for this class instance.
double[,] CD_Matrix_Inverse
Gets the inverse of the CD matrix.
double WCSFitResidual_MeanPix
Gets the mean of the residuals of the WCS solution in pixel units; should be very small as per least squares minimization.
double WCSFitResidual_StdvPix
Gets the standard deviation of the residuals of the WCS solution in pixel units; gives the average WCS solution error in pixels.
double WCSFitResidual_MeanSky
Gets the mean of the residuals of the WCS solution in arcseconds; should be very small as per least squares minimization.
double WCSFitResidual_StdvSky
Gets the standard deviation of the residuals of the WCS solution in arcseconds; gives the average WCS solution error in arcseconds.
void Grid_Invalidate()
Invalidates the existing grid so that it can be updated for new display settings.
double GetCDi_j(int i, int j)
Gets the one-based row-major element from the CD matrix CDi_j[int i, int j], where i is the row index, and j is the column index.
void SetCDi_j(int i, int j, double val)
Sets the one-based row-major element from the CD matrix CDi_j[int i, int j], where i is the row index, and j is the column index.
double[] GetCVALValues(int coordinate_Axis)
Gets the array of coordinate values on one-based axis i used for this World Coordinate Solution.
void SetCVALValues(int coordinate_Axis, double[] cvals)
Sets the array of coordinate values on one-based axis i (Coordinate_Values[i]) used for this World Coordinate Solution.
double[] GetCPIXPixels(int coordinate_Axis)
Gets the array of one-based coordinate pixels on one-based axis n (Coordinate_Pixels[n]) used for this World Coordinate Solution.
void SetCPIXPixels(int coordinate_Axis, double[] cpixs)
Sets the array of one-based coordinate pixels on one-based axis n (Coordinate_Pixels[n]) used for this World Coordinate Solution.
double GetCRVALn(int coordinate_Axis)
Gets the Coordinate Reference Value for the one-based axis n.
void SetCRVALn(int coordinate_Axis, double val)
Sets the Coordinate Reference Value for the one-based axis n.
double GetCRPIXn(int coordinate_Axis)
Gets the one-based Coordinate Reference Pixel for the one-based axis n.
void SetCRPIXn(int coordinate_Axis, double val)
Sets the one-based Coordinate Reference Pixel for the one-based axis n.
double GetCDELTn(int coordinate_Axis)
Gets the world coordinate solution plate scale (arcseconds per pixel) for one-based axis n: CDELTn(int n).
double GetCROTAn(int coordinate_Axis)
Gets the world coordinate solution field rotation (degrees) for one-based axis n: WCSROTn(int n).
string GetCTYPEn(int coordinate_Axis)
Gets the world coordinate solution type for one-based axis n: CTYPEn(int n).
void Solve_WCS(string WCS_Type, double[] X_pix, double[] Y_pix, bool zero_based_pixels, double[] cval1, double[] cval2, JPFITS.FITSHeader header)
Solves the projection parameters for a given list of pixel and coordinate values. Pass nullptr for header
if writing WCS parameters to a primary header not required.
-
WCS_Type
The world coordinate solution type. For example: TAN, for tangent-plane or Gnomic projection. Only TAN is currently supported. -
X_pix
An array of the image x-axis pixel locations. -
Y_pix
An array of the image y-axis pixel locations. -
zero_based_pixels
A boolean to indicate if the X_Pix and Y_Pix are zero-based coordinates. They will be converted to one-based if true. -
cval1
An array of coordinate values in degrees on coordinate axis 1. -
cval2
An array of coordinate values in degrees on coordinate axis 2. -
header
An FITSImageHeader instance to write the solution into. Pass null if not required.
void Get_Pixel(double cval1, double cval2, string WCS_Type, out double X_pix, out double Y_pix, bool return_zero_based_pixels)
Gets the image [x, y] pixel position for a given world coordinate in degrees at cval1 and cval2.
-
cval1
A coordinate values in degrees on coordinate axis 1 (i.e. right ascension). -
cval2
A coordinate values in degrees on coordinate axis 2 (i.e. declination). -
WCS_Type
The type of WCS solution: "TAN" for tangent-plane or Gnomic projection. Only "TAN" supported at this time. -
X_pix
The x-pixel position of the sky coordinate. -
Y_pix
The y-pixel position of the sky coordinate. -
return_zero_based_pixels
If the pixels for the image should be interpreted as zero-based, pass true.
void Get_Pixels(double[] cval1, double[] cval2, string WCS_Type, out double[] X_pix, out double[] Y_pix, bool return_zero_based_pixels)
Gets arrays of image [x, y] pixel positions for a list of given world coordinates in degrees at cval1 and cval2.
-
cval1
An array of coordinate values in degrees on coordinate axis 1. -
cval2
An array of coordinate values in degrees on coordinate axis 2. -
WCS_Type
The type of WCS solution: "TAN" for tangent-plane or Gnomic projection. Only "TAN" supported at this time. -
X_pix
An array of the image x-axis pixel locations. -
Y_pix
An array of the image y-axis pixel locations. -
return_zero_based_pixels
If the pixels for the image should be interpreted as zero-based, pass true.
void Get_Coordinate(double X_pix, double Y_pix, bool zero_based_pixels, string WCS_Type, out double cval1, out double cval2)
Gets the cval1 and cval2 world coordinate in degrees for a given image [x, y] pixel position.
void Get_Coordinate(double X_pix, double Y_pix, bool zero_based_pixels, string WCS_Type, out string cval1_sxgsml, out string cval2_sxgsml)
Gets the cval1 and cval2 world coordinate in sexagesimal for a given image [x, y] pixel position.
void Get_Coordinate(double X_pix, double Y_pix, bool zero_based_pixels, string WCS_Type, out double cval1, out double cval2, out string cval1_sxgsml, out string cval2_sxgsml)
Gets the cval1 and cval2 world coordinate in degrees and sexagesimal for a given image [x, y] pixel position.
void Get_Coordinates(double[] X_pix, double[] Y_pix, bool zero_based_pixels, string WCS_Type, out double[] cval1, out double[] cval2)
Gets arrays of cval1 and cval2 world coordinates in degrees for a list of given image [x, y] pixel positions.
void Get_Coordinates(double[] X_pix, double[] Y_pix, bool zero_based_pixels, string WCS_Type, out string[] cval1_sxgsml, out string[] cval2_sxgsml)
Gets arrays of cval1 and cval2 world coordinates in sexagesimal for a list of given image [x, y] pixel positions.
void Get_Coordinates(double[] X_pix, double[] Y_pix, bool zero_based_pixels, string WCS_Type, out double[] cval1, out double[] cval2, out string[] cval1_sxgsml, out string[] cval2_sxgsml)
Gets arrays of cval1 and cval2 world coordinates in degrees and sexagesimal for a list of given image [x, y] pixel positions.
void CopyFrom(JPFITS.WorldCoordinateSolution wcs_source)
Copy WCS parameters from another WCS solution into the current instance.
void CopyTo(JPFITS.FITSHeader header)
Copy WCS parameters from the current instance into another FITSHeader.
void Clear()
Clear all WCS parameters from this instance.
bool Exists()
Checks if a WCS solution has been computed for this instance.
void Grid_MakeWCSGrid(int imagepixels_width, int imagepixels_height, float xscale, float yscale)
Generates arrays of PointF arrays which represent grid lines in Right Ascension and Declination. The lines are accessed via Grid_RightAscensionPoints and Grid_DeclinationPoints. The sexagesimal labels for each grid line are accessed via Grid_RightAscensionLabels and Grid_DeclinationLabels.
-
imagepixels_width
Image pixels width. -
imagepixels_height
Image pixels height. -
xscale
Window pixels per image pixel. -
yscale
Window pixels per image pixel.
static bool Exists(FITSHeader header, string[] wcs_CTYPEN)
Checks if a WCS solution exists based on the existence of the CTYPE keywords in the primary header of the given FITS object.
-
header
The header to scan for complete FITS standard WCS keywords. -
wcs_CTYPEN
The WCS solution type CTYPE to check for. Only "TAN" supported at this time. Typically both axes utilize the same solution type. For example wcs_CTYPEN = new string[2]{"TAN", "TAN"}
static void Clear(JPFITS.FITSHeader header)
Clears the WCS keywords from the header.
static void SexagesimalElementsToDegreeElements(string ra_sexa, string dec_sexa, string delimit, out double ra_deg, out double dec_deg)
Convert sexagesimal coordinate elements to degree units, with possibly arbitrary scale delimitters.
-
ra_sexa
The right ascension in sexagesimal format. -
dec_sexa
The declination in sexagesimal format. -
delimit
If the scale delimiter is known then pass it (fast), otherwise it will be arbitrarily determined at each scale separation by passing an empty string (slower). -
ra_deg
Return parameter for right ascension in degrees. -
dec_deg
Return parameter for declination in degrees.
static void SexagesimalLineToDegreeElements(string line, out double ra_deg, out double dec_deg)
Convert sexigesimal coordinates found in the first two columns of a String line into degree coordinate units.
-
line
A String line whose first two columns contain sexagesimal coordinates. -
ra_deg
Return parameter for right ascension in degrees. -
dec_deg
Return parameter for declination in degrees.
static void SexagesimalFileToDegreeFile(string file, bool saveDegreeFile, out double[] raDeg, out double[] decDeg)
Open a file whose first two columns are sexagesimal entries with any formatting, and optionally save the file as a new file with a SaveFileDialog and return the coordinate columns as arrays in degree units.
-
file
The full path of the textual file to open, to scan the first two columns for sexagesimal entries. -
saveDegreeFile
True to be given a SaveFileDialog to save a new file with just the two coordinate columns in degree units; False to not save a file. -
raDeg
A declared array for the RA coordinates in degrees. The array will be initialized internally to the appropriate size. The user may not require this array, but it still must be supplied. -
decDeg
A declared array for the Declination coordinates in degrees. The array will be initialized internally to the appropriate size. The user may not require this array, but it still must be supplied.
static void DegreeElementstoSexagesimalElements(double ra_deg, double dec_deg, out string ra_sexa, out string dec_sexa, string delimitter, int decimals)
Convert degree coordinate elements to sexagesimal format.
-
ra_deg
Right ascension in degrees. -
dec_deg
Declination in degrees. -
ra_sexa
The right ascension in sexagesimal format, returned as a String. -
dec_sexa
The declination in sexagesimal format, returned as a String. -
delimitter
The scale delimiter; if an empty String is passed then a colon will be used.
static void DegreeLineToSexagesimalElements(string line, out string ra_sexa, out string dec_sexa, string delimitter, int decimals)
Convert degree coordinates found in the first two columns of a String line into sexagesimal coordinate format.
-
line
A String line whose first two columns contain degree unit coordinates. -
ra_sexa
The right ascension in sexagesimal format, returned as a String. -
dec_sexa
The declination in sexagesimal format, returned as a String. -
delimiter
The scale delimiter; if an empty String is passed then a colon will be used.
static void DegreeFileToSexagesimalFile(string file, bool saveSexigesimalFile, out string[] raSexagesimal, out string[] decSexagesimal, string delimitter, int decimals)
Open a file whose first two columns are degree entries, and optionally save the file as a new file with a SaveFileDialog and return the coordinate columns as arrays in sexigesimal coordinate format.
-
file
The full path of the textual file to open, to scan the first two columns for degree unit entries. -
saveSexigesimalFile
True to be given a SaveFileDialog to save a new file with just the two coordinate columns; False to not save a file. -
raSexagesimal
A declared array for the RA coordinates in sexagesimal format. The array will be initialized internally to the appropriate size. The user may not require this array, but it still must be supplied. -
decSexagesimal
A declared array for the Declination coordinates in sexagesimal format. The array will be initialized internally to the appropriate size. The user may not require this array, but it still must be supplied. -
delimitter
The scale delimiter; if an empty String is passed then a colon will be used.