IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31437


Ignore:
Timestamp:
May 4, 2011, 4:37:26 PM (15 years ago)
Author:
eugene
Message:

option to choose between model and sources for growth curve; save more info about growth curve in output header; clearer warning message in petrosian analysis; use the same center for the selected pixels in both SetRadiusModel and SetRadiusFootprint

Location:
branches/eam_branches/ipp-20110404/psphot/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110404/psphot/src/psphotApResid.c

    r31362 r31437  
    11# include "psphotInternal.h"
    2 // # define DEBUG
     2# define DEBUG
    33
    44# define SKIPSTAR(MSG) { psTrace ("psphot", 3, "invalid : %s", MSG); continue; }
     
    328328    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_META_REPLACE, "ap residual scatter", psf->dApResid);
    329329    psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_META_REPLACE, "number of apresid stars", psf->nApResid);
    330     psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS",   PS_META_REPLACE, "aperture loss (mag)", psf->growth ? psf->growth->apLoss : NAN);
     330
     331    // curve-of-growth offset
     332    if (psf->growth) {
     333        float gaussSigma = psMetadataLookupF32(&status, readout->analysis, "MOMENTS_GAUSS_SIGMA");
     334        if (!status) {
     335            gaussSigma = psMetadataLookupF32(&status, recipe, "MOMENTS_GAUSS_SIGMA");
     336        }
     337        float apScale = psMetadataLookupF32(&status, recipe, "PSF_APERTURE_SCALE");
     338        float PSF_APERTURE = (int)(apScale*gaussSigma);
     339       
     340        float offset = pmGrowthCurveCorrect (psf->growth, PSF_APERTURE);
     341        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS",   PS_META_REPLACE, "aperture loss (mag)", psf->growth->apLoss);
     342        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APREFOFF", PS_META_REPLACE, "offset to ref aperture", offset);
     343    } else {
     344        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS",   PS_META_REPLACE, "aperture loss (mag)", NAN);
     345        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APREFOFF", PS_META_REPLACE, "offset to ref aperture", NAN);
     346    }
    331347
    332348    psLogMsg ("psphot.apresid", PS_LOG_DETAIL, "aperture residual: %f +/- %f\n", psf->ApResid, psf->dApResid);
  • branches/eam_branches/ipp-20110404/psphot/src/psphotExtendedSourceFits.c

    r31362 r31437  
    379379          assert (status);
    380380
    381           // fprintf (stderr, "xfit: %f, %f : %f\n", source->peak->xf, source->peak->yf, source->peak->SN);
    382 
    383381          // limit selection to some SN limit
    384           assert (source->peak); // how can a source not have a peak?
     382          // assert (source->peak); // how can a source not have a peak?
    385383          if (sqrt(source->peak->detValue) < SNlim) {
    386384              Nfaint ++;
  • branches/eam_branches/ipp-20110404/psphot/src/psphotMakeGrowthCurve.c

    r31384 r31437  
    3434    psf->growth = pmGrowthCurveAlloc (PSF_FIT_PAD, 100.0, REF_RADIUS);
    3535
    36 # if (0)
    37     bool IGNORE_GROWTH = psMetadataLookupBool (&status, recipe, "IGNORE_GROWTH");
    38     if (!pmGrowthCurveGenerate (readout, psf, IGNORE_GROWTH, maskVal, markVal)) {
    39         psError(PSPHOT_ERR_APERTURE, false, "Fitting aperture corrections");
    40         psFree(psf->growth); psf->growth = NULL;
    41         return false;
     36    bool GROWTH_FROM_SOURCES = psMetadataLookupBool (&status, recipe, "GROWTH_FROM_SOURCES");
     37    if (!status) GROWTH_FROM_SOURCES = false;
     38
     39    if (GROWTH_FROM_SOURCES) {
     40        bool INTERPOLATE_AP = psMetadataLookupBool (&status, recipe, "INTERPOLATE_AP");
     41        if (!pmGrowthCurveGenerateFromSources (readout, psf, sources, INTERPOLATE_AP, maskVal, markVal)) {
     42            psError(PSPHOT_ERR_APERTURE, false, "Fitting aperture corrections");
     43            psFree(psf->growth); psf->growth = NULL;
     44            return false;
     45        }
     46
     47    } else {
     48        bool IGNORE_GROWTH = psMetadataLookupBool (&status, recipe, "IGNORE_GROWTH");
     49        if (!pmGrowthCurveGenerate (readout, psf, IGNORE_GROWTH, maskVal, markVal)) {
     50            psError(PSPHOT_ERR_APERTURE, false, "Fitting aperture corrections");
     51            psFree(psf->growth); psf->growth = NULL;
     52            return false;
     53        }
    4254    }
    43 # else
    44     bool INTERPOLATE_AP = psMetadataLookupBool (&status, recipe, "INTERPOLATE_AP");
    45     if (!pmGrowthCurveGenerateFromSources (readout, psf, sources, INTERPOLATE_AP, maskVal, markVal)) {
    46         psError(PSPHOT_ERR_APERTURE, false, "Fitting aperture corrections");
    47         psFree(psf->growth); psf->growth = NULL;
    48         return false;
    49     }
    50 # endif
    5155
    5256    psLogMsg ("psphot", PS_LOG_MINUTIA, "built growth curve: %f sec\n", psTimerMark ("psphot.growth"));
  • branches/eam_branches/ipp-20110404/psphot/src/psphotOutput.c

    r31362 r31437  
    251251    psMetadataItemSupplement (&status, header, analysis, "NPSFSTAR");
    252252    psMetadataItemSupplement (&status, header, analysis, "APLOSS");
     253    psMetadataItemSupplement (&status, header, analysis, "APREFOFF");
    253254
    254255    psMetadataItemSupplement (&status, header, analysis, "FWHM_MAJ");
  • branches/eam_branches/ipp-20110404/psphot/src/psphotPetrosianStats.c

    r31154 r31437  
    163163        if (refRadius->data.F32[i] > apRadius) {
    164164            if (i == 0) {
    165                 psWarning ("does this case make any sense? (refRadius[0] > apRadius)");
     165                psWarning ("does this case make any sense? (refRadius[0] %f > apRadius %f)", refRadius->data.F32[i], apRadius);
    166166                continue;
    167167            } else {
     
    188188        if (!found50 && (fluxSum->data.F32[i] > flux50)) {
    189189            if (i == 0) {
    190                 psWarning ("does this case make any sense? (fluxSum[0] > flux50)");
     190                psWarning ("does this case make any sense? (fluxSum[0] %f > flux50 %f)", fluxSum->data.F32[i], flux50);
    191191                continue;
    192192            } else {
     
    198198        if (!found90 && (fluxSum->data.F32[i] > flux90)) {
    199199            if (i == 0) {
    200                 psWarning ("does this case make any sense? (fluxSum[0] > flux90)");
     200                psWarning ("does this case make any sense? (fluxSum[0] %f > flux90 %f)", fluxSum->data.F32[i], flux90);
    201201                continue;
    202202            } else {
  • branches/eam_branches/ipp-20110404/psphot/src/psphotRadiusChecks.c

    r29936 r31437  
    184184bool psphotSetRadiusModel (pmModel *model, pmReadout *readout, pmSource *source, psImageMaskType markVal, bool deep) {
    185185
    186     psF32 *PAR = model->params->data.F32;
    187 
    188     pmMoments *moments = source->moments;
    189     if (moments == NULL) return false;
     186    pmPeak *peak = source->peak;
    190187
    191188    // set the fit radius based on the object flux limit and the model
     
    199196
    200197    // redefine the pixels if needed
    201     pmSourceRedefinePixels (source, readout, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius);
    202 
    203     // set the mask to flag the excluded pixels
    204     psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius, "OR", markVal);
    205     return true;
    206 }
     198    pmSourceRedefinePixels (source, readout, peak->xf, peak->yf, model->fitRadius);
     199
     200    // set the mask to flag the excluded pixels
     201    psImageKeepCircle (source->maskObj, peak->xf, peak->yf, model->fitRadius, "OR", markVal);
     202    return true;
     203}
  • branches/eam_branches/ipp-20110404/psphot/src/psphotRoughClass.c

    r31154 r31437  
    207207        return false;
    208208    }
    209     psLogMsg ("psphot", 3, "psf clump  X,  Y: %f, %f : DX, DY: %f, %f : nStars %d of %d\n", psfClump.X, psfClump.Y, psfClump.dX, psfClump.dY, psfClump.nStars, psfClump.nTotal);
     209    if (!havePSF) {
     210        psLogMsg ("psphot", 3, "psf clump  X,  Y: %f, %f : DX, DY: %f, %f : nStars %d of %d\n", psfClump.X, psfClump.Y, psfClump.dX, psfClump.dY, psfClump.nStars, psfClump.nTotal);
     211    } else {
     212        psLogMsg ("psphot", 3, "psf clump  X,  Y: %f, %f : DX, DY: %f, %f : loaded from metadata\n", psfClump.X, psfClump.Y, psfClump.dX, psfClump.dY);
     213    }
    210214
    211215    // get basic parameters, or set defaults
  • branches/eam_branches/ipp-20110404/psphot/src/psphotSourceFits.c

    r31362 r31437  
    493493    // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5);
    494494    pmSourceFitModel (source, model, &options, maskVal);
    495     // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);
     495    // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);
    496496
    497497    // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0);
     
    558558    // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5);
    559559    pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize);
    560     // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);
     560    // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);
    561561
    562562    // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0);
Note: See TracChangeset for help on using the changeset viewer.