IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2013, 6:16:50 AM (13 years ago)
Author:
eugene
Message:

add structures to addstar ps1-dv3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130307/Ohana/src/addstar/src/ReadStarsFITS.c

    r34580 r35316  
    1515Stars     *Convert_PS1_SV1_Alt    PROTO((FTable *table, unsigned int *nstars));
    1616Stars     *Convert_PS1_SV2        PROTO((FTable *table, unsigned int *nstars));
     17Stars     *Convert_PS1_DV3        PROTO((FTable *table, unsigned int *nstars));
    1718
    1819// given a file with the pointer at the start of the table block and the
     
    7879    stars = Convert_PS1_SV2 (&table, &Nstars);
    7980  }
     81  if (!strcmp (type, "PS1_DV3")) {
     82    stars = Convert_PS1_DV3 (&table, &Nstars);
     83  }
    8084  if (stars == NULL) {
    8185    fprintf (stderr, "invalid table type %s\n", type);
     
    962966}
    963967
    964 
     968Stars *Convert_PS1_DV3 (FTable *table, unsigned int *nstars) {
     969
     970  off_t Nstars;
     971  unsigned int i;
     972  double ZeroPt;
     973  Stars *stars;
     974  CMF_PS1_DV3 *ps1data;
     975
     976  ps1data = gfits_table_get_CMF_PS1_DV3 (table, &Nstars, NULL);
     977  if (!ps1data) {
     978    fprintf (stderr, "skipping inconsistent entry\n");
     979    return (NULL);
     980  }
     981  ZeroPt = GetZeroPoint();
     982
     983  ALLOCATE (stars, Stars, Nstars);
     984  for (i = 0; i < Nstars; i++) {
     985    InitStar (&stars[i]);
     986    stars[i].measure.Xccd       = ps1data[i].X;
     987    stars[i].measure.Yccd       = ps1data[i].Y;
     988    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     989    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     990
     991    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     992    stars[i].measure.pltscale   = ps1data[i].pltscale;
     993
     994    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     995      stars[i].measure.M      = NAN;
     996    } else {
     997      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     998    }
     999    stars[i].measure.dM         = ps1data[i].dM;
     1000    stars[i].measure.dMcal      = ps1data[i].dMcal;
     1001    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     1002                       
     1003    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     1004    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     1005                       
     1006    // these fluxes are converted from counts to counts/sec in FilterStars.c
     1007    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     1008    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     1009    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     1010    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     1011
     1012    stars[i].measure.Sky        = ps1data[i].sky;
     1013    stars[i].measure.dSky       = ps1data[i].dSky;
     1014                       
     1015    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     1016    stars[i].measure.psfQF      = ps1data[i].psfQF;
     1017    stars[i].measure.psfQFperf  = ps1data[i].psfQFperf;
     1018    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     1019    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     1020    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     1021    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     1022
     1023    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     1024    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     1025    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     1026
     1027    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     1028    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     1029    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     1030                       
     1031    stars[i].measure.photFlags  = ps1data[i].flags;
     1032
     1033    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     1034    stars[i].measure.detID      = ps1data[i].detID;
     1035
     1036    // the Average fields and the following Measure fields are set in FilterStars after
     1037    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
     1038
     1039    // averef is set in find_matches
     1040
     1041    // dbFlags is zero on ingest.
     1042
     1043    // the following fields are currently not being set anywhere: t_msec
     1044  }   
     1045  *nstars = Nstars;
     1046  return (stars);
     1047}
     1048
     1049
     1050
Note: See TracChangeset for help on using the changeset viewer.