IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 18, 2012, 10:04:35 AM (14 years ago)
Author:
eugene
Message:

merging changes from eam_branches/ipp-20121130

Location:
trunk/Ohana
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/relphot/Makefile

    r34260 r34844  
    4949$(SRC)/setExclusions.$(ARCH).o   \
    5050$(SRC)/setMrelFinal.$(ARCH).o    \
     51$(SRC)/setMrelCatalog.$(ARCH).o          \
    5152$(SRC)/BoundaryTreeOps.$(ARCH).o         \
    5253$(SRC)/write_coords.$(ARCH).o
     
    7879$(SRC)/setExclusions.$(ARCH).o   \
    7980$(SRC)/setMrelFinal.$(ARCH).o    \
     81$(SRC)/setMrelCatalog.$(ARCH).o    \
    8082$(SRC)/BoundaryTreeOps.$(ARCH).o         \
    8183$(SRC)/write_coords.$(ARCH).o
  • trunk/Ohana/src/relphot/include/relphot.h

    r34642 r34844  
    6363
    6464typedef struct {
     65  int Nfew;
     66  int Ncode;
     67  int Nsys;
     68  int Nbad;
     69  int Ncal;
     70  int Nmos;
     71  int Ngrid;
     72
     73  // NOTE: the following arrays are (possibly) pre-allocated and carried down to each
     74  // thread.  The first 3 (list, dlist, wlist) are used in all relphot analyses; the
     75  // others are only used on the final output steps.
     76
     77  double *list;               // list of measure.mag values for a given star
     78  double *dlist;              // mag errors for a star
     79  double *wlist;              // weights to use for mean mags
     80  double *aplist;             // ap mags for a star
     81  double *kronlist;           // kron mags for a star
     82  double *dkronlist;          // kron mag errors
     83
     84  double *psfqf_list;         // psfqf for all filters
     85  double *psfqfperf_list;     // psfqfperf for all filters
     86  double *stargal_list;       // stargal for all filters
     87
     88  StatType stats;
     89  StatType apstats;
     90  StatType kronstats;
     91} SetMrelInfo;
     92
     93typedef struct {
    6594  AverageTiny *average;       // array of (minimal) average data
    6695  MeasureTiny *measure;       // array of (minimal) measure data
     
    113142
    114143char        *BOUNDARY_TREE;
     144
     145int SET_MREL_VERSION;
    115146
    116147double MAG_LIM;
     
    239270Coords       *getCoords           PROTO((off_t meas, int cat));
    240271off_t         getImageEntry       PROTO((off_t meas, int cat));
     272
     273float         getMcal_alt         PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, float Xccd, float Yccd));
    241274float         getMcal             PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog));
    242275float         getMflat            PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog));
     
    348381int load_tree (char *treefile);
    349382int BoundaryTreePrimaryCell (char *primaryCellName, double ra, double dec);
     383
     384int print_measure_set_alt (Average *average, SecFilt *secfilt, Measure *measure);
     385int setMrel_catalog_alt (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt);
     386int setMrelAverageExposure (off_t meas, int cat, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, AverageTiny *averageT, SecFilt *secfilt, Measure *measure, MeasureTiny *measureT, off_t *found);
     387int setMrelAverageStack (off_t meas, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, char *primaryCell);
     388int setGlobalObjStats (Average *average, Measure *measure);
     389
     390void SetMrelInfoInit (SetMrelInfo *results, int allocLists);
  • trunk/Ohana/src/relphot/src/BoundaryTreeOps.c

    r34260 r34844  
    2121  }
    2222 
     23# define USE_PROJECTION_CELL 0
     24# if (USE_PROJECTION_CELL)
    2325  snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s", tree->name[zone][band]);
     26# else
     27
     28  // I have ra, dec, and the primary projection cell.  In order to choose the primary skycell,
     29  // I just need to project to ra,dec to X,Y based on the center of the cell and then get the subdivision right.
     30   
     31  double x = 0.0;
     32  double y = 0.0;
     33  BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band);
     34 
     35  int xi = x / tree->dX[zone][band];
     36  int yi = y / tree->dY[zone][band];
     37  int N = xi + tree->NX_SUB * yi;
     38 
     39  // XXX short-circuit this for now (we should use this code if we make tree have more variable NX,NY values
     40  // char format[24], skycellname[128];
     41  // int Ndigit = (int)(log10(tree->NX_SUB*tree->NY_SUB)) + 1 ;
     42  // snprintf (format, 24, "%s.%%0%dd", tree->name[zone][band], Ndigit);
     43  // snprintf (skycellname, 128, format, N);
     44
     45  snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s.%03d", tree->name[zone][band], N);
     46# endif
     47
    2448  return TRUE;
    2549}
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r34260 r34844  
    352352
    353353// returns image.Mcal - ff(x,y)
     354float getMcal_alt (off_t meas, int cat, FlatCorrectionTable *flatcorr, float Xccd, float Yccd) {
     355
     356  off_t i;
     357  float value, offset;
     358
     359  i = MeasureToImage[cat][meas];
     360  if (i == -1) return (NAN);
     361
     362  if (image[i].flags & IMAGE_BAD) return (NAN); 
     363  value = image[i].Mcal;
     364  offset = 0.0;
     365
     366  // to do this, I need to pass in the catalog and flatcorr pointers
     367  int flat_id = image[i].photom_map_id;
     368  if (flat_id) {
     369    offset = FlatCorrectionOffset (flatcorr, flat_id, Xccd, Yccd);
     370  }
     371  value -= offset;
     372
     373  return (value);
     374}
     375
     376// returns image.Mcal - ff(x,y)
    354377short getUbercalDist (off_t meas, int cat) {
    355378
     
    400423  if (i == -1) return FALSE;
    401424
    402   // this is a bit crude: stack image names are of the form
    403   // RINGS.V3.skycell.1495.027.sky.191211.stk.988232.cmf
    404   // the primaryCell has a name of the form RINGS.V3.skycell.1495
     425  // this is a bit crude: stack image names are of the form:
     426  // RINGS.V3.skycell.1495.027.sky.191211.stk.988232.cmf.
     427
     428  // the primaryCell has a name of the form RINGS.V3.skycell.1495 or RINGS.V3.skycell.1495.027
     429  // (if we use projection or skycell as the primary)
    405430
    406431  if (!strncmp(image[i].name, name, strlen(name))) return TRUE;
  • trunk/Ohana/src/relphot/src/StarOps.c

    r34749 r34844  
    22
    33static int Nmax;
    4 
    5 typedef struct {
    6   int Nfew;
    7   int Ncode;
    8   int Nsys;
    9   int Nbad;
    10   int Ncal;
    11   int Nmos;
    12   int Ngrid;
    13 
    14   // NOTE: the following arrays are (possibly) pre-allocated and carried down to each
    15   // thread.  The first 3 (list, dlist, wlist) are used in all relphot analyses; the
    16   // others are only used on the final output steps.
    17 
    18   double *list;               // list of measure.mag values for a given star
    19   double *dlist;              // mag errors for a star
    20   double *wlist;              // weights to use for mean mags
    21   double *aplist;             // ap mags for a star
    22   double *kronlist;           // kron mags for a star
    23   double *dkronlist;          // kron mag errors
    24 
    25   double *psfqf_list;         // psfqf for all filters
    26   double *psfqfperf_list;     // psfqfperf for all filters
    27   double *stargal_list;       // stargal for all filters
    28 } SetMrelInfo;
    294
    305enum {THREAD_RUN, THREAD_DONE};
     
    154129  for (i = 0; i < Ncatalog; i++) {
    155130    // pass == -1 for anything other than the final pass
    156     setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt);
     131    switch (SET_MREL_VERSION) {
     132      case 0:
     133        setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt);
     134        break;
     135      case 1:
     136        setMrel_catalog_alt (catalog, i, -1, flatcorr, &results, Nsecfilt);
     137        break;
     138      default:
     139        fprintf (stderr, "invalid setMrel version %d (use 0 or 1)\n", SET_MREL_VERSION);
     140        exit (2);
     141    }
    157142    SetMrelInfoAccum (&summary, &results);
    158143  }
     
    182167
    183168  for (i = 0; i < Ncatalog; i++) {
    184     setMrel_catalog  (catalog, i, pass, flatcorr, &results, Nsecfilt); // XXX add arguments as needed for options
     169    switch (SET_MREL_VERSION) {
     170      case 0:
     171        setMrel_catalog (catalog, i, pass, flatcorr, &results, Nsecfilt);
     172        break;
     173      case 1:
     174        setMrel_catalog_alt (catalog, i, pass, flatcorr, &results, Nsecfilt);
     175        break;
     176      default:
     177        fprintf (stderr, "invalid setMrel version %d (use 0 or 1)\n", SET_MREL_VERSION);
     178        exit (2);
     179    }
    185180    SetMrelInfoAccum (&summary, &results);
    186181  }
     
    286281
    287282    // pass == -1 for anything other than the final pass
    288     setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt);
     283    switch (SET_MREL_VERSION) {
     284      case 0:
     285        setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt);
     286        break;
     287      case 1:
     288        setMrel_catalog_alt (catalog, i, -1, flatcorr, &results, Nsecfilt);
     289        break;
     290      default:
     291        fprintf (stderr, "invalid setMrel version %d (use 0 or 1)\n", SET_MREL_VERSION);
     292        exit (2);
     293    }
    289294    SetMrelInfoAccum (&threadinfo->summary, &results);
    290295  }
     
    332337  liststats_setmode (&kronstats, STATMODE);
    333338
    334   // StatType psfstats;
    335   // liststats_setmode (&psfstats, "MEAN");
    336 
    337339  double *list      = results->list;
    338340  double *dlist     = results->dlist;
     
    363365
    364366    if (isSetMrelFinal) {
     367      // set the name of the primary skycell (this is used in a strcmp to match the skycells in stack detections)
    365368      BoundaryTreePrimaryCell(primaryCell, catalog[Nc].average[j].R, catalog[Nc].average[j].D);
    366369    }
  • trunk/Ohana/src/relphot/src/args.c

    r34642 r34844  
    6464  }
    6565
     66  SET_MREL_VERSION = 1;
     67  if ((N = get_argument (argc, argv, "-set-mrel-version"))) {
     68    remove_argument (N, &argc, argv);
     69    SET_MREL_VERSION = atof(argv[N]);
     70    remove_argument (N, &argc, argv);
     71  }
     72
    6673  VERBOSE = VERBOSE2 = FALSE;
    6774  if ((N = get_argument (argc, argv, "-v"))) {
Note: See TracChangeset for help on using the changeset viewer.