IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20192


Ignore:
Timestamp:
Oct 16, 2008, 9:19:59 AM (18 years ago)
Author:
eugene
Message:

handle nan values in measurement mags; add stats on rejections; output plot names based on outroot

Location:
trunk/Ohana/src/relphot/src
Files:
2 edited

Legend:

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

    r19897 r20192  
    313313int setMmos (Catalog *catalog, int PoorImages) {
    314314
    315   int i, j, m, c, n, N, Nmax, mark, bad;
     315  int i, j, m, c, n, N, Nmax, mark, bad, Nfew, Nbad, Ncal, Nrel, Ngrid, Nsys;
    316316  float Msys, Mrel, Mcal, Mgrid;
    317317  double *list, *dlist, *Mlist, *dMlist;
     
    335335  ALLOCATE (Mlist, double, Nmax);
    336336  ALLOCATE (dMlist, double, Nmax);
     337
     338  Nfew = Nbad = Ncal = Nrel = Ngrid = Nsys = 0;
    337339
    338340  for (i = 0; i < Nmosaic; i++) {
     
    350352      c = clist[i][j];
    351353     
    352       if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue;
     354      if (catalog[c].measure[m].dbFlags & MEAS_BAD) {
     355          Nbad ++;
     356          continue;
     357      }
    353358      Mcal  = getMcal  (m, c);
    354       if (isnan(Mcal)) continue;
     359      if (isnan(Mcal)) {
     360          Ncal++;
     361          continue;
     362      }
    355363      Mgrid = getMgrid (m, c);
    356       if (isnan(Mgrid)) continue;
     364      if (isnan(Mgrid)) {
     365          Ngrid ++;
     366          continue;
     367      }
    357368      Mrel  = getMrel  (catalog, m, c);
    358       if (isnan(Mrel)) continue;
     369      if (isnan(Mrel)) {
     370          Nrel ++;
     371          continue;
     372      }
    359373     
    360374      n = catalog[c].measure[m].averef;
    361375      Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
     376      if (isnan(Msys)) {
     377        Nsys++;
     378        continue;
     379      }
    362380      list[N]  = Msys - Mrel - Mcal - Mgrid;
    363381      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
     
    375393        fprintf (stderr, "marked image %s (%d), (%d < %d) || (%d < %f*%d)\n", image[imlist[i][0]].name, i, N, IMAGE_TOOFEW, N, IMAGE_GOOD_FRACTION, Nlist[i]);
    376394        mosaic[i].code |= ID_IMAGE_FEW;
     395        Nfew ++;
    377396      } else {
    378397        mosaic[i].code &= ~ID_IMAGE_FEW;
     
    389408  free (Mlist);
    390409  free (dMlist);
     410
     411  fprintf (stderr, "%d mosaics marked having too few measurements (Nbad: %d, Ncal: %d, Ngrid: %d, Nrel: %d, Nsys: %d)\n", Nfew, Nbad, Ncal, Ngrid, Nrel, Nsys);
    391412
    392413  if (PoorImages) {
     
    640661  graphdata.ymin = PlotdMmin;
    641662  graphdata.ymax = PlotdMmax;
    642   plot_list (&graphdata, xlist, Mlist, Nmosaic, "airmass vs Mcal", "airmass.png");
     663  plot_list (&graphdata, xlist, Mlist, Nmosaic, "airmass vs Mcal", "%s.airmass.png", OUTROOT);
    643664  plot_defaults (&graphdata);
    644665  graphdata.size = 1.5;
    645666  graphdata.ptype = 7;
    646   plot_list (&graphdata, Mlist, dlist, Nmosaic, "Mcal vs dMcal", "MdM.png");
     667  plot_list (&graphdata, Mlist, dlist, Nmosaic, "Mcal vs dMcal", "%s.MdM.png", OUTROOT);
    647668
    648669# define NBIN 200
     
    660681  plot_defaults (&graphdata);
    661682  graphdata.style = 1;
    662   plot_list (&graphdata, xlist, Mlist, NBIN, "dMcal hist", "dMcalhist.png");
     683  plot_list (&graphdata, xlist, Mlist, NBIN, "dMcal hist", "%s.dMcalhist.png", OUTROOT);
    663684
    664685  free (dlist);
  • trunk/Ohana/src/relphot/src/StarOps.c

    r17285 r20192  
    3434int setMrel (Catalog *catalog, int Ncatalog) {
    3535
    36   int i, j, k, m, N;
     36  int i, j, k, m, N, Nfew, Nsys, Nbad, Ncal, Nmos, Ngrid;
    3737  float Msys, Mcal, Mmos, Mgrid;
    3838  StatType stats;
     39
     40  Nfew = Nsys = Nbad = Ncal = Nmos = Ngrid = 0;
    3941
    4042  for (i = 0; i < Ncatalog; i++) {
     
    4749      N = 0;
    4850      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    49         if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
     51        if (catalog[i].measure[m].dbFlags & MEAS_BAD) {
     52          Nbad ++;
     53          continue;
     54        }
    5055        // XXX allow REF stars (no Image Entry) to be included in the calculation this
    5156        // should be optionally set, and should allow for REF stars to be downweighted by
     
    5560        } else {
    5661          Mcal  = getMcal  (m, i);
    57           if (isnan(Mcal)) continue;
     62          if (isnan(Mcal)) {
     63            Ncal ++;
     64            continue;
     65          }
    5866          Mmos  = getMmos  (m, i);
    59           if (isnan(Mmos)) continue;
     67          if (isnan(Mmos)) {
     68            Nmos ++;
     69            continue;
     70          }
    6071          Mgrid = getMgrid (m, i);
    61           if (isnan(Mgrid)) continue;
     72          if (isnan(Mgrid)) {
     73            Ngrid++;
     74            continue;
     75          }
    6276        }
    6377
    6478        Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     79        if (isnan(Msys)) {
     80          Nsys++;
     81          continue;
     82        }
    6583        list[N] = Msys - Mcal - Mmos - Mgrid;
    6684        dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
     
    6987      if (N < STAR_TOOFEW) { /* too few measurements */
    7088        catalog[i].average[j].code |= ID_STAR_FEW;
     89        Nfew ++;
    7190      } else {
    7291        catalog[i].average[j].code &= ~ID_STAR_FEW;
     
    8099    }
    81100  }
     101  fprintf (stderr, "%d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngrid: %d, Nsys: %d)\n", Nfew, Nbad, Ncal, Nmos, Ngrid, Nsys);
     102
    82103  return (TRUE);
    83104}
     
    523544  double *xlist, *Mlist;
    524545  Graphdata graphdata;
     546  char *filename, tmp;
    525547
    526548# define NBIN 200
     
    542564  plot_defaults (&graphdata);
    543565  graphdata.style = 1;
    544   plot_list (&graphdata, xlist, Mlist, NBIN, "dMrel hist", "dMhist.png");
     566  plot_list (&graphdata, xlist, Mlist, NBIN, "dMrel hist", "%s.dMhist.png", OUTROOT);
    545567
    546568  free (xlist);
     
    574596  plot_defaults (&graphdata);
    575597  graphdata.ymin = -3.0;
    576   plot_list (&graphdata, xlist, ylist, N, "chisq", NULL);
     598  plot_list (&graphdata, xlist, ylist, N, "chisq", "%s.chisq.png", OUTROOT);
    577599  free (xlist);
    578600  free (ylist);
     
    604626  }
    605627  plot_defaults (&graphdata);
    606   plot_list (&graphdata, xlist, ylist, N, "coords", NULL);
     628  plot_list (&graphdata, xlist, ylist, N, "coords", "%s.coords.png", OUTROOT);
    607629
    608630  free (xlist);
Note: See TracChangeset for help on using the changeset viewer.