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/psastro/src/psastroLoadGhosts.c

    r41348 r41367  
    113113    pmFPAview *view = pmFPAviewAlloc (0);
    114114
    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
    116124    GET_2D_POLY ("GHOST.CENTER.X", centerX);
    117125    GET_2D_POLY ("GHOST.CENTER.Y", centerY);
     
    131139
    132140    // 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)) {
    134142        psError(PSASTRO_ERR_CONFIG, true, "failed to load zeropt data from recipe");
    135143        goto escape;
     
    179187                    ghost->srcFP->y = ref->FP->y;
    180188
    181                     //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
    182189                    double rSrc = hypot (ref->FP->x, ref->FP->y);
    183190                    double theta0 = atan2(ref->FP->y,ref->FP->x);
    184191
    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                    }
    192207
    193208                    ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc);
     
    210225                    ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
    211226                    // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y);
     227
    212228
    213229                    if (ghostChip) {
     
    356372 
    357373  // 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)) {
    359375        psError(PSASTRO_ERR_CONFIG, true, "failed to load zeropt data from recipe");
    360376        goto escape;
Note: See TracChangeset for help on using the changeset viewer.