IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4188


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

exploring the defect strategy

Location:
trunk/psphot/src
Files:
3 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}
  • trunk/psphot/src/psUtils.c

    r4129 r4188  
    11# include "psphot.h"
    2 
    3 static psHash *timers = NULL;
    42
    53// set actual region based on image parameters
     
    2119}
    2220
     21static psHash *timers = NULL;
    2322
    2423// start/restart a named timer
     
    110109    }
    111110    return (TRUE);
     111}
     112
     113// find the location of the specified argument
     114int psArgumentGet (int argc, char **argv, char *arg) {
     115
     116    int i;
     117
     118    for (i = 0; i < argc; i++) {
     119        if (!strcmp(argv[i], arg))
     120            return (i);
     121    }
     122 
     123    return ((int)NULL);
     124}
     125
     126// remove the specified argument (by location)
     127int psArgumentRemove (int N, int *argc, char **argv) {
     128
     129    int i;
     130
     131    if ((N != (int)NULL) && (N != 0)) {
     132        (*argc)--;
     133        for (i = N; i < *argc; i++) {
     134            argv[i] = argv[i+1];
     135        }
     136    }
     137
     138    return (N);
    112139}
    113140
  • trunk/psphot/src/psphot.c

    r4129 r4188  
    3434    psf = choose_psf_model (image, config, sources);
    3535
    36     psImage *zap = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
    37     psImageInit (zap, 0);
    38     find_defects (zap, sources, config, psf);
    39     dump_image (zap, argv[2]);
    40     exit (0);
     36    if (0) {
     37      psImage *zap = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
     38      psImageInit (zap, 0);
     39      find_defects (zap, sources, config, psf);
     40      dump_image (zap, argv[2]);
     41      exit (0);
     42    }
    4143
    4244    // test PSF on all except SATURATE and DEFECT (artifacts)
Note: See TracChangeset for help on using the changeset viewer.