IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38445


Ignore:
Timestamp:
Jun 12, 2015, 9:35:20 PM (11 years ago)
Author:
eugene
Message:

merge from trunk

Location:
branches/eam_branches/ipp-20150419/Ohana/src/relphot
Files:
13 edited

Legend:

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

    r38316 r38445  
    237237char        *BOUNDARY_TREE;
    238238
    239 int SET_MREL_VERSION;
     239// XXX deprecate int SET_MREL_VERSION;
    240240int IS_DIFF_DB;
    241241
     
    525525
    526526int launch_region_hosts (RegionHostTable *regionHosts);
    527 int strextend (char *input, char *format,...);
    528527
    529528Image *ImageTableLoad(char *filename, off_t *nimage);
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/ImageTable.c

    r37807 r38445  
    77  FITS_DB db;
    88
     9  gfits_db_init (&db);
    910  db.mode   = dvo_catalog_catmode (CATMODE);
    1011  db.format = dvo_catalog_catformat (CATFORMAT);
     
    2728  // convert database table to internal structure (binary to Image)
    2829  // 'image' points to the same memory as db->ftable->buffer
    29   Image *image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped);
     30  Image *image = gfits_table_get_Image (&db.ftable, &Nimage, &db.scaledValue, &db.nativeOrder);
    3031  if (!image) {
    3132    Shutdown ("ERROR: failed to read images");
     
    4546
    4647  // setup image table format and lock
     48  gfits_db_init (&db);
    4749  db.mode   = dvo_catalog_catmode (CATMODE);
    4850  db.format = dvo_catalog_catformat (CATFORMAT);
     51
    4952  status    = dvo_image_lock (&db, filename, 60.0, LCK_XCLD);  // shorter timeout?
    5053  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/args.c

    r38433 r38445  
    7676  }
    7777
    78   SET_MREL_VERSION = 1;
    79   if ((N = get_argument (argc, argv, "-set-mrel-version"))) {
    80     remove_argument (N, &argc, argv);
    81     SET_MREL_VERSION = atof(argv[N]);
    82     remove_argument (N, &argc, argv);
    83   }
    84 
    8578  VERBOSE = VERBOSE2 = FALSE;
    8679  if ((N = get_argument (argc, argv, "-v"))) {
     
    547540  }
    548541
    549   SET_MREL_VERSION = 1;
    550   if ((N = get_argument (argc, argv, "-set-mrel-version"))) {
    551     remove_argument (N, &argc, argv);
    552     SET_MREL_VERSION = atof(argv[N]);
    553     remove_argument (N, &argc, argv);
    554   }
    555 
    556542  VERBOSE = VERBOSE2 = FALSE;
    557543  if ((N = get_argument (argc, argv, "-v"))) {
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/assign_images.c

    r37807 r38445  
    1111  // convert database table to internal structure (binary to Image)
    1212  // 'image' points to the same memory as db->ftable->buffer
    13   Image *image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
     13  Image *image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].scaledValue, &db[0].nativeOrder);
    1414  if (!image) {
    1515      fprintf (stderr, "ERROR: failed to read images\n");
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/bcatalog.c

    r38317 r38445  
    224224  subcatalog[0].Nmeasure = Nmeasure;
    225225  subcatalog[0].Nsecfilt = catalog[0].Nsecfilt;
    226   subcatalog[0].Nsecf_mem = Naverage * catalog[0].Nsecfilt;
     226  subcatalog[0].Nsecfilt_mem = Naverage * catalog[0].Nsecfilt;
    227227
    228228  if (VERBOSE) {
     
    347347  subcatalog[0].Nmeasure = Nmeasure;
    348348  subcatalog[0].Nsecfilt = oldcatalog[0].Nsecfilt;
    349   subcatalog[0].Nsecf_mem = Naverage * oldcatalog[0].Nsecfilt;
     349  subcatalog[0].Nsecfilt_mem = Naverage * oldcatalog[0].Nsecfilt;
    350350
    351351  return (TRUE);
     
    440440  subcatalog[0].Nmeasure = Nmeasure;
    441441  subcatalog[0].Nsecfilt = catalog[0].Nsecfilt;
    442   subcatalog[0].Nsecf_mem = Naverage * catalog[0].Nsecfilt;
     442  subcatalog[0].Nsecfilt_mem = Naverage * catalog[0].Nsecfilt;
    443443
    444444  return (TRUE);
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/launch_region_hosts.c

    r37037 r38445  
    11# include "relphot.h"
    22# define DEBUG 0
    3 
    4 int strextend (char *input, char *format,...) {
    5 
    6   char tmpextra[1024], tmpline[1024];
    7   va_list argp;
    8 
    9   va_start (argp, format);
    10   vsnprintf (tmpextra, 1024, format, argp);
    11   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    12   strcpy (input, tmpline);
    13 
    14   return TRUE;
    15 }
    163
    174int launch_region_hosts (RegionHostTable *regionHosts) {
     
    5441    ImageTableSave (filename, host->image, host->Nimage);
    5542
    56     char command[1024];
    57     snprintf (command, 1024, "relphot %s", PhotcodeList);
    58     strextend (command, "-parallel-images %s", filename);
    59     strextend (command, "-region-hosts %s", REGION_FILE);
    60     strextend (command, "-region-hostID %d", host->hostID);
    61     strextend (command, "-D CATDIR %s", CATDIR);
    62     strextend (command, "-region %f %f %f %f", host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat);
    63     strextend (command, "-statmode %s", STATMODE);
    64     strextend (command, "-D CAMERA %s", CAMERA);
    65     strextend (command, "-D STAR_TOOFEW %d", STAR_TOOFEW);
    66     strextend (command, "-minerror %f", MIN_ERROR);
    67     strextend (command, "-cloud-limit %f", CLOUD_TOLERANCE);
     43    char *command = NULL;
     44    strextend (&command, "relphot %s", PhotcodeList);
     45    strextend (&command, "-parallel-images %s", filename);
     46    strextend (&command, "-region-hosts %s", REGION_FILE);
     47    strextend (&command, "-region-hostID %d", host->hostID);
     48    strextend (&command, "-D CATDIR %s", CATDIR);
     49    strextend (&command, "-region %f %f %f %f", host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat);
     50    strextend (&command, "-statmode %s", STATMODE);
     51    strextend (&command, "-D CAMERA %s", CAMERA);
     52    strextend (&command, "-D STAR_TOOFEW %d", STAR_TOOFEW);
     53    strextend (&command, "-minerror %f", MIN_ERROR);
     54    strextend (&command, "-cloud-limit %f", CLOUD_TOLERANCE);
    6855
    69     if (VERBOSE)             strextend (command, "-v");
    70     if (VERBOSE2)            strextend (command, "-vv");
    71     if (RESET)               strextend (command, "-reset");
    72     if (RESET_ZEROPTS)       strextend (command, "-reset-zpts");
    73     if (!KEEP_UBERCAL)       strextend (command, "-reset-ubercal");
    74     if (DophotSelect)        strextend (command, "-dophot %d", DophotValue);
    75     if (ImagSelect)          strextend (command, "-instmag %f %f", ImagMin, ImagMax);
    76     if (MaxDensityUse)       strextend (command, "-max-density %f", MaxDensityValue);
    77     if (SyntheticPhotometry) strextend (command, "-synthphot");
     56    if (VERBOSE)             strextend (&command, "-v");
     57    if (VERBOSE2)            strextend (&command, "-vv");
     58    if (RESET)               strextend (&command, "-reset");
     59    if (RESET_ZEROPTS)       strextend (&command, "-reset-zpts");
     60    if (!KEEP_UBERCAL)       strextend (&command, "-reset-ubercal");
     61    if (DophotSelect)        strextend (&command, "-dophot %d", DophotValue);
     62    if (ImagSelect)          strextend (&command, "-instmag %f %f", ImagMin, ImagMax);
     63    if (MaxDensityUse)       strextend (&command, "-max-density %f", MaxDensityValue);
     64    if (SyntheticPhotometry) strextend (&command, "-synthphot");
    7865
    79     if (UPDATE)              strextend (command, "-update");
    80     if (MOSAIC_ZEROPT)       strextend (command, "-mosaic");
    81     if (FREEZE_IMAGES)       strextend (command, "-imfreeze");
    82     if (FREEZE_MOSAICS)      strextend (command, "-mosfreeze");
    83     if (PARALLEL)            strextend (command, "-parallel");
    84     if (PARALLEL_MANUAL)     strextend (command, "-parallel-manual");
    85     if (PARALLEL_SERIAL)     strextend (command, "-parallel-serial");
     66    if (UPDATE)              strextend (&command, "-update");
     67    if (MOSAIC_ZEROPT)       strextend (&command, "-mosaic");
     68    if (FREEZE_IMAGES)       strextend (&command, "-imfreeze");
     69    if (FREEZE_MOSAICS)      strextend (&command, "-mosfreeze");
     70    if (PARALLEL)            strextend (&command, "-parallel");
     71    if (PARALLEL_MANUAL)     strextend (&command, "-parallel-manual");
     72    if (PARALLEL_SERIAL)     strextend (&command, "-parallel-serial");
    8673
    8774    // XXX deprecate this if we are happy with the new version
    88     if (SET_MREL_VERSION != 1) strextend (command, "-set-mrel-version %d", SET_MREL_VERSION);
     75    // if (SET_MREL_VERSION != 1) strextend (command, "-set-mrel-version %d", SET_MREL_VERSION);
    8976
    9077    fprintf (stderr, "command: %s\n", command);
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/load_catalogs.c

    r37037 r38445  
    3434    // XXX keep in mind that not all catalogs are loaded
    3535    dvo_catalog_init (&catalog[i], TRUE);
     36    dvo_catalog_init (&tcatalog, TRUE);
    3637
    3738    // does this host ID match the desired location for the table?
     
    4142    char hostfile[1024];
    4243    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
    43     tcatalog.filename = hostID ? hostfile : skylist[0].filename[i];
    44 
    45     tcatalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    46     tcatalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
    47     tcatalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_SECF;    // don't need to load all data at this point
    48     tcatalog.Nsecfilt  = GetPhotcodeNsecfilt ();               // set the desired number in case we need to create the catalog
     44    tcatalog.filename    = hostID ? hostfile : skylist[0].filename[i];
     45    tcatalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT;    // don't need to load all data at this point
     46    tcatalog.Nsecfilt    = GetPhotcodeNsecfilt ();               // set the desired number in case we need to create the catalog
     47
     48    // tcatalog.catformat   = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     49    // tcatalog.catmode     = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     50    // tcatalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
    4951
    5052    if (!dvo_catalog_open (&tcatalog, skylist[0].regions[i], VERBOSE2, "r")) {
     
    5254      exit (1);
    5355    }
    54     if (!tcatalog.Naves_disk) {
     56    if (!tcatalog.Naverage_disk) {
    5557        if (VERBOSE2) { fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename); }
    5658        dvo_catalog_unlock (&tcatalog);
     
    153155    // MaxDensityUse, MaxDensityValue
    154156
    155     char command[1024];
    156     snprintf (command, 1024, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -D CAMERA %s -D MAG_LIM %f -D SIGMA_LIM %f",
     157    char *command = NULL;
     158    strextend (&command, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -D CAMERA %s -D MAG_LIM %f -D SIGMA_LIM %f",
    157159              PhotcodeList, table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, CAMERA, MAG_LIM, SIGMA_LIM);
    158160
    159     char tmpline[1024];
    160     if (VERBOSE)             { snprintf (tmpline, 1024, "%s -v",              command);                   strcpy (command, tmpline); }
    161     if (VERBOSE2)            { snprintf (tmpline, 1024, "%s -vv",             command);                   strcpy (command, tmpline); }
    162     if (RESET)               { snprintf (tmpline, 1024, "%s -reset",          command);                   strcpy (command, tmpline); }
    163     if (RESET_ZEROPTS)       { snprintf (tmpline, 1024, "%s -reset-zpts",     command);                   strcpy (command, tmpline); }
    164     if (!KEEP_UBERCAL)       { snprintf (tmpline, 1024, "%s -reset-ubercal",  command);                   strcpy (command, tmpline); }
    165     if (DophotSelect)        { snprintf (tmpline, 1024, "%s -dophot %d",      command, DophotValue);      strcpy (command, tmpline); }
    166     if (ImagSelect)          { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax); strcpy (command, tmpline); }
    167     if (MaxDensityUse)       { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);  strcpy (command, tmpline); }
    168     if (SyntheticPhotometry) { snprintf (tmpline, 1024, "%s -synthphot",      command);                   strcpy (command, tmpline); }
     161    if (VERBOSE)             { strextend (&command, "-v"); }
     162    if (VERBOSE2)            { strextend (&command, "-vv"); }
     163    if (RESET)               { strextend (&command, "-reset"); }
     164    if (RESET_ZEROPTS)       { strextend (&command, "-reset-zpts"); }
     165    if (!KEEP_UBERCAL)       { strextend (&command, "-reset-ubercal"); }
     166    if (DophotSelect)        { strextend (&command, "-dophot %d", DophotValue); }
     167    if (ImagSelect)          { strextend (&command, "-instmag %f %f", ImagMin, ImagMax); }
     168    if (MaxDensityUse)       { strextend (&command, "-max-density %f", MaxDensityValue); }
     169    if (SyntheticPhotometry) { strextend (&command, "-synthphot"); }
    169170
    170171    if (TimeSelect) {
    171172      char *tstart = ohana_sec_to_date (TSTART);
    172173      char *tstop  = ohana_sec_to_date (TSTOP);
    173       snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop);
     174      strextend (&command, "-time %s %s", tstart, tstop);
    174175      free (tstart);
    175176      free (tstop);
    176       strcpy (command, tmpline);
    177177    }
    178178
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/load_images.c

    r37807 r38445  
    2121  // convert database table to internal structure (binary to Image)
    2222  // 'image' points to the same memory as db->ftable->buffer
    23   image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
     23  image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].scaledValue, &db[0].nativeOrder);
    2424  if (!image) {
    2525      fprintf (stderr, "ERROR: failed to read images\n");
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/reload_catalogs.c

    r38433 r38445  
    5959    TIMESTAMP(time1);
    6060
    61     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    62     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
    63     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
    64     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();               // set the desired number in case we need to create the catalog
     61    // catalog.catformat   = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     62    // catalog.catmode     = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     63    // catalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
     64    catalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     65    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();               // set the desired number in case we need to create the catalog
    6566
    6667    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
     
    6970      // exit (1);
    7071    }
    71     if (VERBOSE && (catalog.Naves_disk == 0)) {
     72    if (VERBOSE && (catalog.Naverage_disk == 0)) {
    7273        fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
    7374        dvo_catalog_unlock (&catalog);
     
    179180
    180181  int Ngroups;
    181   HostTableGroup *groups = HostTableGroups (table, &Ngroups);
     182  HostTableGroup *groups = HostTableGroupsUniqueMachines (table, &Ngroups);
    182183  // split the table into Ngroups, each with a unique set of machines (this avoids overloading the remote host machines)
    183184
     
    215216    group->hosts[i][0].pathname = tmppath;
    216217
    217     char command[1024];
    218     snprintf (command, 1024, "relphot_client %s -update-catalogs %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -D CAMERA %s -D STAR_TOOFEW %d -minerror %f",
    219               PhotcodeList, imageFile, group->hosts[i][0].hostID, CATDIR, group->hosts[i][0].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, CAMERA, STAR_TOOFEW, MIN_ERROR);
     218    char *command = NULL;
     219    strextend (&command, "relphot_client %s -update-catalogs %s", PhotcodeList, imageFile);
     220    strextend (&command, "-hostID %d -D CATDIR %s -hostdir %s", group->hosts[i][0].hostID, CATDIR, group->hosts[i][0].pathname);
     221    strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     222    strextend (&command, "-statmode %s", STATMODE);
     223    strextend (&command, "-D CAMERA %s", CAMERA);
     224    strextend (&command, "-D STAR_TOOFEW %d -minerror %f", STAR_TOOFEW, MIN_ERROR);
    220225
    221226    // options & configs which affect relphot_client -update-catalogs
     
    229234    // MIN_ERROR
    230235   
    231     char tmpline[1024];
    232     if (VERBOSE)           { snprintf (tmpline, 1024, "%s -v",                  command);                                         strcpy (command, tmpline); }
    233     if (VERBOSE2)          { snprintf (tmpline, 1024, "%s -vv",                 command);                                         strcpy (command, tmpline); }
    234     if (RESET)             { snprintf (tmpline, 1024, "%s -reset",              command);                                         strcpy (command, tmpline); }
    235     if (RESET_ZEROPTS)     { snprintf (tmpline, 1024, "%s -reset-zpts",         command);                                         strcpy (command, tmpline); }
    236     if (UPDATE)            { snprintf (tmpline, 1024, "%s -update",             command);                                         strcpy (command, tmpline); }
    237     if (IS_DIFF_DB)        { snprintf (tmpline, 1024, "%s -is-diff-db",         command);                                         strcpy (command, tmpline); }
    238     if (!KEEP_UBERCAL)     { snprintf (tmpline, 1024, "%s -reset-ubercal",      command);                                         strcpy (command, tmpline); }
    239     if (UPDATE_CATFORMAT)  { snprintf (tmpline, 1024, "%s -update-catformat %s", command, UPDATE_CATFORMAT);                      strcpy (command, tmpline); }
    240     if (BOUNDARY_TREE)     { snprintf (tmpline, 1024, "%s -boundary-tree %s",    command, BOUNDARY_TREE);                         strcpy (command, tmpline); }
    241     if (SYNTH_ZERO_POINTS) { snprintf (tmpline, 1024, "%s -synthphot-zpts %s", command, SYNTH_ZERO_POINTS); strcpy (command, tmpline); }
    242     if (SET_MREL_VERSION != 1) { snprintf (tmpline, 1024, "%s -set-mrel-version %d", command, SET_MREL_VERSION);                  strcpy (command, tmpline); }
    243     if (AreaSelect)       { snprintf (tmpline, 1024, "%s -area %f %f %f %f",    command, AreaXmin, AreaXmax, AreaYmin, AreaYmax); strcpy (command, tmpline); }
     236    if (VERBOSE)          { strextend (&command, "-v"); }
     237    if (VERBOSE2)         { strextend (&command, "-vv"); }
     238    if (RESET)            { strextend (&command, "-reset"); }
     239    if (RESET_ZEROPTS)    { strextend (&command, "-reset-zpts"); }
     240    if (UPDATE)           { strextend (&command, "-update"); }
     241    if (IS_DIFF_DB)       { strextend (&command, "-is-diff-db"); }
     242    if (!KEEP_UBERCAL)    { strextend (&command, "-reset-ubercal"); }
     243    if (UPDATE_CATFORMAT) { strextend (&command, "-update-catformat %s", UPDATE_CATFORMAT); }
     244    if (BOUNDARY_TREE)    { strextend (&command, "-boundary-tree %s", BOUNDARY_TREE); }
     245    if (SYNTH_ZERO_POINTS) { strextend {&command, "-synthphot-zpts %s", SYNTH_ZERO_POINTS); }
     246
     247    // deprecate
     248    // if (SET_MREL_VERSION != 1) { snprintf (tmpline, 1024, "%s -set-mrel-version %d", SET_MREL_VERSION); } // XXXX deprecate this...
     249
     250    if (AreaSelect)       { strextend (&command, "-area %f %f %f %f", AreaXmin, AreaXmax, AreaYmin, AreaYmax); }
    244251    if (TimeSelect) {
    245252      char *tstart = ohana_sec_to_date (TSTART);
    246253      char *tstop  = ohana_sec_to_date (TSTOP);
    247       snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop);
     254      strextend (&command, "-time %s %s", tstart, tstop);
    248255      free (tstart);
    249256      free (tstop);
    250       strcpy (command, tmpline);
    251257    }
    252258
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/relphot_images.c

    r37037 r38445  
    1818  /* register database handle with shutdown procedure */
    1919  set_db (&db);
     20  gfits_db_init (&db);
    2021  db.mode   = dvo_catalog_catmode (CATMODE);
    2122  db.format = dvo_catalog_catformat (CATFORMAT);
     
    185186      // convert database table to internal structure (binary to Image)
    186187      // 'image' points to the same memory as db->ftable->buffer
    187       image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped);
     188      image = gfits_table_get_Image (&db.ftable, &Nimage, &db.scaledValue, &db.nativeOrder);
    188189      if (!image) {
    189190        fprintf (stderr, "ERROR: failed to read images\n");
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/relphot_objects.c

    r38317 r38445  
    4242    char hostfile[1024];
    4343    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
    44     catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
    45     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    46     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
    47     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
    48     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
     44    catalog.filename    = hostID ? hostfile : skylist[0].filename[i];
     45    // catalog.catformat   = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     46    // catalog.catmode     = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     47    // catalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
     48    catalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     49    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();
    4950
    5051    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
     
    5253      exit (1);
    5354    }
    54     if (!catalog.Naves_disk) {
     55    if (!catalog.Naverage_disk) {
    5556      if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
    5657      dvo_catalog_unlock (&catalog);
     
    143144    // MaxDensityUse, MaxDensityValue
    144145
    145     char command[1024];
    146     snprintf (command, 1024, "relphot_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -D CAMERA %s -D STAR_TOOFEW %d -minerror %f",
     146    char *command = NULL;
     147    strextend (&command, "relphot_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -D CAMERA %s -D STAR_TOOFEW %d -minerror %f",
    147148              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, CAMERA, STAR_TOOFEW, MIN_ERROR);
    148149
    149     char tmpline[1024];
    150     if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
    151     if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    152     if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
    153     if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts",     command);                    strcpy (command, tmpline); }
    154     if (UPDATE)        { snprintf (tmpline, 1024, "%s -update",         command);                    strcpy (command, tmpline); }
    155     if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal",  command);                    strcpy (command, tmpline); }
    156     if (SET_MREL_VERSION != 1) { snprintf (tmpline, 1024, "%s -set-mrel-version %d", command, SET_MREL_VERSION); strcpy (command, tmpline); }
     150    if (VERBOSE)       { strextend (&command, "-v"); }
     151    if (VERBOSE2)      { strextend (&command, "-vv"); }
     152    if (RESET)         { strextend (&command, "-reset"); }
     153    if (RESET_ZEROPTS) { strextend (&command, "-reset-zpts"); }
     154    if (UPDATE)        { strextend (&command, "-update"); }
     155    if (!KEEP_UBERCAL) { strextend (&command, "-reset-ubercal"); }
    157156    if (SYNTH_ZERO_POINTS) { snprintf (tmpline, 1024, "%s -synthphot-zpts %s", command, SYNTH_ZERO_POINTS); strcpy (command, tmpline); }
     157
     158    // if (SET_MREL_VERSION != 1) { strextend (&command, "-set-mrel-version %d", SET_MREL_VERSION); }
    158159
    159160    fprintf (stderr, "command: %s\n", command);
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/relphot_parallel_regions.c

    r37807 r38445  
    2323  // register database handle with shutdown procedure
    2424  set_db (&db);
     25  gfits_db_init (&db);
    2526  db.mode   = dvo_catalog_catmode (CATMODE);
    2627  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/relphot_synthphot.c

    r38298 r38445  
    4141    char hostfile[1024];
    4242    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
    43     catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
    44     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    45     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
    46     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
    47     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
     43    catalog.filename    = hostID ? hostfile : skylist[0].filename[i];
     44    // catalog.catformat   = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     45    // catalog.catmode     = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     46    // catalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
     47    catalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT;
     48    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();
    4849
    4950    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
     
    5152      exit (1);
    5253    }
    53     if (!catalog.Naves_disk) {
     54    if (!catalog.Naverage_disk) {
    5455      if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
    5556      dvo_catalog_unlock (&catalog);
     
    110111    // VERBOSE, VERBOSE2
    111112
    112     char command[1024];
    113     snprintf (command, 1024, "relphot_client -synthphot_means %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f",
    114               SYNTH_ZERO_POINTS, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     113    char *command = NULL;
     114    strextend (&command, "relphot_client -synthphot_means %s", SYNTH_ZERO_POINTS);
     115    strextend (&command, "-hostID %d -D CATDIR %s -hostdir %s", table->hosts[i].hostID, CATDIR, table->hosts[i].pathname);
     116    strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    115117
    116     char tmpline[1024];
    117     if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
    118     if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    119     if (UPDATE)        { snprintf (tmpline, 1024, "%s -update",         command);                    strcpy (command, tmpline); }
     118    if (VERBOSE)       { strextend (&command, "-v");      }
     119    if (VERBOSE2)      { strextend (&command, "-vv");     }
     120    if (UPDATE)        { strextend (&command, "-update"); }
    120121
    121122    fprintf (stderr, "command: %s\n", command);
Note: See TracChangeset for help on using the changeset viewer.