IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31673


Ignore:
Timestamp:
Jun 22, 2011, 12:54:41 AM (15 years ago)
Author:
eugene
Message:

various fixes from eam branch

Location:
trunk/psphot
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src/psphot.c

    r31154 r31673  
    44int main (int argc, char **argv) {
    55
     6    psMemInit();
    67    psTimerStart ("complete");
    78    pmErrorRegister();                  // register psModule's error codes/messages
  • trunk/psphot/src/psphotChoosePSF.c

    r31452 r31673  
    373373    }
    374374
     375
     376
    375377    char *modelName = pmModelClassGetName (psf->type);
    376378    psLogMsg ("psphot.pspsf", PS_LOG_INFO, "select psf model: %f sec\n", psTimerMark ("psphot.choose.psf"));
     
    503505      }
    504506      psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT1", PS_META_REPLACE, "PSF extra param 1", stats->sampleMean);
     507      psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 1: %f +/- %f", stats->sampleMean, stats->sampleStdev);
    505508    }
    506509
     
    511514      }
    512515      psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT2", PS_META_REPLACE, "PSF extra param 2", stats->sampleMean);
    513     }
    514 
    515     psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",    PS_META_REPLACE, "PSF angle",           axes.theta);
     516      psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 2: %f +/- %f", stats->sampleMean, stats->sampleStdev);
     517    }
     518
     519    // psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",    PS_META_REPLACE, "PSF angle",           axes.theta);
    516520    psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NPSFSTAR", PS_META_REPLACE, "Number of stars used to make PSF", psf->nPSFstars);
     521
     522    // psLogMsg ("psphot", PS_LOG_DETAIL, "PSF angle: %f, nstars: %d", axes.theta, psf->nPSFstars);
    517523
    518524    char *psfModelName = pmModelClassGetName(psf->type);
  • trunk/psphot/src/psphotExtendedSourceFits.c

    r31452 r31673  
    268268    float radius;
    269269    psScalar *scalar = NULL;
     270    pmMoments psfMoments;
    270271
    271272    // arguments: readout, sources, models, region, psfSize, maskVal, markVal
     
    333334        // this uses the footprint to judge both radius and aperture?
    334335        // XXX save the psf-based moments for output
     336        psfMoments = *source->moments;
    335337        if (!pmSourceMoments (source, radius, 0.0, 0.0, 0.0, maskVal)) {
     338            // subtract the best fit from the object, leave local sky
    336339            fprintf (stderr, "skipping (2) %f, %f\n", source->peak->xf, source->peak->yf);
    337             // subtract the best fit from the object, leave local sky
     340            *source->moments = psfMoments;
    338341            pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    339342            // XXX raise an error flag of some kind
     
    348351            if (!modelFluxStart) {
    349352                fprintf (stderr, "skipping (3) %f, %f\n", source->peak->xf, source->peak->yf);
     353                *source->moments = psfMoments;
    350354                pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    351355                // XXX raise an error of some kind?
     
    467471          source->modelFlux = modelFluxStart;
    468472
     473          *source->moments = psfMoments;
    469474          pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    470475
     
    492497        source->modelFlux = psMemIncrRefCounter (modelFluxes->data[minModel]);
    493498
     499        // replace the original moments
     500        *source->moments = psfMoments;
     501
    494502        // subtract the best fit from the object, leave local sky
    495503        pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
  • trunk/psphot/src/psphotKronMasked.c

    r31452 r31673  
    11# include "psphotInternal.h"
    22
    3 bool psphotKronMag (pmSource *source, float radius, psImageMaskType maskVal);
     3bool psphotKronMag (pmSource *source, float radius, float minKronRadius, psImageMaskType maskVal);
    44
    55bool psphotKronMasked (pmConfig *config, const pmFPAview *view, const char *filerule)
     
    6565    if (!status) {
    6666        RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
     67    }
     68
     69    float MIN_KRON_RADIUS = psMetadataLookupF32 (&status, readout->analysis, "MOMENTS_MIN_KRON");
     70    if (!status) {
     71        MIN_KRON_RADIUS = 0.25*RADIUS;
    6772    }
    6873
     
    96101        }
    97102
    98         psphotKronMag (source, RADIUS, maskVal);
     103        psphotKronMag (source, RADIUS, MIN_KRON_RADIUS, maskVal);
    99104
    100105        // re-subtract the object, leave local sky
     
    138143}
    139144
    140 bool psphotKronMag (pmSource *source, float radius, psImageMaskType maskVal) {
     145bool psphotKronMag (pmSource *source, float radius, float minKronRadius, psImageMaskType maskVal) {
    141146
    142147    PS_ASSERT_PTR_NON_NULL(source, false);
     
    219224
    220225    // Saturate the 1st radial moment
    221     float Mrf = MIN(radius, MAX(0.25*radius, RF/RS));
     226    float Mrf = MAX(minKronRadius, RF/RS);
     227    if (sqrt(source->peak->detValue) < 10.0) {
     228        Mrf = MIN (radius, Mrf);
     229    }
    222230
    223231    // Calculate the Kron magnitude (make this block optional?)
     
    263271        }
    264272    }
     273
     274    source->moments->Mrh = Mrf;
     275
    265276    // XXX for a test, save the old values here:
    266     source->moments->KronCore    = source->moments->KronFlux;
     277    source->moments->KronFouter    = source->moments->KronFlux;
    267278    source->moments->KronCoreErr = source->moments->KronFluxErr;
    268279
  • trunk/psphot/src/psphotMagnitudes.c

    r31452 r31673  
    212212        if (status && isfinite(source->apFlux)) {
    213213            Nap ++;
    214         } else {
    215             fprintf (stderr, "failed to measure mag for source @ %f,%f\n", source->peak->xf, source->peak->yf);
    216         }
     214        }
    217215
    218216        // clear the mask bit
  • trunk/psphot/src/psphotRoughClass.c

    r31452 r31673  
    180180            psAssert (status, "missing MOMENTS_SY_MAX");
    181181        }
    182 
    183         psfClump = pmSourcePSFClump (NULL, region, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_AR_MAX);
     182        float MOMENTS_SX_MIN = psMetadataLookupF32(&status, analysis, "MOMENTS_SX_MIN");
     183        if (!status) {
     184            MOMENTS_SX_MIN = psMetadataLookupF32(&status, recipe, "MOMENTS_SX_MIN");
     185            if (!status) {
     186                MOMENTS_SX_MIN = 0.5;
     187            }
     188        }
     189        float MOMENTS_SY_MIN = psMetadataLookupF32(&status, analysis, "MOMENTS_SY_MIN");
     190        if (!status) {
     191            MOMENTS_SY_MIN = psMetadataLookupF32(&status, recipe, "MOMENTS_SY_MIN");
     192            if (!status) {
     193                MOMENTS_SY_MIN = 0.5;
     194            }
     195        }
     196
     197        psfClump = pmSourcePSFClump (NULL, region, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX);
    184198
    185199        psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X",  PS_META_REPLACE, "psf clump center", psfClump.X);
  • trunk/psphot/src/psphotSkyReplace.c

    r29936 r31673  
    4141    // select the corresponding images
    4242    psF32 **image = readout->image->data.F32;
    43     psImageMaskType  **mask  = readout->mask->data.PS_TYPE_IMAGE_MASK_DATA;
     43    // psImageMaskType  **mask  = readout->mask->data.PS_TYPE_IMAGE_MASK_DATA;
    4444    psF32 **back  = background->image->data.F32;
    4545
     
    4747    for (int j = 0; j < readout->image->numRows; j++) {
    4848        for (int i = 0; i < readout->image->numCols; i++) {
    49             if (!mask[j][i]) {
     49            if (isfinite(image[j][i]) && isfinite(back[j][i])) {
    5050                image[j][i] += back[j][i];
    5151            }
  • trunk/psphot/src/psphotSourceStats.c

    r31452 r31673  
    505505    psF32 MOMENTS_AR_MAX = psMetadataLookupF32(&status, recipe, "MOMENTS_AR_MAX"); psAssert (status, "missing MOMENTS_AR_MAX");
    506506
     507    float MOMENTS_SX_MIN = psMetadataLookupF32(&status, recipe, "MOMENTS_SX_MIN");
     508    if (!status) {
     509        MOMENTS_SX_MIN = 0.5;
     510    }
     511    float MOMENTS_SY_MIN = psMetadataLookupF32(&status, recipe, "MOMENTS_SY_MIN");
     512    if (!status) {
     513        MOMENTS_SY_MIN = 0.5;
     514    }
     515
    507516    // when we set the window, we are not attempting to measure spatial variations; we can use a somewhat higher S/N limit
    508517    // since we are using all sources (true?)
     
    544553
    545554        // determine the PSF parameters from the source moment values
    546         pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_AR_MAX);
     555        pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX);
    547556        psLogMsg ("psphot", 3, "radius %.1f, nStars: %d of %d in clump, nSigma: %5.2f, X,  Y: %f, %f (%f, %f)\n", sigma[i], psfClump.nStars, psfClump.nTotal, psfClump.nSigma, psfClump.X, psfClump.Y, sqrt(psfClump.X) / sigma[i], sqrt(psfClump.Y) / sigma[i]);
    548557
Note: See TracChangeset for help on using the changeset viewer.