IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13514


Ignore:
Timestamp:
May 24, 2007, 2:16:03 PM (19 years ago)
Author:
magnier
Message:

adding some test output code; removed asymmetrical clipping for apresd stats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmPSFtry.c

    r13431 r13514  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-05-18 17:15:35 $
     7 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-05-25 00:16:03 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    168168        if (!status) {
    169169            psfTry->mask->data.U8[i] = PSFTRY_MASK_PSF_FAIL;
     170            psTrace ("psModules.pmPSFtry", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y);
    170171            continue;
    171172        }
     
    174175        if (!pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP)) {
    175176            psfTry->mask->data.U8[i] = PSFTRY_MASK_BAD_PHOT;
     177            psTrace ("psModules.pmPSFtry", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y);
    176178            continue;
    177179        }
     
    261263    }
    262264
     265    // XXX this analysis of the apResid statistics is only approximate.  The fitted magnitudes
     266    // measure at this point (in the PSF fit) use Poisson errors, and are thus biased as a
     267    // function of magnitude.  We re-measure the apResid statistics later in psphot using the
     268    // linear, constant-error fitting.  Do not reject outliers with excessive vigor here.
     269
    263270    // use 3hi/1lo sigma clipping on the r2rflux vs metric fit
    264271    psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
    265     stats->min = 1.0;
    266     stats->max = 3.0;
     272    stats->clipSigma = 3.0;
    267273    stats->clipIter = 3;
     274
     275    // XXX we used to include an asymmetric clipping in order to toss out contaminated stars.
     276    // test this on the very crowded field data.
     277    // stats->min = 1.0;
     278    // stats->max = 3.0;
    268279
    269280    // fit ApTrend only to r2rflux, ignore x,y,flux variations for now
    270281    // linear clipped fit of ApResid to r2rflux
    271282    psPolynomial1D *poly = psPolynomial1DAlloc (PS_POLYNOMIAL_ORD, 1);
    272 
    273     // XXX test to only fit a constant offset (no SKYBIAS)
    274     poly->mask[1] = 1;
     283    poly->mask[1] = 1; // fit only a constant offset (no SKYBIAS)
    275284
    276285    bool result = psVectorClipFitPolynomial1D (poly, stats, psfTry->mask, PSFTRY_MASK_ALL, psfTry->metric, psfTry->metricErr, r2rflux);
     
    284293        return false;
    285294    }
    286     psLogMsg ("pmPSFtryMetric", 4, "fit stats: %f +/- %f\n", stats->robustMedian, stats->robustStdev);
    287     psLogMsg ("pmPSFtryMetric", 4, "apresid: %f +/- %f\n", poly->coeff[0], poly->coeffErr[0]);
     295    psLogMsg ("pmPSFtryMetric", 4, "apresid: %f +/- %f; keeping %ld of %ld psf stars\n", poly->coeff[0], stats->robustStdev, stats->clippedNvalues, psfTry->sources->n);
    288296
    289297    // XXX test dump of fitted model (dump when tracing?)
     
    403411    for (int i = 0; i < stats->clipIter; i++) {
    404412        psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E0], stats, psfTry->mask, 0xff, e0, dz, x, y);
     413        psTrace ("psModules.pmPSFtry", 4, "clipped E0 : keeping %ld of %ld\n", stats->clippedNvalues, e0->n);
    405414        psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E1], stats, psfTry->mask, 0xff, e1, dz, x, y);
     415        psTrace ("psModules.pmPSFtry", 4, "clipped E1 : keeping %ld of %ld\n", stats->clippedNvalues, e1->n);
    406416        psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E2], stats, psfTry->mask, 0xff, e2, dz, x, y);
    407     }
     417        psTrace ("psModules.pmPSFtry", 4, "clipped E2 : keeping %ld of %ld\n", stats->clippedNvalues, e2->n);
     418    }
     419
     420    // XXX temporary dump of the psf parameters
     421    if (psTraceGetLevel("psModules.objects") >= 4) {
     422        FILE *f = fopen ("pol.dat", "w");
     423        for (int i = 0; i < e0->n; i++) {
     424            fprintf (f, "%f %f  :  %f %f %f  : %d\n",
     425                     x->data.F64[i], y->data.F64[i],
     426                     e0->data.F64[i], e1->data.F64[i], e2->data.F64[i], psfTry->mask->data.U8[i]);
     427        }
     428        fclose (f);
     429    }
     430
    408431    psFree (e0);
    409432    psFree (e1);
Note: See TracChangeset for help on using the changeset viewer.