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