IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

gpc2 dynamic masking set up

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.