IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 22, 2005, 4:20:27 PM (21 years ago)
Author:
eugene
Message:

various cleanups, fixes, additions...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotApResid.c

    r5802 r5828  
    2121    psVector *rflux   = psVectorAlloc (300, PS_TYPE_F64);
    2222    psVector *apResid = psVectorAlloc (300, PS_TYPE_F64);
    23     mask->n = rflux->n = apResid->n = 0;
     23    mask->n = xPos->n = yPos->n = rflux->n = apResid->n = 0;
    2424    Npsf = 0;
    2525
     
    4343
    4444        psImageKeepCircle (source->mask, x, y, RADIUS, "OR", PSPHOT_MASK_MARKED);
    45         // XXX EAM : add in source flux
    4645        status = pmSourcePhotometry (&fitMag, &obsMag, model, source->pixels, source->mask);
    4746        psImageKeepCircle (source->mask, x, y, RADIUS, "AND", ~PSPHOT_MASK_MARKED);
     47
     48        pmSourceSubModel (source->pixels, source->mask, model, false, false);
    4849        if (!status) continue;
    4950
     
    5556
    5657        psVectorExtend (mask, 100, 1);
     58        psVectorExtend (xPos, 100, 1);
     59        psVectorExtend (yPos, 100, 1);
    5760        psVectorExtend (rflux, 100, 1);
    5861        psVectorExtend (apResid, 100, 1);
    5962        Npsf ++;
    60 
    61         pmSourceSubModel (source->pixels, source->mask, model, false, false);
    62         psMemCheckCorruption (true);
    6363    }
     64    psLogMsg ("psphot.apresid", 4, "measure aperture residuals : %f sec\n", psTimerMark ("psphot"));
    6465
    6566    // 3hi/1lo sigma clipping on the rflux vs metric fit
     
    7071
    7172    // linear clipped fit of apResid to rflux, xPos, yPos
    72     psf->ApTrend  = psVectorClipFitPolynomial3D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, NULL, rflux, xPos, yPos);
     73    psf->ApTrend  = psVectorClipFitPolynomial3D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, NULL, xPos, yPos, rflux);
    7374    psf->skyBias  = psf->ApTrend->coeff[0][0][1] / (M_PI * PS_SQR(RADIUS));
    7475    psf->ApResid  = psf->ApTrend->coeff[0][0][0];
    7576    psf->dApResid = stats->sampleStdev;
     77    psf->ApTrend->coeff[0][0][1] = 0;
    7678
    77     psLogMsg ("ApResid", 4, "aperture residual: %f +/- %f : %f bias\n", psf->ApResid, psf->dApResid, psf->skyBias);
     79    /*
     80      (aprMag' - fitMag) = rflux*skyBias + ApTrend(x,y)
     81      (aprMag - rflux*skyBias) - fitMag = ApTrend(x,y)
     82      (aprMag - rflux*skyBias) = fitMag + ApTrend(x,y)
     83    */
     84
     85    # if (0)
     86    psPolynomial3D *poly = psf->ApTrend;
     87    for (int nz = 0; nz <= poly->nZ; nz++) {
     88        for (int ny = 0; ny <= poly->nY; ny++) {
     89            for (int nx = 0; nx <= poly->nX; nx++) {
     90                fprintf (stderr, "%d %d %d : %22.15g\n", nx, ny, nz, poly->coeff[nx][ny][nz]);
     91            }
     92        }
     93    }
     94    # endif
     95
     96    psLogMsg ("psphot.apresid", 3, "measure full-frame aperture residual: %f sec\n", psTimerMark ("psphot"));
     97    psLogMsg ("psphot.apresid", 4, "aperture residual: %f +/- %f : %f bias\n", psf->ApResid, psf->dApResid, psf->skyBias);
    7898
    7999    psFree (stats);
Note: See TracChangeset for help on using the changeset viewer.