IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20187


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

fix error in associating photcode with chip; handle nan values in measurement mags; add stats on rejections; output plot names based on outroot

File:
1 edited

Legend:

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

    r19897 r20187  
    187187      if (strncmp (pname, base, strlen (base))) continue;
    188188      p = pname + strlen(base);
     189
     190      /* p is pointing at the DETECTOR ID part of the photcode: CAMERA.FILTER.DETECTOR
     191         for now, we will let this be of the form SSSSnn where SSS is an arbitrary string
     192         and nn is an integer -> ccdnum */
     193     
     194      while (!isdigit(*p) && *p) p++;
    189195      if (*p == 0) continue;
    190196      ccdnum = atoi (p);
    191       /* some ambiguity here between seq number and id number */
    192 
     197
     198      /* ccdnum is an integer, but not necessarily a sequence number.  when the camera layout is
     199         constructed, there will be null values for undefined ccdnums */
     200
     201# if (0)
    193202      /* add this measurement to the grid cell for this chip */
    194203      ave = measure[0].averef;
     
    198207      /* X,Y always positive-definite in range 0,0 - dX, dY */
    199208      RD_to_XY (&X, &Y, ra, dec, &image[i].coords);
     209# endif
     210
     211      // XXX we can now use these values (but need to be careful about old formats)
     212      X = measure[0].Xccd;
     213      Y = measure[0].Yccd;
    200214      setGridMeasure (meas, cat, X, Y, ccdnum);
    201215    }
     
    251265void setMcal (Catalog *catalog, int PoorImages) {
    252266
    253   int i, j, m, c, n, N, Nmax, mark, bad;
     267  int i, j, m, c, n, N, Nmax, mark, bad, Nfew, Nbad, Nmos, Ngrid, Nrel, Nsys;
    254268  float Msys, Mrel, Mmos, Mgrid;
    255269  double *list, *dlist;
     
    268282  ALLOCATE (list, double, Nmax);
    269283  ALLOCATE (dlist, double, Nmax);
     284
     285  Nfew = Nbad = Nmos = Ngrid = Nrel = Nsys = 0;
    270286
    271287  for (i = 0; i < Nimage; i++) {
     
    283299      c = clist[i][j];
    284300     
    285       if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue;
     301      if (catalog[c].measure[m].dbFlags & MEAS_BAD) {
     302          Nbad++;
     303          continue;
     304      }
    286305      Mmos  = getMmos  (m, c);
    287       if (isnan(Mmos)) continue;
     306      if (isnan(Mmos)) {
     307          Nmos ++;
     308          continue;
     309      }
    288310      Mgrid = getMgrid (m, c);
    289       if (isnan(Mgrid)) continue;
     311      if (isnan(Mgrid)) {
     312          Ngrid++;
     313          continue;
     314      }
    290315      Mrel  = getMrel  (catalog, m, c);
    291       if (isnan(Mrel)) continue;
     316      if (isnan(Mrel)) {
     317          Nrel ++;
     318          continue;
     319      }
    292320     
    293321      n = catalog[c].measure[m].averef;
    294322      Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
     323      if (isnan(Msys)) {
     324        Nsys++;
     325        continue;
     326      }
    295327      list[N] = Msys - Mrel - Mmos - Mgrid;
    296328      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
     
    304336      if (mark) {
    305337        image[i].code |= ID_IMAGE_FEW;
     338        Nfew ++;
    306339      } else {
    307340        image[i].code &= ~ID_IMAGE_FEW;
     
    316349  free (list);
    317350  free (dlist);
     351
     352  fprintf (stderr, "%d images marked having too few measurements (Nbad: %d, Nmos: %d, Ngrid: %d, Nrel: %d, Nsys: %d)\n", Nfew, Nbad, Nmos, Ngrid, Nrel, Nsys);
     353
    318354  if (PoorImages) {
    319355    IMAGE_BAD = ID_IMAGE_POOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;
     
    397433  graphdata.ymin = PlotdMmin;
    398434  graphdata.ymax = PlotdMmax;
    399   plot_list (&graphdata, xlist, Mlist, Nimage, "airmass vs Mcal", "airmass.png");
     435  plot_list (&graphdata, xlist, Mlist, Nimage, "airmass vs Mcal", "%s.airmass.png", OUTROOT);
    400436  plot_defaults (&graphdata);
    401   plot_list (&graphdata, Mlist, dlist, Nimage, "Mcal vs dMcal", NULL);
     437  plot_list (&graphdata, Mlist, dlist, Nimage, "Mcal vs dMcal", "%s.Mcal.dMcal.png", OUTROOT);
    402438
    403439# define NBIN 200
     
    416452  plot_defaults (&graphdata);
    417453  graphdata.style = 1;
    418   plot_list (&graphdata, xlist, Mlist, NBIN, "dMcal hist", "dMcalhist.png");
     454  plot_list (&graphdata, xlist, Mlist, NBIN, "dMcal hist", "%s.dMcalhist.png", OUTROOT);
    419455
    420456  free (dlist);
Note: See TracChangeset for help on using the changeset viewer.