IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35599


Ignore:
Timestamp:
May 27, 2013, 2:31:32 PM (13 years ago)
Author:
eugene
Message:

better srand init for mkcmf; raise errors on nan airmasses; replace KiiOpen,KiiClose with KapaOpen,KapaClose; add -quick-airmass to test script

Location:
branches/eam_branches/ipp-20130509/Ohana/src/addstar
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/Ohana/src/addstar/src/SEDops.c

    r16040 r35599  
    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}
  • branches/eam_branches/ipp-20130509/Ohana/src/addstar/src/airmass.c

    r21508 r35599  
    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}
  • branches/eam_branches/ipp-20130509/Ohana/src/addstar/src/mkcmf.c

    r35108 r35599  
    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;
  • branches/eam_branches/ipp-20130509/Ohana/src/addstar/test/relphot.dvo

    r27582 r35599  
    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.