IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15038


Ignore:
Timestamp:
Sep 26, 2007, 5:34:27 PM (19 years ago)
Author:
eugene
Message:

various fixes to ensure data is carried from Stars to Measures correctly for PS1_DEV_1

Location:
trunk/Ohana/src
Files:
37 edited

Legend:

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

    r12732 r15038  
    4343    stars[N].Mcal    = image[0].Mcal;
    4444    stars[N].t       = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
     45    stars[N].dt      = MTIME;
    4546
    4647    stars[N].M       = MIN (stars[N].M + MTIME, NO_MAG);
  • trunk/Ohana/src/addstar/src/ImageOptions.c

    r12332 r15038  
    3636  }
    3737  options[0].photcode = equivPhotcode;
     38
     39  options[0].imageID = 0;
    3840  return (TRUE);
    3941}
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r15036 r15038  
    176176    stars[i].extNsigma = ps1data[i].extNsigma;
    177177
    178     stars[i].detID   = ps1data[i].detID;
     178    stars[i].detID     = ps1data[i].detID;
     179    stars[i].flags     = ps1data[i].flags;
     180
     181    // XXX not defined anyway
     182    // stars[i].stargal   = ps1data[i].stargal;
    179183
    180184    /* these are set elsewhere */
     
    196200    stars[i].dt      = 0;
    197201    stars[i].airmass = 0;
     202    stars[i].az      = 0;
    198203    stars[i].code    = 0;
    199204    stars[i].found   = 0;
  • trunk/Ohana/src/addstar/src/SEDfit.c

    r12332 r15038  
    186186      outcat[0].measure[Nmeas].dM       = 0.0;
    187187      outcat[0].measure[Nmeas].Mcal     = 0;
    188       outcat[0].measure[Nmeas].t           = TIMEREF;
    189       outcat[0].measure[Nmeas].averef      = Nave;
    190       outcat[0].measure[Nmeas].photcode      = table[0].code[n];
    191       outcat[0].measure[Nmeas].dophot      = 0;
    192       outcat[0].measure[Nmeas].flags       = 0;
     188      outcat[0].measure[Nmeas].t        = TIMEREF;
     189      outcat[0].measure[Nmeas].averef   = Nave;
     190      outcat[0].measure[Nmeas].photcode = table[0].code[n];
     191      outcat[0].measure[Nmeas].dophot   = 0;
     192      outcat[0].measure[Nmeas].dbFlags  = 0;
    193193      outcat[0].measure[Nmeas].dt       = 0xffff;
    194194
  • trunk/Ohana/src/addstar/src/find_matches.c

    r14291 r15038  
    163163      catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].D);
    164164
    165       /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
    166       /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
    167165      catalog[0].measure[Nmeas].Xccd     = stars[N].X;
    168166      catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
     
    175173      catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
    176174      catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    177       catalog[0].measure[Nmeas].flags    = 0;
     175      catalog[0].measure[Nmeas].dbFlags  = 0;
    178176      catalog[0].measure[Nmeas].dt       = stars[N].dt;
    179177      catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
     178
     179      catalog[0].measure[Nmeas].photFlags = stars[N].flags;
     180      catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
     181      catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     182      catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
     183      catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     184      catalog[0].measure[Nmeas].Sky       = stars[N].sky;
     185      catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
     186
     187      catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
     188
     189      catalog[0].measure[Nmeas].detID     = stars[N].detID;
     190      catalog[0].measure[Nmeas].imageID   = options.imageID;
     191
     192      catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
     193      catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    180194
    181195      catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
     
    201215      /* this image star matches more than one catalog star */
    202216      if (stars[N].found > -1) {
    203         catalog[0].measure[stars[N].found].flags |= BLEND_IMAGE;
    204         catalog[0].measure[Nmeas].flags |= BLEND_IMAGE;
     217        catalog[0].measure[stars[N].found].dbFlags |= BLEND_IMAGE;
     218        catalog[0].measure[Nmeas].dbFlags |= BLEND_IMAGE;
    205219      }
    206220      if (stars[N].found == -2) { /* this image star matches a catalog star on a neighboring catalog */
    207         catalog[0].measure[Nmeas].flags |= BLEND_IMAGE_NEIGHBOR;
     221        catalog[0].measure[Nmeas].dbFlags |= BLEND_IMAGE_NEIGHBOR;
    208222      }
    209223      if (stars[N].found == -1) { /* this image star matches only this catalog star */
     
    212226      /* this catalog star matches more than one image star */
    213227      if (catalog[0].found[n] > -1) {
    214         catalog[0].measure[catalog[0].found[n]].flags |= BLEND_CATALOG;
    215         catalog[0].measure[Nmeas].flags |= BLEND_CATALOG;
     228        catalog[0].measure[catalog[0].found[n]].dbFlags |= BLEND_CATALOG;
     229        catalog[0].measure[Nmeas].dbFlags |= BLEND_CATALOG;
    216230      } else {
    217231        catalog[0].found[n] = Nmeas;
     
    273287    }
    274288
    275     /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
    276     /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
    277289    catalog[0].measure[Nmeas].Xccd     = stars[N].X;
    278290    catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
     
    287299    catalog[0].measure[Nmeas].photcode  = stars[N].code;  /* photcode */
    288300    catalog[0].measure[Nmeas].dophot    = stars[N].dophot; 
    289     catalog[0].measure[Nmeas].flags     = 0;
     301    catalog[0].measure[Nmeas].dbFlags   = 0;
    290302    catalog[0].measure[Nmeas].dt        = stars[N].dt;
    291303    catalog[0].measure[Nmeas].airmass   = stars[N].airmass;
     304
     305    catalog[0].measure[Nmeas].photFlags = stars[N].flags;
     306    catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
     307    catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     308    catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
     309    catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     310    catalog[0].measure[Nmeas].Sky       = stars[N].sky;
     311    catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
     312
     313    catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
     314
     315    catalog[0].measure[Nmeas].detID     = stars[N].detID;
     316    catalog[0].measure[Nmeas].imageID   = options.imageID;
     317
     318    catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
     319    catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    292320
    293321    catalog[0].measure[Nmeas].Mgal      = stars[N].Mgal;
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r14291 r15038  
    193193    catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
    194194    catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    195     catalog[0].measure[Nmeas].flags    = 0;
     195    catalog[0].measure[Nmeas].dbFlags  = 0;
    196196    catalog[0].measure[Nmeas].dt       = stars[N].dt;
    197197    catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
     198
     199    catalog[0].measure[Nmeas].photFlags = stars[N].flags;
     200    catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
     201    catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     202    catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
     203    catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     204    catalog[0].measure[Nmeas].Sky       = stars[N].sky;
     205    catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
     206
     207    catalog[0].measure[Nmeas].stargal   = 0;
     208
     209    catalog[0].measure[Nmeas].detID     = stars[N].detID;
     210    catalog[0].measure[Nmeas].imageID   = options.imageID;
     211
     212    catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
     213    catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    198214
    199215    catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
     
    270286    }
    271287
    272     /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
    273     /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
    274288    catalog[0].measure[Nmeas].Xccd     = stars[N].X;
    275289    catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
     
    284298    catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
    285299    catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    286     catalog[0].measure[Nmeas].flags    = 0;
     300    catalog[0].measure[Nmeas].dbFlags  = 0;
    287301    catalog[0].measure[Nmeas].dt       = stars[N].dt;
    288302    catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
     303
     304    catalog[0].measure[Nmeas].photFlags = stars[N].flags;
     305    catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
     306    catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     307    catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
     308    catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     309    catalog[0].measure[Nmeas].Sky       = stars[N].sky;
     310    catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
     311
     312    catalog[0].measure[Nmeas].stargal   = 0;
     313
     314    catalog[0].measure[Nmeas].detID     = stars[N].detID;
     315    catalog[0].measure[Nmeas].imageID   = options.imageID;
     316
     317    catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
     318    catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    289319
    290320    catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r12332 r15038  
    140140      catalog[0].measure[Nmeas].photcode = stars[N][0].code;
    141141      catalog[0].measure[Nmeas].dophot   = 0;
    142       catalog[0].measure[Nmeas].flags    = 0;
     142      catalog[0].measure[Nmeas].dbFlags  = 0;
    143143      catalog[0].measure[Nmeas].dt       = 0xffff;
    144144
     
    149149      catalog[0].measure[Nmeas].theta    = NO_MAG;
    150150       
    151       /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
    152       /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
     151      catalog[0].measure[Nmeas].photFlags = 0;
     152      catalog[0].measure[Nmeas].qPSF      = 0;
     153      catalog[0].measure[Nmeas].psfProb   = 0;
     154      catalog[0].measure[Nmeas].crNsigma  = 0;
     155      catalog[0].measure[Nmeas].extNsigma = 0;
     156      catalog[0].measure[Nmeas].Sky       = 0;
     157      catalog[0].measure[Nmeas].dSky      = 0;
     158
     159      catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
     160
     161      catalog[0].measure[Nmeas].detID     = 0;
     162      catalog[0].measure[Nmeas].imageID   = 0;
     163
     164      catalog[0].measure[Nmeas].dXccd     = 0;
     165      catalog[0].measure[Nmeas].dYccd     = 0;
     166
    153167      catalog[0].measure[Nmeas].Xccd     = 0.0;
    154168      catalog[0].measure[Nmeas].Yccd     = 0.0;
     
    168182      /* this image star matches more than one catalog star */
    169183      if (stars[N][0].found > -1) {
    170         catalog[0].measure[stars[N][0].found].flags |= BLEND_IMAGE;
    171         catalog[0].measure[Nmeas].flags |= BLEND_IMAGE;
     184        catalog[0].measure[stars[N][0].found].dbFlags |= BLEND_IMAGE;
     185        catalog[0].measure[Nmeas].dbFlags |= BLEND_IMAGE;
    172186      }
    173187      if (stars[N][0].found == -2) { /* this image star matches a catalog star on a neighboring catalog */
    174         catalog[0].measure[Nmeas].flags |= BLEND_IMAGE_NEIGHBOR;
     188        catalog[0].measure[Nmeas].dbFlags |= BLEND_IMAGE_NEIGHBOR;
    175189      }
    176190      if (stars[N][0].found == -1) { /* this image star matches only this catalog star */
     
    179193      /* this catalog star matches more than one image star */
    180194      if (catalog[0].found[n] > -1) {
    181         catalog[0].measure[catalog[0].found[n]].flags |= BLEND_CATALOG;
    182         catalog[0].measure[Nmeas].flags |= BLEND_CATALOG;
     195        catalog[0].measure[catalog[0].found[n]].dbFlags |= BLEND_CATALOG;
     196        catalog[0].measure[Nmeas].dbFlags |= BLEND_CATALOG;
    183197      } else {
    184198        catalog[0].found[n] = Nmeas;
     
    254268    catalog[0].measure[Nmeas].photcode = stars[N][0].code;
    255269    catalog[0].measure[Nmeas].dophot   = 0;
    256     catalog[0].measure[Nmeas].flags    = 0;
     270    catalog[0].measure[Nmeas].dbFlags  = 0;
    257271    catalog[0].measure[Nmeas].dt       = 0xffff;
     272
     273    catalog[0].measure[Nmeas].photFlags = 0;
     274    catalog[0].measure[Nmeas].qPSF      = 0;
     275    catalog[0].measure[Nmeas].psfProb   = 0;
     276    catalog[0].measure[Nmeas].crNsigma  = 0;
     277    catalog[0].measure[Nmeas].extNsigma = 0;
     278    catalog[0].measure[Nmeas].Sky       = 0;
     279    catalog[0].measure[Nmeas].dSky      = 0;
     280
     281    catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
     282
     283    catalog[0].measure[Nmeas].detID     = 0;
     284    catalog[0].measure[Nmeas].imageID   = 0;
     285
     286    catalog[0].measure[Nmeas].dXccd     = 0;
     287    catalog[0].measure[Nmeas].dYccd     = 0;
     288
     289    catalog[0].measure[Nmeas].Xccd     = 0.0;
     290    catalog[0].measure[Nmeas].Yccd     = 0.0;
    258291
    259292    catalog[0].measure[Nmeas].airmass  = 0;
     
    263296    catalog[0].measure[Nmeas].theta    = NO_MAG;
    264297
    265     /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
    266     /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
    267298    catalog[0].measure[Nmeas].Xccd     = 0.0;
    268299    catalog[0].measure[Nmeas].Yccd     = 0.0;
  • trunk/Ohana/src/addstar/src/load2mass_catalog.c

    r12332 r15038  
    5252      catalog[0].measure[Nmeas].dM       = MIN (stars[i+j].dM,  NO_ERR);
    5353      catalog[0].measure[Nmeas].Mcal     = 0;
    54       catalog[0].measure[Nmeas].t           = stars[i+j].t;
    55       catalog[0].measure[Nmeas].averef      = Nave;
    56       catalog[0].measure[Nmeas].photcode      = stars[i+j].code;
    57       catalog[0].measure[Nmeas].dophot      = 0;
    58       catalog[0].measure[Nmeas].flags       = 0;
     54      catalog[0].measure[Nmeas].t        = stars[i+j].t;
     55      catalog[0].measure[Nmeas].averef   = Nave;
     56      catalog[0].measure[Nmeas].photcode = stars[i+j].code;
     57      catalog[0].measure[Nmeas].dophot   = 0;
     58      catalog[0].measure[Nmeas].dbFlags  = 0;
    5959      catalog[0].measure[Nmeas].dt       = 0xffff;
    6060
  • trunk/Ohana/src/libautocode/def/AddstarClientOptions.d

    r5345 r15038  
    22EXTNAME OPTIONS
    33TYPE    BINTABLE
    4 SIZE    72
     4SIZE    76
    55
    66FIELD     Nsigma,           NSIGMA,               double,         match radius in terms of astrometric error
     
    2020FIELD     photcode,         PHOTCODE,             int,            photocode of input data
    2121FIELD     timeref,          TIMEREF,              e_time,         time/date of input data (REFLIST only?)
     22FIELD     imageID,          IMAGE_ID,             unsigned int,   reference to image
  • trunk/Ohana/src/libautocode/def/Stars.d

    r15034 r15038  
    22EXTNAME STARS
    33TYPE    BINTABLE
    4 SIZE    240
     4SIZE    244
    55
    66FIELD     X,                X,          double,    x coordinate on image,            pixels
     
    3838FIELD     Mcal,             MCAL,       float,     image cal mag,                    mag
    3939FIELD     airmass,          AIRMASS,    float,     (airmass - 1),                    airmass
     40FIELD     az,               AZ,         float,     azimuth
    4041FIELD     code,             CODE,       short
    4142FIELD     nFrames,          N_FRAMES,   short
     43FIELD     flags,            FLAGS,      short
    4244FIELD     dophot,           DOPHOT,     char,      dophot type code
    43 FIELD     dummy,            DUMMY,      char[3]
     45FIELD     dummy,            DUMMY,      char
    4446
    4547# XXX I'm going to need azimuth (or load from image header?)
  • trunk/Ohana/src/libautocode/def/autocode.c

    r7080 r15038  
    3636  if ((swapped == NULL) || (*swapped == FALSE)) {
    3737    gfits_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata);
     38    gfits_table_scale_data (ftable);
    3839    if (swapped != NULL) *swapped = TRUE;
    3940  }
     
    5758
    5859  /* add data values */
     60  gfits_table_scale_data (ftable);
    5961  gfits_convert_$STRUCT (data, sizeof ($STRUCT), Ndata);
    6062  gfits_add_rows (ftable, (char *) data, Ndata, sizeof ($STRUCT));
  • trunk/Ohana/src/libautocode/def/image-ps1-dev-1.d

    r15034 r15038  
    4848FIELD     code,             CODE,                 char,           image quality flag
    4949FIELD     ccdnum,           CCDNUM,               unsigned char,  CCD ID number
    50 FIELD     imageID_hi,       IMAGE_ID_HI,          unsigned int,   ID upper bytes
    51 FIELD     imageID_lo,       IMAGE_ID_LO,          unsigned int,   ID lower bytes
    52 # 48 bytes
     50FIELD     imageID,          IMAGE_ID,             unsigned int,   image ID
     51# 44 bytes
    5352
    54 FIELD     dummy,            DUMMY,                char[10],       unused
     53FIELD     dummy,            DUMMY,                char[14],       unused
    5554FIELD     order,            ORDER,                short,          Mrel 2D polynomical order
    5655FIELD     Mx,               MX,                   short,          Mrel polyterm
  • trunk/Ohana/src/libautocode/def/image.d

    r13884 r15038  
    4848FIELD     code,             CODE,                 char,           image quality flag
    4949FIELD     ccdnum,           CCDNUM,               unsigned char,  CCD ID number
    50 FIELD     imageID_hi,       IMAGE_ID_HI,          unsigned int,   ID upper bytes
    51 FIELD     imageID_lo,       IMAGE_ID_LO,          unsigned int,   ID lower bytes
     50FIELD     imageID,          IMAGE_ID,             unsigned int,   image ID
    5251# 48 bytes
    5352
    54 FIELD     dummy,            DUMMY,                char[10],       unused
     53FIELD     dummy,            DUMMY,                char[14],       unused
    5554FIELD     order,            ORDER,                short,          Mrel 2D polynomical order
    5655FIELD     Mx,               MX,                   short,          Mrel polyterm
  • trunk/Ohana/src/libautocode/def/measure-ps1-dev-1.d

    r15034 r15038  
    22EXTNAME      DVO_MEASURE_PS1_DEV_1
    33TYPE         BINTABLE
    4 SIZE         96
     4SIZE         104
    55DESCRIPTION  DVO Detection Measurement Table
    66
     
    88FIELD dD,             D_DEC,        float,          DEC offset,                   arcsec
    99FIELD M,              MAG,          float,          catalog mag,                  mag
    10 FIELD Mcal,           Mcal,         float,          image cal mag,                mag
    11 FIELD Mgal,           Mgal,         float,          galaxy mag,                   mag
    12 FIELD dM,             dM,           float,          mag error,                    mag
    13 FIELD dt,             dt,           float,          exposure time,                2.5*log(exptime)
     10FIELD Mcal,           M_CAL,        float,          image cal mag,                mag
     11FIELD Mgal,           M_GAL,        float,          galaxy mag,                   mag
     12FIELD dM,             MAG_ERR,      float,          mag error,                    mag
     13FIELD dt,             M_TIME,       float,          exposure time,                2.5*log(exptime)
    1414
    1515# note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
    16 FIELD airmass,        airmass,      float,          (airmass - 1),                airmass
     16FIELD airmass,        AIRMASS,      float,          (airmass - 1),                airmass
    1717FIELD az,             AZ,           float,          telescope azimuth
    1818
     
    2525FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
    2626
    27 FIELD t,              t,            unsigned int,   time in seconds (UNIX)
    28 FIELD averef,         averef,       unsigned int,   reference to average entry     
     27FIELD t,              TIME,         unsigned int,   time in seconds (UNIX)
     28FIELD averef,         AVE_REF,      unsigned int,   reference to average entry     
    2929
    3030# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    31 FIELD detID_hi,       DET_ID_HI,    unsigned int,   ID upper bytes
    32 FIELD detID_lo,       DET_ID_LO,    unsigned int,   ID lower bytes
     31FIELD detID,          DET_ID,       unsigned int,   ID upper bytes
     32FIELD imageID,        IMAGE_ID,     unsigned int,   reference to image
    3333
    34 FIELD imageID_hi,     IMAGE_ID_HI,  unsigned int,   reference to image
    35 FIELD imageID_lo,     IMAGE_ID_LO,  unsigned int,   reference to image
     34# do we need more resolution than a short? should this be a log?
     35FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
     36FIELD psfProb,        PSF_PROB,     float,          psf coverage/quality factor
     37FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
     38FIELD extNsigma,      EXT_NSIGMA,   float,          psf coverage/quality factor
    3639
    37 FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec
    38 FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec
    39 FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
    40 FIELD photcode,       photcode,     unsigned short, photcode
    41 
    42 FIELD flags,          flags,        unsigned short, flags for various uses 
     40FIELD FWx,            FWHM_MAJOR,   short,          object fwhm major axis,       1/100 of arcsec
     41FIELD FWy,            FWHM_MINOR,   short,          object fwhm minor axis,       1/100 of arcsec
     42FIELD theta,          PSF_THETA,    short,          angle wrt ccd X dir,          (0xffff/360) deg
     43FIELD photcode,       PHOTCODE,     unsigned short, photcode
    4344
    4445FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
    4546FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
    4647
    47 # do we need more resolution than a short? should this be a log?
    48 FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
     48FIELD dbFlags,        DB_FLAGS,     unsigned short, flags for various uses 
     49FIELD photFlags,      PHOT_FLAGS,   unsigned short, flags supplied by photometry program
    4950
    50 FIELD dophot,         dophot,       char,           dophot type
    51 FIELD stargal,        stargal,      char,           star-galaxy separator
     51FIELD stargal,        STAR_GAL,     char,           star-galaxy separator
    5252
    53 # we need extra bytes for padding purposes...
    54 FIELD dummy,          dummy,        char[2],        padding
     53# absorb these into photFlags?
     54FIELD dophot,         DOPHOT,       char,           dophot type
    5555
    56 # float : 13 x 4 = 52
     56FIELD dummy,          DUMMY,        char[2],        padding
     57
     58# float : 17 x 4 = 68
    5759# int:     6 x 4 = 24
    5860# short:   8 x 2 = 16
  • trunk/Ohana/src/libautocode/def/measure.d

    r12332 r15038  
    22EXTNAME      DVO_MEASURE
    33TYPE         BINTABLE
    4 SIZE         96
     4SIZE         104
    55DESCRIPTION  DVO Detection Measurement Table
    66
     
    1111FIELD Mgal,           Mgal,         float,          galaxy mag,                   mag
    1212FIELD dM,             dM,           float,          mag error,                    mag
    13 FIELD airmass,        airmass,      float,          (airmass - 1),                airmass
    1413FIELD dt,             dt,           float,          exposure time,                2.5*log(exptime)
    1514
    16 FIELD t,              t,            unsigned int,   time in seconds (UNIX)
    17 FIELD averef,         averef,       unsigned int,   reference to average entry     
    18 
    19 FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec
    20 FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec
    21 FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
    22 FIELD photcode,       photcode,     unsigned short, photcode
    23 
    24 FIELD flags,          flags,        unsigned short, flags for various uses 
    25 FIELD dophot,         dophot,       char,           dophot type
    26 FIELD stargal,        stargal,      char,           star-galaxy separator
     15# note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
     16FIELD airmass,        airmass,      float,          (airmass - 1),                airmass
     17FIELD az,             AZ,           float,          telescope azimuth
    2718
    2819# new field elements needed for Pan-STARRS:
     
    3425FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
    3526
     27FIELD t,              t,            unsigned int,   time in seconds (UNIX)
     28FIELD averef,         averef,       unsigned int,   reference to average entry     
     29
     30# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
     31FIELD detID,          DET_ID,       unsigned int,   detection ID
     32FIELD imageID,        IMAGE_ID,     unsigned int,   reference to image
     33
     34# do we need more resolution than a short? should this be a log?
     35FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
     36FIELD psfProb,        PSF_PROB,     float,          psf coverage/quality factor
     37FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
     38FIELD extNsigma,      EXT_NSIGMA,   float,          psf coverage/quality factor
     39
     40FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec
     41FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec
     42FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
     43FIELD photcode,       photcode,     unsigned short, photcode
     44
    3645FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
    3746FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
    3847
    39 # do we need more resolution than a short? should this be a log?
    40 FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
     48FIELD dbFlags,        DB_FLAGS,     unsigned short, flags for various uses 
     49FIELD photFlags,      PHOT_FLAGS,   unsigned short, flags supplied by photometry program
    4150
    42 # Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    43 FIELD detID_hi,       DET_ID_HI,    unsigned int,   ID upper bytes
    44 FIELD detID_lo,       DET_ID_LO,    unsigned int,   ID lower bytes
     51FIELD stargal,        stargal,      char,           star-galaxy separator
    4552
    46 FIELD imageID_hi,     IMAGE_ID_HI,  unsigned int,   reference to image
    47 FIELD imageID_lo,     IMAGE_ID_LO,  unsigned int,   reference to image
     53# absorb these into photFlags?
     54FIELD dophot,         dophot,       char,           dophot type
    4855
    49 # note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
    50 FIELD az,             AZ,           float,          telescope azimuth
    51 
    52 # we need extra bytes for padding purposes...
    53 FIELD dummy,          dummy,        char[2],        padding
     56FIELD dummy,          DUMMY,        char[2],        padding
  • trunk/Ohana/src/libautocode/def/ps1_dev_1.d

    r15034 r15038  
    2424FIELD psfQual,   PSF_QF,           float,    quality factor
    2525FIELD nFrames,   N_FRAMES,         short,    images overlapping peak
    26 FIELD dummy,     DUMMY,            short,    padding
     26FIELD flags,     FLAGS,            short,    padding
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r15035 r15038  
    1515    out[i].dD         = in[i].dD;
    1616    out[i].M          = in[i].M;
    17     out[i].dM         = in[i].dM;
    1817    out[i].Mcal       = in[i].Mcal;
    1918    out[i].Mgal       = in[i].Mgal;
     19    out[i].dM         = in[i].dM;
     20    out[i].dt         = in[i].dt;
    2021    out[i].airmass    = in[i].airmass;
    2122    out[i].az         = in[i].az;
    22     out[i].dt         = in[i].dt;
     23    out[i].Xccd       = in[i].Xccd;
     24    out[i].Yccd       = in[i].Yccd;
     25    out[i].Sky        = in[i].Sky;
     26    out[i].dSky       = in[i].dSky;
     27    out[i].t          = in[i].t;
     28    out[i].averef     = in[i].averef;
     29    out[i].detID      = in[i].detID;
     30    out[i].imageID    = in[i].imageID;
     31    out[i].qPSF       = in[i].qPSF;
     32    out[i].psfProb    = in[i].psfProb;
     33    out[i].crNsigma   = in[i].crNsigma;
     34    out[i].extNsigma  = in[i].extNsigma;
    2335    out[i].FWx        = in[i].FWx;
    2436    out[i].FWy        = in[i].FWy;
    2537    out[i].theta      = in[i].theta;
    26     out[i].dophot     = in[i].dophot;
    2738    out[i].photcode   = in[i].photcode;
    28     out[i].t          = in[i].t;
    29     out[i].averef     = in[i].averef;
    30     out[i].flags      = in[i].flags;
    31     out[i].Xccd       = in[i].Xccd;
    32     out[i].Yccd       = in[i].Yccd;
    3339    out[i].dXccd      = in[i].dXccd;
    3440    out[i].dYccd      = in[i].dYccd;
     41    out[i].dbFlags    = in[i].dbFlags;
     42    out[i].photFlags  = in[i].photFlags;
    3543    out[i].stargal    = in[i].stargal;
    36     out[i].Sky        = in[i].Sky;
    37     out[i].dSky       = in[i].dSky;
    38     out[i].qPSF       = in[i].qPSF;
    39     out[i].detID_hi   = in[i].detID_hi;
    40     out[i].detID_lo   = in[i].detID_lo;
    41     out[i].imageID_hi = in[i].imageID_hi;
    42     out[i].imageID_lo = in[i].imageID_lo;
     44    out[i].dophot     = in[i].dophot;
    4345  }
    4446  return (out);
     
    5759    out[i].dD         = in[i].dD;
    5860    out[i].M          = in[i].M;
    59     out[i].dM         = in[i].dM;
    6061    out[i].Mcal       = in[i].Mcal;
    6162    out[i].Mgal       = in[i].Mgal;
     63    out[i].dM         = in[i].dM;
     64    out[i].dt         = in[i].dt;
    6265    out[i].airmass    = in[i].airmass;
    6366    out[i].az         = in[i].az;
    64     out[i].dt         = in[i].dt;
     67    out[i].Xccd       = in[i].Xccd;
     68    out[i].Yccd       = in[i].Yccd;
     69    out[i].Sky        = in[i].Sky;
     70    out[i].dSky       = in[i].dSky;
     71    out[i].t          = in[i].t;
     72    out[i].averef     = in[i].averef;
     73    out[i].detID      = in[i].detID;
     74    out[i].imageID    = in[i].imageID;
     75    out[i].qPSF       = in[i].qPSF;
     76    out[i].psfProb    = in[i].psfProb;
     77    out[i].crNsigma   = in[i].crNsigma;
     78    out[i].extNsigma  = in[i].extNsigma;
    6579    out[i].FWx        = in[i].FWx;
    6680    out[i].FWy        = in[i].FWy;
    6781    out[i].theta      = in[i].theta;
    68     out[i].dophot     = in[i].dophot;
    6982    out[i].photcode   = in[i].photcode;
    70     out[i].t          = in[i].t;
    71     out[i].averef     = in[i].averef;
    72     out[i].flags      = in[i].flags;
    73     out[i].Xccd       = in[i].Xccd;
    74     out[i].Yccd       = in[i].Yccd;
    7583    out[i].dXccd      = in[i].dXccd;
    7684    out[i].dYccd      = in[i].dYccd;
     85    out[i].dbFlags    = in[i].dbFlags;
     86    out[i].photFlags  = in[i].photFlags;
    7787    out[i].stargal    = in[i].stargal;
    78     out[i].Sky        = in[i].Sky;
    79     out[i].dSky       = in[i].dSky;
    80     out[i].qPSF       = in[i].qPSF;
    81     out[i].detID_hi   = in[i].detID_hi;
    82     out[i].detID_lo   = in[i].detID_lo;
    83     out[i].imageID_hi = in[i].imageID_hi;
    84     out[i].imageID_lo = in[i].imageID_lo;
     88    out[i].dophot     = in[i].dophot;
    8589  }
    8690  return (out);
     
    221225    out[i].code             = in[i].code;
    222226    out[i].ccdnum           = in[i].ccdnum;
    223     out[i].imageID_hi       = in[i].imageID_hi;
    224     out[i].imageID_lo       = in[i].imageID_lo;
     227    out[i].imageID          = in[i].imageID;
    225228
    226229    out[i].order            = in[i].order;
     
    277280    out[i].code             = in[i].code;
    278281    out[i].ccdnum           = in[i].ccdnum;
    279     out[i].imageID_hi       = in[i].imageID_hi;
    280     out[i].imageID_lo       = in[i].imageID_lo;
     282    out[i].imageID          = in[i].imageID;
    281283
    282284    out[i].order            = in[i].order;
  • trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r15035 r15038  
    2525    out[i].t        = in[i].t;
    2626    out[i].averef   = in[i].averef;
    27     out[i].flags    = in[i].flags;
     27    out[i].dbFlags  = in[i].flags;
    2828   
    2929    /* these can be determined if needed / desired */
     
    3434
    3535    /* these do not have a corresponding value */
    36     out[i].stargal  = 0;
    37     out[i].Sky      = 0;
    38     out[i].dSky     = 0;
    39     out[i].qPSF     = 0;
     36    out[i].az        = 0;
     37    out[i].stargal   = 0;
     38    out[i].Sky       = 0;
     39    out[i].dSky      = 0;
     40    out[i].qPSF      = 0;
     41    out[i].psfProb   = 0;
     42    out[i].crNsigma  = 0;
     43    out[i].extNsigma = 0;
     44    out[i].photFlags = 0;
    4045
    4146    /* XXX add these later */
    42     out[i].detID_hi = 0;
    43     out[i].detID_lo = 0;
    44     out[i].imageID_hi = 0;
    45     out[i].imageID_lo = 0;
     47    out[i].detID = 0;
     48    out[i].imageID = 0;
    4649  }
    4750  return (out);
     
    7275    out[i].t       = in[i].t;
    7376    out[i].averef  = in[i].averef;
    74     out[i].flags   = in[i].flags;
     77    out[i].flags   = in[i].dbFlags;
    7578  }
    7679  return (out);
     
    232235
    233236    /* XXX add these later */
    234     out[i].imageID_hi = 0;
    235     out[i].imageID_lo = 0;
     237    out[i].imageID = 0;
    236238  }
    237239  return (out);
  • trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r15035 r15038  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
    12     out[i].dR   = in[i].dR * 0.01;
    13     out[i].dD   = in[i].dD * 0.01;
    14     out[i].M    = in[i].M  * 0.001;
    15     out[i].dM   = in[i].dM * 0.001;
    16     out[i].Mcal = in[i].Mcal * 0.001;
    17     out[i].dophot  = in[i].dophot;
     12    out[i].dR        = in[i].dR * 0.01;
     13    out[i].dD        = in[i].dD * 0.01;
     14    out[i].M         = in[i].M  * 0.001;
     15    out[i].dM        = in[i].dM * 0.001;
     16    out[i].Mcal      = in[i].Mcal * 0.001;
     17    out[i].dophot    = in[i].dophot;
    1818    out[i].photcode  = in[i].source;
    19     out[i].t       = in[i].t;
     19    out[i].t         = in[i].t;
    2020
    2121    /* flags and averef are now split */
    22     out[i].averef  =  in[i].averef & 0x00ffffff;
    23     out[i].flags   = (in[i].averef & 0xff000000) >> 24;
     22    out[i].averef    =  in[i].averef & 0x00ffffff;
     23    out[i].dbFlags   = (in[i].averef & 0xff000000) >> 24;
    2424
    2525    /* these values don't exist in the Loneos format */
    26     out[i].Mgal    = in[i].M;
    27     out[i].dt      = 0;
    28     out[i].airmass = 0;
    29     out[i].FWx        = 0;
    30     out[i].FWy        = 0;
    31     out[i].theta      = 0;
     26    out[i].Mgal     = in[i].M;
     27    out[i].dt       = 0;
     28    out[i].airmass  = 0;
     29    out[i].az       = 0;
     30    out[i].FWx      = 0;
     31    out[i].FWy      = 0;
     32    out[i].theta    = 0;
    3233    out[i].stargal  = 0;
    3334    out[i].Sky      = 0;
    3435    out[i].dSky     = 0;
    3536    out[i].qPSF     = 0;
     37    out[i].psfProb   = 0;
     38    out[i].crNsigma  = 0;
     39    out[i].extNsigma = 0;
     40    out[i].photFlags = 0;
    3641
    3742    /* these can be determined if needed / desired */
     
    4247
    4348    /* XXX add these later */
    44     out[i].detID_hi = 0;
    45     out[i].detID_lo = 0;
    46     out[i].imageID_hi = 0;
    47     out[i].imageID_lo = 0;
     49    out[i].detID = 0;
     50    out[i].imageID = 0;
    4851  }
    4952  return (out);
     
    6972
    7073    /* flags and averef are merged in Loneos */
    71     out[i].averef =  (in[i].averef & 0x00ffffff) | (in[i].flags << 24);
     74    out[i].averef =  (in[i].averef & 0x00ffffff) | (in[i].dbFlags << 24);
    7275  }
    7376  return (out);
     
    226229
    227230    /* XXX add these later */
    228     out[i].imageID_hi = 0;
    229     out[i].imageID_lo = 0;
     231    out[i].imageID = 0;
    230232  }
    231233  return (out);
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r15035 r15038  
    2626    out[i].t          = in[i].t;
    2727    out[i].averef     = in[i].averef;
    28     out[i].flags      = in[i].flags;
     28    out[i].dbFlags    = in[i].flags;
    2929    out[i].Xccd       = in[i].Xccd;
    3030    out[i].Yccd       = in[i].Yccd;
     
    3535    out[i].dSky       = in[i].dSky;
    3636    out[i].qPSF       = in[i].qPSF;
    37     out[i].detID_hi   = in[i].detID_hi;
    38     out[i].detID_lo   = in[i].detID_lo;
    39     out[i].imageID_hi = in[i].imageID_hi;
    40     out[i].imageID_lo = in[i].imageID_lo;
     37    out[i].detID      = in[i].detID_lo;
     38    out[i].imageID    = in[i].imageID_lo;
     39
     40    // these don't have a correspondence
     41    out[i].psfProb   = 0;
     42    out[i].crNsigma  = 0;
     43    out[i].extNsigma = 0;
     44    out[i].photFlags = 0;
    4145  }
    4246  return (out);
     
    6872    out[i].t          = in[i].t;
    6973    out[i].averef     = in[i].averef;
    70     out[i].flags      = in[i].flags;
     74    out[i].flags      = in[i].dbFlags;
    7175    out[i].Xccd       = in[i].Xccd;
    7276    out[i].Yccd       = in[i].Yccd;
     
    7781    out[i].dSky       = in[i].dSky;
    7882    out[i].qPSF       = in[i].qPSF;
    79     out[i].detID_hi   = in[i].detID_hi;
    80     out[i].detID_lo   = in[i].detID_lo;
    81     out[i].imageID_hi = in[i].imageID_hi;
    82     out[i].imageID_lo = in[i].imageID_lo;
     83    out[i].detID_hi   = 0;
     84    out[i].detID_lo   = in[i].detID;
     85    out[i].imageID_hi = 0;
     86    out[i].imageID_lo = in[i].imageID;
    8387  }
    8488  return (out);
     
    219223    out[i].code             = in[i].code;
    220224    out[i].ccdnum           = in[i].ccdnum;
    221     out[i].imageID_hi       = in[i].imageID_hi;
    222     out[i].imageID_lo       = in[i].imageID_lo;
     225    out[i].imageID          = in[i].imageID_lo;
    223226
    224227    out[i].order            = in[i].order;
     
    275278    out[i].code             = in[i].code;
    276279    out[i].ccdnum           = in[i].ccdnum;
    277     out[i].imageID_hi       = in[i].imageID_hi;
    278     out[i].imageID_lo       = in[i].imageID_lo;
     280    out[i].imageID_hi       = 0;
     281    out[i].imageID_lo       = in[i].imageID;
    279282
    280283    out[i].order            = in[i].order;
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r15035 r15038  
    2626    out[i].t          = in[i].t;
    2727    out[i].averef     = in[i].averef;
    28     out[i].flags      = in[i].flags;
     28    out[i].dbFlags    = in[i].flags;
    2929    out[i].Xccd       = in[i].Xccd;
    3030    out[i].Yccd       = in[i].Yccd;
     
    3535    out[i].dSky       = in[i].dSky;
    3636    out[i].qPSF       = in[i].qPSF;
    37     out[i].detID_hi   = in[i].detID_hi;
    38     out[i].detID_lo   = in[i].detID_lo;
    39     out[i].imageID_hi = in[i].imageID_hi;
    40     out[i].imageID_lo = in[i].imageID_lo;
     37    out[i].detID      = in[i].detID_lo;
     38    out[i].imageID    = in[i].imageID_lo;
     39
     40    // these don't have a correspondence
     41    out[i].psfProb   = 0;
     42    out[i].crNsigma  = 0;
     43    out[i].extNsigma = 0;
     44    out[i].photFlags = 0;
    4145  }
    4246  return (out);
     
    6872    out[i].t          = in[i].t;
    6973    out[i].averef     = in[i].averef;
    70     out[i].flags      = in[i].flags;
     74    out[i].flags      = in[i].dbFlags;
    7175    out[i].Xccd       = in[i].Xccd;
    7276    out[i].Yccd       = in[i].Yccd;
     
    7781    out[i].dSky       = in[i].dSky;
    7882    out[i].qPSF       = in[i].qPSF;
    79     out[i].detID_hi   = in[i].detID_hi;
    80     out[i].detID_lo   = in[i].detID_lo;
    81     out[i].imageID_hi = in[i].imageID_hi;
    82     out[i].imageID_lo = in[i].imageID_lo;
     83    out[i].detID_hi   = 0;
     84    out[i].detID_lo   = in[i].detID;
     85    out[i].imageID_hi = 0;
     86    out[i].imageID_lo = in[i].imageID;
    8387  }
    8488  return (out);
     
    219223    out[i].code             = in[i].code;
    220224    out[i].ccdnum           = in[i].ccdnum;
    221     out[i].imageID_hi       = in[i].imageID_hi;
    222     out[i].imageID_lo       = in[i].imageID_lo;
     225    out[i].imageID          = in[i].imageID_lo;
    223226
    224227    out[i].order            = in[i].order;
     
    275278    out[i].code             = in[i].code;
    276279    out[i].ccdnum           = in[i].ccdnum;
    277     out[i].imageID_hi       = in[i].imageID_hi;
    278     out[i].imageID_lo       = in[i].imageID_lo;
     280    out[i].imageID_hi       = 0;
     281    out[i].imageID_lo       = in[i].imageID;
    279282
    280283    out[i].order            = in[i].order;
  • trunk/Ohana/src/libfits/include/gfitsio.h

    r15007 r15038  
    126126int   gfits_add_rows               PROTO ((FTable *, char *, int, int));
    127127char *gfits_table_print            PROTO ((FTable *,...));
     128int   gfits_table_scale_data       PROTO ((FTable *ftable));
     129int   gfits_table_scale_storage    PROTO ((FTable *ftable));
    128130
    129131/******************************* Matrix functions *************/
  • trunk/Ohana/src/libfits/table/F_table_format.c

    r7054 r15038  
    189189}
    190190
    191     /* vsnprintf (&line[off], Nchar + 1, format, argp); */
     191// apply table tzero, tscal in situ (from storage to data)
     192int gfits_table_scale_data (FTable *ftable) {
     193
     194  int i, j, n, Nx, Ny, Nfields;
     195  int off, Nchar, Nval, Nbytes, status;
     196  char *line, format[64], field[16], type[16];
     197  double tzero, tscale;
     198  char *tmpChar;
     199  short *tmpShort;
     200  int *tmpInt;
     201
     202  off = 0;
     203
     204  gfits_scan (ftable[0].header, "NAXIS1",  "%d", 1, &Nx);
     205  gfits_scan (ftable[0].header, "NAXIS2",  "%d", 1, &Ny);
     206  gfits_scan (ftable[0].header, "TFIELDS", "%d", 1, &Nfields);
     207
     208  for (i = 1; i <= Nfields; i++) {
     209    sprintf (field, "TFORM%d", i);
     210    gfits_scan (ftable[0].header, field, "%s", 1, format);       /* get field format */
     211    gfits_bintable_format (format, type, &Nval, &Nbytes); /* convert to c-style */
     212    Nchar = Nval * Nbytes;
     213
     214    sprintf (field, "TZERO%d", i);
     215    status = gfits_scan (ftable[0].header, field, "%lf", 1, &tzero);       /* get field format */
     216    if (!status) {
     217        off += Nchar;
     218        continue;
     219    }
     220
     221    sprintf (field, "TSCAL%d", i);
     222    status = gfits_scan (ftable[0].header, field, "%lf", 1, &tscale);       /* get field format */
     223    if (!status) {
     224        off += Nchar;
     225        continue;
     226    }
     227    if (tscale == 0.0) {
     228        off += Nchar;
     229        continue;
     230    }
     231
     232    if (!strcmp (type, "char"))   {
     233      for (j = 0; j < Ny; j++) {
     234        for (n = 0; n < Nval; n++) {
     235          tmpChar = (int *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     236          *tmpChar = *tmpChar * tscale + tzero;
     237        }
     238      }
     239    }
     240    if (!strcmp (type, "short"))   {
     241      for (j = 0; j < Ny; j++) {
     242        for (n = 0; n < Nval; n++) {
     243          tmpShort = (int *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     244          *tmpShort = *tmpShort * tscale + tzero;
     245        }
     246      }
     247    }
     248    if (!strcmp (type, "int"))   {
     249      for (j = 0; j < Ny; j++) {
     250        for (n = 0; n < Nval; n++) {
     251          tmpInt = (int *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     252          *tmpInt = *tmpInt * tscale + tzero;
     253        }
     254      }
     255    }
     256    off += Nchar;
     257  }
     258  return (TRUE);
     259}
     260
     261// apply table tzero, tscal in situ (from data to storage)
     262int gfits_table_scale_storage (FTable *ftable) {
     263
     264  int i, j, n, Nx, Ny, Nfields;
     265  int off, Nchar, Nval, Nbytes, status;
     266  char *line, format[64], field[16], type[16];
     267  double tzero, tscale;
     268  char *tmpChar;
     269  short *tmpShort;
     270  int *tmpInt;
     271
     272  off = 0;
     273
     274  gfits_scan (ftable[0].header, "NAXIS1",  "%d", 1, &Nx);
     275  gfits_scan (ftable[0].header, "NAXIS2",  "%d", 1, &Ny);
     276  gfits_scan (ftable[0].header, "TFIELDS", "%d", 1, &Nfields);
     277
     278  for (i = 1; i <= Nfields; i++) {
     279    sprintf (field, "TFORM%d", i);
     280    gfits_scan (ftable[0].header, field, "%s", 1, format);       /* get field format */
     281    gfits_bintable_format (format, type, &Nval, &Nbytes); /* convert to c-style */
     282    Nchar = Nval * Nbytes;
     283
     284    sprintf (field, "TZERO%d", i);
     285    status = gfits_scan (ftable[0].header, field, "%lf", 1, &tzero);       /* get field format */
     286    if (!status) {
     287        off += Nchar;
     288        continue;
     289    }
     290
     291    sprintf (field, "TSCAL%d", i);
     292    status = gfits_scan (ftable[0].header, field, "%lf", 1, &tscale);       /* get field format */
     293    if (!status) {
     294        off += Nchar;
     295        continue;
     296    }
     297    if (tscale == 0.0) {
     298        off += Nchar;
     299        continue;
     300    }
     301
     302    if (!strcmp (type, "char"))   {
     303      for (j = 0; j < Ny; j++) {
     304        for (n = 0; n < Nval; n++) {
     305          tmpChar = (int *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     306          *tmpChar = (*tmpChar - tzero) / tscale;
     307        }
     308      }
     309    }
     310    if (!strcmp (type, "short"))   {
     311      for (j = 0; j < Ny; j++) {
     312        for (n = 0; n < Nval; n++) {
     313          tmpShort = (int *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     314          *tmpShort = (*tmpShort - tzero) / tscale;
     315        }
     316      }
     317    }
     318    if (!strcmp (type, "int"))   {
     319      for (j = 0; j < Ny; j++) {
     320        for (n = 0; n < Nval; n++) {
     321          tmpInt = (int *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     322          *tmpInt = (*tmpInt - tzero) / tscale;
     323        }
     324      }
     325    }
     326    off += Nchar;
     327  }
     328  return (TRUE);
     329}
  • trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c

    r14590 r15038  
    161161//      break;
    162162    case MEAS_FLAGS: /* ? */
    163       value = measure[0].flags;
     163      value = measure[0].dbFlags;
    164164      break;
    165165    case MEAS_XCCD: /* OK */
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r14590 r15038  
    172172                     Mcat, Mrel, catalog.measure[m].dM,
    173173                     date, catalog.measure[m].dR, catalog.measure[m].dD,
    174                      catalog.measure[m].dophot, catalog.measure[m].flags,
     174                     catalog.measure[m].dophot, catalog.measure[m].dbFlags,
    175175                     catalog.measure[m].photcode, GetPhotcodeNamebyCode (catalog.measure[m].photcode));
    176176            free (date);
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r14590 r15038  
    2424    if (TypeSelect && (TypeValue != GetMeasureTypeCode (&M))) continue; \
    2525    if (iMagSelect && (PhotInst (&M) < iMagMin)) continue; \
    26     if (FlagSelect && (M.flags != FlagValue)) continue; \
     26    if (FlagSelect && (M.dbFlags != FlagValue)) continue; \
    2727  }
    2828
     
    688688      for (i = 0; i < average[0].Nm; i++) {
    689689        if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode)) continue;
    690         if (measure[i].flags & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue;
     690        if (measure[i].dbFlags & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue;
    691691        value ++;
    692692      }
     
    698698        if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode))) continue;
    699699        if (ErrSelect && (measure[i].dM > ErrValue)) continue;
    700         if (FlagSelect && (measure[i].flags != FlagValue)) continue;
     700        if (FlagSelect && (measure[i].dbFlags != FlagValue)) continue;
    701701        if (TypeSelect && (TypeValue != GetMeasureTypeCode (&measure[i]))) continue;
    702702        if (iMagSelect && (PhotInst (&measure[i]) < iMagMin)) continue;
     
    874874    for (i = 0; i < average[0].Nm; i++) {
    875875      TESTCODE (code, measure[i]);
    876       if (measure[i].flags && ID_MEAS_SKIP) continue;
     876      if (measure[i].dbFlags && ID_MEAS_SKIP) continue;
    877877      Nm++;
    878878    }
     
    11691169      break;
    11701170    case MEAS_FLAGS: /* ? */
    1171       value = measure[0].flags;
     1171      value = measure[0].dbFlags;
    11721172      break;
    11731173    case MEAS_XCCD: /* OK */
  • trunk/Ohana/src/opihi/dvo/pmeasure.c

    r14590 r15038  
    114114      for (k = 0; k < catalog.average[i].Nm; k++) {
    115115        if (FlagClip) {
    116           flags = catalog.measure[m+k].flags;
     116          flags = catalog.measure[m+k].dbFlags;
    117117          if (!(flags & FlagChoice)) continue;
    118118        }
  • trunk/Ohana/src/relastro/src/UpdateImages.c

    r12332 r15038  
    3535      N = 0;
    3636      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    37         if (catalog[i].measure[m].flags & MEAS_BAD) continue;
     37        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    3838       
    3939        listR[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r14590 r15038  
    8585
    8686      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    87         if (catalog[i].measure[m].flags & MEAS_BAD) continue;
     87        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    8888       
    8989        R[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     
    178178      m = catalog[i].average[j].offset;
    179179      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    180         if (catalog[i].measure[m].flags & MEAS_BAD) continue;
     180        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    181181        setMeanR (fit.Ro, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
    182182        setMeanD (fit.Do, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
  • trunk/Ohana/src/relphot/src/GridOps.c

    r12332 r15038  
    270270      c = clist[i][j];
    271271     
    272       if (catalog[c].measure[m].flags & MEAS_BAD) continue;
     272      if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue;
    273273      Mcal = getMcal  (m, c);
    274274      if (Mcal == NO_MAG) continue;
     
    321321      c = clist[i][j];
    322322     
    323       if (catalog[c].measure[m].flags & MEAS_BAD) {
     323      if (catalog[c].measure[m].dbFlags & MEAS_BAD) {
    324324        Narea ++;
    325325        continue;
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r12332 r15038  
    195195      c = clist[i][j];
    196196     
    197       if (catalog[c].measure[m].flags & MEAS_BAD) continue;
     197      if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue;
    198198      Mmos  = getMmos  (m, c);
    199199      if (Mmos == NO_MAG) continue;
  • trunk/Ohana/src/relphot/src/MosaicOps.c

    r12332 r15038  
    348348      if (Mcal == NO_MAG) continue;
    349349      if (Mcal == NO_IMAGE) continue;
    350       if (catalog[c].measure[m].flags & MEAS_BAD) continue;
     350      if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue;
    351351      if ((Mgrid = getMgrid (m, c)) == NO_MAG) continue;
    352352      if ((Mrel  = getMrel  (catalog, m, c)) == NO_MAG) continue;
     
    593593      c = clist[i][j];
    594594     
    595       if (catalog[c].measure[m].flags & (ID_MEAS_AREA | ID_MEAS_NOCAL)) continue;
     595      if (catalog[c].measure[m].dbFlags & (ID_MEAS_AREA | ID_MEAS_NOCAL)) continue;
    596596
    597597      ave = catalog[c].measure[m].averef;
  • trunk/Ohana/src/relphot/src/StarOps.c

    r12332 r15038  
    5151      N = 0;
    5252      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    53         if (catalog[i].measure[m].flags & MEAS_BAD) continue;
     53        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    5454        Mcal  = getMcal  (m, i);
    5555        if (Mcal == NO_MAG) continue;
     
    110110      m = catalog[i].average[j].offset;
    111111      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    112         if (catalog[i].measure[m].flags & MEAS_BAD) continue;
     112        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    113113        Mcal  = getMcal  (m, i);
    114114        if (Mcal == NO_MAG) continue;
     
    158158      m = catalog[i].average[j].offset;
    159159      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    160         if (catalog[i].measure[m].flags & MEAS_BAD) continue;
     160        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    161161        Mcal  = getMcal  (m, i);
    162162        if (Mcal == NO_MAG) continue;
     
    272272      N = 0;
    273273      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    274         /* if (catalog[i].measure[m].flags & MEAS_BAD) continue; */
     274        /* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */
    275275        Mcal  = getMcal  (m, i);
    276276        if (Mcal == NO_MAG) continue;
     
    308308      N = 0;
    309309      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    310         /* if (catalog[i].measure[m].flags & MEAS_BAD) continue; */
     310        /* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */
    311311        Mcal  = getMcal  (m, i);
    312312        if (Mcal == NO_MAG) continue;
     
    329329      for (k = 0; k < N; k++) {
    330330        if (fabs (list[k] - stats.median) > Ns*stats.sigma) {
    331           catalog[i].measure[ilist[k]].flags |= ID_MEAS_POOR;
     331          catalog[i].measure[ilist[k]].dbFlags |= ID_MEAS_POOR;
    332332          Ndel ++;
    333333        }
  • trunk/Ohana/src/relphot/src/bcatalog.c

    r12332 r15038  
    6666      }
    6767
    68       subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_SKIP;
     68      subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_SKIP;
    6969      subcatalog[0].measure[Nmeasure]        = catalog[0].measure[offset];
    7070      subcatalog[0].measure[Nmeasure].averef = Naverage;
    7171      if (RESET) {
    7272        subcatalog[0].measure[Nmeasure].Mcal = 0;
    73         subcatalog[0].measure[Nmeasure].flags &= 0xff00;
    74         subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_POOR;
    75         subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_AREA;
    76         subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_NOCAL;
     73        subcatalog[0].measure[Nmeasure].dbFlags &= 0xff00;
     74        subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_POOR;
     75        subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_AREA;
     76        subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_NOCAL;
    7777      }
    7878      Nmeasure ++;
  • trunk/Ohana/src/relphot/src/plot_scatter.c

    r12332 r15038  
    2727
    2828      for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
    29         if (catalog[i].measure[m].flags & MEAS_BAD) continue;
     29        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    3030        Mcal  = getMcal  (m, i);
    3131        if (Mcal == NO_MAG) continue;
  • trunk/Ohana/src/relphot/src/setExclusions.c

    r12332 r15038  
    3838
    3939      markbad:
    40         catalog[i].measure[m].flags |= ID_MEAS_AREA;
     40        catalog[i].measure[m].dbFlags |= ID_MEAS_AREA;
    4141        Narea ++;
    4242        continue;
    4343       
    4444      mark_nocal:
    45         catalog[i].measure[m].flags |= ID_MEAS_NOCAL;
     45        catalog[i].measure[m].dbFlags |= ID_MEAS_NOCAL;
    4646        Nnocal ++;
    4747        continue;
  • trunk/Ohana/src/relphot/src/setMrelFinal.c

    r12332 r15038  
    2727       
    2828        catalog[0].measure[m].Mcal = 0;
    29         catalog[0].measure[m].flags &= 0xff00;
    30         catalog[0].measure[m].flags &= ~ID_MEAS_POOR;
    31         catalog[0].measure[m].flags &= ~ID_MEAS_SKIP;
    32         catalog[0].measure[m].flags &= ~ID_MEAS_AREA;
    33         catalog[0].measure[m].flags &= ~ID_MEAS_NOCAL;
     29        catalog[0].measure[m].dbFlags &= 0xff00;
     30        catalog[0].measure[m].dbFlags &= ~ID_MEAS_POOR;
     31        catalog[0].measure[m].dbFlags &= ~ID_MEAS_SKIP;
     32        catalog[0].measure[m].dbFlags &= ~ID_MEAS_AREA;
     33        catalog[0].measure[m].dbFlags &= ~ID_MEAS_NOCAL;
    3434      }
    3535    }
     
    5858    m = catalog[0].average[i].offset;
    5959    for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
    60       catalog[0].measure[m].flags &= ~ID_MEAS_NOCAL;
     60      catalog[0].measure[m].dbFlags &= ~ID_MEAS_NOCAL;
    6161    }
    6262  }
     
    8888
    8989      /* clear SKIP for all measures at first */
    90       catalog[0].measure[m].flags &= ~ID_MEAS_SKIP;
     90      catalog[0].measure[m].dbFlags &= ~ID_MEAS_SKIP;
    9191
    9292      /** never use these measurements (wrong photcode, bad time range) */
     
    129129
    130130    skip:
    131       catalog[0].measure[m].flags |= ID_MEAS_SKIP;
     131      catalog[0].measure[m].dbFlags |= ID_MEAS_SKIP;
    132132      Nskip ++;
    133133    }
Note: See TracChangeset for help on using the changeset viewer.