IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18583


Ignore:
Timestamp:
Jul 16, 2008, 1:07:15 PM (18 years ago)
Author:
eugene
Message:

skip & mask pixels without sufficient input data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotMakeResiduals.c

    r18038 r18583  
    6969    // - set output pixel, weight, and mask
    7070
     71    // XXX need to set these correctly!!
    7172    const int badMask = 1;              // mask bits
    7273    const int poorMask = 2;             //       from psImageInterpolate
    7374    const int clippedMask = 4;          // mask bit set for clipped values
    74 
    75     bool offImage = false;              // pixel is off the image
    7675
    7776    // determine the maximum image size from the input sources
     
    150149        for (int ox = 0; ox < resid->Ro->numCols; ox++) {
    151150
     151            int nGoodPixel = 0;              // pixel is off the image
     152   
    152153            // build the vector of data values for this output pixel
    153154            for (int i = 0; i < input->n; i++) {
     
    160161
    161162                mflux = 0;
    162                 offImage = false;
     163                bool offImage = false;
    163164                if (psImageInterpolate (&flux, &dflux, &mflux, ix, iy, interp) == PS_INTERPOLATE_STATUS_OFF) {
    164165                    // This pixel is off the image
    165166                    offImage = true;
    166                 }
     167                    fmasks->data.U8[i] = 1;
     168                    // fprintf (stderr, "off image: %f %f : %f %f\n", ix, iy, flux, dflux);
     169                }
    167170                fluxes->data.F32[i] = flux;
    168171                dfluxes->data.F32[i] = dflux;
     
    171174                    fmasks->data.U8[i] = 1;
    172175                }
    173                 // fprintf (stderr, "%f %f : %f %f (%d)\n", ix, iy, flux, dflux, fmasks->data.U8[i]);
     176                if (fmasks->data.U8[i] == 0) {
     177                    nGoodPixel ++;
     178                }           
     179            }
     180
     181            // skip pixels which are off the image...
     182            bool validPixel = (SPATIAL_ORDER == 0) ? (nGoodPixel > 1) : (nGoodPixel > 3);
     183            if (!validPixel) {
     184                resid->Ro->data.F32[oy][ox] = 0.0;
     185                resid->Rx->data.F32[oy][ox] = 0.0;
     186                resid->Ry->data.F32[oy][ox] = 0.0;
     187                resid->mask->data.U8[oy][ox] = 1;
     188                continue;
    174189            }
    175190
     
    191206            }
    192207
    193             if (offImage || SPATIAL_ORDER == 0) {
     208            if (SPATIAL_ORDER == 0) {
    194209                // measure the desired statistic on the unclipped pixels
    195210                *fluxStats = *fluxStatsDef;
Note: See TracChangeset for help on using the changeset viewer.