IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 6, 2009, 7:13:34 AM (18 years ago)
Author:
eugene
Message:

update to psImageMaskType and associated (psphot, psastro, ppImage, ppMerge, ppSim, ppStats, ppArith)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20081230/psphot/src/psphotMakeResiduals.c

    r20453 r21087  
    11# include "psphotInternal.h"
    22
    3 bool psphotMakeResiduals (psArray *sources, psMetadata *recipe, pmPSF *psf, psMaskType maskVal) {
     3XXX this function is probably broken: fmasks is confused between Image and Vector.  it is used by psVectorStats, so it must be Vector, but
     4  is populated by mflux, which seems to be Image..
     5bool psphotMakeResiduals (psArray *sources, psMetadata *recipe, pmPSF *psf, psImageMaskType maskVal) {
    46
    57    bool status, isPSF;
    68    double flux, dflux;
    7     psU8 mflux;
     9    psImageMaskType mflux;
    810
    911    psTimerStart ("psphot.residuals");
     
    6971    // - set output pixel, weight, and mask
    7072
    71     // XXX need to set these correctly!!
     73    XXX need to set these correctly based on the RECIPE values
    7274    const int badMask = 1;              // mask bits
    7375    const int poorMask = 2;             //       from psImageInterpolate
     
    9597        psImage *image  = psImageCopy (NULL, source->pixels,   PS_TYPE_F32);
    9698        psImage *weight = psImageCopy (NULL, source->weight,   PS_TYPE_F32);
    97         psImage *mask   = psImageCopy (NULL, source->maskView, PS_TYPE_U8);
     99        psImage *mask   = psImageCopy (NULL, source->maskView, PS_TYPE_IMAGE_MASK);
    98100        pmModelSub (image, mask, model, PM_MODEL_OP_FUNC, maskVal);
    99101
     
    131133    psVector *fluxes  = psVectorAlloc (input->n, PS_TYPE_F32);
    132134    psVector *dfluxes = psVectorAlloc (input->n, PS_TYPE_F32);
    133     psVector *fmasks  = psVectorAlloc (input->n, PS_TYPE_U8);
     135    psVector *fmasks  = psVectorAlloc (input->n, PS_TYPE_VECTOR_MASK);
    134136
    135137    // statistic to use to determine baseline for clipping
     
    166168                    // This pixel is off the image
    167169                    offImage = true;
    168                     fmasks->data.U8[i] = 1;
     170                    fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1;
    169171                    // fprintf (stderr, "off image: %f %f : %f %f\n", ix, iy, flux, dflux);
    170172                }
    171173                fluxes->data.F32[i] = flux;
    172174                dfluxes->data.F32[i] = dflux;
    173                 fmasks->data.U8[i] = mflux;
     175                fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = mflux; // XXX is mflux IMAGE or VECTOR type?
    174176                if (isnan(flux)) {
    175                     fmasks->data.U8[i] = 1;
    176                 }
    177                 if (fmasks->data.U8[i] == 0) {
     177                    fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1;
     178                }
     179                if (fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] == 0) {
    178180                    nGoodPixel ++;
    179181                }
     
    186188                resid->Rx->data.F32[oy][ox] = 0.0;
    187189                resid->Ry->data.F32[oy][ox] = 0.0;
    188                 resid->mask->data.U8[oy][ox] = 1;
     190                resid->mask->data.PS_TYPE_IMAGE_MASK_DATA[oy][ox] = 1;
    189191                continue;
    190192            }
     
    204206                // make this a user option
    205207                if (swing > nSigma) {
    206                     fmasks->data.U8[i] = clippedMask;
    207                 }
    208                 if (!fmasks->data.U8[i]) nKeep++;
     208                    fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = clippedMask;
     209                }
     210                if (!fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i]) nKeep++;
    209211            }
    210212
     
    220222
    221223                if (fabs(resid->Ro->data.F32[oy][ox]) < pixelSN*fluxStats->sampleStdev/sqrt(nKeep)) {
    222                   resid->mask->data.U8[oy][ox] = 1;
    223                 }
    224 
    225                 // fprintf (stderr, "res: %2d %2d : %6.4f  %6.4f  %6.4f   %3d  %1d\n", ox, oy, resid->Ro->data.F32[oy][ox], fluxStats->sampleStdev, fluxStats->sampleStdev/sqrt(nKeep), nKeep, resid->mask->data.U8[oy][ox]);
     224                  resid->mask->data.PS_TYPE_IMAGE_MASK_DATA[oy][ox] = 1;
     225                }
     226
     227                // fprintf (stderr, "res: %2d %2d : %6.4f  %6.4f  %6.4f   %3d  %1d\n", ox, oy, resid->Ro->data.F32[oy][ox], fluxStats->sampleStdev, fluxStats->sampleStdev/sqrt(nKeep), nKeep, resid->mask->data.PS_TYPE_IMAGE_MASK_DATA[oy][ox]);
    226228
    227229            } else {
     
    230232                psVectorInit(B, 0.0);
    231233                for (int i = 0; i < fluxes->n; i++) {
    232                     if (fmasks->data.U8[i]) continue;
     234                    if (fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue;
    233235                    B->data.F64[0] += fluxes->data.F32[i]/dfluxes->data.F32[i];
    234236                    B->data.F64[1] += fluxes->data.F32[i]*xC->data.F32[i]/dfluxes->data.F32[i];
     
    260262
    261263                float dRo = sqrt(A->data.F32[0][0]);
    262                 // fprintf (stderr, "res: %2d %2d : %6.4f  %6.4f  %6.4f   %3d  %1d\n", ox, oy, resid->Ro->data.F32[oy][ox], dRo, dRo/sqrt(nKeep), nKeep, resid->mask->data.U8[oy][ox]);
     264                // fprintf (stderr, "res: %2d %2d : %6.4f  %6.4f  %6.4f   %3d  %1d\n", ox, oy, resid->Ro->data.F32[oy][ox], dRo, dRo/sqrt(nKeep), nKeep, resid->mask->data.PS_TYPE_IMAGE_MASK_DATA[oy][ox]);
    263265
    264266                if (fabs(resid->Ro->data.F32[oy][ox]) < pixelSN*dRo/sqrt(nKeep)) {
    265                   resid->mask->data.U8[oy][ox] = 1;
     267                  resid->mask->data.PS_TYPE_IMAGE_MASK_DATA[oy][ox] = 1;
    266268                }
    267269                //resid->weight->data.F32[oy][ox] = XXX;
Note: See TracChangeset for help on using the changeset viewer.