IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5322


Ignore:
Timestamp:
Oct 13, 2005, 2:40:16 PM (21 years ago)
Author:
eugene
Message:

moving options from global to AddstarClientOptions

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

Legend:

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

    r5285 r5322  
    5151char   STKeyword[64];
    5252
     53/* these globals modify the behavior of gstars (KEEP) */
     54double SNLIMIT;
     55int    ACCEPT_ASTROM;  // accept even bad astrometry solutions (NASTRO == 0)
     56int    TEXTMODE;       // force input file to be loaded as RAW
     57char  *DUMP;           // dump out intermediate results
     58int    XOVERSCAN;      // used to modify stored image dimensions
     59int    YOVERSCAN;      // used to modify stored image dimensions
     60int    XMIN;           // used to filter loaded star list
     61int    XMAX;           // used to filter loaded star list
     62int    YMIN;           // used to filter loaded star list
     63int    YMAX;           // used to filter loaded star list
     64double Latitude;       // carried into image structure from config
     65
     66/* these globals are used separately by both client and server (KEEP) */
     67double ZeroPt;  // double check for consistency
     68int    VERBOSE;
     69
    5370/* add to options as an int / keep the global? */
    5471PhotCode *thiscode;
     
    5976/* globals set by command-line options (AddstarClientOptions) */
    6077/* move into AddstarClientOptions completely */
    61 # if (1)
    62 int   MODE;
    63 int   EXISTING_REGIONS;
    64 int   ONLY_MATCH;
    65 int   SKIP_MISSED;
    66 int   REPLACE;
    67 int   CLOSEST;
    68 int   NOSORT;
    69 int   UPDATE;
    70 int   ONLY_IMAGES;
    71 int   CALIBRATE;
     78# if (0)
     79int    MODE;
     80int    EXISTING_REGIONS;
     81int    ONLY_MATCH;
     82int    SKIP_MISSED;
     83int    REPLACE;
     84int    CLOSEST;
     85int    NOSORT;
     86int    UPDATE;
     87int    ONLY_IMAGES;
     88int    CALIBRATE;
    7289double DEFAULT_RADIUS;   // XXX add to AddstarClientOptions
    7390double NSIGMA;           // XXX add to AddstarClientOptions
    7491# endif
    75 
    76 /* these globals modify the behavior of gstars (KEEP) */
    77 double SNLIMIT;
    78 int    ACCEPT_ASTROM;  // accept even bad astrometry solutions (NASTRO == 0)
    79 int    TEXTMODE;
    80 int    VERBOSE;
    81 char  *DUMP;
    82 int    XOVERSCAN;  // used to modify stored image dimensions
    83 int    YOVERSCAN; 
    84 int    XMIN;       // used to filter loaded star list
    85 int    XMAX;
    86 int    YMIN;
    87 int    YMAX;
    88 double Latitude;   // carried into image structure from config
    8992
    9093/* modify server behavoir (make this an addstar cleanup mode?) */
     
    99102time_t    TIMEREF;    // used by MODE REF
    100103GSCRegion UserPatch;  // used by MODE CAT
    101 char *SELECT_2MASS_QUALITY;  // used only by get2mass_as
    102 
    103 double ZeroPt;  // double check for consistency (image header / config file): KEEP global
    104 
    105 int   FITS_INPUT;     // unused???
    106 int   ADDREFS;        // unused???
    107 int   DUMP_MATCHES;   // un-set???
     104char     *SELECT_2MASS_QUALITY;  // used only by get2mass_as
    108105
    109106/*** addstar prototypes ***/
    110107void       AddToCalibration       PROTO((Average *average, Measure *measure, Measure *new, int *next, int Nstar));
    111 void       ConfigInit             PROTO((int *argc, char **argv));
     108AddstarClientOptions ConfigInit   PROTO((int *argc, char **argv));
    112109void       FindCalibration        PROTO((Image *image));
    113110int        FindDecBand            PROTO((double dec, double *DEC0, double *DEC1));
     
    125122float      airmass                PROTO((float secz_image, double ra, double dec, double st, double latitude));
    126123void       aregion                PROTO((GSCRegion *region, FILE *f, double ra, double dec));
    127 int        args                   PROTO((int argc, char **argv));
     124AddstarClientOptions args         PROTO((int argc, char **argv, AddstarClientOptions options));
    128125void       check_permissions      PROTO((char *basefile));
    129126int        dump_rawstars          PROTO((Stars *stars, int Nstars));
    130127int        edge_check             PROTO((double *x1, double *y1, double *x2, double *y2));
    131 void       find_matches           PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap));
    132 void       find_matches_closest   PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap));
    133 void       find_matches_refstars  PROTO((GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog));
     128void       find_matches           PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options));
     129void       find_matches_closest   PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options));
     130void       find_matches_refstars  PROTO((GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    134131Stars    **find_subset            PROTO((GSCRegion *region, Stars *stars, int Nstars, int *NSTARS));
    135132int        gcatalog               PROTO((Catalog *catalog));
     
    189186Missing *sort_missing (Average *average, int Naverage, Missing *missing, int Nmissing, int *next_miss);
    190187
    191 int InitServerSocket (char *hostname, SockAddress *Address);
    192 int WaitServerSocket (int InitSocket, SockAddress *Address, int *validIP, int Nvalid);
    193 int GetClientSocket (char *hostname);
    194 
    195188/**
    196189  there is an inconsistency to be resolved: fixed structures (like Image)
     
    202195**/
    203196
    204 AddstarClientOptions args_client (int argc, char **argv);
    205 
    206 int args_server (int argc, char **argv);
     197/** function for client / server **/
     198
     199AddstarClientOptions args_client (int argc, char **argv, AddstarClientOptions options);
     200
     201void args_server (int argc, char **argv);
     202
    207203int CheckPassword (int BindSocket);
    208204int NewImage (int BindSocket);
     205
     206int InitServerSocket (char *hostname, SockAddress *Address);
     207int WaitServerSocket (int InitSocket, SockAddress *Address, int *validIP, int Nvalid);
     208int GetClientSocket (char *hostname);
     209
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r5265 r5322  
    11# include "addstar.h"
    22
    3 void ConfigInit (int *argc, char **argv) {
     3AddstarClientOptions ConfigInit (int *argc, char **argv) {
    44
    55  char *config, *file;
    66  char RadiusWord[80];
    77  char PhotCodeFile[256];
     8  AddstarClientOptions options;
    89
    910  /*** load configuration info ***/
     
    1920  XMIN = XMAX = YMIN = YMAX = 0;
    2021
    21   ScanConfig (config, "RADIUS",                 "%s",  0, RadiusWord);
    22   ScanConfig (config, "NSIGMA",                 "%lf", 0, &NSIGMA);
     22  /* used by client to interpret input data */
    2323  ScanConfig (config, "XOVERSCAN",              "%d",  0, &XOVERSCAN);
    2424  ScanConfig (config, "YOVERSCAN",              "%d",  0, &YOVERSCAN);
     
    2828  ScanConfig (config, "ADDSTAR_YMAX",           "%d",  0, &YMAX);
    2929  ScanConfig (config, "MIN_SN_FSTAT",           "%lf", 0, &SNLIMIT);
    30 
    31   ScanConfig (config, "2MASS_DIR_AS",           "%s",  0, TWO_MASS_DIR_AS);
    32   ScanConfig (config, "2MASS_DIR_DR2",          "%s",  0, TWO_MASS_DIR_DR2);
    33   ScanConfig (config, "GSCDIR",                 "%s",  0, GSCDIR);
    34   ScanConfig (config, "USNO_CDROM",             "%s",  0, CDROM);
    35 
    36   ScanConfig (config, "IMAGE_CATALOG",          "%s",  0, ImageCat);
    37   ScanConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
    38   ScanConfig (config, "CATDIR",                 "%s",  0, CATDIR);
    39   ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    40   ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    41   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, PhotCodeFile);
    4230
    4331  /* used by parse_time to find time-related keywords */
     
    5543  ScanConfig (config, "OBSERVATORY-LATITUDE",   "%lf", 0, &Latitude);
    5644  ScanConfig (config, "SUBPIX_DATAFILE",        "%s",  0, SubpixDatafile);
     45
     46  /* location of needed data sources */
     47  ScanConfig (config, "2MASS_DIR_AS",           "%s",  0, TWO_MASS_DIR_AS);
     48  ScanConfig (config, "2MASS_DIR_DR2",          "%s",  0, TWO_MASS_DIR_DR2);
     49  ScanConfig (config, "GSCDIR",                 "%s",  0, GSCDIR);
     50  ScanConfig (config, "USNO_CDROM",             "%s",  0, CDROM);
     51
     52  ScanConfig (config, "IMAGE_CATALOG",          "%s",  0, ImageCat);
     53  ScanConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
     54  ScanConfig (config, "CATDIR",                 "%s",  0, CATDIR);
     55  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
     56  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
     57  ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, PhotCodeFile);
    5758
    5859  /* used by client/server setup */
     
    9293  }
    9394
     95  /* set the default search radius */
     96  ScanConfig (config, "RADIUS",                 "%s",  0, RadiusWord);
     97  ScanConfig (config, "NSIGMA",                 "%lf", 0, &options.Nsigma);
    9498  if (!strcasecmp (RadiusWord, "header")) {
    95     DEFAULT_RADIUS = 0;
     99    options.radius = 0;
    96100  } else {
    97     DEFAULT_RADIUS = atof (RadiusWord);
     101    options.radius = atof (RadiusWord);
    98102  }
    99103
  • trunk/Ohana/src/addstar/src/NewImage.c

    r5288 r5322  
    3838
    3939  for (i = 0; i < Nimage; i++) {
    40     fprintf (stderr, "name: %s\n", image[i].name);
     40    fprintf (stderr, "name: %s, %d stars\n", image[i].name, Nstars);
    4141  }
    4242
  • trunk/Ohana/src/addstar/src/SocketOps.c

    r5271 r5322  
    1111
    1212  host = gethostbyname (hostname);
     13  fprintf (stderr, "errno: %d\n", h_errno);
     14  fprintf (stderr, "host: %d\n", host);
    1315
    1416  bzero (hostip, 80);
    1517  for (i = 0; i < host[0].h_length; i++) {
    16     sprintf (tmpline, "%3u", (0xff & host[0].h_addr[i]));
     18    sprintf (tmpline, "%u", (0xff & host[0].h_addr[i]));
    1719    strcat (hostip, tmpline);
    1820    if (i < host[0].h_length - 1) strcat (hostip, ".");
  • trunk/Ohana/src/addstar/src/addstar.c

    r5239 r5322  
    1010  Catalog catalog;
    1111  FITS_DB db;
     12  AddstarClientOptions options;
    1213
    1314  double dtime;
     
    1718
    1819  SetSignals ();
    19   ConfigInit (&argc, argv);
    20   args (argc, argv);
     20  options = ConfigInit (&argc, argv);
     21  options = args (argc, argv, options);
    2122
    2223  stars = NULL;
     
    2425  regions = NULL;
    2526  set_db (&db);
     27  if (options.update) {
     28    catalog.catflags = LOAD_AVES | LOAD_MEAS_META | LOAD_MISS | LOAD_SECF;
     29  } else {
     30    catalog.catflags = LOAD_AVES | LOAD_MEAS      | LOAD_MISS | LOAD_SECF;
     31  }
    2632
    2733  if (SKYPROBE) load_subpix ();
     
    3339  fprintf (stderr, "mark: lock_image_db: time %9.4f sec\n", dtime);
    3440
    35   switch (MODE) {
     41  switch (options.mode) {
    3642  case M_IMAGE:
    3743    stars = gstars (argv[1], &Nstars, &image);
     
    5056    break;
    5157  }
    52   if (ONLY_MATCH || EXISTING_REGIONS) {
     58  if (options.only_match || options.existing_regions) {
    5359    regions = gregion_match (regions, &Nregions);
    5460  }
     
    6470    gettimeofday (&t1, NULL);
    6571
    66     if (!load_pt_catalog (&catalog, &regions[i])) continue;
     72    load_pt_catalog (&catalog, &regions[i]);
     73
     74    /* for only_match, skip empty catalogs XXX EAM : this leaves behind empty files */
     75    if ((catalog.Nave_disk == 0) && options.only_match) {
     76      unlock_catalog (&catalog);
     77      continue;
     78    }
     79
    6780    Nm = catalog.Nmeasure + catalog.Nmeas_off;
    6881    Na = catalog.Naverage;
     
    7891    gettimeofday (&t1, NULL);
    7992
    80     switch (MODE) {
     93    switch (options.mode) {
    8194    case M_IMAGE:
    8295      Nsubset = Nstars;
    83       if (CLOSEST) {
    84         find_matches_closest (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap);
     96      if (options.closest) {
     97        find_matches_closest (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, options);
    8598      } else {
    86         find_matches (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap);
     99        find_matches (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, options);
    87100      }
    88101      break;
     
    91104    case M_REFLIST:
    92105      subset = find_subset (&regions[i], stars, Nstars, &Nsubset);
    93       find_matches_refstars (&regions[i], subset, Nsubset, &catalog);
     106      find_matches_refstars (&regions[i], subset, Nsubset, &catalog, options);
    94107      if (Nsubset) free (subset);
    95108      break;
     
    105118      unlock_catalog (&catalog);
    106119    } else {
    107       save_pt_catalog (&catalog);
     120      SetProtect (TRUE);
     121      if (!options.only_images) wcatalog (&catalog);
     122      SetProtect (FALSE);
     123      unlock_catalog (&catalog);
    108124    }
    109125
     
    118134  fprintf (stderr, "mark: match: time %9.4f sec\n", dtime);
    119135
    120   if (CALIBRATE) { FindCalibration (&image); }
     136  if (options.calibrate) { FindCalibration (&image); }
    121137
    122138  if (db.dbstate == LCK_EMPTY) {
     
    127143
    128144  /* write out new image */
    129   if (MODE == M_IMAGE) {
     145  if (options.mode == M_IMAGE) {
    130146    dvo_image_addrows (&db, &image, 1);
    131147    SetProtect (TRUE);
     
    143159
    144160/* names:
    145 
    146161   catalog - existing object db table
    147    regions  - sky area which may or may contain data
     162   regions - sky area which may or may not contain data
    148163   patch   - RA,DEC bounded portion of sky
    149    
    150164*/
  • trunk/Ohana/src/addstar/src/addstarc.c

    r5288 r5322  
    1010
    1111  /* load config and options */
    12   ConfigInit (&argc, argv);
    13   options = args_client (argc, argv);
     12  options = ConfigInit (&argc, argv);
     13  options = args_client (argc, argv, options);
    1414
    1515  /* load data */
  • trunk/Ohana/src/addstar/src/addstard.c

    r5271 r5322  
    66  SockAddress Address;
    77  IOBuffer message;
     8  AddstarClientOptions options;
    89
    9   ConfigInit (&argc, argv);
     10  options = ConfigInit (&argc, argv);
    1011  args_server (argc, argv);
    1112
  • trunk/Ohana/src/addstar/src/args.c

    r5268 r5322  
    11# include "addstar.h"
     2void help (void);
     3
     4AddstarClientOptions args (int argc, char **argv, AddstarClientOptions options) {
     5 
     6  int N;
     7
     8  /* check for help request */
     9  if (get_argument (argc, argv, "-help") ||
     10      get_argument (argc, argv, "-h")) {
     11    help ();
     12  }
     13
     14  /*** check for command line options ***/
     15
     16  /* basic mode: image, list, refcat */
     17  options.mode = M_IMAGE;
     18  if ((N = get_argument (argc, argv, "-ref"))) {
     19    options.mode = M_REFLIST;
     20    remove_argument (N, &argc, argv);
     21  }
     22  if ((N = get_argument (argc, argv, "-cat"))) {
     23    options.mode = M_REFCAT;
     24    remove_argument (N, &argc, argv);
     25  }
     26
     27  /*** provide additional data ***/
     28  /* restrict to a portion of the sky? (REFCAT only) */
     29  UserPatch.RA[0] = 0;
     30  UserPatch.RA[1] = 360;
     31  UserPatch.DEC[0] = -90;
     32  UserPatch.DEC[1] = +90;
     33  if ((N = get_argument (argc, argv, "-region"))) {
     34    remove_argument (N, &argc, argv);
     35    UserPatch.RA[0] = atof (argv[N]);
     36    remove_argument (N, &argc, argv);
     37    UserPatch.RA[1] = atof (argv[N]);
     38    remove_argument (N, &argc, argv);
     39    UserPatch.DEC[0] = atof (argv[N]);
     40    remove_argument (N, &argc, argv);
     41    UserPatch.DEC[1] = atof (argv[N]);
     42    remove_argument (N, &argc, argv);
     43  }
     44  /* override any header PHOTCODE values */
     45  thiscode = NULL;
     46  options.photcode = 0;
     47  if ((N = get_argument (argc, argv, "-p"))) {
     48    remove_argument (N, &argc, argv);
     49    options.photcode = GetPhotcodeCodebyName (argv[N]);
     50    thiscode = GetPhotcodebyName (argv[N]);
     51    remove_argument (N, &argc, argv);
     52  }
     53  /* provide a time for dataset */
     54  TIMEREF = 0;
     55  if ((N = get_argument (argc, argv, "-time"))) {
     56    time_t tmp;
     57    remove_argument (N, &argc, argv);
     58    if (!str_to_time (argv[N], &tmp)) {
     59      fprintf (stderr, "syntax error in time\n");
     60      exit (1);
     61    }
     62    TIMEREF = tmp;
     63    remove_argument (N, &argc, argv);
     64  }
     65  /* provide a mosaic for distortion */
     66  MOSAIC = NULL;
     67  options.mosaic = FALSE;
     68  if ((N = get_argument (argc, argv, "-mosaic"))) {
     69    Header header;
     70    ALLOCATE (MOSAIC, Coords, 1);
     71
     72    remove_argument (N, &argc, argv);
     73    if (!fits_read_header (argv[N], &header)) {
     74      fprintf (stderr, "ERROR: can't read header for mosaic %s\n", argv[N]);
     75      exit (1);
     76    }
     77    if (!GetCoords (MOSAIC, &header)) {
     78      fprintf (stderr, "ERROR: no astrometric solution in header\n");
     79      exit (1);
     80    }
     81    if (strcmp(&MOSAIC[0].ctype[4], "-DIS")) {
     82      fprintf (stderr, "ERROR: not a mosaic distortion header\n");
     83      exit (1);
     84    }
     85    remove_argument (N, &argc, argv);
     86    fits_free_header (&header);
     87    options.mosaic = TRUE;
     88  }
     89 
     90  /*** modify behavior ***/
     91  /* only add to existing objects */
     92  options.existing_regions = FALSE;
     93  if ((N = get_argument (argc, argv, "-existing-regions"))) {
     94    options.existing_regions = TRUE;
     95    remove_argument (N, &argc, argv);
     96  }
     97  /* only add to existing objects */
     98  options.only_match = FALSE;
     99  if ((N = get_argument (argc, argv, "-only-match"))) {
     100    options.only_match = TRUE;
     101    remove_argument (N, &argc, argv);
     102  }
     103  /* don't add missed pts to Missed table (image only) */
     104  options.skip_missed = FALSE;
     105  if ((N = get_argument (argc, argv, "-missed"))) {
     106    options.skip_missed = TRUE;
     107    remove_argument (N, &argc, argv);
     108  }
     109  /* replace measurement, don't duplicate (ref/cat only) */
     110  options.replace = FALSE;
     111  if ((N = get_argument (argc, argv, "-replace"))) {
     112    options.replace = TRUE;
     113    remove_argument (N, &argc, argv);
     114  }
     115  /* use 'closest star' matching, rather than traditional method */
     116  options.closest = FALSE;
     117  if ((N = get_argument (argc, argv, "-closest"))) {
     118    options.closest = TRUE;
     119    remove_argument (N, &argc, argv);
     120  }
     121
     122  /* don't re-sort the measure sequence */
     123  options.nosort = FALSE;
     124  if ((N = get_argument (argc, argv, "-nosort"))) {
     125    options.nosort = TRUE;
     126    remove_argument (N, &argc, argv);
     127  }
     128  /* only add new rows (-update) or re-write complete measure table (forces -nosort) */
     129  options.update = FALSE;
     130  if ((N = get_argument (argc, argv, "-update"))) {
     131    options.update = TRUE;
     132    options.nosort = TRUE;
     133    remove_argument (N, &argc, argv);
     134  }
     135
     136  /* only add image potion to image table */
     137  options.only_images = FALSE;
     138  if ((N = get_argument (argc, argv, "-image"))) {
     139    options.only_images = TRUE;
     140    remove_argument (N, &argc, argv);
     141  }
     142  /* apply average zpt offset calibration (image only) */
     143  options.calibrate = FALSE;
     144  if ((N = get_argument (argc, argv, "-cal"))) {
     145    options.calibrate = TRUE;
     146    remove_argument (N, &argc, argv);
     147  }
     148
     149  /*** optional situations ***/
     150  /* treat data specially for skyprobe (calibration, subpix) */
     151  SKYPROBE = FALSE;
     152  if ((N = get_argument (argc, argv, "-skyprobe"))) {
     153    SKYPROBE = TRUE;
     154    remove_argument (N, &argc, argv);
     155    /* XXX EAM : define airmass calculation method?
     156                 set calibrate to true
     157                 perhaps a 'skyprobe' data format (for image.sky issue)
     158    */
     159  }
     160  /* define 2MASS quality flags to keep */
     161  SELECT_2MASS_QUALITY = NULL;
     162  if ((N = get_argument (argc, argv, "-2massquality"))) {
     163    remove_argument (N, &argc, argv);
     164    SELECT_2MASS_QUALITY = strcreate (argv[N]);
     165    remove_argument (N, &argc, argv);
     166  }
     167  /* accept bad header astrometry */
     168  ACCEPT_ASTROM = FALSE;
     169  if ((N = get_argument (argc, argv, "-accept"))) {
     170    ACCEPT_ASTROM = TRUE;
     171    remove_argument (N, &argc, argv);
     172  }
     173  /* force read of image database with mismatched NSTARS & size */
     174  FORCE_READ = FALSE;
     175  if ((N = get_argument (argc, argv, "-force"))) {
     176    FORCE_READ = TRUE;
     177    remove_argument (N, &argc, argv);
     178  }
     179  /* force read of image database with mismatched NSTARS & size */
     180  TEXTMODE = FALSE;
     181  if ((N = get_argument (argc, argv, "-textmode"))) {
     182    TEXTMODE = TRUE;
     183    remove_argument (N, &argc, argv);
     184  }
     185  /* extra error messages */
     186  VERBOSE = FALSE;
     187  if ((N = get_argument (argc, argv, "-v"))) {
     188    VERBOSE = TRUE;
     189    remove_argument (N, &argc, argv);
     190  }
     191  DUMP = NULL;
     192  if ((N = get_argument (argc, argv, "-dump"))) {
     193    remove_argument (N, &argc, argv);
     194    DUMP = strcreate(argv[N]);
     195    remove_argument (N, &argc, argv);
     196  }
     197
     198
     199  if (argc != 2) {
     200    fprintf (stderr, "USAGE: addstar (filename)\n");
     201    fprintf (stderr, "USAGE: addstar -cat (catalog)\n");
     202    fprintf (stderr, "USAGE: addstar -ref (filename)\n");
     203    exit (2);
     204  }
     205  return (options);
     206}
    2207
    3208void help () {
     
    16221  fprintf (stderr, "  -time (YYYY/MM/DD,HH:MM:SS) : specify date/time (override header)\n");
    17222  fprintf (stderr, "  -mosaic (filename)          : identify associated mosaic frame for chip image\n");
    18   fprintf (stderr, "  -fits                       : input file is FITS table, not TEXT table\n");
     223  fprintf (stderr, "  -textmode                   : input file is RAW TEXT table, not FITS table\n");
    19224  fprintf (stderr, "  -existing-regions           : only add measurements to existing catalog files\n");
    20225  fprintf (stderr, "  -only-match                 : only add measurements to existing objects\n");
     
    36241}
    37242
    38 int args (int argc, char **argv) {
    39  
    40   int N;
    41 
    42   /* check for help request */
    43   if (get_argument (argc, argv, "-help") ||
    44       get_argument (argc, argv, "-h")) {
    45     help ();
    46   }
    47 
    48   /*** check for command line options ***/
    49 
    50   /* basic mode: image, list, refcat */
    51   MODE = M_IMAGE;
    52   if ((N = get_argument (argc, argv, "-ref"))) {
    53     MODE = M_REFLIST;
    54     remove_argument (N, &argc, argv);
    55   }
    56   if ((N = get_argument (argc, argv, "-cat"))) {
    57     MODE = M_REFCAT;
    58     remove_argument (N, &argc, argv);
    59   }
    60 
    61   /*** provide additional data ***/
    62   /* restrict to a portion of the sky? (REFCAT only) */
    63   UserPatch.RA[0] = 0;
    64   UserPatch.RA[1] = 360;
    65   UserPatch.DEC[0] = -90;
    66   UserPatch.DEC[1] = +90;
    67   if ((N = get_argument (argc, argv, "-region"))) {
    68     remove_argument (N, &argc, argv);
    69     UserPatch.RA[0] = atof (argv[N]);
    70     remove_argument (N, &argc, argv);
    71     UserPatch.RA[1] = atof (argv[N]);
    72     remove_argument (N, &argc, argv);
    73     UserPatch.DEC[0] = atof (argv[N]);
    74     remove_argument (N, &argc, argv);
    75     UserPatch.DEC[1] = atof (argv[N]);
    76     remove_argument (N, &argc, argv);
    77   }
    78   /* override any header PHOTCODE values */
    79   thiscode = NULL;
    80   if ((N = get_argument (argc, argv, "-p"))) {
    81     remove_argument (N, &argc, argv);
    82     thiscode = GetPhotcodebyName (argv[N]);
    83     remove_argument (N, &argc, argv);
    84   }
    85   /* provide a time for dataset */
    86   TIMEREF = 0;
    87   if ((N = get_argument (argc, argv, "-time"))) {
    88     remove_argument (N, &argc, argv);
    89     if (!str_to_time (argv[N], &TIMEREF)) {
    90       fprintf (stderr, "syntax error in time\n");
    91       exit (1);
    92     }
    93     remove_argument (N, &argc, argv);
    94   }
    95   /* provide a mosaic for distortion */
    96   MOSAIC = NULL;
    97   if ((N = get_argument (argc, argv, "-mosaic"))) {
    98     Header header;
    99     ALLOCATE (MOSAIC, Coords, 1);
    100 
    101     remove_argument (N, &argc, argv);
    102     if (!fits_read_header (argv[N], &header)) {
    103       fprintf (stderr, "ERROR: can't read header for mosaic %s\n", argv[N]);
    104       exit (1);
    105     }
    106     if (!GetCoords (MOSAIC, &header)) {
    107       fprintf (stderr, "ERROR: no astrometric solution in header\n");
    108       exit (1);
    109     }
    110     if (strcmp(&MOSAIC[0].ctype[4], "-DIS")) {
    111       fprintf (stderr, "ERROR: not a mosaic distortion header\n");
    112       exit (1);
    113     }
    114     remove_argument (N, &argc, argv);
    115     fits_free_header (&header);
    116   }
    117   FITS_INPUT = FALSE;
    118   if ((N = get_argument (argc, argv, "-fits"))) {
    119     FITS_INPUT = TRUE;
    120     remove_argument (N, &argc, argv);
    121   }
    122  
    123   /*** modify behavior ***/
    124   /* only add to existing objects */
    125   EXISTING_REGIONS = FALSE;
    126   if ((N = get_argument (argc, argv, "-existing-regions"))) {
    127     EXISTING_REGIONS = TRUE;
    128     remove_argument (N, &argc, argv);
    129   }
    130   /* only add to existing objects */
    131   ONLY_MATCH = FALSE;
    132   if ((N = get_argument (argc, argv, "-only-match"))) {
    133     ONLY_MATCH = TRUE;
    134     remove_argument (N, &argc, argv);
    135   }
    136   /* don't add missed pts to Missed table (image only) */
    137   SKIP_MISSED = FALSE;
    138   if ((N = get_argument (argc, argv, "-missed"))) {
    139     SKIP_MISSED = TRUE;
    140     remove_argument (N, &argc, argv);
    141   }
    142   /* replace measurement, don't duplicate (ref/cat only) */
    143   REPLACE = FALSE;
    144   if ((N = get_argument (argc, argv, "-replace"))) {
    145     REPLACE = TRUE;
    146     remove_argument (N, &argc, argv);
    147   }
    148   /* use 'closest star' matching, rather than traditional method */
    149   CLOSEST = FALSE;
    150   if ((N = get_argument (argc, argv, "-closest"))) {
    151     CLOSEST = TRUE;
    152     remove_argument (N, &argc, argv);
    153   }
    154 
    155   /* don't re-sort the measure sequence */
    156   NOSORT = FALSE;
    157   if ((N = get_argument (argc, argv, "-nosort"))) {
    158     NOSORT = TRUE;
    159     remove_argument (N, &argc, argv);
    160   }
    161   /* only add new rows (-update) or re-write complete measure table (forces -nosort) */
    162   UPDATE = FALSE;
    163   if ((N = get_argument (argc, argv, "-update"))) {
    164     UPDATE = TRUE;
    165     NOSORT = TRUE;
    166     remove_argument (N, &argc, argv);
    167   }
    168 
    169   /* only add image potion to image table */
    170   ONLY_IMAGES = FALSE;
    171   if ((N = get_argument (argc, argv, "-image"))) {
    172     ONLY_IMAGES = TRUE;
    173     remove_argument (N, &argc, argv);
    174   }
    175   /* apply average zpt offset calibration (image only) */
    176   CALIBRATE = FALSE;
    177   if ((N = get_argument (argc, argv, "-cal"))) {
    178     CALIBRATE = TRUE;
    179     remove_argument (N, &argc, argv);
    180   }
    181   /* define 2MASS quality flags to keep */
    182   SELECT_2MASS_QUALITY = NULL;
    183   if ((N = get_argument (argc, argv, "-2massquality"))) {
    184     remove_argument (N, &argc, argv);
    185     SELECT_2MASS_QUALITY = strcreate (argv[N]);
    186     remove_argument (N, &argc, argv);
    187   }
    188 
    189   /*** optional situations ***/
    190   /* treat data specially for skyprobe (calibration, subpix) */
    191   SKYPROBE = FALSE;
    192   if ((N = get_argument (argc, argv, "-skyprobe"))) {
    193     SKYPROBE = TRUE;
    194     remove_argument (N, &argc, argv);
    195     /* XXX EAM : define airmass calculation method?
    196                  set calibrate to true
    197                  perhaps a 'skyprobe' data format (for image.sky issue)
    198     */
    199   }
    200   /* accept bad header astrometry */
    201   ACCEPT_ASTROM = FALSE;
    202   if ((N = get_argument (argc, argv, "-accept"))) {
    203     ACCEPT_ASTROM = TRUE;
    204     remove_argument (N, &argc, argv);
    205   }
    206   /* force read of image database with mismatched NSTARS & size */
    207   FORCE_READ = FALSE;
    208   if ((N = get_argument (argc, argv, "-force"))) {
    209     FORCE_READ = TRUE;
    210     remove_argument (N, &argc, argv);
    211   }
    212   /* force read of image database with mismatched NSTARS & size */
    213   TEXTMODE = FALSE;
    214   if ((N = get_argument (argc, argv, "-textmode"))) {
    215     TEXTMODE = TRUE;
    216     remove_argument (N, &argc, argv);
    217   }
    218   /* extra error messages */
    219   VERBOSE = FALSE;
    220   if ((N = get_argument (argc, argv, "-v"))) {
    221     VERBOSE = TRUE;
    222     remove_argument (N, &argc, argv);
    223   }
    224   DUMP = NULL;
    225   if ((N = get_argument (argc, argv, "-dump"))) {
    226     remove_argument (N, &argc, argv);
    227     DUMP = strcreate(argv[N]);
    228     remove_argument (N, &argc, argv);
    229   }
    230 
    231 
    232   if (argc != 2) {
    233     fprintf (stderr, "USAGE: addstar (filename)\n");
    234     fprintf (stderr, "USAGE: addstar -cat (catalog)\n");
    235     fprintf (stderr, "USAGE: addstar -ref (filename)\n");
    236     exit (2);
    237   }
    238   return (TRUE);
    239 }
    240 
    241243/** addstar modes:
    242244 
  • trunk/Ohana/src/addstar/src/args_client.c

    r5271 r5322  
    22void help (void);
    33
    4 AddstarClientOptions args_client (int argc, char **argv) {
     4AddstarClientOptions args_client (int argc, char **argv, AddstarClientOptions options) {
    55 
    66  int N;
    7   AddstarClientOptions options;  // used to pass options to server
    87
    98  /* check for help request */
  • trunk/Ohana/src/addstar/src/args_server.c

    r5271 r5322  
    22void help (void);
    33
    4 int args_server (int argc, char **argv) {
     4void args_server (int argc, char **argv) {
    55 
    66  int N;
     
    1212  }
    1313
    14   /* basic mode: image, list, refcat */
    15   MODE = M_IMAGE;
    16   if ((N = get_argument (argc, argv, "-ref"))) {
    17     MODE = M_REFLIST;
    18     remove_argument (N, &argc, argv);
    19   }
    20   if ((N = get_argument (argc, argv, "-cat"))) {
    21     MODE = M_REFCAT;
    22     remove_argument (N, &argc, argv);
    23   }
    24 
    25   /*** provide additional data ***/
    2614  /* restrict to a portion of the sky? (REFCAT only) */
    2715  UserPatch.RA[0] = 0;
     
    4028    remove_argument (N, &argc, argv);
    4129  }
    42   /* override any header PHOTCODE values */
    43   thiscode = NULL;
    44   if ((N = get_argument (argc, argv, "-p"))) {
    45     remove_argument (N, &argc, argv);
    46     thiscode = GetPhotcodebyName (argv[N]);
    47     remove_argument (N, &argc, argv);
    48   }
    49   /* provide a time for dataset */
    50   TIMEREF = 0;
    51   if ((N = get_argument (argc, argv, "-time"))) {
    52     remove_argument (N, &argc, argv);
    53     if (!str_to_time (argv[N], &TIMEREF)) {
    54       fprintf (stderr, "syntax error in time\n");
    55       exit (1);
    56     }
    57     remove_argument (N, &argc, argv);
    58   }
    59   /* provide a mosaic for distortion */
    60   MOSAIC = NULL;
    61   if ((N = get_argument (argc, argv, "-mosaic"))) {
    62     Header header;
    63     ALLOCATE (MOSAIC, Coords, 1);
    64 
    65     remove_argument (N, &argc, argv);
    66     if (!fits_read_header (argv[N], &header)) {
    67       fprintf (stderr, "ERROR: can't read header for mosaic %s\n", argv[N]);
    68       exit (1);
    69     }
    70     if (!GetCoords (MOSAIC, &header)) {
    71       fprintf (stderr, "ERROR: no astrometric solution in header\n");
    72       exit (1);
    73     }
    74     if (strcmp(&MOSAIC[0].ctype[4], "-DIS")) {
    75       fprintf (stderr, "ERROR: not a mosaic distortion header\n");
    76       exit (1);
    77     }
    78     remove_argument (N, &argc, argv);
    79     fits_free_header (&header);
    80   }
    81   FITS_INPUT = FALSE;
    82   if ((N = get_argument (argc, argv, "-fits"))) {
    83     FITS_INPUT = TRUE;
    84     remove_argument (N, &argc, argv);
    85   }
    8630 
    87   /*** modify behavior ***/
    88   /* only add to existing objects */
    89   EXISTING_REGIONS = FALSE;
    90   if ((N = get_argument (argc, argv, "-existing-regions"))) {
    91     EXISTING_REGIONS = TRUE;
    92     remove_argument (N, &argc, argv);
    93   }
    94   /* only add to existing objects */
    95   ONLY_MATCH = FALSE;
    96   if ((N = get_argument (argc, argv, "-only-match"))) {
    97     ONLY_MATCH = TRUE;
    98     remove_argument (N, &argc, argv);
    99   }
    100   /* don't add missed pts to Missed table (image only) */
    101   SKIP_MISSED = FALSE;
    102   if ((N = get_argument (argc, argv, "-missed"))) {
    103     SKIP_MISSED = TRUE;
    104     remove_argument (N, &argc, argv);
    105   }
    106   /* replace measurement, don't duplicate (ref/cat only) */
    107   REPLACE = FALSE;
    108   if ((N = get_argument (argc, argv, "-replace"))) {
    109     REPLACE = TRUE;
    110     remove_argument (N, &argc, argv);
    111   }
    112   /* use 'closest star' matching, rather than traditional method */
    113   CLOSEST = FALSE;
    114   if ((N = get_argument (argc, argv, "-closest"))) {
    115     CLOSEST = TRUE;
    116     remove_argument (N, &argc, argv);
    117   }
    118 
    119   /* don't re-sort the measure sequence */
    120   NOSORT = FALSE;
    121   if ((N = get_argument (argc, argv, "-nosort"))) {
    122     NOSORT = TRUE;
    123     remove_argument (N, &argc, argv);
    124   }
    125   /* only add new rows (-update) or re-write complete measure table (forces -nosort) */
    126   UPDATE = FALSE;
    127   if ((N = get_argument (argc, argv, "-update"))) {
    128     UPDATE = TRUE;
    129     NOSORT = TRUE;
    130     remove_argument (N, &argc, argv);
    131   }
    132 
    133   /* only add image potion to image table */
    134   ONLY_IMAGES = FALSE;
    135   if ((N = get_argument (argc, argv, "-image"))) {
    136     ONLY_IMAGES = TRUE;
    137     remove_argument (N, &argc, argv);
    138   }
    139   /* apply average zpt offset calibration (image only) */
    140   CALIBRATE = FALSE;
    141   if ((N = get_argument (argc, argv, "-cal"))) {
    142     CALIBRATE = TRUE;
    143     remove_argument (N, &argc, argv);
    144   }
    14531  /* define 2MASS quality flags to keep */
    14632  SELECT_2MASS_QUALITY = NULL;
     
    15137  }
    15238
    153   /*** optional situations ***/
    154   /* treat data specially for skyprobe (calibration, subpix) */
    155   SKYPROBE = FALSE;
    156   if ((N = get_argument (argc, argv, "-skyprobe"))) {
    157     SKYPROBE = TRUE;
    158     remove_argument (N, &argc, argv);
    159   }
    160   /* accept bad header astrometry */
    161   ACCEPT_ASTROM = FALSE;
    162   if ((N = get_argument (argc, argv, "-accept"))) {
    163     ACCEPT_ASTROM = TRUE;
    164     remove_argument (N, &argc, argv);
    165   }
    16639  /* force read of image database with mismatched NSTARS & size */
    16740  FORCE_READ = FALSE;
     
    17043    remove_argument (N, &argc, argv);
    17144  }
    172   /* force read of image database with mismatched NSTARS & size */
    173   TEXTMODE = FALSE;
    174   if ((N = get_argument (argc, argv, "-textmode"))) {
    175     TEXTMODE = TRUE;
    176     remove_argument (N, &argc, argv);
    177   }
     45
    17846  /* extra error messages */
    17947  VERBOSE = FALSE;
    18048  if ((N = get_argument (argc, argv, "-v"))) {
    18149    VERBOSE = TRUE;
    182     remove_argument (N, &argc, argv);
    183   }
    184   DUMP = NULL;
    185   if ((N = get_argument (argc, argv, "-dump"))) {
    186     remove_argument (N, &argc, argv);
    187     DUMP = strcreate(argv[N]);
    18850    remove_argument (N, &argc, argv);
    18951  }
     
    19961
    20062  fprintf (stderr, "USAGE\n");
    201   fprintf (stderr, "  addstar (filename)\n");
    202   fprintf (stderr, "     add specified image (cmp format) to database\n\n");
    203   fprintf (stderr, "  addstar -ref (filename)");
    204   fprintf (stderr, "     add ASCII data (ra dec mag dmag) to database\n\n");
    205   fprintf (stderr, "  addstar -cat (catalog)");
    206   fprintf (stderr, "     add data from catalog (USNO/2MASS/GSC) to database\n\n");
    207 
    208   fprintf (stderr, "  optional flags:\n");
    209   fprintf (stderr, "  -region ra ra dec dec       : only add data in specified region (-ref mode only)\n");
    210   fprintf (stderr, "  -p (photcode)               : specify photcode (override header)\n");
    211   fprintf (stderr, "  -time (YYYY/MM/DD,HH:MM:SS) : specify date/time (override header)\n");
    212   fprintf (stderr, "  -mosaic (filename)          : identify associated mosaic frame for chip image\n");
    213   fprintf (stderr, "  -fits                       : input file is FITS table, not TEXT table\n");
    214   fprintf (stderr, "  -existing-regions           : only add measurements to existing catalog files\n");
    215   fprintf (stderr, "  -only-match                 : only add measurements to existing objects\n");
    216   fprintf (stderr, "  -missed                     : skipped 'missed' entries\n");
    217   fprintf (stderr, "  -replace                    : replace time/photcode measurements (no duplication)\n");
    218   fprintf (stderr, "  -closest                    : use closest-star algorith\n");
    219   fprintf (stderr, "  -nosort                     : don't re-sort the measure entries (improves speed)\n");
    220   fprintf (stderr, "  -update                     : only update the new rows (foreces -nosort)\n");
    221   fprintf (stderr, "  -image                      : only insert image data\n");
    222   fprintf (stderr, "  -cal                        : perform zero-point calibration\n");
    223   fprintf (stderr, "  -skyprobe                   : specify skyprobe mode\n");
    224   fprintf (stderr, "  -accept                     : accept bad astrometry from header\n");
     63  fprintf (stderr, "  addstard (host)\n");
    22564  fprintf (stderr, "  -force                      : force read of database with inconsistent info\n");
    22665  fprintf (stderr, "  -v                          : verbose mode\n");
    227   fprintf (stderr, "  -dump (mode)                : output test data\n");
    22866  fprintf (stderr, "  -help                       : this list\n");
    22967  fprintf (stderr, "  -h                          : this list\n\n");
    23068  exit (2);
    23169}
    232 
    233 /** addstar modes:
    234  
    235     addstar (image.smp)  - add cmp/smp image data to db
    236     addstar -ref (file.dat) (photcode)
    237     addstar -cat (USNO/2MASS/GSC) -region (ra dec - ra dec)
    238 
    239     -replace : ref/cat - replace existing match (photcode/time)
    240     -match   : ref/cat - only add measures to existing averages
    241 
    242     ref types:
    243     ASCII - RA,DEC,M,dM in a table
    244 
    245     addstar
    246 
    247 **/
    248 
  • trunk/Ohana/src/addstar/src/find_matches.c

    r5287 r5322  
    11# include "addstar.h"
    22
    3 void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap) {
     3void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options) {
    44
    55  int i, j, n, N, J;
     
    8585
    8686  /* choose a radius for matches */
    87   if (DEFAULT_RADIUS == 0) {
    88     RADIUS = NSIGMA * 0.02 * image[0].cerror;  /* 0.02 corrects cerror to arcsec from storage units */
     87  if (options.radius == 0) {
     88    RADIUS = options.Nsigma * 0.02 * image[0].cerror;  /* 0.02 corrects cerror to arcsec from storage units */
    8989  } else {
    90     RADIUS = DEFAULT_RADIUS; /* provided by config */
     90    RADIUS = options.radius; /* provided by config */
    9191  }
    9292  RADIUS2 = RADIUS*RADIUS;
     
    162162
    163163      /* adds the measurement to the calibration if appropriate color terms are found */
    164       if (CALIBRATE) {
     164      if (options.calibrate) {
    165165        AddToCalibration (&catalog[0].average[n], catalog[0].measure, &catalog[0].measure[Nmeas], next_meas, N);
    166166      }
     
    190190      Nmeas ++;
    191191
    192       if (!UPDATE) {
     192      if (!options.update) {
    193193        /* in UPDATE mode, newly calculated coordinates are not saved */
    194194        update_coords (&catalog[0].average[n], &catalog[0].measure[0], next_meas);
     
    200200  /* add reference for undetected catalog stars */
    201201  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (MOSAIC);
    202   for (j = 0; (j < Nave) && !SKIP_MISSED; j++) {
     202  for (j = 0; (j < Nave) && !options.skip_missed; j++) {
    203203    n = N2[j];
    204204    if (catalog[0].found[n] < 0) {
     
    224224  /* incorporate unmatched image stars, if this star is in field of this catalog */
    225225  /* these new entries are all written out in UPDATE mode */
    226   for (i = 0; (i < Nstars) && !ONLY_MATCH; i++) {
     226  for (i = 0; (i < Nstars) && !options.only_match; i++) {
    227227    /* make sure there is space for next entry */
    228228    if (Nmeas >= NMEAS) {
     
    285285
    286286    /** now add references from all previous non-detection observations of this spot on the sky */
    287     for (j = 0; (j < Noverlap) && !SKIP_MISSED; j++) {
     287    for (j = 0; (j < Noverlap) && !options.skip_missed; j++) {
    288288      /* make sure there is space for next entry */
    289289      if (Nmiss >= NMISS) {
     
    316316  REALLOCATE (catalog[0].missing, Missing, Nmiss);
    317317 
    318   if (NOSORT) {
     318  if (options.nosort) {
    319319    catalog[0].sorted = FALSE;
    320320  } else {
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r5287 r5322  
    11# include "addstar.h"
    22
    3 void find_matches_closest (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap) {
     3void find_matches_closest (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options) {
    44
    55  int i, j, n, N, J, Jmin;
     
    8585
    8686  /* choose a radius for matches */
    87   if (DEFAULT_RADIUS == 0) {
    88     RADIUS = NSIGMA * 0.02 * image[0].cerror;  /* 0.02 corrects cerror to arcsec from storage units */
     87  if (options.radius == 0) {
     88    RADIUS = options.Nsigma * 0.02 * image[0].cerror;  /* 0.02 corrects cerror to arcsec from storage units */
    8989  } else {
    90     RADIUS = DEFAULT_RADIUS; /* provided by config */
     90    RADIUS = options.radius; /* provided by config */
    9191  }
    9292  RADIUS2 = RADIUS*RADIUS;
     
    178178
    179179    /* adds the measurement to the calibration if appropriate color terms are found */
    180     if (CALIBRATE) {
     180    if (options.calibrate) {
    181181      AddToCalibration (&catalog[0].average[n], catalog[0].measure, &catalog[0].measure[Nmeas], next_meas, N);
    182182    }
     
    198198  /** add reference for undetected catalog stars **/
    199199  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (MOSAIC);
    200   for (j = 0; (j < Nave) && !SKIP_MISSED; j++) {
     200  for (j = 0; (j < Nave) && !options.skip_missed; j++) {
    201201    n = N2[j];
    202202    if (catalog[0].found[n] < 0) {
     
    222222  /** incorporate unmatched image stars, if this star is in field of this catalog **/
    223223  /* these new entries are all written out in UPDATE mode */
    224   for (i = 0; (i < Nstars) && !ONLY_MATCH; i++) {
     224  for (i = 0; (i < Nstars) && !options.only_match; i++) {
    225225    /* make sure there is space for next entry */
    226226    if (Nmeas >= NMEAS) {
     
    283283
    284284    /** now add references from all previous non-detection observations of this spot on the sky */
    285     for (j = 0; (j < Noverlap) && !SKIP_MISSED; j++) {
     285    for (j = 0; (j < Noverlap) && !options.skip_missed; j++) {
    286286      /* make sure there is space for next entry */
    287287      if (Nmiss >= NMISS) {
     
    314314  REALLOCATE (catalog[0].missing, Missing, Nmiss);
    315315 
    316   if (NOSORT) {
     316  if (options.nosort) {
    317317    catalog[0].sorted = FALSE;
    318318  } else {
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r4865 r5322  
    11# include "addstar.h"
    22
    3 void find_matches_refstars (GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog) {
     3void find_matches_refstars (GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options) {
    44
    55  int i, j, k, n, m, N, J;
     
    8282
    8383  /* choose a radius for matches */
    84   if (DEFAULT_RADIUS == 0) {
     84  if (options.radius == 0) {
    8585    RADIUS = 2.0; /* hardwired default for refstars */
    8686  } else {
    87     RADIUS = DEFAULT_RADIUS; /* provided by config */
     87    RADIUS = options.radius; /* provided by config */
    8888  }
    8989  RADIUS2 = RADIUS*RADIUS;
     
    115115
    116116      /** in replace mode, search for entry and replace values M, dM, R, D */
    117       if (REPLACE && replace_match (&catalog[0].average[n], &catalog[0].measure[m], stars[N])) continue;
     117      if (options.replace && replace_match (&catalog[0].average[n], &catalog[0].measure[m], stars[N])) continue;
    118118
    119119      /** insert star in measurement list */
     
    189189     the reference up-to-date with known stars only */
    190190
    191   for (i = 0; (i < Nstars) && !ONLY_MATCH; i++) {
     191  for (i = 0; (i < Nstars) && !options.only_match; i++) {
    192192    N = N1[i];
    193193    if (stars[N][0].found >= 0) continue;
  • trunk/Ohana/src/addstar/src/gcatalog.c

    r5234 r5322  
    99
    1010  /* read catalog header */
    11   if (UPDATE) {
    12     mode = LOAD_AVES | LOAD_MEAS_META | LOAD_MISS | LOAD_SECF;
    13   } else {
    14     mode = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
    15   }
    16   if (!load_catalog (catalog, mode, VERBOSE)) {
     11  if (!load_catalog (catalog, VERBOSE)) {
    1712    fprintf (stderr, "ERROR: failure loading catalog\n");
    1813    exit (1);
  • trunk/Ohana/src/addstar/src/load_pt_catalog.c

    r3376 r5322  
    1111  switch (lock_catalog (catalog, LCK_XCLD)) {
    1212  case 0:
    13     /* catalog file is locked.  this is an unexpected error because
    14        ImageCat was NOT locked so we should be the only locking entity */
    1513    fprintf (stderr, "ERROR: can't lock file %s\n", catalog[0].filename);
    1614    exit (1);
     
    1917    break;
    2018  case 2:
    21     if (ONLY_MATCH) return (FALSE);
    2219    mkcatalog (region, catalog); /* fills in new header info */
    2320    break;
     
    2522  return (TRUE);
    2623}
     24
     25/* If the catalog file is locked, something weird is happening...  this is an unexpected error
     26   because ImageCat was NOT locked so we should be the only locking entity.  However, this logic
     27   breaks down for the server design: image and catalog are updated independently... */
  • trunk/Ohana/src/addstar/src/replace_match.c

    r5239 r5322  
    55  int i;
    66
    7   if (!REPLACE) return (FALSE);
    8 
    9   /** in replace mode, search for entry and replace values M, dM, R, D */
     7  /* search for entry and replace values M, dM, R, D */
    108  for (i = 0; i < average[0].Nm; i++) {
    119    if (measure[i].source != thiscode[0].code) continue;
  • trunk/Ohana/src/addstar/src/wcatalog.c

    r5234 r5322  
    99  fits_modify (&catalog[0].header, "SORTED",  "%t", 1, catalog[0].sorted);
    1010
    11   if (UPDATE) {
     11  /* if partial load, must use update */
     12  if (catalog[0].Nmeas_off != 0) {
    1213    if (!update_catalog (catalog, VERBOSE)) {
    1314      fprintf (stderr, "ERROR: failure updating catalog\n");
Note: See TracChangeset for help on using the changeset viewer.