IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41348 for trunk/psastro


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

gpc2 dynamic masking set up

Location:
trunk/psastro/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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.