IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35760


Ignore:
Timestamp:
Jul 3, 2013, 2:15:56 PM (13 years ago)
Author:
eugene
Message:

raise a warning for bad airmass info

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

Legend:

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

    r16040 r35760  
    8686int SEDfitInit (SEDtable *table) {
    8787
    88   Xgraph = KiiOpen ("kapa", "sedstar");
     88  Xgraph = KapaOpen ("kapa", "sedstar");
    8989  KapaInitGraph (&graphdata);
    9090  SetLimitsRaw (table[0].wavecode, NULL, table[0].Nfilter, &graphdata);
     
    114114  free (fitmags);
    115115  free (fiterrs);
    116   KiiClose (Xgraph);
     116  KapaClose (Xgraph);
    117117  return (TRUE);
    118118}
  • trunk/Ohana/src/addstar/src/addstar_create_ID.c

    r34405 r35760  
    1010  /*** update the image table ***/
    1111  /* setup image table format and lock */
     12  // gfits_db_init (&db);
    1213  db.mode   = dvo_catalog_catmode (CATMODE);
    1314  db.format = dvo_catalog_catformat (CATFORMAT);
     
    1920    if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat);
    2021    dvo_image_create (&db, GetZeroPoint());
    21   } else {
    22     if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) {
    23       Shutdown ("can't read image catalog %s", db.filename);
    24     }
    25     if (!dvo_image_createID (&db.header)) {
    26       fprintf (stderr, "failed to add database ID\n");
    27       exit (1);
    28     }
     22    // if (!gfits_table_to_vtable (&db[0].ftable, &db[0].vtable, 0, 0)) return (FALSE);
     23    dvo_image_save (&db, VERBOSE);
     24    dvo_image_unlock (&db);
     25    return TRUE;
     26  }
     27
     28  if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) {
     29    Shutdown ("can't read image catalog %s", db.filename);
     30  }
     31  if (!dvo_image_createID (&db.header)) {
     32    fprintf (stderr, "failed to add database ID\n");
     33    exit (1);
    2934  }
    3035  fseeko (db.f, 0, SEEK_SET);
  • trunk/Ohana/src/addstar/src/airmass.c

    r21508 r35760  
    66  AirmassQuality = quality;
    77}
     8
     9static int Nbad_airmass = 0;
    810
    911float airmass (float secz_image, double ra, double dec, double st, double latitude) {
     
    2325  cosz = sin (rdec) * sin (rlat) + cos (rdec) * cos (RAD_DEG*hour) * cos (rlat);
    2426  secz = 1.000 / cosz;
     27 
     28  if (!isfinite(secz)) {
     29    Nbad_airmass ++;
     30  }
     31  if (Nbad_airmass > 1) {
     32    fprintf (stderr, "*** WARNING *** NaN airmass for detection\n");
     33    fprintf (stderr, "*** ra, dec : %f, %f | st : %f | lat : %f | cosz : %f\n", ra, dec, st, latitude, cosz);
     34  }
     35  if (Nbad_airmass > 10) {
     36    fprintf (stderr, "*** ERROR *** more than 10 NaN airmass values for detections, giving up\n");
     37    fprintf (stderr, " (use -quick-airmass to use image airmass)\n");
     38    exit (2);
     39  }
     40
    2541  return (secz);
    2642}
  • trunk/Ohana/src/addstar/src/args.c

    r35579 r35760  
    419419  fprintf (stderr, "  addstar -pmm (filename)");
    420420  fprintf (stderr, "     insert pmm table into database\n\n");
     421  fprintf (stderr, "  addstar -create-id");
     422  fprintf (stderr, "     add a dvodb ID to the image table (and exit)\n\n");
    421423
    422424  fprintf (stderr, "  optional flags:\n");
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r35108 r35760  
    184184  }
    185185
     186  // init the random seed
     187  {
     188    struct timeval now;
     189    gettimeofday (&now, NULL);
     190    long A = now.tv_sec + now.tv_usec * 1000000;
     191    srand48(A);
     192  }
     193   
    186194  /* bore site center guess */
    187195  strcpy (coords.ctype, "DEC--TAN");
     
    379387 
    380388  int i;
    381   long A, B;
    382389  double val, x, dx, dx1, dx2, dx3, df;
    383390  double mean, sigma;
     
    386393  if (Ngaussint == Nbin) return;
    387394
    388   A = time(NULL);
    389   // XXX this is expensive if called a lot (1 sec min)
    390   // for (B = 0; A == time(NULL); B++);
    391   B = A + 10000;
    392   srand48(B);
     395  // A = time(NULL);
     396  // // XXX this is expensive if called a lot (1 sec min)
     397  // // for (B = 0; A == time(NULL); B++);
     398  // B = A + 10000;
     399  // srand48(B);
    393400 
    394401  Ngaussint = Nbin;
  • trunk/Ohana/src/addstar/src/resort_catalog.c

    r34088 r35760  
    3232void SortAveMeasMatch (off_t *MEAS, off_t *AVE, off_t N) {
    3333
    34 # define SWAPFUNC(A,B){ off_t tmp_meas; off_t tmp_ave;  \
    35     tmp_meas = MEAS[A]; MEAS[A] = MEAS[B]; MEAS[B] = tmp_meas;          \
    36     tmp_ave  = AVE[A];  AVE[A]  = AVE[B];  AVE[B]  = tmp_ave;           \
     34# define SWAPFUNC(A,B){ off_t tmp_meas; off_t tmp_ave;          \
     35    tmp_meas = MEAS[A]; MEAS[A] = MEAS[B]; MEAS[B] = tmp_meas;  \
     36    tmp_ave  = AVE[A];  AVE[A]  = AVE[B];  AVE[B]  = tmp_ave;   \
    3737  }
    3838# define COMPARE(A,B)(AVE[A] < AVE[B])
     
    4242}
    4343
    44 # define MARKTIME(MSG,...) { \
    45   float dtime; \
    46   gettimeofday (&stop, (void *) NULL); \
    47   dtime = DTIME (stop, start); start = stop; \
    48   fprintf (stderr, MSG, __VA_ARGS__); }
     44# define MARKTIME(MSG,...) {                    \
     45    float dtime;                                \
     46    gettimeofday (&stop, (void *) NULL);        \
     47    dtime = DTIME (stop, start); start = stop;  \
     48    fprintf (stderr, MSG, __VA_ARGS__); }
    4949
    5050// XXX : where is the time going?  perhaps the ALLOCATE?
     
    9191    if (catalog[0].catformat >= DVO_FORMAT_PS1_V1) {
    9292      // earlier formats did not carry the objID or catID, so they are not available (we could assign on load, but we don't)
     93      myAssert(average[averageSeq[i]].catID == measure[measureSeq[i]].catID, "object / detection mismatch");
     94# if (1)
    9395      myAssert(average[averageSeq[i]].objID == measure[measureSeq[i]].objID, "object / detection mismatch");
    94       myAssert(average[averageSeq[i]].catID == measure[measureSeq[i]].catID, "object / detection mismatch");
     96# else
     97      // for reasons I do not understand, the mini dvodbs generated on stsci1X had a handful of detections with an inconsistency between averef and objID. 
     98      // this happened for 28 detections in the dbs on /data/stsci1?.0/eugene/dvo3pi.20130616, but not at all (as far as I know) in the rest of LAP DVO
     99      if (average[averageSeq[i]].objID != measure[measureSeq[i]].objID) {
     100        fprintf (stderr, "R");
     101        measure[measureSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
     102      }
     103# endif
    95104    }
    96105  }
  • trunk/Ohana/src/addstar/test/relphot.dvo

    r27582 r35760  
    3838    mkinput $offset:$i
    3939    exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC -type $1
    40     exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2
     40    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    4141  end
    4242
     43  echo relphot -D CATDIR catdir.test r -region {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0} -update -nloop 10.0
    4344  exec relphot -D CATDIR catdir.test r -region {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0} -update -nloop 10.0 >& /dev/null
    4445
     
    5253  end
    5354
    54   exec rm test.cmf test.in.txt
    55   exec rm -r catdir.test
     55  #exec rm test.cmf test.in.txt
     56  #exec rm -r catdir.test
    5657
    5758  tapDONE
Note: See TracChangeset for help on using the changeset viewer.