IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34429


Ignore:
Timestamp:
Sep 11, 2012, 10:26:52 AM (14 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20120905 (fixes some mean values and flags in DVO)

Location:
trunk
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r34405 r34429  
    606606    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    607607    stars[i].measure.psfQF      = ps1data[i].psfQF;
     608    stars[i].measure.psfQFperf  = ps1data[i].psfQFpef;
    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].psfQFpef;
     690    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     691    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     692    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     693    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     694
     695    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     696    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     697    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     698
     699    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     700    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     701    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     702                       
     703    stars[i].measure.photFlags  = ps1data[i].flags;
     704
     705    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     706    stars[i].measure.detID      = ps1data[i].detID;
     707
     708    // the Average fields and the following Measure fields are set in FilterStars after
     709    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
     710
     711    // averef is set in find_matches
     712
     713    // dbFlags is zero on ingest.
     714
     715    // the following fields are currently not being set anywhere: t_msec
     716  }   
     717  *nstars = Nstars;
     718  return (stars);
     719}
     720
     721Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
     722
     723  off_t Nstars;
     724  unsigned int i;
     725  double ZeroPt;
     726  Stars *stars;
     727  CMF_PS1_SV1 *ps1data;
     728
     729  if (table[0].header[0].Naxis[0] == 196) {
     730    stars = Convert_PS1_SV1_Alt (table, nstars);
     731    return (stars);
     732  }
     733
     734  ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
     735  if (!ps1data) {
     736    fprintf (stderr, "skipping inconsistent entry\n");
     737    return (NULL);
     738  }
     739  ZeroPt = GetZeroPoint();
     740
     741  ALLOCATE (stars, Stars, Nstars);
     742  for (i = 0; i < Nstars; i++) {
     743    InitStar (&stars[i]);
     744    stars[i].measure.Xccd       = ps1data[i].X;
     745    stars[i].measure.Yccd       = ps1data[i].Y;
     746    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     747    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     748
     749    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     750    stars[i].measure.pltscale   = ps1data[i].pltscale;
     751
     752    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     753      stars[i].measure.M      = NAN;
     754    } else {
     755      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     756    }
     757    stars[i].measure.dM         = ps1data[i].dM;
     758    stars[i].measure.dMcal      = ps1data[i].dMcal;
     759    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     760                       
     761    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     762    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     763
     764    // these fluxes are converted from counts to counts/sec in FilterStars.c
     765    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     766    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     767    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     768    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     769
     770    stars[i].measure.Sky        = ps1data[i].sky;
     771    stars[i].measure.dSky       = ps1data[i].dSky;
     772                       
     773    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     774    stars[i].measure.psfQF      = ps1data[i].psfQF;
     775    stars[i].measure.psfQFperf  = ps1data[i].psfQFpef;
     776    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     777    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     778    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     779    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     780
     781    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     782    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     783    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     784
     785    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     786    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     787    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     788                       
     789    stars[i].measure.photFlags  = ps1data[i].flags;
     790
     791    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     792    stars[i].measure.detID      = ps1data[i].detID;
     793
     794    // the Average fields and the following Measure fields are set in FilterStars after
     795    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     796    // averef is set in find_matches, dbFlags is zero on ingest.
     797
     798    // the following fields are currently not being set anywhere: t_msec
     799  }   
     800  *nstars = Nstars;
     801  return (stars);
     802}
     803
     804Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
     805
     806  off_t Nstars;
     807  unsigned int i;
     808  double ZeroPt;
     809  Stars *stars;
     810  CMF_PS1_SV1 *ps1data;
     811
     812  // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
     813
     814  ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
     815  if (!ps1data) {
     816    fprintf (stderr, "skipping inconsistent entry\n");
     817    return (NULL);
     818  }
     819  ZeroPt = GetZeroPoint();
     820
     821  ALLOCATE (stars, Stars, Nstars);
     822  for (i = 0; i < Nstars; i++) {
     823    InitStar (&stars[i]);
     824    stars[i].measure.Xccd       = ps1data[i].X;
     825    stars[i].measure.Yccd       = ps1data[i].Y;
     826    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     827    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     828
     829    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     830    stars[i].measure.pltscale   = ps1data[i].pltscale;
     831
     832    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     833      stars[i].measure.M      = NAN;
     834    } else {
     835      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     836    }
     837    stars[i].measure.dM         = ps1data[i].dM;
     838    stars[i].measure.dMcal      = ps1data[i].dMcal;
     839    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     840                       
     841    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     842    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     843
    677844    // these fluxes are converted from counts to counts/sec in FilterStars.c
    678845    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     
    705872
    706873    // 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.
     874    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     875    // averef is set in find_matches, dbFlags is zero on ingest.
    712876
    713877    // the following fields are currently not being set anywhere: t_msec
     
    717881}
    718882
    719 Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
     883Stars *Convert_PS1_SV2 (FTable *table, unsigned int *nstars) {
    720884
    721885  off_t Nstars;
     
    723887  double ZeroPt;
    724888  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);
     889  CMF_PS1_SV2 *ps1data;
     890
     891  ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL);
    733892  if (!ps1data) {
    734893    fprintf (stderr, "skipping inconsistent entry\n");
     
    771930    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    772931    stars[i].measure.psfQF      = ps1data[i].psfQF;
     932    stars[i].measure.psfQFperf  = ps1data[i].psfQFpef;
    773933    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    774934    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    799959}
    800960
    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 
     961
  • trunk/Ohana/src/libdvo/include/dvo.h

    r34405 r34429  
    149149/* Average.flags values -- these values are 32 bit (as of PS1_V1) */
    150150typedef 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)
     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_STAR_NO_ASTROM = 0x00400000, // mean astrometry could not be measured
     171  ID_OBJ_EXT        = 0x01000000, // extended in our data (eg, PS)
     172  ID_OBJ_EXT_ALT    = 0x02000000, // extended in external data (eg, 2MASS)
     173  ID_OBJ_GOOD       = 0x04000000, // good-quality measurement in our data (eg,PS)
     174  ID_OBJ_GOOD_ALT   = 0x08000000, // good-quality measurement in  external data (eg, 2MASS)
    174175} DVOAverageFlags;
    175176
     
    180181  ID_SECF_USE_SYNTH   = 0x00000004, // synthetic photometry used in average measurement
    181182  ID_SECF_USE_UBERCAL = 0x00000008, // synthetic photometry used in average measurement
     183  ID_SECF_HAS_PS1     = 0x00000010, // PS1 photometry used in average measurement
     184  ID_SECF_HAS_STACK   = 0x00000020, // PS1 stack photometry exists
    182185  ID_PHOTOM_PASS_0    = 0x00000100, // average magnitude calculated in 0th pass
    183186  ID_PHOTOM_PASS_1    = 0x00000200, // average magnitude calculated in 1th pass
  • trunk/Ohana/src/libdvo/src/dvo_catalog.c

    r34405 r34429  
    8989  average->Trange          = 0;
    9090
     91  average->psfQF           = 0.0;
     92  average->psfQFperf       = 0.0;
     93
    9194  average->stargal         = 0.0;
    9295  average->Npos            = 0;
  • trunk/Ohana/src/opihi/cmd.astro

  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r34405 r34429  
    168168      }
    169169
    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;
     170      // if we have too few good detections for the desired fit, or too limited a
     171      // baseline, use a fit with fewer parameters.  XXX if we have too few measurements
     172      // for even the average position, consider including the lower-quality detections?
     173
     174      catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM;
    175175
    176176      // find Tmin & Tmax from the list of accepted measurements
     
    197197        // XXX need to define PHOTOM and ASTROM object flags
    198198        // XXX reset the average value fields?
    199         catalog[i].average[j].flags |= ID_STAR_FEW;
     199        catalog[i].average[j].flags |= ID_STAR_NO_ASTROM;
    200200        catalog[i].average[j].ChiSqAve  = NAN;
    201201        catalog[i].average[j].ChiSqPM   = NAN;
  • trunk/Ohana/src/relastro/src/bcatalog.c

    r33652 r34429  
    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 */
  • trunk/Ohana/src/relastro/src/initialize.c

    r33652 r34429  
    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
  • trunk/Ohana/src/relastro/src/liststats.c

    r17214 r34429  
    136136    dS += M;
    137137  }
    138   X2 = X2 / Nm;
     138  X2 = X2 / (Nm - 1);
    139139  dS = sqrt (dS / Nm);
    140140
  • trunk/Ohana/src/relastro/src/relastro_objects.c

    r34405 r34429  
    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...
  • trunk/Ohana/src/relphot/src/StarOps.c

    r34267 r34429  
    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++) {
     
    338364    }
    339365
    340     BoundaryTreePrimaryCell(primaryCell, catalog[Nc].average[j].R, catalog[Nc].average[j].D);
     366    if (isSetMrelFinal) {
     367      BoundaryTreePrimaryCell(primaryCell, catalog[Nc].average[j].R, catalog[Nc].average[j].D);
     368    }
    341369
    342370    int GoodPS1 = FALSE;
     
    346374    int NextPS1 = 0;
    347375    int NpsfPS1 = 0;
     376
     377    int Nmeas = 0; // number of meas used for psfqf, psfqfperf, and stargal
    348378
    349379    int Ns;
     
    365395      int haveSynth = FALSE;
    366396      int haveStack = FALSE;
     397      int havePS1   = FALSE;
    367398
    368399      // need to find the measurement closest to the center of its skycell, as well as the
     
    420451
    421452        if (isSetMrelFinal) {
     453          // Map (aplist) and Mkron (kronlist,dkronlist) are used to calculate mean mags per filter
    422454          float Map = PhotAper (&catalog[Nc].measure[m]);
    423455          aplist[N] = Map - Mcal - Mmos - Mgrid;
     
    426458          kronlist[N] = Mkron - Mcal - Mmos - Mgrid;
    427459          dkronlist[N] = catalog[Nc].measure[m].dMkron;
     460
     461          // mean psfQF, psfQFperf, and stargal values are calculated per object (all filters)
     462          psfqf_list[Nmeas]     = catalog[Nc].measure[m].psfQF;
     463          psfqfperf_list[Nmeas] = catalog[Nc].measure[m].psfQF;
     464          stargal_list[Nmeas]   = catalog[Nc].measure[m].extNsigma;
    428465
    429466          // special options for PS1 data
     
    431468            // count the extended detections
    432469            if (!isnan(catalog[Nc].measure[m].Map)) {
    433               if (catalog[Nc].measure[m].M - catalog[Nc].measure[m].Map > 0.5) {
     470              float dMagAp = catalog[Nc].measure[m].M - catalog[Nc].measure[m].Map;
     471              float SigmaAp = hypot(0.1, 2.5*catalog[Nc].measure[m].dM);
     472              // XXX this is still quite ad hoc, but at least it:
     473              // (a) converges to 0.1 mag offset at the bright end
     474              // (b) converges to 0.5 mag offset at the faint end (dM = 0.2)
     475              if (dMagAp > SigmaAp) {
    434476                Next ++;
    435477                NextPS1 ++;
     
    438480              }
    439481            }
     482            havePS1 = TRUE;
    440483          }
    441484          // gpc1 stack data
     
    543586        }
    544587        N++;
     588        Nmeas++;
    545589      }
    546590
     
    658702          case 0:
    659703            catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_0;
    660             GoodPS1 = TRUE;
     704            if (havePS1) GoodPS1 = TRUE;
    661705            break;
    662706          case 1:
    663707            catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_1;
    664             GoodPS1 = TRUE;
     708            if (havePS1) GoodPS1 = TRUE;
    665709            break;
    666710          case 2:
    667711            catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_2;
    668             GoodPS1 = TRUE;
     712            if (havePS1) GoodPS1 = TRUE;
    669713            break;
    670714          case 3:
     
    678722          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_USE_SYNTH;
    679723        }       
     724        if (haveStack) {
     725          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_HAS_STACK;
     726        }       
     727        if (havePS1) {
     728          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_HAS_PS1;
     729        }       
    680730        if (haveUbercal) {
    681731          catalog[Nc].secfilt[Nsecfilt*j+Nsec].flags |= ID_SECF_USE_UBERCAL;
     
    685735
    686736    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;
     737      if (pass == 0) {
     738        DVOAverageFlags flagBits = ID_OBJ_EXT | ID_OBJ_EXT_ALT | ID_OBJ_GOOD | ID_OBJ_GOOD_ALT;
     739        // we attempt to set a few flags here; reset those bits before trying:
     740        catalog[Nc].average[j].flags &= ~flagBits;
     741      }
    691742
    692743      if (NextPS1 && (NextPS1 > NpsfPS1)) {
     
    701752      if (Good2MASS) {
    702753        catalog[Nc].average[j].flags |= ID_OBJ_GOOD_ALT;
     754      }
     755
     756      // use NAN values for catalog[Nc].average[j].psfQF as signal
     757      if (!isfinite(catalog[Nc].average[j].psfQF)) {
     758        // do something here
     759        float psfQFmax     = 0.0;
     760        float psfQFperfmax = 0.0;
     761        float stargalmax   = 0.0;
     762        int seq;
     763        for (seq = 0; seq < Nmeas; seq++) {
     764          if (isfinite(psfqf_list[seq])) {
     765            psfQFmax     = MAX (psfqf_list[seq], psfQFmax);
     766          }
     767          if (isfinite(psfqfperf_list[seq])) {
     768            psfQFperfmax = MAX (psfqfperf_list[seq], psfQFperfmax);
     769          }
     770          if (isfinite(stargal_list[seq])) {
     771            stargalmax   = MAX (stargal_list[seq], stargalmax);
     772          }
     773        }
     774
     775        catalog[Nc].average[j].psfQF     = psfQFmax;
     776        catalog[Nc].average[j].psfQFperf = psfQFperfmax;
     777        catalog[Nc].average[j].stargal   = stargalmax;
    703778      }
    704779    }
  • trunk/Ohana/src/relphot/src/initialize.c

    r33963 r34429  
    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)
  • trunk/Ohana/src/relphot/src/liststats.c

    r33963 r34429  
    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
  • trunk/Ohana/src/relphot/src/relphot_objects.c

    r34405 r34429  
    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      }
  • trunk/Ohana/src/relphot/src/setMrelFinal.c

    r34405 r34429  
    9494  }
    9595
     96  for (i = 0; i < catalog[0].Naverage; i++) {
     97    catalog[0].average[i].psfQF     = NAN;      // force recalculation below
     98    catalog[0].average[i].psfQFperf = NAN;      // force recalculation below
     99    catalog[0].average[i].stargal   = NAN;      // force recalculation below
     100  }
     101
    96102  // XXX make this optional? (do not clean for -averages?)
    97103  if (!simpleAverage) clean_measures (catalog, 1, TRUE, flatcorr);    /* mark outliers ID_MEAS_POOR_PHOTOM */
  • trunk/ippMonitor

  • trunk/ippScripts/scripts/destreak_restore_camera.pl

  • trunk/ippScripts/scripts/ipp_apply_burntool_single.pl

  • trunk/ippScripts/scripts/magic_destreak.pl

  • trunk/ippToPsps

  • trunk/ippTools/share/camtool_find_pendingimfile.sql

  • trunk/ippTools/share/chiptool_setimfiletoupdate.sql

  • trunk/ippTools/share/pxadmin_create_tables.sql

  • trunk/ippTools/share/warptool_towarped.sql

  • trunk/ippTools/src

  • trunk/ippTools/src/magictool.c

  • trunk/ippconfig

  • trunk/ippconfig/recipes/reductionClasses.mdc

  • trunk/ppImage/src

  • trunk/psModules

  • trunk/psphot

  • trunk/psphot/src

  • trunk/psphot/src/psphotStackImageLoop.c

  • trunk/pstamp/scripts

  • trunk/psvideophot

Note: See TracChangeset for help on using the changeset viewer.