IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39334 for trunk


Ignore:
Timestamp:
Feb 7, 2016, 9:00:51 AM (10 years ago)
Author:
eugene
Message:

add options to skip measure, lensing, galphot, starpar when running dvomerge (for special cases)

Location:
trunk/Ohana/src/dvomerge
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/dvomerge/include/dvomerge.h

    r39329 r39334  
    5757int    RESET_STARPAR;
    5858
     59int    SKIP_MEASURE;
     60int    SKIP_LENSING;
     61int    SKIP_STARPAR;
     62int    SKIP_GALPHOT;
     63
    5964int    REPAIR_BY_OBJID;
    6065
  • trunk/Ohana/src/dvomerge/src/LoadCatalog.c

    r39329 r39334  
    11# include "dvomerge.h"
    2 # define SKIP_GALPHOT 0
    3 # define SKIP_STARPAR 0
    42
    53int LoadCatalog (Catalog *catalog, SkyRegion *region, char *filename, char *mode, int Nsecfilt) {
     
    1311  // XXXX TEMP HACK : skip GALPHOT
    1412
    15   catalog[0].catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT | DVO_LOAD_LENSING | DVO_LOAD_LENSOBJ;
    16 # if (SKIP_GALPHOT) 
    17   catalog[0].catflags = catalog[0].catflags | DVO_SKIP_GALPHOT;
    18 # else
    19   catalog[0].catflags = catalog[0].catflags | DVO_LOAD_GALPHOT;
    20 # endif
     13  catalog[0].catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT | DVO_LOAD_LENSOBJ;
    2114
    22 # if (SKIP_STARPAR) 
    23   catalog[0].catflags = catalog[0].catflags | DVO_SKIP_STARPAR;
    24 # else
    25   catalog[0].catflags = catalog[0].catflags | DVO_LOAD_STARPAR;
    26 # endif
     15  if (SKIP_MEASURE) {
     16    catalog[0].catflags = catalog[0].catflags | DVO_SKIP_MEASURE;
     17  } else {
     18    catalog[0].catflags = catalog[0].catflags | DVO_LOAD_MEASURE;
     19  }
     20
     21  if (SKIP_LENSING)  {
     22    catalog[0].catflags = catalog[0].catflags | DVO_SKIP_LENSING;
     23  } else {
     24    catalog[0].catflags = catalog[0].catflags | DVO_LOAD_LENSING;
     25  }
     26
     27  if (SKIP_STARPAR) {
     28    catalog[0].catflags = catalog[0].catflags | DVO_SKIP_STARPAR;
     29  } else {
     30    catalog[0].catflags = catalog[0].catflags | DVO_LOAD_STARPAR;
     31  }
    2732 
     33  if (SKIP_GALPHOT)  {
     34    catalog[0].catflags = catalog[0].catflags | DVO_SKIP_GALPHOT;
     35  } else {
     36    catalog[0].catflags = catalog[0].catflags | DVO_LOAD_GALPHOT;
     37  }
     38
    2839  catalog[0].catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    2940  catalog[0].catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
  • trunk/Ohana/src/dvomerge/src/args.c

    r39329 r39334  
    4444  if ((N = get_argument (*argc, argv, "-matched-tables"))) {
    4545    MATCHED_TABLES = TRUE;
     46    remove_argument (N, argc, argv);
     47  }
     48
     49  /** allow only certain tables to be merged **/
     50  SKIP_MEASURE = FALSE;
     51  if ((N = get_argument (*argc, argv, "-skip-measure"))) {
     52    SKIP_MEASURE = TRUE;
     53    remove_argument (N, argc, argv);
     54  }
     55  SKIP_LENSING = FALSE;
     56  if ((N = get_argument (*argc, argv, "-skip-lensing"))) {
     57    SKIP_LENSING = TRUE;
     58    remove_argument (N, argc, argv);
     59  }
     60  SKIP_STARPAR = FALSE;
     61  if ((N = get_argument (*argc, argv, "-skip-starpar"))) {
     62    SKIP_STARPAR = TRUE;
     63    remove_argument (N, argc, argv);
     64  }
     65  SKIP_GALPHOT = FALSE;
     66  if ((N = get_argument (*argc, argv, "-skip-galphot"))) {
     67    SKIP_GALPHOT = TRUE;
    4668    remove_argument (N, argc, argv);
    4769  }
     
    284306  }
    285307
     308  /** allow only certain tables to be merged **/
     309  SKIP_MEASURE = FALSE;
     310  if ((N = get_argument (*argc, argv, "-skip-measure"))) {
     311    SKIP_MEASURE = TRUE;
     312    remove_argument (N, argc, argv);
     313  }
     314  SKIP_LENSING = FALSE;
     315  if ((N = get_argument (*argc, argv, "-skip-lensing"))) {
     316    SKIP_LENSING = TRUE;
     317    remove_argument (N, argc, argv);
     318  }
     319  SKIP_STARPAR = FALSE;
     320  if ((N = get_argument (*argc, argv, "-skip-starpar"))) {
     321    SKIP_STARPAR = TRUE;
     322    remove_argument (N, argc, argv);
     323  }
     324  SKIP_GALPHOT = FALSE;
     325  if ((N = get_argument (*argc, argv, "-skip-galphot"))) {
     326    SKIP_GALPHOT = TRUE;
     327    remove_argument (N, argc, argv);
     328  }
     329
    286330  /* extra error messages */
    287331  RESET_STARPAR = FALSE;
  • trunk/Ohana/src/dvomerge/src/build_links.c

    r39329 r39334  
    3232  off_t i, j, N;
    3333  off_t *next_meas;
     34
     35  if (!measure) return NULL;
     36  if (SKIP_MEASURE) return NULL;
    3437
    3538  N = 0;
     
    252255  off_t *next_lens;
    253256
     257  if (!lensing) return NULL;
     258  if (SKIP_LENSING) return NULL;
     259
    254260  N = 0;
    255261
     
    521527
    522528  if (!starpar) return NULL;
     529  if (SKIP_STARPAR) return NULL;
    523530
    524531  /* fix order of StarPar (memory intensive, but fast) */
  • trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c

    r39329 r39334  
    323323    if (MATCHED_TABLES)             { strextend (&command, "-matched-tables"); }
    324324    if (MATCH_BY_EXTERN_ID)         { strextend (&command, "-match-by-extern-id"); }
     325
     326    if (SKIP_MEASURE)               { strextend (&command, "-skip-measure"); }
     327    if (SKIP_LENSING)               { strextend (&command, "-skip-lensing"); }
     328    if (SKIP_GALPHOT)               { strextend (&command, "-skip-galphot"); }
     329    if (SKIP_STARPAR)               { strextend (&command, "-skip-starpar"); }
     330
    325331    if (RESET_STARPAR)              { strextend (&command, "-reset-starpar"); }
    326332    if (ALLOW_MISSING_INPUT_IMAGES) { strextend (&command, "-allow-missing-input-images"); }
  • trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c

    r39262 r39334  
    113113
    114114  /* set up pointers for linked list of measure */
    115   if (output[0].sorted && (output[0].Nmeasure >= output[0].Nmeasure_disk)) {
     115  if (output[0].sorted) {
    116116    // this version is only valid if we have done a full catalog load, and if the catalog
    117117    // is sorted while processed
     
    206206    // 4) average properties from the input and the output db need to be properly merged.
    207207
    208     int Nreplace = 0;
    209     if (REPLACE_TYCHO) {
    210       int Minp =  input[0].average[N].measureOffset;
    211       Nreplace = replace_tycho (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[Minp]);
    212       if (Nreplace == 6) {
    213         output[0].found_t[n] = Nmeas;
    214         i++;
    215         continue;
    216       }
    217     }
    218 
    219208    /** add ALL measurements for this input average object **/
    220     for (Nin = Nreplace; Nin < input[0].average[N].Nmeasure; Nin ++) {
    221       offset = input[0].average[N].measureOffset + Nin;
    222 
    223       if (REPLACE_BY_PHOTCODE) {
    224         // index to first measure for this object
    225         // XXX this does not support lensing, starpar, or galphot measurements
    226         if (replace_match (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[offset])) {
     209    if (output[0].measure && !SKIP_MEASURE) {
     210
     211      int Nreplace = 0;
     212      if (REPLACE_TYCHO) {
     213        int Minp =  input[0].average[N].measureOffset;
     214        Nreplace = replace_tycho (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[Minp]);
     215        if (Nreplace == 6) {
     216          output[0].found_t[n] = Nmeas;
     217          i++;
    227218          continue;
     219          // XXX this is probably a bad idea: breaks other tables
    228220        }
    229221      }
    230       /* add to end of measurement list */
    231       add_meas_link (&output[0].average[n], next_meas, Nmeas, NMEAS);
     222
     223      for (Nin = Nreplace; Nin < input[0].average[N].Nmeasure; Nin ++) {
     224        offset = input[0].average[N].measureOffset + Nin;
     225
     226        if (REPLACE_BY_PHOTCODE) {
     227          // index to first measure for this object
     228          // XXX this does not support lensing, starpar, or galphot measurements
     229          if (replace_match (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[offset])) {
     230            continue;
     231          }
     232        }
     233        /* add to end of measurement list */
     234        add_meas_link (&output[0].average[n], next_meas, Nmeas, NMEAS);
    232235       
    233       // set the new measurements
    234       output[0].measure[Nmeas] = input[0].measure[offset];
    235 
    236       // old code: find R,D using average_in[0], the get offset relative to average_out[0].  no longer
    237       // needed since we carry around R,D
    238       // Rin = input[0].average[N].R - input[0].measure[offset].dR / 3600.0;
    239       // Din = input[0].average[N].D - input[0].measure[offset].dD / 3600.0;
    240       // output[0].measure[Nmeas].dR = 3600.0*(output[0].average[n].R - Rin);
    241       // output[0].measure[Nmeas].dD = 3600.0*(output[0].average[n].D - Din);
    242 
    243       output[0].measure[Nmeas].dbFlags  = 0;  // XXX why reset these?
    244       output[0].measure[Nmeas].averef   = n;
    245       output[0].measure[Nmeas].objID    = output[0].average[n].objID;
    246       output[0].measure[Nmeas].catID    = output[0].catID;
    247 
    248       assert (output[0].measure[Nmeas].averef < Nave);
    249 
    250       // fprintf (stderr, "Nave : "OFF_T_FMT", Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n",  n,  Nmeas, output[0].measure[Nmeas].dR, output[0].measure[Nmeas].dD, output[0].measure[i].catID);
    251 
    252       float dRoff = dvoOffsetR(&output[0].measure[Nmeas], &output[0].average[n]);
    253 
    254       // rationalize R
    255       if (dRoff > +180.0*3600.0) {
    256         // average on high end of boundary, move star up
    257         output[0].measure[Nmeas].R += 360.0;
    258         dRoff -= 360.0*3600.0;
    259       }
    260       if (dRoff < -180.0*3600.0) {
    261         // average on low end of boundary, move star down
    262         output[0].measure[Nmeas].R -= 360.0;
    263         dRoff += 360.0*3600.0;
    264       }
    265       if (fabs(dRoff) > 10*RADIUS) {
    266         // take declination into account and check again.
    267         double cosD = cos(RAD_DEG*output[0].average[n].D);
    268         if (fabs(dRoff*cosD) > 10*RADIUS) {
    269           fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    270                    output[0].average[n].R, output[0].average[n].D,
    271                    output[0].measure[Nmeas].R, output[0].measure[Nmeas].D,
    272                    X1[i], X2[Jmin], Y1[i], Y2[Jmin]);
    273           // XXX abort on this? -- this is a bad failure...
    274         }
    275       }
    276       output[0].average[n].Nmeasure ++;
    277       Nmeas ++;
     236        // set the new measurements
     237        output[0].measure[Nmeas] = input[0].measure[offset];
     238
     239        // old code: find R,D using average_in[0], the get offset relative to average_out[0].  no longer
     240        // needed since we carry around R,D
     241        // Rin = input[0].average[N].R - input[0].measure[offset].dR / 3600.0;
     242        // Din = input[0].average[N].D - input[0].measure[offset].dD / 3600.0;
     243        // output[0].measure[Nmeas].dR = 3600.0*(output[0].average[n].R - Rin);
     244        // output[0].measure[Nmeas].dD = 3600.0*(output[0].average[n].D - Din);
     245
     246        output[0].measure[Nmeas].dbFlags  = 0;  // XXX why reset these?
     247        output[0].measure[Nmeas].averef   = n;
     248        output[0].measure[Nmeas].objID    = output[0].average[n].objID;
     249        output[0].measure[Nmeas].catID    = output[0].catID;
     250
     251        assert (output[0].measure[Nmeas].averef < Nave);
     252
     253        // fprintf (stderr, "Nave : "OFF_T_FMT", Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n",  n,  Nmeas, output[0].measure[Nmeas].dR, output[0].measure[Nmeas].dD, output[0].measure[i].catID);
     254
     255        float dRoff = dvoOffsetR(&output[0].measure[Nmeas], &output[0].average[n]);
     256
     257        // rationalize R
     258        if (dRoff > +180.0*3600.0) {
     259          // average on high end of boundary, move star up
     260          output[0].measure[Nmeas].R += 360.0;
     261          dRoff -= 360.0*3600.0;
     262        }
     263        if (dRoff < -180.0*3600.0) {
     264          // average on low end of boundary, move star down
     265          output[0].measure[Nmeas].R -= 360.0;
     266          dRoff += 360.0*3600.0;
     267        }
     268        if (fabs(dRoff) > 10*RADIUS) {
     269          // take declination into account and check again.
     270          double cosD = cos(RAD_DEG*output[0].average[n].D);
     271          if (fabs(dRoff*cosD) > 10*RADIUS) {
     272            fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
     273                     output[0].average[n].R, output[0].average[n].D,
     274                     output[0].measure[Nmeas].R, output[0].measure[Nmeas].D,
     275                     X1[i], X2[Jmin], Y1[i], Y2[Jmin]);
     276            // XXX abort on this? -- this is a bad failure...
     277          }
     278        }
     279        output[0].average[n].Nmeasure ++;
     280        Nmeas ++;
     281      }
    278282    }
    279283
    280284    // if lensing measurements exist, add them too
    281     if (output[0].lensing) {
     285    if (output[0].lensing && !SKIP_LENSING) {
    282286      for (Nin = 0; Nin < input[0].average[N].Nlensing; Nin++) {
    283287        /* add to end of lensing list */
     
    297301
    298302    // if lensing measurements exist, add them too
    299     if (output[0].starpar) {
     303    if (output[0].starpar && !SKIP_STARPAR) {
    300304      for (Nin = 0; Nin < input[0].average[N].Nstarpar; Nin++) {
    301305        /* add to end of lensing list */
     
    315319
    316320    // if galphot measurements exist, add them too
    317     if (output[0].galphot) {
     321    if (output[0].galphot && !SKIP_GALPHOT) {
    318322      for (Nin = 0; Nin < input[0].average[N].Ngalphot; Nin++) {
    319323        /* add to end of galphot list */
     
    405409    output[0].average[Nave].R              = input[0].average[N].R;
    406410    output[0].average[Nave].D              = input[0].average[N].D;
    407     output[0].average[Nave].measureOffset  = Nmeas;
    408411    output[0].average[Nave].objID          = objID; // we create objID values in the context of the output db
    409412    output[0].average[Nave].catID          = catID; // we create catID values in the context of the output db
     
    435438
    436439    /** add measurements for this input average object **/
    437     for (Nin = 0; Nin < input[0].average[N].Nmeasure; Nin ++) {
    438       offset = input[0].average[N].measureOffset + Nin;
    439 
    440       // supply the measurments from this detection
    441       output[0].measure[Nmeas]           = input[0].measure[offset];
    442 
    443       // the following measure elements cannot be set until here:
    444       output[0].measure[Nmeas].dbFlags  = 0;
    445       output[0].measure[Nmeas].averef   = Nave;
    446       output[0].measure[Nmeas].objID    = output[0].average[Nave].objID;
    447       output[0].measure[Nmeas].catID    = output[0].catID;
    448 
    449       // as we add measurements, update Nmeasure to match
    450       output[0].average[Nave].Nmeasure ++;
    451 
    452       /* we set next[Nmeas] to -1 here, and update correctly below */
    453       next_meas[Nmeas] = -1;
    454       Nmeas ++;
    455     }
    456     int Ngroup = input[0].average[N].Nmeasure;
    457     for (j = 0; j < Ngroup - 1; j++) {
    458       next_meas[Nmeas - Ngroup + j] = Nmeas - Ngroup + j + 1;
     440    if (output[0].measure && !SKIP_MEASURE && input[0].average[N].Nmeasure) {
     441      output[0].average[Nave].measureOffset  = Nmeas;
     442      for (Nin = 0; Nin < input[0].average[N].Nmeasure; Nin ++) {
     443        offset = input[0].average[N].measureOffset + Nin;
     444       
     445        // supply the measurments from this detection
     446        output[0].measure[Nmeas]           = input[0].measure[offset];
     447       
     448        // the following measure elements cannot be set until here:
     449        output[0].measure[Nmeas].dbFlags  = 0;
     450        output[0].measure[Nmeas].averef   = Nave;
     451        output[0].measure[Nmeas].objID    = output[0].average[Nave].objID;
     452        output[0].measure[Nmeas].catID    = output[0].catID;
     453       
     454        // as we add measurements, update Nmeasure to match
     455        output[0].average[Nave].Nmeasure ++;
     456
     457        /* we set next[Nmeas] to -1 here, and update correctly below */
     458        next_meas[Nmeas] = -1;
     459        Nmeas ++;
     460      }
     461      int Ngroup = input[0].average[N].Nmeasure;
     462      for (j = 0; j < Ngroup - 1; j++) {
     463        next_meas[Nmeas - Ngroup + j] = Nmeas - Ngroup + j + 1;
     464      }
    459465    }
    460466
    461467    /** add lensing for this input average object **/
    462     if (output[0].lensing) {
     468    if (output[0].lensing && !SKIP_LENSING && input[0].average[N].Nlensing) {
    463469      output[0].average[Nave].lensingOffset  = Nlens;
    464470      for (Nin = 0; Nin < input[0].average[N].Nlensing; Nin ++) {
     
    486492
    487493    /** add starpar for this input average object **/
    488     if (output[0].starpar) {
     494    if (output[0].starpar && !SKIP_STARPAR && input[0].average[N].Nstarpar) {
    489495      output[0].average[Nave].starparOffset  = Nstar;
    490496      for (Nin = 0; Nin < input[0].average[N].Nstarpar; Nin ++) {
     
    512518
    513519    /** add galphot for this input average object **/
    514     if (output[0].galphot) {
     520    if (output[0].galphot && !SKIP_GALPHOT && input[0].average[N].Ngalphot) {
    515521      output[0].average[Nave].galphotOffset  = Ngalp;
    516522      for (Nin = 0; Nin < input[0].average[N].Ngalphot; Nin ++) {
     
    543549
    544550  REALLOCATE (output[0].average, Average, Nave);
    545   REALLOCATE (output[0].measure, Measure, Nmeas);
    546   REALLOCATE (output[0].lensing, Lensing, Nlens);
    547   REALLOCATE (output[0].starpar, StarPar, Nstar);
    548   REALLOCATE (output[0].galphot, GalPhot, Ngalp);
     551  if (!SKIP_MEASURE) { REALLOCATE (output[0].measure, Measure, Nmeas); }
     552  if (!SKIP_LENSING) { REALLOCATE (output[0].lensing, Lensing, Nlens); }
     553  if (!SKIP_STARPAR) { REALLOCATE (output[0].starpar, StarPar, Nstar); }
     554  if (!SKIP_GALPHOT) { REALLOCATE (output[0].galphot, GalPhot, Ngalp); }
    549555 
    550556# define NOSORT 0
     
    553559  } else {
    554560    output[0].sorted = TRUE;
    555     output[0].measure = sort_measure (output[0].average, Nave, output[0].measure, Nmeas, next_meas);
    556     output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlens, next_lens);
    557     output[0].starpar = sort_starpar (output[0].average, Nave, output[0].starpar, Nstar, next_star);
    558     output[0].galphot = sort_galphot (output[0].average, Nave, output[0].galphot, Ngalp, next_galp);
     561    if (!SKIP_MEASURE) { output[0].measure = sort_measure (output[0].average, Nave, output[0].measure, Nmeas, next_meas); }
     562    if (!SKIP_LENSING) { output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlens, next_lens); }
     563    if (!SKIP_STARPAR) { output[0].starpar = sort_starpar (output[0].average, Nave, output[0].starpar, Nstar, next_star); }
     564    if (!SKIP_GALPHOT) { output[0].galphot = sort_galphot (output[0].average, Nave, output[0].galphot, Ngalp, next_galp); }
    559565  }
    560566
     
    562568  output[0].objID    = objID; // new max value, save on catalog close
    563569  output[0].Naverage = Nave;
    564   output[0].Nmeasure = Nmeas;
    565   output[0].Nlensing = Nlens;
    566   output[0].Nstarpar = Nstar;
    567   output[0].Ngalphot = Ngalp;
     570  if (!SKIP_MEASURE) { output[0].Nmeasure = Nmeas; }
     571  if (!SKIP_LENSING) { output[0].Nlensing = Nlens; }
     572  if (!SKIP_STARPAR) { output[0].Nstarpar = Nstar; }
     573  if (!SKIP_GALPHOT) { output[0].Ngalphot = Ngalp; }
    568574  output[0].Nsecfilt_mem = Nave*NsecfiltOut;
    569575  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nlens, Ngalp: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nlens, Ngalp, Nmatch);
Note: See TracChangeset for help on using the changeset viewer.