Changeset 41367 for trunk/psastro/src/psastroLoadGhosts.c
- Timestamp:
- May 27, 2020, 2:21:31 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroLoadGhosts.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroLoadGhosts.c
r41348 r41367 113 113 pmFPAview *view = pmFPAviewAlloc (0); 114 114 115 GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad); 115 //We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists 116 float mirCheck = 0; 117 md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD"); 118 if (!md) { psLogMsg ("psastro", PS_LOG_INFO, "No ghost mirror_rad polynomial found. Assuming old-style ghost masking"); } 119 if (md) { 120 GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad); 121 mirCheck = 1; 122 } 123 116 124 GET_2D_POLY ("GHOST.CENTER.X", centerX); 117 125 GET_2D_POLY ("GHOST.CENTER.Y", centerY); … … 131 139 132 140 // raise an error if the config is broken 133 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa, recipe)) {141 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, NULL, fpa, recipe)) { 134 142 psError(PSASTRO_ERR_CONFIG, true, "failed to load zeropt data from recipe"); 135 143 goto escape; … … 179 187 ghost->srcFP->y = ref->FP->y; 180 188 181 //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle182 189 double rSrc = hypot (ref->FP->x, ref->FP->y); 183 190 double theta0 = atan2(ref->FP->y,ref->FP->x); 184 191 185 double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc); 186 double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad)); 187 double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad)); 188 189 // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords 190 ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 191 ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 192 if(mirCheck) { 193 //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle 194 double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc); 195 double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad)); 196 double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad)); 197 198 // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords 199 ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 200 ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 201 } 202 if(!mirCheck) { 203 //Use the old-style ghost position determination 204 ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y); 205 ghost->FP->y = -ref->FP->y + psPolynomial2DEval(centerY, -ref->FP->x, -ref->FP->y); 206 } 192 207 193 208 ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc); … … 210 225 ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y); 211 226 // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y); 227 212 228 213 229 if (ghostChip) { … … 356 372 357 373 // if a filter is defined, but the recipe elements are missing, the config is broken. 358 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa, recipe)) {374 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, NULL, fpa, recipe)) { 359 375 psError(PSASTRO_ERR_CONFIG, true, "failed to load zeropt data from recipe"); 360 376 goto escape;
Note:
See TracChangeset
for help on using the changeset viewer.
