IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2011, 1:19:27 PM (15 years ago)
Author:
eugene
Message:

updates from eam branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r30725 r31160  
    5454    stars = Convert_PS1_V3 (&table, &Nstars);
    5555  }
     56  if (!strcmp (type, "PS1_SV1")) {
     57    stars = Convert_PS1_SV1 (&table, &Nstars);
     58  }
    5659  if (stars == NULL) {
    5760    fprintf (stderr, "invalid table type %s\n", type);
     
    501504  return (stars);
    502505}
     506
     507Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
     508
     509  off_t Nstars;
     510  unsigned int i;
     511  double ZeroPt;
     512  Stars *stars;
     513  CMF_PS1_SV1 *ps1data;
     514
     515  if (table[0].header[0].Naxis[0] == 196) {
     516      stars = Convert_PS1_SV1_Alt (table, nstars);
     517      return (stars);
     518  }
     519
     520  ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
     521  if (!ps1data) {
     522    fprintf (stderr, "skipping inconsistent entry\n");
     523    return (NULL);
     524  }
     525  ZeroPt = GetZeroPoint();
     526
     527  ALLOCATE (stars, Stars, Nstars);
     528  for (i = 0; i < Nstars; i++) {
     529    InitStar (&stars[i]);
     530    stars[i].measure.Xccd       = ps1data[i].X;
     531    stars[i].measure.Yccd       = ps1data[i].Y;
     532    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     533    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     534
     535    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     536    stars[i].measure.pltscale   = ps1data[i].pltscale;
     537
     538    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     539        stars[i].measure.M      = NAN;
     540    } else {
     541        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     542    }
     543    stars[i].measure.dM         = ps1data[i].dM;
     544    stars[i].measure.dMcal      = ps1data[i].dMcal;
     545    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     546                       
     547    stars[i].measure.Sky        = ps1data[i].sky;
     548    stars[i].measure.dSky       = ps1data[i].dSky;
     549                       
     550    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     551    stars[i].measure.psfQual    = ps1data[i].psfQual;
     552    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     553    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     554    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     555    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     556
     557    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     558    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     559    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     560
     561    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     562    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     563    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     564                       
     565    stars[i].measure.photFlags  = ps1data[i].flags;
     566
     567    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     568    stars[i].measure.detID      = ps1data[i].detID;
     569
     570    // the Average fields and the following Measure fields are set in FilterStars after
     571    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     572    // averef is set in find_matches, dbFlags is zero on ingest.
     573
     574    // the following fields are currently not being set anywhere: t_msec
     575  }   
     576  *nstars = Nstars;
     577  return (stars);
     578}
     579
     580Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
     581
     582  off_t Nstars;
     583  unsigned int i;
     584  double ZeroPt;
     585  Stars *stars;
     586  CMF_PS1_SV1 *ps1data;
     587
     588  // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
     589
     590  ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
     591  if (!ps1data) {
     592    fprintf (stderr, "skipping inconsistent entry\n");
     593    return (NULL);
     594  }
     595  ZeroPt = GetZeroPoint();
     596
     597  ALLOCATE (stars, Stars, Nstars);
     598  for (i = 0; i < Nstars; i++) {
     599    InitStar (&stars[i]);
     600    stars[i].measure.Xccd       = ps1data[i].X;
     601    stars[i].measure.Yccd       = ps1data[i].Y;
     602    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     603    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     604
     605    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     606    stars[i].measure.pltscale   = ps1data[i].pltscale;
     607
     608    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     609        stars[i].measure.M      = NAN;
     610    } else {
     611        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     612    }
     613    stars[i].measure.dM         = ps1data[i].dM;
     614    stars[i].measure.dMcal      = ps1data[i].dMcal;
     615    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     616                       
     617    stars[i].measure.Sky        = ps1data[i].sky;
     618    stars[i].measure.dSky       = ps1data[i].dSky;
     619                       
     620    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     621    stars[i].measure.psfQual    = ps1data[i].psfQual;
     622    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     623    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     624    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     625    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     626
     627    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     628    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     629    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     630
     631    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     632    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     633    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     634                       
     635    stars[i].measure.photFlags  = ps1data[i].flags;
     636
     637    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     638    stars[i].measure.detID      = ps1data[i].detID;
     639
     640    // the Average fields and the following Measure fields are set in FilterStars after
     641    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     642    // averef is set in find_matches, dbFlags is zero on ingest.
     643
     644    // the following fields are currently not being set anywhere: t_msec
     645  }   
     646  *nstars = Nstars;
     647  return (stars);
     648}
     649
Note: See TracChangeset for help on using the changeset viewer.