IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8428


Ignore:
Timestamp:
Aug 20, 2006, 5:37:16 PM (20 years ago)
Author:
eugene
Message:

better error checking, config tests

Location:
trunk/Ohana/src/addstar/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r6763 r8428  
    11# include "addstar.h"
     2
     3void GetConfig (char *config, char *field, char *format, int N, void *ptr);
    24
    35AddstarClientOptions ConfigInit (int *argc, char **argv) {
     
    1820  if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);
    1921
    20   XMIN = XMAX = YMIN = YMAX = 0;
    2122
    22   /* used by client to interpret input data */
     23  /* exclude overscan region from the dB image boundaries */
     24  XOVERSCAN = YOVERSCAN = 0;
    2325  ScanConfig (config, "XOVERSCAN",              "%d",  0, &XOVERSCAN);
    2426  ScanConfig (config, "YOVERSCAN",              "%d",  0, &YOVERSCAN);
     27
     28  /* only upload stars within region; a value of 0 means ignore the limit */
     29  XMIN = XMAX = YMIN = YMAX = 0;
    2530  ScanConfig (config, "ADDSTAR_XMIN",           "%d",  0, &XMIN);
    2631  ScanConfig (config, "ADDSTAR_XMAX",           "%d",  0, &XMAX);
    2732  ScanConfig (config, "ADDSTAR_YMIN",           "%d",  0, &YMIN);
    2833  ScanConfig (config, "ADDSTAR_YMAX",           "%d",  0, &YMAX);
     34
     35  /* exclude stars with SN > SNLIMIT (ADDSTAR_SNLIMIT overrides old name MIN_SN_FSTAT) */
     36  SNLIMIT = 0;
    2937  ScanConfig (config, "MIN_SN_FSTAT",           "%lf", 0, &SNLIMIT);
     38  ScanConfig (config, "ADDSTAR_SNLIMIT",        "%lf", 0, &SNLIMIT);
    3039
    3140  /* used by parse_time to find time-related keywords */
     41  strcpy (DateKeyword, "NONE");
     42  strcpy (DateMode, "NONE");
     43  strcpy (UTKeyword, "NONE");
     44  strcpy (JDKeyword, "NONE");
     45  strcpy (MJDKeyword, "NONE");
    3246  ScanConfig (config, "DATE-KEYWORD",           "%s",  0, DateKeyword);
    3347  ScanConfig (config, "DATE-MODE",              "%s",  0, DateMode);
     
    3953  ScanConfig (config, "AIRMASS-KEYWORD",        "%s",  0, AirmassKeyword);
    4054  ScanConfig (config, "CCDNUM-KEYWORD",         "%s",  0, CCDNumKeyword);
    41 
    4255  ScanConfig (config, "ST-KEYWORD",             "%s",  0, STKeyword);
    4356  ScanConfig (config, "OBSERVATORY-LATITUDE",   "%lf", 0, &Latitude);
     
    4558
    4659  /* instrumental magnitude range for calibration mode */
    47   if (!ScanConfig (config, "CAL_INSTMAG_MAX",   "%lf", 0, &CAL_INSTMAG_MAX)) CAL_INSTMAG_MAX =  -9.0;
    48   if (!ScanConfig (config, "CAL_INSTMAG_MIN",   "%lf", 0, &CAL_INSTMAG_MIN)) CAL_INSTMAG_MIN = -13.0;
     60  CAL_INSTMAG_MAX =  -9.0;
     61  CAL_INSTMAG_MIN = -13.0;
     62  ScanConfig (config, "CAL_INSTMAG_MAX",   "%lf", 0, &CAL_INSTMAG_MAX);
     63  ScanConfig (config, "CAL_INSTMAG_MIN",   "%lf", 0, &CAL_INSTMAG_MIN);
    4964
    5065  /* location of needed data sources */
     
    6075  ScanConfig (config, "TYCHO_DIR",             "%s",  0, TYCHO_DIR);
    6176
    62   ScanConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
    63   ScanConfig (config, "CATDIR",                 "%s",  0, CATDIR);
     77  GetConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
     78  GetConfig (config, "CATDIR",                 "%s",  0, CATDIR);
     79  GetConfig (config, "PHOTCODE_FILE",          "%s",  0, PhotCodeFile);
    6480  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    6581  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    66   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, PhotCodeFile);
    6782  if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) {
    68     SKY_DEPTH = 2;
     83    SKY_DEPTH = 3;
    6984  }
    7085  if (!ScanConfig (config, "SKY_TABLE",         "%s",  0, SKY_TABLE)) {
     
    7388  sprintf (ImageCat, "%s/Images.dat", CATDIR);
    7489
    75   /* dropped: ScanConfig (config, "IMAGE_CATALOG",          "%s",  0, ImageCat); */
     90  /* dropped: GetConfig (config, "IMAGE_CATALOG",          "%s",  0, ImageCat); */
    7691
    7792  ScanConfig (config, "CAMERA_LAYOUT",          "%s",  0, CameraLayout);
     
    114129
    115130  /* set the default search radius */
    116   ScanConfig (config, "RADIUS",                 "%s",  0, RadiusWord);
    117   ScanConfig (config, "NSIGMA",                 "%lf", 0, &options.Nsigma);
     131  if (!ScanConfig (config, "ADDSTAR_RADIUS", "%s", 0, RadiusWord)) {
     132    GetConfig (config, "RADIUS", "%s", 0, RadiusWord);
     133  }
     134  /* XXX this does not work for refcat and reflist modes... */
    118135  if (!strcasecmp (RadiusWord, "header")) {
    119136    options.radius = 0;
     137    if (!ScanConfig (config, "ADDSTAR_NSIGMA", "%lf", 0, &options.Nsigma)) {
     138      GetConfig (config, "NSIGMA", "%lf", 0, &options.Nsigma);
     139    }
    120140  } else {
    121141    options.radius = atof (RadiusWord);
  • trunk/Ohana/src/addstar/src/gstars.c

    r8361 r8428  
    1010  Stars *stars, *rdstars;
    1111  Header header;
     12
     13  /* XXX which of these values are required, which are just interesting? */
    1214
    1315  if (!gfits_read_header (file, &header)) {
     
    202204  for (N = j = 0; j < image[0].nstar; j++) {
    203205    /* allow for some dynamic filtering of star list */
    204     if (rdstars[j].dM > SNLIMIT) continue;
     206    if (SNLIMIT && rdstars[j].dM > SNLIMIT) continue;
    205207    if (XMAX && (rdstars[j].X > XMAX)) continue;
    206208    if (XMIN && (rdstars[j].X < XMIN)) continue;
  • trunk/Ohana/src/addstar/src/parse_time.c

    r7080 r8428  
    2727  }
    2828   
     29  if (!strcasecmp (UTKeyword, "NONE")) {
     30      fprintf (stderr, "ERROR: no valid Date/Time keywords\n");
     31      exit (1);
     32  }
     33  if (!strcasecmp (DateKeyword, "NONE")) {
     34      fprintf (stderr, "ERROR: no valid Date/Time keywords\n");
     35      exit (1);
     36  }
     37  if (!strcasecmp (DateMode, "NONE")) {
     38      fprintf (stderr, "ERROR: no valid Date/Time keywords\n");
     39      exit (1);
     40  }
     41
    2942  /* get UT and DATE */
    3043  uppercase (UTKeyword);
Note: See TracChangeset for help on using the changeset viewer.