IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2011, 1:12:39 PM (15 years ago)
Author:
eugene
Message:

use the smoothed image for footprint culling; use a more stringent culling for saturated stars; more tweaks to get sat stars to be fitted; various updates to psphotStack; unify psphotImageLoop varients; be a bit careful about number of stars in a PSF clump

Location:
trunk/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src/psphotExtendedSourceAnalysis.c

    r30624 r31154  
    11# include "psphotInternal.h"
    22
    3 // ?? these cannot happen here --> we would need to do this in psphotExtendedSourceAnalysis
    4 // XXX option to choose a consistent position
    5 // XXX option to choose a consistent elliptical contour
    6 // XXX SDSS uses the r-band petrosian radius to measure petrosian fluxes in all bands
    7 // XXX consistent choice of extendedness...
     3// measure the elliptical radial profile and use this to measure the petrosian parameters for the sources
     4// XXX this function needs to be threaded
    85
    96// for now, let's store the detections on the readout->analysis for each readout
     
    4037    int Next = 0;
    4138    int Npetro = 0;
    42     int Nisophot = 0;
    4339    int Nannuli = 0;
    44     int Nkron = 0;
    4540
    4641    psTimerStart ("psphot.extended");
     
    6863    assert (maskVal);
    6964
    70     // XXX require petrosian analysis for non-linear fits?
    71 
    72     // XXX temporary user-supplied systematic sky noise measurement (derive from background model)
    73     float skynoise = psMetadataLookupF32 (&status, recipe, "SKY.NOISE");
     65    // get the sky noise from the background analysis; if this is missing, get the user-supplied value
     66    float skynoise = psMetadataLookupF32 (&status, readout->analysis, "SKY_STDEV");
     67    if (!status) {
     68        skynoise = psMetadataLookupF32 (&status, recipe, "SKY.NOISE");
     69        psWarning ("failed to get sky noise level from background analysis; defaulting to user supplied value of %f\n", skynoise);
     70    }
    7471
    7572    // S/N limit to perform full non-linear fits
     
    7875    // which extended source analyses should we perform?
    7976    bool doPetrosian    = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN");
    80     bool doIsophotal    = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL");
    8177    bool doAnnuli       = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI");
    82     bool doKron         = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON");
    83 
    84 # if (0)
    85     // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN
    86     // XXX use this to set skynoise
    87     pmReadout *backModel = psphotSelectBackground (config, view);
    88     pmReadout *backStdev = psphotSelectBackgroundStdev (config, view);
    89 # endif
     78    bool doPetroStars   = psMetadataLookupBool (&status, recipe, "PETROSIAN_FOR_STARS");
    9079
    9180    // source analysis is done in S/N order (brightest first)
    92     sources = psArraySort (sources, pmSourceSortBySN);
     81    sources = psArraySort (sources, pmSourceSortByFlux);
    9382
    9483    // option to limit analysis to a specific region
     
    10392
    10493        // skip PSF-like and non-astronomical objects
    105         if (source->type == PM_SOURCE_TYPE_STAR) continue;
    10694        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    10795        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
    10896        if (source->mode & PM_SOURCE_MODE_DEFECT) continue;
    10997        if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
    110         if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue;
     98
     99        // optionally allow non-extended objects to get petrosians as well
     100        if (!doPetroStars) {
     101            if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue;
     102            if (source->type == PM_SOURCE_TYPE_STAR) continue;
     103        }
    111104
    112105        // limit selection to some SN limit
    113106        assert (source->peak); // how can a source not have a peak?
    114         if (source->peak->SN < SN_LIM) continue;
     107        if (sqrt(source->peak->detValue) < SN_LIM) continue;
    115108
    116109        // limit selection by analysis region
     
    119112        if (source->peak->x > AnalysisRegion.x1) continue;
    120113        if (source->peak->y > AnalysisRegion.y1) continue;
    121 
    122         // fprintf (stderr, "xsrc: %f, %f : %f\n", source->peak->xf, source->peak->yf, source->peak->SN);
    123114
    124115        // replace object in image
     
    136127
    137128        // if we request any of these measurements, we require the radial profile
    138         if (doPetrosian || doIsophotal || doAnnuli || doKron) {
     129        if (doPetrosian || doAnnuli) {
    139130            if (!psphotRadialProfile (source, recipe, skynoise, maskVal)) {
    140131                // all measurements below require the radial profile; skip them all
     
    144135                continue;
    145136            }
     137            Nannuli ++;
    146138            source->mode |= PM_SOURCE_MODE_RADIAL_FLUX;
    147139        }
     
    169161    psLogMsg ("psphot", PS_LOG_INFO, "extended source analysis: %f sec for %d objects\n", psTimerMark ("psphot.extended"), Next);
    170162    psLogMsg ("psphot", PS_LOG_INFO, "  %d petrosian\n", Npetro);
    171     psLogMsg ("psphot", PS_LOG_INFO, "  %d isophotal\n", Nisophot);
    172163    psLogMsg ("psphot", PS_LOG_INFO, "  %d annuli\n", Nannuli);
    173     psLogMsg ("psphot", PS_LOG_INFO, "  %d kron\n", Nkron);
    174164
    175165    psphotVisualShowResidualImage (readout, false);
Note: See TracChangeset for help on using the changeset viewer.