IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41348


Ignore:
Timestamp:
Apr 28, 2020, 1:26:07 PM (6 years ago)
Author:
tdeboer
Message:

gpc2 dynamic masking set up

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/gpc2/ghost.model.mdc

    r41339 r41348  
    11# TdB20200327 ghost model fit for gpc2
     2
     3# These are the original linear solutions for gpc1
     4GHOST.MIRROR.RAD METADATA
     5  NORDER_X S32 1
     6  VAL_X00  F64 -412.2283909
     7  VAL_X01  F64 2.07619288
     8  NELEMENTS  S32 2
     9END
     10
    211GHOST.CENTER.X METADATA
    312  NORDER_X S32 3
    413  NORDER_Y S32 3
    5   VAL_X00_Y00  F64 -1.15871916e+02
    6   VAL_X01_Y00  F64  4.09678844e-02
    7   VAL_X02_Y00  F64  2.83256020e-08
    8   VAL_X03_Y00  F64  5.83797628e-11
    9   VAL_X00_Y01  F64  2.14720353e-03
    10   VAL_X01_Y01  F64 -2.07766141e-07
    11   VAL_X02_Y01  F64  2.45261797e-12
    12   VAL_X00_Y02  F64  2.45187527e-07
    13   VAL_X01_Y02  F64  1.24779721e-10
    14   VAL_X00_Y03  F64  4.74932940e-12
     14  VAL_X00_Y00  F64  2.03112383e+01
     15  VAL_X01_Y00  F64 -1.65708159e-02
     16  VAL_X02_Y00  F64  1.43129504e-07
     17  VAL_X03_Y00  F64  4.52735266e-11
     18  VAL_X00_Y01  F64  4.26192254e-03
     19  VAL_X01_Y01  F64  6.66469973e-08
     20  VAL_X02_Y01  F64 -1.33859987e-11
     21  VAL_X00_Y02  F64  2.34527886e-07
     22  VAL_X01_Y02  F64  6.81385407e-11
     23  VAL_X00_Y03  F64 -1.01627226e-11
    1524  NELEMENTS  S32 10
    1625END
     
    1928  NORDER_X S32 3
    2029  NORDER_Y S32 3
    21   VAL_X00_Y00  F64  4.06137992e+01
    22   VAL_X01_Y00  F64 -3.89362940e-02
    23   VAL_X02_Y00  F64 -2.22548205e-07
    24   VAL_X03_Y00  F64  8.83360295e-11
    25   VAL_X00_Y01  F64 -2.50474486e-03
    26   VAL_X01_Y01  F64  3.37661246e-07
    27   VAL_X02_Y01  F64  1.76755513e-10
    28   VAL_X00_Y02  F64  1.92636172e-07
    29   VAL_X01_Y02  F64 -6.90714499e-12
    30   VAL_X00_Y03  F64  1.45561098e-10
     30  VAL_X00_Y00  F64 -3.07632661e+02
     31  VAL_X01_Y00  F64 -1.70554450e-03
     32  VAL_X02_Y00  F64  9.68642857e-08
     33  VAL_X03_Y00  F64 -4.93941120e-12
     34  VAL_X00_Y01  F64 -1.59277258e-02
     35  VAL_X01_Y01  F64  5.50875919e-08
     36  VAL_X02_Y01  F64  5.61297596e-11
     37  VAL_X00_Y02  F64  1.12248583e-07
     38  VAL_X01_Y02  F64  2.87924055e-11
     39  VAL_X00_Y03  F64  4.50177026e-11
    3140  NELEMENTS  S32 10
    3241END
    3342
    34 
    35 # These are the original linear solutions
     43# These are the original linear solutions for gpc1
    3644GHOST.INNER.MAJOR METADATA
    3745  NORDER_X S32 1
  • trunk/ippconfig/gpc2/psastro.config

    r41338 r41348  
    6262
    6363# XXX Test for taurus
    64 PSASTRO.GRID.MIN.SIGMA  F32  5.0
     64PSASTRO.GRID.MIN.SIGMA  F32  1.0
    6565PSASTRO.IGNORE          STR  SATURATED,CRLIMIT,DEFECT,BLEND,FAIL
    6666
     
    174174  ZEROPT   F32 26.3
    175175  PHOTCODE STR r
    176   GHOST_MAX_MAG                   F32 -23.0
     176  GHOST_MAX_MAG                   F32 -23.5
    177177END
    178178
    179179REFSTAR_MASK                    BOOL TRUE
    180 REFSTAR_MASK_MAX_MAG            F32 -15.0
     180REFSTAR_MASK_MAX_MAG            F32 -16.0
    181181REFSTAR_MASK_SATSTAR_MAG_MAX    F32 -15.0
    182182REFSTAR_MASK_SATSTAR_MAG_SLOPE  F32  10.15
     
    237237GLINT_ANGLE_POS_SLOPE           F32  0.07903 
    238238GLINT_ANGLE_POS_REF             F32 -575.5
    239 GLINT_WIDTH                     F32  30.0
     239GLINT_WIDTH                     F32  60.0
    240240
    241241# save glint positions?
     
    251251
    252252GLINT.REGION                    METADATA
    253   REGION                        STR  [-38000:-24000,-20000:+20000]
     253  REGION                        STR  [-38000:-25000,-20000:+20000]
    254254  GLINT.TYPE                    STR  LEFT
    255255END
    256256
    257257GLINT.REGION                    METADATA
    258   REGION                        STR  [+24000:+38000,-20000:+20000]
     258  REGION                        STR  [+25000:+38000,-20000:+20000]
    259259  GLINT.TYPE                    STR  RIGHT
    260260END
    261261
    262262GLINT.REGION                    METADATA
    263   REGION                        STR  [-20000:+20000,+24000:+38000:]
     263  REGION                        STR  [-20000:+20000,+25000:+38000:]
    264264  GLINT.TYPE                    STR  TOP
    265265END
    266266
    267267GLINT.REGION                    METADATA
    268   REGION                        STR  [-20000:+20000,-38000:-24000]
     268  REGION                        STR  [-20000:+20000,-38000:-25000]
    269269  GLINT.TYPE                    STR  BOTTOM
    270270END
  • trunk/psModules/src/objects/pmSourceIO.c

    r41338 r41348  
    810810    pmSourceIO_WriteMatchedRefs (file->fits, file->fpa, config);
    811811    pmSourceIO_WriteGlints (file->fits, file->fpa, config);
     812    pmSourceIO_WriteGhosts (file->fits, file->fpa, config);
    812813    return true;
    813814}
  • trunk/psModules/src/objects/pmSourceIO.h

    r41338 r41348  
    9292
    9393bool pmSourceIO_WriteGlints (psFits *fits, pmFPA *fpa, pmConfig *config);
     94bool pmSourceIO_WriteGhosts (psFits *fits, pmFPA *fpa, pmConfig *config);
    9495
    9596/// @}
  • trunk/psModules/src/objects/pmSourceIO_Ghosts.c

    r41339 r41348  
    104104    psPolynomial2D *centerX = NULL;
    105105    psPolynomial2D *centerY = NULL;
     106    psPolynomial1D *mirrorRad = NULL;
    106107    psPolynomial1D *outerMajor = NULL;
    107108    psPolynomial1D *outerMinor = NULL;
     
    110111    psMetadata *ghostModel = NULL;
    111112
     113    psLogMsg ("psastro", PS_LOG_INFO, "writing ghost positions");
     114
    112115    // select the current recipe
    113116    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
     
    132135    pmFPAview *view = pmFPAviewAlloc (0);
    133136
     137    GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
    134138    GET_2D_POLY ("GHOST.CENTER.X", centerX);
    135139    GET_2D_POLY ("GHOST.CENTER.Y", centerY);
     
    187191                    for (int i = 0; i < refstars->n; i++) {
    188192                        pmAstromObj *ref = refstars->data[i];
    189                         psTrace("psastro.ghost",5,"Begin ghost %d/%ld: MAX_MAG: %g; ref_mag: %g @ (%.10g,%.10g)",i,refstars->n,MAX_MAG,ref->Mag,ref->sky->r * 180 / M_PI,ref->sky->d * 180.0 / M_PI);
    190193                        if (ref->Mag > MAX_MAG) continue;
    191194
     
    194197                        ghost->srcFP->y = ref->FP->y;
    195198
    196                         // XXX it is stupid that this takes -X_fpa,-Y_fpa --> the analysis script is reporting the guess FPA position, and the fit is using that...
    197                         ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
    198                         ghost->FP->y = -ref->FP->y + psPolynomial2DEval(centerY, -ref->FP->x, -ref->FP->y);
    199 
    200                         float rSrc = hypot (ref->FP->x, ref->FP->y);
     199                        //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
     200                        double rSrc = hypot (ref->FP->x, ref->FP->y);
     201                        double theta0 = atan2(ref->FP->y,ref->FP->x);
     202
     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);
    201210
    202211                        ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc);
     
    278287        psFree (ghostModel);
    279288        psFree (view);
    280         return true;
    281289
    282290        if (table->n == 0) {
  • trunk/psModules/src/objects/pmSourceIO_Glints.c

    r41339 r41348  
    6666    float zeropt, exptime;
    6767
     68    psLogMsg ("psastro", PS_LOG_INFO, "writing glint positions");
     69
    6870    // select the current recipe
    6971    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
     
    184186                }
    185187
    186                 //do a rudimentary check of whether the glint enters the pixel FPA
    187                 if (!strcasecmp(glintType, "TOP")    && ((star->FP->y - glintLength) > 20500.))  continue;
    188                 if (!strcasecmp(glintType, "BOTTOM") && ((star->FP->y + glintLength) < -20500.))  continue;
    189                 if (!strcasecmp(glintType, "LEFT")   && ((star->FP->x + glintLength) < -20500.))  continue;
    190                 if (!strcasecmp(glintType, "RIGHT")  && ((star->FP->x - glintLength) > 20500.))  continue;
     188                //do a rudimentary check of whether the glint enters the pixel FPA, and exclude very short ones
     189                if (!strcasecmp(glintType, "TOP")    && ((star->FP->y - glintLength) > 19500.))  continue;
     190                if (!strcasecmp(glintType, "BOTTOM") && ((star->FP->y + glintLength) < -19500.))  continue;
     191                if (!strcasecmp(glintType, "LEFT")   && ((star->FP->x + glintLength) < -19500.))  continue;
     192                if (!strcasecmp(glintType, "RIGHT")  && ((star->FP->x - glintLength) > 19500.))  continue;
    191193           
    192194                //save the glint positions
  • trunk/psastro/src/psastroLoadGhosts.c

    r41338 r41348  
    105105    psPolynomial2D *centerX = NULL;
    106106    psPolynomial2D *centerY = NULL;
     107    psPolynomial1D *mirrorRad = NULL;
    107108    psPolynomial1D *outerMajor = NULL;
    108109    psPolynomial1D *outerMinor = NULL;
     
    110111    psPolynomial1D *innerMinor = NULL;
    111112
    112 
    113113    pmFPAview *view = pmFPAviewAlloc (0);
    114114
     115    GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
    115116    GET_2D_POLY ("GHOST.CENTER.X", centerX);
    116117    GET_2D_POLY ("GHOST.CENTER.Y", centerY);
     
    178179                    ghost->srcFP->y = ref->FP->y;
    179180
    180                     // XXX it is stupid that this takes -X_fpa,-Y_fpa --> the analysis script is reporting the guess FPA position, and the fit is using that...
    181                     ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
    182                     ghost->FP->y = -ref->FP->y + psPolynomial2DEval(centerY, -ref->FP->x, -ref->FP->y);
    183 
    184                     float rSrc = hypot (ref->FP->x, ref->FP->y);
     181                    //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
     182                    double rSrc = hypot (ref->FP->x, ref->FP->y);
     183                    double theta0 = atan2(ref->FP->y,ref->FP->x);
     184
     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);
    185192
    186193                    ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc);
     
    203210                    ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
    204211                    // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y);
    205 
    206                     psPlane coordFPA,ptCH2;
    207                     psPlane coordCell,ptFP2;
    208                     coordCell.x = ghost->chip->x;
    209                     coordCell.y = ghost->chip->y;
    210                     psPlaneTransformApply(&coordFPA,ghostChip->toFPA,&coordCell);
    211                     ptCH2.x = ghost->chip->x;
    212                     ptCH2.y = ghost->chip->y;
    213                     psPlaneTransformApply(&ptFP2,ghostChip->toFPA,&ptCH2);
    214 
    215                     psPlane ptCH, ptFP;
    216                     ptFP.x = ghost->FP->x;
    217                     ptFP.y = ghost->FP->y;
    218                     psPlaneTransformApply (&ptCH, ghostChip->fromFPA, &ptFP);
    219 
    220                     psastroUpdateChipToFPA (fpa, ghostChip);
    221                     psPlane ptCH3, ptFP3;
    222                     ptCH3.x = ghost->chip->x;
    223                     ptCH3.y = ghost->chip->y;
    224                     psPlaneTransformApply(&ptFP3,ghostChip->toFPA,&ptCH3);
    225 
    226 
    227 
    228                     psLogMsg ("psastro", 3, "Ghost refpos: %f %f %s pos: %f %f %f %f %f %f %f %f %f %f %f %f mag: %f inshape: %f %f %f outshape: %f %f %f \n", ref->FP->x,ref->FP->y,psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"), ghost->FP->x,ghost->FP->y,coordFPA.x,coordFPA.y,ghost->chip->x, ghost->chip->y,ptCH.x,ptCH.y,ptFP2.x,ptFP2.y,ptFP3.x,ptFP3.y, ghost->Mag,ghost->inner.major,ghost->inner.minor,ghost->inner.theta/PM_RAD_DEG,ghost->outer.major,ghost->outer.minor,ghost->outer.theta/PM_RAD_DEG);
    229212
    230213                    if (ghostChip) {
     
    257240                              ghost->outer.major,ghost->outer.minor,ghost->outer.theta);
    258241                    }                 
    259                      
    260 
    261                            
     242                                           
    262243                    if (!ghostChip) goto skip;
    263244                    if (!ghostChip->cells) goto skip;
  • trunk/psastro/src/psastroLoadGlints.c

    r41338 r41348  
    152152            }
    153153
     154            //do a rudimentary check of whether the glint enters the pixel FPA
     155            if (!strcasecmp(glintType, "TOP")    && ((star->FP->y - glintLength) > 20000.))  continue;
     156            if (!strcasecmp(glintType, "BOTTOM") && ((star->FP->y + glintLength) < -20000.))  continue;
     157            if (!strcasecmp(glintType, "LEFT")   && ((star->FP->x + glintLength) < -20000.))  continue;
     158            if (!strcasecmp(glintType, "RIGHT")  && ((star->FP->x - glintLength) > 20000.))  continue;
    154159
    155160            psVector *x_glint = psVectorAlloc(2,PS_TYPE_F32);
     
    179184                        double yFPAs, yFPAe;
    180185                        psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip);
     186                        if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe);
    181187
    182188                        xFPA0 = star->FP->x;
     
    204210                        double yFPAs, yFPAe;
    205211                        psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip);
     212                        if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe);
    206213
    207214                        xFPA0 = star->FP->x;
     
    218225                x_glint->data.F32[1] = xFPA1;
    219226                y_glint->data.F32[1] = yFPA1;
     227
    220228
    221229                //we need to loop over each corner to select the chips that can have the glint on it
     
    243251                        if (yFPA0 > yFPAe) continue;
    244252                        if (yFPA1 < yFPAs) continue;
     253
    245254
    246255                        //find the y-coord positions for this chip
     
    322331
    323332                        // FPA coordinates of intersections with chip edges
    324                         double yFPAs, yFPAe;
    325                         psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip);
    326 
    327                         xFPA0 = yFPAe;
     333                        double xFPAs, xFPAe;
     334                        psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip);
     335                        if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe);
     336
     337                        xFPA0 = xFPAe;
    328338                        yFPA0 = star->FP->y;
    329                         glintLength-= (star->FP->x-yFPAe);
     339                        glintLength-= (star->FP->x-xFPAe);
    330340                    }
    331341
     
    347357
    348358                        // FPA coordinates of intersections with chip edges
    349                         double yFPAs, yFPAe;
    350                         psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip);
    351 
    352                         xFPA0 = yFPAs;
     359                        double xFPAs, xFPAe;
     360                        psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip);
     361                        if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe);
     362
     363                        xFPA0 = xFPAs;
    353364                        yFPA0 = star->FP->y;
    354                         glintLength-= (yFPAs-star->FP->x);
     365                        glintLength-= (xFPAs-star->FP->x);
    355366                    }
    356367
     
    431442                       
    432443                        fprintf (stderr, "glint %s : %d %f,%f to %f,%f (%f %f %f)\n", glintType, nChip, xChip0, yChip0, xChip1, yChip1, glint_length, glintWidth, chip_angle);
     444
    433445                        psVector *glint = psVectorAlloc(5,PS_TYPE_F32);
    434446                        glint->data.F32[0] = xChip0;
  • trunk/psastro/src/psastroMaskUpdates.c

    r41342 r41348  
    424424                        psastroGhost *ghost = ghosts->data[i];
    425425                        //offset the ghost angles with the astrometric rotation angle
    426                         ghost->inner.theta -= (ROT_PARITY * ROTANGLE);
    427                         ghost->outer.theta -= (ROT_PARITY * ROTANGLE);
     426                        ghost->inner.theta = ghost->inner.theta - AST_T0;
     427                        ghost->outer.theta = ghost->outer.theta - AST_T0;
    428428                        // XXX bright vs faint ghost bits? (OR with SUSPECT)
    429429                        psastroMaskEllipticalAnnulus (readoutMask->mask, ghostMaskValue, ghost->chip->x, ghost->chip->y, ghost->inner, ghost->outer);
     
    444444                        //psastroMaskRectangle (readoutMask->mask, glintMaskValue, glint->x0, glint->y0, glint->x1, glint->y1);
    445445
     446                        psLogMsg ("psastro", 3, "glint: %d %f %f %f %f %f\n",i, glint->data.F32[0], glint->data.F32[1],glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]);
    446447                        psastroMaskBox (readoutMask->mask, glintMaskValue, glint->data.F32[0], glint->data.F32[1],
    447448                                    glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]);
Note: See TracChangeset for help on using the changeset viewer.