pmAstrometryObjects.h

Go to the documentation of this file.
00001 /** @file  pmAstrometryObjects.h
00002 *
00003 *  @brief This file defines the basic types for matching objects
00004 *  based on their astrometry.
00005 *
00006 *  @ingroup AstroImage
00007 *
00008 *  @author EAM, IfA
00009 *
00010 *  @version $Revision: 1.1 $ $Name: rel9_1 $
00011 *  @date $Date: 2005/12/05 20:49:30 $
00012 *
00013 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00014 */
00015 
00016 #if !defined(PM_ASTROMETRYOBJECTS_H)
00017 #define PM_PM_ASTROMETRYOBJECTS_H_H
00018 
00019 # include <stdio.h>
00020 # include <strings.h>  // for strcasecmp
00021 # include <unistd.h>   // for unlink
00022 # include <pslib.h>
00023 # include <pmAstrometry.h>
00024 
00025 /*
00026  * 
00027  * This structure specifies the coordinate of the detection in each of the
00028  * four necessary coordinate frames: pix defines the position in the psReadout
00029  * frame, FP defines the position in the Focal Plane frame, TP defines the
00030  * position in the Tangent Plane frame, sky defines the position on the Celestial
00031  * Sphere. In addition, a measurement of the brightness is given by the element
00032  * Mag. Such a data structure should be used for both the raw and the reference
00033  * stars. In astrometric processing, the raw detections will be projected using
00034  * the best available information to each of these coordinate frames from the pix
00035  * coordinates, while the reference detections will be projected to the other
00036  * frames from the sky coordinates.
00037  * 
00038  * XXX: There are more members here than in the SDRS.
00039  * 
00040  */
00041 typedef struct
00042 {
00043     psPlane pix;                        ///< the position in the pmReadout frame
00044     psPlane cell;                       ///< the position in the pmCell frame
00045     psPlane chip;                       ///< the position in the pmChip frame
00046     psPlane FP;                         ///< the position in the pmFPA frame
00047     psPlane TP;                         ///< the position in the tangent plane
00048     psSphere sky;                       ///< the position on the Celestial Sphere.
00049     double Mag;                         ///< A measurement of the brightness.
00050     double dMag;                        ///< What is this?
00051 }
00052 pmAstromObj;
00053 
00054 
00055 
00056 /*
00057  * 
00058  * The pmAstromMatch structure defines the cross-correlation between two
00059  * arrays. A single such data item specifies that item number pmAstromMatch.idx1
00060  * in the first list corresponds to pmAstromMatch.idx2 in the second list.
00061  * 
00062  */
00063 typedef struct
00064 {
00065     int i1;                             ///< What is this?
00066     int i2;                             ///< What is this?
00067 }
00068 pmAstromMatch;
00069 
00070 
00071 /*
00072  * 
00073  * XXX: Not in SDRS.
00074  * 
00075  */
00076 typedef struct
00077 {
00078     psPlane center;                     ///<
00079     psPlane offset;                     ///<
00080     double  angle;                      ///<
00081     double  minMetric;                  ///<
00082     double  minVar;                     ///<
00083     int     nMatch;                     ///<
00084 }
00085 pmAstromStats;
00086 
00087 
00088 
00089 /*
00090  * 
00091  * If the two sets of coordinates are expected to agree very well (ie, the
00092  * current best-guess astrometric solution is quite close to the radius. The
00093  * following function accepts two sets of pmAstromObj sources and determines the
00094  * matched objects between the two lists. The input sources must have been
00095  * projected to the Focal Plane coordinates (pmAstromObj.FP), and the supplied
00096  * options entry must contain the desired match radius (keyword:
00097  * ASTROM.MATCH.RADIUS). The output consists an array of pmAstromMatch values,
00098  * defined below.
00099  * 
00100  */
00101 psArray *pmAstromRadiusMatch(
00102     psArray *st1,
00103     psArray *st2,
00104     psMetadata *config
00105 );
00106 
00107 
00108 
00109 /*
00110  * 
00111  * This function accepts an array of pmAstromObj objects and rotates them by
00112  * the given angle about the given center coordinate pCenter,qCenter in the Focal
00113  * Plane Array coordinates.
00114  * 
00115  * XXX: This differs from the SDRS
00116  * 
00117  */
00118 /* SDRS
00119 psArray *pmAstromRotateObj(
00120     psArray *old,
00121     double angle,
00122     double pCenter,
00123     double qCenter
00124 );
00125 */
00126 psArray *pmAstromRotateObj(
00127     psArray *old,
00128     psPlane center,
00129     double angle
00130 );
00131 
00132 
00133 /*
00134  * 
00135  * If the two sets of coordinates are not known to agree well, but the
00136  * relative scale and approximate relative rotation is known, then a much faster
00137  * match can be found using pair-pair displacements. In such a case, the two
00138  * lists can be considered as having the same coordinate system, with an unknown
00139  * relative displacement. In this algorithm, all possible pair-wise differences
00140  * between the source positions in the two lists are constructed and accumulated
00141  * in a grid of possible offset values. The resulting grid is searched for a
00142  * cluster representing the offset between the two input lists. This algorithm
00143  * can only tolerate a small error in the relative scale or the relative rotation
00144  * of the two coordinate lists. However, this process is naturally O(N2), and is
00145  * thus advantageous over triangle matching in some circumstances. This process
00146  * can be extended to allow a larger uncertainty in the relative rotation by
00147  * allowing the procedure to scan over a range of rotations. We define the
00148  * following function to apply this matching algorithm:
00149  * 
00150  * XXX: In the SDRS, this function is a pointer.
00151  * 
00152  */
00153 pmAstromStats pmAstromGridMatch(
00154     psArray *st1,
00155     psArray *st2,
00156     psMetadata *config
00157 );
00158 
00159 
00160 /*
00161  * 
00162  * The result of a pmAstromGridMatch may be used to modify the astrometry
00163  * transformation information for a pmFPA image hierarchy structure. The result
00164  * of pmAstromGridMatch defines the adjustments which should be made to the
00165  * reference coordinate of the projection (pmFPA.projection.R,D) and the
00166  * effective rotation of the Focal Plane.  The rotation implies modification of
00167  * the linear terms of the pmFPA.toTangentPlane transformation. These two
00168  * adjustments are made using the function:
00169  * 
00170  * XXX: This function name is different in the SDRS.
00171  * 
00172  */
00173 psPlaneTransform *pmAstromGridApply(
00174     psPlaneTransform *map,
00175     pmAstromStats stat
00176 );
00177 
00178 
00179 /*
00180  * 
00181  * This function is identical to pmAstromGridMatch, but is valid for only a
00182  * single relative rotation. The input config information need not contain any of
00183  * the GRID.*.ANGLE entries (they will be ignored).
00184  * 
00185  * XXX: This function name is different in the SDRS.
00186  * 
00187  */
00188 /* in pmAstromGrid.c */
00189 pmAstromStats pmAstromGridAngle(
00190     psArray *st1,
00191     psArray *st2,
00192     psMetadata *config);
00193 
00194 
00195 
00196 /*
00197  * 
00198  * This function accepts the raw and reference source lists and the list of
00199  * matched entries. It uses the matched list to determine a polynomial
00200  * transformation between the two coordinate systems. The fitting uses clipping
00201  * to exclude outliers, likely representing poor matches. The config element must
00202  * contain the information ASTROM.NSIGMA (specifying the number of sigma used in
00203  * the clipping) and ASTROM.NCLIP (specifying the number of clipping iterations
00204  * must be performed). The config element must also specify the order of the
00205  * polynomial fit (keyword: ASTROM.ORDER). The result of this fit is a set of
00206  * modifications of the components of the pmFPA.toTangentPlane transformation,
00207  * and the modifications of the reference coordinate of the projection
00208  * (pmFPA.projection.R,D) and the projection scale (pmFPA.projection.Xs,Ys). The
00209  * modifications to pmFPA.toTangentPlane incorporate the rotation component of
00210  * the linear terms and the higher-order terms of the polynomial fits.
00211  * 
00212  * XXX: No prototype code.
00213  * 
00214  */
00215 bool pmAstromFitFPA(
00216     pmFPA *fpa,
00217     psArray *st1,
00218     psArray *st2,
00219     psArray *match,
00220     psMetadata *config
00221 );
00222 
00223 
00224 
00225 /*
00226  *
00227  * This function accepts the raw and reference source lists for a single chip
00228  * and the list of matched entries. It uses the matched list to determine a
00229  * polynomial transformation between the two coordinate systems. The fitting
00230  * uses clipping to exclude outliers, likely representing poor matches. The
00231  * config element must contain the information ASTROM.NSIGMA
00232  *(specifying the number of sigma used in the clipping) and ASTROM.NCLIP
00233  *(specifying the number of clipping iterations must be performed). The config
00234  *element must also specify the order of the polynomial fit (keyword:
00235  *ASTROM.ORDER).  The result of this fit is a set of modifications of the
00236  *components of the pmChip.toFPA transformation.
00237  * 
00238  * XXX: No prototype code.
00239  * 
00240  */
00241 bool pmAstromFitChip(
00242     pmFPA *fpa,
00243     psArray *st1,
00244     psArray *st2,
00245     psArray *match,
00246     psMetadata *config
00247 );
00248 
00249 
00250 /*
00251  * 
00252  * The following function determines the position residual, in the tangent
00253  * plane, as a function of position in the focal plane, for a collection of raw
00254  * measurements and matched reference stars. The configuration data must include
00255  * the bin size over which the gradient is measured (keyword: ASTROM.GRAD.BOX).
00256  * The function returns an array of pmAstromGradient structures, defined below.
00257  * 
00258  * XXX: No prototype code.
00259  * 
00260  */
00261 psArray pmAstromMeasureGradients(
00262     psArray *starlist1,
00263     psArray *starlist2,
00264     psArray *match,
00265     psMetadata *config
00266 );
00267 
00268 
00269 
00270 /*
00271  * 
00272  * The following data structure carries the information about the residual
00273  * gradient of source positions in the tangent plane (pmAstromObj.TP) as a
00274  * function of position in the focal plane (pmAstromObj.FP).
00275  * 
00276  */
00277 typedef struct
00278 {
00279     psPlane FP;
00280     psPlane dTPdL;
00281     psPlane dTPdM;
00282 }
00283 pmAstromGradient;
00284 
00285 
00286 /*
00287  * 
00288  * The gradient set measured above can be fitted with a pair of 2D
00289  * polynomials. The resulting fits can then be related back to the implied
00290  * polynomials which represent the distortion. The following function performs
00291  * the fit and applies the result to the distortion transformation of the
00292  * supplied pmFPA structure. The configuration variable supplies the polynomial
00293  * order (keyword: ASTROM.DISTORT.ORDER).
00294  * 
00295  * XXX: No prototype code.
00296  * 
00297  */
00298 psArray pmAstromFitDistortion(
00299     pmFPA *fpa,
00300     psArray *gradients,
00301     psMetadata *config);
00302 
00303 
00304 
00305 
00306 
00307 /*******************************************************************************
00308  The following functions and structs were in the prototype code, but not the
00309  SDRS.
00310  ******************************************************************************/
00311 /*
00312  * 
00313  * 
00314  * 
00315  * 
00316  */
00317 
00318 
00319 /*
00320  * 
00321  * Allocates a pmAstromObj struct.
00322  * 
00323  */
00324 pmAstromObj *pmAstromObjAlloc (void);
00325 
00326 
00327 
00328 /*
00329  * 
00330  * Copies a pmAstromObj struct.
00331  * 
00332  */
00333 pmAstromObj *pmAstromObjCopy(
00334     pmAstromObj *old
00335 );
00336 
00337 
00338 
00339 /*
00340  * 
00341  * 
00342  * 
00343  */
00344 pmAstromMatch *pmAstromMatchAlloc(
00345     int i1,
00346     int i2
00347 );
00348 
00349 
00350 
00351 
00352 /*
00353  * 
00354  * 
00355  * 
00356  */
00357 psPlaneTransform *pmAstromMatchFit(
00358     psPlaneTransform *map,
00359     psArray *st1,
00360     psArray *st2,
00361     psArray *match,
00362     psMetadata *config
00363 );
00364 
00365 
00366 
00367 /*
00368  * 
00369  * 
00370  * 
00371  */
00372 int pmAstromObjSortByFPX(
00373     const void **a,
00374     const void **b
00375 );
00376 
00377 
00378 
00379 /*
00380  * 
00381  * 
00382  * 
00383  */
00384 int pmAstromObjSortByMag(
00385     const void **a,
00386     const void **b
00387 );
00388 
00389 #endif
00390 

Generated on Tue Dec 13 13:38:22 2005 for Pan-STARRS Module Library by  doxygen 1.4.5