IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24400


Ignore:
Timestamp:
Jun 14, 2009, 2:15:25 PM (17 years ago)
Author:
eugene
Message:

added new cmf format ps1_v2, added function to handle broken cmf ps1_v1 data & added call to addstar

Location:
trunk/Ohana/src
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/include/addstar.h

    r21508 r24400  
    263263Stars     *Convert_PS1_DEV_1      PROTO((FTable *table, int *nstars));
    264264Stars     *Convert_PS1_V1         PROTO((FTable *table, int *nstars));
     265Stars     *Convert_PS1_V1_Alt     PROTO((FTable *table, int *nstars));
     266Stars     *Convert_PS1_V2         PROTO((FTable *table, int *nstars));
    265267
    266268int        InitStar               PROTO((Stars *star));
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r21508 r24400  
    4343    stars = Convert_PS1_V1 (&table, &Nstars);
    4444  }
     45  if (!strcmp (type, "PS1_V2")) {
     46    stars = Convert_PS1_V2 (&table, &Nstars);
     47  }
    4548  if (stars == NULL) {
    4649    fprintf (stderr, "ERROR: invalid table type %s\n", type);
     
    188191  Stars *stars;
    189192  CMF_PS1_V1 *ps1data;
     193
     194  // CMF_PS1_V1 was modified 2009.05.26 (r24251) to use doubles for ra & dec.  this was a
     195  // mistake in two ways: a few format should have been defined (eg, CMF_PS1_V2), and the
     196  // layout used did not have clean byte-boundaries for the corresponding structure.  The
     197  // former means we have two varieties of CMF_PS1_V1 out there; the latter means that the
     198  // autocode tools do not work to read in the new version, even if we recognize it.  Here we
     199  // test for the existence of the broken version (table[0].headers[0].Naxis[0] == 136), and
     200  // call a special conversion function if it is found.
     201
     202  if (table[0].header[0].Naxis[0] == 136) {
     203      stars = Convert_PS1_V1_Alt (table, nstars);
     204      return (stars);
     205  }
    190206
    191207  ps1data = gfits_table_get_CMF_PS1_V1 (table, &Nstars, NULL);
     
    244260  return (stars);
    245261}
     262
     263Stars *Convert_PS1_V1_Alt (FTable *table, int *nstars) {
     264
     265  int i, Nstars;
     266  double ZeroPt;
     267  Stars *stars;
     268  CMF_PS1_V2 *ps1data;
     269
     270  // CMF_PS1_V1 was modified 2009.05.26 (r24251) to use doubles for ra & dec.  this was a
     271  // mistake in two ways: a few format should have been defined (eg, CMF_PS1_V2), and the
     272  // layout used did not have clean byte-boundaries for the corresponding structure.  The
     273  // former means we have two varieties of CMF_PS1_V1 out there; the latter means that the
     274  // autocode tools do not work to read in the new version, even if we recognize it.  Here we
     275  // test for the existence of the broken version (table[0].headers[0].Naxis[0] == 136), and
     276  // call a special conversion function if it is found.
     277
     278  ps1data = gfits_table_get_CMF_PS1_V1_Alt (table, &Nstars, NULL);
     279  ZeroPt = GetZeroPoint();
     280
     281  ALLOCATE (stars, Stars, Nstars);
     282  for (i = 0; i < Nstars; i++) {
     283    InitStar (&stars[i]);
     284    stars[i].measure.Xccd       = ps1data[i].X;
     285    stars[i].measure.Yccd       = ps1data[i].Y;
     286    stars[i].measure.dXccd      = ShortPixels(ps1data[i].dX);
     287    stars[i].measure.dYccd      = ShortPixels(ps1data[i].dY);
     288
     289    stars[i].measure.posangle   = ShortDegree(ps1data[i].posangle);
     290    stars[i].measure.pltscale   = ps1data[i].pltscale;
     291
     292    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     293        stars[i].measure.M      = NAN;
     294    } else {
     295        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     296    }
     297    stars[i].measure.dM         = ps1data[i].dM;
     298    stars[i].measure.dMcal      = ps1data[i].dMcal;
     299    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     300                       
     301    stars[i].measure.Sky        = ps1data[i].sky;
     302    stars[i].measure.dSky       = ps1data[i].dSky;
     303                       
     304    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     305    stars[i].measure.psfQual    = ps1data[i].psfQual;
     306    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     307    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     308    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     309    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     310
     311    stars[i].measure.FWx        = ShortPixels(ps1data[i].fx);
     312    stars[i].measure.FWy        = ShortPixels(ps1data[i].fy);
     313    stars[i].measure.theta      = ShortDegree(ps1data[i].df);
     314
     315    stars[i].measure.Mxx        = ShortPixels(ps1data[i].Mxx);
     316    stars[i].measure.Mxy        = ShortPixels(ps1data[i].Mxy);
     317    stars[i].measure.Myy        = ShortPixels(ps1data[i].Myy);
     318                       
     319    stars[i].measure.photFlags  = ps1data[i].flags;
     320
     321    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     322    stars[i].measure.detID      = ps1data[i].detID;
     323
     324    // the Average fields and the following Measure fields are set in FilterStars after
     325    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     326    // averef is set in find_matches, dbFlags is zero on ingest.
     327
     328    // the following fields are currently not being set anywhere: t_msec
     329  }   
     330  *nstars = Nstars;
     331  return (stars);
     332}
     333
     334Stars *Convert_PS1_V2 (FTable *table, int *nstars) {
     335
     336  int i, Nstars;
     337  double ZeroPt;
     338  Stars *stars;
     339  CMF_PS1_V2 *ps1data;
     340
     341  ps1data = gfits_table_get_CMF_PS1_V2 (table, &Nstars, NULL);
     342  ZeroPt = GetZeroPoint();
     343
     344  ALLOCATE (stars, Stars, Nstars);
     345  for (i = 0; i < Nstars; i++) {
     346    InitStar (&stars[i]);
     347    stars[i].measure.Xccd       = ps1data[i].X;
     348    stars[i].measure.Yccd       = ps1data[i].Y;
     349    stars[i].measure.dXccd      = ShortPixels(ps1data[i].dX);
     350    stars[i].measure.dYccd      = ShortPixels(ps1data[i].dY);
     351
     352    stars[i].measure.posangle   = ShortDegree(ps1data[i].posangle);
     353    stars[i].measure.pltscale   = ps1data[i].pltscale;
     354
     355    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     356        stars[i].measure.M      = NAN;
     357    } else {
     358        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     359    }
     360    stars[i].measure.dM         = ps1data[i].dM;
     361    stars[i].measure.dMcal      = ps1data[i].dMcal;
     362    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     363                       
     364    stars[i].measure.Sky        = ps1data[i].sky;
     365    stars[i].measure.dSky       = ps1data[i].dSky;
     366                       
     367    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     368    stars[i].measure.psfQual    = ps1data[i].psfQual;
     369    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     370    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     371    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     372    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     373
     374    stars[i].measure.FWx        = ShortPixels(ps1data[i].fx);
     375    stars[i].measure.FWy        = ShortPixels(ps1data[i].fy);
     376    stars[i].measure.theta      = ShortDegree(ps1data[i].df);
     377
     378    stars[i].measure.Mxx        = ShortPixels(ps1data[i].Mxx);
     379    stars[i].measure.Mxy        = ShortPixels(ps1data[i].Mxy);
     380    stars[i].measure.Myy        = ShortPixels(ps1data[i].Myy);
     381                       
     382    stars[i].measure.photFlags  = ps1data[i].flags;
     383
     384    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     385    stars[i].measure.detID      = ps1data[i].detID;
     386
     387    // the Average fields and the following Measure fields are set in FilterStars after
     388    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     389    // averef is set in find_matches, dbFlags is zero on ingest.
     390
     391    // the following fields are currently not being set anywhere: t_msec
     392  }   
     393  *nstars = Nstars;
     394  return (stars);
     395}
  • trunk/Ohana/src/libautocode/Makefile.Targets

    r21508 r24400  
    4848$(ASRC)/cmf-ps1-dev-1.$(ARCH).o \
    4949$(ASRC)/cmf-ps1-v1.$(ARCH).o \
     50$(ASRC)/cmf-ps1-v2.$(ARCH).o \
    5051$(ASRC)/cmf-smpdata.$(ARCH).o \
    5152$(ASRC)/getstar-ps1-dev-0.$(ARCH).o \
     
    107108$(AINC)/cmf-ps1-dev-1.h \
    108109$(AINC)/cmf-ps1-v1.h \
     110$(AINC)/cmf-ps1-v2.h \
    109111$(AINC)/cmf-smpdata.h \
    110112$(AINC)/getstar-ps1-dev-0.h \
  • trunk/Ohana/src/libautocode/def/cmf-ps1-v1.d

    r24399 r24400  
    33EXTNAME CMF_PS1_V1
    44TYPE    BINTABLE
    5 SIZE    136
     5SIZE    128
    66
    77# elements of data structure / FITS table
     
    1111FIELD dX,        X_PSF_SIG,        float,    x coord error,         pixels
    1212FIELD dY,        Y_PSF_SIG,        float,    y coord error,         pixels
    13 FIELD RA,        RA_PSF,           double,   PSF RA coord,          degrees
    14 FIELD DEC,       DEC_PSF,          double,   PSF DEC coord,         degrees
     13FIELD RA,        RA_PSF,           float,    PSF RA coord,          degrees
     14FIELD DEC,       DEC_PSF,          float,    PSF DEC coord,         degrees
    1515FIELD posangle,  POSANGLE,         float,    Posangle at source,    degrees
    1616FIELD pltscale,  PLTSCALE,         float,    Plate Scale at source, arcsec/pixel
  • trunk/Ohana/src/libdvo/Makefile

    r24399 r24400  
    6969$(SRC)/skyregion_io.$(ARCH).o    \
    7070$(SRC)/skyregion_gsc.$(ARCH).o    \
    71 $(SRC)/skyregion_ops.$(ARCH).o
     71$(SRC)/skyregion_ops.$(ARCH).o \
     72$(SRC)/cmf-ps1-v1-alt.$(ARCH).o
    7273
    7374# $(SRC)/dvo_convert_panstarrs.$(ARCH).o \
  • trunk/Ohana/src/libdvo/include/dvo.h

    r24308 r24400  
    184184  SkyRegion **regions;
    185185} SkyList;
     186
     187// special-case function:
     188CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, int *Ndata, int *swapped);
    186189
    187190# if (0)
Note: See TracChangeset for help on using the changeset viewer.