IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 7, 2012, 10:51:18 AM (14 years ago)
Author:
eugene
Message:

merge changes from eam_branch/ipp-20120905: add satstar profile to psphotStackReadout; skip negative fluxes in standard psphotReadout; replace mask pixel values when growing the CR mask; mask cores of 1st pass sources to avoid excessively close detections; add SUBTRACT_SATSTAR_PROFILE to psphot recipe

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/psphot

  • trunk/psphot/src

  • trunk/psphot/src/psphotAddNoise.c

    r34404 r34418  
    11# include "psphotInternal.h"
     2
     3bool psphotMaskSource(pmSource *source, bool add, psImageMaskType maskVal);
    24
    35bool psphotAddNoise (pmConfig *config, const pmFPAview *view, const char *filerule) {
     
    3032}
    3133
     34static int Nmasked = 0;
     35
    3236bool psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool add) {
    3337
     
    5660    psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
    5761    psAssert (maskVal, "missing mask value?");
     62
     63    psImageMaskType markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT"); // Mask value for bad pixels
     64    psAssert (markVal, "missing mask value?");
    5865
    5966    // increase variance by factor*(object noise):
     
    94101
    95102        pmSourceNoiseOp (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, FACTOR, SIZE, add, maskVal, 0, 0);
     103
     104        psphotMaskSource (source, add, markVal);
    96105    }
    97106    if (add) {
     
    100109        psLogMsg ("psphot.noise", PS_LOG_WARN, "sub noise for %ld objects: %f sec\n", sources->n, psTimerMark ("psphot.noise"));
    101110    }
     111    fprintf (stderr, "masked %d objects\n", Nmasked);
    102112
    103113    psphotVisualShowImage (readout);
     
    105115    return true;
    106116}
     117
     118bool psphotMaskSource(pmSource *source, bool add, psImageMaskType maskVal) {
     119
     120    if (!source) return false;
     121    if (!source->peak) return false; // XXX how can we have a peak-less source?
     122    if (source->type == PM_SOURCE_TYPE_DEFECT) return false;
     123    if (source->type == PM_SOURCE_TYPE_SATURATED) return false;
     124
     125    float Xc = source->peak->xf - source->pixels->col0 - 0.5;
     126    float Yc = source->peak->yf - source->pixels->row0 - 0.5;
     127
     128    psImageMaskType notMaskVal = ~maskVal;
     129
     130    for (int iy = 0; iy < source->pixels->numRows; iy++) {
     131        for (int ix = 0; ix < source->pixels->numCols; ix++) {
     132
     133            float radius = hypot (ix - Xc, iy - Yc) ;
     134
     135            if (radius > 4) continue;
     136
     137            if (add) {
     138              source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] |= maskVal;
     139            } else {
     140              source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] &= notMaskVal;
     141            }
     142        }
     143    }
     144    Nmasked ++;
     145
     146    return true;
     147}
     148
Note: See TracChangeset for help on using the changeset viewer.