IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13570


Ignore:
Timestamp:
May 31, 2007, 2:52:04 AM (19 years ago)
Author:
rhl
Message:

Give names to mask bits for psImageInterpolate; don't despair if a residual pixel's too close to the edge

File:
1 edited

Legend:

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

    r13529 r13570  
    6565    // - re-measure the robust median & sigma
    6666    // - set output pixel, weight, and mask
     67
     68    const int badMask = 1;              // mask bits
     69    const int poorMask = 2;             //       from psImageInterpolate
     70    const int clippedMask = 4;          // mask bit set for clipped values
     71
     72    bool offImage = false;              // pixel is off the image
    6773
    6874    // determine the maximum image size from the input sources
     
    97103        // we will interpolate the image and weight - include the mask or not?
    98104        // XXX consider better values for the mask bits
    99         psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(mode, image, weight, NULL, 0xff, 0.0, 0.0, 1, 2, 0.0);
     105        psImageInterpolateOptions *interp =
     106            psImageInterpolateOptionsAlloc(mode, image, weight, NULL, 0xff, 0.0, 0.0, badMask, poorMask, 0.0);
    100107        psArrayAdd (input,  100, interp);
    101108
     
    149156
    150157                mflux = 0;
    151                 psImageInterpolate (&flux, &dflux, &mflux, ix, iy, interp);
     158                offImage = false;
     159                if (psImageInterpolate (&flux, &dflux, &mflux, ix, iy, interp) == PS_INTERPOLATE_STATUS_OFF) {
     160                    // This pixel is off the image
     161                    offImage = true;
     162                }
    152163                fluxes->data.F32[i] = flux;
    153164                dfluxes->data.F32[i] = dflux;
     
    169180                // make this a user option
    170181                if (swing > nSigma) {
    171                     fmasks->data.U8[i] = 1;
     182                    fmasks->data.U8[i] = clippedMask;
    172183                }
    173184            }               
    174185
    175             if (SPATIAL_ORDER == 0) {
     186            if (offImage || SPATIAL_ORDER == 0) {
    176187                // measure the desired statistic on the unclipped pixels
    177188                *fluxStats = *fluxStatsDef;
    178189                psVectorStats (fluxStats, fluxes, NULL, fmasks, 0xff);
    179190               
    180                 resid->Ro->data.F32[oy][ox] = psStatsGetValue (fluxStats, statOption);
     191                resid->Ro->data.F32[oy][ox] = psStatsGetValue(fluxStats, statOption);
     192                resid->Rx->data.F32[oy][ox] = resid->Ry->data.F32[oy][ox] = 0.0;
    181193                //resid->weight->data.F32[oy][ox] = fluxStats->sampleStdev;
    182194            } else {
     
    213225                resid->Rx->data.F32[oy][ox] = B->data.F64[1];
    214226                resid->Ry->data.F32[oy][ox] = B->data.F64[2];
     227                //resid->weight->data.F32[oy][ox] = XXX;
    215228            }
    216229        }
Note: See TracChangeset for help on using the changeset viewer.