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