IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36912


Ignore:
Timestamp:
Jun 19, 2014, 2:41:50 PM (12 years ago)
Author:
eugene
Message:

fix bugs to make addstar work with new PS1_V5 format & dvo tests to verify; fix PS1_V5 I/O functions for table column order error (RA_PSF,DEC_PSF not on 8-byte block in FITS table)

Location:
branches/eam_branches/ipp-20140610/Ohana/src
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/FilterStars.c

    r34260 r36912  
    9999      stars[N].measure.dFluxKron /= image[0].exptime;
    100100    }
     101    if (!isnan(stars[N].measure.FluxAp)) {
     102      stars[N].measure.FluxAp /= image[0].exptime;
     103    }
     104    if (!isnan(stars[N].measure.dFluxAp)) {
     105      stars[N].measure.dFluxAp /= image[0].exptime;
     106    }
    101107   
    102108    // the external ID is supplied, but do we trust it?
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/MatchHeaders.c

    r35416 r36912  
    5959    if (!strcmp (exttype, "PS1_V3")) goto keep;
    6060    if (!strcmp (exttype, "PS1_V4")) goto keep;
     61    if (!strcmp (exttype, "PS1_V5")) goto keep;
    6162    if (!strcmp (exttype, "PS1_SV1")) goto keep;
    6263    if (!strcmp (exttype, "PS1_SV2")) goto keep;
    63     if (!strcmp (exttype, "PS1_DV3")) {
     64    if (!strcmp (exttype, "PS1_SV3")) goto keep;
     65    if (!strcmp (exttype, "PS1_DV3")) goto keep;
     66    if (!strcmp (exttype, "PS1_DV4")) {
    6467      goto keep;
    6568    }
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/ReadStarsFITS.c

    r35416 r36912  
    1212Stars     *Convert_PS1_V3         PROTO((FTable *table, unsigned int *nstars));
    1313Stars     *Convert_PS1_V4         PROTO((FTable *table, unsigned int *nstars));
     14Stars     *Convert_PS1_V5         PROTO((FTable *table, unsigned int *nstars));
    1415Stars     *Convert_PS1_SV1        PROTO((FTable *table, unsigned int *nstars));
    1516Stars     *Convert_PS1_SV1_Alt    PROTO((FTable *table, unsigned int *nstars));
    1617Stars     *Convert_PS1_SV2        PROTO((FTable *table, unsigned int *nstars));
     18Stars     *Convert_PS1_SV3        PROTO((FTable *table, unsigned int *nstars));
    1719Stars     *Convert_PS1_DV3        PROTO((FTable *table, unsigned int *nstars));
     20Stars     *Convert_PS1_DV4        PROTO((FTable *table, unsigned int *nstars));
    1821
    1922// given a file with the pointer at the start of the table block and the
     
    7376    stars = Convert_PS1_V4 (&table, &Nstars);
    7477  }
     78  if (!strcmp (type, "PS1_V5")) {
     79    stars = Convert_PS1_V5 (&table, &Nstars);
     80  }
    7581  if (!strcmp (type, "PS1_SV1")) {
    7682    stars = Convert_PS1_SV1 (&table, &Nstars);
     
    7985    stars = Convert_PS1_SV2 (&table, &Nstars);
    8086  }
     87  if (!strcmp (type, "PS1_SV3")) {
     88    stars = Convert_PS1_SV3 (&table, &Nstars);
     89  }
    8190  if (!strcmp (type, "PS1_DV3")) {
    8291    stars = Convert_PS1_DV3 (&table, &Nstars);
     92  }
     93  if (!strcmp (type, "PS1_DV4")) {
     94    stars = Convert_PS1_DV4 (&table, &Nstars);
    8395  }
    8496  if (stars == NULL) {
     
    724736}
    725737
     738Stars *Convert_PS1_V5 (FTable *table, unsigned int *nstars) {
     739
     740  off_t Nstars;
     741  unsigned int i;
     742  double ZeroPt;
     743  Stars *stars;
     744  CMF_PS1_V5 *ps1data;
     745
     746  ps1data = gfits_table_get_CMF_PS1_V5 (table, &Nstars, NULL);
     747  if (!ps1data) {
     748    fprintf (stderr, "skipping inconsistent entry\n");
     749    return (NULL);
     750  }
     751  ZeroPt = GetZeroPoint();
     752
     753  ALLOCATE (stars, Stars, Nstars);
     754  for (i = 0; i < Nstars; i++) {
     755    InitStar (&stars[i]);
     756    stars[i].measure.Xccd       = ps1data[i].X;
     757    stars[i].measure.Yccd       = ps1data[i].Y;
     758    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     759    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     760
     761    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     762    stars[i].measure.pltscale   = ps1data[i].pltscale;
     763
     764    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     765      stars[i].measure.M      = NAN;
     766    } else {
     767      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     768    }
     769    stars[i].measure.dM         = ps1data[i].dM;
     770    stars[i].measure.dMcal      = ps1data[i].dMcal;
     771    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     772    stars[i].measure.dMap       = (ps1data[i].apFlux > 0.0) ? fabs(ps1data[i].apFluxErr / ps1data[i].apFlux) : NAN;
     773                       
     774    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     775    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     776                       
     777    // instrumental fluxes: these fluxes are converted from counts to counts/sec in
     778    // FilterStars.c
     779    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     780    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     781    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     782    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     783    stars[i].measure.FluxAp     = ps1data[i].apFlux;
     784    stars[i].measure.dFluxAp    = ps1data[i].apFluxErr;
     785
     786    stars[i].measure.Sky        = ps1data[i].sky;
     787    stars[i].measure.dSky       = ps1data[i].dSky;
     788                       
     789    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     790    stars[i].measure.psfQF      = ps1data[i].psfQF;
     791    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
     792
     793    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     794    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     795    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     796    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     797
     798    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     799    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     800    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     801
     802    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     803    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     804    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     805                       
     806    stars[i].measure.photFlags  = ps1data[i].flags;
     807
     808    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     809    stars[i].measure.detID      = ps1data[i].detID;
     810
     811    // the Average fields and the following Measure fields are set in FilterStars after
     812    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
     813
     814    // averef is set in find_matches
     815
     816    // dbFlags is zero on ingest.
     817
     818    // the following fields are currently not being set anywhere: t_msec
     819  }   
     820  *nstars = Nstars;
     821  return (stars);
     822}
     823
    726824Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
    727825
     
    901999  }
    9021000  ZeroPt = GetZeroPoint();
     1001
     1002  ALLOCATE (stars, Stars, Nstars);
     1003  for (i = 0; i < Nstars; i++) {
     1004    InitStar (&stars[i]);
     1005    stars[i].measure.Xccd       = ps1data[i].X;
     1006    stars[i].measure.Yccd       = ps1data[i].Y;
     1007    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     1008    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     1009
     1010    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     1011    stars[i].measure.pltscale   = ps1data[i].pltscale;
     1012
     1013    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     1014      stars[i].measure.M      = NAN;
     1015    } else {
     1016      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     1017    }
     1018    stars[i].measure.dM         = ps1data[i].dM;
     1019    stars[i].measure.dMcal      = ps1data[i].dMcal;
     1020    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     1021                       
     1022    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     1023    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     1024
     1025    // these fluxes are converted from counts to counts/sec in FilterStars.c
     1026    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     1027    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     1028    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     1029    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     1030
     1031    stars[i].measure.Sky        = ps1data[i].sky;
     1032    stars[i].measure.dSky       = ps1data[i].dSky;
     1033                       
     1034    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     1035    stars[i].measure.psfQF      = ps1data[i].psfQF;
     1036    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
     1037
     1038    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     1039    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     1040    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     1041    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     1042
     1043    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     1044    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     1045    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     1046
     1047    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     1048    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     1049    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     1050                       
     1051    stars[i].measure.photFlags  = ps1data[i].flags;
     1052
     1053    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     1054    stars[i].measure.detID      = ps1data[i].detID;
     1055
     1056    // the Average fields and the following Measure fields are set in FilterStars after
     1057    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     1058    // averef is set in find_matches, dbFlags is zero on ingest.
     1059
     1060    // the following fields are currently not being set anywhere: t_msec
     1061  }   
     1062  *nstars = Nstars;
     1063  return (stars);
     1064}
     1065
     1066Stars *Convert_PS1_SV3 (FTable *table, unsigned int *nstars) {
     1067
     1068  off_t Nstars;
     1069  unsigned int i;
     1070  double ZeroPt;
     1071  Stars *stars;
     1072  CMF_PS1_SV3 *ps1data;
     1073
     1074  ps1data = gfits_table_get_CMF_PS1_SV3 (table, &Nstars, NULL);
     1075  if (!ps1data) {
     1076    fprintf (stderr, "skipping inconsistent entry\n");
     1077    return (NULL);
     1078  }
     1079  ZeroPt = GetZeroPoint();
     1080
     1081  fprintf (stderr, "WARNING: Convert_PS1_SV3 not yet updated to match real format\n");
    9031082
    9041083  ALLOCATE (stars, Stars, Nstars);
     
    10471226}
    10481227
    1049 
    1050 
     1228Stars *Convert_PS1_DV4 (FTable *table, unsigned int *nstars) {
     1229
     1230  off_t Nstars;
     1231  unsigned int i;
     1232  double ZeroPt;
     1233  Stars *stars;
     1234  CMF_PS1_DV4 *ps1data;
     1235
     1236  ps1data = gfits_table_get_CMF_PS1_DV4 (table, &Nstars, NULL);
     1237  if (!ps1data) {
     1238    fprintf (stderr, "skipping inconsistent entry\n");
     1239    return (NULL);
     1240  }
     1241  ZeroPt = GetZeroPoint();
     1242
     1243  fprintf (stderr, "WARNING: Convert_PS1_DV4 not yet updated to match real format\n");
     1244
     1245  ALLOCATE (stars, Stars, Nstars);
     1246  for (i = 0; i < Nstars; i++) {
     1247    InitStar (&stars[i]);
     1248    stars[i].measure.Xccd       = ps1data[i].X;
     1249    stars[i].measure.Yccd       = ps1data[i].Y;
     1250    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     1251    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     1252
     1253    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     1254    stars[i].measure.pltscale   = ps1data[i].pltscale;
     1255
     1256    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     1257      stars[i].measure.M      = NAN;
     1258    } else {
     1259      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     1260    }
     1261    stars[i].measure.dM         = ps1data[i].dM;
     1262    stars[i].measure.dMcal      = ps1data[i].dMcal;
     1263    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     1264                       
     1265    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     1266    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     1267                       
     1268    // these fluxes are converted from counts to counts/sec in FilterStars.c
     1269    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     1270    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     1271    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     1272    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     1273
     1274    stars[i].measure.Sky        = ps1data[i].sky;
     1275    stars[i].measure.dSky       = ps1data[i].dSky;
     1276                       
     1277    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     1278    stars[i].measure.psfQF      = ps1data[i].psfQF;
     1279    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
     1280    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     1281    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     1282    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     1283    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     1284
     1285    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     1286    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     1287    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     1288
     1289    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     1290    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     1291    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     1292                       
     1293    stars[i].measure.photFlags  = ps1data[i].flags;
     1294
     1295    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     1296    stars[i].measure.detID      = ps1data[i].detID;
     1297
     1298    // the Average fields and the following Measure fields are set in FilterStars after
     1299    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
     1300
     1301    // averef is set in find_matches
     1302
     1303    // dbFlags is zero on ingest.
     1304
     1305    // the following fields are currently not being set anywhere: t_msec
     1306  }   
     1307  *nstars = Nstars;
     1308  return (stars);
     1309}
     1310
     1311
     1312
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/mkcmf.c

    r36906 r36912  
    811811    stars[i].dMcal = 0.05;
    812812
    813     stars[i].dMcal = 0.05;
    814 
    815813    XY_to_RD (&stars[i].RA, &stars[i].DEC, X[i], Y[i], &coords);
    816814    stars[i].apNpix = 3.14*8.0*8.0;
     
    870868      stars[i].X += FX * fSN * rnd_gauss(0.0, 1.0);
    871869      stars[i].Y += FY * fSN * rnd_gauss(0.0, 1.0);
    872       stars[i].M += fSN*rnd_gauss(0.0, 1.0);
     870      float Moff = fSN*rnd_gauss(0.0, 1.0);
     871      stars[i].M += Moff;
     872      stars[i].Map += Moff;
     873      stars[i].MapRaw += Moff;
     874      stars[i].Mcalib += Moff;
    873875    }
    874876  }
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/test/simple.dvo

    r36911 r36912  
    3434end 
    3535
     36if (not($?NO_NOISE))
     37  $NO_NOISE = ""
     38end
     39
    3640# create a populated catdir with a single cmf -- test each field
    3741macro test.fields
     
    5054
    5155  mkinput
    52   echo mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1
    53   exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1
     56  echo mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1 $NO_NOISE
     57  exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1 $NO_NOISE
    5458  if ($TAP_VERBOSE)
    5559    echo exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    5660    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    5761  else
     62    echo addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    5863    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass >& tmp.log
    5964  end
     
    113118
    114119    # some fields require arithmetic manipulations
    115     if ("$name:0" == "KRON_FLUX")
    116      set v1 = -2.5*log(v1)
    117     end
    118     if ("$name:0" == "KRON_FLUX_ERR")
    119      set v1 = KRON_FLUX_ERR / KRON_FLUX
     120    ## if ("$name:0" == "KRON_FLUX")
     121    ##  set v1 = -2.5*log(v1)
     122    ## end
     123    ## if ("$name:0" == "KRON_FLUX_ERR")
     124    ##  set v1 = KRON_FLUX_ERR / KRON_FLUX
     125    ## end
     126    if (("$name:0" == "X_PSF_SIG") || ("$name:0" == "Y_PSF_SIG"))
     127     set v1 = int(100*(v1))
     128     set v2 = int(100*(v2 + 0.0001))
     129    end
     130    if ("$name:0" == "POSANGLE")
     131     set v1 = int((0xffff/360.0)*(v1))
     132     set v2 = int((0xffff/360.0)*(v2 + 0.0028))
    120133    end
    121134
     
    335348  Y_PSF_SIG         : yccd:err
    336349  POSANGLE          : posangle
    337   PLTSCALE          : pltscale
     350  PLTSCALE          : platescale
    338351  PSF_INST_MAG      : mag:inst 
    339352  PSF_INST_MAG_SIG  : mag:err   
     
    345358  AP_FLUX           : flux:aper:inst 
    346359  AP_FLUX_SIG       : flux:aper:inst:err
    347   CAL_PSF_MAG       : mag:rel
    348   CAL_PSF_MAG_SIG   : mag:rel:err
     360  CAL_PSF_MAG       : mag:cal
     361  CAL_PSF_MAG_SIG   : mag:cal:err
    349362  RA_PSF            : ra
    350363  DEC_PSF           : dec
     
    386399  N_FRAMES          : SKIP # not ingested into DVO                   
    387400end                                                                   
    388 
    389  
    390 
    391 
    392 
    393 
    394 
    395 
    396 
    397 
    398 
    399 
    400 
    401 
    402 
    403 
    404 
    405 
    406 
    407 
    408 
    409 
    410 
    411 
    412 
    413 
    414 
    415 
    416 
    417 
    418 
    419 
    420 
    421 
    422 
    423 
    424 
    425 
    426 
    427 
    428 
    429 
    430 
    431 
    432 
    433 
    434 
  • branches/eam_branches/ipp-20140610/Ohana/src/libautocode/Makefile.Targets

    r36899 r36912  
    8080$(ASRC)/cmf-ps1-v3.$(ARCH).o \
    8181$(ASRC)/cmf-ps1-v4.$(ARCH).o \
    82 $(ASRC)/cmf-ps1-v5.$(ARCH).o \
    8382$(ASRC)/cmf-ps1-sv1.$(ARCH).o \
    8483$(ASRC)/cmf-ps1-sv2.$(ARCH).o \
     84$(ASRC)/cmf-ps1-sv3.$(ARCH).o \
     85$(ASRC)/cmf-ps1-dv4.$(ARCH).o \
    8586$(ASRC)/cmf-smpdata.$(ARCH).o \
    8687$(ASRC)/getstar-ps1-dev-0.$(ARCH).o \
     
    176177$(AINC)/cmf-ps1-v3.h \
    177178$(AINC)/cmf-ps1-v4.h \
    178 $(AINC)/cmf-ps1-v5.h \
    179179$(AINC)/cmf-ps1-sv1.h \
    180180$(AINC)/cmf-ps1-sv2.h \
     181$(AINC)/cmf-ps1-sv3.h \
     182$(AINC)/cmf-ps1-dv4.h \
    181183$(AINC)/cmf-smpdata.h \
    182184$(AINC)/getstar-ps1-dev-0.h \
  • branches/eam_branches/ipp-20140610/Ohana/src/libautocode/def/cmf-ps1-v5.d

    r36899 r36912  
    2222FIELD apFlux,         AP_FLUX,           float,    aperture flux,         counts
    2323FIELD apFluxErr,      AP_FLUX_SIG,       float,    error on ap flux,      counts
     24FIELD apNpix,         AP_NPIX,           int,      pixels used by aper,   pixels
    2425FIELD Mcalib,         CAL_PSF_MAG,       float,    calibrated psf mag,    mags
    2526FIELD dMcal,          CAL_PSF_MAG_SIG,   float,    zero point scatter,    mags
     27
     28# this field is in the wrong order (is between DEC and sky in cmf, but breaks byte boundary).
     29# I need to move these bytes around on read (fix PS1_V5?)
     30FIELD Mpeak,          PEAK_FLUX_AS_MAG,  float,    peak flux as a mag,    mags
    2631
    2732# NOTE: RA & DEC (both double) need to be on an 8-byte boundary...
     
    2934FIELD DEC,            DEC_PSF,           double,   PSF DEC coord,         degrees
    3035
    31 # this field is in the wrong order (between apFluxErr and Mcalib in cmf, but breaks byte boundary).
    32 # I need to move these bytes around on read (fix PS1_V5?)
    33 FIELD apNpix,         AP_NPIX,           int,      pixels used by aper,   pixels
    34 
    35 FIELD Mpeak,          PEAK_FLUX_AS_MAG,  float,    peak flux as a mag,    mags
    3636FIELD sky,            SKY,               float,    sky flux,              cnts/sec
    3737FIELD dSky,           SKY_SIGMA,         float,    sky flux error,        cnts/sec
  • branches/eam_branches/ipp-20140610/Ohana/src/libdvo/Makefile

    r36898 r36912  
    3838$(DESTINC)/ps1_v5_defs.h \
    3939$(DESTINC)/ps1_ref_defs.h \
    40 $(DESTINC)/cmf-ps1-dv3.h
     40$(DESTINC)/cmf-ps1-dv3.h \
     41$(DESTINC)/cmf-ps1-v5.h
    4142
    4243INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h $(DESTINC)/dvo_util.h $(DESTINC)/dvodb.h $(DESTINC)/libdvo_astro.h $(DESTINC)/convert.h $(DESTINC)/get_graphdata.h
     
    8889$(SRC)/cmf-ps1-sv1-alt.$(ARCH).o \
    8990$(SRC)/cmf-ps1-dv3.$(ARCH).o \
     91$(SRC)/cmf-ps1-v5.$(ARCH).o \
    9092$(SRC)/dvo_util.$(ARCH).o \
    9193$(SRC)/dbBooleanCond.$(ARCH).o          \
  • branches/eam_branches/ipp-20140610/Ohana/src/libdvo/include/dvo.h

    r36911 r36912  
    335335// another special case : does not match byte-boundaries
    336336# include "cmf-ps1-dv3.h"
     337# include "cmf-ps1-v5.h"
    337338
    338339typedef struct {
     
    668669float PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code, dvoMagClassType class);
    669670float PhotErr (Measure *measure, dvoMagClassType class);
     671float PhotCalErr (Measure *measure, dvoMagClassType class);
    670672
    671673float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source);
     
    690692float PhotFluxAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source);
    691693float PhotFluxRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure, dvoMagClassType class, dvoMagSourceType source);
     694
     695float PhotFluxInstErr (Measure *measure, dvoMagClassType class);
     696float PhotFluxCatErr (Measure *measure, dvoMagClassType class);
    692697
    693698float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
  • branches/eam_branches/ipp-20140610/Ohana/src/libdvo/src/cmf-ps1-dv3.c

    r35416 r36912  
    22
    33/*** note : this file is derived from the autocode version, but is modified because
    4      the forma does not match with structure byte boundaries ***/
     4     the format does not match with structure byte boundaries ***/
    55
    66/* if we are not correctly including the ohana headers, this will fail */
  • branches/eam_branches/ipp-20140610/Ohana/src/libdvo/src/dbExtractMeasures.c

    r36911 r36912  
    177177            case MAG_LEVEL_SYS:
    178178            case MAG_LEVEL_REL:
     179              value.Flt = PhotErr (measure, field->magClass); 
     180              break;
    179181            case MAG_LEVEL_CAL:
    180               value.Flt = PhotErr (measure, field->magClass); 
     182              value.Flt = PhotCalErr (measure, field->magClass); 
    181183              break;
    182184            case MAG_LEVEL_AVE:
     
    220222          switch (field->magLevel) {
    221223            case MAG_LEVEL_INST:
     224              value.Flt = PhotFluxInstErr (measure, field->magClass); 
     225              break;
    222226            case MAG_LEVEL_CAT:
     227              value.Flt = PhotFluxCatErr (measure, field->magClass); 
     228              break;
    223229            case MAG_LEVEL_SYS:
    224230            case MAG_LEVEL_REL:
  • branches/eam_branches/ipp-20140610/Ohana/src/libdvo/src/dvo_photcode_ops.c

    r36911 r36912  
    549549}
    550550
     551float PhotCalErr (Measure *measure, dvoMagClassType class) {
     552
     553  float dMcal = measure[0].dMcal;
     554  return (dMcal);
     555}
     556
    551557float PhotAveErr (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
    552558
     
    11131119  float Foff = MagToFlux(Mcol);
    11141120  return (Fave * Foff);
     1121}
     1122
     1123float PhotFluxInstErr (Measure *measure, dvoMagClassType class) {
     1124
     1125  float Moff = - measure[0].dt - ZERO_POINT;
     1126
     1127  // use dFlux if we can, but use dMag if we must:
     1128  // dFlux = Flux * dMag
     1129
     1130  float dFinst = NAN;
     1131  switch (class) {
     1132    case MAG_CLASS_PSF:
     1133      if (isnan (measure[0].dFluxPSF)) {
     1134        float Finst = MagToFlux(measure[0].M + Moff);
     1135        dFinst = measure[0].dM * Finst;
     1136      } else {
     1137        dFinst = measure[0].dFluxPSF;
     1138      }
     1139      break;
     1140    case MAG_CLASS_KRON:
     1141      if (isnan (measure[0].dFluxKron)) {
     1142        float Finst = MagToFlux(measure[0].Mkron + Moff);
     1143        dFinst = measure[0].dMkron * Finst;
     1144      } else {
     1145        dFinst = measure[0].dFluxKron;
     1146      }
     1147      break;
     1148    case MAG_CLASS_APER:
     1149      if (isnan (measure[0].dFluxAp)) {
     1150        float Finst = MagToFlux(measure[0].Map + Moff);
     1151        dFinst = measure[0].dMap * Finst;
     1152      } else {
     1153        dFinst = measure[0].dFluxAp;
     1154      }
     1155      break;
     1156    default:
     1157      break;
     1158  }
     1159  return (dFinst);
     1160}
     1161
     1162float PhotFluxCatErr (Measure *measure, dvoMagClassType class) {
     1163
     1164  int Np = photcodes[0].hashcode[measure[0].photcode];
     1165  if (Np == -1) return (NAN);
     1166  PhotCode *code = &photcodes[0].code[Np];
     1167
     1168  // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux
     1169  float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
     1170  float Moff = Mcal - ZERO_POINT;
     1171  float Foff = MagToFlux(Mcal);
     1172
     1173  // use dFlux if we can, but use dMag if we must:
     1174  // dFlux = Flux * dMag
     1175
     1176  float dFcat = NAN;
     1177  switch (class) {
     1178    case MAG_CLASS_PSF:
     1179      if (isnan (measure[0].dFluxPSF)) {
     1180        float Finst = MagToFlux(measure[0].M + Moff);
     1181        dFcat = measure[0].dM * Finst;
     1182      } else {
     1183        dFcat = measure[0].dFluxPSF * Foff;
     1184      }
     1185      break;
     1186    case MAG_CLASS_KRON:
     1187      if (isnan (measure[0].dFluxKron)) {
     1188        float Finst = MagToFlux(measure[0].Mkron + Moff);
     1189        dFcat = measure[0].dMkron * Finst;
     1190      } else {
     1191        dFcat = measure[0].dFluxKron * Foff;
     1192      }
     1193      break;
     1194    case MAG_CLASS_APER:
     1195      if (isnan (measure[0].dFluxAp)) {
     1196        float Finst = MagToFlux(measure[0].Map + Moff);
     1197        dFcat = measure[0].dMap * Finst;
     1198      } else {
     1199        dFcat = measure[0].dFluxAp * Foff;
     1200      }
     1201      break;
     1202    default:
     1203      break;
     1204  }
     1205  return (dFcat);
    11151206}
    11161207
Note: See TracChangeset for help on using the changeset viewer.