IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 21, 2021, 10:03:06 AM (5 years ago)
Author:
eugene
Message:

major revision of the photometric flat-field correction / grid analysis; strip out code which uses astrometric information to define the grid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relphot.20210521/src/ImageOps.c

    r41557 r41603  
    319319}
    320320
    321 int findCCD (off_t idx, off_t meas, int cat, MeasureTiny *measure) {
    322 
    323   int ccdnum;
    324   double X, Y;
    325   char *pname, *filter, *p, base[256];
    326 
    327   /* identify the ccd on the basis of the photcode name */
    328   pname = GetPhotcodeNamebyCode (image[idx].photcode);
    329 
    330   // skip measurements which do not match one of the requested photcodes (
    331   // (do we not already exclude in bcatalog -- maybe needed for reload_objects?
    332   int Ns = GetActivePhotcodeIndex (measure[0].photcode);
    333   if (Ns < 0) return FALSE;
    334 
    335   filter = photcodes[Ns][0].name;
    336   sprintf (base, "%s.%s.", MOSAICNAME, filter);
    337   if (strncmp (pname, base, strlen (base))) return (FALSE);
    338   p = pname + strlen(base);
    339 
    340   /* p is pointing at the DETECTOR ID part of the photcode: CAMERA.FILTER.DETECTOR
    341      for now, we will let this be of the form SSSSnn where SSS is an arbitrary string
    342      and nn is an integer -> ccdnum */
    343      
    344   /// XXX we have an inconsistency here wrt dvo.layout and dvo.photcode
    345 
    346   while (!isdigit(*p) && *p) p++;
    347   if (*p == 0) return (FALSE);
    348   ccdnum = atoi (p);
    349 
    350   /* ccdnum is an integer, but not necessarily a sequence number.  when the camera layout is
    351      constructed, there will be null values for undefined ccdnums */
    352 
    353   // old code to add this measurement to the grid cell for this chip
    354   // ave = measureT[0].averef;
    355   // ra  = catalog[cat].averageT[ave].R - measureT[0].dR / 3600.0;
    356   // dec = catalog[cat].averageT[ave].D - measureT[0].dD / 3600.0;
    357   // RD_to_XY (&X, &Y, ra, dec, &image[i].coords);
    358 
    359   // XXX we can now use these values (but need to be careful about old formats)
    360   X = measure[0].Xccd;
    361   Y = measure[0].Yccd;
    362   setGridMeasure (meas, cat, X, Y, ccdnum);
    363 
    364   return (TRUE);
    365 }
    366 
    367321void matchImage (Catalog *catalog, off_t meas, int cat, int doImageList) {
    368322
    369323  off_t idx, ID;
    370   int status;
    371324  MeasureTiny *measure;
    372325 
     
    380333  }
    381334  catalog[cat].measureT[meas].myDet = TRUE;
    382 
    383   if (USE_GRID) {
    384     status = findCCD (idx, meas, cat, measure);
    385     if (!status) {
    386       if (VERBOSE2) fprintf (stderr, "failed to determine CCD for "OFF_T_FMT", %d\n",  meas, cat);
    387       return;
    388     }
    389   }
    390335
    391336  // index for (catalog, measure) -> image
     
    690635          continue;
    691636      }
    692       float Mgrid = getMgrid (m, c);
     637      float Mgrid = getMgridTiny (&catalog[c].measureT[m]);
    693638      if (isnan(Mgrid)) {
    694639          Ngrid++;
     
    889834          continue;
    890835      }
    891       float Mgrid = getMgrid (m, c);
     836      float Mgrid = getMgridTiny (&catalog[c].measureT[m]);
    892837      if (isnan(Mgrid)) {
    893838          Ngrid++;
     
    11791124      Mgrp  = getMgrp  (m, c, catalog[c].measureT[m].airmass, NULL);
    11801125      if (isnan(Mgrp)) continue;
    1181       Mgrid = getMgrid (m, c);
     1126      Mgrid = getMgridTiny (&catalog[c].measureT[m]);
    11821127      if (isnan(Mgrid)) continue;
    11831128      N++;
Note: See TracChangeset for help on using the changeset viewer.