IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28185


Ignore:
Timestamp:
Jun 1, 2010, 4:41:14 PM (16 years ago)
Author:
eugene
Message:

modify measurement rejection process

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relphot/src/StarOps.c

    r27790 r28185  
    391391}
    392392
     393# define NSIGMA_CLIP 3.0
     394# define NSIGMA_REJECT 5.0
    393395void clean_measures (Catalog *catalog, int Ncatalog, int final) {
    394396
     
    396398  int i, N, image_bad, TOOFEW;
    397399  off_t *ilist;
    398   double *tlist, *list, *dlist, Ns;
     400  double *tlist, *list, *dlist;
    399401  float Msys, Mcal, Mmos, Mgrid;
    400402  StatType stats;
     403  int Ncal, Nmos, Ngrid, Nfew;
    401404
    402405  if (VERBOSE) fprintf (stderr, "marking poor measures\n");
     
    416419  TOOFEW = MAX (5, STAR_TOOFEW);
    417420
    418   Ns = 3;
    419421  Ndel = Nave = 0;
     422  Ncal = Nmos = Ngrid = Nfew = 0;
    420423  for (i = 0; i < Ncatalog; i++) {
    421424    for (j = 0; j < catalog[i].Naverage; j++) {
     
    433436        /* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */
    434437        Mcal  = getMcal  (m, i);
    435         if (isnan(Mcal)) continue;
     438        if (isnan(Mcal)) { Ncal ++; continue; }
    436439        Mmos  = getMmos  (m, i);
    437         if (isnan(Mmos)) continue;
     440        if (isnan(Mmos)) { Nmos ++; continue; }
    438441        Mgrid = getMgrid (m, i);
    439         if (isnan(Mgrid)) continue;
     442        if (isnan(Mgrid)) { Ngrid ++; continue; }
    440443
    441444        Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     
    444447        N++;
    445448      }
    446       if (N <= TOOFEW) continue;
     449      if (N <= TOOFEW) { Nfew ++; continue; }
    447450
    448451      /* 3-sigma clip based on stats of inner 50% */
     452
     453      // calculated mean of inner 50%
    449454      initstats ("INNER_MEAN");
    450455      liststats (list, dlist, N, &stats);
    451456      stats.sigma = MAX (MIN_ERROR, stats.sigma); /* if measurements agree too well, sigma -> 0.0 */
     457
     458      // ignore entries > 3sigma from inner mean
    452459      for (k = m = 0; k < N; k++) {
    453         if (fabs (list[k] - stats.median) < Ns*stats.sigma) {
     460        if (fabs (list[k] - stats.median) < NSIGMA_CLIP*stats.sigma) {
    454461          list[m] = list[k];
    455462          m++;
    456463        }
    457464      }
     465      // recalculate the mean & sigma of the accepted measurements
    458466      initstats ("MEAN");
    459467      liststats (list, dlist, m, &stats);
     
    483491      if (N < TOOFEW) continue;
    484492
    485       /* mark bad measures */
     493      /* mark bad measures (> 3 sigma deviant) */
    486494      for (k = 0; k < N; k++) {
    487         if (fabs (list[k] - stats.median) > Ns*stats.sigma) {
     495        if (fabs (list[k] - stats.median) > NSIGMA_REJECT*stats.sigma) {
    488496          catalog[i].measure[ilist[k]].dbFlags |= ID_MEAS_POOR_PHOTOM;
    489497          Ndel ++;
Note: See TracChangeset for help on using the changeset viewer.