IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 4, 2013, 2:00:29 PM (13 years ago)
Author:
eugene
Message:

rules for performing the extended source fits and petrosian analysis are defined in psphotChooseAnalysisOptions.c; only the model-specific limits are applied here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psphot/src/psphotExtendedSourceFits.c

    r36333 r36342  
    6464    psLogMsg("psphot", PS_LOG_INFO, "extended source fits for image %d", index);
    6565    psphotVisualShowImage(readout);
    66 
    67     // psphotSaveImage (NULL, readout->image, "test.01.fits");
    6866
    6967    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     
    302300            psArrayAdd(job->args, 1, cells->data[j]); // sources
    303301            psArrayAdd(job->args, 1, models);
     302
    304303            // Allocate a metadata iterator here because psMetadataIteratorAlloc/Free are not thread safe
    305304            psMetadataIterator *iter = psMetadataIteratorAlloc (models, PS_LIST_HEAD, NULL);
     
    321320
    322321// XXX TEST
    323             if (true && !isInteractive) {
     322            if (!isInteractive) {
    324323                if (!psThreadJobAddPending(job)) {
    325324                    psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
     
    403402    psphotSersicModelClassCleanup();
    404403
    405     // psphotSaveImage (NULL, readout->image, "test.02.fits");
    406 
    407404    psphotVisualShowResidualImage (readout, false);
    408405
     
    458455        pmSource *source = sources->data[i];
    459456
    460         // skip PSF-like and non-astronomical objects
    461         if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue;
    462         if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    463         if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
    464 
    465         // skip saturated stars modeled with a radial profile
    466         if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
    467 
    468         // XXX this should use peak?
     457        // rules for measuring petrosian parameters for specific objects are set in
     458        // psphotChooseAnalysisOptions.c
     459        if (!(source->tmpFlags & PM_SOURCE_TMPF_EXT_FIT)) continue;
     460
     461        // limit selection by analysis region (XXX move this into psphotChooseAnalysisOption?)
    469462        if (source->peak->x < region->x0) continue;
    470463        if (source->peak->y < region->y0) continue;
    471464        if (source->peak->x > region->x1) continue;
    472465        if (source->peak->y > region->y1) continue;
    473 
    474 
    475         // XXX for a test, just do the obvious trail
    476         // XXX if (source->peak->xf < 1100) continue;
    477         // XXX if (source->peak->xf > 1400) continue;
    478         // XXX if (source->peak->yf >  245) continue;
    479466
    480467        // replace object in image
     
    487474        psphotSetRadiusMomentsExact(&fitRadius, &windowRadius, readout, source, markVal); // NOTE : 6 allocs
    488475
    489         // XXX WATCH OUT HERE!!
    490         // fitRadius = 30;
    491 
    492476        // UPDATE : we have changed the moments calculation.  There is now an iteration within
    493477        // psphotKronMasked to determine moments appropriate for a larger object.  The values
     
    502486# ifdef TEST_OBJECT
    503487        bool testObject = false;
    504         // testObject |= ((fabs(source->peak->xf -  179) < 5) && (fabs(source->peak->yf - 1138) < 5));
    505         // testObject |= ((fabs(source->peak->xf - 5047) < 5) && (fabs(source->peak->yf -  151) < 5));
    506         // testObject |= ((fabs(source->peak->xf - 3929) < 5) && (fabs(source->peak->yf - 4109) < 5));
    507         // testObject |= ((fabs(source->peak->xf -  915) < 5) && (fabs(source->peak->yf - 5998) < 5));
    508         // testObject |= ((fabs(source->peak->xf - 5406) < 5) && (fabs(source->peak->yf -  326) < 5));
     488        testObject |= ((fabs(source->peak->xf -  179) < 5) && (fabs(source->peak->yf - 1138) < 5));
    509489        if (testObject) {
    510490            fprintf (stderr, "test object @ %f, %f\n", source->peak->xf, source->peak->yf);
     
    528508          assert (status);
    529509
    530           // limit selection to some SN limit
    531           bool skipSource = false;
    532           if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {
    533               skipSource = (source->moments->KronFlux < FIT_SN_LIM * source->moments->KronFluxErr);
    534           } else {
    535               skipSource = (sqrt(source->peak->detValue) < FIT_SN_LIM);
    536           }
    537           if (skipSource) {
     510          // limit selection to some SN limit for specific models (this value only applies if > EXTENDED_SOURCE_SN_LIM)
     511          if (isfinite(FIT_SN_LIM)) {
     512            if (source->moments->KronFlux < FIT_SN_LIM * source->moments->KronFluxErr) {
    538513              Nfaint ++;
    539514              continue;
     515            }
    540516          }
    541517
     
    612588              }
    613589          }
    614           // XXX really need to do this in a cleaner way:
    615           // XXX I'm not sure I can get to this statement with a null modelFit
    616           if (!modelFit) continue;
     590          psAssert (modelFit, "modelFit not set?");
    617591
    618592          // test for fit quality / result
Note: See TracChangeset for help on using the changeset viewer.