IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 27, 2020, 2:21:31 PM (6 years ago)
Author:
tdeboer
Message:

gpc1 dynamic masks set up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_Ghosts.c

    r41348 r41367  
    135135    pmFPAview *view = pmFPAviewAlloc (0);
    136136
    137     GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
     137    //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
     138    float mirCheck = 0;
     139    md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD");
     140    if (!md) { psLogMsg ("psastro", PS_LOG_INFO, "No ghost mirror_rad polynomial found. Assuming old-style ghost masking"); }
     141    if (md) {
     142        GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
     143        mirCheck = 1;
     144    } 
     145
    138146    GET_2D_POLY ("GHOST.CENTER.X", centerX);
    139147    GET_2D_POLY ("GHOST.CENTER.Y", centerY);
     
    143151    GET_1D_POLY ("GHOST.INNER.MAJOR", innerMajor);
    144152    GET_1D_POLY ("GHOST.INNER.MINOR", innerMinor);
     153
    145154
    146155    // select the input astrometry data (also carries the refstars)
     
    153162
    154163    // really error-out here?  or just skip?
    155     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa_ast, recipe)) {
     164    if (!psastroZeroPointFromRecipeGlint (&zeropt, &exptime, &MAX_MAG,NULL, fpa_ast, recipe)) {
    156165        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    157166        goto escape;
     
    201210                        double theta0 = atan2(ref->FP->y,ref->FP->x);
    202211
    203                         double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
    204                         double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad));
    205                         double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad));
    206 
    207                         // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords
    208                         ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
    209                         ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     212                        if(mirCheck) {
     213                            //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
     214                            double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
     215                            double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad));
     216                            double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad));
     217
     218                            // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords
     219                            ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     220                            ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     221                        } 
     222                        if(!mirCheck) {
     223                            //Use the old-style ghost position determination
     224                            ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
     225                            ghost->FP->y = -ref->FP->y + psPolynomial2DEval(centerY, -ref->FP->x, -ref->FP->y);
     226                        }
    210227
    211228                        ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc);
     
    503520  return true;
    504521}
     522
     523
Note: See TracChangeset for help on using the changeset viewer.