IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 6, 2012, 6:32:19 PM (14 years ago)
Author:
watersc1
Message:

merge from trunk. Preliminary versions of stacktool/warptool updates and regenerate_background.pl script. The warp code is finished and tested, and I still need to get the stack version resolved.

Location:
branches/czw_branch/20120906/Ohana
Files:
2 deleted
120 edited
25 copied

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/Ohana

  • branches/czw_branch/20120906/Ohana/src/addstar/src/ReadStarsFITS.c

    r34405 r34772  
    606606    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    607607    stars[i].measure.psfQF      = ps1data[i].psfQF;
     608    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
    608609    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    609610    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    675676    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
    676677                       
     678    // these fluxes are converted from counts to counts/sec in FilterStars.c
     679    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     680    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     681    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     682    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     683
     684    stars[i].measure.Sky        = ps1data[i].sky;
     685    stars[i].measure.dSky       = ps1data[i].dSky;
     686                       
     687    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     688    stars[i].measure.psfQF      = ps1data[i].psfQF;
     689    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
     690
     691    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     692    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     693    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     694    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     695
     696    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     697    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     698    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     699
     700    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     701    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     702    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     703                       
     704    stars[i].measure.photFlags  = ps1data[i].flags;
     705
     706    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     707    stars[i].measure.detID      = ps1data[i].detID;
     708
     709    // the Average fields and the following Measure fields are set in FilterStars after
     710    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
     711
     712    // averef is set in find_matches
     713
     714    // dbFlags is zero on ingest.
     715
     716    // the following fields are currently not being set anywhere: t_msec
     717  }   
     718  *nstars = Nstars;
     719  return (stars);
     720}
     721
     722Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
     723
     724  off_t Nstars;
     725  unsigned int i;
     726  double ZeroPt;
     727  Stars *stars;
     728  CMF_PS1_SV1 *ps1data;
     729
     730  if (table[0].header[0].Naxis[0] == 196) {
     731    stars = Convert_PS1_SV1_Alt (table, nstars);
     732    return (stars);
     733  }
     734
     735  ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
     736  if (!ps1data) {
     737    fprintf (stderr, "skipping inconsistent entry\n");
     738    return (NULL);
     739  }
     740  ZeroPt = GetZeroPoint();
     741
     742  ALLOCATE (stars, Stars, Nstars);
     743  for (i = 0; i < Nstars; i++) {
     744    InitStar (&stars[i]);
     745    stars[i].measure.Xccd       = ps1data[i].X;
     746    stars[i].measure.Yccd       = ps1data[i].Y;
     747    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     748    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     749
     750    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     751    stars[i].measure.pltscale   = ps1data[i].pltscale;
     752
     753    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     754      stars[i].measure.M      = NAN;
     755    } else {
     756      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     757    }
     758    stars[i].measure.dM         = ps1data[i].dM;
     759    stars[i].measure.dMcal      = ps1data[i].dMcal;
     760    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     761                       
     762    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     763    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     764
     765    // these fluxes are converted from counts to counts/sec in FilterStars.c
     766    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     767    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     768    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     769    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     770
     771    stars[i].measure.Sky        = ps1data[i].sky;
     772    stars[i].measure.dSky       = ps1data[i].dSky;
     773                       
     774    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     775    stars[i].measure.psfQF      = ps1data[i].psfQF;
     776    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
     777
     778    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     779    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     780    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     781    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     782
     783    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     784    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     785    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     786
     787    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     788    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     789    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     790                       
     791    stars[i].measure.photFlags  = ps1data[i].flags;
     792
     793    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     794    stars[i].measure.detID      = ps1data[i].detID;
     795
     796    // the Average fields and the following Measure fields are set in FilterStars after
     797    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     798    // averef is set in find_matches, dbFlags is zero on ingest.
     799
     800    // the following fields are currently not being set anywhere: t_msec
     801  }   
     802  *nstars = Nstars;
     803  return (stars);
     804}
     805
     806Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
     807
     808  off_t Nstars;
     809  unsigned int i;
     810  double ZeroPt;
     811  Stars *stars;
     812  CMF_PS1_SV1 *ps1data;
     813
     814  // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
     815
     816  ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
     817  if (!ps1data) {
     818    fprintf (stderr, "skipping inconsistent entry\n");
     819    return (NULL);
     820  }
     821  ZeroPt = GetZeroPoint();
     822
     823  ALLOCATE (stars, Stars, Nstars);
     824  for (i = 0; i < Nstars; i++) {
     825    InitStar (&stars[i]);
     826    stars[i].measure.Xccd       = ps1data[i].X;
     827    stars[i].measure.Yccd       = ps1data[i].Y;
     828    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     829    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     830
     831    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     832    stars[i].measure.pltscale   = ps1data[i].pltscale;
     833
     834    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     835      stars[i].measure.M      = NAN;
     836    } else {
     837      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     838    }
     839    stars[i].measure.dM         = ps1data[i].dM;
     840    stars[i].measure.dMcal      = ps1data[i].dMcal;
     841    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     842                       
     843    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     844    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     845
    677846    // these fluxes are converted from counts to counts/sec in FilterStars.c
    678847    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     
    705874
    706875    // the Average fields and the following Measure fields are set in FilterStars after
    707     // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
    708 
    709     // averef is set in find_matches
    710 
    711     // dbFlags is zero on ingest.
     876    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     877    // averef is set in find_matches, dbFlags is zero on ingest.
    712878
    713879    // the following fields are currently not being set anywhere: t_msec
     
    717883}
    718884
    719 Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
     885Stars *Convert_PS1_SV2 (FTable *table, unsigned int *nstars) {
    720886
    721887  off_t Nstars;
     
    723889  double ZeroPt;
    724890  Stars *stars;
    725   CMF_PS1_SV1 *ps1data;
    726 
    727   if (table[0].header[0].Naxis[0] == 196) {
    728     stars = Convert_PS1_SV1_Alt (table, nstars);
    729     return (stars);
    730   }
    731 
    732   ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
     891  CMF_PS1_SV2 *ps1data;
     892
     893  ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL);
    733894  if (!ps1data) {
    734895    fprintf (stderr, "skipping inconsistent entry\n");
     
    771932    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    772933    stars[i].measure.psfQF      = ps1data[i].psfQF;
     934    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
     935
    773936    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    774937    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    799962}
    800963
    801 Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
    802 
    803   off_t Nstars;
    804   unsigned int i;
    805   double ZeroPt;
    806   Stars *stars;
    807   CMF_PS1_SV1 *ps1data;
    808 
    809   // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
    810 
    811   ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
    812   if (!ps1data) {
    813     fprintf (stderr, "skipping inconsistent entry\n");
    814     return (NULL);
    815   }
    816   ZeroPt = GetZeroPoint();
    817 
    818   ALLOCATE (stars, Stars, Nstars);
    819   for (i = 0; i < Nstars; i++) {
    820     InitStar (&stars[i]);
    821     stars[i].measure.Xccd       = ps1data[i].X;
    822     stars[i].measure.Yccd       = ps1data[i].Y;
    823     stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
    824     stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
    825 
    826     stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
    827     stars[i].measure.pltscale   = ps1data[i].pltscale;
    828 
    829     if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    830       stars[i].measure.M      = NAN;
    831     } else {
    832       stars[i].measure.M      = ps1data[i].M + ZeroPt;
    833     }
    834     stars[i].measure.dM         = ps1data[i].dM;
    835     stars[i].measure.dMcal      = ps1data[i].dMcal;
    836     stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    837                        
    838     stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
    839     stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
    840 
    841     // these fluxes are converted from counts to counts/sec in FilterStars.c
    842     stars[i].measure.FluxPSF    = ps1data[i].Flux;
    843     stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
    844     stars[i].measure.FluxKron   = ps1data[i].kronFlux;
    845     stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
    846 
    847     stars[i].measure.Sky        = ps1data[i].sky;
    848     stars[i].measure.dSky       = ps1data[i].dSky;
    849                        
    850     stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    851     stars[i].measure.psfQF      = ps1data[i].psfQF;
    852     stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    853     stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    854     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    855     stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    856 
    857     stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
    858     stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
    859     stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
    860 
    861     stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
    862     stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    863     stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    864                        
    865     stars[i].measure.photFlags  = ps1data[i].flags;
    866 
    867     // this is may optionally be replaced by the internal sequence (see FilterStars.c)
    868     stars[i].measure.detID      = ps1data[i].detID;
    869 
    870     // the Average fields and the following Measure fields are set in FilterStars after
    871     // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
    872     // averef is set in find_matches, dbFlags is zero on ingest.
    873 
    874     // the following fields are currently not being set anywhere: t_msec
    875   }   
    876   *nstars = Nstars;
    877   return (stars);
    878 }
    879 
    880 Stars *Convert_PS1_SV2 (FTable *table, unsigned int *nstars) {
    881 
    882   off_t Nstars;
    883   unsigned int i;
    884   double ZeroPt;
    885   Stars *stars;
    886   CMF_PS1_SV2 *ps1data;
    887 
    888   ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL);
    889   if (!ps1data) {
    890     fprintf (stderr, "skipping inconsistent entry\n");
    891     return (NULL);
    892   }
    893   ZeroPt = GetZeroPoint();
    894 
    895   ALLOCATE (stars, Stars, Nstars);
    896   for (i = 0; i < Nstars; i++) {
    897     InitStar (&stars[i]);
    898     stars[i].measure.Xccd       = ps1data[i].X;
    899     stars[i].measure.Yccd       = ps1data[i].Y;
    900     stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
    901     stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
    902 
    903     stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
    904     stars[i].measure.pltscale   = ps1data[i].pltscale;
    905 
    906     if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    907       stars[i].measure.M      = NAN;
    908     } else {
    909       stars[i].measure.M      = ps1data[i].M + ZeroPt;
    910     }
    911     stars[i].measure.dM         = ps1data[i].dM;
    912     stars[i].measure.dMcal      = ps1data[i].dMcal;
    913     stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    914                        
    915     stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
    916     stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
    917 
    918     // these fluxes are converted from counts to counts/sec in FilterStars.c
    919     stars[i].measure.FluxPSF    = ps1data[i].Flux;
    920     stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
    921     stars[i].measure.FluxKron   = ps1data[i].kronFlux;
    922     stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
    923 
    924     stars[i].measure.Sky        = ps1data[i].sky;
    925     stars[i].measure.dSky       = ps1data[i].dSky;
    926                        
    927     stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    928     stars[i].measure.psfQF      = ps1data[i].psfQF;
    929     stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    930     stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    931     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    932     stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    933 
    934     stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
    935     stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
    936     stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
    937 
    938     stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
    939     stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    940     stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    941                        
    942     stars[i].measure.photFlags  = ps1data[i].flags;
    943 
    944     // this is may optionally be replaced by the internal sequence (see FilterStars.c)
    945     stars[i].measure.detID      = ps1data[i].detID;
    946 
    947     // the Average fields and the following Measure fields are set in FilterStars after
    948     // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
    949     // averef is set in find_matches, dbFlags is zero on ingest.
    950 
    951     // the following fields are currently not being set anywhere: t_msec
    952   }   
    953   *nstars = Nstars;
    954   return (stars);
    955 }
    956 
    957 
     964
  • branches/czw_branch/20120906/Ohana/src/addstar/src/mkcmf.c

    r34405 r34772  
    178178  }
    179179   
     180  gauss_init (2048);
     181
    180182  // load test stars from a file:
    181183  Nstars = 0;
     
    254256  gfits_modify (&header, "NASTRO",   "%d", 1, 10);
    255257
    256   gfits_modify (&header, "IMAGEID",  "%d", 1, (int)(1000*drand48()));
    257   gfits_modify (&header, "SOURCEID", "%d", 1, (int)(100*drand48()));
     258  int imageID = 1000.0*drand48();
     259  int sourceID = 100.0*drand48();
     260
     261  gfits_modify (&header, "IMAGEID",  "%d", 1, imageID);
     262  gfits_modify (&header, "SOURCEID", "%d", 1, sourceID);
    258263
    259264  PutCoords (&coords, &header);
     
    396401  // this needs to make different output 'stars' entries depending on the desired type
    397402  ALLOCATE (stars, PS1_DEV_0, Nstars);
    398   gauss_init (2048);
    399403  for (i = 0; i < Nstars; i++) {
    400404    stars[i].detID = i;
     
    441445  // this needs to make different output 'stars' entries depending on the desired type
    442446  ALLOCATE (stars, PS1_DEV_1, Nstars);
    443   gauss_init (2048);
    444447  for (i = 0; i < Nstars; i++) {
    445448    stars[i].detID = i;
     
    489492  // this needs to make different output 'stars' entries depending on the desired type
    490493  ALLOCATE (stars, CMF_PS1_V1, Nstars);
    491   gauss_init (2048);
    492494  for (i = 0; i < Nstars; i++) {
    493495    stars[i].detID = i;
     
    537539  // this needs to make different output 'stars' entries depending on the desired type
    538540  ALLOCATE (stars, CMF_PS1_V2, Nstars);
    539   gauss_init (2048);
    540541  for (i = 0; i < Nstars; i++) {
    541542    stars[i].detID = i;
     
    591592  // this needs to make different output 'stars' entries depending on the desired type
    592593  ALLOCATE (stars, CMF_PS1_V3, Nstars);
    593   gauss_init (2048);
    594594  for (i = 0; i < Nstars; i++) {
    595595    stars[i].detID = i;
     
    649649  // this needs to make different output 'stars' entries depending on the desired type
    650650  ALLOCATE (stars, CMF_PS1_V4, Nstars);
    651   gauss_init (2048);
    652651  for (i = 0; i < Nstars; i++) {
    653652    stars[i].detID = i;
     
    660659    stars[i].M = M[i];
    661660    stars[i].Map = M[i] - 0.05;
     661    stars[i].MapRaw = M[i] - 0.10;
     662
     663    stars[i].Flux = flux;
     664    stars[i].dFlux = flux * fSN;
     665
     666    stars[i].apFlux = pow(10.0, -0.4*stars[i].Map);
     667    stars[i].apFluxErr = stars[i].apFlux * fSN;
    662668
    663669    if (ADDNOISE) {
  • branches/czw_branch/20120906/Ohana/src/addstar/src/psps_ids.c

    r34260 r34772  
    2121CreatePSPSStackDetectionID(int sourceID, int imageID, int detID)
    2222{
    23   // sourceID : ID of database + table that tracked the image (< 0x100 = 256)
     23  // sourceID : ID of database + table that tracked the image (< 0x7f = 127)
    2424  // imageID : external ID of the image which provided the detections (< 0x1000.0000 ~ 2.7e8)
    2525  // detID : detection sequence in image (< 0x1000.0000 ~ 2.7e8)
     
    2727  assert (detID    < 0x10000000);
    2828  assert (imageID  < 0x10000000);
    29   assert (sourceID < 0x100);
     29  assert (sourceID < 0x7f);
    3030 
    3131  uint64_t detectid = ((uint64_t)sourceID << 56) + ((uint64_t)imageID << 28) + (uint64_t)detID;
  • branches/czw_branch/20120906/Ohana/src/delstar/Makefile

    r16040 r34772  
    1 default: delstar
     1default: delstar delstar_client
    22help:
    33        @echo "make options: addstar (default)"
     
    1818
    1919delstar: $(BIN)/delstar.$(ARCH)
    20 install: $(DESTBIN)/delstar
     20delstar_client: $(BIN)/delstar_client.$(ARCH)
     21
     22install: $(DESTBIN)/delstar $(DESTBIN)/delstar_client
    2123
    2224DELSTAR = \
     
    2729$(SRC)/delete_imagename.$(ARCH).o \
    2830$(SRC)/delete_imagefile.$(ARCH).o \
     31$(SRC)/delete_image_photcodes.$(ARCH).o \
     32$(SRC)/delete_photcodes.$(ARCH).o \
    2933$(SRC)/delete_times.$(ARCH).o     \
    3034$(SRC)/gimages.$(ARCH).o          \
     
    3337$(SRC)/parse_time.$(ARCH).o       \
    3438$(SRC)/check_permissions.$(ARCH).o \
     39$(SRC)/Shutdown.$(ARCH).o         
     40
     41DELSTAR_CLIENT = \
     42$(SRC)/delstar_client.$(ARCH).o   \
     43$(SRC)/SetSignals.$(ARCH).o       \
     44$(SRC)/ConfigInit.$(ARCH).o       \
     45$(SRC)/args.$(ARCH).o             \
     46$(SRC)/delete_photcodes.$(ARCH).o \
    3547$(SRC)/Shutdown.$(ARCH).o         
    3648
     
    4254$(DELSTAR): $(INC)/delstar.h
    4355$(BIN)/delstar.$(ARCH) : $(DELSTAR)
     56
     57$(DELSTAR_CLIENT): $(INC)/delstar.h
     58$(BIN)/delstar_client.$(ARCH) : $(DELSTAR_CLIENT)
  • branches/czw_branch/20120906/Ohana/src/delstar/include/delstar.h

    r27435 r34772  
    1212
    1313/* global variables set in parameter file */
    14 char   ImageCat[256];
    15 char   ImageTemplate[256];
    16 char   CatTemplate[256];
    17 char   GSCFILE[256];
    18 char   CATDIR[256];
     14char   ImageCat[DVO_MAX_PATH];
     15char   ImageTemplate[DVO_MAX_PATH];
     16char   CatTemplate[DVO_MAX_PATH];
     17char   GSCFILE[DVO_MAX_PATH];
     18
     19char  *CATDIR;
     20
    1921char   CATMODE[16];    /* raw, mef, split, mysql */
    2022char   CATFORMAT[16];  /* internal, elixir, loneos, panstarrs */
     23
     24char  *IMAGENAME;
     25
    2126double NSIGMA;
    2227double ALPHA;
     
    2429int    ORPHAN;
    2530int    MISSED;
    26 char   SKY_TABLE[256];
     31char   SKY_TABLE[DVO_MAX_PATH];
    2732int    SKY_DEPTH;  /** XXX EAM : depth of catalog tables, fix usage */
     33
     34int    PARALLEL;
     35int    PARALLEL_MANUAL;
     36int    PARALLEL_SERIAL;
     37
     38int          HOST_ID;
     39char        *HOSTDIR;
    2840
    2941time_t    START;
     
    3143PhotCode *PHOTCODE;
    3244
     45char *PHOTCODE_LIST;
     46
    3347int    MODE;
    34 enum {MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED};
     48enum {MODE_NONE, MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED, MODE_PHOTCODES};
    3549
    3650char DateKeyword[64], DateMode[64], UTKeyword[64], MJDKeyword[64], JDKeyword[64];
     51
     52SkyRegion UserPatch;
    3753
    3854/*** delstar prototypes ***/
     
    4662int        Shutdown               PROTO((char *format, ...)) OHANA_FORMAT(printf, 1, 2);
    4763void       TrapSignal             PROTO((int sig));
    48 int        args                   PROTO((int *argc, char **argv));
     64int        args                   PROTO((int argc, char **argv));
    4965void       check_permissions      PROTO((char *basefile));
    50 void       delete_imagefile       PROTO((FITS_DB *db, char *filename));
    51 void       delete_imagename       PROTO((FITS_DB *db, char *name));
     66void       delete_imagefile       PROTO((FITS_DB *db));
     67void       delete_imagename       PROTO((FITS_DB *db));
    5268void       delete_times           PROTO((FITS_DB *db));
    5369int        edge_check             PROTO((double *x1, double *y1, double *x2, double *y2));
     
    7288
    7389void set_db (FITS_DB *in);
     90
     91int args_client (int argc, char **argv);
     92
     93void SortAveMeasMatch (off_t *MEAS, off_t *AVE, off_t N);
     94
     95int delete_photcodes (int hostID, char *hostpath);
     96int delete_photcodes_parallel (SkyList *sky);
     97int delete_photcodes_catalog (Catalog *catalog, PhotCode **photcodes, int Nphotcodes);
     98int delete_image_photcodes (FITS_DB *db);
  • branches/czw_branch/20120906/Ohana/src/delstar/src/ConfigInit.c

    r25757 r34772  
    55  char *config, *file;
    66  char CatdirPhotcodeFile[256];
    7   char MasterPhotcodeFile[256];
    87
    98  /*** load configuration info ***/
     
    2019  ScanConfig (config, "ALPHA",                  "%lf", 0, &ALPHA);
    2120  ScanConfig (config, "GSCFILE",                "%s", 0, GSCFILE);
    22   ScanConfig (config, "CATDIR",                 "%s", 0, CATDIR);
    2321  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    2422  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    25   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    2623
    27   sprintf (ImageCat, "%s/Images.dat", CATDIR);
     24  // force CATDIR to be absolute (so parallel mode will work)
     25  char *tmpcatdir = NULL;
     26  ALLOCATE (tmpcatdir, char, DVO_MAX_PATH);
     27  ScanConfig (config, "CATDIR",                 "%s",  0, tmpcatdir);
     28  CATDIR = abspath (tmpcatdir, DVO_MAX_PATH);
     29  free (tmpcatdir);
     30
     31  snprintf (ImageCat, DVO_MAX_PATH, "%s/Images.dat", CATDIR);
    2832
    2933  ScanConfig (config, "DATE-KEYWORD",           "%s", 0, DateKeyword);
     
    4549  /* XXX this does not yet write out the master photcode table */
    4650  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    47   if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    48     fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
     51  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
     52    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    4953    exit (1);
    5054  }
  • branches/czw_branch/20120906/Ohana/src/delstar/src/args.c

    r34088 r34772  
    44
    55  fprintf (stderr, "USAGE:\n");
    6   fprintf (stderr, "  delstar (filename)\n");
    7   fprintf (stderr, "  delstar -name (filename)\n");
     6  fprintf (stderr, "  delstar -file (filename)\n");
     7  fprintf (stderr, "  delstar -name (imagename)\n");
    88  fprintf (stderr, "  delstar -time (start) (stop/range)\n");
    99  fprintf (stderr, "  delstar -orphan (region)\n");
     
    2222}
    2323
    24 int args (int *argc, char **argv) {
     24void delstar_client_usage () {
     25  fprintf (stderr, "USAGE: delstar_client [options]\n");
     26  exit (2);
     27}
     28
     29int args (int argc, char **argv) {
    2530 
    2631  int N;
     
    2833
    2934  /* check for help request */
    30   if (get_argument (*argc, argv, "-help") ||
    31       get_argument (*argc, argv, "-h")) {
     35  if (get_argument (argc, argv, "-help") ||
     36      get_argument (argc, argv, "-h")) {
    3237    help ();
    3338  }
    3439
    3540  VERBOSE = FALSE;
    36   if ((N = get_argument (*argc, argv, "-v"))) {
     41  if ((N = get_argument (argc, argv, "-v"))) {
    3742    VERBOSE = TRUE;
    38     remove_argument (N, argc, argv);
    39   }
    40 
    41   MODE = MODE_IMAGEFILE;
    42   if ((N = get_argument (*argc, argv, "-name"))) {
    43     if (MODE != MODE_IMAGEFILE) usage();
     43    remove_argument (N, &argc, argv);
     44  }
     45
     46  // region of interest
     47  UserPatch.Rmin = 0;
     48  UserPatch.Rmax = 360;
     49  UserPatch.Dmin = -90;
     50  UserPatch.Dmax = +90;
     51  if ((N = get_argument (argc, argv, "-region"))) {
     52    remove_argument (N, &argc, argv);
     53    UserPatch.Rmin = atof (argv[N]);
     54    remove_argument (N, &argc, argv);
     55    UserPatch.Rmax = atof (argv[N]);
     56    remove_argument (N, &argc, argv);
     57    UserPatch.Dmin = atof (argv[N]);
     58    remove_argument (N, &argc, argv);
     59    UserPatch.Dmax = atof (argv[N]);
     60    remove_argument (N, &argc, argv);
     61  }
     62
     63  // XXX for the moment, make this selection manual.  it needs to be automatic
     64  // based on the state of the SkyTable
     65  PARALLEL = FALSE;
     66  if ((N = get_argument (argc, argv, "-parallel"))) {
     67    PARALLEL = TRUE;
     68    remove_argument (N, &argc, argv);
     69  }
     70  // this is a test mode : rather than launching the remote jobs and waiting for completion,
     71  // delstar will simply list the remote command and wait for the user to signal completion
     72  PARALLEL_MANUAL = FALSE;
     73  if ((N = get_argument (argc, argv, "-parallel-manual"))) {
     74    PARALLEL = TRUE; // -parallel-manual implies -parallel
     75    PARALLEL_MANUAL = TRUE;
     76    remove_argument (N, &argc, argv);
     77  }
     78  // this is a test mode : rather than launching the delstar_client jobs remotely, they are
     79  // run in serial via 'system'
     80  PARALLEL_SERIAL = FALSE;
     81  if ((N = get_argument (argc, argv, "-parallel-serial"))) {
     82    if (PARALLEL_MANUAL) {
     83      fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n");
     84      exit (1);
     85    }
     86    PARALLEL = TRUE; // -parallel-serial implies -parallel
     87    PARALLEL_SERIAL = TRUE;
     88    remove_argument (N, &argc, argv);
     89  }
     90
     91  IMAGENAME = NULL;
     92  MODE = MODE_NONE;
     93  if ((N = get_argument (argc, argv, "-name"))) {
     94    if (MODE != MODE_NONE) usage();
    4495    MODE = MODE_IMAGENAME;
    45     remove_argument (N, argc, argv);
    46   }
    47   if ((N = get_argument (*argc, argv, "-orphan"))) {
    48     if (MODE != MODE_IMAGEFILE) usage();
     96    remove_argument (N, &argc, argv);
     97    IMAGENAME = strcreate (argv[N]);
     98    remove_argument (N, &argc, argv);
     99  }
     100  if ((N = get_argument (argc, argv, "-file"))) {
     101    if (MODE != MODE_NONE) usage();
     102    MODE = MODE_IMAGENAME;
     103    remove_argument (N, &argc, argv);
     104    IMAGENAME = strcreate (argv[N]);
     105    remove_argument (N, &argc, argv);
     106  }
     107  if ((N = get_argument (argc, argv, "-orphan"))) {
     108    if (MODE != MODE_NONE) usage();
    49109    MODE = MODE_ORPHAN;
    50     remove_argument (N, argc, argv);
    51   }
    52   if ((N = get_argument (*argc, argv, "-missed"))) {
    53     if (MODE != MODE_IMAGEFILE) usage();
     110    remove_argument (N, &argc, argv);
     111  }
     112  if ((N = get_argument (argc, argv, "-missed"))) {
     113    if (MODE != MODE_NONE) usage();
    54114    MODE = MODE_MISSED;
    55     remove_argument (N, argc, argv);
    56   }
    57   if ((N = get_argument (*argc, argv, "-time"))) {
    58     if (MODE != MODE_IMAGEFILE) usage();
     115    remove_argument (N, &argc, argv);
     116  }
     117  if ((N = get_argument (argc, argv, "-photcodes"))) {
     118    if (MODE != MODE_NONE) usage();
     119    MODE = MODE_PHOTCODES;
     120    remove_argument (N, &argc, argv);
     121    PHOTCODE_LIST = strcreate(argv[N]);
     122    remove_argument (N, &argc, argv);
     123  }
     124  if ((N = get_argument (argc, argv, "-time"))) {
     125    if (MODE != MODE_NONE) usage();
    59126    MODE = MODE_TIME;
    60     remove_argument (N, argc, argv);
     127    remove_argument (N, &argc, argv);
    61128
    62129    if (!ohana_str_to_time (argv[N], &START)) usage ();
    63     remove_argument (N, argc, argv);
     130    remove_argument (N, &argc, argv);
    64131
    65132    /* interpret second value */
     
    71138        END = START + trange;
    72139      }
    73       remove_argument (N, argc, argv);
     140      remove_argument (N, &argc, argv);
    74141      goto goodtime;
    75142    }
     
    81148        END   = tmp;
    82149      }
    83       remove_argument (N, argc, argv);
     150      remove_argument (N, &argc, argv);
    84151      goto goodtime;
    85152    }
    86153    usage ();
    87154  }
     155
    88156goodtime:
    89157
    90   /* restrict to a single photcode (not compatible with -image) */
     158  /* restrict to a single photcode (not compatible with -image)
    91159  PHOTCODE = NULL;
    92   if ((N = get_argument (*argc, argv, "-photcode"))) {
    93     remove_argument (N, argc, argv);
     160  if ((N = get_argument (argc, argv, "-photcode"))) {
     161    remove_argument (N, &argc, argv);
    94162    PHOTCODE = GetPhotcodebyName (argv[N]);
    95     remove_argument (N, argc, argv);
    96   }
    97 
    98   if ((MODE == MODE_TIME) && (*argc != 1)) usage ();
    99   if ((MODE != MODE_TIME) && (*argc != 2)) usage ();
     163    remove_argument (N, &argc, argv);
     164  }*/
     165
     166  if (argc != 1) usage ();
    100167  return (TRUE);
    101168}
     169
     170int args_client (int argc, char **argv) {
     171 
     172  int N;
     173
     174  // by definition, the client is not parallel
     175  PARALLEL = FALSE;
     176  PARALLEL_MANUAL = FALSE;
     177  PARALLEL_SERIAL = FALSE;
     178
     179  HOST_ID = 0;
     180  if ((N = get_argument (argc, argv, "-hostID"))) {
     181    remove_argument (N, &argc, argv);
     182    HOST_ID = atoi (argv[N]);
     183    remove_argument (N, &argc, argv);
     184  }
     185  if (!HOST_ID) delstar_client_usage();
     186
     187  HOSTDIR = NULL;
     188  if ((N = get_argument (argc, argv, "-hostdir"))) {
     189    remove_argument (N, &argc, argv);
     190    HOSTDIR = strcreate (argv[N]);
     191    remove_argument (N, &argc, argv);
     192  }
     193  if (!HOSTDIR) delstar_client_usage();
     194
     195  /* check for help request */
     196  if (get_argument (argc, argv, "-help") ||
     197      get_argument (argc, argv, "-h")) {
     198    help ();
     199  }
     200
     201  VERBOSE = FALSE;
     202  if ((N = get_argument (argc, argv, "-v"))) {
     203    VERBOSE = TRUE;
     204    remove_argument (N, &argc, argv);
     205  }
     206
     207  /* specify portion of the sky */
     208  UserPatch.Rmin = 0;
     209  UserPatch.Rmax = 360;
     210  UserPatch.Dmin = -90;
     211  UserPatch.Dmax = +90;
     212  if ((N = get_argument (argc, argv, "-region"))) {
     213    remove_argument (N, &argc, argv);
     214    UserPatch.Rmin = atof (argv[N]);
     215    remove_argument (N, &argc, argv);
     216    UserPatch.Rmax = atof (argv[N]);
     217    remove_argument (N, &argc, argv);
     218    UserPatch.Dmin = atof (argv[N]);
     219    remove_argument (N, &argc, argv);
     220    UserPatch.Dmax = atof (argv[N]);
     221    remove_argument (N, &argc, argv);
     222  }
     223
     224  MODE = MODE_NONE;
     225  if ((N = get_argument (argc, argv, "-photcodes"))) {
     226    if (MODE != MODE_NONE) delstar_client_usage();
     227    MODE = MODE_PHOTCODES;
     228    remove_argument (N, &argc, argv);
     229    PHOTCODE_LIST = strcreate(argv[N]);
     230    remove_argument (N, &argc, argv);
     231  }
     232
     233  if (MODE == MODE_NONE) delstar_client_usage ();
     234  return (TRUE);
     235}
  • branches/czw_branch/20120906/Ohana/src/delstar/src/delete_imagefile.c

    r27435 r34772  
    11# include "delstar.h"
    22
    3 void delete_imagefile (FITS_DB *db, char *filename) {
     3void delete_imagefile (FITS_DB *db) {
    44
    55  off_t i, Nimlist;
     
    1616
    1717  /* load information about file - time/photcode */
    18   image = gimages (filename);
     18  image = gimages (IMAGENAME);
    1919 
    2020  /* need to define method to get the mosaic (look up from table) */
     
    5454  // XXX EAM : load image data above, find mosaic?
    5555  imlist = find_images_data (db, image, &Nimlist);
    56   if (!Nimlist) Shutdown ("image %s not found in db", filename);
     56  if (!Nimlist) Shutdown ("image %s not found in db", IMAGENAME);
    5757
    5858  gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, imlist, Nimlist);
  • branches/czw_branch/20120906/Ohana/src/delstar/src/delete_imagename.c

    r29001 r34772  
    11# include "delstar.h"
    22
    3 void delete_imagename (FITS_DB *db, char *name) {
     3void delete_imagename (FITS_DB *db) {
    44
    55  off_t i, j, k;
     
    2525
    2626  /* find image in db by name */
    27   imlist = find_images_name (db, name, &Nimlist);
    28   if (!Nimlist) Shutdown ("image %s not found in db", name);
     27  imlist = find_images_name (db, IMAGENAME, &Nimlist);
     28  if (!Nimlist) Shutdown ("image %s not found in db", IMAGENAME);
    2929 
    3030  for (k = 0; k < Nimlist; k++) {
  • branches/czw_branch/20120906/Ohana/src/delstar/src/delstar.c

    r6428 r34772  
    88  SetSignals ();
    99  ConfigInit (&argc, argv);
    10   args (&argc, argv);
     10  args (argc, argv);
    1111
    1212  set_db (&db);
     
    2020  switch (MODE) {
    2121    case MODE_IMAGEFILE:
    22       delete_imagefile (&db, argv[1]);
     22      delete_imagefile (&db);
    2323      break;
    2424    case MODE_IMAGENAME:
    25       delete_imagename (&db, argv[1]);
     25      delete_imagename (&db);
    2626      break;
    2727    case MODE_TIME:
    2828      delete_times (&db);
    2929      break;
     30    case MODE_PHOTCODES: {
     31      if (!delete_image_photcodes (&db)) exit (1);
     32
     33      if (!delete_photcodes (0, NULL)) {
     34        fprintf (stderr, "failure deleting measurements\n");
     35        exit (1);
     36      }
     37      exit (0);
     38    }
    3039    case MODE_ORPHAN:
    3140      fprintf (stderr, "delete orphans not available\n");
  • branches/czw_branch/20120906/Ohana/src/dvomerge/src/dvomergeHistory.c

    r34405 r34772  
    132132  int stat_result = stat (filename, &outstats);
    133133  if (stat_result) {
    134     if (errno == ENOENT) return NULL;
     134    if (errno == ENOENT) {
     135      dmhObject *history = NULL;
     136      ALLOCATE (history, dmhObject, 1);
     137      history->Nmerge = 0;
     138   
     139      // ALLOCATE full list
     140      ALLOCATE (history->size, off_t,  history->Nmerge);
     141      ALLOCATE (history->time, time_t, history->Nmerge);
     142      ALLOCATE (history->date, char *, history->Nmerge);
     143      return history;
     144    }
    135145    fprintf (stderr, "cannot read stats on output file %s\n", filename);
    136146    perror ("stats error message:");
  • branches/czw_branch/20120906/Ohana/src/getstar/src/ConfigInit.c

    r25757 r34772  
    55  char *config, *file;
    66  char CatdirPhotcodeFile[256];
    7   char MasterPhotcodeFile[256];
    87
    98  /*** load configuration info ***/
     
    2120  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    2221  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    23   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    2422  if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) {
    2523    SKY_DEPTH = 2;
     
    3432  /* XXX this does not yet write out the master photcode table */
    3533  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    36   if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    37     fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
     34  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
     35    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    3836    exit (1);
    3937  }
  • branches/czw_branch/20120906/Ohana/src/getstar/src/MatchImages.c

    r28241 r34772  
    4343    tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    4444    tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
     45    tcoords.Npolyterms = 1;
    4546    strcpy (tcoords.ctype, "RA---TAN");
    4647  }
  • branches/czw_branch/20120906/Ohana/src/getstar/src/args.c

    r20985 r34772  
    4040
    4141  MagLimitUse = FALSE;
     42  MagLimitValue = 100;
    4243  if ((N = get_argument (argc, argv, "-maglim"))) {
    4344    MagLimitUse = TRUE;
     
    6061
    6162  MinMagUse = FALSE;
     63  MinMagValue = -100;
    6264  if ((N = get_argument (argc, argv, "-minmag"))) {
    6365    MinMagUse = TRUE;
  • branches/czw_branch/20120906/Ohana/src/getstar/src/select_by_region.c

    r34088 r34772  
    8282      }
    8383      if (isnan(mag)) continue;
     84      if (mag < MinMagValue) continue;
     85      if (mag > MagLimitValue) continue;
    8486
    8587      bin = (mag - MagMin) / dMag;
     
    118120    if (D > region[0].Dmax) continue;
    119121
    120     if (MagLimitUse) {
     122    // If either magnitude limit was specfied it a apply both.
     123    // If one of the limits is not used it is initialized to an unphysical value so test will succeed
     124    if (MagLimitUse || MinMagUse) {
    121125      mag = NAN;
    122126      if (needMeas) {
     
    132136      }
    133137      if (isnan(mag) || (mag > MagLimitValue)) continue;
     138      if (isnan(mag) || (mag < MinMagValue)) continue;
    134139    }
    135140
  • branches/czw_branch/20120906/Ohana/src/kapa2/src/SetColormap.c

    r26891 r34772  
    2424  graphic = GetGraphic();
    2525
     26  int NANValue = graphic[0].Npixels - 1;
     27  int MaxValue = graphic[0].Npixels - 1;
     28
    2629  // the "fullcolor" colormap is uniquely defined for each image;
    2730  // defer to the 'SetColorScale' step
     
    3538  {
    3639      // XXX set pure green for now
    37       graphic[0].cmap[graphic[0].Npixels-1].red = 0;
    38       graphic[0].cmap[graphic[0].Npixels-1].green = 0xffff;
    39       graphic[0].cmap[graphic[0].Npixels-1].blue = 0;
     40      graphic[0].cmap[NANValue].red = 0;
     41      graphic[0].cmap[NANValue].green = 0xffff;
     42      graphic[0].cmap[NANValue].blue = 0;
    4043  } 
    4144
     
    7376
    7477  // red,green,blue are values in range 0x0000 to 0xffff
    75   scale = 0xffff / (graphic[0].Npixels - 2);
     78  scale = 0xffff / (float) (MaxValue - 1);
    7679
    7780  /* greyscale */
    7881  if ((!strcasecmp (name, "grayscale")) || (!strcasecmp (name, "greyscale"))) {
    79     for (i = 0; i < graphic[0].Npixels - 1; i++) { 
     82    for (i = 0; i < MaxValue; i++) { 
    8083      SETVALUE (graphic[0].cmap[i].red,   0xffff - i*scale, 0, 0xffff);
    8184      SETVALUE (graphic[0].cmap[i].green, 0xffff - i*scale, 0, 0xffff);
     
    8790  /* -grayscale */
    8891  if ((!strcasecmp (name, "-grayscale")) || (!strcasecmp (name, "-greyscale"))) {
    89     for (i = 0; i < graphic[0].Npixels - 1; i++) { 
     92    for (i = 0; i < MaxValue; i++) { 
    9093      SETVALUE (graphic[0].cmap[i].red,   i*scale, 0, 0xffff);
    9194      SETVALUE (graphic[0].cmap[i].green, i*scale, 0, 0xffff);
     
    97100  /* heat */
    98101  if (!strcasecmp (name, "Heat")) {
    99     greenRef = 0.25*graphic[0].Npixels*scale*2.0;
    100     blueRef  = 0.50*graphic[0].Npixels*scale*2.0;
    101     for (i = 0; i < (int)(0.25*graphic[0].Npixels); i++) { 
     102    greenRef = 0.25*MaxValue*scale*2.0;
     103    blueRef  = 0.50*MaxValue*scale*2.0;
     104    for (i = 0; i < (int)(0.25*MaxValue); i++) { 
    102105      SETVALUE (graphic[0].cmap[i].red,   2*i*scale, 0, 0xffff);
    103106      graphic[0].cmap[i].green = 0;
     
    105108      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    106109    }
    107     for (i = 0.25*graphic[0].Npixels; i < 0.50*graphic[0].Npixels; i++) { 
     110    for (i = 0.25*MaxValue; i < 0.50*MaxValue; i++) { 
    108111      SETVALUE (graphic[0].cmap[i].red,   2*i*scale,            0, 0xffff);
    109112      SETVALUE (graphic[0].cmap[i].green, 2*i*scale - greenRef, 0, 0xffff);
     
    111114      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    112115    }
    113     for (i = (int)(0.50*graphic[0].Npixels); i < (int)(0.75*graphic[0].Npixels); i++) { 
     116    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 
    114117      graphic[0].cmap[i].red = 0xffff;
    115118      SETVALUE (graphic[0].cmap[i].green, 2*i*scale - greenRef, 0, 0xffff);
     
    117120      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    118121    }
    119     for (i = (int)(0.75*graphic[0].Npixels); i < graphic[0].Npixels - 1; i++) { 
     122    for (i = (int)(0.75*MaxValue); i < MaxValue; i++) { 
    120123      graphic[0].cmap[i].red   = 0xffff;
    121124      graphic[0].cmap[i].green = 0xffff;
     
    127130  /* rainbow */
    128131  if (!strcasecmp (name, "Rainbow")) {
    129     redRef   = 0.25*graphic[0].Npixels*scale*4.0;
    130     greenRef = 0.50*graphic[0].Npixels*scale*4.0;
    131     blueRef  = 0.50*graphic[0].Npixels*scale*4.0;
    132     for (i = 0; i < (int)(0.25*graphic[0].Npixels); i++) { 
     132    redRef   = 0.25*MaxValue*scale*4.0;
     133    greenRef = 0.50*MaxValue*scale*4.0;
     134    blueRef  = 0.50*MaxValue*scale*4.0;
     135    for (i = 0; i < (int)(0.25*MaxValue); i++) { 
    133136      graphic[0].cmap[i].red   = 0;
    134137      graphic[0].cmap[i].green = 0;
     
    136139      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    137140    }
    138     for (i = (int)(0.25*graphic[0].Npixels); i < (int)(0.50*graphic[0].Npixels); i++) { 
     141    for (i = (int)(0.25*MaxValue); i < (int)(0.50*MaxValue); i++) { 
    139142      SETVALUE (graphic[0].cmap[i].red,   4*i*scale - redRef,  0, 0xffff);
    140143      graphic[0].cmap[i].green = 0;
     
    142145      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    143146    }
    144     for (i = (int)(0.50*graphic[0].Npixels); i < (int)(0.75*graphic[0].Npixels); i++) { 
     147    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 
    145148      graphic[0].cmap[i].red  = 0xffff;
    146149      SETVALUE (graphic[0].cmap[i].green,  4*i*scale - greenRef, 0, 0xffff);
     
    148151      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    149152    }
    150     blueRef  = 0.75*graphic[0].Npixels*scale*4.0;
    151     for (i = (int)(0.75*graphic[0].Npixels); i < graphic[0].Npixels - 1; i++) { 
     153    // blue = blueScale * i + blueRef
     154    // blue = (0xffff - 0.0)*(i - MinValue) / (MaxValue - MinValue) + 0.0
     155    // blue = i * 0xffff / (MaxValue - MinValue) - 0xffff * MinValue / (MaxValue - MinValue)
     156    float iMin = (int)(0.75*MaxValue);
     157    float iMax = MaxValue - 1;
     158    float dB = 0xffff / (iMax - iMin);
     159    float oB = -0xffff * iMin / (iMax - iMin);
     160    for (i = iMin; i < MaxValue; i++) { 
    152161      graphic[0].cmap[i].red   = 0xffff;
    153162      graphic[0].cmap[i].green = 0xffff;
    154       SETVALUE (graphic[0].cmap[i].blue,  4*i*scale - blueRef, 0, 0xffff);
     163      SETVALUE (graphic[0].cmap[i].blue,  i*dB + oB, 0, 0xffff);
    155164      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
    156165    }
  • branches/czw_branch/20120906/Ohana/src/libautocode/def/measure-ps1-v4.d

    r34405 r34772  
    22EXTNAME      DVO_MEASURE_PS1_V4
    33TYPE         BINTABLE
    4 SIZE         176
     4SIZE         184
    55DESCRIPTION  DVO Detection Measurement Table
    66
     
    2929FIELD Xccd,           X_CCD,        float,          X coord on chip,               pixels
    3030FIELD Yccd,           Y_CCD,        float,          Y coord on chip,               pixels
     31
     32FIELD Xoff,           X_OFF,        float,          X correction in chip coords,   pixels
     33FIELD Yoff,           Y_OFF,        float,          Y correction in chip coords,   pixels
    3134
    3235# could these be packed into fewer bits?
  • branches/czw_branch/20120906/Ohana/src/libautocode/def/measure.d

    r34405 r34772  
    22EXTNAME      DVO_MEASURE
    33TYPE         BINTABLE
    4 SIZE         176
     4SIZE         184
    55DESCRIPTION  DVO Detection Measurement Table
    66
     
    2929FIELD Xccd,           X_CCD,        float,          X coord on chip,                pixels
    3030FIELD Yccd,           Y_CCD,        float,          Y coord on chip,                pixels
     31
     32FIELD Xoff,           X_OFF,        float,          X correction in chip coords,   pixels
     33FIELD Yoff,           Y_OFF,        float,          Y correction in chip coords,   pixels
    3134
    3235# could these be packed into fewer bits?
  • branches/czw_branch/20120906/Ohana/src/libautocode/def/secfilt-ps1-v4.d

    r34260 r34772  
    66
    77# elements of data structure / FITS table
    8 FIELD  M,           MAG,           float,      average mag in this band,              mags
    9 FIELD  Map,         MAG_AP,        float,      ave aperture mag in this band,         mags
    10 FIELD  Mkron,       MAG_KRON,      float,      ave kron mag in this band,             mags
    11 FIELD  dMkron,      MAG_KRON_ERR,  float,      formal error on average kron mag,      mags
    12 FIELD  dM,          MAG_ERR,       float,      formal error on average mag,           mags
    13 FIELD  Xm,          MAG_CHI,       float,      chisq on average mag,                  [100*log(value)]
    14 FIELD  FluxPSF,     FLUX_PSF,      float,      mean flux psf fit (PS1: stack)
    15 FIELD  dFluxPSF,    FLUX_PSF_ERR,  float,      mean flux psf error
    16 FIELD  FluxKron,    FLUX_KRON,     float,      mean flux kron ap (PS1: stack)
    17 FIELD  dFluxKron,   FLUX_KRON_ERR, float,      mean flux kron err
    18 FIELD  flags,       FLAGS,         uint32_t,   photometry flags
    19 FIELD  Ncode,       NCODE,         short,      number of detections in band
    20 FIELD  Nused,       NUSED,         short,      number of detections used in average
    21 FIELD  M_20,        MAG_20,        short,      lower 20percent mag,                   millimags
    22 FIELD  M_80,        MAG_80,        short,      upper 20percent mag,                   millimags
    23 FIELD  ubercalDist, UBERCAL_DIST,  short,      number of images from an ubercal-image
    24 FIELD  Mstdev,      MAG_STDEV,     short,      standard deviation of measurements,    millimags
    25 FIELD  stackID,     STACK_ID,      uint32_t,   image ID of stack used for fluxes (if any)
    26 FIELD  dummy,       DUMMY,         uint32_t,   padding
     8FIELD  M,             MAG,             float,      average mag in this band,              mags
     9FIELD  Map,           MAG_AP,          float,      ave aperture mag in this band,         mags
     10FIELD  Mkron,         MAG_KRON,        float,      ave kron mag in this band,             mags
     11FIELD  dMkron,        MAG_KRON_ERR,    float,      formal error on average kron mag,      mags
     12FIELD  dM,            MAG_ERR,         float,      formal error on average mag,           mags
     13FIELD  Xm,            MAG_CHI,         float,      chisq on average mag,                  [100*log(value)]
     14FIELD  FluxPSF,       FLUX_PSF,        float,      mean flux psf fit (PS1: stack)
     15FIELD  dFluxPSF,      FLUX_PSF_ERR,    float,      mean flux psf error
     16FIELD  FluxKron,      FLUX_KRON,       float,      mean flux kron ap (PS1: stack)
     17FIELD  dFluxKron,     FLUX_KRON_ERR,   float,      mean flux kron err
     18FIELD  flags,         FLAGS,           uint32_t,   photometry flags
     19FIELD  Ncode,         NCODE,           short,      number of detections in band
     20FIELD  Nused,         NUSED,           short,      number of detections used in average
     21FIELD  M_20,          MAG_20,          short,      lower 20percent mag,                   millimags
     22FIELD  M_80,          MAG_80,          short,      upper 20percent mag,                   millimags
     23FIELD  ubercalDist,   UBERCAL_DIST,    short,      number of images from an ubercal-image
     24FIELD  Mstdev,        MAG_STDEV,       short,      standard deviation of measurements,    millimags
     25FIELD  stackDetectID, STACK_DETECT_ID, uint64_t,   detection ID on stack used for fluxes (if any)
  • branches/czw_branch/20120906/Ohana/src/libautocode/def/secfilt.d

    r34260 r34772  
    66
    77# elements of data structure / FITS table
    8 FIELD  M,           MAG,           float,      average mag in this band,              mags
    9 FIELD  Map,         MAG,           float,      average mag in this band,              mags
    10 FIELD  Mkron,       MAG_KRON,      float,      ave kron mag in this band,             mags
    11 FIELD  dMkron,      MAG_KRON_ERR,  float,      formal error on average kron mag,      mags
    12 FIELD  dM,          MAG_ERR,       float,      formal error on average mag,           mags
    13 FIELD  Xm,          MAG_CHI,       float,      chisq on average mag,                  [100*log(value)]
    14 FIELD  FluxPSF,     FLUX_PSF,      float,      mean flux psf fit (PS1: stack)
    15 FIELD  dFluxPSF,    FLUX_PSF_ERR,  float,      mean flux psf error
    16 FIELD  FluxKron,    FLUX_KRON,     float,      mean flux kron ap (PS1: stack)
    17 FIELD  dFluxKron,   FLUX_KRON_ERR, float,      mean flux kron err
    18 FIELD  flags,       FLAGS,         uint32_t,   photometry flags
    19 FIELD  Ncode,       NCODE,         short,      number of detections in band
    20 FIELD  Nused,       NUSED,         short,      number of detections used in average
    21 FIELD  M_20,        MAG_20,        short,      lower 20percent mag,                   millimags
    22 FIELD  M_80,        MAG_80,        short,      upper 20percent mag,                   millimags
    23 FIELD  ubercalDist, UBERCAL_DIST,  short,      number of images from an ubercal-image
    24 FIELD  Mstdev,      MAG_STDEV,     short,      standard deviation of measurements,    millimags
    25 FIELD  stackID,     STACK_ID,      uint32_t,   image ID of stack used for fluxes (if any)
    26 FIELD  dummy,       DUMMY,         uint32_t,   padding
     8FIELD  M,             MAG,             float,      average mag in this band,              mags
     9FIELD  Map,           MAG,             float,      average mag in this band,              mags
     10FIELD  Mkron,         MAG_KRON,        float,      ave kron mag in this band,             mags
     11FIELD  dMkron,        MAG_KRON_ERR,    float,      formal error on average kron mag,      mags
     12FIELD  dM,            MAG_ERR,         float,      formal error on average mag,           mags
     13FIELD  Xm,            MAG_CHI,         float,      chisq on average mag,                  [100*log(value)]
     14FIELD  FluxPSF,       FLUX_PSF,        float,      mean flux psf fit (PS1: stack)
     15FIELD  dFluxPSF,      FLUX_PSF_ERR,    float,      mean flux psf error
     16FIELD  FluxKron,      FLUX_KRON,       float,      mean flux kron ap (PS1: stack)
     17FIELD  dFluxKron,     FLUX_KRON_ERR,   float,      mean flux kron err
     18FIELD  flags,         FLAGS,           uint32_t,   photometry flags
     19FIELD  Ncode,         NCODE,           short,      number of detections in band
     20FIELD  Nused,         NUSED,           short,      number of detections used in average
     21FIELD  M_20,          MAG_20,          short,      lower 20percent mag,                   millimags
     22FIELD  M_80,          MAG_80,          short,      upper 20percent mag,                   millimags
     23FIELD  ubercalDist,   UBERCAL_DIST,    short,      number of images from an ubercal-image
     24FIELD  Mstdev,        MAG_STDEV,       short,      standard deviation of measurements,    millimags
     25FIELD  stackDetectID, STACK_DETECT_ID, uint64_t,   detection ID on stack used for fluxes (if any)
    2726
    2827# *** 20090206 : new fields : M_20, M_80; dropped dummy
  • branches/czw_branch/20120906/Ohana/src/libdvo/doc/notes.txt

    r34260 r34772  
    1717
    18184) create a DVOTableFormat entry for the new format
    19    (libdvo/include/dvo.h).  the naming convetion is DVO_FORMAT_FOO.
     19   (libdvo/include/dvo.h).  the naming convention is DVO_FORMAT_FOO.
    2020
    21215) add an entry for the new format in dvo_catalog_catformat
  • branches/czw_branch/20120906/Ohana/src/libdvo/include/dvo.h

    r34405 r34772  
    131131  ID_MEAS_UNDEF_5        = 0x00004000,  // unused
    132132  ID_MEAS_PHOTOM_UBERCAL = 0x00008000,  // externally-supplied zero point from ubercal analysis
     133  ID_MEAS_STACK_PRIMARY  = 0x00010000,  // this stack measurement is in the primary skycell
     134  ID_MEAS_STACK_PHOT_SRC = 0x00020000,  // this measurement supplied the stack photometry
    133135} DVOMeasureFlags;
    134136
     
    149151/* Average.flags values -- these values are 32 bit (as of PS1_V1) */
    150152typedef enum {
    151   ID_STAR_FEW     = 0x00000001, // used within relphot: skip star
    152   ID_STAR_POOR    = 0x00000002, // used within relphot: skip star
    153   ID_PROPER       = 0x00000400, // star with large proper motion
    154   ID_TRANSIENT    = 0x00001000, // is this mutually exclusive with USNO?
    155   ID_VARIABLE     = 0x00002000, // not currently set?
    156   ID_ASTEROID     = 0x00002000, // identified with an asteroid
    157   ID_BAD_OBJECT   = 0x00004000, // if all measurements are bad, set this bit
    158   ID_MOVING       = 0x00008000, // is a moving object
    159   ID_ROCK         = 0x0000a000, // 0x8000 + 0x2000
    160   ID_GHOST        = 0x0000c001, // 0x8000 + 0x4000 + 0x0001
    161   ID_TRAIL        = 0x0000c002, // 0x8000 + 0x4000 + 0x0002
    162   ID_BLEED        = 0x0000c003, // 0x8000 + 0x4000 + 0x0003
    163   ID_COSMIC       = 0x0000c004, // 0x8000 + 0x4000 + 0x0004
    164   ID_STAR_FIT_AVE = 0x00010000, // average position fitted
    165   ID_STAR_FIT_PM  = 0x00020000, // proper motion fitted
    166   ID_STAR_FIT_PAR = 0x00040000, // parallax fitted
    167   ID_STAR_USE_AVE = 0x00080000, // average position used (not PM or PAR)
    168   ID_STAR_USE_PM  = 0x00100000, // proper motion used (not AVE or PAR)
    169   ID_STAR_USE_PAR = 0x00200000, // parallax used (not AVE or PM)
    170   ID_OBJ_EXT      = 0x01000000, // extended in our data (eg, PS)
    171   ID_OBJ_EXT_ALT  = 0x02000000, // extended in external data (eg, 2MASS)
    172   ID_OBJ_GOOD     = 0x04000000, // good-quality measurement in our data (eg,PS)
    173   ID_OBJ_GOOD_ALT = 0x08000000, // good-quality measurement in  external data (eg, 2MASS)
     153  ID_STAR_FEW       = 0x00000001, // used within relphot: skip star
     154  ID_STAR_POOR      = 0x00000002, // used within relphot: skip star
     155  ID_PROPER         = 0x00000400, // star with large proper motion
     156  ID_TRANSIENT      = 0x00001000, // is this mutually exclusive with USNO?
     157  ID_VARIABLE       = 0x00002000, // not currently set?
     158  ID_ASTEROID       = 0x00002000, // identified with an asteroid
     159  ID_BAD_OBJECT     = 0x00004000, // if all measurements are bad, set this bit
     160  ID_MOVING         = 0x00008000, // is a moving object
     161  ID_ROCK           = 0x0000a000, // 0x8000 + 0x2000
     162  ID_GHOST          = 0x0000c001, // 0x8000 + 0x4000 + 0x0001
     163  ID_TRAIL          = 0x0000c002, // 0x8000 + 0x4000 + 0x0002
     164  ID_BLEED          = 0x0000c003, // 0x8000 + 0x4000 + 0x0003
     165  ID_COSMIC         = 0x0000c004, // 0x8000 + 0x4000 + 0x0004
     166  ID_STAR_FIT_AVE   = 0x00010000, // average position fitted
     167  ID_STAR_FIT_PM    = 0x00020000, // proper motion fitted
     168  ID_STAR_FIT_PAR   = 0x00040000, // parallax fitted
     169  ID_STAR_USE_AVE   = 0x00080000, // average position used (not PM or PAR)
     170  ID_STAR_USE_PM    = 0x00100000, // proper motion used (not AVE or PAR)
     171  ID_STAR_USE_PAR   = 0x00200000, // parallax used (not AVE or PM)
     172  ID_STAR_NO_ASTROM = 0x00400000, // mean astrometry could not be measured
     173  ID_OBJ_EXT        = 0x01000000, // extended in our data (eg, PS)
     174  ID_OBJ_EXT_ALT    = 0x02000000, // extended in external data (eg, 2MASS)
     175  ID_OBJ_GOOD       = 0x04000000, // good-quality measurement in our data (eg,PS)
     176  ID_OBJ_GOOD_ALT   = 0x08000000, // good-quality measurement in  external data (eg, 2MASS)
     177  ID_OBJ_GOOD_STACK = 0x10000000, // good-quality object in the stack (> 1 good stack)
     178  ID_OBJ_SUSPECT_STACK = 0x20000000, // suspect object in the stack (> 1 good or suspect stack, < 2 good)
     179  ID_OBJ_BAD_STACK  = 0x40000000, // good-quality object in the stack (> 1 good stack)
    174180} DVOAverageFlags;
    175181
     
    180186  ID_SECF_USE_SYNTH   = 0x00000004, // synthetic photometry used in average measurement
    181187  ID_SECF_USE_UBERCAL = 0x00000008, // synthetic photometry used in average measurement
     188  ID_SECF_HAS_PS1     = 0x00000010, // PS1 photometry used in average measurement
     189  ID_SECF_HAS_STACK   = 0x00000020, // PS1 stack photometry exists
    182190  ID_PHOTOM_PASS_0    = 0x00000100, // average magnitude calculated in 0th pass
    183191  ID_PHOTOM_PASS_1    = 0x00000200, // average magnitude calculated in 1th pass
     
    185193  ID_PHOTOM_PASS_3    = 0x00000800, // average magnitude calculated in 3th pass
    186194  ID_PHOTOM_PASS_4    = 0x00001000, // average magnitude calculated in 4th pass
     195  ID_PSPS_OBJ_EXT     = 0x00002000, // In PSPS ID_SECF_OBJ_EXT is moved here so it fits within 16 bits
    187196  ID_SECF_OBJ_EXT     = 0x01000000, // extended in this band
    188197} DVOSecfiltFlags;
  • branches/czw_branch/20120906/Ohana/src/libdvo/include/dvodb.h

    r34260 r34772  
    4545      MAG_80,
    4646      MAG_UC_DIST,
    47       MAG_STACK_ID,
     47      MAG_STACK_DET_ID,
    4848      MAG_FLUX_PSF,
    4949      MAG_FLUX_PSF_ERR,
     
    122122      MEAS_XCCD_ERR,
    123123      MEAS_YCCD_ERR,
     124      MEAS_XOFF,
     125      MEAS_YOFF,
    124126      MEAS_POS_SYS_ERR,
    125127      MEAS_XMOSAIC,
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/LoadPhotcodes.c

    r28246 r34772  
    1111  }
    1212
     13  if (!master_file) return FALSE;
     14
    1315  /* next try to load the photcodes from the master text photcode file */
    1416  /* automatically (or on demand?) save the text file to the FITS version */
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/LoadPhotcodesFITS.c

    r34260 r34772  
    1616  /* XXX choose more sensible lock timeouts! */
    1717  db.lockstate = LCK_SOFT;
    18   db.timeout   = 10.0;
     18  db.timeout   = 60.0;
    1919  gfits_db_init (&db);
    2020
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dbExtractAverages.c

    r34405 r34772  
    242242          value.Flt = PhotUCdist (field->photcode, average, secfilt);
    243243          break;
    244         case MAG_STACK_ID:
     244        case MAG_STACK_DET_ID:
    245245          value.Int = PhotStackID (field->photcode, average, secfilt);
    246246          break;
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dbExtractMeasures.c

    r34405 r34772  
    385385      value.Flt = FromShortDegrees(measure[0].theta);
    386386      break;
     387
     388    case MEAS_POSANGLE: /* OK */
     389      value.Flt = FromShortDegrees(measure[0].posangle);
     390      break;
     391    case MEAS_PLATESCALE: /* OK */
     392      value.Flt = measure[0].pltscale;
     393      break;
     394
    387395    case MEAS_MXX: /* OK */
    388396      value.Flt = FromShortPixels(measure[0].Mxx);
     
    435443# endif
    436444      break;
     445    case MEAS_XOFF: /* OK */
     446      value.Flt = measure[0].Xoff;
     447      break;
     448    case MEAS_YOFF: /* OK */
     449      value.Flt = measure[0].Yoff;
     450      break;
    437451    case MEAS_XCCD_ERR: /* OK */
    438452      value.Flt = FromShortPixels(measure[0].dXccd);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dbFields.c

    r34405 r34772  
    5656  if (!strcasecmp (string, "80"))          return (MAG_80);
    5757  if (!strcasecmp (string, "ucdist"))      return (MAG_UC_DIST);
    58   if (!strcasecmp (string, "stackID"))     return (MAG_STACK_ID);
     58  if (!strcasecmp (string, "stackDetectID")) return (MAG_STACK_DET_ID);
    5959  if (!strcasecmp (string, "fluxpsf"))     return (MAG_FLUX_PSF);
    6060  if (!strcasecmp (string, "fluxpsferr"))  return (MAG_FLUX_PSF_ERR);
     
    217217  if (!strcasecmp (fieldName, "XCCD:ERR"))       ESCAPE (MEAS_XCCD_ERR,       MAG_NONE, OPIHI_FLT);
    218218  if (!strcasecmp (fieldName, "YCCD:ERR"))       ESCAPE (MEAS_YCCD_ERR,       MAG_NONE, OPIHI_FLT);
     219  if (!strcasecmp (fieldName, "XOFF"))           ESCAPE (MEAS_XOFF,           MAG_NONE, OPIHI_FLT);
     220  if (!strcasecmp (fieldName, "YOFF"))           ESCAPE (MEAS_YOFF,           MAG_NONE, OPIHI_FLT);
    219221  if (!strcasecmp (fieldName, "POS_SYS_ERR"))    ESCAPE (MEAS_POS_SYS_ERR,    MAG_NONE, OPIHI_FLT);
    220222  if (!strcasecmp (fieldName, "XMOSAIC"))        ESCAPE (MEAS_XMOSAIC,        MAG_NONE, OPIHI_FLT);
     
    228230  if (!strcasecmp (fieldName, "CATID"))          ESCAPE (MEAS_CAT_ID,         MAG_NONE, OPIHI_INT);
    229231  if (!strcasecmp (fieldName, "IMAGEID"))        ESCAPE (MEAS_IMAGE_ID,       MAG_NONE, OPIHI_INT);
     232  if (!strcasecmp (fieldName, "EXTERNID"))       ESCAPE (MEAS_EXTERN_ID,      MAG_NONE, OPIHI_INT);
    230233  if (!strcasecmp (fieldName, "PSF_QF"))         ESCAPE (MEAS_PSF_QF,         MAG_NONE, OPIHI_FLT);
    231234  if (!strcasecmp (fieldName, "PSF_QF_PERFECT")) ESCAPE (MEAS_PSF_QF_PERFECT, MAG_NONE, OPIHI_FLT);
     
    237240  if (!strcasecmp (fieldName, "SKY"))            ESCAPE (MEAS_SKY,            MAG_NONE, OPIHI_FLT);
    238241  if (!strcasecmp (fieldName, "SKY_ERR"))        ESCAPE (MEAS_dSKY,           MAG_NONE, OPIHI_FLT);
    239   if (!strcasecmp (fieldName, "externID"))       ESCAPE (MEAS_EXTERN_ID,      MAG_NONE, OPIHI_INT);
    240242  if (!strcasecmp (fieldName, "MCAL_OFFSET"))    ESCAPE (MEAS_MCAL_OFFSET,    MAG_NONE, OPIHI_FLT);
    241243  if (!strcasecmp (fieldName, "FLAT"))           ESCAPE (MEAS_FLAT,           MAG_NONE, OPIHI_FLT);
     
    260262  field->magMode = mode;
    261263  switch (mode) {
    262     case MAG_STACK_ID:
     264    case MAG_STACK_DET_ID:
    263265    case MAG_NCODE:
    264266    case MAG_NPHOT:
     
    351353  field->magMode = mode;
    352354  switch (mode) {
    353     case MAG_STACK_ID:
     355    case MAG_STACK_DET_ID:
    354356    case MAG_NCODE:
    355357    case MAG_NPHOT:
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_catalog.c

    r34405 r34772  
    8383  average->dP              = 0;
    8484
    85   average->ChiSqAve        = 0.0;
    86   average->ChiSqPM         = 0.0;
    87   average->ChiSqPar        = 0.0;
     85  average->ChiSqAve        = NAN;
     86  average->ChiSqPM         = NAN;
     87  average->ChiSqPar        = NAN;
    8888  average->Tmean           = 0;
    8989  average->Trange          = 0;
     90
     91  average->psfQF           = NAN;
     92  average->psfQFperf       = NAN;
    9093
    9194  average->stargal         = 0.0;
     
    131134  secfilt->ubercalDist = 1000;
    132135  secfilt->Mstdev      = NAN_S_SHORT;
    133   secfilt->stackID     = 0;
    134 
    135   secfilt->dummy       = 0;
     136  secfilt->stackDetectID     = 0;
    136137}
    137138
     
    160161 measure->Xccd      = NAN;
    161162 measure->Yccd      = NAN;
     163 measure->Xoff      = 0.0;
     164 measure->Yoff      = 0.0;
    162165
    163166 measure->Sky       = NAN;
     
    175178
    176179 measure->psfQF     = NAN;
     180 measure->psfQFperf = NAN;
    177181 measure->psfChisq  = NAN;
    178182 measure->psfNdof   = 0;
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_catalog_split.c

    r33963 r34772  
    8383    return (FALSE);
    8484  }
     85  off_t fullsize = catalog->header.datasize;
    8586
    8687  // write the PHU matrix; this is probably a NOP, do I have to keep it in?
     
    9192    return (FALSE);
    9293  }
     94  fullsize += matrix.datasize;
    9395  gfits_free_matrix (&matrix);
    9496
     
    98100    return (FALSE);
    99101  }
     102  fullsize += ftable->datasize + ftable->header->datasize;
     103
     104  // if the output file will be completely re-written, truncate to total datasize
     105  if ((start == 0) && (Nrows == Ntotal)) {
     106    int fd = fileno (catalog->f);
     107    if (ftruncate (fd, fullsize)) {
     108      perror ("dvo_catalog_save_subset: ");
     109      return (FALSE);
     110    }
     111  }
     112
    100113  return (TRUE);
    101114}
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r34405 r34772  
    1111
    1212  for (i = 0; i < Nvalues; i++) {
     13    dvo_measure_init (&out[i]);
    1314    out[i].dR         = in[i].dR;
    1415    out[i].dD         = in[i].dD;
     
    4041    out[i].photFlags  = in[i].photFlags;
    4142
    42     // changed or added for PS1_DEV_2
     43    // changed for PS1_DEV_2
    4344    out[i].Map        = in[i].Mgal;
    44     out[i].dMcal      = 0;
    45 
    46     // changed or added for PS1_V1
     45
     46    // changed for PS1_V1
    4747    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
    48     out[i].t_msec     = 0;
    49     out[i].extID      = 0;
    50     out[i].objID      = 0;
    51     out[i].catID      = 0;
    52     out[i].Mxx        = 0.0;
    53     out[i].Mxy        = 0.0;
    54     out[i].Myy        = 0.0;
    55     out[i].posangle   = 0;
    56     out[i].pltscale   = 0;
    57     out[i].psfNdof    = 0;
    58     out[i].psfNpix    = 0;
    59 
    60     // added for PS1_V4
    61     out[i].Mkron      = NAN;
    62     out[i].dMkron     = NAN;
    63     out[i].FluxPSF    = NAN;
    64     out[i].dFluxPSF   = NAN;
    65     out[i].FluxKron   = NAN;
    66     out[i].dFluxKron  = NAN;
    67     out[i].psfQFperf  = NAN;
    6848  }
    6949  return (out);
     
    125105
    126106  for (i = 0; i < Nvalues; i++) {
     107    dvo_average_init (&out[i]);
     108
    127109    out[i].R             = in[i].R;     
    128110    out[i].D             = in[i].D;     
     
    138120    out[i].catID         = in[i].catID;
    139121
    140     // changed or added for PS1_DEV_2
     122    // changed for PS1_DEV_2
    141123    out[i].Nmeasure      = in[i].Nm;     
    142124    out[i].Nmissing      = in[i].Nn;     
    143125    out[i].measureOffset = in[i].offset;
    144126    out[i].missingOffset = in[i].missing;
    145     out[i].Nextend       = 0;
    146     out[i].extendOffset  = 0;
    147 
    148     // changed or added for PS1_V1
     127
     128    // changed for PS1_V1
    149129    out[i].flags         = in[i].code;   
    150     out[i].ChiSqAve      = NAN;
    151     out[i].ChiSqPM       = NAN;
    152     out[i].ChiSqPar      = NAN;
    153     out[i].Tmean         = 0;
    154     out[i].Trange        = 0;
    155     out[i].Npos          = 0.0;
    156     out[i].extID         = 0;
    157 
    158     // added in PS1_V3
    159     out[i].photFlagsUpper = 0;
    160     out[i].photFlagsLower = 0;
    161 
    162     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    163     out[i].psfQF         = NAN;
    164     out[i].psfQFperf     = NAN;
    165     out[i].stargal       = NAN;
     130
     131    // PS1_V4 : Xp dropped in V4 onward, was not really used anyway
    166132  }
    167133  return (out);
     
    210176
    211177  for (i = 0; i < Nvalues; i++) {
     178    dvo_secfilt_init (&out[i]);
     179
    212180    out[i].M     = in[i].M;     
    213181    out[i].dM    = in[i].dM;     
     
    215183    out[i].Ncode = in[i].Ncode;
    216184    out[i].Nused = in[i].Nused;
    217 
    218     // changed or added for PS1_V1
    219     out[i].M_20  = 0;     
    220     out[i].M_80  = 0;     
    221 
    222     // changed or added for PS1_V2
    223     out[i].flags = 0;
    224 
    225     // added in PS1_V3
    226     out[i].Map         = 0;
    227     out[i].Mstdev      = 0;
    228     out[i].ubercalDist = 0;
    229 
    230     // added for PS1_V4
    231     out[i].Mkron       = NAN;
    232     out[i].dMkron      = NAN;
    233     out[i].FluxPSF     = NAN;
    234     out[i].dFluxPSF    = NAN;
    235     out[i].FluxKron    = NAN;
    236     out[i].dFluxKron   = NAN;
    237     out[i].stackID     = 0;
    238185 }
    239186  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r34405 r34772  
    1111
    1212  for (i = 0; i < Nvalues; i++) {
     13    dvo_measure_init (&out[i]);
    1314    out[i].dR         = in[i].dR;
    1415    out[i].dD         = in[i].dD;
     
    4142    out[i].dbFlags    = in[i].dbFlags;
    4243
    43     // changed or added for PS1_V1
     44    // changed for PS1_V1
    4445    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
    45     out[i].t_msec     = 0;
    46     out[i].extID      = 0;
    47     out[i].objID      = 0;
    48     out[i].catID      = 0;
    49     out[i].Mxx        = 0.0;
    50     out[i].Mxy        = 0.0;
    51     out[i].Myy        = 0.0;
    52     out[i].posangle   = 0;
    53     out[i].pltscale   = 0;
    54     out[i].psfNdof    = 0;
    55     out[i].psfNpix    = 0;
    56 
    57     // added for PS1_V4
    58     out[i].Mkron      = NAN;
    59     out[i].dMkron     = NAN;
    60     out[i].FluxPSF    = NAN;
    61     out[i].dFluxPSF   = NAN;
    62     out[i].FluxKron   = NAN;
    63     out[i].dFluxKron  = NAN;
    64     out[i].psfQFperf  = NAN;
    6546 }
    6647  return (out);
     
    121102
    122103  for (i = 0; i < Nvalues; i++) {
     104    dvo_average_init (&out[i]);
     105
    123106    out[i].R             = in[i].R;     
    124107    out[i].D             = in[i].D;     
     
    140123    out[i].catID         = in[i].catID;
    141124
    142     // changed or added for PS1_V1
     125    // changed for PS1_V1
    143126    out[i].flags         = in[i].code;   
    144     out[i].ChiSqAve      = NAN;
    145     out[i].ChiSqPM       = NAN;
    146     out[i].ChiSqPar      = NAN;
    147     out[i].Tmean         = 0;
    148     out[i].Trange        = 0;
    149     out[i].Npos          = 0.0;
    150     out[i].extID         = 0;
    151 
    152     // added in PS1_V3
    153     out[i].photFlagsUpper = 0;
    154     out[i].photFlagsLower = 0;
    155 
    156     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    157     out[i].psfQF         = NAN;
    158     out[i].psfQFperf     = NAN;
    159     out[i].stargal       = NAN;
    160127  }
    161128  return (out);
     
    204171
    205172  for (i = 0; i < Nvalues; i++) {
     173    dvo_secfilt_init (&out[i]);
     174
    206175    out[i].M     = in[i].M;     
    207176    out[i].dM    = in[i].dM;     
     
    209178    out[i].Ncode = in[i].Ncode;
    210179    out[i].Nused = in[i].Nused;
    211 
    212     // changed or added for PS1_V1
    213     out[i].M_20  = 0;     
    214     out[i].M_80  = 0;     
    215 
    216     // changed or added for PS1_V2
    217     out[i].flags = 0;
    218 
    219     // added in PS1_V3
    220     out[i].Map         = 0;
    221     out[i].Mstdev      = 0;
    222     out[i].ubercalDist = 0;
    223 
    224     // added for PS1_V4
    225     out[i].Mkron       = NAN;
    226     out[i].dMkron      = NAN;
    227     out[i].FluxPSF     = NAN;
    228     out[i].dFluxPSF    = NAN;
    229     out[i].FluxKron    = NAN;
    230     out[i].dFluxKron   = NAN;
    231     out[i].stackID     = 0;
    232180 }
    233181  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c

    r34405 r34772  
    1111
    1212  for (i = 0; i < Nvalues; i++) {
     13    dvo_measure_init (&out[i]);
     14
    1315    out[i].dR         = in[i].dR;
    1416    out[i].dD         = in[i].dD;
    1517    out[i].M          = in[i].M;
    16     out[i].Mcal       = 0.0;
    17     out[i].Map        = NAN;
    1818    out[i].dM         = in[i].dM;
    19     out[i].dMcal      = 0.0;
    2019    out[i].dt         = in[i].dt;
    21     out[i].airmass    = NAN;
    22     out[i].az         = NAN;
    23     out[i].Xccd       = NAN;
    24     out[i].Yccd       = NAN;
    25     out[i].Sky        = NAN;
    26     out[i].dSky       = NAN;
    2720    out[i].t          = in[i].t;
    28     out[i].t_msec     = 0;
    2921    out[i].averef     = in[i].averef;
    30     out[i].detID      = 0;
    31     out[i].imageID    = 0;
    3222    out[i].objID      = in[i].objID;
    3323    out[i].catID      = in[i].catID;
    34     out[i].extID      = 0;
    3524    out[i].psfQF      = 1.0; // we do not save a value, but some operations (relphot/average) filter on this value..
    36     out[i].psfChisq   = NAN;
    37     out[i].psfNdof    = 0;
    38     out[i].psfNpix    = 0;
    39     out[i].crNsigma   = NAN;
    40     out[i].extNsigma  = NAN;
    41     out[i].FWx        = 0;
    42     out[i].FWy        = 0;
    43     out[i].theta      = 0;
    44     out[i].Mxx        = 0;
    45     out[i].Mxy        = 0;
    46     out[i].Myy        = 0;
    47     out[i].dXccd      = 0;
    48     out[i].dYccd      = 0;
    49     out[i].posangle   = 0;
    50     out[i].pltscale   = NAN;
    5125    out[i].photcode   = in[i].photcode;
    52     out[i].dbFlags    = 0;
    53     out[i].photFlags  = 0;
    54 
    55     // added for PS1_V4
    56     out[i].Mkron      = NAN;
    57     out[i].dMkron     = NAN;
    58     out[i].FluxPSF    = NAN;
    59     out[i].dFluxPSF   = NAN;
    60     out[i].FluxKron   = NAN;
    61     out[i].dFluxKron  = NAN;
    62     out[i].psfQFperf  = NAN;
    6326  }
    6427  return (out);
     
    9659
    9760  for (i = 0; i < Nvalues; i++) {
     61    dvo_average_init (&out[i]);
     62
    9863    out[i].R             = in[i].R;     
    9964    out[i].D             = in[i].D;     
    10065    out[i].dR            = in[i].dR;
    10166    out[i].dD            = in[i].dD;
    102     out[i].uR            = NAN;
    103     out[i].uD            = NAN;
    104     out[i].duR           = NAN;
    105     out[i].duD           = NAN;
    106     out[i].P             = NAN;
    107     out[i].dP            = NAN;
    108     out[i].ChiSqAve      = NAN;
    109     out[i].ChiSqPM       = NAN;
    110     out[i].ChiSqPar      = NAN;
    111     out[i].Tmean         = 0;
    112     out[i].Trange        = 0;
    113     out[i].Npos          = 0;
    11467    out[i].Nmeasure      = in[i].Nmeasure;     
    11568    out[i].Nmissing      = in[i].Nmissing;     
    116     out[i].Nextend       = 0;
    11769    out[i].measureOffset = in[i].measureOffset;
    11870    out[i].missingOffset = in[i].missingOffset;
    119     out[i].extendOffset  = 0;
    120     out[i].flags         = 0;
    12171    out[i].objID         = in[i].objID;
    12272    out[i].catID         = in[i].catID;
    123     out[i].extID         = 0;
    124 
    125     // added in PS1_V3
    126     out[i].photFlagsUpper = 0;
    127     out[i].photFlagsLower = 0;
    128 
    129     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    130     out[i].psfQF         = NAN;
    131     out[i].psfQFperf     = NAN;
    132     out[i].stargal       = NAN;
    13373  }
    13474  return (out);
     
    167107
    168108  for (i = 0; i < Nvalues; i++) {
     109    dvo_secfilt_init (&out[i]);
     110
    169111    out[i].M     = in[i].M;     
    170112    out[i].dM    = in[i].dM;     
    171     out[i].Xm    = NAN_S_SHORT;
    172     out[i].Ncode = 0;
    173     out[i].Nused = 0;
    174     out[i].M_20  = 0;
    175     out[i].M_80  = 0;
    176 
    177     // changed or added for PS1_V2
    178     out[i].flags = 0;
    179 
    180     // added in PS1_V3
    181     out[i].Map         = 0;
    182     out[i].Mstdev      = 0;
    183     out[i].ubercalDist = 0;
    184 
    185     // added for PS1_V4
    186     out[i].Mkron       = NAN;
    187     out[i].dMkron      = NAN;
    188     out[i].FluxPSF     = NAN;
    189     out[i].dFluxPSF    = NAN;
    190     out[i].FluxKron    = NAN;
    191     out[i].dFluxKron   = NAN;
    192     out[i].stackID     = 0;
    193113 }
    194114  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c

    r34405 r34772  
    1111
    1212  for (i = 0; i < Nvalues; i++) {
     13    dvo_measure_init (&out[i]);
     14
    1315    out[i].dR         = in[i].dR;
    1416    out[i].dD         = in[i].dD;
     
    5254    out[i].dbFlags    = in[i].dbFlags;
    5355    out[i].photFlags  = in[i].photFlags;
    54 
    55     // added for PS1_V4
    56     out[i].Mkron      = NAN;
    57     out[i].dMkron     = NAN;
    58     out[i].FluxPSF    = NAN;
    59     out[i].dFluxPSF   = NAN;
    60     out[i].FluxKron   = NAN;
    61     out[i].dFluxKron  = NAN;
    62     out[i].psfQFperf  = NAN;
    6356  }
    6457  return (out);
     
    128121
    129122  for (i = 0; i < Nvalues; i++) {
     123    dvo_average_init (&out[i]);
     124
    130125    out[i].R             = in[i].R;     
    131126    out[i].D             = in[i].D;     
     
    139134    out[i].dP            = in[i].dP;
    140135    out[i].ChiSqAve      = in[i].ChiSq;     
    141     out[i].ChiSqPM       = NAN;
    142     out[i].ChiSqPar      = NAN;
    143     out[i].Tmean         = 0;
    144     out[i].Trange        = 0;
    145136    out[i].Npos          = in[i].Npos;     
    146137    out[i].Nmeasure      = in[i].Nmeasure;     
     
    154145    out[i].catID         = in[i].catID;
    155146    out[i].extID         = in[i].extID;
    156 
    157     // added in PS1_V3
    158     out[i].photFlagsUpper = 0;
    159     out[i].photFlagsLower = 0;
    160 
    161     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    162     out[i].psfQF         = NAN;
    163     out[i].psfQFperf     = NAN;
    164     out[i].stargal       = NAN;
    165147  }
    166148  return (out);
     
    210192
    211193  for (i = 0; i < Nvalues; i++) {
     194    dvo_secfilt_init (&out[i]);
     195
    212196    out[i].M     = in[i].M;     
    213197    out[i].dM    = in[i].dM;     
     
    217201    out[i].M_20  = in[i].M_20;     
    218202    out[i].M_80  = in[i].M_80;     
    219 
    220     // changed or added for PS1_V2
    221     out[i].flags = 0;
    222 
    223     // added in PS1_V3
    224     out[i].Map         = 0;
    225     out[i].Mstdev      = 0;
    226     out[i].ubercalDist = 0;
    227 
    228     // added for PS1_V4
    229     out[i].Mkron       = NAN;
    230     out[i].dMkron      = NAN;
    231     out[i].FluxPSF     = NAN;
    232     out[i].dFluxPSF    = NAN;
    233     out[i].FluxKron    = NAN;
    234     out[i].dFluxKron   = NAN;
    235     out[i].stackID     = 0;
    236203 }
    237204  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c

    r34405 r34772  
    1111
    1212  for (i = 0; i < Nvalues; i++) {
     13    dvo_measure_init (&out[i]);
     14
    1315    out[i].dR         = in[i].dR;
    1416    out[i].dD         = in[i].dD;
     
    5355    out[i].dbFlags    = in[i].dbFlags;
    5456    out[i].photFlags  = in[i].photFlags;
    55 
    56     // added for PS1_V4
    57     out[i].Mkron      = NAN;
    58     out[i].dMkron     = NAN;
    59     out[i].FluxPSF    = NAN;
    60     out[i].dFluxPSF   = NAN;
    61     out[i].FluxKron   = NAN;
    62     out[i].dFluxKron  = NAN;
    63     out[i].psfQFperf  = NAN;
    6457  }
    6558  return (out);
     
    129122
    130123  for (i = 0; i < Nvalues; i++) {
     124    dvo_average_init (&out[i]);
     125
    131126    out[i].R             = in[i].R;     
    132127    out[i].D             = in[i].D;     
     
    155150    out[i].catID         = in[i].catID;
    156151    out[i].extID         = in[i].extID;
    157 
    158     // added in PS1_V3
    159     out[i].photFlagsUpper = 0;
    160     out[i].photFlagsLower = 0;
    161 
    162     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    163     out[i].psfQF         = NAN;
    164     out[i].psfQFperf     = NAN;
    165     out[i].stargal       = NAN;
    166152  }
    167153  return (out);
     
    215201
    216202  for (i = 0; i < Nvalues; i++) {
     203    dvo_secfilt_init (&out[i]);
     204
    217205    out[i].M     = in[i].M;     
    218206    out[i].dM    = in[i].dM;     
     
    223211    out[i].M_20  = in[i].M_20;     
    224212    out[i].M_80  = in[i].M_80;     
    225 
    226     // added in PS1_V3
    227     out[i].Map         = 0;
    228     out[i].Mstdev      = 0;
    229     out[i].ubercalDist = 0;
    230 
    231     // added for PS1_V4
    232     out[i].Mkron       = NAN;
    233     out[i].dMkron      = NAN;
    234     out[i].FluxPSF     = NAN;
    235     out[i].dFluxPSF    = NAN;
    236     out[i].FluxKron    = NAN;
    237     out[i].dFluxKron   = NAN;
    238     out[i].stackID     = 0;
    239213 }
    240214  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c

    r34405 r34772  
    1111
    1212  for (i = 0; i < Nvalues; i++) {
     13    dvo_measure_init (&out[i]);
     14
    1315    out[i].dR         = in[i].dR;
    1416    out[i].dD         = in[i].dD;
     
    5355    out[i].dbFlags    = in[i].dbFlags;
    5456    out[i].photFlags  = in[i].photFlags;
    55 
    56     // added for PS1_V4
    57     out[i].Mkron      = NAN;
    58     out[i].dMkron     = NAN;
    59     out[i].FluxPSF    = NAN;
    60     out[i].dFluxPSF   = NAN;
    61     out[i].FluxKron   = NAN;
    62     out[i].dFluxKron  = NAN;
    63     out[i].psfQFperf  = NAN;
    6457  }
    6558  return (out);
     
    129122
    130123  for (i = 0; i < Nvalues; i++) {
     124    dvo_average_init (&out[i]);
     125
    131126    out[i].R             = in[i].R;     
    132127    out[i].D             = in[i].D;     
     
    157152    out[i].catID         = in[i].catID;
    158153    out[i].extID         = in[i].extID;
    159 
    160     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    161     out[i].psfQF         = NAN;
    162     out[i].psfQFperf     = NAN;
    163     out[i].stargal       = NAN;
    164154  }
    165155  return (out);
     
    215205
    216206  for (i = 0; i < Nvalues; i++) {
     207    dvo_secfilt_init (&out[i]);
     208
    217209    out[i].M           = in[i].M;     
    218210    out[i].Map         = in[i].Map;     
     
    226218    out[i].Mstdev      = in[i].Mstdev;     
    227219    out[i].ubercalDist = in[i].ubercalDist;     
    228 
    229     // added for PS1_V4
    230     out[i].Mkron       = NAN;
    231     out[i].dMkron      = NAN;
    232     out[i].FluxPSF     = NAN;
    233     out[i].dFluxPSF    = NAN;
    234     out[i].FluxKron    = NAN;
    235     out[i].dFluxKron   = NAN;
    236     out[i].stackID     = 0;
    237220 }
    238221  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c

    r34405 r34772  
    99
    1010  ALLOCATE_ZERO (out, Measure, Nvalues);
     11
     12  for (i = 0; i < Nvalues; i++) {
     13    dvo_measure_init (&out[i]);
     14
     15    out[i].dR         = in[i].dR;
     16    out[i].dD         = in[i].dD;
     17    out[i].M          = in[i].M;
     18    out[i].Mcal       = in[i].Mcal;
     19    out[i].Map        = in[i].Map;
     20    out[i].Mkron      = in[i].Mkron;
     21    out[i].dMkron     = in[i].dMkron;
     22    out[i].dM         = in[i].dM;
     23    out[i].dMcal      = in[i].dMcal;
     24    out[i].dt         = in[i].dt;
     25    out[i].FluxPSF    = in[i].FluxPSF;
     26    out[i].dFluxPSF   = in[i].dFluxPSF;
     27    out[i].FluxKron   = in[i].FluxKron;
     28    out[i].dFluxKron  = in[i].dFluxKron;
     29    out[i].airmass    = in[i].airmass;
     30    out[i].az         = in[i].az;
     31    out[i].Xccd       = in[i].Xccd;
     32    out[i].Yccd       = in[i].Yccd;
     33    out[i].Xoff       = in[i].Xoff;
     34    out[i].Yoff       = in[i].Yoff;
     35    out[i].Sky        = in[i].Sky;
     36    out[i].dSky       = in[i].dSky;
     37    out[i].t          = in[i].t;
     38    out[i].t_msec     = in[i].t_msec;
     39    out[i].averef     = in[i].averef;
     40    out[i].detID      = in[i].detID;
     41    out[i].imageID    = in[i].imageID;
     42    out[i].objID      = in[i].objID;
     43    out[i].catID      = in[i].catID;
     44    out[i].extID      = in[i].extID;
     45    out[i].psfQF      = in[i].psfQF;
     46    out[i].psfQFperf  = in[i].psfQFperf;
     47    out[i].psfChisq   = in[i].psfChisq;
     48    out[i].psfNdof    = in[i].psfNdof;
     49    out[i].psfNpix    = in[i].psfNpix;
     50    out[i].crNsigma   = in[i].crNsigma;
     51    out[i].extNsigma  = in[i].extNsigma;
     52    out[i].FWx        = in[i].FWx;
     53    out[i].FWy        = in[i].FWy;
     54    out[i].theta      = in[i].theta;
     55    out[i].Mxx        = in[i].Mxx;
     56    out[i].Mxy        = in[i].Mxy;
     57    out[i].Myy        = in[i].Myy;
     58    out[i].dXccd      = in[i].dXccd;
     59    out[i].dYccd      = in[i].dYccd;
     60    out[i].dRsys      = in[i].dRsys;
     61    out[i].posangle   = in[i].posangle;
     62    out[i].pltscale   = in[i].pltscale;
     63    out[i].photcode   = in[i].photcode;
     64    out[i].dbFlags    = in[i].dbFlags;
     65    out[i].photFlags  = in[i].photFlags;
     66  }
     67  return (out);
     68}
     69
     70Measure_PS1_V4 *MeasureInternalTo_PS1_V4 (Measure *in, off_t Nvalues) {
     71
     72  off_t i;
     73  Measure_PS1_V4 *out;
     74
     75  ALLOCATE_ZERO (out, Measure_PS1_V4, Nvalues);
    1176
    1277  for (i = 0; i < Nvalues; i++) {
     
    64129}
    65130
    66 Measure_PS1_V4 *MeasureInternalTo_PS1_V4 (Measure *in, off_t Nvalues) {
    67 
    68   off_t i;
    69   Measure_PS1_V4 *out;
    70 
    71   ALLOCATE_ZERO (out, Measure_PS1_V4, Nvalues);
    72 
    73   for (i = 0; i < Nvalues; i++) {
    74     out[i].dR         = in[i].dR;
    75     out[i].dD         = in[i].dD;
    76     out[i].M          = in[i].M;
    77     out[i].Mcal       = in[i].Mcal;
    78     out[i].Map        = in[i].Map;
    79     out[i].Mkron      = in[i].Mkron;
    80     out[i].dMkron     = in[i].dMkron;
    81     out[i].dM         = in[i].dM;
    82     out[i].dMcal      = in[i].dMcal;
    83     out[i].dt         = in[i].dt;
    84     out[i].FluxPSF    = in[i].FluxPSF;
    85     out[i].dFluxPSF   = in[i].dFluxPSF;
    86     out[i].FluxKron   = in[i].FluxKron;
    87     out[i].dFluxKron  = in[i].dFluxKron;
    88     out[i].airmass    = in[i].airmass;
    89     out[i].az         = in[i].az;
    90     out[i].Xccd       = in[i].Xccd;
    91     out[i].Yccd       = in[i].Yccd;
    92     out[i].Sky        = in[i].Sky;
    93     out[i].dSky       = in[i].dSky;
    94     out[i].t          = in[i].t;
    95     out[i].t_msec     = in[i].t_msec;
    96     out[i].averef     = in[i].averef;
    97     out[i].detID      = in[i].detID;
    98     out[i].imageID    = in[i].imageID;
    99     out[i].objID      = in[i].objID;
    100     out[i].catID      = in[i].catID;
    101     out[i].extID      = in[i].extID;
    102     out[i].psfQF      = in[i].psfQF;
    103     out[i].psfQFperf  = in[i].psfQFperf;
    104     out[i].psfChisq   = in[i].psfChisq;
    105     out[i].psfNdof    = in[i].psfNdof;
    106     out[i].psfNpix    = in[i].psfNpix;
    107     out[i].crNsigma   = in[i].crNsigma;
    108     out[i].extNsigma  = in[i].extNsigma;
    109     out[i].FWx        = in[i].FWx;
    110     out[i].FWy        = in[i].FWy;
    111     out[i].theta      = in[i].theta;
    112     out[i].Mxx        = in[i].Mxx;
    113     out[i].Mxy        = in[i].Mxy;
    114     out[i].Myy        = in[i].Myy;
    115     out[i].dXccd      = in[i].dXccd;
    116     out[i].dYccd      = in[i].dYccd;
    117     out[i].dRsys      = in[i].dRsys;
    118     out[i].posangle   = in[i].posangle;
    119     out[i].pltscale   = in[i].pltscale;
    120     out[i].photcode   = in[i].photcode;
    121     out[i].dbFlags    = in[i].dbFlags;
    122     out[i].photFlags  = in[i].photFlags;
    123   }
    124   return (out);
    125 }
    126 
    127131// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
    128132Average *Average_PS1_V4_ToInternal (Average_PS1_V4 *in, off_t Nvalues, SecFilt **primary) {
     
    134138
    135139  for (i = 0; i < Nvalues; i++) {
     140    dvo_average_init (&out[i]);
     141
    136142    out[i].R             = in[i].R;     
    137143    out[i].D             = in[i].D;     
     
    221227
    222228  for (i = 0; i < Nvalues; i++) {
    223     out[i].M           = in[i].M;     
    224     out[i].Map         = in[i].Map;     
    225     out[i].Mkron       = in[i].Mkron;     
    226     out[i].dMkron      = in[i].dMkron;     
    227     out[i].dM          = in[i].dM;     
    228     out[i].Xm          = in[i].Xm;     
    229     out[i].FluxPSF     = in[i].FluxPSF;
    230     out[i].dFluxPSF    = in[i].dFluxPSF;
    231     out[i].FluxKron    = in[i].FluxKron;
    232     out[i].dFluxKron   = in[i].dFluxKron;
    233     out[i].flags       = in[i].flags;     
    234     out[i].Ncode       = in[i].Ncode;
    235     out[i].Nused       = in[i].Nused;
    236     out[i].M_20        = in[i].M_20;     
    237     out[i].M_80        = in[i].M_80;     
    238     out[i].Mstdev      = in[i].Mstdev;     
    239     out[i].ubercalDist = in[i].ubercalDist;     
    240     out[i].stackID     = in[i].stackID;     
     229    dvo_secfilt_init (&out[i]);
     230
     231    out[i].M             = in[i].M;     
     232    out[i].Map           = in[i].Map;     
     233    out[i].Mkron         = in[i].Mkron;     
     234    out[i].dMkron        = in[i].dMkron;     
     235    out[i].dM            = in[i].dM;     
     236    out[i].Xm            = in[i].Xm;     
     237    out[i].FluxPSF       = in[i].FluxPSF;
     238    out[i].dFluxPSF      = in[i].dFluxPSF;
     239    out[i].FluxKron      = in[i].FluxKron;
     240    out[i].dFluxKron     = in[i].dFluxKron;
     241    out[i].flags         = in[i].flags;     
     242    out[i].Ncode         = in[i].Ncode;
     243    out[i].Nused         = in[i].Nused;
     244    out[i].M_20          = in[i].M_20;     
     245    out[i].M_80          = in[i].M_80;     
     246    out[i].Mstdev        = in[i].Mstdev;     
     247    out[i].ubercalDist   = in[i].ubercalDist;     
     248    out[i].stackDetectID = in[i].stackDetectID;     
    241249 }
    242250  return (out);
     
    251259
    252260  for (i = 0; i < Nvalues; i++) {
    253     out[i].M           = in[i].M;     
    254     out[i].Map         = in[i].Map;     
    255     out[i].Mkron       = in[i].Mkron;     
    256     out[i].dMkron      = in[i].dMkron;     
    257     out[i].dM          = in[i].dM;     
    258     out[i].Xm          = in[i].Xm;     
    259     out[i].FluxPSF     = in[i].FluxPSF;
    260     out[i].dFluxPSF    = in[i].dFluxPSF;
    261     out[i].FluxKron    = in[i].FluxKron;
    262     out[i].dFluxKron   = in[i].dFluxKron;
    263     out[i].flags       = in[i].flags;     
    264     out[i].Ncode       = in[i].Ncode;
    265     out[i].Nused       = in[i].Nused;
    266     out[i].M_20        = in[i].M_20;     
    267     out[i].M_80        = in[i].M_80;     
    268     out[i].Mstdev      = in[i].Mstdev;     
    269     out[i].ubercalDist = in[i].ubercalDist;     
    270     out[i].stackID     = in[i].stackID;     
     261    out[i].M             = in[i].M;     
     262    out[i].Map           = in[i].Map;     
     263    out[i].Mkron         = in[i].Mkron;     
     264    out[i].dMkron        = in[i].dMkron;     
     265    out[i].dM            = in[i].dM;     
     266    out[i].Xm            = in[i].Xm;     
     267    out[i].FluxPSF       = in[i].FluxPSF;
     268    out[i].dFluxPSF      = in[i].dFluxPSF;
     269    out[i].FluxKron      = in[i].FluxKron;
     270    out[i].dFluxKron     = in[i].dFluxKron;
     271    out[i].flags         = in[i].flags;     
     272    out[i].Ncode         = in[i].Ncode;
     273    out[i].Nused         = in[i].Nused;
     274    out[i].M_20          = in[i].M_20;     
     275    out[i].M_80          = in[i].M_80;     
     276    out[i].Mstdev        = in[i].Mstdev;     
     277    out[i].ubercalDist   = in[i].ubercalDist;     
     278    out[i].stackDetectID = in[i].stackDetectID;
    271279  }
    272280  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r34405 r34772  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
     12    dvo_measure_init (&out[i]);
    1213    out[i].FWx      = in[i].FWx;
    1314    out[i].t        = in[i].t;
     
    2829   
    2930    // added for PANSTARRS_DEV_0
    30     out[i].Xccd      = 0;  // determine on-the-fly
    31     out[i].Yccd      = 0;  // determine on-the-fly
    32     out[i].dXccd     = 0;
    33     out[i].dYccd     = 0;
    34     out[i].az        = 0;
    35     out[i].Sky       = 0;
    36     out[i].dSky      = 0;
    37     out[i].psfQF     = 0;
    38     out[i].psfChisq  = 0;
    39     out[i].crNsigma  = 0;
    40     out[i].extNsigma = 0;
    41     out[i].detID     = 0;  // determine on-the-fly
    42     out[i].imageID   = 0;  // determine on-the-fly
    43 
    44     // changed or added for PS1_DEV_1 (2008.02.26)
     31    // out[i].Xccd      = 0;  // determine on-the-fly
     32    // out[i].Yccd      = 0;  // determine on-the-fly
     33    // out[i].detID     = 0;  // determine on-the-fly
     34    // out[i].imageID   = 0;  // determine on-the-fly
     35
     36    // changed for PS1_DEV_1 (2008.02.26)
    4537    out[i].dbFlags    = in[i].flags;
    46     out[i].detID      = 0;
    47     out[i].imageID    = 0;
    48 
    49     // changed or added for PS1_DEV_2
     38
     39    // changed for PS1_DEV_2
    5040    out[i].Map        = in[i].Mgal;
    51     out[i].dMcal      = 0;
    52 
    53     // changed or added for PS1_V1
     41
     42    // changed for PS1_V1
    5443    out[i].photFlags  = in[i].dophot << 16;
    55     out[i].t_msec     = 0;
    56     out[i].extID      = 0;
    57     out[i].objID      = 0;
    58     out[i].catID      = 0;
    59     out[i].Mxx        = 0.0;
    60     out[i].Mxy        = 0.0;
    61     out[i].Myy        = 0.0;
    62     out[i].posangle   = 0;
    63     out[i].pltscale   = 0;
    64     out[i].psfNdof    = 0;
    65     out[i].psfNpix    = 0;
    66 
    67     // added for PS1_V4
    68     out[i].Mkron      = NAN;
    69     out[i].dMkron     = NAN;
    70     out[i].FluxPSF    = NAN;
    71     out[i].dFluxPSF   = NAN;
    72     out[i].FluxKron   = NAN;
    73     out[i].dFluxKron  = NAN;
    74     out[i].psfQFperf  = NAN;
    7544  }
    7645  return (out);
     
    12695
    12796  for (i = 0; i < Nvalues; i++) {
     97    dvo_average_init (&out[i]);
     98    dvo_secfilt_init (&primary[0][i]);
     99
    128100    out[i].R             = in[i].R;     
    129101    out[i].D             = in[i].D;     
     
    134106    primary[0][i].Xm    = in[i].Xm;     
    135107
    136     primary[0][i].Ncode = 0;     
    137     primary[0][i].Nused = 0;
    138 
    139108    // added for PANSTARRS_DEV_0
    140     out[i].dR      = 0;
    141     out[i].dD      = 0;
    142     out[i].uR      = 0;
    143     out[i].uD      = 0;
    144     out[i].duR     = 0;
    145     out[i].duD     = 0;
    146     out[i].P       = 0;
    147     out[i].dP      = 0;
    148     out[i].objID   = 0; // determine on-the-fly
    149     out[i].catID   = 0; // determine on-the-fly
     109    // out[i].objID   = 0; // determine on-the-fly
     110    // out[i].catID   = 0; // determine on-the-fly
    150111
    151112    // changed or added for PS1_DEV_2
     
    154115    out[i].measureOffset = in[i].offset;
    155116    out[i].missingOffset = in[i].missing;
    156     out[i].Nextend       = 0;
    157     out[i].extendOffset  = 0;
    158117
    159118    // changed or added for PS1_V1
    160119    out[i].flags         = in[i].code;   
    161     out[i].ChiSqAve      = NAN;
    162     out[i].ChiSqPM       = NAN;
    163     out[i].ChiSqPar      = NAN;
    164     out[i].Tmean         = 0;
    165     out[i].Trange        = 0;
    166     out[i].Npos          = 0.0;
    167     out[i].extID         = 0;
    168 
    169     // added in PS1_V3
    170     out[i].photFlagsUpper = 0;
    171     out[i].photFlagsLower = 0;
    172 
    173     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    174     out[i].psfQF         = NAN;
    175     out[i].psfQFperf     = NAN;
    176     out[i].stargal       = NAN;
    177120  }
    178121  return (out);
     
    217160
    218161  for (i = 0; i < Nvalues; i++) {
     162    dvo_secfilt_init (&out[i]);
     163
    219164    out[i].Xm    = in[i].Xm;     
    220165
     
    222167    out[i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M   * 0.001;
    223168    out[i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM  * 0.001;
    224     out[i].Ncode = 0;
    225     out[i].Nused = 0;
    226 
    227     // changed or added for PS1_V1
    228     out[i].M_20  = 0;     
    229     out[i].M_80  = 0;     
    230 
    231     // changed or added for PS1_V2
    232     out[i].flags = 0;
    233 
    234     // added in PS1_V3
    235     out[i].Map         = 0;
    236     out[i].Mstdev      = 0;
    237     out[i].ubercalDist = 0;
    238 
    239     // added for PS1_V4
    240     out[i].Mkron       = NAN;
    241     out[i].dMkron      = NAN;
    242     out[i].FluxPSF    = NAN;
    243     out[i].dFluxPSF   = NAN;
    244     out[i].FluxKron   = NAN;
    245     out[i].dFluxKron  = NAN;
    246     out[i].stackID     = 0;
    247169  }
    248170  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r34405 r34772  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
     12    dvo_measure_init (&out[i]);
    1213    out[i].t        = in[i].t;
    1314
     
    1617    out[i].dbFlags   = (in[i].averef & 0xff000000) >> 24;
    1718    out[i].t         = in[i].t;
    18     out[i].dt        = 0;
    19     out[i].airmass   = 0;
    20     out[i].FWy       = 0;
    21     out[i].FWx       = 0;
    22     out[i].theta     = 0;
    2319
    2420    // changed for PANSTARRS_DEV_0
     
    3228   
    3329    // added for PANSTARRS_DEV_0
    34     out[i].Xccd      = 0;  // determine on-the-fly
    35     out[i].Yccd      = 0;  // determine on-the-fly
    36     out[i].dXccd     = 0;
    37     out[i].dYccd     = 0;
    38     out[i].az        = 0;
    39     out[i].Sky       = 0;
    40     out[i].dSky      = 0;
    41     out[i].psfQF     = 0;
    42     out[i].psfChisq  = 0;
    43     out[i].crNsigma  = 0;
    44     out[i].extNsigma = 0;
    45     out[i].detID     = 0;  // determine on-the-fly
    46     out[i].imageID   = 0;  // determine on-the-fly
    47 
    48     // changed or added for PS1_DEV_1 (2008.02.26)
    49     out[i].detID      = 0;
    50     out[i].imageID    = 0;
    51 
    52     // changed or added for PS1_DEV_2
    53     out[i].dMcal      = 0;
     30    // out[i].Xccd      = 0;  // determine on-the-fly
     31    // out[i].Yccd      = 0;  // determine on-the-fly
     32    // out[i].detID     = 0;  // determine on-the-fly
     33    // out[i].imageID   = 0;  // determine on-the-fly
    5434
    5535    // changed or added for PS1_V1
    5636    out[i].photFlags  = in[i].dophot << 16;
    57     out[i].t_msec     = 0;
    58     out[i].extID      = 0;
    59     out[i].objID      = 0;
    60     out[i].catID      = 0;
    61     out[i].Mxx        = 0.0;
    62     out[i].Mxy        = 0.0;
    63     out[i].Myy        = 0.0;
    64     out[i].posangle   = 0;
    65     out[i].pltscale   = 0;
    66     out[i].psfNdof    = 0;
    67     out[i].psfNpix    = 0;
    68 
    69     // added for PS1_V4
    70     out[i].Mkron      = NAN;
    71     out[i].dMkron     = NAN;
    72     out[i].FluxPSF    = NAN;
    73     out[i].dFluxPSF   = NAN;
    74     out[i].FluxKron   = NAN;
    75     out[i].dFluxKron  = NAN;
    76     out[i].psfQFperf  = NAN;
    7737  }
    7838  return (out);
     
    11777
    11878  for (i = 0; i < Nvalues; i++) {
     79    dvo_average_init (&out[i]);
     80    dvo_secfilt_init (&primary[0][i]);
     81
    11982    out[i].R             = in[i].R;     
    12083    out[i].D             = in[i].D;     
    121 
    122     // added for ELIXIR
    123     primary[0][i].dM    = NAN;
    12484
    12585    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
    12686    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
    12787    primary[0][i].Xm    = in[i].Xm;     
    128     primary[0][i].Ncode = 0;     
    129     primary[0][i].Nused = 0;
    13088
    13189    // added for PANSTARRS_DEV_0
    132     out[i].dR      = 0;
    133     out[i].dD      = 0;
    134     out[i].uR      = 0;
    135     out[i].uD      = 0;
    136     out[i].duR     = 0;
    137     out[i].duD     = 0;
    138     out[i].P       = 0;
    139     out[i].dP      = 0;
    140     out[i].objID   = 0; // determine on-the-fly
    141     out[i].catID   = 0; // determine on-the-fly
     90    // out[i].objID   = 0; // determine on-the-fly
     91    // out[i].catID   = 0; // determine on-the-fly
    14292
    14393    // changed or added for PS1_DEV_2
     
    14696    out[i].measureOffset = in[i].offset;
    14797    out[i].missingOffset = in[i].missing;
    148     out[i].Nextend       = 0;
    149     out[i].extendOffset  = 0;
    15098
    15199    // changed or added for PS1_V1
    152100    out[i].flags         = in[i].code;   
    153     out[i].ChiSqAve      = NAN;
    154     out[i].ChiSqPM       = NAN;
    155     out[i].ChiSqPar      = NAN;
    156     out[i].Tmean         = 0;
    157     out[i].Trange        = 0;
    158     out[i].Npos          = 0.0;
    159     out[i].extID         = 0;
    160 
    161     // added in PS1_V3
    162     out[i].photFlagsUpper = 0;
    163     out[i].photFlagsLower = 0;
    164 
    165     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    166     out[i].psfQF         = NAN;
    167     out[i].psfQFperf     = NAN;
    168     out[i].stargal       = NAN;
     101
     102    // PS1_V4 : (Xp dropped in V4 onward, was not really used anyway)
    169103  }
    170104  return (out);
     
    208142
    209143  for (i = 0; i < Nvalues; i++) {
     144    dvo_secfilt_init (&out[i]);
     145
    210146    out[i].Xm    = in[i].Xm;     
    211147
    212     // added for ELIXIR
    213     out[i].dM    = NAN;
    214 
    215148    // added or changed for PANSTARRS_DEV_0
    216149    out[i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M * 0.001;
    217     out[i].Ncode = 0;
    218     out[i].Nused = 0;
    219 
    220     // changed or added for PS1_V1
    221     out[i].M_20  = 0;     
    222     out[i].M_80  = 0;     
    223 
    224     // changed or added for PS1_V2
    225     out[i].flags = 0;
    226 
    227     // added in PS1_V3
    228     out[i].Map         = 0;
    229     out[i].Mstdev      = 0;
    230     out[i].ubercalDist = 0;
    231 
    232     // added for PS1_V4
    233     out[i].Mkron       = NAN;
    234     out[i].dMkron      = NAN;
    235     out[i].FluxPSF    = NAN;
    236     out[i].dFluxPSF   = NAN;
    237     out[i].FluxKron   = NAN;
    238     out[i].dFluxKron  = NAN;
    239     out[i].stackID     = 0;
    240150  }
    241151  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r34405 r34772  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
     12    dvo_measure_init (&out[i]);
    1213    out[i].dR         = in[i].dR;
    1314    out[i].dD         = in[i].dD;
     
    3536    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
    3637
    37     // changed or added for PS1_DEV_1 (2008.02.26)
     38    // changed for PS1_DEV_1 (2008.02.26)
    3839    out[i].psfQF      = (in[i].psfQF == NAN_S_SHORT) ? NAN : in[i].psfQF;
    3940    out[i].dbFlags    = in[i].flags;
    4041    out[i].detID      = in[i].detID_lo;
    4142    out[i].imageID    = in[i].imageID_lo;
    42     out[i].psfChisq   = 0;
    43     out[i].crNsigma   = 0;
    44     out[i].extNsigma  = 0;
    45 
    46     // changed or added for PS1_DEV_2
     43
     44    // changed for PS1_DEV_2
    4745    out[i].Map        = in[i].Mgal;
    48     out[i].dMcal      = 0;
    49 
    50     // changed or added for PS1_V1
     46
     47    // changed for PS1_V1
    5148    out[i].photFlags  = in[i].dophot << 16;
    52     out[i].t_msec     = 0;
    53     out[i].extID      = 0;
    54     out[i].objID      = 0;
    55     out[i].catID      = 0;
    56     out[i].Mxx        = 0.0;
    57     out[i].Mxy        = 0.0;
    58     out[i].Myy        = 0.0;
    59     out[i].posangle   = 0;
    60     out[i].pltscale   = 0;
    61     out[i].psfNdof    = 0;
    62     out[i].psfNpix    = 0;
    63 
    64     // added for PS1_V4
    65     out[i].Mkron      = NAN;
    66     out[i].dMkron     = NAN;
    67     out[i].FluxPSF    = NAN;
    68     out[i].dFluxPSF   = NAN;
    69     out[i].FluxKron   = NAN;
    70     out[i].dFluxKron  = NAN;
    71     out[i].psfQFperf  = NAN;
    7249  }
    7350  return (out);
     
    132109
    133110  for (i = 0; i < Nvalues; i++) {
     111    dvo_average_init (&out[i]);
     112
    134113    out[i].R             = in[i].R;     
    135114    out[i].D             = in[i].D;     
     
    145124    out[i].catID         = in[i].catID;
    146125
    147     // changed or added for PS1_DEV_2
     126    // changed for PS1_DEV_2
    148127    out[i].Nmeasure      = in[i].Nm;     
    149128    out[i].Nmissing      = in[i].Nn;     
    150129    out[i].measureOffset = in[i].offset;
    151130    out[i].missingOffset = in[i].missing;
    152     out[i].Nextend       = 0;
    153     out[i].extendOffset  = 0;
    154 
    155     // changed or added for PS1_V1
     131
     132    // changed for PS1_V1
    156133    out[i].flags         = in[i].code;   
    157     out[i].ChiSqAve      = NAN;
    158     out[i].ChiSqPM       = NAN;
    159     out[i].ChiSqPar      = NAN;
    160     out[i].Tmean         = 0;
    161     out[i].Trange        = 0;
    162     out[i].Npos          = 0.0;
    163     out[i].extID         = 0;
    164 
    165     // added in PS1_V3
    166     out[i].photFlagsUpper = 0;
    167     out[i].photFlagsLower = 0;
    168 
    169     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    170     out[i].psfQF         = NAN;
    171     out[i].psfQFperf     = NAN;
    172     out[i].stargal       = NAN;
    173134  }
    174135  return (out);
     
    219180
    220181  for (i = 0; i < Nvalues; i++) {
     182    dvo_secfilt_init (&out[i]);
     183
    221184    out[i].M     = in[i].M;     
    222185    out[i].dM    = in[i].dM;     
     
    224187    out[i].Ncode = in[i].Ncode;
    225188    out[i].Nused = in[i].Nused;
    226 
    227     // changed or added for PS1_V1
    228     out[i].M_20  = 0;     
    229     out[i].M_80  = 0;     
    230 
    231     // changed or added for PS1_V2
    232     out[i].flags = 0;
    233 
    234     // added in PS1_V3
    235     out[i].Map         = 0;
    236     out[i].Mstdev      = 0;
    237     out[i].ubercalDist = 0;
    238 
    239     // added for PS1_V4
    240     out[i].Mkron       = NAN;
    241     out[i].dMkron      = NAN;
    242     out[i].FluxPSF     = NAN;
    243     out[i].dFluxPSF    = NAN;
    244     out[i].FluxKron    = NAN;
    245     out[i].dFluxKron   = NAN;
    246     out[i].stackID     = 0;
    247189 }
    248190  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r34405 r34772  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
     12    dvo_measure_init (&out[i]);
    1213    out[i].dR         = in[i].dR;
    1314    out[i].dD         = in[i].dD;
     
    4041    out[i].detID      = in[i].detID_lo;
    4142    out[i].imageID    = in[i].imageID_lo;
    42     out[i].psfChisq   = 0;
    43     out[i].crNsigma   = 0;
    44     out[i].extNsigma  = 0;
    45 
    46     // changed or added for PS1_DEV_2
     43
     44    // changed for PS1_DEV_2
    4745    out[i].Map        = in[i].Mgal;
    48     out[i].dMcal      = 0;
    49 
    50     // changed or added for PS1_V1
     46
     47    // changed for PS1_V1
    5148    out[i].photFlags  = in[i].dophot << 16;
    52     out[i].t_msec     = 0;
    53     out[i].extID      = 0;
    54     out[i].objID      = 0;
    55     out[i].catID      = 0;
    56     out[i].Mxx        = 0.0;
    57     out[i].Mxy        = 0.0;
    58     out[i].Myy        = 0.0;
    59     out[i].posangle   = 0;
    60     out[i].pltscale   = 0;
    61     out[i].psfNdof    = 0;
    62     out[i].psfNpix    = 0;
    63 
    64     // added for PS1_V4
    65     out[i].Mkron      = NAN;
    66     out[i].dMkron     = NAN;
    67     out[i].FluxPSF    = NAN;
    68     out[i].dFluxPSF   = NAN;
    69     out[i].FluxKron   = NAN;
    70     out[i].dFluxKron  = NAN;
    71     out[i].psfQFperf  = NAN;
    7249  }
    7350  return (out);
     
    132109
    133110  for (i = 0; i < Nvalues; i++) {
     111    dvo_average_init (&out[i]);
     112
    134113    out[i].R             = in[i].R;     
    135114    out[i].D             = in[i].D;     
     
    145124    out[i].catID         = in[i].catID;
    146125
    147     // changed or added for PS1_DEV_2
     126    // changed for PS1_DEV_2
    148127    out[i].Nmeasure      = in[i].Nm;     
    149128    out[i].Nmissing      = in[i].Nn;     
    150129    out[i].measureOffset = in[i].offset;
    151130    out[i].missingOffset = in[i].missing;
    152     out[i].Nextend       = 0;
    153     out[i].extendOffset  = 0;
    154 
    155     // changed or added for PS1_V1
     131
     132    // changed for PS1_V1
    156133    out[i].flags         = in[i].code;   
    157     out[i].ChiSqAve      = NAN;
    158     out[i].ChiSqPM       = NAN;
    159     out[i].ChiSqPar      = NAN;
    160     out[i].Tmean         = 0;
    161     out[i].Trange        = 0;
    162     out[i].Npos          = 0.0;
    163     out[i].extID         = 0;
    164 
    165     // added in PS1_V3
    166     out[i].photFlagsUpper = 0;
    167     out[i].photFlagsLower = 0;
    168 
    169     // added for PS1_V4 (Xp dropped in V4 onward, was not really used anyway)
    170     out[i].psfQF         = NAN;
    171     out[i].psfQFperf     = NAN;
    172     out[i].stargal       = NAN;
    173134  }
    174135  return (out);
     
    219180
    220181  for (i = 0; i < Nvalues; i++) {
     182    dvo_secfilt_init (&out[i]);
     183
    221184    out[i].M     = in[i].M;     
    222185    out[i].dM    = in[i].dM;     
     
    224187    out[i].Ncode = in[i].Ncode;
    225188    out[i].Nused = in[i].Nused;
    226 
    227     // changed or added for PS1_V1
    228     out[i].M_20  = 0;     
    229     out[i].M_80  = 0;     
    230 
    231     // changed or added for PS1_V2
    232     out[i].flags = 0;
    233 
    234     // added in PS1_V3
    235     out[i].Map         = 0;
    236     out[i].Mstdev      = 0;
    237     out[i].ubercalDist = 0;
    238 
    239     // added for PS1_V4
    240     out[i].Mkron       = NAN;
    241     out[i].dMkron      = NAN;
    242     out[i].FluxPSF     = NAN;
    243     out[i].dFluxPSF    = NAN;
    244     out[i].FluxKron    = NAN;
    245     out[i].dFluxKron   = NAN;
    246     out[i].stackID     = 0;
    247189 }
    248190  return (out);
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/dvo_photcode_ops.c

    r34260 r34772  
    664664
    665665  Ns = photcodes[0].hashNsec[code[0].code];
    666   ID = (Ns == -1) ? 0 : secfilt[Ns].stackID;
     666  ID = (Ns == -1) ? 0 : secfilt[Ns].stackDetectID;
    667667  return (ID);
    668668}
  • branches/czw_branch/20120906/Ohana/src/libdvo/src/fits_db.c

    r29938 r34772  
    159159  make_backup (db[0].filename);
    160160  Fseek (db[0].f, 0, SEEK_SET);
     161
     162  int fd = fileno (db->f);
     163  if (ftruncate (fd, 0)) {
     164    perror ("gfits_db_save: ");
     165    return (FALSE);
     166  }
    161167
    162168  if (!gfits_fwrite_header  (db[0].f, &db[0].header)) {
  • branches/czw_branch/20120906/Ohana/src/libfits/header/F_create_H.c

    r28241 r34772  
    2626  }
    2727
    28   gfits_modify (header, "PCOUNT", "%d",  1, header[0].pcount);
    29   gfits_modify (header, "GCOUNT", "%d",  1, header[0].gcount);
     28  // gfits_modify (header, "PCOUNT", "%d",  1, header[0].pcount);
     29  // gfits_modify (header, "GCOUNT", "%d",  1, header[0].gcount);
    3030  gfits_modify (header, "BSCALE", "%lf", 1, header[0].bscale);
    3131  gfits_modify (header, "BZERO",  "%lf", 1, header[0].bzero);
  • branches/czw_branch/20120906/Ohana/src/libfits/header/F_modify.c

    r33648 r34772  
    6868  if (!strcmp (mode, "%jd"))  { snprintf (string, 81, "%-8s= %20jd / %-s ",   field, va_arg (argp, intmax_t),           comment); goto found_it; }
    6969
    70   /* string value.  Quotes must be at least 18 chars apart */
     70  /* string value.  Quotes must be at least 8 chars apart */
    7171  if (!strcmp (mode, "%s")) {
    7272    char *ptr = va_arg (argp, char *);
    7373    if (!ptr) goto invalid;
    7474    strncpy (data, ptr, 68);
    75     snprintf (string, 81, "%-8s= '%-18s' / %-s ", field, data, comment);
     75    snprintf (string, 81, "%-8s= '%-8s' / %-s ", field, data, comment);
    7676    goto found_it;
    7777  }
  • branches/czw_branch/20120906/Ohana/src/libfits/header/F_print.c

    r33648 r34772  
    6363  if (!strcmp (mode, "%jd")) { snprintf (string, 81, "%-8s= %20jd / %46s ",   field, va_arg (argp, intmax_t),           blank); goto found_it; }
    6464
    65   /* string value.  Quotes must be at least 18 chars apart.  Longer lines will this should be fixed to allow arbitrary string lengths, up to 69 chars */
     65  /* string value.  Quotes must be at least 8 chars apart.  Longer lines will this should be fixed to allow arbitrary string lengths, up to 69 chars */
    6666  if (!strcmp (mode, "%s")) {
    6767    char *ptr = va_arg (argp, char *);
     
    6969    strcpy (line, ptr);
    7070    line[68] = 0;
    71     snprintf (string, 81, "%-8s= '%-18s' / %46s ", field, line, blank);
     71    snprintf (string, 81, "%-8s= '%-8s' / %46s ", field, line, blank);
    7272    goto found_it;
    7373  }
  • branches/czw_branch/20120906/Ohana/src/libkapa/src/IOfuncs.c

    r27588 r34772  
    7575  if (status != 16) {
    7676      fprintf (stderr, "dropped message length\n");
     77      // XXX if this happens, I need to give up and return FALSE
     78      // XXX BUT: I need to think a bit more about hand-shaking.
    7779  }
    7880  if (DEBUG) fprintf (stderr, "recv buffer: %s\n", buffer);
  • branches/czw_branch/20120906/Ohana/src/libohana/include/ohana.h

    r34260 r34772  
    256256int     iparse                 PROTO((int *X, int NX, char *line));
    257257int     iparse_csv             PROTO((int *X, int NX, char *line));
     258int     charparse_csv          PROTO((char *X, int NX, char *line));
     259int     charparse              PROTO((char *X, int NX, char *line));
    258260int     tparse                 PROTO((time_t *X, int NX, char *line));
    259261int     tparse_csv             PROTO((time_t *X, int NX, char *line));
  • branches/czw_branch/20120906/Ohana/src/libohana/src

  • branches/czw_branch/20120906/Ohana/src/libohana/src/string.c

    r33963 r34772  
    130130  status = EOF + 1;
    131131 
    132   for (i = 0, c = 0; (c != '\n') && (status != EOF); i++) {
     132  for (i = 0, c = 0; (c != '\n') && (c != '\r') && (status != EOF); i++) {
    133133    status = fscanf (f, "%c", &c);
    134134    line[i] = c;
     
    154154  status = EOF + 1;
    155155 
    156   for (i = 0, c = 0; (c != '\n') && (status != EOF) && (i < maxlen); i++) {
     156  for (i = 0, c = 0; (c != '\n') && (c != '\r') && (status != EOF) && (i < maxlen); i++) {
    157157    status = fscanf (f, "%c", &c);
    158158    line[i] = c;
     
    264264  if (ptr == word) return (FALSE);
    265265  if (word[0] == '-') return (-1);
     266  return (1);
     267}
     268
     269int charparse (char *X, int NX, char *line) {
     270
     271  int i;
     272  char *word;
     273
     274  word = line;
     275  for (i = 0; i < NX - 1; i++)
     276    word = _parse_nextword (word);
     277
     278  *X = word[0];
     279  return (1);
     280}
     281
     282int charparse_csv (char *X, int NX, char *line) {
     283
     284  int i;
     285  char *word;
     286
     287  word = line;
     288  for (i = 0; i < NX - 1; i++)
     289    word = _parse_nextword_csv (word);
     290 
     291  if (word[0] == '"') word[0] = word[1];
     292  if (word[0] == ',') {
     293      *X = 0;
     294      return 1;
     295  }
     296
     297  *X = word[0];
    266298  return (1);
    267299}
  • branches/czw_branch/20120906/Ohana/src/markrock/src/ConfigInit.c

    r25757 r34772  
    55  char *config, *file;
    66  char CatdirPhotcodeFile[256];
    7   char MasterPhotcodeFile[256];
    87
    98  /*** load configuration info ***/
     
    2120  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    2221  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    23   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    2422
    2523  /* unique to markrock */
     
    4442  /* XXX this does not yet write out the master photcode table */
    4543  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    46   if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    47     fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
     44  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
     45    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    4846    exit (1);
    4947  }
  • branches/czw_branch/20120906/Ohana/src/markstar/src/ConfigInit.c

    r25757 r34772  
    55  char *config, *file;
    66  char CatdirPhotcodeFile[256];
    7   char MasterPhotcodeFile[256];
    87
    98  /*** load configuration info ***/
     
    2120  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    2221  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    23   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    2422
    2523  sprintf (ImageCat, "%s/Images.dat", CATDIR);
     
    5452  /* XXX this does not yet write out the master photcode table */
    5553  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    56   if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    57     fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
     54  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
     55    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    5856    exit (1);
    5957  }
  • branches/czw_branch/20120906/Ohana/src/opihi

    • Property svn:mergeinfo deleted
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.astro

  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.astro/cgrid.c

    r30611 r34772  
    279279  graphmode.ptype = 100; /* connect a pair */
    280280  graphmode.etype = 0;
    281   PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     281  PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    282282
    283283  free (Xvec.elements.Ptr);
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.astro/cplot.c

    r21153 r34772  
    33int cplot (int argc, char **argv) {
    44 
     5  double ra_prev = 0;
    56  int i, kapa, Npts, status, leftside;
    67  opihi_flt *x, *y, *r, *d, Rmin, Rmax, Rmid;
     
    4142  Npts = 0;
    4243  for (i = 0; i < Xvec.Nelements; i++, r++, d++) {
    43     *r = ohana_normalize_angle (*r);
    44     while (*r < Rmin) *r += 360.0;
    45     while (*r > Rmax) *r -= 360.0;
     44    double ra = ohana_normalize_angle (*r);
     45    while (ra < Rmin) ra += 360.0;
     46    while (ra > Rmax) ra -= 360.0;
    4647
    4748    // for pair-by-pair connections, check on second point if we straddle the back midline
    48     if ((graphmode.ptype == 100) && (i % 2)) {
    49       leftside = (r[-1] < Rmid); // if first of the pair is left, second must be as well
    50       if ( leftside && (r[0] > Rmid + 90)) { r[0] -= 360.0; }
    51       if (!leftside && (r[0] < Rmid - 90)) { r[0] += 360.0; }
     49    if (graphmode.ptype == 100) {
     50      if (i % 2) {
     51        leftside = (ra_prev < Rmid); // if first of the pair is left, second must be as well
     52        if ( leftside && (ra > Rmid + 90)) { ra -= 360.0; }
     53        if (!leftside && (ra < Rmid - 90)) { ra += 360.0; }
     54      } else {
     55        ra_prev = ra;
     56      }
    5257    }
    53     status = RD_to_XY (x, y, *r, *d, &graphmode.coords);
     58    status = RD_to_XY (x, y, ra, *d, &graphmode.coords);
    5459
    5560    // if we fail on one of the points, drop the corresponding pair
     
    7883
    7984  graphmode.etype = 0;
    80   PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     85  PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    8186 
    8287  free (Xvec.elements.Ptr);
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.astro/czplot.c

    r31667 r34772  
    7676  graphmode.size = -1; /* point size determined by Zvec */
    7777  graphmode.etype = 0;
    78   PlotVectorTriplet (kapa, &Xvec, &Yvec, &Zvec, &graphmode);
     78  PlotVectorTriplet (kapa, &Xvec, &Yvec, &Zvec, NULL, &graphmode);
    7979
    8080  free (Xvec.elements.Flt);
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data

  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/Makefile

    r33662 r34772  
    114114$(SRC)/shift.$(ARCH).o          \
    115115$(SRC)/sort.$(ARCH).o           \
    116 $(SRC)/spline_apply.$(ARCH).o   \
    117 $(SRC)/spline_construct.$(ARCH).o \
     116$(SRC)/spline.$(ARCH).o         \
     117$(SRC)/spline_commands.$(ARCH).o \
     118$(SRC)/imspline_apply.$(ARCH).o \
     119$(SRC)/imspline_construct.$(ARCH).o \
    118120$(SRC)/imstats.$(ARCH).o           \
    119121$(SRC)/style.$(ARCH).o             \
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/box.c

    r27790 r34772  
    149149 usage:
    150150  gprint (GP_ERR, "USAGE: box [-ticks NNNN] [-axis NNNN] [-labels NNNN]\n");
     151
     152  gprint (GP_ERR, "  additional options:\n");
     153  gprint (GP_ERR, "  -fn (font) (size) : set font used for box\n");
     154  gprint (GP_ERR, "  -lw (weight) : set box line weight\n");
     155  gprint (GP_ERR, "  -c (color) : set box color\n");
     156  gprint (GP_ERR, "  \n");
     157  gprint (GP_ERR, "  for the descriptions below:\n");
     158  gprint (GP_ERR, "    -x refers to the bottom x-axis, \n");
     159  gprint (GP_ERR, "    -y refers to the left y-axis, \n");
     160  gprint (GP_ERR, "    +x refers to the top x-axis, \n");
     161  gprint (GP_ERR, "    +y refers to the right y-axis, \n");
     162  gprint (GP_ERR, "  \n");
     163  gprint (GP_ERR, "  -ticks [NNNN]  : turn on (1), off (0), or use default for ticks\n");
     164  gprint (GP_ERR, "  -labels [NNNN] : turn on (1), off (0), or use default for label\n");
     165  gprint (GP_ERR, "  -axis [NNNN]   : turn on (1), off (0), or use default for axis\n");
     166  gprint (GP_ERR, "    the order for the NNNN values in the above options is: -x, -y, +x, +y\n");
     167  gprint (GP_ERR, "  \n");
     168  gprint (GP_ERR, "  -tickpad : set the spacing between the ticks and the tick text \n");
     169  gprint (GP_ERR, "  \n");
     170  gprint (GP_ERR, "  the following set the spacing between the label and the given axis:\n");
     171  gprint (GP_ERR, "    -labelpadx, -labelpady, +labelpadx, +labelpady\n");
     172  gprint (GP_ERR, "  \n");
     173  gprint (GP_ERR, "  -pad : set the spacing between the plot section boundary and the axes\n");
     174  gprint (GP_ERR, "         alternatively, set each axis independently with:\n");
     175  gprint (GP_ERR, "        -xpad, -ypad, +xpad, +ypad\n");
     176
    151177  return (FALSE);
    152178}
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/dbconnect.c

    r27435 r34772  
    3333  password[i] = 0;
    3434# endif
     35
     36  // XXX do I need to call mysql_library_init()?
    3537
    3638  mysql_init (&mysql);
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/dbselect.c

    r20936 r34772  
    6161  ALLOCATE (vec, Vector *, Ncols);
    6262  for (i = 0; i < Ncols; i++) {
    63     if ((vec[i] = SelectVector (fields[i].name, ANYVECTOR, TRUE)) == NULL) {
    64       gprint (GP_ERR, "trouble creating vector named %s\n", fields[i].name);
     63    char *name = fields[i].name ? fields[i].name : fields[i].org_name;
     64    if ((vec[i] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) {
     65      gprint (GP_ERR, "trouble creating vector named %s\n", name);
    6566      free (query);
    6667      free (vec);
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/grid.c

    r26258 r34772  
    178178  graphmode.ptype = 100; /* connect a pair */
    179179  graphmode.etype = 0;
    180   PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     180  PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    181181
    182182  free (Xvec.elements.Flt);
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/init.c

    r33662 r34772  
    102102int shift            PROTO((int, char **));
    103103int sort_vectors     PROTO((int, char **));
    104 int spline_apply_cmd PROTO((int, char **));
    105 int spline_construct_cmd PROTO((int, char **));
     104int spline_command   PROTO((int, char **));
     105int imspline_apply   PROTO((int, char **));
     106int imspline_construct PROTO((int, char **));
    106107int stats            PROTO((int, char **));
    107108int imstats          PROTO((int, char **));
     
    254255  {1, "shift",        shift,            "shift data in an image"},
    255256  {1, "sort",         sort_vectors,     "sort list of vectors"},
    256   {1, "spline.apply", spline_apply_cmd, "apply spline fit to generate an image"},
    257   {1, "spline.const", spline_construct_cmd, "create spline 2nd deriv. terms"},
     257  {1, "spline",       spline_command,   "shift data in an image"},
     258  {1, "imspline.apply", imspline_apply, "apply spline fit to generate an image"},
     259  {1, "imspline.const", imspline_construct, "create spline 2nd deriv. terms"},
    258260  {1, "stats",        imstats,          "statistics on a portion of an image"},
    259261  {1, "style",        style,            "set the style for graph plots"},
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/plot.c

    r32346 r34772  
    33int plot (int argc, char **argv) {
    44 
    5   int kapa, N, Npts;
     5  char *out;
     6  int kapa, N, Npts, valid, size, i;
    67  Graphdata graphmode;
    78  Vector *xvec, *yvec, *dxmvec, *dxpvec, *dymvec, *dypvec;
     
    3233  }
    3334
    34   if (argc != 3) {
     35  valid  = (argc == 3);
     36  valid |= (argc > 4) && !strcmp (argv[3], "where");
     37  if (!valid) {
    3538    gprint (GP_ERR, "USAGE: plot <x> <y> [style]\n");
     39    gprint (GP_ERR, "   OR: plot <x> <y> [style] where (condition)\n");
    3640    return (FALSE);
     41  }
     42
     43  // tvec is used for logical test (truth vector)
     44  Vector *tvec = NULL;
     45  char *mask = NULL;
     46  if (argc > 4) {
     47    out = dvomath (argc - 4, &argv[4], &size, 1);
     48    if (out == NULL) {
     49      print_error ();
     50      return FALSE;
     51    }
     52    if ((tvec = SelectVector (out, OLDVECTOR, TRUE)) == NULL) {
     53      gprint (GP_ERR, " invalid logic result\n");
     54      DeleteNamedVector (out);
     55      free (out);
     56      return (FALSE);
     57    }
    3758  }
    3859
     
    5374    return (FALSE);
    5475  }
     76  if (tvec && tvec[0].Nelements != yvec[0].Nelements) {
     77    gprint (GP_ERR, "logic test vector not the same length as data vectors\n");
     78    return (FALSE);
     79  }
    5580  if (dypvec && (dypvec->Nelements != xvec->Nelements)) goto mismatch;
    5681  if (dymvec && (dymvec->Nelements != xvec->Nelements)) goto mismatch;
     
    5984
    6085  Npts = xvec[0].Nelements;
    61   if (Npts == 0) return (TRUE);
     86  if (Npts == 0) {
     87    if (tvec) DeleteVector (tvec);
     88    return (TRUE);
     89  }
     90
     91  if (tvec) {
     92    Npts = 0;
     93    ALLOCATE (mask, char, tvec->Nelements);
     94    for (i = 0; i < tvec->Nelements; i++) {
     95      mask[i] = (tvec->type == OPIHI_FLT) ? (tvec->elements.Flt[i] == 0.0) : (tvec->elements.Int[i] == 0.0);
     96      if (!mask[i]) Npts ++;
     97    }
     98    if (Npts == 0) {
     99      DeleteVector (tvec);
     100      free (mask);
     101      return TRUE;
     102    }
     103  }
    62104
    63105  if (!KapaPrepPlot (kapa, Npts, &graphmode)) return (FALSE);
    64106 
    65   PlotVectorSingle (kapa, xvec, "x");
    66   PlotVectorSingle (kapa, yvec, "y");
     107  PlotVectorSingle (kapa, xvec, mask, "x");
     108  PlotVectorSingle (kapa, yvec, mask, "y");
    67109  if (graphmode.etype & 0x01) {
    68     PlotVectorSingle (kapa, dymvec, "dym");
    69     PlotVectorSingle (kapa, dypvec, "dyp");
     110    PlotVectorSingle (kapa, dymvec, mask, "dym");
     111    PlotVectorSingle (kapa, dypvec, mask, "dyp");
    70112  }
    71113  if (graphmode.etype & 0x02) {
    72     PlotVectorSingle (kapa, dxmvec, "dxm");
    73     PlotVectorSingle (kapa, dxpvec, "dxp");
     114    PlotVectorSingle (kapa, dxmvec, mask, "dxm");
     115    PlotVectorSingle (kapa, dxpvec, mask, "dxp");
     116  }
     117
     118  if (tvec) {
     119    free (mask);
     120    DeleteVector (tvec);
    74121  }
    75122  return (TRUE);
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/read_vectors.c

    r33662 r34772  
    2222
    2323// vector types
    24 enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME};
     24enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME, COLTYPE_CHAR};
    2525
    2626int read_vectors (int argc, char **argv) {
     
    3030  int i, j, Nskip, Narg, Nvec, *col, IsCSV, VERBOSE;
    3131  int Nbytes, Nstart, NELEM, Nelem, nread, *coltype;
    32   char *colstr, *c0, *c1, *buffer, *extname;
     32  char *colstr, *c0, *c1, *extname;
    3333  Vector **vec;
     34
     35  char *buffer = NULL;
    3436
    3537  /* auto-sense table type */
     
    101103      if (!strcasecmp(ptr, "float")) { coltype[i] = COLTYPE_FLT; }
    102104      if (!strcasecmp(ptr, "int"))   { coltype[i] = COLTYPE_INT; }
     105      if (!strcasecmp(ptr, "char"))  { coltype[i] = COLTYPE_CHAR; }
    103106      if (!strcasecmp(ptr, "time"))  { coltype[i] = COLTYPE_TIME; }
    104107      if (!coltype[i]) goto bad_colname;
     
    143146  NELEM = 1000;
    144147  for (i = 0; i < Nvec; i++) {
    145     if (coltype[i] == COLTYPE_INT) {
     148    if ((coltype[i] == COLTYPE_INT) || (coltype[i] == COLTYPE_CHAR)) {
    146149      ResetVector (vec[i], OPIHI_INT, NELEM);
    147150    } else {
     
    154157  bzero (buffer, 0x10001);
    155158  for (i = 0; i < Nskip; i++) {
    156     scan_line (f, buffer);
     159    if (scan_line_maxlen (f, buffer, 0x10000) == EOF) {
     160      gprint (GP_ERR, "problem reading file %s\n", filename);
     161      free (vec);
     162      free (col);
     163      return FALSE;
     164    }
    157165  }
    158166
     
    178186    while (bufferStatus) {
    179187      c1 = strchr (c0, '\n'); // find the end of this current line
     188      if (!c1) {
     189        c1 = strchr (c0, '\r'); // try \r for non-UNIX files (what do we do about a Mac? \n\r?)
     190      }
    180191      if (c1 == (char *) NULL) {
    181192        Nstart = strlen (c0);
     
    195206      for (i = 0; i < Nvec; i++) {
    196207        int ivalue;
     208        char cvalue;
    197209        double dvalue;
    198210        time_t tvalue;
     
    203215            readStatus = IsCSV ? iparse_csv (&ivalue, col[i], c0) : iparse (&ivalue, col[i], c0);
    204216            vec[i][0].elements.Int[Nelem] = readStatus ? ivalue : 0;
     217            break;
     218          case COLTYPE_CHAR:
     219            readStatus = IsCSV ? charparse_csv (&cvalue, col[i], c0) : charparse (&cvalue, col[i], c0);
     220            vec[i][0].elements.Int[Nelem] = readStatus ? cvalue : 0;
    205221            break;
    206222          case COLTYPE_FLT:
     
    254270  free (vec);
    255271  free (col);
    256   free (buffer);
     272  if (buffer) free (buffer);
    257273  return (TRUE);
    258274
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/reindex.c

    r33662 r34772  
    55int reindex (int argc, char **argv) {
    66 
    7   int  i, Npts, Nmax;
     7  int  i, Nmax, N;
    88  Vector *ivec, *ovec, *xvec;
    99
    1010  ivec = ovec = xvec = NULL;
    11   Npts = 0;
     11  int Npts = 0;
     12
     13  int KEEP_UNMATCH = FALSE;
     14  if ((N = get_argument (argc, argv, "-keep-unmatched"))) {
     15    remove_argument (N, &argc, argv);
     16    KEEP_UNMATCH = TRUE;
     17  }
    1218
    1319  if (argc != 6) goto usage;
     
    2228
    2329  // ovec matches ivec in type and xvec in size (xvec need not have all ivec elements, and may have duplicates
     30  int NPTS = xvec[0].Nelements;
    2431  ResetVector (ovec, ivec->type, xvec[0].Nelements);
    2532
     
    3138    opihi_int *vx = xvec[0].elements.Int;
    3239    for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) {
    33       if (*vx == -1) continue;
    34       if (*vx < 0) ESCAPE("unexpected value in index: %d (%d)\n", *vx, i);
     40      if (Npts >= NPTS) {
     41        NPTS += 2000;
     42        REALLOCATE (ovec[0].elements.Flt, opihi_flt, NPTS);
     43      }
     44      if (*vx < 0) {
     45        if (KEEP_UNMATCH) {
     46          ovec[0].elements.Flt[Npts] = NAN;
     47          Npts++;
     48        }
     49        continue;
     50      }
    3551      if (*vx > Nmax) ESCAPE("unexpected value in index: %d (%d)\n", *vx, i);
    3652      ovec[0].elements.Flt[Npts] = vi[*vx];
     
    4258    opihi_int *vx = xvec[0].elements.Int;
    4359    for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) {
    44       if (*vx == -1) continue;
    45       if (*vx < 0) ESCAPE("unexpected value in index: %d (%d)\n", *vx, i);
     60      if (Npts >= NPTS) {
     61        NPTS += 2000;
     62        REALLOCATE (ovec[0].elements.Int, opihi_int, NPTS);
     63      }
     64      if (*vx < 0) {
     65        if (KEEP_UNMATCH) {
     66          ovec[0].elements.Flt[Npts] = -1;
     67          Npts++;
     68        }
     69        continue;
     70      }
    4671      if (*vx > Nmax) ESCAPE("unexpected value in index: %d (%d)\n", *vx, i);
    4772      ovec[0].elements.Int[Npts] = vi[*vx];
     
    6085usage:
    6186    gprint (GP_ERR, "USAGE: reindex (out) = (in) using (index)\n");
    62     gprint (GP_ERR, "  creates a new vectors (out) from (in) based on sequence in (index)\n");
     87    gprint (GP_ERR, "  Creates a new vector (out) from (in) based on sequence in (index)\n");
     88    gprint (GP_ERR, "  output[i] = input[index[i]]\n");
     89    gprint (GP_ERR, "  If -keep-unmatched is provided, elements of index with negative values will be set to NaN / -1,\n");
     90    gprint (GP_ERR, "    otherwise they will be skipped in the output.\n");
     91    gprint (GP_ERR, "  The output vector has the type of the input vector and the length of the index (if -keep-unmatched).\n");
     92    gprint (GP_ERR, "  The index vector may have duplicates\n");
    6393    return (FALSE);
    6494}
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/subset.c

    r30610 r34772  
    1313  Npts = 0;
    1414
     15  if (argc < 6) {
     16    gprint (GP_ERR, "SYNTAX: subset vec = vec [if/where] (logic expression)\n");
     17    return (FALSE);
     18  }
     19
    1520  valid = TRUE;
    16   valid &= (argc >= 6);
    1721  valid &= !strcmp(argv[2], "=");
    1822  valid &= !strcmp(argv[4], "if") || !strcmp (argv[4], "where");
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/write_vectors.c

    r33963 r34772  
    9999  }
    100100
    101   /* open file for outuput */
     101  /* open file for output */
    102102  if (append) {
    103103    f = fopen (argv[1], "a");
  • branches/czw_branch/20120906/Ohana/src/opihi/cmd.data/zplot.c

    r31667 r34772  
    33int zplot (int argc, char **argv) {
    44 
    5   int i, kapa;
     5  char *outname = NULL;
     6  int i, kapa, valid, size;
    67  opihi_flt *out;
    78  double min, range;
     
    1112  if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE);
    1213
    13   if (argc != 6) {
     14  valid  = (argc == 6);
     15  valid |= (argc > 7) && !strcmp (argv[6], "where");
     16  if (!valid) {
    1417    gprint (GP_ERR, "USAGE: zplot <x> <y> <z> min max\n");
     18    gprint (GP_ERR, "   OR: zplot <x> <y> <z> min max where (condition)\n");
    1519    return (FALSE);
    1620  }
     
    1822  min = atof(argv[4]);
    1923  range = atof(argv[5]) - min;
     24
     25  // tvec is used for logical test (truth vector)
     26  Vector *tvec = NULL;
     27  char *mask = NULL;
     28  if (argc > 7) {
     29    outname = dvomath (argc - 7, &argv[7], &size, 1);
     30    if (outname == NULL) {
     31      print_error ();
     32      return FALSE;
     33    }
     34    if ((tvec = SelectVector (outname, OLDVECTOR, TRUE)) == NULL) {
     35      gprint (GP_ERR, " invalid logic result\n");
     36      DeleteNamedVector (outname);
     37      free (outname);
     38      return (FALSE);
     39    }
     40  }
    2041
    2142  /* find vectors */
     
    2950  if (xvec[0].Nelements != zvec[0].Nelements) {
    3051    gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[3]);
     52    return (FALSE);
     53  }
     54  if (tvec && tvec[0].Nelements != yvec[0].Nelements) {
     55    gprint (GP_ERR, "logic test vector not the same length as data vectors\n");
    3156    return (FALSE);
    3257  }
     
    4671  }
    4772
     73  if (tvec) {
     74    ALLOCATE (mask, char, tvec->Nelements);
     75    for (i = 0; i < tvec->Nelements; i++) {
     76      mask[i] = (tvec->type == OPIHI_FLT) ? (tvec->elements.Flt[i] == 0.0) : (tvec->elements.Int[i] == 0.0);
     77    }
     78  }
     79
    4880  /* point size determined by Zvec */
    4981  graphmode.style = 2; /* plot points */
    5082  graphmode.size = -1; /* point size determined by Zvec */
    5183  graphmode.etype = 0; /* no errorbars */
    52   PlotVectorTriplet (kapa, xvec, yvec, &Zvec, &graphmode);
     84  PlotVectorTriplet (kapa, xvec, yvec, &Zvec, mask, &graphmode);
    5385
    5486  free (Zvec.elements.Ptr);
     87  if (mask) free (mask);
     88  DeleteNamedVector (outname);
    5589
    5690  return (TRUE);
     
    6094int zcplot (int argc, char **argv) {
    6195 
    62   int i, kapa;
     96  char *outname = NULL;
     97  int i, kapa, valid, size;
    6398  opihi_flt *out;
    6499  double min, range;
     
    68103  if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE);
    69104
    70   if (argc != 6) {
    71     gprint (GP_ERR, "USAGE: zplot <x> <y> <z> min max\n");
     105  valid  = (argc == 6);
     106  valid |= (argc > 7) && !strcmp (argv[6], "where");
     107  if (!valid) {
     108    gprint (GP_ERR, "USAGE: zcplot <x> <y> <z> min max\n");
     109    gprint (GP_ERR, "   OR: zcplot <x> <y> <z> min max where (condition)\n");
    72110    return (FALSE);
    73111  }
     
    75113  min = atof(argv[4]);
    76114  range = atof(argv[5]) - min;
     115
     116  // tvec is used for logical test (truth vector)
     117  Vector *tvec = NULL;
     118  char *mask = NULL;
     119  if (argc > 7) {
     120    outname = dvomath (argc - 7, &argv[7], &size, 1);
     121    if (outname == NULL) {
     122      print_error ();
     123      return FALSE;
     124    }
     125    if ((tvec = SelectVector (outname, OLDVECTOR, TRUE)) == NULL) {
     126      gprint (GP_ERR, " invalid logic result\n");
     127      DeleteNamedVector (outname);
     128      free (outname);
     129      return (FALSE);
     130    }
     131  }
    77132
    78133  /* find vectors */
     
    86141  if (xvec[0].Nelements != zvec[0].Nelements) {
    87142    gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[3]);
     143    return (FALSE);
     144  }
     145  if (tvec && tvec[0].Nelements != yvec[0].Nelements) {
     146    gprint (GP_ERR, "logic test vector not the same length as data vectors\n");
    88147    return (FALSE);
    89148  }
     
    103162  }
    104163
     164  if (tvec) {
     165    ALLOCATE (mask, char, tvec->Nelements);
     166    for (i = 0; i < tvec->Nelements; i++) {
     167      mask[i] = (tvec->type == OPIHI_FLT) ? (tvec->elements.Flt[i] == 0.0) : (tvec->elements.Int[i] == 0.0);
     168    }
     169  }
     170
    105171  /* point size determined by Zvec */
    106172  graphmode.style = 2; /* plot points */
    107173  graphmode.color = -1; /* point color determined by Zvec */
    108174  graphmode.etype = 0; /* no errorbars */
    109   PlotVectorTriplet (kapa, xvec, yvec, &Zvec, &graphmode);
     175  PlotVectorTriplet (kapa, xvec, yvec, &Zvec, mask, &graphmode);
    110176
    111177  free (Zvec.elements.Ptr);
     178  if (mask) free (mask);
     179  DeleteNamedVector (outname);
    112180
    113181  return (TRUE);
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/Makefile

    r33662 r34772  
    6767$(SRC)/lightcurve.$(ARCH).o             \
    6868$(SRC)/mextract.$(ARCH).o               \
     69$(SRC)/mmatch.$(ARCH).o         \
    6970$(SRC)/mmextract.$(ARCH).o              \
    7071$(SRC)/objectcoverage.$(ARCH).o         \
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/avextract.c

    r34405 r34772  
    137137  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    138138  if (PARALLEL && !HOST_ID) {
    139     int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0, VERBOSE);
     139    int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, 0, VERBOSE);
    140140
    141141    dbFreeFields (fields, Nfields);
     
    325325    gprint (GP_ERR, "  <photcode>:nphot : number of measurements used for average magnitude in this photcode\n");
    326326
     327    // gprint (GP_ERR, "  <photcode>:ap :  catalog aperture magnitude for photcode\n");
     328    // gprint (GP_ERR, "  <photcode>:aper :  catalog aperture magnitude for photcode\n");
     329    // gprint (GP_ERR, "  <photcode>:aveerr : average error (stdev)\n");
     330    // gprint (GP_ERR, "  <photcode>:aperinst : aperture flux\n");
     331    // gprint (GP_ERR, "  <photcode>:aper_inst : aperture flux\n");
     332
     333    gprint (GP_ERR, "  <photcode>:kron : kron flux\n");
     334    // gprint (GP_ERR, "  <photcode>:kronerr : kron error\n");
     335    gprint (GP_ERR, "  <photcode>:photflags : photometry flags for measurements\n");
     336    gprint (GP_ERR, "  <photcode>:flags : photometry flags for measurements\n");
     337    gprint (GP_ERR, "  <photcode>:stdev : standard deviation of measurements\n");
     338    gprint (GP_ERR, "  <photcode>:20 : 20 percentile psf mag\n");
     339    gprint (GP_ERR, "  <photcode>:80 : 80 percentile psf mag\n");
     340    gprint (GP_ERR, "  <photcode>:ucdist : distance to ubercalibrated exposure (in exposure overlaps)\n");
     341    gprint (GP_ERR, "  <photcode>:stackDetectID : PSPS ID for stack detection\n");
     342    gprint (GP_ERR, "  <photcode>:fluxpsf : psf flux\n");
     343    gprint (GP_ERR, "  <photcode>:fluxpsferr : psf flux error\n");
     344    gprint (GP_ERR, "  <photcode>:fluxkron : kron flux\n");
     345    gprint (GP_ERR, "  <photcode>:fluxkronerr : kron flux error\n");
     346
    327347    // gprint (GP_ERR, "  type : dophot type (unused)\n");
    328348    // gprint (GP_ERR, "  typefrac : dophot type fraction (unused)\n");
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/avmatch.c

    r34405 r34772  
    9595
    9696    // I need to pass the RA & DEC vectors to the remote clients...
    97     int status = HostTableParallelOps (argc, argv, RESULT_FILE, RAvec->Nelements, VERBOSE);
     97    int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);
    9898    if (vec) free (vec);
    9999   
     
    203203      Npts = j;
    204204
    205       if (Ncat == -1) continue;
    206       if (Ncat == -2) continue;
     205      if (Ncat == -1) continue; // this point is not in this catalog file
     206      if (Ncat == -2) continue; // no matches to this point
    207207
    208208      m = catalog.average[Ncat].measureOffset;
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/dvo_host_utils.c

    r34260 r34772  
    7979}
    8080
    81 // bundle the arguments into a command and pass to dvo_client.  this implementation
    82 // expects there to be a result file from the clients, and to load this into vectors in
    83 // the main shell.  'Nelements' is a temp hack : for most commands, the result vectors are
    84 // concatenated, but for avmatch, the vectors are merged by index into a pre-known
    85 // length.  this is probably not a solution to a general problem..
    86 int HostTableParallelOps (int argc, char **argv, char *ResultFile, int Nelements, int VERBOSE) {
     81// bundle the arguments into a command and pass to dvo_client. 
     82
     83// the normal ending step expects there to be a result file from the clients, and to load
     84// this into vectors in the main shell.  'Nelements' is a temp hack : for most commands,
     85// the result vectors are concatenated, but for avmatch, the vectors are merged by index
     86// into a pre-known length.  this is probably not a solution to a general problem..
     87
     88// an alternative ending step ignores the result files and instead saves the names into
     89// the list 'result:n' for the user to access as desired
     90int HostTableParallelOps (int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE) {
    8791
    8892  int i;
     
    153157  }
    154158
     159  // create the result file list
     160  char name[256];
     161  snprintf (name, 256, "RESULT_FILE:n");
     162  set_int_variable (name, table->Nhosts);
     163  snprintf (name, 256, "RESULT_DATA:n");
     164  set_int_variable (name, table->Nhosts);
     165  snprintf (name, 256, "RESULT_STATUS:n");
     166  set_int_variable (name, table->Nhosts);
     167
    155168  // load fields from file
    156169  int    Nvec = 0;
    157170  Vector **vec = NULL;
    158171  for (i = 0; i < table->Nhosts; i++) {
     172
     173    snprintf (name, 256, "RESULT_FILE:%d", i);
     174    set_str_variable (name, table->hosts[i].results);
     175
     176    // DATA : 0 (unread), 1 (read)
     177    snprintf (name, 256, "RESULT_DATA:%d", i);
     178    set_int_variable (name, 0);
     179
     180    // STATUS : 0 (normal exit), -1 (crash), N (failure exit status)
     181    snprintf (name, 256, "RESULT_STATUS:%d", i);
     182    set_int_variable (name, table->hosts[i].status);
     183
    159184    if (table->hosts[i].status) continue;
     185
     186    if (ReadVectors) {
     187      int    Ninvec = 0;
     188      Vector **invec = ReadVectorTableFITS (table->hosts[i].results, "RESULT", &Ninvec);
     189      if (!invec) {
     190        // failed to read the file, now what?
     191        gprint (GP_ERR, "failed to read remote result file : %s\n", table->hosts[i].results);
     192        free (table->hosts[i].results);
     193        table->hosts[i].results = NULL;
     194        continue;
     195      }
     196      free (table->hosts[i].results);
     197      table->hosts[i].results = NULL;
     198      set_int_variable (name, 1); // result file has been read
     199
     200      if (Nelements == 0) {
     201        vec = MergeVectors (vec, &Nvec, invec, Ninvec);
     202        if (vec != invec) {
     203          FreeVectorArray (invec, Ninvec);
     204        }
     205      } else {
     206        vec = MergeVectorsByIndex (vec, &Nvec, invec, Ninvec, Nelements);
     207        FreeVectorArray (invec, Ninvec);
     208      }
     209    }
     210  }
     211
     212  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
     213  if (ResultFile) {
     214    int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nvec, FALSE, NULL);
     215    if (!status) {
     216      gprint (GP_ERR, "failed to write result file %s\n", ResultFile);
     217      return FALSE;
     218    }
     219  }
     220
     221  for (i = 0; i < Nvec; i++) {
     222    AssignVector (vec[i], vec[i]->name, ANYVECTOR, TRUE);
     223  }
     224  free (vec);
     225
     226  free (table);
     227  return TRUE;
     228}
     229
     230// re-gather the remote results files: this can be used in case one of the clients failed,
     231// and has since been re-run
     232int HostTableReloadResults (char *uniquer, int VERBOSE) {
     233
     234  int i;
     235
     236  // load the list of hosts
     237  SkyTable *sky = GetSkyTable();
     238  if (!sky) {
     239    gprint (GP_ERR, "failed to load sky table for database\n");
     240    return FALSE;
     241  }
     242
     243  char *CATDIR = GetCATDIR ();
     244  if (!CATDIR) {
     245    gprint (GP_ERR, "failed to get CATDIR for database\n");
     246    return FALSE;
     247  }
     248
     249  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     250  if (!table) {
     251    gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     252    return FALSE;
     253  }   
     254
     255  // load fields from file
     256  int    Nvec = 0;
     257  Vector **vec = NULL;
     258  for (i = 0; i < table->Nhosts; i++) {
     259    // ensure that the paths are absolute path names
     260    char *tmppath = abspath (table->hosts[i].pathname, DVO_MAX_PATH);
     261    free (table->hosts[i].pathname);
     262    table->hosts[i].pathname = tmppath;
     263
     264    // need to save the results filename with the uniquer
     265    // XXX a bit of a waste (but only 1024 * 60 bytes or so
     266    ALLOCATE (table->hosts[i].results, char, DVO_MAX_PATH);
     267    snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s.fits", table->hosts[i].pathname, uniquer);
    160268
    161269    int    Ninvec = 0;
     
    171279    table->hosts[i].results = NULL;
    172280
    173     if (Nelements == 0) {
    174       vec = MergeVectors (vec, &Nvec, invec, Ninvec);
    175       if (vec != invec) {
    176         FreeVectorArray (invec, Ninvec);
    177       }
    178     } else {
    179       vec = MergeVectorsByIndex (vec, &Nvec, invec, Ninvec, Nelements);
     281    // fprintf (stderr, "%s : %d\n", table->hosts[i].pathname, invec[0]->Nelements);
     282
     283    vec = MergeVectors (vec, &Nvec, invec, Ninvec);
     284    if (vec != invec) {
    180285      FreeVectorArray (invec, Ninvec);
    181     }
    182   }
    183 
    184   // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    185   if (ResultFile) {
    186     int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nvec, FALSE, NULL);
    187     if (!status) {
    188       gprint (GP_ERR, "failed to write result file %s\n", ResultFile);
    189       return FALSE;
    190286    }
    191287  }
     
    199295  return TRUE;
    200296}
    201 
    202 // re-gather the remote results files: this can be used in case one of the clients failed,
    203 // and has since been re-run
    204 int HostTableReloadResults (char *uniquer, int VERBOSE) {
    205 
    206   int i;
    207 
    208   // load the list of hosts
    209   SkyTable *sky = GetSkyTable();
    210   if (!sky) {
    211     gprint (GP_ERR, "failed to load sky table for database\n");
    212     return FALSE;
    213   }
    214 
    215   char *CATDIR = GetCATDIR ();
    216   if (!CATDIR) {
    217     gprint (GP_ERR, "failed to get CATDIR for database\n");
    218     return FALSE;
    219   }
    220 
    221   HostTable *table = HostTableLoad (CATDIR, sky->hosts);
    222   if (!table) {
    223     gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
    224     return FALSE;
    225   }   
    226 
    227   // load fields from file
    228   int    Nvec = 0;
    229   Vector **vec = NULL;
    230   for (i = 0; i < table->Nhosts; i++) {
    231     // ensure that the paths are absolute path names
    232     char *tmppath = abspath (table->hosts[i].pathname, DVO_MAX_PATH);
    233     free (table->hosts[i].pathname);
    234     table->hosts[i].pathname = tmppath;
    235 
    236     // need to save the results filename with the uniquer
    237     // XXX a bit of a waste (but only 1024 * 60 bytes or so
    238     ALLOCATE (table->hosts[i].results, char, DVO_MAX_PATH);
    239     snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s.fits", table->hosts[i].pathname, uniquer);
    240 
    241     int    Ninvec = 0;
    242     Vector **invec = ReadVectorTableFITS (table->hosts[i].results, "RESULT", &Ninvec);
    243     if (!invec) {
    244       // failed to read the file, now what?
    245       gprint (GP_ERR, "failed to read remote result file : %s\n", table->hosts[i].results);
    246       free (table->hosts[i].results);
    247       table->hosts[i].results = NULL;
    248       continue;
    249     }
    250     free (table->hosts[i].results);
    251     table->hosts[i].results = NULL;
    252 
    253     // fprintf (stderr, "%s : %d\n", table->hosts[i].pathname, invec[0]->Nelements);
    254 
    255     vec = MergeVectors (vec, &Nvec, invec, Ninvec);
    256     if (vec != invec) {
    257       FreeVectorArray (invec, Ninvec);
    258     }
    259   }
    260 
    261   for (i = 0; i < Nvec; i++) {
    262     AssignVector (vec[i], vec[i]->name, ANYVECTOR, TRUE);
    263   }
    264   free (vec);
    265 
    266   free (table);
    267   return TRUE;
    268 }
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/fitcolors.c

    r28241 r34772  
    311311        KapaBox (kapa, &graphdata);
    312312
    313         PlotVectorPair (kapa, xvec, yvec, &graphdata);
     313        PlotVectorPair (kapa, xvec, yvec, NULL, &graphdata);
    314314
    315315        for (i = 0; i < 11; i++) {
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/images.c

    r34088 r34772  
    350350    graphmode.ptype = 100; /* connect pairs of points */
    351351    graphmode.etype = 0;
    352     PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     352    PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    353353  }
    354354
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/imbox.c

    r27435 r34772  
    123123    graphmode.ptype = 100; /* connect pairs of points */
    124124    graphmode.etype = 0;
    125     PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     125    PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    126126  }
    127127
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/imdense.c

    r31635 r34772  
    6565    graphmode.style = 2; /* points */
    6666    graphmode.etype = 0;
    67     PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     67    PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    6868  }
    6969
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/imstats.c

    r31635 r34772  
    5454  graphmode.style = 2;
    5555  graphmode.etype = 0;
    56   PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     56  PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    5757 
    5858  free (Xvec.elements.Flt);
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/init.c

    r33662 r34772  
    4242int lightcurve      PROTO((int, char **));
    4343int mextract        PROTO((int, char **));
     44int mmatch          PROTO((int, char **));
    4445int mmextract       PROTO((int, char **));
    4546int objectcoverage  PROTO((int, char **));
     
    9798  {1, "lightcurve",  lightcurve,   "extract lightcurve for a star"},
    9899  {1, "mextract",    mextract,     "extract measure data values"},
     100  {1, "mmatch",      mmatch,       "extract measure data values matched to RA,DEC points"},
    99101  {1, "mmextract",   mmextract,    "extract joined measurements"},
    100102  {1, "objectcoverage", objectcoverage, "plot catalog boundaries"},
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/lcurve.c

    r34088 r34772  
    160160    PlotVectorPairErrors (kapa, &Xvec, &Yvec, &dYvec, &graphmode);
    161161  } else {
    162     PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     162    PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    163163  }
    164164
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/mextract.c

    r34260 r34772  
    108108  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    109109  if (PARALLEL && !HOST_ID) {
    110     int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0, VERBOSE);
     110    int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, 0, VERBOSE);
    111111
    112112    dbFreeFields (fields, Nfields);
     
    313313    gprint (GP_ERR, "  Npos  : number of measurments used for astrometry\n");
    314314
    315     gprint (GP_ERR, "  objflags  : object flags\n");
    316     gprint (GP_ERR, "  photflags : detection flags from image analysis\n");
    317     gprint (GP_ERR, "  dbflags : detection flags from database analysis\n");
     315    gprint (GP_ERR, "  objflags  : object flags [alias: obj_flags]\n");
     316    gprint (GP_ERR, "  secflags  : average photometry flags [aliases: obj_phot_flags, sec_flags, secfilt_flags]\n");
     317    gprint (GP_ERR, "  photflags : detection flags from image analysis [alias: phot_flags]\n");
     318    gprint (GP_ERR, "  dbflags : detection flags from database analysis [alias: db_flags]\n");
    318319
    319320    gprint (GP_ERR, "  obj_flags : object flags\n");
     
    321322    gprint (GP_ERR, "  db_flags : detection flags from database analysis\n");
    322323
     324    gprint (GP_ERR, "  airmass : airmass of detection\n");
     325    gprint (GP_ERR, "  meas_airmass : airmass of exposure\n");
     326    gprint (GP_ERR, "  alt : altitude of detection\n");
     327    gprint (GP_ERR, "  az  : azimuth of detection\n");
     328    gprint (GP_ERR, "  exptime : exposure time [s]\n");
     329    gprint (GP_ERR, "  photcode : photcode \n");
     330    gprint (GP_ERR, "  photcode:equiv : equivalent average photcode \n");
     331    gprint (GP_ERR, "  photcode:c : zero point of photcode \n");
     332    gprint (GP_ERR, "  photcode:klam : airmass slope of photcode \n");
     333    gprint (GP_ERR, "  time : time of exposure [Seconds since Jan 1, 1970/\n");
     334    gprint (GP_ERR, "  fwhm : fwhm (average) of fitted PSF [pixels]\n");
     335    gprint (GP_ERR, "  fwhm_maj : fwhm (major axis) of fitted PSF [pixels]\n");
     336    gprint (GP_ERR, "  fwhm_min : fwhm (minor axis) of fitted PSF [pixels]\n");
     337    gprint (GP_ERR, "  theta : position angle of fitted PSF\n");
     338    gprint (GP_ERR, "  posangle : position angle of detector at measurement [degrees]\n");
     339    gprint (GP_ERR, "  platescale : plate scale of detector at measurement [arcsec/pixel] (negative = sky parity)\n");
     340
     341    gprint (GP_ERR, "  Mxx : second moment in X [pixels^2]\n");
     342    gprint (GP_ERR, "  Mxy : second moment cross term [pixels^2]\n");
     343    gprint (GP_ERR, "  Myy : second moment in Y [pixels^2]\n");
     344
     345    gprint (GP_ERR, "  xccd : ccd x position\n");
     346    gprint (GP_ERR, "  yccd : ccd y position\n");
     347    gprint (GP_ERR, "  xoff : ccd x correction\n");
     348    gprint (GP_ERR, "  yoff : ccd y correction\n");
     349    gprint (GP_ERR, "  xccd:err : ccd x position error\n");
     350    gprint (GP_ERR, "  yccd:err : ccd y position error\n");
     351
     352    gprint (GP_ERR, "  pos_sys_err : systematic position error\n");
     353
     354    gprint (GP_ERR, "  xmosaic : mosaic x position\n");
     355    gprint (GP_ERR, "  ymosaic : mosaic y position\n");
     356
     357    gprint (GP_ERR, "  xchip : chip x position (= ccd position)\n");
     358    gprint (GP_ERR, "  ychip : chip y position (= ccd position)\n");
     359    gprint (GP_ERR, "  xfpa : fpa x position (= mosaic position)\n");
     360    gprint (GP_ERR, "  yfpa : fpa y position (= mosaic position)\n");
     361
     362    gprint (GP_ERR, "  detID : ID of detection (unique on source image)\n");
     363    gprint (GP_ERR, "  objID : object ID (32 bit, unique in catalog)\n");
     364    gprint (GP_ERR, "  catID : catalog ID (32 bit)\n");
     365    gprint (GP_ERR, "  imageID : ID of source image (32 bit)\n");
     366    gprint (GP_ERR, "  externID : externID of source image (32 bit)\n");
     367
     368    gprint (GP_ERR, "  psf_qf : PSF quality factor (psf-weighted mask fraction)\n");
     369    gprint (GP_ERR, "  psf_qf_perfect : PSF quality factor, perfect mask version (psf-weighted mask fraction)\n");
     370
     371    gprint (GP_ERR, "  psf_chisq : PSF fit chi square\n");
     372    gprint (GP_ERR, "  psf_ndof : PSF number of degrees of freedom\n");
     373    gprint (GP_ERR, "  psf_npix : PSF number of pixels\n");
     374
     375    gprint (GP_ERR, "  cr_nsigma : Nsigma deviation towards cosmic ray\n");
     376    gprint (GP_ERR, "  ext_nsigma : Nsigma deviation towards extended source\n");
     377
     378    gprint (GP_ERR, "  sky : sky model flux at measurement location\n");
     379    gprint (GP_ERR, "  sky_err : sky model stdev at measurement location\n");
     380
     381    gprint (GP_ERR, "  Mcal_offset : difference wrt nominal zero point (clouds are positive)\n");
     382    gprint (GP_ERR, "  flat : flat-field correction (measure.Mcal - image.Mcal)\n");
     383
     384    gprint (GP_ERR, "  center_offset : distance to image center\n");
     385    gprint (GP_ERR, "  flux : PSF flux\n");
     386    gprint (GP_ERR, "  flux_err : PSF flux error\n");
     387    gprint (GP_ERR, "  flux_psf : PSF flux\n");
     388    gprint (GP_ERR, "  flux_psf_err : PSF flux error\n");
     389    gprint (GP_ERR, "  flux_kron : KRON flux\n");
     390    gprint (GP_ERR, "  flux_kron_err : KRON flux error\n");
     391
     392    gprint (GP_ERR, "  --- the following fields are selected by giving a photcode with the attached ending\n");
    323393    gprint (GP_ERR, "  <photcode>:ave : average magnitude for photcode (or equivalent)\n");
    324394    gprint (GP_ERR, "  <photcode>:ref : reference magnitude system for photcode (or equivalent)\n");
     
    335405    gprint (GP_ERR, "  <photcode>:ncode : number of measurements in photcode\n");
    336406    gprint (GP_ERR, "  <photcode>:nphot : number of measurements used for average magnitude\n");
    337     gprint (GP_ERR, "  airmass : airmass of detection\n");
    338     gprint (GP_ERR, "  alt : altitude of detection\n");
    339     gprint (GP_ERR, "  az  : azimuth of detection\n");
    340     gprint (GP_ERR, "  exptime : exposure time [s]\n");
    341     gprint (GP_ERR, "  photcode : photcode \n");
    342     gprint (GP_ERR, "  photcode:equiv : equivalent average photcode \n");
    343     gprint (GP_ERR, "  time : time of exposure [Seconds since Jan 1, 1970/\n");
    344     gprint (GP_ERR, "  fwhm : fwhm (average) of fitted PSF [pixels]\n");
    345     gprint (GP_ERR, "  fwhm_maj : fwhm (major axis) of fitted PSF [pixels]\n");
    346     gprint (GP_ERR, "  fwhm_min : fwhm (minor axis) of fitted PSF [pixels]\n");
    347     gprint (GP_ERR, "  theta : position angle of fitted PSF\n");
    348     gprint (GP_ERR, "  posangle : position angle of detector at measurement [degrees]\n");
    349     gprint (GP_ERR, "  platescale : plate scale of detector at measurement [arcsec/pixel] \n");
    350 
    351     gprint (GP_ERR, "  psf_qf : PSF quality factor (psf-weighted mask fraction)\n");
    352     gprint (GP_ERR, "  psf_chisq : PSF fit chi square\n");
    353     gprint (GP_ERR, "  psf_ndof : PSF number of degrees of freedom\n");
    354     gprint (GP_ERR, "  psf_npix : PSF number of pixels\n");
    355 
    356     gprint (GP_ERR, "  cr_nsigma : Nsigma deviation towards cosmic ray\n");
    357     gprint (GP_ERR, "  ext_nsigma : Nsigma deviation towards extended source\n");
    358 
    359     gprint (GP_ERR, "  Mxx : second moment in X [pixels^2]\n");
    360     gprint (GP_ERR, "  Mxy : second moment cross term [pixels^2]\n");
    361     gprint (GP_ERR, "  Myy : second moment in Y [pixels^2]\n");
    362 
    363     gprint (GP_ERR, "  xccd : ccd x position\n");
    364     gprint (GP_ERR, "  yccd : ccd y position\n");
    365     gprint (GP_ERR, "  xccd:err : ccd x position error\n");
    366     gprint (GP_ERR, "  yccd:err : ccd y position error\n");
    367     gprint (GP_ERR, "  xmosaic : mosaic x position\n");
    368     gprint (GP_ERR, "  ymosaic : mosaic y position\n");
    369     gprint (GP_ERR, "  xchip : chip x position (= ccd position)\n");
    370     gprint (GP_ERR, "  ychip : chip y position (= ccd position)\n");
    371     gprint (GP_ERR, "  xfpa : fpa x position (= mosaic position)\n");
    372     gprint (GP_ERR, "  yfpa : fpa y position (= mosaic position)\n");
    373 
    374     gprint (GP_ERR, "  detID : ID of detection (unique on source image)\n");
    375     gprint (GP_ERR, "  objID : object ID (32 bit, unique in catalog)\n");
    376     gprint (GP_ERR, "  catID : catalog ID (32 bit)\n");
    377     gprint (GP_ERR, "  imageID : ID of source image (32 bit)\n");
    378     gprint (GP_ERR, "  externID : externID of source image (32 bit)\n");
    379 
    380     gprint (GP_ERR, "  Mcal_offset : difference wrt nominal zero point (clouds are positive)\n");
    381     gprint (GP_ERR, "  flat : flat-field correction (measure.Mcal - image.Mcal)\n");
     407
     408    gprint (GP_ERR, "  <photcode>:aperinst : instrumental aperture magnitude\n");
     409    gprint (GP_ERR, "  <photcode>:aper_inst : instrumental aperture magnitude\n");
     410    gprint (GP_ERR, "  <photcode>:kron : kron mag\n");
     411    gprint (GP_ERR, "  <photcode>:kroninst : instrumental kron mag\n");
     412    gprint (GP_ERR, "  <photcode>:kron_inst : instrumental kron mag\n");
     413    gprint (GP_ERR, "  <photcode>:kronerr : kron mag error\n");
     414
     415    gprint (GP_ERR, "  <photcode>:photflags : photometry flags for measurements\n");
     416    gprint (GP_ERR, "  <photcode>:flags : photometry flags for measurements\n");
     417    gprint (GP_ERR, "  <photcode>:fluxpsf : average psf flux\n");
     418    gprint (GP_ERR, "  <photcode>:fluxpsferr : average psf flux error\n");
     419    gprint (GP_ERR, "  <photcode>:fluxkron : average kron flux\n");
     420    gprint (GP_ERR, "  <photcode>:fluxkronerr : average kron flux error\n");
     421
    382422    return (FALSE);
    383423  }
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/mmatch.c

    r34678 r34772  
    124124
    125125    // call the remote client
    126     int status = HostTableParallelOps (targc, targv, RESULT_FILE, 0, VERBOSE);
     126    int status = HostTableParallelOps (targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
    127127    if (vec) free (vec);
    128128   
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/procks.c

    r20936 r34772  
    113113  graphmode.style = 2; /* set style to points */
    114114  graphmode.etype = 0; /* no errorbars */
    115   PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     115  PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    116116
    117117  /* now plot vectors between two extrema */
     
    146146  graphmode.etype = 0; /* no errorbars */
    147147
    148   PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     148  PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    149149
    150150  free (Xvec.elements.Flt);
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/remote.c

    r33963 r34772  
    1212    remove_argument (N, &argc, argv);
    1313    VERBOSE = TRUE;
     14  }
     15
     16  int ReadVectors = TRUE;
     17  if ((N = get_argument (argc, argv, "-skip-result"))) {
     18    remove_argument (N, &argc, argv);
     19    ReadVectors = FALSE;
    1420  }
    1521
     
    4349
    4450  // strip of the 'remote' and send the remaining arguments to the remote machine
    45   int status = HostTableParallelOps (argc - 1, &argv[1], NULL, 0, VERBOSE);
     51  int status = HostTableParallelOps (argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE);
    4652  return status;
    4753}
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/showtile.c

    r20936 r34772  
    8686    graphmode.ptype = 100; /* connect pairs of points */
    8787    graphmode.etype = 0;
    88     PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     88    PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    8989  }
    9090
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/simage.c

    r34088 r34772  
    151151  graphmode.etype = 0;
    152152
    153   PlotVectorTriplet (kapa, &Xvec, &Yvec, &Zvec, &graphmode);
     153  PlotVectorTriplet (kapa, &Xvec, &Yvec, &Zvec, NULL, &graphmode);
    154154
    155155  free (Xvec.elements.Flt);
  • branches/czw_branch/20120906/Ohana/src/opihi/dvo/skycat.c

    r34088 r34772  
    100100    graphmode.ptype = 100; /* connect pairs of points */
    101101    graphmode.etype = 0;
    102     PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     102    PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
    103103  }
    104104
  • branches/czw_branch/20120906/Ohana/src/opihi/include/data.h

    r31636 r34772  
    8484
    8585/* in spline.c */
    86 void spline_construct (float *x, float *y, int N, float *y2);
    87 float spline_apply (float *x, float *y, float *y2, int N, float X);
     86void spline_construct_flt (float *x, float *y, int N, float *y2);
     87float spline_apply_flt (float *x, float *y, float *y2, int N, float X);
     88void spline_construct_dbl (opihi_flt *x, opihi_flt *y, int N, opihi_flt *y2);
     89opihi_flt spline_apply_dbl (opihi_flt *x, opihi_flt *y, opihi_flt *y2, int N, opihi_flt X);
    8890
    8991/* in svdcmp.c */
     
    168170void FreeQueues (void);
    169171void FreeBooks (void);
     172
     173// the interpolating spline has valu
     174typedef struct {
     175  int Nknots;
     176  opihi_flt *xk;
     177  opihi_flt *yk;
     178  opihi_flt *y2;
     179  char *name;
     180} Spline;
     181
     182/* in SplineOps.c */
     183void InitSplines ();
     184void FreeSplines ();
     185void InitSpline (Spline *spline, char *name, int Nknots);
     186void FreeSpline (Spline *spline);
     187Spline *GetSpline (int where);
     188Spline *FindSpline (char *name);
     189Spline *CreateSpline (char *name, int Nknots);
     190int DeleteSpline (Spline *spline);
     191void ListSplines ();
     192int SaveSpline (char *filename, char *name, int append);
     193int LoadSpline (char *filename, char *name);
    170194
    171195/* hermitian functions */
  • branches/czw_branch/20120906/Ohana/src/opihi/include/display.h

    r31636 r34772  
    77
    88/*** kapa graph functions ***/
    9 int           PlotVectorSingle      PROTO((int kapa, Vector *vec, char *mode));
    10 int           PlotVectorPair        PROTO((int kapa, Vector *xVec, Vector *yVec, Graphdata *graphmode));
     9int           PlotVectorSingle      PROTO((int kapa, Vector *vec, char *mask, char *mode));
     10int           PlotVectorPair        PROTO((int kapa, Vector *xVec, Vector *yVec, char *mask, Graphdata *graphmode));
    1111int           PlotVectorPairErrors  PROTO((int kapa, Vector *xVec, Vector *yVec, Vector *dyValues, Graphdata *graphmode));
    12 int           PlotVectorTriplet     PROTO((int kapa, Vector *xVec, Vector *yVec, Vector *zValues, Graphdata *graphmode));
     12
     13int           PlotVectorTriplet     PROTO((int kapa, Vector *xVec, Vector *yVec, Vector *zValues, char *mask, Graphdata *graphmode));
    1314// int           GetGraphData          PROTO((Graphdata *data, int *kapa, char *name));
    1415int           GetGraph              PROTO((Graphdata *data, int *kapa, char *name));
  • branches/czw_branch/20120906/Ohana/src/opihi/include/dvoshell.h

    r33963 r34772  
    100100
    101101int          HostTableLaunchJobs    PROTO((HostTable *table, char *basecmd, char *options, int VERBOSE));
    102 int          HostTableParallelOps   PROTO((int argc, char **argv, char *ResultFile, int Nelements, int VERBOSE));
     102int          HostTableParallelOps   PROTO((int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE));
    103103int          HostTableReloadResults PROTO((char *uniquer, int VERBOSE));
    104104
  • branches/czw_branch/20120906/Ohana/src/opihi/lib.data/Makefile

    r31635 r34772  
    2323$(SDIR)/bracket.$(ARCH).o               \
    2424$(SDIR)/spline.$(ARCH).o                \
     25$(SDIR)/SplineOps.$(ARCH).o             \
    2526$(SDIR)/mrqmin.$(ARCH).o                \
    2627$(SDIR)/mrq2dmin.$(ARCH).o              \
  • branches/czw_branch/20120906/Ohana/src/opihi/lib.data/PlotVectors.c

    r20936 r34772  
    11# include "display.h"
    22
    3 int PlotVectorSingle (int kapa, Vector *vec, char *mode) {
    4 
    5   int i, Npts;
     3int PlotVectorSingle (int kapa, Vector *vec, char *mask, char *mode) {
     4
     5  int i, Npts, Nout;
    66  float *temp;
    77
     
    99  ALLOCATE (temp, float, Npts);
    1010
     11  Nout = 0;
    1112  if (vec->type == OPIHI_FLT) {
    1213    opihi_flt *value = vec->elements.Flt;
    1314    for (i = 0; i < Npts; i++) {
    14       temp[i] = value[i];
     15      if (mask && mask[i]) continue;
     16      temp[Nout] = value[i];
     17      Nout ++;
    1518    }
    1619  } else {
    1720    opihi_int *value = vec->elements.Int;
    1821    for (i = 0; i < Npts; i++) {
    19       temp[i] = value[i];
    20     }
    21   }
    22   KapaPlotVector (kapa, Npts, temp, mode);
    23 
    24   free (temp);
    25 
    26   return (TRUE);
    27 }
    28 
    29 int PlotVectorPair (int kapa, Vector *xVec, Vector *yVec, Graphdata *graphmode) {
    30 
    31   int i, Npts;
     22      if (mask && mask[i]) continue;
     23      temp[Nout] = value[i];
     24      Nout ++;
     25    }
     26  }
     27  KapaPlotVector (kapa, Nout, temp, mode);
     28
     29  free (temp);
     30
     31  return (TRUE);
     32}
     33
     34int PlotVectorPair (int kapa, Vector *xVec, Vector *yVec, char *mask, Graphdata *graphmode) {
     35
     36  int i, Npts, Nout;
    3237  float *temp;
    3338
     
    3742  ALLOCATE (temp, float, Npts);
    3843
    39   KapaPrepPlot (kapa, Npts, graphmode);
    40 
     44  Nout = 0;
    4145  if (xVec->type == OPIHI_FLT) {
    4246    opihi_flt *value = xVec->elements.Flt;
    4347    for (i = 0; i < Npts; i++) {
    44       temp[i] = value[i];
     48      if (mask && mask[i]) continue;
     49      temp[Nout] = value[i];
     50      Nout ++;
    4551    }
    4652  } else {
    4753    opihi_int *value = xVec->elements.Int;
    4854    for (i = 0; i < Npts; i++) {
    49       temp[i] = value[i];
    50     }
    51   }
    52   KapaPlotVector (kapa, Npts, temp, "x");
    53 
     55      if (mask && mask[i]) continue;
     56      temp[Nout] = value[i];
     57      Nout ++;
     58    }
     59  }
     60  KapaPrepPlot (kapa, Nout, graphmode);
     61  KapaPlotVector (kapa, Nout, temp, "x");
     62
     63  Nout = 0;
    5464  if (yVec->type == OPIHI_FLT) {
    5565    opihi_flt *value = yVec->elements.Flt;
    5666    for (i = 0; i < Npts; i++) {
    57       temp[i] = value[i];
     67      if (mask && mask[i]) continue;
     68      temp[Nout] = value[i];
     69      Nout ++;
    5870    }
    5971  } else {
    6072    opihi_int *value = yVec->elements.Int;
    6173    for (i = 0; i < Npts; i++) {
    62       temp[i] = value[i];
    63     }
    64   }
    65   KapaPlotVector (kapa, Npts, temp, "y");
    66 
    67   free (temp);
    68 
    69   return (TRUE);
    70 }
    71 
    72 int PlotVectorTriplet (int kapa, Vector *xVec, Vector *yVec, Vector *zVec, Graphdata *graphmode) {
    73 
    74   int i, Npts;
     74      if (mask && mask[i]) continue;
     75      temp[Nout] = value[i];
     76      Nout ++;
     77    }
     78  }
     79  KapaPlotVector (kapa, Nout, temp, "y");
     80
     81  free (temp);
     82
     83  return (TRUE);
     84}
     85
     86int PlotVectorTriplet (int kapa, Vector *xVec, Vector *yVec, Vector *zVec, char *mask, Graphdata *graphmode) {
     87
     88  int i, Npts, Nout;
    7589  float *temp;
    7690
     
    8195  ALLOCATE (temp, float, Npts);
    8296
    83   KapaPrepPlot (kapa, Npts, graphmode);
    84 
     97  Nout = 0;
    8598  if (xVec->type == OPIHI_FLT) {
    8699    opihi_flt *value = xVec->elements.Flt;
    87100    for (i = 0; i < Npts; i++) {
    88       temp[i] = value[i];
     101      if (mask && mask[i]) continue;
     102      temp[Nout] = value[i];
     103      Nout ++;
    89104    }
    90105  } else {
    91106    opihi_int *value = xVec->elements.Int;
    92107    for (i = 0; i < Npts; i++) {
    93       temp[i] = value[i];
    94     }
    95   }
    96   KapaPlotVector (kapa, Npts, temp, "x");
    97 
     108      if (mask && mask[i]) continue;
     109      temp[Nout] = value[i];
     110      Nout ++;
     111    }
     112  }
     113  KapaPrepPlot (kapa, Nout, graphmode);
     114  KapaPlotVector (kapa, Nout, temp, "x");
     115
     116  Nout = 0;
    98117  if (yVec->type == OPIHI_FLT) {
    99118    opihi_flt *value = yVec->elements.Flt;
    100119    for (i = 0; i < Npts; i++) {
    101       temp[i] = value[i];
     120      if (mask && mask[i]) continue;
     121      temp[Nout] = value[i];
     122      Nout ++;
    102123    }
    103124  } else {
    104125    opihi_int *value = yVec->elements.Int;
    105126    for (i = 0; i < Npts; i++) {
    106       temp[i] = value[i];
    107     }
    108   }
    109   KapaPlotVector (kapa, Npts, temp, "y");
    110 
     127      if (mask && mask[i]) continue;
     128      temp[Nout] = value[i];
     129      Nout ++;
     130    }
     131  }
     132  KapaPlotVector (kapa, Nout, temp, "y");
     133
     134  Nout = 0;
    111135  if (zVec->type == OPIHI_FLT) {
    112136    opihi_flt *value = zVec->elements.Flt;
    113137    for (i = 0; i < Npts; i++) {
    114       temp[i] = value[i];
     138      if (mask && mask[i]) continue;
     139      temp[Nout] = value[i];
     140      Nout ++;
    115141    }
    116142  } else {
    117143    opihi_int *value = zVec->elements.Int;
    118144    for (i = 0; i < Npts; i++) {
    119       temp[i] = value[i];
    120     }
    121   }
    122   KapaPlotVector (kapa, Npts, temp, "z");
     145      if (mask && mask[i]) continue;
     146      temp[Nout] = value[i];
     147      Nout ++;
     148    }
     149  }
     150  KapaPlotVector (kapa, Nout, temp, "z");
    123151
    124152  free (temp);
  • branches/czw_branch/20120906/Ohana/src/opihi/lib.data/spline.c

    r16119 r34772  
    22
    33/* construct the natural spline for x, y in y2 */
    4 void spline_construct (float *x, float *y, int N, float *y2) {
     4void spline_construct_flt (float *x, float *y, int N, float *y2) {
    55
    66  int i;
     
    2727
    2828/* evaluate spline for x, y, y2 at X */
    29 float spline_apply (float *x, float *y, float *y2, int N, float X) {
     29float spline_apply_flt (float *x, float *y, float *y2, int N, float X) {
    3030
    3131  int i, lo, hi;
     
    5858
    5959}
     60
     61/* construct the natural spline for x, y in y2 */
     62void spline_construct_dbl (opihi_flt *x, opihi_flt *y, int N, opihi_flt *y2) {
     63
     64  int i;
     65  opihi_flt dy, dx, *tmp;
     66 
     67  ALLOCATE (tmp, opihi_flt, N);
     68
     69  y2[0] = tmp[0] = 0.0;
     70 
     71  for (i = 1; i < N-1; i++) {
     72    dx = (x[i+0] - x[i-1]) / (x[i+1] - x[i-1]);
     73    dy = dx * y2[i-1] + 2.0;
     74    y2[i] = (dx - 1.0) / dy;
     75    tmp[i] = (y[i+1] - y[i+0]) / (x[i+1] - x[i+0]) - (y[i+0] - y[i-1]) / (x[i+0] - x[i-1]);
     76    tmp[i] = (6.0 * tmp[i] / (x[i+1] - x[i-1]) - dx*tmp[i-1]) / dy;
     77  }
     78 
     79  y2[N-1] = 0;
     80  for (i = N-2; i >= 1; i--)
     81    y2[i] = y2[i]*y2[i+1] + tmp[i];
     82
     83  free (tmp);
     84}
     85
     86/* evaluate spline for x, y, y2 at X */
     87opihi_flt spline_apply_dbl (opihi_flt *x, opihi_flt *y, opihi_flt *y2, int N, opihi_flt X) {
     88
     89  int i, lo, hi;
     90  opihi_flt dx, a, b, value;
     91 
     92  /* find correct element in array (x must be sorted) */
     93  lo = 0;
     94  hi = N-1;
     95  while (hi - lo > 1) {
     96    i = 0.5*(hi+lo);
     97    if (x[i] > X) {
     98      hi = i;
     99    } else {
     100      lo = i;
     101    }
     102  }
     103
     104  /* error condition: duplicate abssisca */
     105  dx = x[hi] - x[lo];
     106  if (dx == 0.0) {
     107    return (HUGE_VAL);
     108  }
     109
     110  /* evaluate spline */
     111  a = (x[hi] - X) / dx;
     112  b = (X - x[lo]) / dx;
     113
     114  value = a*y[lo] + b*y[hi] + ((a*a*a - a)*y2[lo] + (b*b*b - b)*y2[hi])*(dx*dx) / 6.0;
     115  return (value);
     116
     117}
  • branches/czw_branch/20120906/Ohana/src/opihi/lib.shell/VectorIO.c

    r33963 r34772  
    22 
    33// write a set of vectors to a FITS file (vectors names become fits column names)
    4 int WriteVectorTableFITS (char *filename, char *extname, Vector **vec, int Nvec, int append, char *format) {
    5  
     4int WriteVectorTable (Header *theader, FTable *ftable, char *extname, Vector **vec, int Nvec, char *format) {
     5 
     6  int j;
     7
    68  char *tformat = NULL;
    7   Header header;
    8   Matrix matrix;
    9   Header theader;
    10   FTable ftable;
    11 
    12   int j;
    13   FILE *f = NULL;
    14 
    15   /* open file for outuput */
    16   if (append) {
    17     f = fopen (filename, "a");
    18   } else {
    19     f = fopen (filename, "w");
    20   }
    21   if (f == (FILE *) NULL) {
    22     gprint (GP_ERR, "can't open file for write : %s\n", filename);
    23     return (FALSE);
    24   }
    25 
    26   if (!append) {
    27     gfits_init_header (&header);
    28     header.extend = TRUE;
    29     gfits_create_header (&header);
    30     gfits_create_matrix (&header, &matrix);
    31   }
    32 
    33   gfits_create_table_header (&theader, "BINTABLE", extname);
     9
     10  gfits_create_table_header (theader, "BINTABLE", extname);
    3411
    3512  ALLOCATE (tformat, char, 2*Nvec);
     
    7148  // this somehow
    7249  for (j = 0; j < Nvec; j++) {
    73     gfits_define_bintable_column (&theader, &tformat[2*j], vec[j][0].name, NULL, NULL, 1.0, 0.0);
     50    gfits_define_bintable_column (theader, &tformat[2*j], vec[j][0].name, NULL, NULL, 1.0, 0.0);
    7451  }
    7552  free (tformat);
    7653
    7754  // generate the output array that carries the data
    78   gfits_create_table (&theader, &ftable);
     55  gfits_create_table (theader, ftable);
    7956
    8057  // add the vectors to the output array
    8158  for (j = 0; j < Nvec; j++) {
    8259    if (vec[j][0].type == OPIHI_FLT) {
    83       gfits_set_bintable_column_reformat (&theader, &ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements);
     60      gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements);
    8461    } else {
    85       gfits_set_bintable_column_reformat (&theader, &ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements);
    86     }
    87   }
     62      gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements);
     63    }
     64  }
     65  return (TRUE);
     66
     67 escape:
     68  if (tformat) free (tformat);
     69  return (FALSE);
     70}
     71 
     72// write a set of vectors to a FITS file (vectors names become fits column names)
     73int WriteVectorTableFITS (char *filename, char *extname, Vector **vec, int Nvec, int append, char *format) {
     74 
     75  Header header;
     76  Matrix matrix;
     77  Header theader;
     78  FTable ftable;
     79
     80  FILE *f = NULL;
     81
     82  /* open file for outuput */
     83  if (append) {
     84    f = fopen (filename, "a");
     85  } else {
     86    f = fopen (filename, "w");
     87  }
     88  if (f == (FILE *) NULL) {
     89    gprint (GP_ERR, "can't open file for write : %s\n", filename);
     90    return (FALSE);
     91  }
     92
     93  if (!WriteVectorTable (&theader, &ftable, extname, vec, Nvec, format)) goto escape;
    8894
    8995  if (!append) {
     96    gfits_init_header (&header);
     97    header.extend = TRUE;
     98    gfits_create_header (&header);
     99    gfits_create_matrix (&header, &matrix);
    90100    gfits_fwrite_header  (f, &header);
    91101    gfits_fwrite_matrix  (f, &matrix);
     
    111121  gfits_free_table (&ftable);
    112122
    113   if (tformat) free (tformat);
    114123  fclose (f);
    115124  fflush (f);
  • branches/czw_branch/20120906/Ohana/src/photdbc/src/ConfigInit.c

    r33963 r34772  
    1414  char *config, *file;
    1515  char CatdirPhotcodeFile[256];
    16   char MasterPhotcodeFile[256];
    1716
    1817  /*** load configuration info ***/
     
    6059  free (tmpcatdir);
    6160
    62   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    63 
    6461  sprintf (ImageCat, "%s/Images.dat", CATDIR);
    6562
     
    7370  /* XXX this does not yet write out the master photcode table */
    7471  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    75   if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, TRUE)) {
     72  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
    7673    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    7774    exit (1);
  • branches/czw_branch/20120906/Ohana/src/relastro/include/relastro.h

    r33963 r34772  
    271271void          initstats           PROTO((char *mode));
    272272int           liststats           PROTO((double *value, double *dvalue, int N, StatType *stats));
     273int           liststats_pos       PROTO((double *value, double *dvalue, int N, StatType *stats, int XVERB));
    273274Catalog      *load_catalogs       PROTO((SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath));
    274275int           load_images         PROTO((FITS_DB *db, SkyList *skylist));
  • branches/czw_branch/20120906/Ohana/src/relastro/src/ConfigInit.c

    r33963 r34772  
    55  char  *config, *file;
    66  char CatdirPhotcodeFile[256];
    7   char MasterPhotcodeFile[256];
    87  struct stat filestat;
    98  int status;
     
    4645  ScanConfig(config, "CATMODE",                "%s",  0, CATMODE);
    4746  ScanConfig(config, "CATFORMAT",              "%s",  0, CATFORMAT);
    48   ScanConfig(config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    4947
    5048  // Defaults for WHERE_A are established in db_utils.c: intializeConstraints
     
    7371  /* update master photcode table if not defined */
    7472  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    75   if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    76     fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
     73  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
     74    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    7775    exit (1);
    7876  }
  • branches/czw_branch/20120906/Ohana/src/relastro/src/ImageOps.c

    r34088 r34772  
    174174  for (i = 0; i < Ncatalog; i++) {
    175175    for (j = 0; j < catalog[i].Nmeasure; j++) {
    176       // XXX : update to optionally restrict by photcode equiv a la relphot
    177       // ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);
    178       // if (photcode[0].code != ecode) continue;
     176      if (NphotcodesSkip > 0) {
     177        int k;
     178        int found = FALSE;
     179        for (k = 0; (k < NphotcodesSkip) && !found; k++) {
     180          if (photcodesSkip[k][0].code == catalog[i].measure[j].photcode) found = TRUE;
     181          if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(catalog[i].measure[j].photcode)) found = TRUE;
     182        }
     183        if (found) continue;
     184      } 
    179185      matchImage (catalog, j, i, MATCHCAT);
    180186    }
  • branches/czw_branch/20120906/Ohana/src/relastro/src/UpdateObjects.c

    r34405 r34772  
    103103      mode = FIT_MODE;
    104104
     105      // XVERB |= (catalog[i].averge[j].objID == 0xc90) && (catalog[i].average[j].catID == 0x2a1e);
     106      XVERB |= (catalog[i].average[j].objID == OBJ_ID_SRC) && (catalog[i].average[j].catID == CAT_ID_SRC);
     107      XVERB |= (catalog[i].average[j].objID == OBJ_ID_DST) && (catalog[i].average[j].catID == CAT_ID_DST);
     108
    105109      // find the basic properties of the detections for this object (Tmin, Tmax, Tmean)
    106110      for (k = 0; k < catalog[i].average[j].Nmeasure; k++) {
     111
     112        if (XVERB) {
     113          char *date = ohana_sec_to_date (measure[k].t);
     114          int dbFlagsBig = measureBig ? measureBig[k].dbFlags : 0;
     115          fprintf (stderr, OFF_T_FMT" %f %f %s : 0x%08x : 0x%08x\n",  k, measure[k].dR, measure[k].dD, date, measure[k].dbFlags, dbFlagsBig);
     116          free (date);
     117        }
    107118
    108119        // does the measurement pass the supplied filtering constraints?
     
    113124        }
    114125
    115         //outlier rejection
     126        // outlier rejection
    116127        if (FlagOutlier && (measure[k].dbFlags & ID_MEAS_POOR_ASTROM)) {
    117128          measure[k].dbFlags &= ~ID_MEAS_USED_OBJ;
     
    138149        if (isnan(dX[N])) {
    139150          measure[k].dbFlags &= ~ID_MEAS_USED_OBJ;
     151          if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; }
    140152          continue;
    141153        }
    142154        if (isnan(dY[N])) {
    143155          measure[k].dbFlags &= ~ID_MEAS_USED_OBJ;
     156          if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; }
    144157          continue;
    145158        }
     
    168181      }
    169182
    170       // if we have too few good detections for the desired fit, or too limited a baseline, use a
    171       // fit with fewer parameters.  XXX if we have too few parameters for even the average
    172       // position, consider including the lower-quality detections
    173 
    174       catalog[i].average[j].flags &= ~ID_STAR_FEW;
     183      // if we have too few good detections for the desired fit, or too limited a
     184      // baseline, use a fit with fewer parameters.  XXX if we have too few measurements
     185      // for even the average position, consider including the lower-quality detections?
     186
     187      catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM;
    175188
    176189      // find Tmin & Tmax from the list of accepted measurements
     
    197210        // XXX need to define PHOTOM and ASTROM object flags
    198211        // XXX reset the average value fields?
    199         catalog[i].average[j].flags |= ID_STAR_FEW;
     212        catalog[i].average[j].flags |= ID_STAR_NO_ASTROM;
    200213        catalog[i].average[j].ChiSqAve  = NAN;
    201214        catalog[i].average[j].ChiSqPM   = NAN;
     
    207220      coords.crval1 = R[0];
    208221      coords.crval2 = D[0];
    209 
    210       // XVERB |= (catalog[i].averge[j].objID == 0xc90) && (catalog[i].average[j].catID == 0x2a1e);
    211       XVERB |= (catalog[i].average[j].objID == OBJ_ID_SRC) && (catalog[i].average[j].catID == CAT_ID_SRC);
    212       XVERB |= (catalog[i].average[j].objID == OBJ_ID_DST) && (catalog[i].average[j].catID == CAT_ID_DST);
    213222
    214223      // to judge the quality of the PM and PAR fits, we need to fit all three models and compare Chisq
     
    266275      // fit the average model
    267276      if ((mode == FIT_AVERAGE) || (mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) {
    268         liststats (R, dR, N, &statsR); // WARNING: this function modifies R (do not use after here)
    269         liststats (D, dD, N, &statsD); // WARNING: this function modifies D (do not use after here)
     277        liststats_pos (R, dR, N, &statsR, XVERB); // WARNING: this function modifies R (do not use after here)
     278        liststats_pos (D, dD, N, &statsD, XVERB); // WARNING: this function modifies D (do not use after here)
    270279
    271280        fitAve.Ro = statsR.mean;
     
    275284        fitAve.dDo = 3600.0*statsD.sigma;
    276285
    277         fitAve.chisq = 0.5*(statsR.chisq + statsD.chisq);
     286        fitAve.chisq = 0.5 * (statsR.chisq + statsD.chisq);
    278287        fitAve.Nfit = N;
    279288
     
    358367      catalog[i].average[j].Trange = (Trange * 86400 * 365.26);
    359368      catalog[i].average[j].Npos = fit.Nfit;
    360       if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f)\n",
     369      if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) chisq=(%f, %f, %f)\n",
    361370                          catalog[i].average[j].R,
    362371                          catalog[i].average[j].D,
     
    365374                          3600*(catalog[i].average[j].D - fit.Do),
    366375                          catalog[i].average[j].uR,
    367                           catalog[i].average[j].uD);
    368 
     376                          catalog[i].average[j].uD,
     377                          fitAve.chisq, fitPM.chisq, fitPAR.chisq);
    369378    }
    370379
  • branches/czw_branch/20120906/Ohana/src/relastro/src/args.c

    r33963 r34772  
    237237  }
    238238
    239   PHOTCODE_SKIP_LIST = NULL;
     239  PHOTCODE_SKIP_LIST = strcreate("SCOS.103a.E,SCOS.4414.OG590,SCOS.4415.OG590,SCOS.IIIaF.OG590,SCOS.IIIaF.RG610,SCOS.IIIaF.RG630,SCOS.IIIaJ.GG385,SCOS.IIIaJ.GG395,SCOS.IVN.RG715,SCOS.IVN.RG9");
    240240  if ((N = get_argument (argc, argv, "-photcode"))) {
    241241    remove_argument (N, &argc, argv);
    242     PHOTCODE_SKIP_LIST = strcreate(argv[N]);
     242    char *tmp1 = strcreate(argv[N]);
     243
     244    int Ntotal = strlen(tmp1) + strlen(PHOTCODE_SKIP_LIST) + 5;
     245
     246    char *tmp2 = NULL;
     247    ALLOCATE (tmp2, char, Ntotal);
     248    snprintf (tmp2, Ntotal, "%s,%s", PHOTCODE_SKIP_LIST, tmp1);
     249
     250    free (tmp1);
     251    free (PHOTCODE_SKIP_LIST);
     252
     253    PHOTCODE_SKIP_LIST = tmp2;
    243254    remove_argument (N, &argc, argv);
    244255  }
  • branches/czw_branch/20120906/Ohana/src/relastro/src/bcatalog.c

    r33652 r34772  
    2626
    2727  DVOAverageFlags averageBits =
    28     ID_STAR_FEW     |
    29     ID_STAR_POOR    |
    30     ID_STAR_FIT_AVE |
    31     ID_STAR_FIT_PM  |
    32     ID_STAR_FIT_PAR |
    33     ID_STAR_USE_AVE |
    34     ID_STAR_USE_PM  |
    35     ID_STAR_USE_PAR;
     28    ID_STAR_FIT_AVE   |
     29    ID_STAR_FIT_PM    |
     30    ID_STAR_FIT_PAR   |
     31    ID_STAR_USE_AVE   |
     32    ID_STAR_USE_PM    |
     33    ID_STAR_USE_PAR   |
     34    ID_STAR_NO_ASTROM ;
    3635
    3736  /* exclude stars not in range or with too few measurements */
  • branches/czw_branch/20120906/Ohana/src/relastro/src/initialize.c

    r33652 r34772  
    1919
    2020  initstats (STATMODE);
    21 
    22   // IMAGE_BAD = ID_IMAGE_ASTROM_POOR | ID_IMAGE_ASTROM_FEW | ID_IMAGE_ASTROM_SKIP;
    23   // STAR_BAD  = ID_STAR_POOR | ID_STAR_FEW;
    24   // MEAS_BAD  = ID_MEAS_NOCAL | ID_MEAS_POOR_ASTROM | ID_MEAS_SKIP_ASTROM | ID_MEAS_AREA;
    2521
    2622  /* XXX drop irrelevant entries */
     
    5753
    5854  initstats (STATMODE);
    59 
    60   // IMAGE_BAD = ID_IMAGE_ASTROM_POOR | ID_IMAGE_ASTROM_FEW | ID_IMAGE_ASTROM_SKIP;
    61   // STAR_BAD  = ID_STAR_POOR | ID_STAR_FEW;
    62   // MEAS_BAD  = ID_MEAS_NOCAL | ID_MEAS_POOR_ASTROM | ID_MEAS_SKIP_ASTROM | ID_MEAS_AREA;
    6355}
    6456
  • branches/czw_branch/20120906/Ohana/src/relastro/src/liststats.c

    r17214 r34772  
    136136    dS += M;
    137137  }
    138   X2 = X2 / Nm;
     138  X2 = X2 / (Nm - 1);
    139139  dS = sqrt (dS / Nm);
    140140
     
    148148}
    149149
     150int liststats_pos (double *value, double *dvalue, int N, StatType *stats, int XVERB) {
     151 
     152  int i, ks, ke, Nm;
     153  double Mo, dMo, M, dM, X2, dS, *chi;
     154
     155  ke = ks = dMo = 0;
     156
     157  stats[0].Nmeas = N;
     158  stats[0].mean  = 0;
     159  stats[0].sigma = 0;
     160  stats[0].error = 0;
     161  stats[0].chisq = 0;
     162  if (N < 1) return (FALSE);
     163
     164  dsortpair (value, dvalue, N);
     165  if (N % 2) {
     166    stats[0].median = value[(int)(0.5*N)];
     167  } else {
     168    stats[0].median = 0.5*(value[N/2] + value[N/2 - 1]);
     169  }
     170  stats[0].min    = value[0];
     171  stats[0].max    = value[N-1];
     172
     173  switch (statmode) {
     174  case M_MEDIAN:
     175    ks = 0;
     176    ke = N;
     177    Mo = stats[0].median;
     178    Nm = N;
     179    goto chisq;
     180    break;
     181  case M_MEAN:
     182  case M_WTMEAN:
     183    ks = 0;
     184    ke = N;
     185    break;
     186  case M_INNER_MEAN:
     187  case M_INNER_WTMEAN:
     188  case M_CHI_INNER_MEAN:
     189  case M_CHI_INNER_WTMEAN:
     190    ks = 0.25*N + 0.50;
     191    ke = 0.75*N + 0.25;
     192    if (N <= 3) {
     193      ks = 0;
     194      ke = N;
     195    }
     196    break;
     197  case M_INNER_80_MEAN:
     198  case M_INNER_80_WTMEAN:
     199  case M_CHI_INNER_80_MEAN:
     200  case M_CHI_INNER_80_WTMEAN:
     201    ks = 0.1*N + 0.1;
     202    ke = 0.8*N + 0.1;
     203    if (N <= 10) {
     204      ks = 0;
     205      ke = N;
     206    }
     207    break;
     208  }   
     209
     210  if ((statmode == M_CHI_INNER_MEAN) ||
     211      (statmode == M_CHI_INNER_WTMEAN) ||
     212      (statmode == M_CHI_INNER_80_MEAN) ||
     213      (statmode == M_CHI_INNER_80_WTMEAN)) {
     214    ALLOCATE (chi, double, N);
     215    for (i = 0; i < N; i++) {
     216      chi[i] = (value[i] - stats[0].median) / dvalue[i];
     217    }
     218    dsortthree (chi, value, dvalue, N);
     219    free (chi);
     220  }
     221
     222  /* calculating the per-star offset based on the weighted average */
     223  M = dM = Nm = 0;
     224  if ((statmode == M_WTMEAN) ||
     225      (statmode == M_INNER_WTMEAN) ||
     226      (statmode == M_INNER_80_WTMEAN) ||
     227      (statmode == M_CHI_INNER_WTMEAN) ||
     228      (statmode == M_CHI_INNER_80_WTMEAN)) {
     229    for (i = ks; i < ke; i++) {
     230      M   += value[i] / SQ (dvalue[i]);
     231      dM  += 1.0 / SQ (dvalue[i]);
     232      Nm  ++; 
     233    }   
     234    Mo = M / dM;
     235    dMo = sqrt (1.0 / dM);
     236  } else {
     237    for (i = ks; i < ke; i++) {
     238      M   += value[i];
     239      dM  += SQ (dvalue[i]);
     240      Nm  ++; 
     241    }   
     242    Mo = M / (double) Nm;
     243    dMo = sqrt (dM / (double) Nm);
     244  }
     245
     246 chisq:
     247  /* find sigma and chisq */
     248  X2 = dS = 0;
     249  for (i = ks; i < ke; i++) {
     250    M  = SQ (value[i] - Mo);
     251    dM = SQ (dvalue[i]);
     252    X2 += M / dM;
     253    dS += M;
     254    if (XVERB) fprintf (stderr, "chisq contrib : %f : %f : %f : %f : %f\n", Mo, 3600.0*(value[i] - Mo), 3600.0*dvalue[i], (value[i] - Mo) / dvalue[i], X2);
     255  }
     256  X2 = X2 / (Nm - 1);
     257  dS = sqrt (dS / Nm);
     258
     259  stats[0].mean  = Mo;
     260  stats[0].Nmeas = Nm;
     261  stats[0].chisq = X2;
     262  stats[0].sigma = dS;
     263  stats[0].error = dMo;
     264
     265  return (TRUE);
     266}
     267
  • branches/czw_branch/20120906/Ohana/src/relastro/src/relastro_objects.c

    r34405 r34772  
    1616
    1717  DVOAverageFlags averageBits =
    18     ID_STAR_FEW     |
    19     ID_STAR_POOR    |
    20     ID_STAR_FIT_AVE |
    21     ID_STAR_FIT_PM  |
    22     ID_STAR_FIT_PAR |
    23     ID_STAR_USE_AVE |
    24     ID_STAR_USE_PM  |
    25     ID_STAR_USE_PAR;
     18    ID_STAR_FIT_AVE   |
     19    ID_STAR_FIT_PM    |
     20    ID_STAR_FIT_PAR   |
     21    ID_STAR_USE_AVE   |
     22    ID_STAR_USE_PM    |
     23    ID_STAR_USE_PAR   |
     24    ID_STAR_NO_ASTROM ;
    2625
    2726  // XXX need to decide how to determine PARALLEL mode...
     
    133132
    134133    char command[1024];
    135     snprintf (command, 1024, "relastro_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f",
    136               table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     134    snprintf (command, 1024, "relastro_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s",
     135              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE);
    137136
    138137    char tmpline[1024];
  • branches/czw_branch/20120906/Ohana/src/relphot/include/relphot.h

    r34260 r34772  
    137137int    NGRID;
    138138int    RESET;
     139int    RESET_ZEROPTS;
    139140int    UPDATE;
    140141int    SAVE_IMAGE_UPDATES;
  • branches/czw_branch/20120906/Ohana/src/relphot/src/ConfigInit.c

    r33963 r34772  
    66  char  *config, *file;
    77  char CatdirPhotcodeFile[256];
    8   char MasterPhotcodeFile[256];
    98
    109  /*** load configuration info ***/
     
    4544  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    4645  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    47   ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    4846
    49   sprintf (ImageCat, "%s/Images.dat", CATDIR);
     47  snprintf (ImageCat, DVO_MAX_PATH, "%s/Images.dat", CATDIR);
    5048
    5149  if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) {
     
    6967  /* XXX this does not yet write out the master photcode table */
    7068  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    71   if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    72     fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
     69  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
     70    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    7371    exit (1);
    7472  }
  • branches/czw_branch/20120906/Ohana/src/relphot/src/StarOps.c

    r34267 r34772  
    1111  int Nmos;
    1212  int Ngrid;
    13   double *list;
    14   double *dlist;
    15   double *wlist;
    16   double *aplist;
    17   double *kronlist;
    18   double *dkronlist;
     13
     14  // NOTE: the following arrays are (possibly) pre-allocated and carried down to each
     15  // thread.  The first 3 (list, dlist, wlist) are used in all relphot analyses; the
     16  // others are only used on the final output steps.
     17
     18  double *list;               // list of measure.mag values for a given star
     19  double *dlist;              // mag errors for a star
     20  double *wlist;              // weights to use for mean mags
     21  double *aplist;             // ap mags for a star
     22  double *kronlist;           // kron mags for a star
     23  double *dkronlist;          // kron mag errors
     24
     25  double *psfqf_list;         // psfqf for all filters
     26  double *psfqfperf_list;     // psfqfperf for all filters
     27  double *stargal_list;       // stargal for all filters
    1928} SetMrelInfo;
    2029
     
    168177  ALLOCATE (results.dkronlist, double, Nmax);
    169178
     179  ALLOCATE (results.psfqf_list, double, Nmax);
     180  ALLOCATE (results.psfqfperf_list, double, Nmax);
     181  ALLOCATE (results.stargal_list, double, Nmax);
     182
    170183  for (i = 0; i < Ncatalog; i++) {
    171184    setMrel_catalog  (catalog, i, pass, flatcorr, &results, Nsecfilt); // XXX add arguments as needed for options
     
    178191  free (results.kronlist);
    179192  free (results.dkronlist);
     193
     194  free (results.psfqf_list);
     195  free (results.psfqfperf_list);
     196  free (results.stargal_list);
    180197  return (TRUE);
    181198}
     
    315332  liststats_setmode (&kronstats, STATMODE);
    316333
     334  // StatType psfstats;
     335  // liststats_setmode (&psfstats, "MEAN");
     336
    317337  double *list      = results->list;
    318338  double *dlist     = results->dlist;
     
    322342  double *dkronlist = results->dkronlist;
    323343
     344  double *psfqf_list     = results->psfqf_list;
     345  double *psfqfperf_list = results->psfqfperf_list;
     346  double *stargal_list   = results->stargal_list;
     347
    324348  SetMrelInfoInit (results, FALSE); // do not allocate list,dlist,wlist arrays
    325349
     
    327351
    328352  char *primaryCell = NULL;
    329   ALLOCATE (primaryCell, char, DVO_MAX_PATH);
     353  if (isSetMrelFinal) {
     354    ALLOCATE (primaryCell, char, DVO_MAX_PATH);
     355  }
    330356
    331357  for (j = 0; j < catalog[Nc].Naverage; j++) {
    332     // XXX accumulate all secfilt values in a single pass?
    333 
    334358    // option for a test print
    335359    if (FALSE && (catalog[Nc].average[j].objID == 0x7146) && (catalog[Nc].average[j].catID == 0x49d8)) {
     
    338362    }
    339363
    340     BoundaryTreePrimaryCell(primaryCell, catalog[Nc].average[j].R, catalog[Nc].average[j].D);
     364    if (isSetMrelFinal) {
     365      BoundaryTreePrimaryCell(primaryCell, catalog[Nc].average[j].R, catalog[Nc].average[j].D);
     366    }
    341367
    342368    int GoodPS1 = FALSE;
     
    346372    int NextPS1 = 0;
    347373    int NpsfPS1 = 0;
     374
     375    int Nmeas = 0; // number of meas used for psfqf, psfqfperf, and stargal
     376
     377    int NstackGood = 0;
     378    int NstackSuspect = 0;
     379
     380    int haveStackObject = FALSE;
    348381
    349382    int Ns;
     
    365398      int haveSynth = FALSE;
    366399      int haveStack = FALSE;
     400      int havePS1   = FALSE;
    367401
    368402      // need to find the measurement closest to the center of its skycell, as well as the
     
    370404
    371405      float stackCenterOffsetMin = 1e9;
    372       int stackCenterIDmin = -1;
    373406      off_t stackCenterMeasureMin = -1;
    374407
    375408      float stackPrimaryOffsetMin = 1e9;
    376       int stackPrimaryIDmin = -1;
    377409      off_t stackPrimaryMeasureMin = -1;
    378410
     
    384416      int minUbercalDist = 1000;
    385417   
     418      int isBad = FALSE;
     419      int isSuspect = FALSE;
     420
    386421      N = 0;
    387422      m = catalog[Nc].averageT[j].measureOffset;
     
    393428        if (code->equiv != thisCode) { continue; }
    394429        Ncode ++;
     430
     431        catalog[Nc].measure[m].dbFlags &= ~ID_MEAS_STACK_PRIMARY;
    395432
    396433        if (catalog[Nc].measureT[m].dbFlags & MEAS_BAD) SKIP_THIS_MEAS(Nbad);
     
    414451        if (isnan(Msys)) SKIP_THIS_MEAS(Nsys);
    415452
    416         list[N] = Msys - Mcal - Mmos - Mgrid;
    417 
    418453        int myUbercalDist = getUbercalDist(m,Nc);
    419454        minUbercalDist = MIN(minUbercalDist, myUbercalDist);
    420455
    421456        if (isSetMrelFinal) {
    422           float Map = PhotAper (&catalog[Nc].measure[m]);
    423           aplist[N] = Map - Mcal - Mmos - Mgrid;
    424 
    425           float Mkron = PhotKron (&catalog[Nc].measure[m]);
    426           kronlist[N] = Mkron - Mcal - Mmos - Mgrid;
    427           dkronlist[N] = catalog[Nc].measure[m].dMkron;
    428 
    429457          // special options for PS1 data
    430458          if ((catalog[Nc].measure[m].photcode >= 10000) && (catalog[Nc].measure[m].photcode <= 10500)) {
    431459            // count the extended detections
    432460            if (!isnan(catalog[Nc].measure[m].Map)) {
    433               if (catalog[Nc].measure[m].M - catalog[Nc].measure[m].Map > 0.5) {
     461              float dMagAp = catalog[Nc].measure[m].M - catalog[Nc].measure[m].Map;
     462              float SigmaAp = hypot(0.1, 2.5*catalog[Nc].measure[m].dM);
     463              // XXX this is still quite ad hoc, but at least it:
     464              // (a) converges to 0.1 mag offset at the bright end
     465              // (b) converges to 0.5 mag offset at the faint end (dM = 0.2)
     466              if (dMagAp > SigmaAp) {
    434467                Next ++;
    435468                NextPS1 ++;
     
    438471              }
    439472            }
     473            havePS1 = TRUE;
    440474          }
     475
    441476          // gpc1 stack data
    442477          if ((catalog[Nc].measure[m].photcode >= 11000) && (catalog[Nc].measure[m].photcode <= 11400)) {
    443             // if (pass < 2) continue;
    444478            haveStack = TRUE;
     479            haveStackObject = TRUE;
    445480
    446481            unsigned int stackImageID;
     
    452487              if (stackPrimaryOffset < stackPrimaryOffsetMin) {
    453488                stackPrimaryOffsetMin = stackPrimaryOffset;
    454                 stackPrimaryIDmin = stackImageID;
     489                // stackPrimaryIDmin = stackImageID;
    455490                stackPrimaryMeasureMin = m;
    456491              }
     
    461496            if (stackCenterOffset < stackCenterOffsetMin) {
    462497              stackCenterOffsetMin = stackCenterOffset;
    463               stackCenterIDmin = stackImageID;
     498              // stackCenterIDmin = stackImageID;
    464499              stackCenterMeasureMin = m;
    465500            }
     501
     502            // data quality assessment
     503            isBad |= (catalog[Nc].measure[m].photFlags & code->photomBadMask);
     504            isBad |= (catalog[Nc].measure[m].psfQF < 0.85);
     505            isBad |= isnan(catalog[Nc].measure[m].psfQF);
     506            isBad |= catalog[Nc].measure[m].dM > 0.2; // S/N < 5.0
     507
     508            isSuspect |= (catalog[Nc].measure[m].photFlags & code->photomPoorMask);
     509            isSuspect |= (catalog[Nc].measure[m].psfQFperf < 0.85);
     510
     511            // mean psfQF, psfQFperf, and stargal values are calculated per object (all filters, stacks and exposures)
     512            psfqf_list[Nmeas]     = catalog[Nc].measure[m].psfQF;
     513            psfqfperf_list[Nmeas] = catalog[Nc].measure[m].psfQFperf;
     514            stargal_list[Nmeas]   = catalog[Nc].measure[m].extNsigma;
     515            Nmeas++;
     516
     517            continue; // do not include stack measurements in the per-exposure statistics
    466518          }
    467519
     
    478530                // detections without one of these bits should only be used in PASS_1
    479531                SKIP_THIS_MEAS(Nbad);
    480                 continue;
    481532              }
    482533            }
     
    512563              if (pass < 4) {
    513564                SKIP_THIS_MEAS(Nbad);
    514                 continue;
    515565              }
    516566              haveSynth = TRUE;
    517567            }
    518568          }
     569
     570          // Map (aplist) and Mkron (kronlist,dkronlist) are used to calculate mean mags per filter
     571          float Map = PhotAper (&catalog[Nc].measure[m]);
     572          aplist[N] = Map - Mcal - Mmos - Mgrid;
     573
     574          float Mkron = PhotKron (&catalog[Nc].measure[m]);
     575          kronlist[N] = Mkron - Mcal - Mmos - Mgrid;
     576          dkronlist[N] = catalog[Nc].measure[m].dMkron;
     577
     578          // mean psfQF, psfQFperf, and stargal values are calculated per object (all filters, stacks and exposures)
     579          psfqf_list[Nmeas]     = catalog[Nc].measure[m].psfQF;
     580          psfqfperf_list[Nmeas] = catalog[Nc].measure[m].psfQFperf;
     581          stargal_list[Nmeas]   = catalog[Nc].measure[m].extNsigma;
     582          Nmeas++;
    519583        }
    520584
     
    527591        dlist[N] = MAX (hypot(catalog[Nc].measureT[m].dM, code->photomErrSys), MIN_ERROR);
    528592        wlist[N] = 1.0;
     593        list[N]  = Msys - Mcal - Mmos - Mgrid;
    529594
    530595        // up-weight the ubercal values (or convergence can take a long time...)
     
    549614      if (haveStack && (N > 1)) {
    550615        // fprintf (stderr, "multiple stack values for %10.6f %10.6f\n", catalog[Nc].averageT[j].R, catalog[Nc].averageT[j].D);
     616      }
     617
     618      if (haveStack) {
     619        if (!isSuspect && !isBad) {
     620          NstackGood ++;
     621        }
     622        if (isSuspect && !isBad) {
     623          NstackSuspect ++;
     624        }
    551625      }
    552626
     
    604678        if (haveStack) {
    605679          m  = (stackPrimaryMeasureMin >= 0) ? stackPrimaryMeasureMin : stackCenterMeasureMin;
    606           ID = (stackPrimaryMeasureMin >= 0) ? stackPrimaryIDmin      : stackCenterIDmin;
     680
     681          // we are now populating stackDetectID not stack Image ID in secfilt
     682          // ID = (stackPrimaryMeasureMin >= 0) ? stackPrimaryIDmin      : stackCenterIDmin;
     683          ID = catalog[Nc].measure[m].extID; // for the stack, this is the stackDetectID
    607684
    608685          // get the zero point for the selected image
    609           float zp = Mcal + Mmos + Mgrid + PhotZeroPoint (&catalog[Nc].measure[m], &catalog[Nc].average[j], &catalog[Nc].secfilt[j*Nsecfilt]);
     686          float zp = PhotZeroPoint (&catalog[Nc].measure[m], &catalog[Nc].average[j], &catalog[Nc].secfilt[j*Nsecfilt]) - (Mcal + Mmos + Mgrid);
    610687
    611688          // flux_cgs : erg sec^1 cm^-2 Hz^-1
     
    647724          catalog[Nc].secfilt[Nsecfilt*j+Nsec].dFluxKron = zpFactor * catalog[Nc].measure[m].dFluxKron;
    648725
    649           catalog[Nc].secfilt[Nsecfilt*j+Nsec].stackID   = ID;
     726          catalog[Nc].secfilt[Nsecfilt*j+Nsec].stackDetectID = ID;
     727
     728          catalog[Nc].measure[m].dbFlags |= ID_MEAS_STACK_PHOT_SRC;
     729          if (stackPrimaryMeasureMin >= 0) {
     730            catalog[Nc].measure[m].dbFlags |= ID_MEAS_STACK_PRIMARY;
     731          }
    650732        }
    651733
     
    658740          case 0:
    659741            catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_0;
    660             GoodPS1 = TRUE;
     742            if (havePS1) GoodPS1 = TRUE;
    661743            break;
    662744          case 1:
    663745            catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_1;
    664             GoodPS1 = TRUE;
     746            if (havePS1) GoodPS1 = TRUE;
    665747            break;
    666748          case 2:
    667749            catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_2;
    668             GoodPS1 = TRUE;
     750            if (havePS1) GoodPS1 = TRUE;
    669751            break;
    670752          case 3:
     
    678760          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_USE_SYNTH;
    679761        }       
     762        if (haveStack) {
     763          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_HAS_STACK;
     764        }       
     765        if (havePS1) {
     766          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_HAS_PS1;
     767        }       
    680768        if (haveUbercal) {
    681769          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_USE_UBERCAL;
     
    685773
    686774    if (isSetMrelFinal) {
    687       DVOAverageFlags flagBits = ID_OBJ_EXT | ID_OBJ_EXT_ALT | ID_OBJ_GOOD | ID_OBJ_GOOD_ALT;
    688 
    689       // we attempt to set a few flags here; reset those bits before trying:
    690       catalog[Nc].average[j].flags &= ~flagBits;
     775      if (pass == 0) {
     776        DVOAverageFlags flagBits = ID_OBJ_EXT | ID_OBJ_EXT_ALT | ID_OBJ_GOOD | ID_OBJ_GOOD_ALT;
     777        // we attempt to set a few flags here; reset those bits before trying:
     778        catalog[Nc].average[j].flags &= ~flagBits;
     779      }
    691780
    692781      if (NextPS1 && (NextPS1 > NpsfPS1)) {
     
    701790      if (Good2MASS) {
    702791        catalog[Nc].average[j].flags |= ID_OBJ_GOOD_ALT;
     792      }
     793
     794      if (NstackGood >= 2) {
     795        catalog[Nc].average[j].flags |= ID_OBJ_GOOD_STACK;
     796      } else if (NstackGood + NstackSuspect >= 2) {
     797        catalog[Nc].average[j].flags |= ID_OBJ_SUSPECT_STACK;
     798      } else if (haveStackObject) {
     799        catalog[Nc].average[j].flags |= ID_OBJ_BAD_STACK;
     800      }
     801
     802      // use NAN values for catalog[Nc].average[j].psfQF as signal
     803      if (!isfinite(catalog[Nc].average[j].psfQF)) {
     804        // do something here
     805        float psfQFmax     = 0.0;
     806        float psfQFperfmax = 0.0;
     807        float stargalmax   = 0.0;
     808        int seq;
     809        for (seq = 0; seq < Nmeas; seq++) {
     810          if (isfinite(psfqf_list[seq])) {
     811            psfQFmax     = MAX (psfqf_list[seq], psfQFmax);
     812          }
     813          if (isfinite(psfqfperf_list[seq])) {
     814            psfQFperfmax = MAX (psfqfperf_list[seq], psfQFperfmax);
     815          }
     816          if (isfinite(stargal_list[seq])) {
     817            stargalmax   = MAX (stargal_list[seq], stargalmax);
     818          }
     819        }
     820
     821        catalog[Nc].average[j].psfQF     = psfQFmax;
     822        catalog[Nc].average[j].psfQFperf = psfQFperfmax;
     823        catalog[Nc].average[j].stargal   = stargalmax;
    703824      }
    704825    }
  • branches/czw_branch/20120906/Ohana/src/relphot/src/args.c

    r34260 r34772  
    163163  }
    164164
     165  RESET_ZEROPTS = FALSE;
     166  if ((N = get_argument (argc, argv, "-reset-zpts"))) {
     167    remove_argument (N, &argc, argv);
     168    RESET_ZEROPTS = TRUE;
     169  }
     170
    165171  UPDATE = FALSE;
    166172  if ((N = get_argument (argc, argv, "-update"))) {
     
    418424    remove_argument (N, &argc, argv);
    419425    RESET = TRUE;
     426  }
     427
     428  RESET_ZEROPTS = FALSE;
     429  if ((N = get_argument (argc, argv, "-reset-zpts"))) {
     430    remove_argument (N, &argc, argv);
     431    RESET_ZEROPTS = TRUE;
    420432  }
    421433
  • branches/czw_branch/20120906/Ohana/src/relphot/src/initialize.c

    r33963 r34772  
    7777  args_client (argc, argv);
    7878
    79   if (MODE == MODE_UPDATE_OBJECTS) return;
     79  if (MODE == MODE_UPDATE_OBJECTS) {
     80    char tmpline1[256];
     81    int Ns;
     82    Nphotcodes = GetPhotcodeNsecfilt ();
     83    ALLOCATE (photcodes, PhotCode *, Nphotcodes);
     84    ALLOCATE (PhotcodeList, char, 256);
     85    for (Ns = 0; Ns < Nphotcodes; Ns++) {
     86      photcodes[Ns] = GetPhotcodebyNsec (Ns);
     87      if (Ns > 0) {
     88        snprintf (tmpline1, 256, "%s,%s", PhotcodeList, photcodes[Ns][0].name);
     89      } else {
     90        snprintf (tmpline1, 256, "%s", photcodes[Ns][0].name);
     91      }
     92      strcpy (PhotcodeList, tmpline1);
     93    }
     94    return;
     95  }
    8096
    8197  // load the list of photcodes into the globals (photcodes, Nphotcodes)
  • branches/czw_branch/20120906/Ohana/src/relphot/src/liststats.c

    r33963 r34772  
    3838    dsortthree (value, dvalue, weight, N);
    3939  } else {
    40     dsortpair (value, dvalue, N);
     40    if (dvalue) {
     41      dsortpair (value, dvalue, N);
     42    } else {
     43      dsort (value, N);
     44    }
    4145  }
    4246
  • branches/czw_branch/20120906/Ohana/src/relphot/src/load_catalogs.c

    r34405 r34772  
    134134    // KEEP_UBERCAL
    135135    // RESET (-reset)
     136    // RESET_ZEROPTS (-reset-zpts)
    136137    // TimeSelect -time
    137138    // DophotSelect
     
    150151    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    151152    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
     153    if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts",     command);                    strcpy (command, tmpline); }
    152154    if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal",  command);                    strcpy (command, tmpline); }
    153155    if (DophotSelect)  { snprintf (tmpline, 1024, "%s -dophot %d",      command, DophotValue);       strcpy (command, tmpline); }
  • branches/czw_branch/20120906/Ohana/src/relphot/src/reload_catalogs.c

    r34088 r34772  
    172172    // VERBOSE, VERBOSE2
    173173    // RESET
     174    // RESET_ZEROPTS
    174175    // TimeSelect
    175176    // AreaSelect
     
    182183    if (VERBOSE2)         { snprintf (tmpline, 1024, "%s -vv",                  command);                                         strcpy (command, tmpline); }
    183184    if (RESET)            { snprintf (tmpline, 1024, "%s -reset",               command);                                         strcpy (command, tmpline); }
     185    if (RESET_ZEROPTS)    { snprintf (tmpline, 1024, "%s -reset-zpts",          command);                                         strcpy (command, tmpline); }
    184186    if (UPDATE)           { snprintf (tmpline, 1024, "%s -update",              command);                                         strcpy (command, tmpline); }
    185187    if (!KEEP_UBERCAL)    { snprintf (tmpline, 1024, "%s -reset-ubercal",       command);                                         strcpy (command, tmpline); }
  • branches/czw_branch/20120906/Ohana/src/relphot/src/relphot_objects.c

    r34405 r34772  
    6161      Nsecfilt = catalog.Nsecfilt;
    6262      DVOSecfiltFlags secfiltBits =
    63         ID_SECF_STAR_FEW |
    64         ID_SECF_STAR_POOR |
    65         ID_PHOTOM_PASS_0 |
    66         ID_PHOTOM_PASS_1 |
    67         ID_PHOTOM_PASS_2 |
    68         ID_PHOTOM_PASS_3 |
    69         ID_PHOTOM_PASS_4 |
    70         ID_SECF_USE_SYNTH |
     63        ID_SECF_STAR_FEW    |
     64        ID_SECF_STAR_POOR   |
     65        ID_PHOTOM_PASS_0    |
     66        ID_PHOTOM_PASS_1    |
     67        ID_PHOTOM_PASS_2    |
     68        ID_PHOTOM_PASS_3    |
     69        ID_PHOTOM_PASS_4    |
     70        ID_SECF_USE_SYNTH   |
    7171        ID_SECF_USE_UBERCAL |
    72         ID_SECF_OBJ_EXT;
     72        ID_SECF_HAS_STACK   |
     73        ID_SECF_HAS_PS1     |
     74        ID_SECF_OBJ_EXT     ;
     75     
     76      DVOAverageFlags astromBits =
     77        ID_STAR_FIT_AVE   |
     78        ID_STAR_FIT_PM    |
     79        ID_STAR_FIT_PAR   |
     80        ID_STAR_USE_AVE   |
     81        ID_STAR_USE_PM    |
     82        ID_STAR_USE_PAR   |
     83        ID_STAR_NO_ASTROM ;
    7384     
    7485      for (j = 0; j < catalog.Naverage; j++) {
    75         catalog.average[j].flags = 0;
     86        catalog.average[j].flags &= astromBits; // reset all except astrometry bits
     87        catalog.average[j].psfQF     = NAN;     // reset (will be re-calculated here)
     88        catalog.average[j].psfQFperf = NAN;     // reset (will be re-calculated here)
     89        catalog.average[j].stargal   = NAN;     // reset (will be re-calculated here)
    7690        for (k = 0; k < Nsecfilt; k++) {
    77           catalog.secfilt[j*Nsecfilt + k].M      = NAN;
    78           catalog.secfilt[j*Nsecfilt + k].Map    = NAN;
    79           catalog.secfilt[j*Nsecfilt + k].dM     = NAN;
    80           catalog.secfilt[j*Nsecfilt + k].Mstdev = NAN_S_SHORT;
    81           catalog.secfilt[j*Nsecfilt + k].Xm     = NAN;
    82           catalog.secfilt[j*Nsecfilt + k].M_20   = NAN_S_SHORT;
    83           catalog.secfilt[j*Nsecfilt + k].M_80   = NAN_S_SHORT;
    84           catalog.secfilt[j*Nsecfilt + k].Ncode  = 0;
    85           catalog.secfilt[j*Nsecfilt + k].Nused  = 0;
    86           catalog.secfilt[j*Nsecfilt + k].flags &= ~secfiltBits;
    87           catalog.secfilt[j*Nsecfilt + k].ubercalDist = 1000;
     91          dvo_secfilt_init (&catalog.secfilt[j*Nsecfilt + k]);
     92          catalog.secfilt[j*Nsecfilt + k].flags &= ~secfiltBits; // XXX: only reset photom bits:
    8893        }
    8994      }
     
    157162    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    158163    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
     164    if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts",     command);                    strcpy (command, tmpline); }
    159165    if (UPDATE)        { snprintf (tmpline, 1024, "%s -update",         command);                    strcpy (command, tmpline); }
    160166    if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal",  command);                    strcpy (command, tmpline); }
  • branches/czw_branch/20120906/Ohana/src/relphot/src/select_images.c

    r34088 r34772  
    256256    }
    257257    if (RESET) {
    258       if (!KEEP_UBERCAL || !(image[nimage].flags & ID_IMAGE_PHOTOM_UBERCAL)) {
    259         image[nimage].Mcal = 0.0;
    260         image[nimage].dMcal = NAN;
    261         image[nimage].flags &= ~ID_IMAGE_PHOTOM_UBERCAL;
     258      if (RESET_ZEROPTS) {
     259        if (!KEEP_UBERCAL || !(image[nimage].flags & ID_IMAGE_PHOTOM_UBERCAL)) {
     260          image[nimage].Mcal = 0.0;
     261          image[nimage].dMcal = NAN;
     262          image[nimage].flags &= ~ID_IMAGE_PHOTOM_UBERCAL;
     263        }
    262264      }
    263265      image[nimage].flags &= ~ID_IMAGE_PHOTOM_POOR;
  • branches/czw_branch/20120906/Ohana/src/relphot/src/setMrelFinal.c

    r34405 r34772  
    4040      for (i = 0; i < catalog[0].Naverage; i++) {
    4141        off_t N = Nsecfilt*i+Nsec;
    42         catalog[0].secfilt[N].M      = NAN;
    43         catalog[0].secfilt[N].Map    = NAN;
    44         catalog[0].secfilt[N].dM     = NAN;
    45         catalog[0].secfilt[N].Mstdev = NAN_S_SHORT;
    46         catalog[0].secfilt[N].Xm     = NAN;
    47         catalog[0].secfilt[N].M_20   = NAN_S_SHORT;
    48         catalog[0].secfilt[N].M_80   = NAN_S_SHORT;
    49         catalog[0].secfilt[N].Ncode  = 0;
    50         catalog[0].secfilt[N].Nused  = 0;
    51         catalog[0].secfilt[N].flags  = 0; // XXX there are no *astrometry* bits in secfilt.flags
    52         catalog[0].secfilt[N].ubercalDist = 1000;
     42        dvo_secfilt_init (&catalog[0].secfilt[N]);
    5343
    5444        off_t m = catalog[0].average[i].measureOffset;
     
    7565            }
    7666          } else {
    77             if (getImageEntry (m, 0) >= 0) {
     67            if (RESET_ZEROPTS && (getImageEntry (m, 0) >= 0)) {
    7868              catalog[0].measure[m].Mcal = 0.0;
    7969            }
     
    9282  for (i = 0; i < Nsecfilt*catalog[0].Naverage; i++) {
    9383    catalog[0].found[i] = FALSE;
     84  }
     85
     86  for (i = 0; i < catalog[0].Naverage; i++) {
     87    catalog[0].average[i].psfQF     = NAN;      // force recalculation below
     88    catalog[0].average[i].psfQFperf = NAN;      // force recalculation below
     89    catalog[0].average[i].stargal   = NAN;      // force recalculation below
    9490  }
    9591
     
    241237        }
    242238       
    243         // PASS 2 : accept stack measurements
     239        // PASS 2 : (no additional cut)
    244240
    245241        // PASS 1 : accept poor measurements as well (eg, POOR FIT, etc)
  • branches/czw_branch/20120906/Ohana/src/tools/src/radec.c

    r33661 r34772  
    2323      status = _hms_to_deg (&ra, &dec, line, sep, 3);
    2424      if (status)
    25         fprintf (stdout, "%10.6f %10.6f\n", ra, dec);
     25        fprintf (stdout, "%12.8f %12.8f\n", ra, dec);
    2626    }
    2727    exit (0);
  • branches/czw_branch/20120906/Ohana/src/uniphot/Makefile

    r33654 r34772  
    2121setphot: $(BIN)/setphot.$(ARCH)
    2222setphot_client: $(BIN)/setphot_client.$(ARCH)
     23setposangle: $(BIN)/setposangle.$(ARCH)
     24setposangle_client: $(BIN)/setposangle_client.$(ARCH)
    2325
    24 install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setphot $(DESTBIN)/setphot_client
     26install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setphot $(DESTBIN)/setphot_client $(DESTBIN)/setposangle $(DESTBIN)/setposangle_client
    2527
    2628UNIPHOT = \
     
    7173$(BIN)/setphot_client.$(ARCH): $(SETPHOT_CLIENT)
    7274
     75SETPOSANGLE = \
     76$(SRC)/setposangle.$(ARCH).o        \
     77$(SRC)/initialize_setposangle.$(ARCH).o \
     78$(SRC)/load_images_setposangle.$(ARCH).o \
     79$(SRC)/ImageSubsetSetPosangle.$(ARCH).o     \
     80$(SRC)/update_dvo_setposangle.$(ARCH).o \
     81$(SRC)/update_catalog_setposangle.$(ARCH).o \
     82$(SRC)/SetSignals.$(ARCH).o         \
     83$(SRC)/Shutdown.$(ARCH).o           
     84
     85$(SETPOSANGLE): $(INC)/setposangle.h
     86$(BIN)/setposangle.$(ARCH): $(SETPOSANGLE)
     87
     88SETPOSANGLE_CLIENT = \
     89$(SRC)/setposangle_client.$(ARCH).o         \
     90$(SRC)/update_dvo_setposangle.$(ARCH).o \
     91$(SRC)/update_catalog_setposangle.$(ARCH).o \
     92$(SRC)/initialize_setposangle.$(ARCH).o \
     93$(SRC)/load_images_setposangle.$(ARCH).o \
     94$(SRC)/SetSignals.$(ARCH).o         \
     95$(SRC)/Shutdown.$(ARCH).o           \
     96$(SRC)/ImageSubsetSetPosangle.$(ARCH).o
     97
     98$(SETPOSANGLE_CLIENT): $(INC)/setposangle.h
     99$(BIN)/setposangle_client.$(ARCH): $(SETPOSANGLE_CLIENT)
     100
    73101SETFWHM =                           \
    74102$(SRC)/setfwhm.$(ARCH).o            \
  • branches/czw_branch/20120906/Ohana/src/uniphot/src/initialize_setphot.c

    r33963 r34772  
    2121  // load the photcode table
    2222  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    23   if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, TRUE)) {
     23  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
    2424    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    2525    exit (1);
  • branches/czw_branch/20120906/Ohana/src/uniphot/src/initialize_setphot_client.c

    r33654 r34772  
    1717  // load the photcode table : XXX needed?
    1818  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    19   if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, TRUE)) {
     19  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
    2020    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
    2121    exit (1);
Note: See TracChangeset for help on using the changeset viewer.