IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29412


Ignore:
Timestamp:
Oct 14, 2010, 2:09:00 PM (16 years ago)
Author:
eugene
Message:

better check for valid BYTE_SWAP setting; add support for PS1_V3 format cmf files

Location:
branches/eam_branches/ipp-20100823/Ohana/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/Ohana/src/addstar/include/addstar.h

    r28965 r29412  
    253253Stars     *Convert_PS1_V1_Alt     PROTO((FTable *table, unsigned int *nstars));
    254254Stars     *Convert_PS1_V2         PROTO((FTable *table, unsigned int *nstars));
     255Stars     *Convert_PS1_V3         PROTO((FTable *table, unsigned int *nstars));
    255256
    256257int        InitStar               PROTO((Stars *star));
  • branches/eam_branches/ipp-20100823/Ohana/src/addstar/src/MatchHeaders.c

    r27435 r29412  
    5757    if (!strcmp (exttype, "PS1_V1")) goto keep;
    5858    if (!strcmp (exttype, "PS1_V2")) goto keep;
     59    if (!strcmp (exttype, "PS1_V3")) goto keep;
    5960    continue;
    6061
  • branches/eam_branches/ipp-20100823/Ohana/src/addstar/src/ReadStarsFITS.c

    r29001 r29412  
    4747    stars = Convert_PS1_V2 (&table, &Nstars);
    4848  }
     49  if (!strcmp (type, "PS1_V3")) {
     50    stars = Convert_PS1_V3 (&table, &Nstars);
     51  }
    4952  if (stars == NULL) {
    5053    fprintf (stderr, "ERROR: invalid table type %s\n", type);
     
    426429  return (stars);
    427430}
     431
     432Stars *Convert_PS1_V3 (FTable *table, unsigned int *nstars) {
     433
     434  off_t Nstars;
     435  unsigned int i;
     436  double ZeroPt;
     437  Stars *stars;
     438  CMF_PS1_V3 *ps1data;
     439
     440  ps1data = gfits_table_get_CMF_PS1_V3 (table, &Nstars, NULL);
     441  if (!ps1data) {
     442    fprintf (stderr, "skipping inconsistent entry\n");
     443    return (NULL);
     444  }
     445  ZeroPt = GetZeroPoint();
     446
     447  ALLOCATE (stars, Stars, Nstars);
     448  for (i = 0; i < Nstars; i++) {
     449    InitStar (&stars[i]);
     450    stars[i].measure.Xccd       = ps1data[i].X;
     451    stars[i].measure.Yccd       = ps1data[i].Y;
     452    stars[i].measure.dXccd      = ShortPixels(ps1data[i].dX);
     453    stars[i].measure.dYccd      = ShortPixels(ps1data[i].dY);
     454
     455    stars[i].measure.posangle   = ShortDegree(ps1data[i].posangle);
     456    stars[i].measure.pltscale   = ps1data[i].pltscale;
     457
     458    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     459        stars[i].measure.M      = NAN;
     460    } else {
     461        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     462    }
     463    stars[i].measure.dM         = ps1data[i].dM;
     464    stars[i].measure.dMcal      = ps1data[i].dMcal;
     465    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     466                       
     467    stars[i].measure.Sky        = ps1data[i].sky;
     468    stars[i].measure.dSky       = ps1data[i].dSky;
     469                       
     470    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     471    stars[i].measure.psfQual    = ps1data[i].psfQual;
     472    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     473    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     474    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     475    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     476
     477    stars[i].measure.FWx        = ShortPixels(ps1data[i].fx);
     478    stars[i].measure.FWy        = ShortPixels(ps1data[i].fy);
     479    stars[i].measure.theta      = ShortDegree(ps1data[i].df);
     480
     481    stars[i].measure.Mxx        = ShortPixels(ps1data[i].Mxx);
     482    stars[i].measure.Mxy        = ShortPixels(ps1data[i].Mxy);
     483    stars[i].measure.Myy        = ShortPixels(ps1data[i].Myy);
     484                       
     485    stars[i].measure.photFlags  = ps1data[i].flags;
     486
     487    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     488    stars[i].measure.detID      = ps1data[i].detID;
     489
     490    // the Average fields and the following Measure fields are set in FilterStars after
     491    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     492    // averef is set in find_matches, dbFlags is zero on ingest.
     493
     494    // the following fields are currently not being set anywhere: t_msec
     495  }   
     496  *nstars = Nstars;
     497  return (stars);
     498}
  • branches/eam_branches/ipp-20100823/Ohana/src/libautocode/Makefile.Targets

    r27579 r29412  
    5959$(ASRC)/cmf-ps1-v1.$(ARCH).o \
    6060$(ASRC)/cmf-ps1-v2.$(ARCH).o \
     61$(ASRC)/cmf-ps1-v3.$(ARCH).o \
    6162$(ASRC)/cmf-smpdata.$(ARCH).o \
    6263$(ASRC)/getstar-ps1-dev-0.$(ARCH).o \
     
    129130$(AINC)/cmf-ps1-v1.h \
    130131$(AINC)/cmf-ps1-v2.h \
     132$(AINC)/cmf-ps1-v3.h \
    131133$(AINC)/cmf-smpdata.h \
    132134$(AINC)/getstar-ps1-dev-0.h \
  • branches/eam_branches/ipp-20100823/Ohana/src/libautocode/def/autocode.c

    r29001 r29412  
    2525}
    2626
    27 $STRUCT *gfits_downsize_and_convert_$STRUCT ($STRUCT *data, off_t size, off_t nitems) {
    28 
    29   off_t i;
    30   unsigned char *byte, tmp;
    31   $STRUCT *output;
    32 
    33   if ($SIZE > size) {
    34     fprintf (stderr, "ERROR: uncorrectable mismatch in data types $STRUCT: "OFF_T_FMT" vs %d\n",  size,  $SIZE);
    35     exit (1);
    36   }
    37 
    38   // allocate a new array
    39   ALLOCATE (output, $STRUCT, nitems);
    40   for (i = 0; i < nitems; i++) {
    41     memcpy (&output[i], &data[i], $SIZE);
    42   }
    43 
    44   /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */
    45   i = tmp = 0;
    46   byte = NULL;
    47 
    48 # ifdef BYTE_SWAP
    49   byte = (unsigned char *) output;
    50   for (i = 0; i < nitems; i++, byte += size) {
    51     /** BYTE SWAP **/
    52   }
    53 # endif 
    54 
    55   return (output);
    56 }
    57 
    5827/*** add test of EXTNAME and header-defined columns? ***/
    5928/* return internal structure representation */
     
    6130
    6231  int Ncols;
    63   $STRUCT *data, *output;
     32  $STRUCT *data;
    6433
    6534  Ncols = ftable[0].header[0].Naxis[0];
     
    7342  if ((swapped == NULL) || (*swapped == FALSE)) {
    7443    if (!gfits_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata)) {
    75       output = gfits_downsize_and_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata);
    76       free (ftable[0].buffer);
    77       ftable[0].buffer = (char *) output;
    78       // XXX do I need to change NX?
     44      return NULL;
    7945    }
    8046    gfits_table_scale_data (ftable);
  • branches/eam_branches/ipp-20100823/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c

    r29001 r29412  
    11# include "dvo.h"
     2
     3/* if we are not correctly including the ohana headers, this will fail */
     4# ifndef BYTE_SWAP
     5# ifndef NOT_BYTE_SWAP
     6# error "neither BYTE_SWAP not NOT_BYTE_SWAP is set"
     7# endif
     8# endif
    29
    310CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, off_t *Ndata, char *swapped) {
  • branches/eam_branches/ipp-20100823/Ohana/src/libfits/include/gfitsio.h

    r28241 r29412  
    1313# endif
    1414
     15/* if we are not correctly including the ohana headers, this will fail */
    1516# ifndef NEWLINE
    1617# define NEWLINE                 10  /* UNIX RETURN character */
  • branches/eam_branches/ipp-20100823/Ohana/src/libkapa/include/kapa.h

    r27790 r29412  
    1212# include <png.h>
    1313# include <dvo.h>
     14
     15/* if we are not correctly including the ohana headers, this will fail */
     16# ifndef BYTE_SWAP
     17# ifndef NOT_BYTE_SWAP
     18# error "neither BYTE_SWAP not NOT_BYTE_SWAP is set"
     19# endif
     20# endif
    1421
    1522typedef struct sockaddr_in KapaSockAddress;
  • branches/eam_branches/ipp-20100823/Ohana/src/libohana/include/ohana.h

    r28645 r29412  
    9494};
    9595
    96 /* note: in the Ohana tree, the byte order is determined by the ARCH variable
    97    if you have a small endian machine that is not listed here, the test
    98    program 'typestest' should fail */
     96/* Some notes on the Ohana BYTE_SWAP macros:
     97
     98   1) BYTE_SWAP is set in this file based on the environment variable 'ARCH', which is in turn
     99   set by the psconfig system (or is set manually by the builder). 
     100
     101   2) BYTE_SWAP is only used when building the Ohana tree: code which links against Ohana
     102   (eg, libkapa or others) does not need to have this value correctly set.
     103   
     104   3) the libohana build tests for the validity of the BYTE_SWAP choice by running the test
     105   program 'typestest' and raising an error if the tests fail.
     106
     107   4) if your build fails due to the typestest program, check your value of 'ARCH' and if
     108   necessary add it to the list below.
     109
     110*/
     111
    99112# ifndef BYTE_SWAP
    100113# ifdef linux
     
    117130# define BYTE_SWAP
    118131# endif
    119 # else
     132# endif /* BYTE_SWAP */
     133
     134/* other Ohana components use these two values to check that ohana.h was correctly included */
     135# ifndef BYTE_SWAP
    120136# define NOT_BYTE_SWAP
    121 # endif /* BYTE_SWAP */
     137# endif
    122138
    123139# ifndef NAN
  • branches/eam_branches/ipp-20100823/Ohana/src/libohana/src/Fread.c

    r27435 r29412  
    1414  tmp = byte[X+2]; byte[X+2] = byte[X+5]; byte[X+5] = tmp; \
    1515  tmp = byte[X+3]; byte[X+3] = byte[X+4]; byte[X+4] = tmp;
    16 
    17 /** this is also used in libautocode/def/common.h -- consolidate **/
    18 # ifdef linux
    19 # define BYTE_SWAP
    20 # endif
    21 
    22 # ifdef sid
    23 # define BYTE_SWAP
    24 # endif
    25 
    26 # ifdef dec
    27 # define BYTE_SWAP
    28 # endif
    2916
    3017/* add other architectures here, ie dec, alpha, etc */
  • branches/eam_branches/ipp-20100823/Ohana/src/mosastro/src/ConvertMatch.c

    r12332 r29412  
    1111  tmp = byte[X+2]; byte[X+2] = byte[X+5]; byte[X+5] = tmp; \
    1212  tmp = byte[X+3]; byte[X+3] = byte[X+4]; byte[X+4] = tmp;
    13 
    14 # ifdef linux
    15 # define BYTE_SWAP
    16 # endif
    17 
    18 # ifdef sid
    19 # define BYTE_SWAP
    20 # endif
    21 
    22 # ifdef dec
    23 # define BYTE_SWAP
    24 # endif
    2513
    2614# define MATCH_SIZE 104
Note: See TracChangeset for help on using the changeset viewer.