IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 18, 2015, 8:21:16 AM (11 years ago)
Author:
eugene
Message:

fixing loadgalphot

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

Legend:

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

    r38553 r38600  
    3636} GalPhotIDset;
    3737
    38 AddstarClientOptions args_loadgalphot (int argc, char **argv, AddstarClientOptions options);
     38AddstarClientOptions args_loadgalphot (int *argc, char **argv, AddstarClientOptions options);
    3939
    4040int loadgalphot_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options);
    4141
    42 GalPhot_Stars *loadgalphot_readstars (char *filename, int *nstars);
     42GalPhot_Stars *loadgalphot_readstars (char *filename, int *nstars, AddstarClientOptions *options);
    4343
    4444int loadgalphot_sortStars (GalPhot_Stars *stars, int Nstars);
  • trunk/Ohana/src/addstar/src/args_loadgalphot.c

    r38553 r38600  
    44static void help (void);
    55
    6 AddstarClientOptions args_loadgalphot (int argc, char **argv, AddstarClientOptions options) {
     6AddstarClientOptions args_loadgalphot (int *argc, char **argv, AddstarClientOptions options) {
    77 
    88  int N;
    99
    1010  /* check for help request */
    11   if (get_argument (argc, argv, "-help") ||
    12       get_argument (argc, argv, "-h")) {
     11  if (get_argument (*argc, argv, "-help") ||
     12      get_argument (*argc, argv, "-h")) {
    1313    help ();
    1414  }
    … …  
    2727  HOST_ID = 0;
    2828  PARALLEL = FALSE;
    29   if ((N = get_argument (argc, argv, "-parallel"))) {
     29  if ((N = get_argument (*argc, argv, "-parallel"))) {
    3030    PARALLEL = TRUE;
    31     remove_argument (N, &argc, argv);
     31    remove_argument (N, argc, argv);
    3232  }
    3333  // this is a test mode : rather than launching the remote jobs and waiting for completion,
    3434  // relphot will simply list the remote command and wait for the user to signal completion
    3535  PARALLEL_MANUAL = FALSE;
    36   if ((N = get_argument (argc, argv, "-parallel-manual"))) {
     36  if ((N = get_argument (*argc, argv, "-parallel-manual"))) {
    3737    PARALLEL = TRUE; // -parallel-manual implies -parallel
    3838    PARALLEL_MANUAL = TRUE;
    39     remove_argument (N, &argc, argv);
     39    remove_argument (N, argc, argv);
    4040  }
    4141  // this is a test mode : rather than launching the relphot_client jobs remotely, they are
    4242  // run in serial via 'system'
    4343  PARALLEL_SERIAL = FALSE;
    44   if ((N = get_argument (argc, argv, "-parallel-serial"))) {
     44  if ((N = get_argument (*argc, argv, "-parallel-serial"))) {
    4545    if (PARALLEL_MANUAL) {
    4646      fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n");
    … …  
    4949    PARALLEL = TRUE; // -parallel-serial implies -parallel
    5050    PARALLEL_SERIAL = TRUE;
    51     remove_argument (N, &argc, argv);
     51    remove_argument (N, argc, argv);
    5252  }
    5353
    5454  /* only add to existing regions */
    5555  options.existing_regions = FALSE;
    56   if ((N = get_argument (argc, argv, "-existing-regions"))) {
     56  if ((N = get_argument (*argc, argv, "-existing-regions"))) {
    5757    options.existing_regions = TRUE;
    58     remove_argument (N, &argc, argv);
     58    remove_argument (N, argc, argv);
    5959  }
    6060  /* only add to existing objects */
    6161  options.only_match = FALSE;
    62   if ((N = get_argument (argc, argv, "-only-match"))) {
     62  if ((N = get_argument (*argc, argv, "-only-match"))) {
    6363    options.only_match = TRUE;
    64     remove_argument (N, &argc, argv);
     64    remove_argument (N, argc, argv);
    6565  }
    6666  /* replace measurement, don't duplicate (ref/cat only) */
    6767  options.replace = FALSE;
    68   if ((N = get_argument (argc, argv, "-replace"))) {
     68  if ((N = get_argument (*argc, argv, "-replace"))) {
    6969    options.replace = TRUE;
    70     remove_argument (N, &argc, argv);
     70    remove_argument (N, argc, argv);
     71  }
     72  /* override any header PHOTCODE values */
     73  options.photcode = 0;
     74  if ((N = get_argument (*argc, argv, "-p"))) {
     75    remove_argument (N, argc, argv);
     76    options.photcode = GetPhotcodeCodebyName (argv[N]);
     77    remove_argument (N, argc, argv);
     78  }
     79  if ((N = get_argument (*argc, argv, "-photcode"))) {
     80    remove_argument (N, argc, argv);
     81    options.photcode = GetPhotcodeCodebyName (argv[N]);
     82    remove_argument (N, argc, argv);
    7183  }
    7284
    7385  /* extra error messages */
    7486  VERBOSE = FALSE;
    75   if ((N = get_argument (argc, argv, "-v"))) {
     87  if ((N = get_argument (*argc, argv, "-v"))) {
    7688    VERBOSE = TRUE;
    77     remove_argument (N, &argc, argv);
     89    remove_argument (N, argc, argv);
    7890  }
    7991
    8092  /* other addstar options which cannot be used in loadgalphot */
    81   options.photcode = 0;
    8293  options.timeref = 0;
    8394  options.mosaic = FALSE;
    … …  
    95106  DUMP = NULL;
    96107
    97   if (argc < 2) {
     108  if (*argc < 2) {
    98109    fprintf (stderr, "USAGE: loadgalphot [options] (fitsfile) [..more files]\n");
    99110    exit (2);
  • trunk/Ohana/src/addstar/src/loadgalphot.c

    r38553 r38600  
    1414  // need to construct these options with args_loadgalphot...
    1515  options = ConfigInit (&argc, argv);
    16   options = args_loadgalphot (argc, argv, options);
     16  options = args_loadgalphot (&argc, argv, options);
    1717
    1818  // load the full sky description table (dvodb must exist)
  • trunk/Ohana/src/addstar/src/loadgalphot_readstars.c

    r38553 r38600  
    1515
    1616static float *chisqFit = NULL;
    17 
    18 GalPhot_Stars *loadgalphot_readstars (char *filename, int *nstars) {
     17static float ZeroPt = 0;
     18
     19GalPhot_Stars *loadgalphot_readstars (char *filename, int *nstars, AddstarClientOptions *options) {
    1920
    2021  // read in the full FITS files ('cause I don't have a partial read option)
    … …  
    6768    namehash[i][2] = -1;
    6869  }
     70
     71  ZeroPt = GetZeroPoint();
    6972
    7073  char name[256], tmpname[256];
    … …  
    228231    stars[i].galphot.modelType = MODEL_TYPE_gal[i];
    229232    stars[i].galphot.detID     = ID_gal[i];
     233    stars[i].galphot.photcode  = options->photcode;
    230234
    231235    // I have a grid of measurements with (Flux, dFlux, Chisq) at each point
    … …  
    377381
    378382  // use bilinear interpolation to choose Flux @ (Xmin,Ymin)?
    379   galphot->mag    = -2.5*log10(flux[iMin]); // correct for exptime?
     383  galphot->mag    = -2.5*log10(flux[iMin]) + ZeroPt; // correct for exptime?
    380384  galphot->magErr = sqrt(fluxErr[iMin]) / flux[iMin];
    381385  galphot->chisq  = chisqMin;
  • trunk/Ohana/src/addstar/src/loadgalphot_table.c

    r38553 r38600  
    66  int i, Nstars;
    77
    8   GalPhot_Stars *stars = loadgalphot_readstars (filename, &Nstars);
     8  GalPhot_Stars *stars = loadgalphot_readstars (filename, &Nstars, options);
    99
    1010  // sort the stars by RA
Note: See TracChangeset for help on using the changeset viewer.