IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2012, 6:22:30 AM (14 years ago)
Author:
eugene
Message:

only load images for which the full set of overlapping catalogs were loaded; generate RA range test bands to correctly include / exclude images close to the region boundary; the -reset option should not reset Mcal for any measurements from images which were not loaded (bcatalog needs to accept the current catalog number as a result); when calculating mag:ave values (setMrel), the measurements from unloaded images need to use their own Mcal values (measure.Mcal)

Location:
branches/eam_branches/ipp-20120405/Ohana/src/relphot
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/include/relphot.h

    r33799 r33807  
    198198int           args                PROTO((int argc, char **argv));
    199199int           args_client         PROTO((int argc, char **argv));
    200 int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog));
     200int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog, int Ncat));
    201201void          clean_images        PROTO((void));
    202202void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr));
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/StarOps.c

    r33797 r33807  
    178178
    179179        if (getImageEntry (m, Nc) < 0) {
    180           Mcal = Mmos = Mgrid = 0;
     180          // measurements without an image are either external reference photometry or
     181          // data for which the associated image has not been loaded (probably because of
     182          // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
     183          Mmos = Mgrid = 0;
     184          Mcal = catalog[Nc].measureT[m].Mcal; // check that this is zero for loaded REF value
    181185        } else {
    182186          Mcal  = getMcal  (m, Nc, flatcorr, catalog);
     
    429433
    430434          if (getImageEntry (m, i) < 0) {
     435          XXXX : likely problem -- compare with setMrel_catalog;
    431436            // these detetions have no image (eg, ref values such as 2MASS)
    432437            Mcal = Mmos = Mgrid = 0;
     
    795800        if (isnan(Mgrid)) continue;
    796801
     802        // note that measurements for which the image is not selected will not up modified
     803        // (that is a good thing! -- we keep a prior calibration)
     804
    797805        // set the output calibration
    798806        catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid;
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/bcatalog.c

    r33736 r33807  
    33int LimitDensityCatalog_ByNmeasure (Catalog *subcatalog, Catalog *oldcatalog);
    44
    5 int bcatalog (Catalog *subcatalog, Catalog *catalog) {
     5int bcatalog (Catalog *subcatalog, Catalog *catalog, int Ncat) {
    66 
    77  off_t i, j, offset;
     
    159159      subcatalog[0].measureT[Nmeasure].averef = Naverage;
    160160      if (RESET) {
    161         if (!KEEP_UBERCAL) {
    162           subcatalog[0].measureT[Nmeasure].Mcal = 0;
    163           subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
     161        // only reset Mcal for measures with a matching image
     162        // do not reset Mcal for ubercal images unless explicitly requested
     163        if (subcatalog[0].measureT[Nmeasure].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
     164          if (!KEEP_UBERCAL) {
     165            subcatalog[0].measureT[Nmeasure].Mcal = 0.0;
     166            subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
     167          }
     168        } else {
     169          if (getImageEntry (Nmeasure, Ncat) >= 0) {
     170            subcatalog[0].measureT[Nmeasure].Mcal = 0.0;
     171          }
    164172        }
    165173        subcatalog[0].measureT[Nmeasure].dbFlags &= ~PHOTOM_FLAGS;
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/load_catalogs.c

    r33651 r33807  
    6868
    6969    // select only the brighter stars
    70     bcatalog (&catalog[i], &tcatalog);
     70    bcatalog (&catalog[i], &tcatalog, i);
    7171    dvo_catalog_unlock (&tcatalog);
    7272    dvo_catalog_free (&tcatalog);
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/select_images.c

    r33798 r33807  
    122122    RmaxSkyRegion = RmaxSkyRegionAlt;
    123123  }
    124  
    125124  double RmidSkyRegion = 0.5*(RminSkyRegion + RmaxSkyRegion);
    126125  MARKTIME("create sky region coords: %f sec\n", dtime);
    127126
    128   // if we overlap 0,360, RminSkyRegion will be 180 (or so)
    129 
    130127  dsortindex (RmaxSky, index, skylist[0].Nregions);
    131128  MARKTIME("sort sky coords: %f sec\n", dtime);
     129
     130  // generate a set of Rmin/Rmax values using this RmidSkyRegion for DEC bands of width
     131  // dDecBand (0.1 deg).  DecIndex = (Dec + 90) / dDecBand
     132  double *RminBand, *RmaxBand;
     133  float dDecBand = 0.1;
     134  int NDecBands = 180 / dDecBand + 1;
     135  ALLOCATE (RminBand, double, NDecBands);
     136  ALLOCATE (RmaxBand, double, NDecBands);
     137  for (i = 0; i < NDecBands; i++) {
     138    RminBand[i] = +360.0;
     139    RmaxBand[i] = -360.0;
     140  }
     141 
     142   /* compare with each region file */
     143  for (i = 0; i < skylist[0].Nregions; i++) {
     144    int iDecBandMin = (skylist[0].regions[i][0].Dmin + 90.0) / dDecBand;
     145    int iDecBandMax = (skylist[0].regions[i][0].Dmax + 90.0) / dDecBand;
     146
     147    double RminAlt = ohana_normalize_angle_to_midpoint (skylist[0].regions[i][0].Rmin, RmidSkyRegion);
     148    double RmaxAlt = ohana_normalize_angle_to_midpoint (skylist[0].regions[i][0].Rmax, RmidSkyRegion);
     149
     150    for (j = iDecBandMin; j <= iDecBandMax; j++) {
     151      RminBand[j] = MIN(RminBand[j], RminAlt);
     152      RmaxBand[j] = MAX(RmaxBand[j], RmaxAlt);
     153    }
     154  }
     155
     156# if (0)
     157  // XXX quick test
     158  FILE *fout = fopen ("dec.bands.dat", "w");
     159  for (i = 0; i < NDecBands; i++) {
     160    fprintf (fout, "%d %f : %f - %f\n", (int) i, dDecBand * i - 90.0, RminBand[i], RmaxBand[i]);
     161  }
     162  fclose (fout);
     163# endif
    132164
    133165  if (VERBOSE) fprintf (stderr, "finding images\n");
     
    209241    if (RminImage > RmaxSkyRegion) continue;
    210242    if (RmaxImage < RminSkyRegion) continue;
     243
     244    // the above checks are only valid for the outermost region.  however, at a given
     245    // declination, the range of RA is limited by the actual catalog boundaries
     246    // check if this image is in range for the Dmax and Dmin locations
     247
     248    int iDecBandMin = (DminImage + 90.0) / dDecBand;
     249    int iDecBandMax = (DmaxImage + 90.0) / dDecBand;
     250
     251    // the sky region RA is defined to be 0 - 360.0
     252    if (RminImage > RmaxBand[iDecBandMin]) {
     253      fprintf (stderr, "skip image %s (%f,%f) on boundary\n", timage[i].name, 0.5*(RminImage + RmaxImage), 0.5*(DminImage + DmaxImage));
     254      continue;
     255    }
     256    if (RminImage > RmaxBand[iDecBandMax]) {
     257      fprintf (stderr, "skip image %s (%f,%f) on boundary\n", timage[i].name, 0.5*(RminImage + RmaxImage), 0.5*(DminImage + DmaxImage));
     258      continue;
     259    }
     260    if (RmaxImage < RminBand[iDecBandMin]) {
     261      fprintf (stderr, "skip image %s (%f,%f) on boundary\n", timage[i].name, 0.5*(RminImage + RmaxImage), 0.5*(DminImage + DmaxImage));
     262      continue;
     263    }
     264    if (RmaxImage < RminBand[iDecBandMax]) {
     265      fprintf (stderr, "skip image %s (%f,%f) on boundary\n", timage[i].name, 0.5*(RminImage + RmaxImage), 0.5*(DminImage + DmaxImage));
     266      continue;
     267    }
    211268
    212269    // image overlaps region, keep it
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/setMrelFinal.c

    r33736 r33807  
    6666          }
    6767       
    68           if (!KEEP_UBERCAL) {
    69             catalog[0].measure[m].Mcal = 0;
    70             catalog[0].measure[m].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
     68          // only reset Mcal for measures with a matching image
     69          // do not reset Mcal for ubercal images unless explicitly requested
     70
     71          if (catalog[0].measure[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
     72            if (!KEEP_UBERCAL) {
     73              catalog[0].measure[m].Mcal = 0.0;
     74              catalog[0].measure[m].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
     75            }
     76          } else {
     77            if (getImageEntry (m, 0) >= 0) {
     78              catalog[0].measure[m].Mcal = 0.0;
     79            }
    7180          }
    7281          catalog[0].measure[m].dbFlags &= ~PHOTOM_FLAGS;
Note: See TracChangeset for help on using the changeset viewer.