IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 8, 2022, 5:04:42 PM (4 years ago)
Author:
eugene
Message:

merge changes from trunk (UKIRT addstar, relphot mods, dvomerge mods, ippCheck work, mlayer

Location:
branches/eam_branches/ipp-20220316
Files:
36 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20220316

  • branches/eam_branches/ipp-20220316/Ohana

  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/include/WISE.h

    r38986 r42166  
    2121short WISE_W1, WISE_W2, WISE_W3, WISE_W4;
    2222
    23 enum {MODE_NONE, MODE_ALLWISE, MODE_ALLSKY, MODE_PRELIM};
     23enum {MODE_NONE, MODE_CATWISE, MODE_ALLWISE, MODE_ALLSKY, MODE_PRELIM};
    2424int MODE;
    2525
    26 AddstarClientOptions args_loadwise (int argc, char **argv, AddstarClientOptions options);
     26AddstarClientOptions args_loadwise (int *argc, char **argv, AddstarClientOptions options);
    2727
    2828int loadwise_rawdata (SkyList *skytable, char *filename, AddstarClientOptions options);
     
    3838int loadwise_star_allsky  (Measure *measure, char *line, int Nmax);
    3939int loadwise_star_allwise (Measure *measure, char *line, int Nmax);
    40 
     40int loadwise_star_catwise (Measure *measure, char *line, int Nmax, double Rs, double Ds);
    4141
    4242char *nextWISEfield (char *line);
     
    4949int setWISE_dup_flag (Measure *measure, char qual);
    5050int setWISE_use_flag (Measure *measure, char qual);
     51int setWISE_sat_flag (Measure *measure, char *ptr);
     52
     53int setCatWISE_sat_flag (Measure *measure, char *ptr, int start, int end);
     54int setCatWISE_blend_flag (Measure *measure, char *line);
    5155
    5256char *skipNbounds (char *line, char bound, int Nbound, int Nbyte);
     57
     58char *getLineSegment (char *line, int start, int end);
     59double getDoubleRAW (char *line, int start, int end);
     60double getDoubleNAN (char *line, int start, int end);
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/include/ukirt_uhs.h

    r42077 r42166  
    33
    44# define NSTARS_MAX 10000000
     5//# define NSTARS_MAX 5000
    56// # define NSTARS_MAX 10
    67
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/args_loadwise.c

    r38062 r42166  
    33static void help (void);
    44
    5 AddstarClientOptions args_loadwise (int argc, char **argv, AddstarClientOptions options) {
     5AddstarClientOptions args_loadwise (int *argc, char **argv, AddstarClientOptions options) {
    66 
    77  int N;
    88
    99  /* check for help request */
    10   if (get_argument (argc, argv, "-help") ||
    11       get_argument (argc, argv, "-h")) {
     10  if (get_argument (*argc, argv, "-help") ||
     11      get_argument (*argc, argv, "-h")) {
    1212    help ();
    1313  }
     
    2929  /* only add to existing regions */
    3030  options.existing_regions = FALSE;
    31   if ((N = get_argument (argc, argv, "-existing-regions"))) {
     31  if ((N = get_argument (*argc, argv, "-existing-regions"))) {
    3232    options.existing_regions = TRUE;
    33     remove_argument (N, &argc, argv);
     33    remove_argument (N, argc, argv);
    3434  }
    3535  /* only add to existing objects */
    3636  options.only_match = FALSE;
    37   if ((N = get_argument (argc, argv, "-only-match"))) {
     37  if ((N = get_argument (*argc, argv, "-only-match"))) {
    3838    options.only_match = TRUE;
    39     remove_argument (N, &argc, argv);
     39    remove_argument (N, argc, argv);
    4040  }
    4141  /* replace measurement, don't duplicate (ref/cat only) */
    4242  options.replace = FALSE;
    43   if ((N = get_argument (argc, argv, "-replace"))) {
     43  if ((N = get_argument (*argc, argv, "-replace"))) {
    4444    options.replace = TRUE;
    45     remove_argument (N, &argc, argv);
     45    remove_argument (N, argc, argv);
    4646  }
    4747
    4848  /* extra error messages */
    4949  VERBOSE = FALSE;
    50   if ((N = get_argument (argc, argv, "-v"))) {
     50  if ((N = get_argument (*argc, argv, "-v"))) {
    5151    VERBOSE = TRUE;
    52     remove_argument (N, &argc, argv);
     52    remove_argument (N, argc, argv);
    5353  }
    5454
    5555  /* load the prelim data dump */
    56   MODE = MODE_ALLWISE;
    57   if ((N = get_argument (argc, argv, "-mode"))) {
    58     MODE = MODE_NONE;
    59     remove_argument (N, &argc, argv);
     56  MODE = MODE_NONE;
     57  if ((N = get_argument (*argc, argv, "-mode"))) {
     58    remove_argument (N, argc, argv);
     59    if (!strcasecmp(argv[N], "catwise")) MODE = MODE_CATWISE;
    6060    if (!strcasecmp(argv[N], "allwise")) MODE = MODE_ALLWISE;
    6161    if (!strcasecmp(argv[N], "allsky"))  MODE = MODE_ALLSKY;
     
    6565      exit (2);
    6666    }
    67     remove_argument (N, &argc, argv);
     67    remove_argument (N, argc, argv);
    6868  }
    6969
     
    8585  DUMP = NULL;
    8686
    87   if (argc < 2) {
     87  if (*argc < 2) {
    8888    fprintf (stderr, "USAGE: loadwise [options] (wisefile) [..more files]\n");
    8989    exit (2);
     
    9494static void help () {
    9595
    96   fprintf (stderr, "USAGE: loadwise [options] (wisefile) [..more files]\n");
     96  fprintf (stderr, "USAGE: loadwise [-mode MODE] [options] (wisefile) [..more files]\n");
    9797  fprintf (stderr, "  add data from WISE catalog to DVO\n\n");
     98
     99  fprintf (stderr, "  MODE may be : catwise, allwise, allsky, prelim\n");
    98100
    99101  fprintf (stderr, "  optional flags:\n");
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c

    r42077 r42166  
    467467        NELEM += 1000;
    468468
    469         REALLOCATE (sourceID,     uint64_t, NELEM);
     469        REALLOCATE (sourceID,     uint64_t, NELEM); 
    470470        REALLOCATE (frameSetID,   uint64_t, NELEM);
    471471        REALLOCATE (ra,           double,   NELEM);
    472472        REALLOCATE (dec,          double,   NELEM);
     473        REALLOCATE (epoch,        double,   NELEM);
    473474        REALLOCATE (priOrSec,     uint64_t, NELEM);
    474475        REALLOCATE (mergedClass,  int,      NELEM);
    475476        REALLOCATE (pStar,        double,   NELEM);
    476477        REALLOCATE (pGalaxy,      double,   NELEM);
     478
    477479        REALLOCATE (zHallMag,     double,   NELEM);
    478480        REALLOCATE (zHallMagErr,  double,   NELEM);
     
    485487        REALLOCATE (zppErrBits,   int,      NELEM);
    486488        REALLOCATE (zSeqNum,      int,      NELEM);
     489
    487490        REALLOCATE (yHallMag,     double,   NELEM);
    488491        REALLOCATE (yHallMagErr,  double,   NELEM);
     
    495498        REALLOCATE (yppErrBits,   int,      NELEM);
    496499        REALLOCATE (ySeqNum,      int,      NELEM);
     500
    497501        REALLOCATE (jHallMag,     double,   NELEM);
    498502        REALLOCATE (jHallMagErr,  double,   NELEM);
     
    505509        REALLOCATE (jppErrBits,   int,      NELEM);
    506510        REALLOCATE (jSeqNum,      int,      NELEM);
     511
    507512        REALLOCATE (hHallMag,     double,   NELEM);
    508513        REALLOCATE (hHallMagErr,  double,   NELEM);
     
    515520        REALLOCATE (hppErrBits,   int,      NELEM);
    516521        REALLOCATE (hSeqNum,      int,      NELEM);
     522
    517523        REALLOCATE (k1HallMag,     double,   NELEM);
    518524        REALLOCATE (k1HallMagErr,  double,   NELEM);
     
    525531        REALLOCATE (k1ppErrBits,   int,      NELEM);
    526532        REALLOCATE (k1SeqNum,      int,      NELEM);
     533
    527534        REALLOCATE (k2HallMag,     double,   NELEM);
    528535        REALLOCATE (k2HallMagErr,  double,   NELEM);
     
    541548    }
    542549  }
     550  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
    543551
    544552  // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
     
    715723    Nstars ++;
    716724
    717     if (NSTARS >= Nstars) {
     725    if (Nstars >= NSTARS) {
    718726      NSTARS += 10000;
    719727      REALLOCATE (stars, UKIRT_Stars, NSTARS);
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c

    r42077 r42166  
    388388        NELEM += 1000;
    389389
    390         REALLOCATE (sourceID,     uint64_t, NELEM);
     390        REALLOCATE (sourceID,     uint64_t, NELEM);   
    391391        REALLOCATE (frameSetID,   uint64_t, NELEM);
    392392        REALLOCATE (ra,           double,   NELEM);
    393393        REALLOCATE (dec,          double,   NELEM);
     394        REALLOCATE (epoch,        double,   NELEM);
    394395        REALLOCATE (priOrSec,     uint64_t, NELEM);
    395396        REALLOCATE (mergedClass,  int,      NELEM);
    396397        REALLOCATE (pStar,        double,   NELEM);
    397398        REALLOCATE (pGalaxy,      double,   NELEM);
     399
    398400        REALLOCATE (jAperMag1,     double,   NELEM);
    399401        REALLOCATE (jAperMag1Err,  double,   NELEM);
     
    406408        REALLOCATE (jppErrBits,   int,      NELEM);
    407409        REALLOCATE (jSeqNum,      int,      NELEM);
     410
    408411        REALLOCATE (hAperMag1,     double,   NELEM);
    409412        REALLOCATE (hAperMag1Err,  double,   NELEM);
     
    416419        REALLOCATE (hppErrBits,   int,      NELEM);
    417420        REALLOCATE (hSeqNum,      int,      NELEM);
     421
    418422        REALLOCATE (k1AperMag1,     double,   NELEM);
    419423        REALLOCATE (k1AperMag1Err,  double,   NELEM);
     
    426430        REALLOCATE (k1ppErrBits,   int,      NELEM);
    427431        REALLOCATE (k1SeqNum,      int,      NELEM);
     432
    428433        REALLOCATE (k2AperMag1,     double,   NELEM);
    429434        REALLOCATE (k2AperMag1Err,  double,   NELEM);
     
    436441        REALLOCATE (k2ppErrBits,   int,      NELEM);
    437442        REALLOCATE (k2SeqNum,      int,      NELEM);
     443
    438444        REALLOCATE (h2AperMag1,     double,   NELEM);
    439445        REALLOCATE (h2AperMag1Err,  double,   NELEM);
     
    452458    }
    453459  }
     460  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
    454461
    455462  // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
     
    606613    Nstars ++;
    607614
    608     if (NSTARS >= Nstars) {
     615    if (Nstars >= NSTARS) {
    609616      NSTARS += 10000;
    610617      REALLOCATE (stars, UKIRT_Stars, NSTARS);
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c

    r42077 r42166  
    234234    }
    235235  }
     236  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
    236237
    237238  // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
     
    307308    Nstars ++;
    308309
    309     if (NSTARS >= Nstars) {
     310    if (Nstars >= NSTARS) {
    310311      NSTARS += 10000;
    311312      REALLOCATE (stars, UKIRT_Stars, NSTARS);
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c

    r42077 r42166  
    415415        NELEM += 1000;
    416416
    417         REALLOCATE (sourceID,     uint64_t, NELEM);
     417        REALLOCATE (sourceID,     uint64_t, NELEM);   
    418418        REALLOCATE (frameSetID,   uint64_t, NELEM);
    419419        REALLOCATE (ra,           double,   NELEM);
    420420        REALLOCATE (dec,          double,   NELEM);
     421        REALLOCATE (epoch,        double,   NELEM);
    421422        REALLOCATE (priOrSec,     uint64_t, NELEM);
    422423        REALLOCATE (mergedClass,  int,      NELEM);
    423424        REALLOCATE (pStar,        double,   NELEM);
    424425        REALLOCATE (pGalaxy,      double,   NELEM);
     426
    425427        REALLOCATE (yHallMag,     double,   NELEM);
    426428        REALLOCATE (yHallMagErr,  double,   NELEM);
     
    433435        REALLOCATE (yppErrBits,   int,      NELEM);
    434436        REALLOCATE (ySeqNum,      int,      NELEM);
     437
    435438        REALLOCATE (j1HallMag,     double,   NELEM);
    436439        REALLOCATE (j1HallMagErr,  double,   NELEM);
     
    443446        REALLOCATE (j1ppErrBits,   int,      NELEM);
    444447        REALLOCATE (j1SeqNum,      int,      NELEM);
     448
    445449        REALLOCATE (j2HallMag,     double,   NELEM);
    446450        REALLOCATE (j2HallMagErr,  double,   NELEM);
     
    453457        REALLOCATE (j2ppErrBits,   int,      NELEM);
    454458        REALLOCATE (j2SeqNum,      int,      NELEM);
     459
    455460        REALLOCATE (hHallMag,     double,   NELEM);
    456461        REALLOCATE (hHallMagErr,  double,   NELEM);
     
    463468        REALLOCATE (hppErrBits,   int,      NELEM);
    464469        REALLOCATE (hSeqNum,      int,      NELEM);
     470
    465471        REALLOCATE (kHallMag,     double,   NELEM);
    466472        REALLOCATE (kHallMagErr,  double,   NELEM);
     
    479485    }
    480486  }
     487  fprintf (stderr, " DONE: Nelem: %d, *nstars: %d\n", Nelem, *nstars);
    481488
    482489  // Nelem is now the number of items (objects,stars) read from the Gaia CSV file
     
    633640    Nstars ++;
    634641
    635     if (NSTARS >= Nstars) {
     642    if (Nstars >= NSTARS) {
    636643      NSTARS += 10000;
    637644      REALLOCATE (stars, UKIRT_Stars, NSTARS);
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadwise.c

    r38986 r42166  
    2222  SetSignals ();
    2323  options = ConfigInit (&argc, argv);
    24   options = args_loadwise (argc, argv, options);
     24  options = args_loadwise (&argc, argv, options);
    2525
    2626  // load the full sky description table:
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadwise_ops.c

    r33653 r42166  
    1717  char *ptr = line;
    1818
    19   ptr = skipNbounds (ptr, '|', 1, Nmax);
    20   *R = strtod (ptr, NULL);
    21   ptr = skipNbounds (ptr, '|', 1, Nmax);
    22   *D = strtod (ptr, NULL);
     19  if (MODE == MODE_CATWISE) {
     20      // copy the string ranges and then use strtod (not necessary?)
     21      *R = strtod (&ptr[47], NULL); // safe to use the strtod on the line because it is white-space separated
     22      *D = strtod (&ptr[59], NULL);
     23  } else {
     24      ptr = skipNbounds (ptr, '|', 1, Nmax);
     25      *R = strtod (ptr, NULL);
     26      ptr = skipNbounds (ptr, '|', 1, Nmax);
     27      *D = strtod (ptr, NULL);
     28  }
    2329  if (*D > 90) Shutdown ("weird DEC value: something is wrong");
    2430
     
    9197}
    9298 
     99/* return a pointer to the first char after Nbound of value bound */
     100char *getLineSegment (char *line, int start, int end) {
     101
     102  // do NOT damage the buffer by seting the end byte to NULL
     103  if (0) { line[end] = 0; }
     104  char *ptr = &line[start];
     105  return (ptr);
     106}
     107 
     108double getDoubleRAW (char *line, int start, int end) {
     109    char *ptr = getLineSegment(line, start, end);
     110    double value = strtod (ptr, NULL);
     111    return value;
     112}
     113
     114double getDoubleNAN (char *line, int start, int end) {
     115    char *endpoint = NULL;
     116    char *ptr = getLineSegment(line, start, end);
     117    double value = strtod (ptr, &endpoint);
     118    if (endpoint == ptr) { value = NAN; }
     119    return value;
     120}
     121
    93122/* watch for patches which cross 0,360 boundary */
    94123SkyTable *loadWISE_acc (char *path, char *accel) {
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadwise_rawdata.c

    r38986 r42166  
    2828  getWISE_setup ();
    2929
     30  int NMeasPerStar = (MODE == MODE_CATWISE) ? 2 : 4;
     31
    3032  ALLOCATE (buffer, char, NBYTE);
    3133
     
    3436  if (f == NULL) Shutdown ("can't read WISE data file: %s", filename);
    3537  // test if this is a raw datafile or gzipped...
     38
     39  int skipHeader = TRUE;
    3640
    3741  Nextra = 0;  // number excess bytes from lsat partial row
     
    5963    Dmax = -90.0;
    6064
     65    // XXX buffer is being reread instead of continuing.
     66
    6167    // scan through entire buffer for star coords
    6268    while (1) {
     69
     70      if (skipHeader && (MODE == MODE_CATWISE)) {
     71        if (*p == '\\') goto skip_header;
     72        if (*p == '|') goto skip_header;
     73      }
     74      if (skipHeader && (MODE == MODE_CATWISE)) {
     75        // once we get past the header, do not skip any more
     76        skipHeader = FALSE;
     77      }
     78
    6379      getWISE_coords (p, &tstars[Ntstars].R, &tstars[Ntstars].D, Nbyte - offset);
    6480      tstars[Ntstars].offset = offset; // offset within scan
     
    7490      Ntstars ++;
    7591      CHECK_REALLOCATE (tstars, WISE_Stars, NTSTARS, Ntstars, 10000);
     92
     93    skip_header:
    7694
    7795      /* start of the next line */
     
    143161        if (tstars[j].D > UserPatch.Dmax) continue;
    144162         
     163        // offset is bytes to start of line from start of buffer
    145164        offset = tstars[j].offset;
    146165
    147166        dvo_average_init (&newcat->average[Nave]);
    148         for (k = 0; k < 4; k++) {
     167        for (k = 0; k < NMeasPerStar; k++) {
    149168          dvo_measure_init (&newcat->measure[Nmeas+k]);
    150169        }
     
    163182            loadwise_star_allwise (&newcat->measure[Nmeas], &buffer[offset], Nbyte - offset);
    164183            break;
     184          case MODE_CATWISE:
     185            loadwise_star_catwise (&newcat->measure[Nmeas], &buffer[offset], Nbyte - offset, tstars[j].R, tstars[j].D);
     186            break;
    165187          default:
    166188            break;
     
    169191        tstars[j].flag = TRUE;
    170192
    171         newcat->average[Nave].Nmeasure = 4;
     193        newcat->average[Nave].Nmeasure = NMeasPerStar;
    172194        newcat->average[Nave].measureOffset = Nmeas;
    173195
    174196        Nave ++;
    175         Nmeas += 4;
     197        Nmeas += NMeasPerStar;
    176198
    177199        CHECK_REALLOCATE (newcat->average, Average, NAVE,  Nave,  1000);
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadwise_star_full.c

    r38986 r42166  
    22# include "WISE.h"
    33
    4 int setWISE_ph_qual (Measure *measure, char qual);
    54int setWISE_var_flag_allsky (Measure *measure, char qual);
    65int setWISE_ext_flag_allsky (Measure *measure, char ptr);
    76int setWISE_var_flag_prelim (Measure *measure, char qual);
    87int setWISE_ext_flag_prelim (Measure *measure, char ptr);
    9 int setWISE_cc_flag (Measure *measure, char qual);
    10 int setWISE_sat_flag (Measure *measure, char *ptr);
    118int setWISE_blend_flag (Measure *measure, char *ptr);
     9
     10// fill in the data for a CatWISE double star.  takes a pointer to the start of the line the
     11// RA and DEC have already been set
     12int loadwise_star_catwise (Measure *measure, char *line, int Nmax, double Rs, double Ds) {
     13
     14  if (line == NULL) Shutdown ("format error in WISE");
     15
     16  /*** CATWISE has fixed width data, not pipe-separated, etc ***/
     17
     18  // https://irsa.ipac.caltech.edu/data/WISE/CatWISE/gator_docs/catwise_colDescriptions.html
     19
     20  // We are supplied a pointer (line) to the start of a full line of data.  The CatWISE
     21  // format uses fixed-width fields with white-space separators.  The ra & dec values have
     22  // already been extracted.
     23
     24  measure[0].R    = Rs;
     25  measure[0].D    = Ds;
     26  measure[1].R    = Rs;
     27  measure[1].D    = Ds;
     28
     29  // I can assign dRA and dDEC to dX and dY if I can consistently set posangle and pltscale
     30  measure[0].dXccd = ToShortPixels(getDoubleRAW (line, 71, 79) + 0.005); // sig_ra -- add 5/1000 to avoid truncation
     31  measure[0].dYccd = ToShortPixels(getDoubleRAW (line, 80, 88) + 0.005); // sig_dec
     32  measure[0].posangle = 0.0;
     33  measure[0].pltscale = 1.0;
     34
     35  // we only know a single set of values for both bands
     36  measure[1].dXccd    = measure[0].dXccd;
     37  measure[1].dYccd    = measure[0].dYccd;
     38  measure[1].posangle = measure[0].posangle;
     39  measure[1].pltscale = measure[0].pltscale;
     40
     41  measure[0].Xccd = getDoubleRAW (line,  98, 106); // wx
     42  measure[0].Yccd = getDoubleRAW (line, 107, 115); // wy
     43  measure[1].Xccd = measure[0].Xccd;
     44  measure[1].Yccd = measure[0].Yccd;
     45
     46  // W1
     47  measure[0].M         = getDoubleNAN (line, 248, 254); // w1mpro
     48  measure[0].dM        = getDoubleNAN (line, 255, 264); // w1sigmpro
     49  measure[0].psfChisq  = getDoubleRAW (line, 265, 275); // w1rchi2
     50  measure[0].psfQF     = measure[0].psfChisq;
     51  measure[0].photFlags = 0;
     52
     53  // W2
     54  measure[1].M         = getDoubleNAN (line, 276, 282); // w2mpro
     55  measure[1].dM        = getDoubleNAN (line, 283, 292); // w2sigmpro
     56  measure[1].psfChisq  = getDoubleRAW (line, 293, 303); // w2rchi2
     57  measure[1].psfQF     = measure[1].psfChisq;
     58  measure[1].photFlags = 0;
     59
     60  setCatWISE_blend_flag (measure, line); // w1sat
     61
     62  setCatWISE_sat_flag (&measure[0], line, 323, 330); // w1sat
     63  setCatWISE_sat_flag (&measure[1], line, 331, 338); // w2sat
     64
     65  // cc_flags? 1642 - 1657
     66  // setWISE_cc_flag (&measure[0], ptr[i]); // cc_flags
     67
     68  // set ext flags for all 4 measures
     69  // setCatWISE_ext_flag_allsky (measure, ptr[0]); // ext_flg
     70
     71  // setWISE_var_flag_allsky (&measure[0], ptr[i]); // var_flg
     72
     73  // setWISE_ph_qual (&measure[i], ptr[i]); // ph_qual
     74
     75  double mjdmean = getDoubleRAW (line, 1126, 1138); // MeanObsMJD
     76 
     77  // the release is based on data taken in the period 14 January 2010 to 29 April 2010
     78  if (mjdmean == 0.0) {
     79    measure[0].t = 0;
     80  } else {
     81    measure[0].t = ohana_mjd_to_sec (mjdmean);
     82  }
     83  measure[1].t = measure[0].t;
     84
     85  measure[0].photcode  = WISE_W1;
     86  measure[0].detID   = 0;
     87  measure[0].imageID = 0;
     88
     89  measure[1].photcode  = WISE_W2;
     90  measure[1].detID   = 0;
     91  measure[1].imageID = 0;
     92
     93  return TRUE;
     94}
    1295
    1396// fill in the data for a WISE quad star.  takes a pointer to the start of the line the
     
    458541}
    459542
     543int setCatWISE_blend_flag (Measure *measure, char *line) {
     544
     545  // na
     546  int nb = atoi(getLineSegment(line, 315, 318)); // nb
     547  int na = atoi(getLineSegment(line, 319, 322)); // na
     548
     549  if (nb != 1) {
     550    if (na == 0) {
     551      measure[0].photFlags |= FLAG_BLEND_ACTIVE;
     552      measure[1].photFlags |= FLAG_BLEND_ACTIVE;
     553    } else {
     554      measure[0].photFlags |= FLAG_BLEND_PASSIVE;
     555      measure[1].photFlags |= FLAG_BLEND_PASSIVE;
     556    }
     557  }
     558  return TRUE;
     559}
     560
    460561int setWISE_sat_flag (Measure *measure, char *ptr) {
    461562
     
    465566    }
    466567    return TRUE;
     568}
     569
     570int setCatWISE_sat_flag (Measure *measure, char *ptr, int start, int end) {
     571
     572  float sat = getDoubleRAW (ptr, start, end);
     573  if (sat > 0.0) {
     574    measure[0].photFlags |= FLAG_SATURATED_PIX;
     575  }
     576  return TRUE;
    467577}
    468578
  • branches/eam_branches/ipp-20220316/Ohana/src/dvomerge/include/dvomerge.h

    r41341 r42166  
    6565int    RESET_LENSING;
    6666
     67int    SKIP_IMAGES;
    6768int    SKIP_MEASURE;
    6869int    SKIP_MISSING;
  • branches/eam_branches/ipp-20220316/Ohana/src/dvomerge/src/args.c

    r41341 r42166  
    3939    remove_argument (N, argc, argv);
    4040  }
    41 
    42   /* extra error messages */
    43   MATCHED_TABLES = FALSE;
     41  SKIP_IMAGES = FALSE;
     42  if ((N = get_argument (*argc, argv, "-skip-images"))) {
     43    SKIP_IMAGES = TRUE;
     44    remove_argument (N, argc, argv);
     45  }
     46
     47  /* extra error messages */
     48  MATCHED_TABLES = TRUE;
    4449  if ((N = get_argument (*argc, argv, "-matched-tables"))) {
    4550    MATCHED_TABLES = TRUE;
     51    remove_argument (N, argc, argv);
     52  }
     53  if ((N = get_argument (*argc, argv, "-unmatched-tables"))) {
     54    MATCHED_TABLES = FALSE;
    4655    remove_argument (N, argc, argv);
    4756  }
     
    7786    SKIP_GALPHOT = TRUE;
    7887    remove_argument (N, argc, argv);
     88  }
     89
     90  if (SKIP_IMAGES && !(SKIP_MEASURE || SKIP_LENSING)) {
     91    fprintf (stderr, "WARNING: skipping images but merging measure and lensing tables: imageIDs will not be correct\n");
     92    fprintf (stderr, "type Ctrl-C within 5 seconds to cancel\n");
     93    for (int i = 5; i > 0; i--) {
     94      fprintf (stderr, "%d.. ", i);
     95      usleep (1000000);
     96    }
     97    fprintf (stderr, "\n");
    7998  }
    8099
  • branches/eam_branches/ipp-20220316/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c

    r39329 r42166  
    404404  off_t i;
    405405
    406   for (i = 0; i < IDmap->oldIDmax + 1; i++) {
     406  for (i = 0; IDmap->notFoundMeasure && (i < IDmap->oldIDmax + 1); i++) {
    407407    if (!IDmap->notFoundMeasure[i]) continue;
    408408    fprintf (stderr, "SKIP IMAGE MEASURE: "OFF_T_FMT", %d measures\n", i, IDmap->notFoundMeasure[i]);
    409409  }
    410   for (i = 0; i < IDmap->oldIDmax + 1; i++) {
     410  for (i = 0; IDmap->notFoundLensing && (i < IDmap->oldIDmax + 1); i++) {
    411411    if (!IDmap->notFoundLensing[i]) continue;
    412412    fprintf (stderr, "SKIP IMAGE LENSING: "OFF_T_FMT", %d lensings\n", i, IDmap->notFoundLensing[i]);
  • branches/eam_branches/ipp-20220316/Ohana/src/dvomerge/src/dvomergeUpdate.c

    r39301 r42166  
    8181  }
    8282
    83   if (CONTINUE) {
    84     // need to determine the mapping from the input to the output images
    85     dvomergeImagesGetMap (&IDmap, input, output);
    86   } else {
    87     dvomergeImagesUpdate (&IDmap, input, output);
    88     if (IMAGES_ONLY) exit (0);
     83  // do not merge the images unless requested
     84  if (!SKIP_IMAGES) {
     85    if (CONTINUE) {
     86      // need to determine the mapping from the input to the output images
     87      dvomergeImagesGetMap (&IDmap, input, output);
     88    } else {
     89      dvomergeImagesUpdate (&IDmap, input, output);
     90      if (IMAGES_ONLY) exit (0);
     91    }
    8992  }
    90 
     93   
    9194  // load the sky table for the existing database
    9295  insky = SkyTableLoadOptimal (input, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE);
  • branches/eam_branches/ipp-20220316/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c

    r41341 r42166  
    163163    }
    164164
     165    // for SKIP_IMAGES, this is a NO-OP
    165166    dvo_update_image_IDs (IDmap, &incatalog);
    166167
  • branches/eam_branches/ipp-20220316/Ohana/src/dvomerge/src/dvomergeUpdate_threaded.c

    r38986 r42166  
    6969      LoadCatalog (&outcatalog, outlist[0].regions[j], outlist[0].filename[j], "w", threadData->NsecfiltOutput);
    7070
     71      // for SKIP_IMAGES, this is a NO-OP
    7172      dvo_update_image_IDs (threadData->IDmap, &incatalog);
    7273      merge_catalogs_old (&threadData->outsky->regions[j], &outcatalog, &incatalog, RADIUS, threadData->secfiltMap);
     
    183184  }
    184185
    185   if (CONTINUE) {
    186     // need to determine the mapping from the input to the output images
    187     dvomergeImagesGetMap (&IDmap, input, output);
    188   } else {
    189     dvomergeImagesUpdate (&IDmap, input, output);
    190     if (IMAGES_ONLY) exit (0);
     186  if (!SKIP_IMAGES) {
     187    if (CONTINUE) {
     188      // need to determine the mapping from the input to the output images
     189      dvomergeImagesGetMap (&IDmap, input, output);
     190    } else {
     191      dvomergeImagesUpdate (&IDmap, input, output);
     192      if (IMAGES_ONLY) exit (0);
     193    }
    191194  }
    192195
  • branches/eam_branches/ipp-20220316/Ohana/src/libohana/src/errors.c

    r41468 r42166  
    2626
    2727int push_error (char *line) {
     28
     29  if (!errorlines) {
     30    NLINE = 10;
     31    ALLOCATE (errorlines, char *, NLINE);
     32    for (int i = 0; i < NLINE; i++) {
     33      errorlines[i] = NULL;
     34    }
     35  }
    2836
    2937  errorlines[Nline] = strcreate (line);
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi

  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/Makefile

    r42082 r42166  
    106106$(SRC)/mget3d.$(ARCH).o         \
    107107$(SRC)/mslice.$(ARCH).o         \
     108$(SRC)/mlayer.$(ARCH).o         \
    108109$(SRC)/minterpolate.$(ARCH).o   \
    109110$(SRC)/medimage.$(ARCH).o       \
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/create.c

    r41341 r42166  
    33int create (int argc, char **argv) {
    44 
    5   int i, N, INT;
     5  int i, N;
    66  opihi_flt start, end, delta;
    77  Vector *vec;
     
    3434  }
    3535
    36   INT = FALSE;
     36  int INT = FALSE;
    3737  if ((N = get_argument (argc, argv, "-int"))) {
    3838    INT = TRUE;
     
    4040  }
    4141
    42   if ((argc != 5) && (argc != 4)) {
    43     gprint (GP_ERR, "USAGE: create vector start end [delta] [-int]\n");
    44     gprint (GP_ERR, " -int : resulting vector is integer type (delta must be integer)\n");
    45     gprint (GP_ERR, " -str : resulting vector is string type (only give number of elements)\n");
    46     return (FALSE);
     42  int EMPTY = FALSE;
     43  if ((N = get_argument (argc, argv, "-empty"))) {
     44    EMPTY = TRUE;
     45    remove_argument (N, &argc, argv);
    4746  }
    4847
     48  if (!EMPTY && (argc != 5) && (argc != 4)) goto usage;
     49  if (EMPTY && (argc != 2)) goto usage;
     50
    4951  if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) return (FALSE);
     52  if (EMPTY) {
     53    ResetVector (vec, (INT ? OPIHI_INT : OPIHI_FLT), 0);
     54    return TRUE;
     55  }
    5056
    5157  delta = 1;
     
    9197
    9298  return (TRUE);
     99
     100 usage:
     101  gprint (GP_ERR, "USAGE: create vector start end [delta] [-int]\n");
     102  gprint (GP_ERR, " -int : resulting vector is integer type (delta must be integer)\n");
     103  gprint (GP_ERR, " -str : resulting vector is string type (only give number of elements)\n");
     104  gprint (GP_ERR, "OR: create vector -empty (creates vector of length zero)\n");
     105  return (FALSE);
    93106}
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/init.c

    r42082 r42166  
    9797int mget3d           PROTO((int, char **));
    9898int mslice           PROTO((int, char **));
     99int mlayer           PROTO((int, char **));
    99100int minterp          PROTO((int, char **));
    100101int medimage_command PROTO((int, char **));
     
    296297  {1, "mget3d",       mget3d,           "extract a vector from a 3D image"},
    297298  {1, "mslice",       mslice,           "extract an image plane from a 3D image"},
     299  {1, "mlayer",       mlayer,           "insert an image plane into a 3D image"},
    298300  {1, "imget",        mget,             "extract a vector from an image"},
    299301  {1, "minterp",      minterp,          "interpolate image pixels"},
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/mslice.c

    r40334 r42166  
    3131  if (argc != 4) {
    3232    gprint (GP_ERR, "USAGE: mslice <input> <output> plane [-x,-y,-z]\n");
     33    gprint (GP_ERR, "  extract 2D image from 3D cube (opposite of mlayer)\n");
    3334    gprint (GP_ERR, "  -z is default\n");
    3435    return (FALSE);
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/write_vectors.c

    r41341 r42166  
    102102  if (argc < 3) {
    103103    gprint (GP_ERR, "USAGE: write [options] file vector vector ...\n");
    104     gprint (GP_ERR, "OPTIONS: [-header] [-append] [-f \"format\"] [-fits NAME] [-csv] [-h,--help]\n");
     104    gprint (GP_ERR, "OPTIONS: [-header [buf]] [-append] [-f \"format\"] [-fits NAME] [-csv] [-h,--help]\n");
    105105    return (FALSE);
    106106  }
     
    289289 usage:
    290290    gprint (GP_ERR, "USAGE: write [options] file vector vector ...\n");
    291     gprint (GP_ERR, "OPTIONS: [-header] [-append] [-f \"format\"] [-fits NAME] [-csv] [-h,--help]\n\n");
     291    gprint (GP_ERR, "OPTIONS: [-header [buf]] [-append] [-f \"format\"] [-fits NAME] [-csv] [-h,--help]\n\n");
    292292
    293293    gprint (GP_ERR, "OPTIONS: \n");
    294     gprint (GP_ERR, "  -header : add a descriptive header line to ascii or csv output\n");
     294    gprint (GP_ERR, "  -header : add a descriptive header line to ascii or csv output (see below for FITS)\n");
    295295    gprint (GP_ERR, "  -append : write to the end of the existing file\n");
    296296    gprint (GP_ERR, "  -fits NAME : write a fits table (extention name is NAME, column names match vector names)\n");
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/VectorIO.c

    r41422 r42166  
    267267}
    268268 
    269 static char *rawkeywords[] = {"SIMPLE", "BITPIX", "NAXIS", "PCOUNT", "GCOUNT", "EXTEND", "EXTNAME", "BSCALE", "BZERO", "TFIELDS", "TFORM", "TZERO", "TSCAL", "        ", NULL};
     269static char *rawkeywords[] = {"SIMPLE", "BITPIX", "NAXIS", "PCOUNT", "GCOUNT", "EXTEND", "EXTNAME", "BSCALE", "BZERO", "TFIELDS", "TFORM", "TTYPE", "TZERO", "TSCAL", "        ", NULL};
    270270
    271271// write a set of vectors to a FITS file (vectors names become fits column names)
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot

  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/include/relphot.h

    r42112 r42166  
    721721int relphot_images (SkyList *skylist);
    722722
    723 void relphot_usage (void);
     723void relphot_usage (int argc, char **argv);
    724724void relphot_help (int argc, char **argv);
    725725
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/src/ResetOps.c

    r41946 r42166  
    123123
    124124  for (off_t i = 0; i < catalog->Naverage; i++) {
    125     catalog->average[i].psfQF     = NAN;        // force recalculation in setMrelCatalog
    126     catalog->average[i].psfQFperf = NAN;        // force recalculation in setMrelCatalog
    127     catalog->average[i].stargal   = NAN;        // force recalculation in setMrelCatalog
    128     catalog->average[i].photFlagsUpper = 0;     // reset (will be re-calculated)
    129     catalog->average[i].photFlagsLower = 0;     // reset (will be re-calculated)
    130     catalog->average[i].NwarpOK        = 0;     // reset (will be re-calculated)
     125    if (STAGES & STAGE_CHIP) {
     126      catalog->average[i].psfQF     = NAN;      // force recalculation in setMrelCatalog
     127      catalog->average[i].psfQFperf = NAN;      // force recalculation in setMrelCatalog
     128      catalog->average[i].stargal   = NAN;      // force recalculation in setMrelCatalog
     129      catalog->average[i].photFlagsUpper = 0;   // reset (will be re-calculated)
     130      catalog->average[i].photFlagsLower = 0;   // reset (will be re-calculated)
     131    }
     132   
     133    if (STAGES & STAGE_WARP) {
     134      catalog->average[i].NwarpOK        = 0;   // reset (will be re-calculated)
     135    }
    131136
    132137    // RESET_FLATCORR independent of RESET?
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/src/args.c

    r42112 r42166  
    203203    remove_argument (N, &argc, argv);
    204204    TEST_IMAGE1 = strtol(argv[N], &endptr, 0);
    205     if (*endptr) relphot_usage ();
     205    if (*endptr) relphot_usage (argc, argv);
    206206    remove_argument (N, &argc, argv);
    207207  }
     
    211211    remove_argument (N, &argc, argv);
    212212    TEST_IMAGE2 = strtol(argv[N], &endptr, 0);
    213     if (*endptr) relphot_usage ();
     213    if (*endptr) relphot_usage (argc, argv);
    214214    remove_argument (N, &argc, argv);
    215215  }
     
    584584    remove_argument (N, &argc, argv);
    585585    mode = PARALLEL_IMAGES;
    586     if (N >= argc) relphot_usage();
     586    if (N >= argc) relphot_usage(argc, argv);
    587587    IMAGE_TABLE = strcreate (argv[N]);
    588588    remove_argument (N, &argc, argv);
    589     if (!REGION_FILE) relphot_usage();
     589    if (!REGION_FILE) relphot_usage(argc, argv);
    590590  }
    591591
     
    594594    remove_argument (N, &argc, argv);
    595595    mode = PARALLEL_REGIONS;
    596     if (!REGION_FILE) relphot_usage();
     596    if (!REGION_FILE) relphot_usage(argc, argv);
    597597    if ((N = get_argument (argc, argv, "-parallel-regions-manual"))) {
    598598      remove_argument (N, &argc, argv);
     
    609609      // note: initialize sets PhotcodeList to the full set of average photcodes
    610610      // if the mode is UPDATE_AVERAGES
    611       if (argc != 1) relphot_usage();
    612       break;
     611      // if (argc != 1) relphot_usage(argc, argv);
     612      // break;
    613613     
     614      if (argc == 1) break; // if no photcodes are given, use them all?
     615
    614616    case UPDATE_IMAGES:
    615617    case PARALLEL_IMAGES:
     
    623625    default:
    624626      fprintf (stderr, "no valid mode selected\n");
    625       relphot_usage();
     627      relphot_usage(argc, argv);
    626628      break;
    627629  }
    628   if (argc != 1) relphot_usage ();
     630  if (argc != 1) relphot_usage (argc, argv);
    629631
    630632  // if we supplied a file, we need to load it now
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/src/help.c

    r38062 r42166  
    11# include "relphot.h"
    22
    3 void relphot_usage (void) {
     3void relphot_usage (int argc, char **argv) {
    44  fprintf (stderr, "ERROR: USAGE: relphot (photcodes) -images\n");
    55  fprintf (stderr, "       or:    relphot -averages\n");
     
    1111  fprintf (stderr, "       or:    -catalog (name)\n");
    1212  fprintf (stderr, "  use -h for more usage information\n");
     13
     14  fprintf (stderr, "unparsed arguments: ");
     15  for (int i = 0; i < argc; i++) {
     16    fprintf (stderr, "%s ", argv[i]);
     17  }
     18  fprintf (stderr, "\n");
     19
    1320  exit (2);
    1421}
     
    1926  if (get_argument (argc, argv, "-help")) goto show_help;
    2027  if (get_argument (argc, argv, "-h"))    goto show_help;
    21   if (argc == 1) relphot_usage();
     28  if (argc == 1) relphot_usage(0, NULL);
    2229  return;
    2330
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/src/initialize.c

    r41647 r42166  
    99  if (!mode) exit (2);
    1010
    11   // UPDATE_AVERAGES always operates on all photcodes?
    12   if (mode == UPDATE_AVERAGES) {
     11  // UPDATE_AVERAGES used to always operate on all photcodes
     12  // now, if a list of photcodes are given that is used, otherwise
     13  // all will be used
     14  if (!photcodes) {
    1315    char tmpline1[256];
    1416    int Ns;
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/src/relphot_images.c

    r42112 r42166  
    132132 
    133133    // if (GRID_ZEROPT) dump_grid ();
     134    setMcal  (catalog);
     135    setMmos  (catalog);
     136    setMgrp  (catalog);
    134137
    135138    setMcal  (catalog);
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/src/setMrelCatalog.c

    r42010 r42166  
    266266      // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    267267      Mcal = measureT[k].McalPSF; // check that this is zero for loaded REF value
     268      // but external reference photometry might not have Mcal set, so set to 0.0 in that case.
     269      if (isnan(Mcal)) Mcal = 0.0;
    268270    } else {
    269271      // getMcal returns image[].Mcal
     
    412414
    413415    // XXX hardwired grizy = (01234) JHK = (567) w = (8)
    414     if ((Nsec < 5) || (Nsec == 8)) {
     416    if (Nsec < 5) {
    415417      secfilt[Nsec].Ncode = results->NexpPS1[Nsec];
    416418    } else {
  • branches/eam_branches/ipp-20220316/Ohana/src/relphot/src/setMrelFinal.c

    r41647 r42166  
    1111  int Nsecfilt = GetPhotcodeNsecfilt ();
    1212
     13  // this resets values only if -reset is used
    1314  ResetAverageAndMeasure (catalog);
    1415 
Note: See TracChangeset for help on using the changeset viewer.