IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38600 for trunk


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

fixing loadgalphot

Location:
trunk/Ohana/src
Files:
8 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
  • trunk/Ohana/src/libdvo/include/dvodb.h

    r38153 r38600  
    304304      AVE_REF_COLOR_RED,
    305305      AVE_PHOT, // photometry class of values
     306      AVE_GAL_MAG,
     307      AVE_GAL_MAG_ERR,
     308      AVE_GAL_MAJ,
     309      AVE_GAL_MAJ_ERR,
     310      AVE_GAL_MIN,
     311      AVE_GAL_MIN_ERR,
     312      AVE_GAL_THETA,
     313      AVE_GAL_THETA_ERR,
     314      AVE_GAL_INDEX,
     315      AVE_GAL_CHISQ,
     316      AVE_GAL_NPIX,
     317      AVE_GAL_TYPE,
    306318      AVE_E_BV,               // extinction (mags)
    307319      AVE_E_BV_ERR,
  • trunk/Ohana/src/libdvo/src/dbFields.c

    r38153 r38600  
    159159  }
    160160  return FALSE;
     161}
     162
     163int dbFieldNeedStarpar (dbField *fields, int Nfields, int isAverage) {
     164  int i;
     165  for (i = 0; i < Nfields; i++) {
     166    if (isAverage) {
     167      if (fields[i].ID == AVE_E_BV)             return TRUE;
     168      if (fields[i].ID == AVE_E_BV_ERR)         return TRUE;
     169      if (fields[i].ID == AVE_DISTANCE_MOD)     return TRUE;
     170      if (fields[i].ID == AVE_DISTANCE_MOD_ERR) return TRUE;
     171      if (fields[i].ID == AVE_M_R)              return TRUE;
     172      if (fields[i].ID == AVE_M_R_ERR)          return TRUE;
     173      if (fields[i].ID == AVE_FEH)              return TRUE;
     174      if (fields[i].ID == AVE_FEH_ERR)          return TRUE;
     175      if (fields[i].ID == AVE_URA_GALMODEL)     return TRUE;
     176      if (fields[i].ID == AVE_UDEC_GALMODEL)    return TRUE;
     177      if (fields[i].ID == AVE_RA_GALMODEL)      return TRUE;
     178      if (fields[i].ID == AVE_DEC_GALMODEL)     return TRUE;
     179    }
     180  }
    161181}
    162182
     
    690710  if (!strcasecmp (fieldName, "REF_COLOR_RED"))  ESCAPE (AVE_REF_COLOR_RED,  OPIHI_FLT);
    691711
     712  if (!strcasecmp (fieldName, "GAL_MAG"    ))      ESCAPE (AVE_GAL_MAG       ,   OPIHI_FLT);
     713  if (!strcasecmp (fieldName, "GAL_MAG_ERR"))      ESCAPE (AVE_GAL_MAG_ERR   ,   OPIHI_FLT);
     714  if (!strcasecmp (fieldName, "GAL_MAJ"    ))      ESCAPE (AVE_GAL_MAJ       ,   OPIHI_FLT);
     715  if (!strcasecmp (fieldName, "GAL_MAJ_ERR"))      ESCAPE (AVE_GAL_MAJ_ERR   ,   OPIHI_FLT);
     716  if (!strcasecmp (fieldName, "GAL_MIN"    ))      ESCAPE (AVE_GAL_MIN       ,   OPIHI_FLT);
     717  if (!strcasecmp (fieldName, "GAL_MIN_ERR"))      ESCAPE (AVE_GAL_MIN_ERR   ,   OPIHI_FLT);
     718  if (!strcasecmp (fieldName, "GAL_THETA"  ))      ESCAPE (AVE_GAL_THETA     ,   OPIHI_FLT);
     719  if (!strcasecmp (fieldName, "GAL_THETA_ERR"))    ESCAPE (AVE_GAL_THETA_ERR ,   OPIHI_FLT);
     720  if (!strcasecmp (fieldName, "GAL_INDEX"  ))      ESCAPE (AVE_GAL_INDEX     ,   OPIHI_FLT);
     721  if (!strcasecmp (fieldName, "GAL_CHISQ"  ))      ESCAPE (AVE_GAL_CHISQ     ,   OPIHI_FLT);
     722  if (!strcasecmp (fieldName, "GAL_NPIX"   ))      ESCAPE (AVE_GAL_NPIX      ,   OPIHI_FLT);
     723  if (!strcasecmp (fieldName, "GAL_TYPE"   ))      ESCAPE (AVE_GAL_TYPE      ,   OPIHI_FLT);
     724
    692725  if (!strcasecmp (fieldName, "E_BV"))             ESCAPE (AVE_E_BV          ,   OPIHI_FLT);
    693726  if (!strcasecmp (fieldName, "E_BV_ERR"))         ESCAPE (AVE_E_BV_ERR      ,   OPIHI_FLT);
  • trunk/Ohana/src/opihi/dvo/avextract.c

    r38471 r38600  
    167167  int needLensobj = dbFieldNeedLensobj (fields, Nfields);
    168168  int needStarpar = dbFieldNeedStarpar (fields, Nfields, TRUE);
     169  int needGalphot = dbFieldNeedGalphot (fields, Nfields, TRUE);
    169170
    170171  // grab data from all selected sky regions
Note: See TracChangeset for help on using the changeset viewer.