IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38711


Ignore:
Timestamp:
Sep 6, 2015, 3:12:26 PM (11 years ago)
Author:
eugene
Message:

fix up loadstarpar

Location:
branches/eam_branches/ipp-20150625/Ohana/src/addstar
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/Makefile

    r38616 r38711  
    283283$(SRC)/loadstarpar_save_remote.$(ARCH).o \
    284284$(SRC)/loadstarpar_table.$(ARCH).o \
     285$(SRC)/loadstarpar_extras.$(ARCH).o \
    285286$(SRC)/psps_ids.$(ARCH).o
    286287
     
    300301$(SRC)/loadstarpar_save_remote.$(ARCH).o \
    301302$(SRC)/loadstarpar_table.$(ARCH).o \
     303$(SRC)/loadstarpar_extras.$(ARCH).o \
    302304$(SRC)/psps_ids.$(ARCH).o
    303305
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/include/loadstarpar.h

    r37807 r38711  
    1212char *INPUT;
    1313
    14 AddstarClientOptions args_loadstarpar (int argc, char **argv, AddstarClientOptions options);
    15 AddstarClientOptions args_loadstarpar_client (int argc, char **argv, AddstarClientOptions options);
     14AddstarClientOptions args_loadstarpar (int *argc, char **argv, AddstarClientOptions options);
     15AddstarClientOptions args_loadstarpar_client (int *argc, char **argv, AddstarClientOptions options);
    1616
    1717int loadstarpar_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options);
     
    2323int save_remote_host (HostInfo *host);
    2424
    25 int init_remote_hosts ();
    26 int find_empty_slot ();
    27 int harvest_all ();
    28 int harvest_host ();
     25int init_remote_hosts (void);
     26int find_empty_slot (void);
     27int harvest_all (void);
     28int harvest_host (void);
    2929
    3030int loadstarpar_catalog (StarPar_Stars *stars, int Nstars, SkyRegion *region, char *filename, AddstarClientOptions *options);
     
    4040
    4141int loadstarpar_sortStars (StarPar_Stars *stars, int Nstars);
     42
     43int loadstarpar_tmpdir (void);
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/args_loadstarpar.c

    r37807 r38711  
    55static void help_client (void);
    66
    7 AddstarClientOptions args_loadstarpar (int argc, char **argv, AddstarClientOptions options) {
     7AddstarClientOptions args_loadstarpar (int *argc, char **argv, AddstarClientOptions options) {
    88 
    99  int N;
    1010
    1111  /* check for help request */
    12   if (get_argument (argc, argv, "-help") ||
    13       get_argument (argc, argv, "-h")) {
     12  if (get_argument (*argc, argv, "-help") ||
     13      get_argument (*argc, argv, "-h")) {
    1414    help ();
    1515  }
     
    2828  HOST_ID = 0;
    2929  PARALLEL = FALSE;
    30   if ((N = get_argument (argc, argv, "-parallel"))) {
     30  if ((N = get_argument (*argc, argv, "-parallel"))) {
    3131    PARALLEL = TRUE;
    32     remove_argument (N, &argc, argv);
     32    remove_argument (N, argc, argv);
    3333  }
    3434  // this is a test mode : rather than launching the remote jobs and waiting for completion,
    3535  // relphot will simply list the remote command and wait for the user to signal completion
    3636  PARALLEL_MANUAL = FALSE;
    37   if ((N = get_argument (argc, argv, "-parallel-manual"))) {
     37  if ((N = get_argument (*argc, argv, "-parallel-manual"))) {
    3838    PARALLEL = TRUE; // -parallel-manual implies -parallel
    3939    PARALLEL_MANUAL = TRUE;
    40     remove_argument (N, &argc, argv);
     40    remove_argument (N, argc, argv);
    4141  }
    4242  // this is a test mode : rather than launching the relphot_client jobs remotely, they are
    4343  // run in serial via 'system'
    4444  PARALLEL_SERIAL = FALSE;
    45   if ((N = get_argument (argc, argv, "-parallel-serial"))) {
     45  if ((N = get_argument (*argc, argv, "-parallel-serial"))) {
    4646    if (PARALLEL_MANUAL) {
    4747      fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n");
     
    5050    PARALLEL = TRUE; // -parallel-serial implies -parallel
    5151    PARALLEL_SERIAL = TRUE;
    52     remove_argument (N, &argc, argv);
    53   }
    54 
    55   /* only add to existing regions */
     52    remove_argument (N, argc, argv);
     53  }
     54
     55  /* only add to existing regions  */
    5656  options.existing_regions = FALSE;
    57   if ((N = get_argument (argc, argv, "-existing-regions"))) {
    58     options.existing_regions = TRUE;
    59     remove_argument (N, &argc, argv);
    60   }
     57  // XXX NOT USED if ((N = get_argument (*argc, argv, "-existing-regions"))) {
     58  // XXX NOT USED   options.existing_regions = TRUE;
     59  // XXX NOT USED   remove_argument (N, argc, argv);
     60  // XXX NOT USED }
     61
    6162  /* only add to existing objects */
    6263  options.only_match = FALSE;
    63   if ((N = get_argument (argc, argv, "-only-match"))) {
     64  if ((N = get_argument (*argc, argv, "-only-match"))) {
    6465    options.only_match = TRUE;
    65     remove_argument (N, &argc, argv);
    66   }
     66    remove_argument (N, argc, argv);
     67  }
     68
    6769  /* replace measurement, don't duplicate (ref/cat only) */
    6870  options.replace = FALSE;
    69   if ((N = get_argument (argc, argv, "-replace"))) {
     71  if ((N = get_argument (*argc, argv, "-replace"))) {
    7072    options.replace = TRUE;
    71     remove_argument (N, &argc, argv);
     73    remove_argument (N, argc, argv);
    7274  }
    7375
    7476  /* extra error messages */
    7577  VERBOSE = FALSE;
    76   if ((N = get_argument (argc, argv, "-v"))) {
     78  if ((N = get_argument (*argc, argv, "-v"))) {
    7779    VERBOSE = TRUE;
    78     remove_argument (N, &argc, argv);
     80    remove_argument (N, argc, argv);
    7981  }
    8082
     
    9698  DUMP = NULL;
    9799
    98   if (argc < 2) {
     100  if (*argc < 2) {
    99101    fprintf (stderr, "USAGE: loadstarpar [options] (fitsfile) [..more files]\n");
    100102    exit (2);
     
    103105}
    104106
    105 AddstarClientOptions args_loadstarpar_client (int argc, char **argv, AddstarClientOptions options) {
     107AddstarClientOptions args_loadstarpar_client (int *argc, char **argv, AddstarClientOptions options) {
    106108 
    107109  int N;
    108110
    109111  /* check for help request */
    110   if (get_argument (argc, argv, "-help") ||
    111       get_argument (argc, argv, "-h")) {
     112  if (get_argument (*argc, argv, "-help") ||
     113      get_argument (*argc, argv, "-h")) {
    112114    help ();
    113115  }
     
    118120
    119121  HOST_ID = 0;
    120   if ((N = get_argument (argc, argv, "-hostID"))) {
    121     remove_argument (N, &argc, argv);
     122  if ((N = get_argument (*argc, argv, "-hostID"))) {
     123    remove_argument (N, argc, argv);
    122124    HOST_ID = atoi (argv[N]);
    123     remove_argument (N, &argc, argv);
     125    remove_argument (N, argc, argv);
    124126  }
    125127  if (!HOST_ID) help_client();
    126128
    127129  HOSTDIR = NULL;
    128   if ((N = get_argument (argc, argv, "-hostdir"))) {
    129     remove_argument (N, &argc, argv);
     130  if ((N = get_argument (*argc, argv, "-hostdir"))) {
     131    remove_argument (N, argc, argv);
    130132    HOSTDIR = strcreate (argv[N]);
    131     remove_argument (N, &argc, argv);
     133    remove_argument (N, argc, argv);
    132134  }
    133135  if (!HOSTDIR) help_client();
    134136
    135137  CPT_FILE = NULL;
    136   if ((N = get_argument (argc, argv, "-cpt"))) {
    137     remove_argument (N, &argc, argv);
     138  if ((N = get_argument (*argc, argv, "-cpt"))) {
     139    remove_argument (N, argc, argv);
    138140    CPT_FILE = strcreate (argv[N]);
    139     remove_argument (N, &argc, argv);
     141    remove_argument (N, argc, argv);
    140142  }
    141143  if (!CPT_FILE) help_client();
    142144 
    143145  INPUT = NULL;
    144   if ((N = get_argument (argc, argv, "-input"))) {
    145     remove_argument (N, &argc, argv);
     146  if ((N = get_argument (*argc, argv, "-input"))) {
     147    remove_argument (N, argc, argv);
    146148    INPUT = strcreate (argv[N]);
    147     remove_argument (N, &argc, argv);
     149    remove_argument (N, argc, argv);
    148150  }
    149151  if (!INPUT) help_client();
     
    157159  /* only add to existing objects */
    158160  options.only_match = FALSE;
    159   if ((N = get_argument (argc, argv, "-only-match"))) {
     161  if ((N = get_argument (*argc, argv, "-only-match"))) {
    160162    options.only_match = TRUE;
    161     remove_argument (N, &argc, argv);
     163    remove_argument (N, argc, argv);
    162164  }
    163165  /* replace measurement, don't duplicate (ref/cat only) */
    164166  options.replace = FALSE;
    165   if ((N = get_argument (argc, argv, "-replace"))) {
     167  if ((N = get_argument (*argc, argv, "-replace"))) {
    166168    options.replace = TRUE;
    167     remove_argument (N, &argc, argv);
     169    remove_argument (N, argc, argv);
    168170  }
    169171
    170172  /* extra error messages */
    171173  VERBOSE = FALSE;
    172   if ((N = get_argument (argc, argv, "-v"))) {
     174  if ((N = get_argument (*argc, argv, "-v"))) {
    173175    VERBOSE = TRUE;
    174     remove_argument (N, &argc, argv);
     176    remove_argument (N, argc, argv);
    175177  }
    176178
     
    192194  DUMP = NULL;
    193195
    194   if (argc != 1) {
     196  if (*argc != 1) {
    195197    fprintf (stderr, "USAGE: loadstarpar_client -cpt (file) -input (file)\n");
    196198    exit (2);
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/find_matches_starpar.c

    r38467 r38711  
    131131
    132132    /** add starpar for this star **/
    133 
    134     // set the new starparments
    135     catalog[0].starpar[Nstarpar]          = stars[N].starpar;
    136     catalog[0].starpar[Nstarpar].averef   = n;
    137     catalog[0].starpar[Nstarpar].objID    = catalog[0].average[n].objID;
    138     catalog[0].starpar[Nstarpar].catID    = catID;
    139 
    140     // NOTE: include R,D in starpar?
    141     // XXX if I add R,D to starpar, I should rationalize R,D to the same boundary?
    142 
     133    off_t m;
     134    if (options->replace && catalog[0].average[n].Nstarpar) {
     135      m = catalog[0].average[n].starparOffset;
     136    } else {
     137      m = Nstarpar;
     138      catalog[0].average[n].starparOffset = m;
     139      catalog[0].average[n].Nstarpar ++;
     140      Nstarpar ++;
     141    }
     142    catalog[0].starpar[m]          = stars[N].starpar;
     143    catalog[0].starpar[m].averef   = n;
     144    catalog[0].starpar[m].objID    = catalog[0].average[n].objID;
     145    catalog[0].starpar[m].catID    = catID;
    143146    stars[N].found = TRUE;
    144     catalog[0].average[n].Nstarpar ++;
    145     Nstarpar ++;
    146147    i++;
    147148  }
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadstarpar.c

    r38618 r38711  
    1919  SetSignals ();
    2020  options = ConfigInit (&argc, argv);
    21   options = args_loadstarpar (argc, argv, options);
     21  options = args_loadstarpar (&argc, argv, options);
    2222
    2323  // load the full sky description table (dvodb must exist)
     
    2525  SkyTableSetFilenames (sky, CATDIR, "cpt");
    2626 
     27  // make the tmpdir if needed
     28  if (!loadstarpar_tmpdir()) exit (1);
     29
    2730  // load the list of hosts
    2831  HostTable *hosts = NULL;
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadstarpar_client.c

    r38618 r38711  
    99  SetSignals ();
    1010  options = ConfigInit (&argc, argv);
    11   options = args_loadstarpar_client (argc, argv, options);
     11  options = args_loadstarpar_client (&argc, argv, options);
    1212
    1313  // client is called with a pointer to the file to be loaded
     
    2121  StarPar_Stars *stars = loadstarpar_load_stars (INPUT, &Nstars);
    2222
    23   loadstarpar_catalog (stars, Nstars, skylist->regions[0], CPT_FILE, &options);
     23  char filename[DVO_MAX_PATH];
     24  snprintf (filename, DVO_MAX_PATH, "%s/%s.cpt", HOSTDIR, CPT_FILE);
     25
     26  loadstarpar_catalog (stars, Nstars, skylist->regions[0], filename, &options);
    2427
    2528  free (stars);
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadstarpar_io.c

    r37807 r38711  
    2929  gfits_define_bintable_column (&theader, "D", "DEC",      "", "degree", 1.0, 0.0);
    3030  gfits_define_bintable_column (&theader, "E", "GLON",     "", "degree", 1.0, 0.0);
    31   gfits_define_bintable_column (&theader, "D", "GLAT",     "", "degree", 1.0, 0.0);
     31  gfits_define_bintable_column (&theader, "E", "GLAT",     "", "degree", 1.0, 0.0);
    3232  gfits_define_bintable_column (&theader, "E", "Ebv",      "", "", 1.0, 0.0);
    3333  gfits_define_bintable_column (&theader, "E", "dEbv",     "", "", 1.0, 0.0);
     
    8484  gfits_free_table (&ftable);
    8585
     86  fflush (f);
     87  fclose (f);
     88
    8689  return TRUE;
    8790}
    8891
    8992
    90 # define GET_COLUMN(OUT,NAME,TYPE)                                      \
     93# define GET_COLUMN(OUT,NAME,TYPE,RTYPE)                                        \
    9194  TYPE *OUT = gfits_get_bintable_column_data (&theader, &ftable, NAME, type, &Nrow, &Ncol); \
    92   myAssert (!strcmp(type, #TYPE), "wrong column type");
     95  myAssert (!strcmp(type, #RTYPE), "wrong column type");
    9396
    9497StarPar_Stars *loadstarpar_load_stars (char *filename, int *nstars) {
     
    134137  if (!gfits_fread_ftable_data (f, &ftable, FALSE)) goto escape;
    135138 
    136   GET_COLUMN(ra      , "RA"        ,   double);
    137   GET_COLUMN(dec     , "DEC"       ,   double);
    138   GET_COLUMN(glon    , "GLON"      ,   float);
    139   GET_COLUMN(glat    , "GLAT"      ,   float);
    140   GET_COLUMN(Ebv     , "Ebv"       ,   float);
    141   GET_COLUMN(dEbv    , "dEbv"      ,   float);
    142   GET_COLUMN(DistMag , "DistMag"   ,   float);
    143   GET_COLUMN(dDistMag, "dDistMag"  ,   float);
    144   GET_COLUMN(M_r     , "M_r"       ,   float);
    145   GET_COLUMN(dM_r    , "dM_r"      ,   float);
    146   GET_COLUMN(FeH     , "FeH"       ,   float);
    147   GET_COLUMN(dFeH    , "dFeH"      ,   float);
    148   GET_COLUMN(averef  , "averef"    ,   unsigned int);
    149   GET_COLUMN(objID   , "objID"     ,   unsigned int);
    150   GET_COLUMN(catID   , "catID"     ,   unsigned int);
     139  GET_COLUMN(ra      , "RA"        ,   double      ,   double      );
     140  GET_COLUMN(dec     , "DEC"       ,   double      ,   double      );
     141  GET_COLUMN(glon    , "GLON"      ,   float       ,   float       );
     142  GET_COLUMN(glat    , "GLAT"      ,   float       ,   float       );
     143  GET_COLUMN(Ebv     , "Ebv"       ,   float       ,   float       );
     144  GET_COLUMN(dEbv    , "dEbv"      ,   float       ,   float       );
     145  GET_COLUMN(DistMag , "DistMag"   ,   float       ,   float       );
     146  GET_COLUMN(dDistMag, "dDistMag"  ,   float       ,   float       );
     147  GET_COLUMN(M_r     , "M_r"       ,   float       ,   float       );
     148  GET_COLUMN(dM_r    , "dM_r"      ,   float       ,   float       );
     149  GET_COLUMN(FeH     , "FeH"       ,   float       ,   float       );
     150  GET_COLUMN(dFeH    , "dFeH"      ,   float       ,   float       );
     151  GET_COLUMN(averef  , "averef"    ,   unsigned int,   int         );
     152  GET_COLUMN(objID   , "objID"     ,   unsigned int,   int         );
     153  GET_COLUMN(catID   , "catID"     ,   unsigned int,   int         );
    151154
    152155  gfits_free_header (&theader);
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadstarpar_readstars.c

    r37807 r38711  
    4747  char type[16];
    4848
    49   GET_COLUMN (glat,    "l",    float);
    50   GET_COLUMN (glon,    "b",    float);
     49  GET_COLUMN (glon,    "l",    float);
     50  GET_COLUMN (glat,    "b",    float);
    5151  GET_COLUMN (conv,    "conv", byte);
    5252  GET_COLUMN (lnZ,     "lnZ",  float);
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadstarpar_save_remote.c

    r38441 r38711  
    1818
    1919    // save to a unique filename
    20     char filename[1024]; // CATDIR/tmpdir/starpar.PID.index.fits
    21     snprintf (filename, 1024, "%s/tmpdir/starpar.%s.%05d.fits", CATDIR, uniquer, region->index);
     20    char filename[DVO_MAX_PATH]; // CATDIR/tmpdir/starpar.PID.index.fits
     21    snprintf (filename, DVO_MAX_PATH, "%s/tmpdir/starpar.%s.%05d.fits", CATDIR, uniquer, region->index);
    2222
    2323    // write the data to the given FITS file
     
    5757    strextend (&command, "-input %s", filename);
    5858
     59    if (options->only_match) strextend (&command, "-only-match");
     60    if (options->replace) strextend (&command, "-replace");
     61
     62    fprintf (stderr, "command: %s\n", command);
     63
    5964    // launch the job on the remote machine (no handshake)
    6065    int errorInfo = 0;
Note: See TracChangeset for help on using the changeset viewer.