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/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) {
Note: See TracChangeset for help on using the changeset viewer.