IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2011, 1:19:27 PM (15 years ago)
Author:
eugene
Message:

updates from eam branch

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

Legend:

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

    r30616 r31160  
    7878    remove_argument (N, &argc, argv);
    7979    PLOTDELAY = 1e6*atof(argv[N]);
     80    PLOTSTUFF = TRUE; // always turn on plotting if i request a plot delay
    8081    remove_argument (N, &argc, argv);
    8182  }
  • trunk/Ohana/src/relphot/src/bcatalog.c

    r30616 r31160  
    77  off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm;
    88  float mag;
    9   int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew;
     9  int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Ngalaxy, Npsfqf;
    1010
    1111  // XXX PhotNsec as a global is a bad idea; either get it from catalog
     
    2323  Nmeasure = Naverage = 0;
    2424
    25   Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = 0;
     25  Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = Npsfqf = Ngalaxy = 0;
    2626
    2727  /* exclude stars not in range or with too few measurements */
     
    4444
    4545    Nm = 0;
     46    int nEXT = 0;
     47    int nPSF = 0;
    4648    for (j = 0; j < catalog[0].average[i].Nmeasure; j++) {
    4749
     
    6264      // XXX chnage this to select by bitflags
    6365      if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) { Ndophot ++; continue; }
     66
     67      // skip garbage measurements
     68      if (catalog[0].measure[offset].psfQual < 0.85) { Npsfqf ++; continue; }
     69
     70      // check for galaxies
     71      if (!isnan(catalog[0].measure[offset].Map)) {
     72          if (catalog[0].measure[offset].M - catalog[0].measure[offset].Map > 0.15) {
     73              nEXT ++;
     74          } else {
     75              nPSF ++;
     76          }
     77      }
    6478
    6579      /* select measurements by mag limit */
     
    95109    }
    96110
     111    // skip object if it is likely to be a galaxy
     112    if (nEXT >= nPSF) {
     113      Nmeasure -= Nm;
     114      Ngalaxy ++;
     115      continue;
     116    }
     117
    97118    // XXXX test : what checks do I need to make elsewhere to avoid problems here?
    98119    if (Nm <= STAR_TOOFEW) { /* enough measurements in band? */
     
    121142    fprintf (stderr, "using "OFF_T_FMT" stars ("OFF_T_FMT" measures) of "OFF_T_FMT" for catalog %s\n",
    122143             subcatalog[0].Naverage,  subcatalog[0].Nmeasure,  i, catalog[0].filename);
    123     fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few\n",
    124              Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew);
     144    fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few, %d psfqf, %d galaxies\n",
     145             Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Npsfqf, Ngalaxy);
    125146  }
    126147  return (TRUE);
  • trunk/Ohana/src/relphot/src/load_images.c

    r30616 r31160  
    77  fprintf (stderr, MSG, __VA_ARGS__); }
    88
     9// This function generates a subset of the images based on selections.  Input db has already
     10// been loaded with the raw fits table data
    911SkyList *load_images (FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect) {
    1012
     
    3234  }
    3335
    34   // convert database table to internal structure
     36  // convert database table to internal structure (binary to Image)
    3537  image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
    3638  if (!image) {
     
    4446  MARKTIME("selected images: %f sec\n", dtime);
    4547
     48  // generate db->vtable from db->ftable based on the selection
     49  // XXX does this simply duplicate the memory needlessly?  we recreate these lines
     50  // in reload_images.  If we had saved the line numbers, we could avoid this
    4651  gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, LineNumber, Nsubset);
    4752  MARKTIME("converted ftable to vtable: %f sec\n", dtime);
    4853
     54  // save the subset of images in the static reference in ImageOps, set up indexes
    4955  initImages (subset, Nsubset);
    5056  MARKTIME("init images: %f sec\n", dtime);
    5157
     58  // match chips to mosaics (if applicable)
    5259  initMosaics (subset, Nsubset);
    5360  MARKTIME("init mosaics: %f sec\n", dtime);
  • trunk/Ohana/src/relphot/src/select_images.c

    r30616 r31160  
    3333  struct timeval start, stop;
    3434 
    35   double RmaxSkyRegion, RminSkyRegion, DminSkyRegion, DmaxSkyRegion, RmidSkyRegion;
     35  double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion;
    3636
    3737  double *RmaxSky;
     
    131131    }
    132132
    133     /* define image corners */
    134     Xi[0] = 0;            Yi[0] = 0;
    135     Xi[1] = timage[i].NX; Yi[1] = 0;
    136     Xi[2] = timage[i].NX; Yi[2] = timage[i].NY;
    137     Xi[3] = 0;            Yi[3] = timage[i].NY;
    138     Xi[4] = 0;            Yi[4] = 0;
     133    /* define image corners - note the DIS images (mosaic phu) are special */
     134    if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) {
     135      Xi[0] = -0.5*timage[i].NX; Yi[0] = -0.5*timage[i].NY;
     136      Xi[1] = +0.5*timage[i].NX; Yi[1] = -0.5*timage[i].NY;
     137      Xi[2] = +0.5*timage[i].NX; Yi[2] = +0.5*timage[i].NY;
     138      Xi[3] = -0.5*timage[i].NX; Yi[3] = +0.5*timage[i].NY;
     139      Xi[4] = -0.5*timage[i].NX; Yi[4] = -0.5*timage[i].NY;
     140    } else {
     141      Xi[0] = 0;            Yi[0] = 0;
     142      Xi[1] = timage[i].NX; Yi[1] = 0;
     143      Xi[2] = timage[i].NX; Yi[2] = timage[i].NY;
     144      Xi[3] = 0;            Yi[3] = timage[i].NY;
     145      Xi[4] = 0;            Yi[4] = 0;
     146    }
    139147    found = FALSE;
    140148
    141     /* transform corners to ra,dec -- costs ~3sec for 3M images */
     149    /* transform corners to ra,dec -- costs ~3sec for 3M images (pikake) */
    142150    double RminImage = 360.0;
    143151    double RmaxImage =   0.0;
     
    147155      XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords);
    148156      Ri[j] = ohana_normalize_angle_to_midpoint (Ri[j], RmidSkyRegion);
    149      
     157
    150158      RminImage = MIN(RminImage, Ri[j]);
    151159      RmaxImage = MAX(RmaxImage, Ri[j]);
     
    158166        RminImage = tmp - 360.0;
    159167    }
    160    
     168
    161169    // check that this image is even in range of the searched region
    162170    if (DminImage > DmaxSkyRegion) continue;
     
    182190      tcoords.crval2 = skycoords[m].Dc;
    183191
    184       /* transform to ra,dec */
     192      /* transform corner coords to X,Y in this catalog system */
    185193      InRange = TRUE;
    186194      for (j = 0; (j < 5) && InRange; j++) {
     
    352360  return (Nlo);
    353361}
    354 
    355 off_t getRegionStopByRA (double R, double *Rref, off_t Nregions) {
    356 
    357   // use bisection to find the overlapping mosaic
    358 
    359   off_t Nlo, Nhi, N;
    360 
    361   // find the last mosaic before start
    362   Nlo = 0; Nhi = Nregions;
    363   while (Nhi - Nlo > 10) {
    364     N = 0.5*(Nlo + Nhi);
    365     if (Rref[N] < R) {
    366       Nlo = MAX(N, 0);
    367     } else {
    368       Nhi = MIN(N, Nregions);
    369     }
    370   }
    371   return (Nlo);
    372 }
Note: See TracChangeset for help on using the changeset viewer.