IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32996 for trunk/psphot/src


Ignore:
Timestamp:
Dec 22, 2011, 9:00:06 AM (14 years ago)
Author:
eugene
Message:

need to guess models for matched detections in order to get forced photometry -- this meant modifying psphotGuessModels to work on the allSources, not newSources and to test if the guess had previously been performed; updates to radial profile analysis to get smoother Krons -- this now agrees very well with sextractor (though my apertures are slightly smaller and not elliptical)

Location:
trunk/psphot
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src

  • trunk/psphot/src/psphotFitSourcesLinear.c

    r32695 r32996  
    216216    psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "built fitSources: %f sec (%ld objects)\n", psTimerMark ("psphot.linear"), sources->n);
    217217
    218     // fprintf (stderr, "****** Nsat : %d ********\n", Nsat);
    219 
    220218    if (fitSources->n == 0) {
    221219        psFree(fitSources);
  • trunk/psphot/src/psphotForcedReadout.c

    r29936 r32996  
    5555    psphotLoadExtSources (config, view, filerule);
    5656
    57     // construct an initial model for each object, set the radius to fitRadius, set circular fit mask
     57    // Construct an initial model for each object, set the radius to fitRadius, set circular
     58    // fit mask.  NOTE: only applied to sources without guess models
    5859    psphotGuessModels (config, view, filerule);
    5960
  • trunk/psphot/src/psphotGuessModels.c

    r32633 r32996  
    4646    psAssert (detections, "missing detections?");
    4747
    48     psArray *sources = detections->newSources;
     48    psArray *sources = detections->allSources;
    4949    psAssert (sources, "missing sources?");
    5050
     
    160160        pmSource *source = sources->data[i];
    161161
     162        // do not redo sources already guessed
     163        if (source->tmpFlags & PM_SOURCE_TMPF_MODEL_GUESS) continue;
     164
    162165        // this is used to mark sources for which the model is measured. We check later that
    163166        // all are used.
  • trunk/psphot/src/psphotKronIterate.c

    r32776 r32996  
    111111
    112112        pmSource *source = sources->data[i];
    113         if (!source->peak) continue; // XXX how can we have a peak-less source?
    114 
    115         // allocate space for moments
    116         if (!source->moments) continue;
    117113
    118114        // set a window function for each source based on the moments
     115        // (this skips really bad sources (no peak, no moments, DEFECT)
    119116        psphotKronWindowSetSource (source, kronWindow, false, true);
    120117    }
     
    401398
    402399    if (!source) return false;
     400    if (!source->peak) return false; // XXX how can we have a peak-less source?
    403401    if (!source->moments) return false;
     402    if (source->type == PM_SOURCE_TYPE_DEFECT) return false;
     403    if (source->type == PM_SOURCE_TYPE_SATURATED) return false;
    404404    psAssert(kronWindow, "need a window");
    405405
  • trunk/psphot/src/psphotRadialProfileWings.c

    r32776 r32996  
    8080    }
    8181
    82     MIN_RADIUS = 0.25*psMetadataLookupF32 (&status, readout->analysis, "PSF_MOMENTS_RADIUS");
     82    MIN_RADIUS = psMetadataLookupF32 (&status, readout->analysis, "PSF_MOMENTS_RADIUS");
    8383    if (!status) {
    84         MIN_RADIUS = 0.25*psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
     84        MIN_RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
    8585    }
    8686
     
    209209# define TEST_Y 3096
    210210
     211float InterpolateValues (float X0, float Y0, float X1, float Y1, float X);
     212
    211213// XXX use integer radius values?  the rings assume integer values, right? or do they?
    212214bool psphotRadialProfileWingsSource (pmSource *source, pmReadout *readout, psImageMaskType maskVal) {
     
    226228
    227229    // radii will be MIN_RADIUS to MAX_RADIUS in NN log steps:
    228     float NSTEP = 10.0;
     230    float NSTEP = 25.0;
    229231    float MIN_DR = 2;
    230232    float NSIGMA = 1.0;
     
    288290        // fprintf (stderr, "%f %f : %f : %f %f  :  %f\n", source->peak->xf, source->peak->yf, radius, meanFlux, meanFluxError, slope);
    289291
    290         if (!limit) {
    291             limit |= (meanFlux - NSIGMA * meanFluxError < THRESHOLD); // dropped to sky level
    292             limit |= isfinite(slope) && (fabs(slope) < 3.0); // SB no longer changing.
    293             limitRadius = meanRadius;
     292        if (!limit && (meanFlux - NSIGMA * meanFluxError < THRESHOLD)) {
     293            // dropped to sky level
     294            limit = true;
     295            // linearly interpolate to the radius at which we hit the sky
     296            if (isfinite(lastFlux)) {
     297                limitRadius = InterpolateValues(lastFlux, lastRadius, meanFlux, meanRadius, 0.0);
     298            } else {
     299                limitRadius = meanRadius;
     300            }
     301            limitFlux = meanFlux;
     302            limitSlope = slope;
     303        }
     304        if (!limit && isfinite(slope) && (fabs(slope) < 3.0)) {
     305            // SB no longer changing.       
     306            limit = true;
     307            // linearly interpolate to the radius at which we hit the sky, using the last flux and the limiting slope
     308            if (isfinite(lastFlux)) {
     309                limitRadius = lastRadius + lastFlux / 3.0;
     310            } else {
     311                limitRadius = meanRadius;
     312            }
    294313            limitFlux = meanFlux;
    295314            limitSlope = slope;
  • trunk/psphot/src/psphotReadout.c

    r32695 r32996  
    127127    // psphotLoadExtSources (config, view, filerule); // pass 1
    128128
    129     // construct an initial model for each object, set the radius to fitRadius, set circular
    130     // fit mask (detections->newSources)
    131     psphotGuessModels (config, view, filerule); // pass 1
    132 
    133129    // merge the newly selected sources into the existing list
    134130    // NOTE: merge OLD and NEW
    135131    psphotMergeSources (config, view, filerule);
     132
     133    // Construct an initial model for each object, set the radius to fitRadius, set circular
     134    // fit mask.  NOTE: only applied to sources without guess models
     135    psphotGuessModels (config, view, filerule); // pass 1
    136136
    137137    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
     
    193193        }
    194194
    195         // create full input models, set the radius to fitRadius, set circular fit mask
    196         // NOTE: apply only to detections->newSources
    197         psphotGuessModels (config, view, filerule); // pass 2 (detections->newSources)
    198 
    199195        // replace all sources so fit below applies to all at once
    200196        // NOTE: apply only to OLD sources (which have been subtracted)
     
    205201        // XXX check on free of sources...
    206202        psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources)
     203
     204        // Construct an initial model for each object, set the radius to fitRadius, set circular
     205        // fit mask.  NOTE: only applied to sources without guess models
     206        psphotGuessModels (config, view, filerule); // pass 1
    207207
    208208        // NOTE: apply to ALL sources
     
    234234        }
    235235
    236         // create full input models, set the radius to fitRadius, set circular fit mask
    237         // NOTE: apply only to detections->newSources
    238         psphotGuessModels (config, view, filerule); // pass 2 (detections->newSources)
    239 
    240236        // replace all sources so fit below applies to all at once
    241237        // NOTE: apply only to OLD sources (which have been subtracted)
     
    247243        psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources)
    248244
     245        // Construct an initial model for each object, set the radius to fitRadius, set circular
     246        // fit mask.  NOTE: only applied to sources without guess models
     247        psphotGuessModels (config, view, filerule); // pass 1
     248
    249249        // NOTE: apply to ALL sources
    250250        psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources)
  • trunk/psphot/src/psphotReadoutFindPSF.c

    r30624 r32996  
    5454    }
    5555
     56    // merge the newly selected sources into the existing list
     57    // NOTE: merge OLD and NEW
     58    psphotMergeSources (config, view, filerule);
     59
    5660# if 0
    5761    // XXX if we want to determine the aperture residual correction here, we either
     
    6165    psphotGuessModels (config, view, filerule);
    6266# endif
    63 
    64     // merge the newly selected sources into the existing list
    65     // NOTE: merge OLD and NEW
    66     psphotMergeSources (config, view, filerule);
    6767
    6868# if 0
  • trunk/psphot/src/psphotReadoutForcedKnownSources.c

    r29936 r32996  
    3636    }
    3737
    38     // construct an initial model for each object
    39     psphotGuessModels (config, view, filerule);
    40 
    4138    // merge the newly selected sources into the existing list
    4239    // NOTE: merge OLD and NEW
    4340    psphotMergeSources (config, view, filerule);
     41
     42    // Construct an initial model for each object, set the radius to fitRadius, set circular
     43    // fit mask.  NOTE: only applied to sources without guess models
     44    psphotGuessModels (config, view, filerule);
    4445
    4546    // linear PSF fit to source peaks
  • trunk/psphot/src/psphotReadoutKnownSources.c

    r30624 r32996  
    4848    }
    4949
    50     // construct an initial model for each object
    51     psphotGuessModels (config, view, filerule);
    52 
    5350    // merge the newly selected sources into the existing list
    5451    // NOTE: merge OLD and NEW
    5552    psphotMergeSources (config, view, filerule);
     53
     54    // Construct an initial model for each object, set the radius to fitRadius, set circular
     55    // fit mask.  NOTE: only applied to sources without guess models
     56    psphotGuessModels (config, view, filerule);
    5657
    5758    // linear PSF fit to source peaks
  • trunk/psphot/src/psphotReadoutMinimal.c

    r29936 r32996  
    5959    }
    6060
    61     // construct an initial model for each object
    62     psphotGuessModels (config, view, filerule);
    63 
    6461    // merge the newly selected sources into the existing list
    6562    psphotMergeSources (config, view, filerule);
     63
     64    // Construct an initial model for each object, set the radius to fitRadius, set circular
     65    // fit mask.  NOTE: only applied to sources without guess models
     66    psphotGuessModels (config, view, filerule);
    6667
    6768    // linear PSF fit to source peaks
  • trunk/psphot/src/psphotSourceMatch.c

    r32666 r32996  
    261261            source->imageID = index;
    262262            source->mode2 |= PM_SOURCE_MODE2_MATCHED; // source is generated based on another image
     263            source->type = PM_SOURCE_TYPE_STAR; // until we know more, assume a PSF fit
    263264
    264265            // add the peak
  • trunk/psphot/src/psphotStackImageLoop.c

  • trunk/psphot/src/psphotStackMatchPSFsNext.c

    r32348 r32996  
    5151
    5252    bool status = false;
     53
     54    psTimerStart ("psphot.smooth");
    5355
    5456    // find the currently selected readout
  • trunk/psphot/src/psphotStackReadout.c

    r32695 r32996  
    160160    }
    161161
    162     // construct an initial model for each object, set the radius to fitRadius, set circular fit mask
    163     psphotGuessModels (config, view, STACK_SRC);
    164 
    165162    // merge the newly selected sources into the existing list
    166163    // NOTE: merge OLD and NEW
    167164    psphotMergeSources (config, view, STACK_SRC);
     165
     166    // Construct an initial model for each object, set the radius to fitRadius, set circular
     167    // fit mask.  NOTE: only applied to sources without guess models
     168    psphotGuessModels (config, view, STACK_SRC);
    168169
    169170    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
     
    248249        }
    249250
    250         // create full input models, set the radius to fitRadius, set circular fit mask
    251         // NOTE: apply only to detections->newSources
    252         psphotGuessModels (config, view, STACK_SRC); // pass 2 (detections->newSources)
    253 
    254251        // replace all sources so fit below applies to all at once
    255252        // NOTE: apply only to OLD sources (which have been subtracted)
     
    260257        // XXX check on free of sources...
    261258        psphotMergeSources (config, view, STACK_SRC); // (detections->newSources + detections->allSources -> detections->allSources)
     259
     260        // Construct an initial model for each object, set the radius to fitRadius, set circular
     261        // fit mask.  NOTE: only applied to sources without guess models
     262        psphotGuessModels (config, view, STACK_SRC);
    262263    }
    263264
     
    269270    objects = psphotMatchSources (config, view, STACK_SRC);
    270271    psMemDump("matchsources");
     272
     273    // Construct an initial model for each object, set the radius to fitRadius, set circular
     274    // fit mask.  NOTE: only applied to sources without guess models
     275    psphotGuessModels (config, view, STACK_SRC);
    271276
    272277    psphotStackObjectsUnifyPosition (objects);
Note: See TracChangeset for help on using the changeset viewer.