IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 9, 2005, 6:28:24 AM (21 years ago)
Author:
eugene
Message:

exploring the defect strategy

File:
1 edited

Legend:

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

    r4129 r4188  
    1010  float gradx, grady, gradlim;
    1111  float N0, N1, peak, sky;
    12   int x, y;
     12  int x, y, Nzap;
     13
     14  psTimerStart ("psphot");
    1315
    1416  // measure the x and y max gradients
     
    5658     
    5759  // search for pixels with (dfdy > grady) or (dfdx > gradx) allowing for Nsigma outliers
     60  Nzap = 0;
    5861  for (int i = 0; i < sources->n; i++) {
    5962    psSource *source = sources->data[i];
     
    6669    sky  = source->moments->Sky;
    6770    peak = source->moments->Peak - sky;
     71    if (peak < 0) continue;
    6872    if (peak < peak*PS_MIN(gradx, grady) + NSIGMA*sqrt(2*sky + peak)) continue;
    6973    psTrace (".psphot.defects", 4, "peak: %f, SN: %f\n", peak, source->moments->SN);
     
    7478        N0 = image->data.F32[iy][ix];
    7579        N1 = image->data.F32[iy][ix + 1];
    76         gradlim = fabs(N1 - N0 - NSIGMA*(sqrt(N1) + sqrt(N0))) / peak;
    77         // XXX this line is wrong: we should use the appropriate noise from the noise map
     80        gradlim = fabs(N1 - N0) - NSIGMA*(sqrt(N1 + N0));
     81        // gradient - N*sigma
     82        gradlim = gradlim / peak;
    7883       
    7984        // if gradient is too large, zap the high pixel
    8085        if (gradlim < gradx) continue;
    81         if (N1 > N0) {
     86        if (N0 > N1) {
     87          zap->data.U8[iy][ix] = 1;
     88        } else {
    8289          zap->data.U8[iy][ix + 1] = 1;
    83         } else {
    84           zap->data.U8[iy][ix] = 1;
    8590        }
    8691      }
     
    9297        N0 = image->data.F32[iy][ix];
    9398        N1 = image->data.F32[iy + 1][ix];
    94         gradlim = fabs(N1 - N0 - NSIGMA*(sqrt(N1) + sqrt(N0))) / peak;
    95         // XXX this line is wrong: we should use the appropriate noise from the noise map
     99        gradlim = fabs(N1 - N0) - NSIGMA*(sqrt(N1 + N0));
     100        gradlim = gradlim / peak;
    96101       
    97102        // if gradient is too large, zap the high pixel
    98103        // note the inefficiency: we are re-testing known zapped entries
    99         if (gradlim > grady) continue;
    100         if (N1 > N0) {
     104        if (gradlim < grady) continue;
     105        if (N0 > N1) {
     106          zap->data.U8[iy][ix] = 1;
     107        } else {
    101108          zap->data.U8[iy + 1][ix] = 1;
    102         } else {
    103           zap->data.U8[iy][ix] = 1;
    104109        }           
    105110      }
    106111    }
    107     psFree (zap);
    108112
    109113    // mask & zero the zapped pixels
     
    114118        y = iy + image->row0;
    115119        zapmask->data.F32[y][x] = 1;
     120        Nzap ++;
    116121      }
    117122    }
     123    psFree (zap);
    118124
    119125  }
     126  psLogMsg ("psphot", 3, "zap: %f sec, %d pixels\n", psTimerMark ("psphot"), Nzap);
     127
    120128  return (true);
    121129}
Note: See TracChangeset for help on using the changeset viewer.