IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21418


Ignore:
Timestamp:
Feb 8, 2009, 12:36:43 PM (17 years ago)
Author:
eugene
Message:

upgrades to PS1 Initial Deployed version

Location:
branches/eam_branch_20090208/Ohana/src
Files:
9 added
24 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20090208/Ohana/src/libautocode/Makefile.Targets

    r21408 r21418  
    1 
    21AOBJS = \
    32$(ASRC)/coords.$(ARCH).o \
     
    98$(ASRC)/average-ps1-dev-1.$(ARCH).o \
    109$(ASRC)/average-ps1-dev-2.$(ARCH).o \
     10$(ASRC)/average-ps1-v1.$(ARCH).o \
    1111$(ASRC)/secfilt.$(ARCH).o \
    1212$(ASRC)/secfilt-loneos.$(ARCH).o \
     
    1616$(ASRC)/secfilt-ps1-dev-1.$(ARCH).o \
    1717$(ASRC)/secfilt-ps1-dev-2.$(ARCH).o \
     18$(ASRC)/secfilt-ps1-v1.$(ARCH).o \
    1819$(ASRC)/measure.$(ARCH).o \
    1920$(ASRC)/measure-loneos.$(ARCH).o \
     
    2324$(ASRC)/measure-ps1-dev-1.$(ARCH).o \
    2425$(ASRC)/measure-ps1-dev-2.$(ARCH).o \
     26$(ASRC)/measure-ps1-v1.$(ARCH).o \
    2527$(ASRC)/missing.$(ARCH).o \
    2628$(ASRC)/photcode.$(ARCH).o \
     
    2931$(ASRC)/photcode-ps1-dev-2.$(ARCH).o \
    3032$(ASRC)/photcode-ps1-dev-3.$(ARCH).o \
     33$(ASRC)/photcode-ps1-v1.$(ARCH).o \
    3134$(ASRC)/image.$(ARCH).o \
    3235$(ASRC)/image-loneos.$(ARCH).o \
     
    3740$(ASRC)/image-ps1-dev-2.$(ARCH).o \
    3841$(ASRC)/image-ps1-dev-3.$(ARCH).o \
     42$(ASRC)/image-ps1-v1.$(ARCH).o \
    3943$(ASRC)/regimage.$(ARCH).o \
    4044$(ASRC)/detreg.$(ARCH).o \
     
    6367$(AINC)/average-ps1-dev-1.h \
    6468$(AINC)/average-ps1-dev-2.h \
     69$(AINC)/average-ps1-v1.h \
    6570$(AINC)/secfilt.h \
    6671$(AINC)/secfilt-loneos.h \
     
    7075$(AINC)/secfilt-ps1-dev-1.h \
    7176$(AINC)/secfilt-ps1-dev-2.h \
     77$(AINC)/secfilt-ps1-v1.h \
    7278$(AINC)/measure.h \
    7379$(AINC)/measure-loneos.h \
     
    7783$(AINC)/measure-ps1-dev-1.h \
    7884$(AINC)/measure-ps1-dev-2.h \
     85$(AINC)/measure-ps1-v1.h \
    7986$(AINC)/missing.h \
    8087$(AINC)/photcode.h \
     
    8390$(AINC)/photcode-ps1-dev-2.h \
    8491$(AINC)/photcode-ps1-dev-3.h \
     92$(AINC)/photcode-ps1-v1.h \
    8593$(AINC)/image.h \
    8694$(AINC)/image-loneos.h \
     
    9199$(AINC)/image-ps1-dev-2.h \
    92100$(AINC)/image-ps1-dev-3.h \
     101$(AINC)/image-ps1-v1.h \
    93102$(AINC)/regimage.h \
    94103$(AINC)/detreg.h \
  • branches/eam_branch_20090208/Ohana/src/libautocode/def/average.d

    r16810 r21418  
    22EXTNAME      DVO_AVERAGE
    33TYPE         BINTABLE
    4 SIZE         80
     4SIZE         94
    55DESCRIPTION  DVO Average Object Table
    66
    77# elements of data structure / FITS table
    88
    9 FIELD R,              RA,         double,           RA,                           decimal degrees
    10 FIELD D,              DEC,        double,           DEC,                          decimal degrees
    11 FIELD dR,             RA_ERR,     float,            RA error                      arcsec
    12 FIELD dD,             DEC_ERR,    float,            DEC error                     arcsec
     9FIELD R,              RA,          double,          RA,                           decimal degrees
     10FIELD D,              DEC,         double,          DEC,                          decimal degrees
     11FIELD dR,             RA_ERR,      float,           RA error                      arcsec
     12FIELD dD,             DEC_ERR,     float,           DEC error                     arcsec
     13                                   
     14FIELD uR,             U_RA,        float,           RA*cos(D) proper-motion,      arcsec/year
     15FIELD uD,             U_DEC,       float,           DEC proper-motion,            arcsec/year
     16FIELD duR,            V_RA_ERR,    float,           RA*cos(D) p-m error,          arcsec/year
     17FIELD duD,            V_DEC_ERR,   float,           DEC p-m error,                arcsec/year
     18FIELD P,              PAR,         float,           parallax,                     arcsec
     19FIELD dP,             PAR_ERR,     float,           parallax error,               arcsec
    1320
    14 FIELD uR,             U_RA,       float,            RA*cos(D) proper-motion,      arcsec/year
    15 FIELD uD,             U_DEC,      float,            DEC proper-motion,            arcsec/year
    16 FIELD duR,            V_RA_ERR,   float,            RA*cos(D) p-m error,          arcsec/year
    17 FIELD duD,            V_DEC_ERR,  float,            DEC p-m error,                arcsec/year
    18 FIELD P,              PAR,        float,            parallax,                     arcsec
    19 FIELD dP,             PAR_ERR,    float,            parallax error,               arcsec
     21FIELD Xp,             SIGMA_POS,   short,           position scatter,             1/100 arcsec
     22FIELD ChiSq,          CHISQ_POS,   float,           astrometry analysis chisq
     23FIELD Npos,           NUMBER_POS,  unsigned short,  number of detections used for astrometry
    2024
    21 FIELD Xp,             SIGMA_POS,   short,           position scatter,             1/100 arcsec
     25# this limits us to a max of 64k measurements per object
    2226FIELD Nmeasure,       NMEASURE,    unsigned short,  number of psf measurements
    2327FIELD Nmissing,       NMISSING,    unsigned short,  number of missings
    2428FIELD Nextend,        NEXTEND,     unsigned short,  number of extended measurements
    25 FIELD measureOffset,  OFF_MEASURE, int,             offset to first psf measurement
    26 FIELD missingOffset,  OFF_MISSING, int,             offset to first missing obs
    27 FIELD extendOffset,   OFF_EXTEND,  int,             offset to first extended measurement
    2829
    29 FIELD code,           code,       unsigned short,   ID code (star; ghost; etc)
    30 FIELD dummy,          DUMMY,      char[2],          padding
     30FIELD measureOffset,  OFF_MEASURE, int,             offset to first psf measurement
     31FIELD missingOffset,  OFF_MISSING, int,             offset to first missing obs
     32FIELD extendOffset,   OFF_EXTEND,  int,             offset to first extended measurement
    3133
    32 # Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints
    33 # for C89 compatibility.  The objID is constructed based on the
    34 # position of first instatiation.  this is actually quite expensive
    35 # because we need to include the uniqueness test to construct this,
    36 # which requires a select for each new object.  Therefore, I will use
    37 # a table based ID (table ID + object ID), and we will have to
    38 # re-number the object IDs if we change the table density, OR treat
    39 # all subdivisions as entries which are from a foreign table.
     34# 'flags' was called 'code' prior to 2009.02.07
     35FIELD flags,          FLAGS,       uint32_t,        average object flags (star; ghost; etc)
    4036
    41 FIELD objID,          OBJ_ID,    unsigned int,   unique ID for object in table
    42 FIELD catID,          CAT_ID,    unsigned int,   unique ID for table in which object was first realized
     37# objID + catID gives a unique ID for all objects in the database
     38FIELD objID,          OBJ_ID,      unsigned int,    unique ID for object in table
     39FIELD catID,          CAT_ID,      unsigned int,    unique ID for table in which object was first realized
     40FIELD extID,          EXT_ID,      uint64_t,        external ID for object (eg PSPS objID)
    4341
    4442# this structure should only be used for internal representations
     
    4745# the index for the secfilt table is just Nsecfilt times the index for the average table.
    4846
    49 # the DVO object IDs are generated internally and are not equivalent to the PSPS object IDs
    50 # probably need to add position chisq
    51 
    52 # XXX include the number of measurements used to determine the positional information?
     47# *** 20090206 : new fields : ChiSq, Npos, flags (was code, uint16_t), extID
  • branches/eam_branch_20090208/Ohana/src/libautocode/def/image.d

    r20936 r21418  
    4040# 40 bytes
    4141
    42 FIELD     name,             NAME,                 char[128],      name of original image
     42FIELD     name,             NAME,                 char[121],      name of original image
    4343FIELD     detection_limit,  DETECTION_LIMIT,      unsigned char,  detection limit,           10*mag
    4444FIELD     saturation_limit, SATURATION_LIMIT,     unsigned char,  saturation limit,          10*mag
     
    4747FIELD     fwhm_y,           FWHM_Y,               unsigned char,  PSF y width,               25*arcsec
    4848FIELD     trate,            TRATE,                unsigned char,  scan rate,                 100 usec/pixel
    49 FIELD     code,             CODE,                 char,           image quality flag
    5049FIELD     ccdnum,           CCDNUM,               unsigned char,  CCD ID number
     50FIELD     flags,            FLAGS,                unsigned int,   image quality flags
    5151FIELD     imageID,          IMAGE_ID,             unsigned int,   internal image ID
    52 
    53 # XXX do we want to use this to handle mosaics?
    54 # FIELD           parentID,         PARENT_ID,            unsigned int,   associated ref image
     52FIELD     parentID,         PARENT_ID,            unsigned int,   associated ref image
    5553FIELD     externID,         EXTERN_ID,            unsigned int,   external image ID
    5654FIELD     sourceID,         SOURCE_ID,            unsigned short, analysis source ID
     
    7371FIELD     Myyyy,            MYYYY,                short,          Mrel polyterm
    7472# 40 bytes
     73
     74# *** 20090206 : new fields : parentID, flags (was code char), changed name to 121 bytes.
  • branches/eam_branch_20090208/Ohana/src/libautocode/def/measure.d

    r16810 r21418  
    22EXTNAME      DVO_MEASURE
    33TYPE         BINTABLE
    4 SIZE         112
     4SIZE         139
    55DESCRIPTION  DVO Detection Measurement Table
    66
     
    1010FIELD Mcal,           M_CAL,        float,          image cal mag,                mag
    1111FIELD Map,            M_APER,       float,          aperture mag,                 mag
     12FIELD Map_small,      M_APER_SMALL, float,          small aperture mag,           mag
    1213FIELD dM,             MAG_ERR,      float,          mag error,                    mag
    1314FIELD dMcal,          MAG_CAL_ERR,  float,          systematic calibration error, mag
    1415FIELD dt,             M_TIME,       float,          exposure time,                2.5*log(exptime)
     16
    1517
    1618# note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
     
    2628FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
    2729
    28 FIELD t,              TIME,         unsigned int,   time in seconds (UNIX)
     30FIELD t,              TIME,         int,            time in seconds (UNIX)
     31FIELD t_msec,         TIME_MSEC,    unsigned short, time fraction of second,       milliseconds
    2932FIELD averef,         AVE_REF,      unsigned int,   reference to average entry     
    3033
     
    3235FIELD detID,          DET_ID,       unsigned int,   detection ID
    3336FIELD imageID,        IMAGE_ID,     unsigned int,   reference to DVO image ID
     37FIELD extID,          EXT_ID,       uint64_t,       external ID (eg PSPS detID)
    3438
    3539# do we need more resolution than a short? should this be a log?
    36 FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
     40FIELD psfQual,        PSF_QF,       float,          psf coverage/quality factor
    3741FIELD psfChisq,       PSF_CHISQ,    float,          psf fit chisq
    3842FIELD crNsigma,       CR_NSIGMA,    float,          Nsigma deviation towards CR
     
    4246FIELD FWy,            FWHM_MINOR,   short,          object fwhm minor axis,       1/100 of arcsec
    4347FIELD theta,          PSF_THETA,    short,          angle wrt ccd X dir,          (0xffff/360) deg
    44 FIELD photcode,       PHOTCODE,     unsigned short, photcode
     48
     49# moments
     50FIELD Mxx,            MXX,          short,          second moments in pixel coords, 1/100 of arcsec
     51FIELD Mxy,            MXY,          short,          second moments in pixel coords, 1/100 of arcsec
     52FIELD Myy,            MYY,          short,          second moments in pixel coords, 1/100 of arcsec
    4553
    4654# convert this to error in arcsec on load?
    4755FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
    4856FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
     57FIELD dTccd,          T_CCD_ERR,    short,          position angle chip to sky,    (0xffff/360) deg
    4958
    50 FIELD dbFlags,        DB_FLAGS,     unsigned short, flags for various uses 
    51 FIELD photFlags,      PHOT_FLAGS,   unsigned short, flags supplied by photometry program
     59FIELD photcode,       PHOTCODE,     unsigned short, photcode
     60FIELD dbFlags,        DB_FLAGS,     uint64_t,       flags supplied by analysis in database
     61FIELD photFlags,      PHOT_FLAGS,   uint64_t,       flags supplied by photometry program
    5262
    5363FIELD stargal,        STAR_GAL,     char,           star-galaxy separator
    5464
    55 # absorb these into photFlags?
    56 FIELD dophot,         DOPHOT,       char,           dophot type
     65# *** 20090206 : new fields : t_msec, extID, Mxx, Mxy, Myy, dTccd; deprecated dophot
     66#                dbFlags, photFlags : uint16_t to uint64_t
    5767
    58 FIELD dummy,          DUMMY,        char[6],        padding
     68# XXX unsigned int values are probably not being saved in the FITS file correctly: no BZERO, BSCALE
  • branches/eam_branch_20090208/Ohana/src/libautocode/def/secfilt.d

    r12332 r21418  
    22EXTNAME      DVO_SECFILT
    33TYPE         BINTABLE
    4 SIZE         16
     4SIZE         18
    55DESCRIPTION  DVO SecFilt : Secondary Filter Data
    66
     
    1111FIELD  Ncode, NCODE,    short,                number of detections in band
    1212FIELD  Nused, NUSED,    short,                number of detections used in average
    13 FIELD  dummy, JUNK,     short,                place holder
     13FIELD  M_20,  MAG_20,   short,                lower 20percent mag,      millimags
     14FIELD  M_80,  MAG_80,   short,                upper 20percent mag,      millimags
     15
     16# *** 20090206 : new fields : M_20, M_80; dropped dummy
  • branches/eam_branch_20090208/Ohana/src/libautocode/doc/autocode.txt

    r3515 r21418  
     1
     22009.02.07
     3
     4The autocode tables currently use type names which are ambiguous in
     5terms of their actual sizes in bits.  I've added the intNN_t and
     6uintNN_t types -- this requires --use-gnu99 with configure
     7
     8see libdvo/doc/notes.txt for instructions on adding new dvo catalog formats
     9
     102007.00.00
    111
    212This directory contains a collection of autocoded FITS I/O routines
  • branches/eam_branch_20090208/Ohana/src/libautocode/generate

    r7080 r21418  
    114114       
    115115        # rawshort is a short without byteswapping
     116        # rawshort is a patch for old photreg tables
    116117
    117118        $pt1 = 0;
     
    124125        if ($type eq "int")           { $pt1 = "J"; }
    125126        if ($type eq "unsigned int")  { $pt1 = "J"; }
    126         if ($type eq "e_time")        { $pt1 = "J"; }
     127
     128        if ($type eq "int8_t")        { $pt1 = "B"; }
     129        if ($type eq "uint8_t")       { $pt1 = "B"; }
     130        if ($type eq "int16_t")       { $pt1 = "I"; }
     131        if ($type eq "uint16_t")      { $pt1 = "I"; }
     132        if ($type eq "int32_t")       { $pt1 = "J"; }
     133        if ($type eq "uint32_t")      { $pt1 = "J"; }
     134
     135        # FITS tables do not allow for 64bit integers.  we need to
     136        # write these by splitting the value into high and low 32 bit values
     137        if ($type eq "int64_t")       { $pt1 = "J"; $Np = 2*$Np; }
     138        if ($type eq "uint64_t")      { $pt1 = "J"; $Np = 2*$Np; }
     139
    127140        if ($type eq "float")         { $pt1 = "E"; }
    128141        if ($type eq "double")        { $pt1 = "D"; }
    129142
     143        # special 'elixir' types:
     144        if ($type eq "e_time")        { $pt1 = "J"; }
    130145        if ($type eq "e_void")        { $pt1 = "B"; $Np = 8*$Np; }
    131146        # e_void is a 64 bit pointer, cast to size_t.  its value is not loaded
     
    146161        printf FILE "%-20s 1.0, 0.0);\n", "\"$unit[$i]\", ";
    147162    }
    148 
    149163}
    150164
     
    217231        if ($type eq "int")           { $pt1 = sprintf "I%s", $length; }
    218232        if ($type eq "unsigned int")  { $pt1 = sprintf "I%s", $length; }
    219         if ($type eq "e_time")        { $pt1 = sprintf "I%s", $length; }
     233
     234        if ($type eq "int8_t")        { $pt1 = sprintf "I%s", $length; }
     235        if ($type eq "uint8_t")       { $pt1 = sprintf "I%s", $length; }
     236        if ($type eq "int16_t")       { $pt1 = sprintf "I%s", $length; }
     237        if ($type eq "uint16_t")      { $pt1 = sprintf "I%s", $length; }
     238        if ($type eq "int32_t")       { $pt1 = sprintf "I%s", $length; }
     239        if ($type eq "uint32_t")      { $pt1 = sprintf "I%s", $length; }
     240
     241        # FITS tables do not allow for 64bit integers.  we need to
     242        # write these by splitting the value into high and low 32 bit values
     243        if ($type eq "int64_t")       { $pt1 = sprintf "I%s", $length; }
     244        if ($type eq "uint64_t")      { $pt1 = sprintf "I%s", $length; }
     245
    220246        if ($type eq "float")         { $pt1 = sprintf "F%s", $length; }
    221247        if ($type eq "double")        { $pt1 = sprintf "F%s", $length; }
    222248
     249        # special 'elixir' types:
     250        if ($type eq "e_time")        { $pt1 = sprintf "I%s", $length; }
    223251        if ($type eq "e_void")        { $pt1 = sprintf "I%s", $length; }
    224252
     
    283311        if ($type eq "unsigned char") { $N +=   $Np; next; }
    284312        if ($type eq "rawshort")      { $N += 2*$Np; next; }
     313
    285314        if ($type eq "short")         { $T = "BYTE"; $n = 2; }
    286315        if ($type eq "unsigned short"){ $T = "BYTE"; $n = 2; }
    287316        if ($type eq "int")           { $T = "WORD"; $n = 4; }
    288317        if ($type eq "unsigned int")  { $T = "WORD"; $n = 4; }
     318
     319        if ($type eq "int8_t")        { $N +=   $Np; next; }
     320        if ($type eq "uint8_t")       { $N +=   $Np; next; }
     321        if ($type eq "int16_t")       { $T = "BYTE"; $n = 2; }
     322        if ($type eq "uint16_t")      { $T = "BYTE"; $n = 2; }
     323        if ($type eq "int32_t")       { $T = "WORD"; $n = 4; }
     324        if ($type eq "uint32_t")      { $T = "WORD"; $n = 4; }
     325
     326        # FITS tables do not allow for 64bit integers.  we need to
     327        # write these by splitting the value into high and low 32 bit values
     328        if ($type eq "int64_t")       { $T = "WORD"; $n = 4; $Np = 2*$Np; }
     329        if ($type eq "uint64_t")      { $T = "WORD"; $n = 4; $Np = 2*$Np; }
     330
     331        if ($type eq "float")         { $T = "WORD"; $n = 4; }
     332        if ($type eq "double")        { $T = "DBLE"; $n = 8; }
     333
     334        # special 'elixir' types:
    289335        if ($type eq "e_time")        { $T = "WORD"; $n = 4; }
    290336        if ($type eq "e_void")        { $T = "DBLE"; $n = 8; }
    291         if ($type eq "float")         { $T = "WORD"; $n = 4; }
    292         if ($type eq "double")        { $T = "DBLE"; $n = 8; }
     337
    293338        if (!$n) { die "unknown type $type"; }
    294339        for ($j = 0; $j < $Np; $j++) {
     
    318363        if ($type eq "int")            { $Nbytes += 4*$Np; $valid = 1; }
    319364        if ($type eq "unsigned int")   { $Nbytes += 4*$Np; $valid = 1; }
     365
     366        if ($type eq "int8_t")         { $Nbytes += 1*$Np; $valid = 1; }
     367        if ($type eq "uint8_t")        { $Nbytes += 1*$Np; $valid = 1; }
     368        if ($type eq "int16_t")        { $Nbytes += 2*$Np; $valid = 1; }
     369        if ($type eq "uint16_t")       { $Nbytes += 2*$Np; $valid = 1; }
     370        if ($type eq "int32_t")        { $Nbytes += 4*$Np; $valid = 1; }
     371        if ($type eq "uint32_t")       { $Nbytes += 4*$Np; $valid = 1; }
     372
     373        # FITS tables do not allow for 64bit integers.  we need to
     374        # write these by splitting the value into high and low 32 bit values
     375        if ($type eq "int64_t")        { $Nbytes += 8*$Np; $valid = 1; }
     376        if ($type eq "uint64_t")       { $Nbytes += 8*$Np; $valid = 1; }
     377
     378        if ($type eq "float")          { $Nbytes += 4*$Np; $valid = 1; }
     379        if ($type eq "double")         { $Nbytes += 8*$Np; $valid = 1; }
     380
     381        # special 'elixir' types:
    320382        if ($type eq "e_time")         { $Nbytes += 4*$Np; $valid = 1; }
    321383        if ($type eq "e_void")         { $Nbytes += 8*$Np; $valid = 1; }
    322         if ($type eq "float")          { $Nbytes += 4*$Np; $valid = 1; }
    323         if ($type eq "double")         { $Nbytes += 8*$Np; $valid = 1; }
    324384        if (!$valid) { die "unknown type $type"; }
    325385    }
  • branches/eam_branch_20090208/Ohana/src/libdvo/Makefile

    r17419 r21418  
    3131$(DESTINC)/ps1_dev_1_defs.h \
    3232$(DESTINC)/ps1_dev_2_defs.h \
    33 $(DESTINC)/ps1_dev_3_defs.h
     33$(DESTINC)/ps1_dev_3_defs.h \
     34$(DESTINC)/ps1_v1_defs.h
    3435
    3536INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h
     
    6566$(SRC)/dvo_convert_PS1_DEV_2.$(ARCH).o \
    6667$(SRC)/dvo_convert_PS1_DEV_3.$(ARCH).o \
     68$(SRC)/dvo_convert_PS1_V1.$(ARCH).o \
    6769$(SRC)/skyregion_io.$(ARCH).o    \
    6870$(SRC)/skyregion_gsc.$(ARCH).o    \
  • branches/eam_branch_20090208/Ohana/src/libdvo/doc/notes.txt

    r12332 r21418  
    22Adding a new dvo catalog format.  Assume the new format name is 'foo'.
    33
    4 1) create the autocode definition files for average, measure, secfilt, image
    5    these files must be a subset of the internal versions of these same
    6    tables.  if you intend to add fields which don't exist in the
    7    internal tables, you must update the internal tables as well.  the
    8    naming convention is: average-foo.d, etc.
     41) create the autocode definition files for average, measure, secfilt,
     5   image, and photcode.  these files must be a subset of the internal
     6   versions of these same tables.  if you intend to add fields which
     7   don't exist in the internal tables, you must update the internal
     8   tables as well.  the naming convention is: average-foo.d, etc.
    99
    10102) add the new definition files to libautocode/Makefile.Targets (both
     
    2222 (libdvo/src/dvo_catalog.c).  The name should be "FOO".
    2323
    24 6) add entry for structure size in dvo_catalog_load_raw
    25    (libdvo/src/dvo_catalog_raw.c), since this is not available from
    26    the header.
     246) in libdvo/src/dvo_catalog_raw.c, update the FORMAT_CASE lists to
     25   include the new STRUCT name.
    2726
    28 7) add entries in ReadRawAverage, WriteRawAverage, ReadRawMeasure,
    29    WriteRawMeasure, ReadRawSecFilt, WriteRawSecFilt.  Make sure to use
    30    the new STRUCT names. the conversion function gfit_convert_Foo will
    31    be automatically generated.
     277) create a new conversion file dvo_convert_foo.c and define the
     28   internal to Foo conversions.
    3229
    33 8) add entry in WriteRawAverage, making sure to use the new STRUCT
    34    name. the conversion function gfit_convert_Foo will be
    35    automatically generated. 
     308) add the new format to the list of FORMAT conversion in dvo_convert.c.
    3631
    37 9) create a new conversion file dvo_convert_foo.c and define the
    38    internal to Foo conversions.
     329) any changes to the internal format need to be reflected in the
     33   functions in the dvo_convert_*.c files.  These files are defined so
     34   that changed fields are sequential in the functions.  This should
     35   make is easy to identify the new changes needed.
     36
     3710) add the new format to the section at the end of dvo_image.c
     38
     3911) add the new format to the dvo_image_raw.c
     40
     4112) add the photcode format conversions to libdvo/src/LoadPhotcodesFITS.c
     42
     4312) switch the output photcode format conversion ina libdvo/src/SavePhotcodesFITS.c
     44
     4513) Add the conversion functions to the header file libdvo/include/foo_defs.h
    3946
    4047* Note some esoteric format issues: 
     
    5461    keywords.
    5562
     63----
     64
     6520090207 : adding PS1_V1
     66
     67measure:
     68 new fields : t_msec, extID, Mxx, Mxy, Myy, dTccd; deprecated dophot
     69 dbFlags, photFlags : uint16_t to uint64_t
     70
     71average:
     72 new fields : ChiSq, Npos, flags (was code, uint16_t), extID
     73
     74secfilt:
     75 new fields : M_20, M_80; dropped dummy
     76
     77image:
     78 new fields : parentID, flags (was code char), changed name to 121 bytes.
     79
     80photcode:
     81 new fields : NONE
     82
     83** parentID was added to enable easy lookups from chip->fpa for mosaic
     84   astrometry.  In old databases, this conversion was done by making
     85   the match via the time and photcode.  This conversion needs to be
     86   done on load...
  • branches/eam_branch_20090208/Ohana/src/libdvo/include/dvo.h

    r21408 r21418  
    1818              DVO_FORMAT_PS1_DEV_1,
    1919              DVO_FORMAT_PS1_DEV_2,
    20               DVO_FORMAT_PS1_DEV_3
     20              DVO_FORMAT_PS1_DEV_3,
     21              DVO_FORMAT_PS1_V1
    2122} DVOTableFormat;
    2223
     
    407408# include "ps1_dev_2_defs.h"
    408409# include "ps1_dev_3_defs.h"
     410# include "ps1_v1_defs.h"
    409411
    410412/*** DVO image db I/O Functions ***/
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/LoadPhotcodesFITS.c

    r17190 r21418  
    4040  gfits_scan (&db.theader, "EXTNAME", "%s", 1, extname);
    4141
    42   if (!strcmp (extname, "DVO_PHOTCODE") || !strcmp (extname, "DVO_PHOTCODE_ELIXIR")) {
     42  if (!strcmp (extname, "DVO_PHOTCODE")) {
     43    PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped);
     44    photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode);
     45    free (photcode_elixir);
     46  }
     47
     48  if (!strcmp (extname, "DVO_PHOTCODE_ELIXIR")) {
    4349    PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped);
    4450    photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode);
     
    6268    photcode = PhotCode_PS1_DEV_3_To_Internal (photcode_ps1_dev_3, Ncode);
    6369    free (photcode_ps1_dev_3);
     70  }
     71
     72  if (!strcmp (extname, "DVO_PHOTCODE_PS1_V1")) {
     73    PhotCode_PS1_V1 *photcode_ps1_v1 = gfits_table_get_PhotCode_PS1_V1 (&db.ftable, &Ncode, &db.swapped);
     74    photcode = PhotCode_PS1_V1_To_Internal (photcode_ps1_v1, Ncode);
     75    free (photcode_ps1_v1);
    6476  }
    6577
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/SavePhotcodesFITS.c

    r17190 r21418  
    2929  // for the moment, we simply support the latest photcode format for output
    3030  // XXX update this as needed as new formats are defined
    31   PhotCode_PS1_DEV_3 *photcode_output = PhotCode_Internal_To_PS1_DEV_3 (table[0].code, table[0].Ncode);
     31  PhotCode_PS1_V1 *photcode_output = PhotCode_Internal_To_PS1_V1 (table[0].code, table[0].Ncode);
    3232
    3333  /* convert FITS format data to internal format (byteswaps & EXTNAME) */
    3434  gfits_db_create (&db);
    35   gfits_table_set_PhotCode_PS1_DEV_3 (&db.ftable, photcode_output, table[0].Ncode);
     35  gfits_table_set_PhotCode_PS1_V1 (&db.ftable, photcode_output, table[0].Ncode);
    3636  gfits_db_save (&db);
    3737  gfits_db_close (&db);
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_catalog.c

    r20981 r21418  
    5252  if (!strcasecmp (catformat, "PS1_DEV_1"))       return (DVO_FORMAT_PS1_DEV_1);
    5353  if (!strcasecmp (catformat, "PS1_DEV_2"))       return (DVO_FORMAT_PS1_DEV_2);
     54  if (!strcasecmp (catformat, "PS1_V1"))          return (DVO_FORMAT_PS1_V1);
    5455  return (DVO_FORMAT_UNDEF);
    5556}
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_catalog_raw.c

    r20982 r21418  
    8686      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    8787      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     88      FORMAT_CASE (PS1_V1,    PS1_V1);
    8889
    8990    default:
     
    271272  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_1)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_1");
    272273  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
     274  if (catalog[0].catformat == DVO_FORMAT_PS1_V1)          gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V1");
    273275
    274276  /* rewind file pointers and truncate file */
     
    366368      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    367369      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     370      FORMAT_CASE (PS1_V1,    PS1_V1);
    368371
    369372    default:
     
    412415      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    413416      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     417      FORMAT_CASE (PS1_V1,    PS1_V1);
    414418
    415419    default:
     
    462466      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    463467      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     468      FORMAT_CASE (PS1_V1,    PS1_V1);
    464469
    465470    default:
     
    508513      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    509514      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     515      FORMAT_CASE (PS1_V1,    PS1_V1);
    510516
    511517    default:
     
    558564      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    559565      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     566      FORMAT_CASE (PS1_V1,    PS1_V1);
    560567
    561568    default:
     
    604611      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    605612      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     613      FORMAT_CASE (PS1_V1,    PS1_V1);
    606614
    607615    default:
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert.c

    r21408 r21418  
    4949  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    5050  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     51  CONVERT_FORMAT ("DVO_AVERAGE_PS1_V1",          PS1_V1,          PS1_V1);
    5152# undef CONVERT_FORMAT
    5253
     
    7980      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    8081      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
     82      FORMAT_CASE (PS1_V1,          PS1_V1);
    8183# undef FORMAT_CASE
    8284
     
    122124  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    123125  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     126  CONVERT_FORMAT ("DVO_MEASURE_PS1_V1",          PS1_V1,          PS1_V1);
    124127# undef CONVERT_FORMAT
    125128
     
    152155      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    153156      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
     157      FORMAT_CASE (PS1_V1,          PS1_V1);
    154158# undef FORMAT_CASE
    155159
     
    195199  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    196200  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     201  CONVERT_FORMAT ("DVO_SECFILT_PS1_V1",          PS1_V1,          PS1_V1);
    197202# undef CONVERT_FORMAT
    198203
     
    225230      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    226231      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
     232      FORMAT_CASE (PS1_V1,          PS1_V1);
    227233# undef FORMAT_CASE
    228234
     
    288294  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    289295  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    290   CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_3",       PS1_DEV_3,       PS1_DEV_3);
     296  CONVERT_FORMAT ("DVO_IMAGE_PS1_V1",          PS1_V1,          PS1_V1);
     297
     298  // XXX Not sure this was ever actually used -- it was not complete...
     299  // CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_3",       PS1_DEV_3,       PS1_DEV_3);
     300
    291301# undef CONVERT_FORMAT
    292302
     
    322332      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    323333      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    324       FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
     334      FORMAT_CASE (PS1_V1,          PS1_V1);
     335
     336      // XXX not sure this was actually used: it was incomplete
     337      // FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
    325338# undef FORMAT_CASE
    326339
     
    372385      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    373386      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    374       FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
     387      FORMAT_CASE (PS1_V1,          PS1_V1);
     388
     389      // XXX not sure this was used, it was incomplete
     390      // FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
     391
    375392# undef FORMAT_CASE
    376393
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r21408 r21418  
    1515    out[i].M          = in[i].M;
    1616    out[i].Mcal       = in[i].Mcal;
    17     out[i].Map        = in[i].Mgal;
    1817    out[i].dM         = in[i].dM;
    1918    out[i].dt         = in[i].dt;
     
    2827    out[i].detID      = in[i].detID;
    2928    out[i].imageID    = in[i].imageID;
    30     out[i].qPSF       = in[i].qPSF;
     29    out[i].psfQual    = in[i].psfQual;
    3130    out[i].psfChisq   = in[i].psfChisq;
    3231    out[i].crNsigma   = in[i].crNsigma;
     
    4140    out[i].photFlags  = in[i].photFlags;
    4241    out[i].stargal    = in[i].stargal;
    43     out[i].dophot     = in[i].dophot;
     42
     43    // changed or added for PS1_DEV_2
     44    out[i].Map        = in[i].Mgal;
     45    out[i].dMcal      = 0;
     46
     47    // changed or added for PS1_V1
     48    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
     49    out[i].t_msec     = 0;
     50    out[i].extID      = 0;
     51    out[i].Mxx        = 0.0;
     52    out[i].Mxy        = 0.0;
     53    out[i].Myy        = 0.0;
     54    out[i].dTccd      = 0;
     55    out[i].Map_small  = 0;
    4456  }
    4557  return (out);
     
    5870    out[i].M          = in[i].M;
    5971    out[i].Mcal       = in[i].Mcal;
    60     out[i].Mgal       = in[i].Map;
    6172    out[i].dM         = in[i].dM;
    6273    out[i].dt         = in[i].dt;
     
    7182    out[i].detID      = in[i].detID;
    7283    out[i].imageID    = in[i].imageID;
    73     out[i].qPSF       = in[i].qPSF;
     84    out[i].psfQual    = in[i].psfQual;
    7485    out[i].psfChisq   = in[i].psfChisq;
    7586    out[i].crNsigma   = in[i].crNsigma;
     
    8293    out[i].dYccd      = in[i].dYccd;
    8394    out[i].dbFlags    = in[i].dbFlags;
    84     out[i].photFlags  = in[i].photFlags;
    8595    out[i].stargal    = in[i].stargal;
    86     out[i].dophot     = in[i].dophot;
     96
     97    // changed or added for PS1_DEV_2
     98    out[i].Mgal       = in[i].Map;
     99
     100    // changed or added for PS1_V1
     101    out[i].photFlags  = in[i].photFlags & 0x0000ffff;
     102    out[i].dophot     = in[i].photFlags >> 16;
    87103  }
    88104  return (out);
     
    101117    out[i].D             = in[i].D;     
    102118    out[i].Xp            = in[i].Xp;     
    103     out[i].Nmeasure      = in[i].Nm;     
    104     out[i].Nmissing      = in[i].Nn;     
    105     out[i].code          = in[i].code;   
    106     out[i].measureOffset = in[i].offset;
    107     out[i].missingOffset = in[i].missing;
    108119    out[i].dR            = in[i].dR;
    109120    out[i].dD            = in[i].dD;
     
    116127    out[i].objID         = in[i].objID;
    117128    out[i].catID         = in[i].catID;
     129
     130    // changed or added for PS1_DEV_2
     131    out[i].Nmeasure      = in[i].Nm;     
     132    out[i].Nmissing      = in[i].Nn;     
     133    out[i].measureOffset = in[i].offset;
     134    out[i].missingOffset = in[i].missing;
     135    out[i].Nextend       = 0;
     136    out[i].extendOffset  = 0;
     137
     138    // changed or added for PS1_V1
     139    out[i].flags         = in[i].code;   
     140    out[i].ChiSq         = 0.0;
     141    out[i].Npos          = 0.0;
     142    out[i].extID         = 0;
    118143  }
    119144  return (out);
     
    129154
    130155  for (i = 0; i < Nvalues; i++) {
    131     out[i].R        = in[i].R;     
    132     out[i].D        = in[i].D;     
    133     out[i].Xp       = in[i].Xp;     
    134     out[i].Nm       = in[i].Nmeasure;     
    135     out[i].Nn       = in[i].Nmissing;     
    136     out[i].code     = in[i].code;   
    137     out[i].offset   = in[i].measureOffset;
    138     out[i].missing  = in[i].missingOffset;
    139     out[i].dR       = in[i].dR;
    140     out[i].dD       = in[i].dD;
    141     out[i].uR       = in[i].uR;
    142     out[i].uD       = in[i].uD;
    143     out[i].duR      = in[i].duR;
    144     out[i].duD      = in[i].duD;
    145     out[i].P        = in[i].P;
    146     out[i].dP       = in[i].dP;
    147     out[i].objID    = in[i].objID;
    148     out[i].catID    = in[i].catID;
     156    out[i].R             = in[i].R;     
     157    out[i].D             = in[i].D;     
     158    out[i].Xp            = in[i].Xp;     
     159    out[i].dR            = in[i].dR;
     160    out[i].dD            = in[i].dD;
     161    out[i].uR            = in[i].uR;
     162    out[i].uD            = in[i].uD;
     163    out[i].duR           = in[i].duR;
     164    out[i].duD           = in[i].duD;
     165    out[i].P             = in[i].P;
     166    out[i].dP            = in[i].dP;
     167    out[i].objID         = in[i].objID;
     168    out[i].catID         = in[i].catID;
     169
     170    // changed or added for PS1_DEV_2
     171    out[i].Nm            = in[i].Nmeasure;     
     172    out[i].Nn            = in[i].Nmissing;     
     173    out[i].offset        = in[i].measureOffset;
     174    out[i].missing       = in[i].missingOffset;
     175
     176    // changed or added for PS1_V1
     177    out[i].code          = in[i].flags;   
    149178  }
    150179  return (out);
     
    164193    out[i].Ncode = in[i].Ncode;
    165194    out[i].Nused = in[i].Nused;
     195
     196    // changed or added for PS1_V1
     197    out[i].M_20  = 0;     
     198    out[i].M_80  = 0;     
    166199 }
    167200  return (out);
     
    218251    out[i].fwhm_y           = in[i].fwhm_y;
    219252    out[i].trate            = in[i].trate;
    220     out[i].code             = in[i].code;
    221253    out[i].ccdnum           = in[i].ccdnum;
    222254    out[i].imageID          = in[i].imageID;
     
    237269    out[i].Mxyyy            = in[i].Mxyyy;
    238270    out[i].Myyyy            = in[i].Myyyy;
     271
     272    // changed or added for PS1_DEV_2
     273    out[i].externID         = 0;
     274    out[i].sourceID         = 0;
     275
     276    // changed or added for PS1_V1
     277    out[i].flags            = in[i].code;
     278    out[i].parentID         = 0;
    239279  }
    240280  return (out);
     
    275315    out[i].fwhm_y           = in[i].fwhm_y;
    276316    out[i].trate            = in[i].trate;
    277     out[i].code             = in[i].code;
    278317    out[i].ccdnum           = in[i].ccdnum;
    279318    out[i].imageID          = in[i].imageID;
     
    294333    out[i].Mxyyy            = in[i].Mxyyy;
    295334    out[i].Myyyy            = in[i].Myyyy;
     335
     336    // changed or added for PS1_V1
     337    out[i].code             = in[i].flags;
     338  }
     339  return (out);
     340}
     341
     342PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {
     343
     344  int i;
     345  PhotCode *out;
     346
     347  ALLOCATE (out, PhotCode, Nvalues);
     348
     349  for (i = 0; i < Nvalues; i++) {
     350    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     351    out[i].name[31] = 0; // force termination
     352
     353    out[i].code  = in[i].code;         
     354    out[i].type  = in[i].type;         
     355    out[i].C     = in[i].C;           
     356    out[i].dC    = in[i].dC;           
     357    out[i].dX    = in[i].dX;           
     358    out[i].K     = in[i].K;           
     359    out[i].c1    = in[i].c1;           
     360    out[i].c2    = in[i].c2;           
     361    out[i].equiv = in[i].equiv;       
     362    out[i].Nc    = in[i].Nc;           
     363    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     364
     365    out[i].astromErrMagScale = in[i].astromErrMagScale;
     366    out[i].photomErrSys      = in[i].photomErrSys;
     367
     368    // changed or added for PS1_DEV_2
     369    out[i].astromErrSys      = 0.0;
     370    out[i].astromErrScale    = 0.0;
     371
     372    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     373    out[i].photomPoorMask      = 0;
     374    out[i].photomBadMask       = 0;
     375    out[i].astromPoorMask      = 0;
     376    out[i].astromBadMask       = 0;
    296377  }
    297378  return (out);
     
    323404    out[i].astromErrMagScale = out[i].astromErrMagScale;
    324405    out[i].photomErrSys      = out[i].photomErrSys;
    325 
    326   }
    327   return (out);
    328 }
    329 
    330 PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {
    331 
    332   int i;
    333   PhotCode *out;
    334 
    335   ALLOCATE (out, PhotCode, Nvalues);
    336 
    337   for (i = 0; i < Nvalues; i++) {
    338     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    339     out[i].name[31] = 0; // force termination
    340 
    341     out[i].code  = in[i].code;         
    342     out[i].type  = in[i].type;         
    343     out[i].C     = in[i].C;           
    344     out[i].dC    = in[i].dC;           
    345     out[i].dX    = in[i].dX;           
    346     out[i].K     = in[i].K;           
    347     out[i].c1    = in[i].c1;           
    348     out[i].c2    = in[i].c2;           
    349     out[i].equiv = in[i].equiv;       
    350     out[i].Nc    = in[i].Nc;           
    351 
    352     // not defined in PS1_DEV_1
    353     out[i].astromErrSys      = 0.0;
    354     out[i].astromErrScale    = 0.0;
    355     out[i].astromErrMagScale = in[i].astromErrMagScale;
    356     out[i].photomErrSys      = in[i].photomErrSys;
    357 
    358     memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    359 
    360     out[i].photomPoorMask      = 0;
    361     out[i].photomBadMask       = 0;
    362     out[i].astromPoorMask      = 0;
    363     out[i].astromBadMask       = 0;
    364   }
    365   return (out);
    366 }
     406  }
     407  return (out);
     408}
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r21408 r21418  
    2929    out[i].detID      = in[i].detID;
    3030    out[i].imageID    = in[i].imageID;
    31     out[i].qPSF       = in[i].qPSF;
     31    out[i].psfQual    = in[i].psfQual;
    3232    out[i].psfChisq   = in[i].psfChisq;
    3333    out[i].crNsigma   = in[i].crNsigma;
     
    4040    out[i].dYccd      = in[i].dYccd;
    4141    out[i].dbFlags    = in[i].dbFlags;
    42     out[i].photFlags  = in[i].photFlags;
    4342    out[i].stargal    = in[i].stargal;
    44     out[i].dophot     = in[i].dophot;
     43
     44    // changed or added for PS1_V1
     45    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
     46    out[i].t_msec     = 0;
     47    out[i].extID      = 0;
     48    out[i].Mxx        = 0.0;
     49    out[i].Mxy        = 0.0;
     50    out[i].Myy        = 0.0;
     51    out[i].dTccd      = 0;
     52    out[i].Map_small  = 0;
    4553  }
    4654  return (out);
     
    7381    out[i].detID      = in[i].detID;
    7482    out[i].imageID    = in[i].imageID;
    75     out[i].qPSF       = in[i].qPSF;
     83    out[i].psfQual    = in[i].psfQual;
    7684    out[i].psfChisq   = in[i].psfChisq;
    7785    out[i].crNsigma   = in[i].crNsigma;
     
    8492    out[i].dYccd      = in[i].dYccd;
    8593    out[i].dbFlags    = in[i].dbFlags;
    86     out[i].photFlags  = in[i].photFlags;
    8794    out[i].stargal    = in[i].stargal;
    88     out[i].dophot     = in[i].dophot;
     95
     96    // changed or added for PS1_V1
     97    out[i].photFlags  = in[i].photFlags & 0x0000ffff;
     98    out[i].dophot     = in[i].photFlags >> 16;
    8999  }
    90100  return (out);
     
    114124    out[i].Nmissing      = in[i].Nmissing;     
    115125    out[i].Nextend       = in[i].Nextend;     
    116     out[i].code          = in[i].code;   
    117126    out[i].measureOffset = in[i].measureOffset;
    118127    out[i].missingOffset = in[i].missingOffset;
     
    120129    out[i].objID         = in[i].objID;
    121130    out[i].catID         = in[i].catID;
     131
     132    // changed or added for PS1_V1
     133    out[i].flags         = in[i].code;   
     134    out[i].ChiSq         = 0.0;
     135    out[i].Npos          = 0.0;
     136    out[i].extID         = 0;
    122137  }
    123138  return (out);
     
    147162    out[i].Nmissing      = in[i].Nmissing;     
    148163    out[i].Nextend       = in[i].Nextend;     
    149     out[i].code          = in[i].code;   
    150164    out[i].measureOffset = in[i].measureOffset;
    151165    out[i].missingOffset = in[i].missingOffset;
     
    153167    out[i].objID         = in[i].objID;
    154168    out[i].catID         = in[i].catID;
     169
     170    // changed or added for PS1_V1
     171    out[i].code          = in[i].flags;   
    155172  }
    156173  return (out);
     
    170187    out[i].Ncode = in[i].Ncode;
    171188    out[i].Nused = in[i].Nused;
     189
     190    // changed or added for PS1_V1
     191    out[i].M_20  = 0;     
     192    out[i].M_80  = 0;     
    172193 }
    173194  return (out);
     
    201222    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    202223
    203     strncpy (out[i].name, in[i].name, 63); // out[128], int[64]
     224    strncpy (out[i].name, in[i].name, 63); // out[121], int[64]
    204225    out[i].name[63] = 0; // force termination
    205226
     
    224245    out[i].fwhm_y           = in[i].fwhm_y;
    225246    out[i].trate            = in[i].trate;
    226     out[i].code             = in[i].code;
    227247    out[i].ccdnum           = in[i].ccdnum;
    228248    out[i].imageID          = in[i].imageID;
     
    245265    out[i].Mxyyy            = in[i].Mxyyy;
    246266    out[i].Myyyy            = in[i].Myyyy;
     267
     268    // changed or added for PS1_V1
     269    out[i].flags            = in[i].code;
     270    out[i].parentID         = 0;
    247271  }
    248272  return (out);
     
    259283    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    260284
    261     strncpy (out[i].name, in[i].name, 63); // in[128], out[64]
     285    strncpy (out[i].name, in[i].name, 63); // in[121], out[64]
    262286    out[i].name[63] = 0; // force termination
    263287
     
    282306    out[i].fwhm_y           = in[i].fwhm_y;
    283307    out[i].trate            = in[i].trate;
    284     out[i].code             = in[i].code;
    285308    out[i].ccdnum           = in[i].ccdnum;
    286309    out[i].imageID          = in[i].imageID;
     
    303326    out[i].Mxyyy            = in[i].Mxyyy;
    304327    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
    308 
    309 PhotCode_PS1_DEV_2 *PhotCode_Internal_To_PS1_DEV_2 (PhotCode *in, int Nvalues) {
    310 
    311   int i;
    312   PhotCode_PS1_DEV_2 *out;
    313 
    314   ALLOCATE (out, PhotCode_PS1_DEV_2, Nvalues);
     328
     329    // changed or added for PS1_V1
     330    out[i].code             = in[i].flags;
     331  }
     332  return (out);
     333}
     334
     335PhotCode *PhotCode_PS1_DEV_2_To_Internal (PhotCode_PS1_DEV_2 *in, int Nvalues) {
     336
     337  int i;
     338  PhotCode *out;
     339
     340  ALLOCATE (out, PhotCode, Nvalues);
    315341
    316342  for (i = 0; i < Nvalues; i++) {
     
    334360    out[i].astromErrMagScale = in[i].astromErrMagScale;
    335361    out[i].photomErrSys      = in[i].photomErrSys;
    336   }
    337   return (out);
    338 }
    339 
    340 PhotCode *PhotCode_PS1_DEV_2_To_Internal (PhotCode_PS1_DEV_2 *in, int Nvalues) {
    341 
    342   int i;
    343   PhotCode *out;
    344 
    345   ALLOCATE (out, PhotCode, Nvalues);
     362
     363    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     364    out[i].photomPoorMask      = 0;
     365    out[i].photomBadMask       = 0;
     366    out[i].astromPoorMask      = 0;
     367    out[i].astromBadMask       = 0;
     368  }
     369  return (out);
     370}
     371
     372PhotCode_PS1_DEV_2 *PhotCode_Internal_To_PS1_DEV_2 (PhotCode *in, int Nvalues) {
     373
     374  int i;
     375  PhotCode_PS1_DEV_2 *out;
     376
     377  ALLOCATE (out, PhotCode_PS1_DEV_2, Nvalues);
    346378
    347379  for (i = 0; i < Nvalues; i++) {
     
    365397    out[i].astromErrMagScale = in[i].astromErrMagScale;
    366398    out[i].photomErrSys      = in[i].photomErrSys;
    367 
    368     out[i].photomPoorMask      = 0;
    369     out[i].photomBadMask       = 0;
    370     out[i].astromPoorMask      = 0;
    371     out[i].astromBadMask       = 0;
    372   }
    373   return (out);
    374 }
     399  }
     400  return (out);
     401}
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c

    r21408 r21418  
    33/* convert PS1_DEV_3 formats to internal formats */
    44
    5 // XXX EAM I am not yet ready to commit to a full PS1_DEV_3 release, but I am providing image and photcode conversion
     5// We only provide image and photcode conversion
    66
    77Image *Image_PS1_DEV_3_ToInternal (Image_PS1_DEV_3 *in, int Nvalues) {
     
    3838    out[i].fwhm_y           = in[i].fwhm_y;
    3939    out[i].trate            = in[i].trate;
    40     out[i].code             = in[i].code;
    4140    out[i].ccdnum           = in[i].ccdnum;
    4241    out[i].imageID          = in[i].imageID;
     
    5958    out[i].Mxyyy            = in[i].Mxyyy;
    6059    out[i].Myyyy            = in[i].Myyyy;
     60
     61    // changed or added for PS1_V1
     62    out[i].flags            = in[i].code;
     63    out[i].parentID         = 0;
    6164  }
    6265  return (out);
     
    9699    out[i].fwhm_y           = in[i].fwhm_y;
    97100    out[i].trate            = in[i].trate;
    98     out[i].code             = in[i].code;
    99101    out[i].ccdnum           = in[i].ccdnum;
    100102    out[i].imageID          = in[i].imageID;
     
    117119    out[i].Mxyyy            = in[i].Mxyyy;
    118120    out[i].Myyyy            = in[i].Myyyy;
     121
     122    // changed or added for PS1_V1
     123    out[i].code             = in[i].flags;
     124  }
     125  return (out);
     126}
     127
     128PhotCode *PhotCode_PS1_DEV_3_To_Internal (PhotCode_PS1_DEV_3 *in, int Nvalues) {
     129
     130  int i;
     131  PhotCode *out;
     132
     133  ALLOCATE (out, PhotCode, Nvalues);
     134
     135  for (i = 0; i < Nvalues; i++) {
     136    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     137    out[i].name[31] = 0; // force termination
     138
     139    out[i].code  = in[i].code;         
     140    out[i].type  = in[i].type;         
     141    out[i].C     = in[i].C;           
     142    out[i].dC    = in[i].dC;           
     143    out[i].dX    = in[i].dX;           
     144    out[i].K     = in[i].K;           
     145    out[i].c1    = in[i].c1;           
     146    out[i].c2    = in[i].c2;           
     147    out[i].equiv = in[i].equiv;       
     148    out[i].Nc    = in[i].Nc;           
     149    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     150
     151    out[i].astromErrSys      = in[i].astromErrSys;
     152    out[i].astromErrScale    = in[i].astromErrScale;
     153    out[i].astromErrMagScale = in[i].astromErrMagScale;
     154    out[i].photomErrSys      = in[i].photomErrSys;
     155
     156    out[i].photomPoorMask      = in[i].photomPoorMask;
     157    out[i].photomBadMask       = in[i].photomBadMask;
     158    out[i].astromPoorMask      = in[i].astromPoorMask;
     159    out[i].astromBadMask       = in[i].astromBadMask;
    119160  }
    120161  return (out);
     
    157198}
    158199
    159 PhotCode *PhotCode_PS1_DEV_3_To_Internal (PhotCode_PS1_DEV_3 *in, int Nvalues) {
    160 
    161   int i;
    162   PhotCode *out;
    163 
    164   ALLOCATE (out, PhotCode, Nvalues);
    165 
    166   for (i = 0; i < Nvalues; i++) {
    167     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    168     out[i].name[31] = 0; // force termination
    169 
    170     out[i].code  = in[i].code;         
    171     out[i].type  = in[i].type;         
    172     out[i].C     = in[i].C;           
    173     out[i].dC    = in[i].dC;           
    174     out[i].dX    = in[i].dX;           
    175     out[i].K     = in[i].K;           
    176     out[i].c1    = in[i].c1;           
    177     out[i].c2    = in[i].c2;           
    178     out[i].equiv = in[i].equiv;       
    179     out[i].Nc    = in[i].Nc;           
    180     memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    181 
    182     out[i].astromErrSys      = in[i].astromErrSys;
    183     out[i].astromErrScale    = in[i].astromErrScale;
    184     out[i].astromErrMagScale = in[i].astromErrMagScale;
    185     out[i].photomErrSys      = in[i].photomErrSys;
    186 
    187     out[i].photomPoorMask      = in[i].photomPoorMask;
    188     out[i].photomBadMask       = in[i].photomBadMask;
    189     out[i].astromPoorMask      = in[i].astromPoorMask;
    190     out[i].astromBadMask       = in[i].astromBadMask;
    191   }
    192   return (out);
    193 }
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r21408 r21418  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
     12    out[i].FWx      = in[i].FWx;
     13    out[i].t        = in[i].t;
     14    out[i].averef   = in[i].averef;
     15
     16    // changed for PANSTARRS_DEV_0
    1217    out[i].dR       = (in[i].dR      == NAN_S_SHORT) ? NAN : in[i].dR     * 0.01;
    1318    out[i].dD       = (in[i].dD      == NAN_S_SHORT) ? NAN : in[i].dD     * 0.01;
     
    1621    out[i].dt       = (in[i].dt      == NAN_S_SHORT) ? NAN : in[i].dt     * 0.001;
    1722    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
    18 
    19     // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
    20     // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
    2123    out[i].Map      = (in[i].Mgal    == NAN_S_SHORT) ? NAN : in[i].Mgal   * 0.001;
    2224    out[i].airmass  = (in[i].airmass == NAN_S_SHORT) ? NAN : in[i].airmass* 0.001;
    23     out[i].FWx      = in[i].FWx;
    2425    out[i].FWy      = in[i].fwy * in[i].FWx * 0.01;
    2526    out[i].theta    = in[i].theta*(0x10000 / 0x100);
    26     out[i].dophot   = in[i].dophot;
    2727    out[i].photcode = in[i].source;
    28     out[i].t        = in[i].t;
    29     out[i].averef   = in[i].averef;
    30     out[i].dbFlags  = in[i].flags;
    3128   
    32     /* these can be determined if needed / desired */
    33     out[i].Xccd     = 0;
    34     out[i].Yccd     = 0;
    35     out[i].dXccd    = 0;
    36     out[i].dYccd    = 0;
    37 
    38     /* these do not have a corresponding value */
     29    // added for PANSTARRS_DEV_0
     30    out[i].Xccd      = 0;  // determine on-the-fly
     31    out[i].Yccd      = 0;  // determine on-the-fly
     32    out[i].dXccd     = 0;
     33    out[i].dYccd     = 0;
    3934    out[i].az        = 0;
    4035    out[i].stargal   = 0;
    4136    out[i].Sky       = 0;
    4237    out[i].dSky      = 0;
    43     out[i].qPSF      = 0;
     38    out[i].psfQual   = 0;
    4439    out[i].psfChisq  = 0;
    4540    out[i].crNsigma  = 0;
    4641    out[i].extNsigma = 0;
    47     out[i].photFlags = 0;
    48 
    49     /* XXX add these later */
    50     out[i].detID = 0;
    51     out[i].imageID = 0;
     42    out[i].detID     = 0;  // determine on-the-fly
     43    out[i].imageID   = 0;  // determine on-the-fly
     44
     45    // changed or added for PS1_DEV_1 (2008.02.26)
     46    out[i].dbFlags    = in[i].flags;
     47    out[i].detID      = 0;
     48    out[i].imageID    = 0;
     49
     50    // changed or added for PS1_DEV_2
     51    out[i].Map        = in[i].Mgal;
     52    out[i].dMcal      = 0;
     53
     54    // changed or added for PS1_V1
     55    out[i].photFlags  = in[i].dophot << 16;
     56    out[i].t_msec     = 0;
     57    out[i].extID      = 0;
     58    out[i].Mxx        = 0.0;
     59    out[i].Mxy        = 0.0;
     60    out[i].Myy        = 0.0;
     61    out[i].dTccd      = 0;
     62    out[i].Map_small  = 0;
    5263  }
    5364  return (out);
     
    6374
    6475  for (i = 0; i < Nvalues; i++) {
     76    out[i].FWx     = in[i].FWx;
     77    out[i].t       = in[i].t;
     78    out[i].averef  = in[i].averef;
     79
     80    // changed for PANSTARRS_DEV_0
    6581    out[i].dR       = isnan(in[i].dR     ) ? NAN_S_SHORT : in[i].dR      *  100.0;
    6682    out[i].dD       = isnan(in[i].dD     ) ? NAN_S_SHORT : in[i].dD      *  100.0;
     
    7187    out[i].Mgal     = isnan(in[i].Map    ) ? NAN_S_SHORT : in[i].Map     * 1000.0;
    7288    out[i].airmass  = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0;
     89    out[i].fwy      = in[i].FWy * 100.0 / in[i].FWx;
     90    out[i].theta    = in[i].theta*(0x100/ 0x10000);
     91    out[i].source   = in[i].photcode;
    7392
    7493    if (out[i].M < 0) {
     
    7695    }
    7796
    78     out[i].FWx     = in[i].FWx;
    79     out[i].fwy     = in[i].FWy * 100.0 / in[i].FWx;
    80     out[i].theta   = in[i].theta*(0x100/ 0x10000);
    81     out[i].dophot  = in[i].dophot;
    82     out[i].source  = in[i].photcode;
    83     out[i].t       = in[i].t;
    84     out[i].averef  = in[i].averef;
     97    // changed or added for PS1_DEV_1 (2008.02.26)
    8598    out[i].flags   = in[i].dbFlags;
     99
     100    // changed or added for PS1_V1
     101    out[i].dophot  = in[i].photFlags >> 16;
    86102  }
    87103  return (out);
     
    101117    out[i].D             = in[i].D;     
    102118    out[i].Xp            = in[i].Xp;     
    103     out[i].Nmeasure      = in[i].Nm;     
    104     out[i].Nmissing      = in[i].Nn;     
    105     out[i].code          = in[i].code;   
    106     out[i].measureOffset = in[i].offset;
    107     out[i].missingOffset = in[i].missing;
    108 
    109     /* these don't exist in Elixir */
     119
     120    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     121    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     122    primary[0][i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;     
     123    primary[0][i].Xm    = in[i].Xm;     
     124
     125    primary[0][i].Ncode = 0;     
     126    primary[0][i].Nused = 0;
     127
     128    // added for PANSTARRS_DEV_0
    110129    out[i].dR      = 0;
    111130    out[i].dD      = 0;
     
    116135    out[i].P       = 0;
    117136    out[i].dP      = 0;
    118 
    119     /* XXX add these later */
    120     out[i].objID   = 0;
    121     out[i].catID   = 0;
    122 
    123     primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
    124     primary[0][i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;     
    125     primary[0][i].Xm    = in[i].Xm;     
    126     primary[0][i].Ncode = 0;     
    127     primary[0][i].Nused = 0;
     137    out[i].objID   = 0; // determine on-the-fly
     138    out[i].catID   = 0; // determine on-the-fly
     139
     140    // changed or added for PS1_DEV_2
     141    out[i].Nmeasure      = in[i].Nm;     
     142    out[i].Nmissing      = in[i].Nn;     
     143    out[i].measureOffset = in[i].offset;
     144    out[i].missingOffset = in[i].missing;
     145    out[i].Nextend       = 0;
     146    out[i].extendOffset  = 0;
     147
     148    // changed or added for PS1_V1
     149    out[i].flags         = in[i].code;   
     150    out[i].ChiSq         = 0.0;
     151    out[i].Npos          = 0.0;
     152    out[i].extID         = 0;
    128153  }
    129154  return (out);
     
    142167    out[i].D       = in[i].D;     
    143168    out[i].Xp      = in[i].Xp;     
    144     out[i].Nm      = in[i].Nmeasure;     
    145     out[i].Nn      = in[i].Nmissing;     
    146     out[i].code    = in[i].code;   
    147     out[i].offset  = in[i].measureOffset;
    148     out[i].missing = in[i].missingOffset;
    149 
     169
     170    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
    150171    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
    151172    out[i].dM      = isnan(primary[i].dM) ? NAN_S_SHORT : primary[i].dM  * 1000.0;
    152173    out[i].Xm      = primary[i].Xm;     
     174
     175    // changed or added for PS1_DEV_2
     176    out[i].Nm      = in[i].Nmeasure;     
     177    out[i].Nn      = in[i].Nmissing;     
     178    out[i].offset  = in[i].measureOffset;
     179    out[i].missing = in[i].missingOffset;
     180
     181    // changed or added for PS1_V1
     182    out[i].code    = in[i].flags;   
    153183  }
    154184  return (out);
     
    164194
    165195  for (i = 0; i < Nvalues; i++) {
     196    out[i].Xm    = in[i].Xm;     
     197
     198    // added or changed for PANSTARRS_DEV_0
    166199    out[i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M   * 0.001;
    167200    out[i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM  * 0.001;
    168     out[i].Xm    = in[i].Xm;     
    169201    out[i].Ncode = 0;
    170202    out[i].Nused = 0;
     203
     204    // changed or added for PS1_V1
     205    out[i].M_20  = 0;     
     206    out[i].M_80  = 0;     
    171207  }
    172208  return (out);
     
    182218
    183219  for (i = 0; i < Nvalues; i++) {
     220    out[i].Xm    = in[i].Xm;     
     221
     222    // added or changed for PANSTARRS_DEV_0
    184223    out[i].M     = isnan(in[i].M)  ? NAN_S_SHORT : in[i].M   * 1000.0;
    185224    out[i].dM    = isnan(in[i].dM) ? NAN_S_SHORT : in[i].dM  * 1000.0;
    186     out[i].Xm    = in[i].Xm;     
    187225  }
    188226  return (out);
     
    207245    out[i].NX               = in[i].NX;
    208246    out[i].NY               = in[i].NY;
    209     out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
    210     out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
    211     out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
    212     out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
    213     out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
    214247    out[i].Xm               = in[i].Xm;
    215248    out[i].photcode         = in[i].source;
     
    221254    out[i].fwhm_y           = in[i].fwhm_y;
    222255    out[i].trate            = in[i].trate;
    223     out[i].code             = in[i].code;
    224256    out[i].ccdnum           = in[i].ccdnum;
    225257
     
    240272    out[i].Myyyy            = in[i].Myyyy;
    241273
    242     /* XXX add these later */
    243     out[i].imageID = 0;
    244 
    245     // not available in ELIXIR
     274    // added or changed for PANSTARRS_DEV_0
     275    out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
     276    out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
     277    out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
     278    out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
     279    out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
    246280    out[i].sidtime          = NAN;
    247281    out[i].latitude         = NAN;
     282    out[i].imageID          = 0; // determine on-the-fly
     283
     284    // changed or added for PS1_DEV_2
     285    out[i].externID         = 0;
     286    out[i].sourceID         = 0;
     287
     288    // changed or added for PS1_V1
     289    out[i].flags            = in[i].code;
     290    out[i].parentID         = 0;
    248291  }
    249292  return (out);
     
    268311    out[i].NX               = in[i].NX;
    269312    out[i].NY               = in[i].NY;
    270     out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
    271     out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
    272     out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
    273     out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
    274     out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     313
    275314    out[i].Xm               = in[i].Xm;
    276315    out[i].source           = in[i].photcode;
     
    282321    out[i].fwhm_y           = in[i].fwhm_y;
    283322    out[i].trate            = in[i].trate;
    284     out[i].code             = in[i].code;
    285323    out[i].ccdnum           = in[i].ccdnum;
    286324
     
    300338    out[i].Mxyyy            = in[i].Mxyyy;
    301339    out[i].Myyyy            = in[i].Myyyy;
    302   }
    303   return (out);
    304 }
    305 
    306 PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) {
    307 
    308   int i;
    309   PhotCode_Elixir *out;
    310 
    311   ALLOCATE (out, PhotCode_Elixir, Nvalues);
     340
     341    // added or changed for PANSTARRS_DEV_0
     342    out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
     343    out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
     344    out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
     345    out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
     346    out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     347
     348    // changed or added for PS1_V1
     349    out[i].code             = in[i].flags;
     350  }
     351  return (out);
     352}
     353
     354PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) {
     355
     356  int i;
     357  PhotCode *out;
     358
     359  ALLOCATE (out, PhotCode, Nvalues);
    312360
    313361  for (i = 0; i < Nvalues; i++) {
     
    326374    out[i].Nc    = in[i].Nc;           
    327375    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    328   }
    329   return (out);
    330 }
    331 
    332 PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) {
    333 
    334   int i;
    335   PhotCode *out;
    336 
    337   ALLOCATE (out, PhotCode, Nvalues);
     376
     377    // changed or added for PS1_DEV_1
     378    out[i].astromErrMagScale = 0.0;
     379    out[i].photomErrSys      = 0.0;
     380
     381    // changed or added for PS1_DEV_2
     382    out[i].astromErrSys      = 0.0;
     383    out[i].astromErrScale    = 0.0;
     384
     385    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     386    out[i].photomPoorMask      = 0;
     387    out[i].photomBadMask       = 0;
     388    out[i].astromPoorMask      = 0;
     389    out[i].astromBadMask       = 0;
     390  }
     391  return (out);
     392}
     393
     394PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) {
     395
     396  int i;
     397  PhotCode_Elixir *out;
     398
     399  ALLOCATE (out, PhotCode_Elixir, Nvalues);
    338400
    339401  for (i = 0; i < Nvalues; i++) {
     
    352414    out[i].Nc    = in[i].Nc;           
    353415    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    354 
    355     // not defined in Elixir:
    356     out[i].astromErrSys      = 0.0;
    357     out[i].astromErrScale    = 0.0;
    358     out[i].astromErrMagScale = 0.0;
    359     out[i].photomErrSys      = 0.0;
    360 
    361     out[i].photomPoorMask      = 0;
    362     out[i].photomBadMask       = 0;
    363     out[i].astromPoorMask      = 0;
    364     out[i].astromBadMask       = 0;
    365   }
    366   return (out);
    367 }
     416  }
     417  return (out);
     418}
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r21408 r21418  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
    12     out[i].dR        = (in[i].dR      == NAN_S_SHORT) ? NAN : in[i].dR     * 0.01;
    13     out[i].dD        = (in[i].dD      == NAN_S_SHORT) ? NAN : in[i].dD     * 0.01;
    14     out[i].M         = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
    15     out[i].dM        = (in[i].dM      == NAN_U_CHAR)  ? NAN : in[i].dM     * 0.001;
    16     out[i].Mcal      = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
    17     out[i].dophot    = in[i].dophot;
    18     out[i].photcode  = in[i].source;
    19     out[i].t         = in[i].t;
    20 
    21     /* flags and averef are now split */
     12    out[i].t        = in[i].t;
     13
     14    // added or changed for ELIXIR
    2215    out[i].averef    =  in[i].averef & 0x00ffffff;
    2316    out[i].dbFlags   = (in[i].averef & 0xff000000) >> 24;
    24 
    25     /* these values don't exist in the Loneos format */
    26 
    27     // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
    28     // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
    29     out[i].Map       = out[i].M;
     17    out[i].t         = in[i].t;
    3018    out[i].dt        = 0;
    3119    out[i].airmass   = 0;
     20    out[i].FWy       = 0;
     21    out[i].FWx       = 0;
     22    out[i].theta     = 0;
     23
     24    // changed for PANSTARRS_DEV_0
     25    out[i].dR       = (in[i].dR      == NAN_S_SHORT) ? NAN : in[i].dR     * 0.01;
     26    out[i].dD       = (in[i].dD      == NAN_S_SHORT) ? NAN : in[i].dD     * 0.01;
     27    out[i].M        = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
     28    out[i].dM       = (in[i].dM      == NAN_U_CHAR)  ? NAN : in[i].dM     * 0.001;
     29    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
     30    out[i].Map      = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
     31    out[i].photcode = in[i].source;
     32   
     33    // added for PANSTARRS_DEV_0
     34    out[i].Xccd      = 0;  // determine on-the-fly
     35    out[i].Yccd      = 0;  // determine on-the-fly
     36    out[i].dXccd     = 0;
     37    out[i].dYccd     = 0;
    3238    out[i].az        = 0;
    33     out[i].FWx       = 0;
    34     out[i].FWy       = 0;
    35     out[i].theta     = 0;
    3639    out[i].stargal   = 0;
    3740    out[i].Sky       = 0;
    3841    out[i].dSky      = 0;
    39     out[i].qPSF      = 0;
     42    out[i].psfQual   = 0;
    4043    out[i].psfChisq  = 0;
    4144    out[i].crNsigma  = 0;
    4245    out[i].extNsigma = 0;
    43     out[i].photFlags = 0;
    44 
    45     /* these can be determined if needed / desired */
    46     out[i].Xccd     = 0;
    47     out[i].Yccd     = 0;
    48     out[i].dXccd    = 0;
    49     out[i].dYccd    = 0;
    50 
    51     /* XXX add these later */
    52     out[i].detID = 0;
    53     out[i].imageID = 0;
     46    out[i].detID     = 0;  // determine on-the-fly
     47    out[i].imageID   = 0;  // determine on-the-fly
     48
     49    // changed or added for PS1_DEV_1 (2008.02.26)
     50    out[i].detID      = 0;
     51    out[i].imageID    = 0;
     52
     53    // changed or added for PS1_DEV_2
     54    out[i].dMcal      = 0;
     55
     56    // changed or added for PS1_V1
     57    out[i].photFlags  = in[i].dophot << 16;
     58    out[i].t_msec     = 0;
     59    out[i].extID      = 0;
     60    out[i].Mxx        = 0.0;
     61    out[i].Mxy        = 0.0;
     62    out[i].Myy        = 0.0;
     63    out[i].dTccd      = 0;
     64    out[i].Map_small  = 0;
    5465  }
    5566  return (out);
     
    6576
    6677  for (i = 0; i < Nvalues; i++) {
     78
     79    // changed for PANSTARRS_DEV_0
    6780    out[i].dR     = isnan(in[i].dR     ) ? NAN_S_SHORT : in[i].dR      *  100.0;
    6881    out[i].dD     = isnan(in[i].dD     ) ? NAN_S_SHORT : in[i].dD      *  100.0;
     
    7083    out[i].dM     = isnan(in[i].dM     ) ? NAN_U_CHAR  : in[i].dM      * 1000.0;
    7184    out[i].Mcal   = isnan(in[i].Mcal   ) ? NAN_S_SHORT : in[i].Mcal    * 1000.0;
    72     out[i].dophot = in[i].dophot;
    7385    out[i].source = in[i].photcode;
    7486    out[i].t      = in[i].t;
     
    7688    /* flags and averef are merged in Loneos */
    7789    out[i].averef =  (in[i].averef & 0x00ffffff) | (in[i].dbFlags << 24);
     90
     91    // changed or added for PS1_V1
     92    out[i].dophot  = in[i].photFlags >> 16;
    7893  }
    7994  return (out);
     
    93108    out[i].D             = in[i].D;     
    94109    out[i].Xp            = in[i].Xp;     
    95     out[i].Nmeasure      = in[i].Nm;     
    96     out[i].Nmissing      = in[i].Nn;     
    97     out[i].code          = in[i].code;   
    98     out[i].measureOffset = in[i].offset;
    99     out[i].missingOffset = in[i].missing;
    100 
    101     /* these don't exist in Loneos */
     110
     111    // added for ELIXIR
     112    primary[0][i].dM    = NAN;
     113
     114    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     115    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     116    primary[0][i].Xm    = in[i].Xm;     
     117    primary[0][i].Ncode = 0;     
     118    primary[0][i].Nused = 0;
     119
     120    // added for PANSTARRS_DEV_0
    102121    out[i].dR      = 0;
    103122    out[i].dD      = 0;
     
    108127    out[i].P       = 0;
    109128    out[i].dP      = 0;
    110 
    111     /* XXX add these later */
    112     out[i].objID   = 0;
    113     out[i].catID   = 0;
    114 
    115     primary[0][i].M  = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
    116     primary[0][i].Xm = in[i].Xm;     
    117     primary[0][i].dM = NAN;
    118     primary[0][i].Ncode = 0;     
    119     primary[0][i].Nused = 0;
     129    out[i].objID   = 0; // determine on-the-fly
     130    out[i].catID   = 0; // determine on-the-fly
     131
     132    // changed or added for PS1_DEV_2
     133    out[i].Nmeasure      = in[i].Nm;     
     134    out[i].Nmissing      = in[i].Nn;     
     135    out[i].measureOffset = in[i].offset;
     136    out[i].missingOffset = in[i].missing;
     137    out[i].Nextend       = 0;
     138    out[i].extendOffset  = 0;
     139
     140    // changed or added for PS1_V1
     141    out[i].flags         = in[i].code;   
     142    out[i].ChiSq         = 0.0;
     143    out[i].Npos          = 0.0;
     144    out[i].extID         = 0;
    120145  }
    121146  return (out);
     
    134159    out[i].D       = in[i].D;     
    135160    out[i].Xp      = in[i].Xp;     
     161
     162    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     163    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
     164    out[i].Xm      = primary[i].Xm;     
     165
     166    // changed or added for PS1_DEV_2
    136167    out[i].Nm      = in[i].Nmeasure;     
    137168    out[i].Nn      = in[i].Nmissing;     
    138     out[i].code    = in[i].code;   
    139169    out[i].offset  = in[i].measureOffset;
    140170    out[i].missing = in[i].missingOffset;
    141171
    142     out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
    143     out[i].Xm      = primary[i].Xm;     
     172    // changed or added for PS1_V1
     173    out[i].code    = in[i].flags;   
    144174  }
    145175  return (out);
     
    155185
    156186  for (i = 0; i < Nvalues; i++) {
     187    out[i].Xm    = in[i].Xm;     
     188
     189    // added for ELIXIR
     190    out[i].dM    = NAN;
     191
     192    // added or changed for PANSTARRS_DEV_0
    157193    out[i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M * 0.001;
    158     out[i].Xm    = in[i].Xm;     
    159     out[i].dM    = NAN;
    160194    out[i].Ncode = 0;
    161195    out[i].Nused = 0;
     196
     197    // changed or added for PS1_V1
     198    out[i].M_20  = 0;     
     199    out[i].M_80  = 0;     
    162200  }
    163201  return (out);
     
    173211
    174212  for (i = 0; i < Nvalues; i++) {
     213    out[i].Xm   = in[i].Xm;     
     214
     215    // added or changed for PANSTARRS_DEV_0
    175216    out[i].M    = isnan(in[i].M)  ? NAN_S_SHORT : in[i].M * 1000.0;
    176     out[i].Xm   = in[i].Xm;     
    177217  }
    178218  return (out);
     
    197237    out[i].NX               = in[i].NX;
    198238    out[i].NY               = in[i].NY;
    199 
    200     out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
    201     out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
    202     out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
    203     out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
    204     out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
    205239
    206240    out[i].Xm               = in[i].Xm;
     
    213247    out[i].fwhm_y           = in[i].fwhm_y;
    214248    out[i].trate            = in[i].trate;
    215     out[i].code             = in[i].code;
    216249    out[i].ccdnum           = in[i].ccdnum;
     250
    217251    out[i].order            = in[i].order;
    218252    out[i].Mx               = in[i].Mx;
     
    231265    out[i].Myyyy            = in[i].Myyyy;
    232266
    233     /* XXX add these later */
    234     out[i].imageID = 0;
     267    // added or changed for PANSTARRS_DEV_0
     268    out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
     269    out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
     270    out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
     271    out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
     272    out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
     273    out[i].sidtime          = NAN;
     274    out[i].latitude         = NAN;
     275    out[i].imageID          = 0; // determine on-the-fly
     276
     277    // changed or added for PS1_DEV_2
     278    out[i].externID         = 0;
     279    out[i].sourceID         = 0;
     280
     281    // changed or added for PS1_V1
     282    out[i].flags            = in[i].code;
     283    out[i].parentID         = 0;
    235284  }
    236285  return (out);
     
    255304    out[i].NX               = in[i].NX;
    256305    out[i].NY               = in[i].NY;
    257 
    258     out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
    259     out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
    260     out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
    261     out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
    262     out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
    263306
    264307    out[i].Xm               = in[i].Xm;
     
    271314    out[i].fwhm_y           = in[i].fwhm_y;
    272315    out[i].trate            = in[i].trate;
    273     out[i].code             = in[i].code;
    274316    out[i].ccdnum           = in[i].ccdnum;
     317
    275318    out[i].order            = in[i].order;
    276319    out[i].Mx               = in[i].Mx;
     
    288331    out[i].Mxyyy            = in[i].Mxyyy;
    289332    out[i].Myyyy            = in[i].Myyyy;
    290   }
    291   return (out);
    292 }
     333
     334    // added or changed for PANSTARRS_DEV_0
     335    out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
     336    out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
     337    out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
     338    out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
     339    out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     340
     341    // changed or added for PS1_V1
     342    out[i].code             = in[i].flags;
     343  }
     344  return (out);
     345}
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r21408 r21418  
    1616    out[i].Mcal       = in[i].Mcal;
    1717
    18     // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
    19     // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
    20     out[i].Map        = in[i].Mgal;
    2118    out[i].airmass    = in[i].airmass;
    2219    out[i].az         = in[i].az;
     
    2522    out[i].FWy        = in[i].FWy;
    2623    out[i].theta      = in[i].theta;
    27     out[i].dophot     = in[i].dophot;
    2824    out[i].photcode   = in[i].photcode;
    2925    out[i].t          = in[i].t;
    3026    out[i].averef     = in[i].averef;
    31     out[i].dbFlags    = in[i].flags;
    3227    out[i].Xccd       = in[i].Xccd;
    3328    out[i].Yccd       = in[i].Yccd;
     
    3732    out[i].Sky        = in[i].Sky;
    3833    out[i].dSky       = in[i].dSky;
    39     out[i].qPSF       = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF;
     34
     35    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     36    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     37
     38    // changed or added for PS1_DEV_1 (2008.02.26)
     39    out[i].psfQual    = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual;
     40    out[i].dbFlags    = in[i].flags;
    4041    out[i].detID      = in[i].detID_lo;
    4142    out[i].imageID    = in[i].imageID_lo;
    42 
    43     // these don't have a correspondence
    44     out[i].psfChisq  = 0;
    45     out[i].crNsigma  = 0;
    46     out[i].extNsigma = 0;
    47     out[i].photFlags = 0;
     43    out[i].psfChisq   = 0;
     44    out[i].crNsigma   = 0;
     45    out[i].extNsigma  = 0;
     46
     47    // changed or added for PS1_DEV_2
     48    out[i].Map        = in[i].Mgal;
     49    out[i].dMcal      = 0;
     50
     51    // changed or added for PS1_V1
     52    out[i].photFlags  = in[i].dophot << 16;
     53    out[i].t_msec     = 0;
     54    out[i].extID      = 0;
     55    out[i].Mxx        = 0.0;
     56    out[i].Mxy        = 0.0;
     57    out[i].Myy        = 0.0;
     58    out[i].dTccd      = 0;
     59    out[i].Map_small  = 0;
    4860  }
    4961  return (out);
     
    6476    out[i].dM         = in[i].dM;
    6577    out[i].Mcal       = in[i].Mcal;
    66     out[i].Mgal       = in[i].Map;
    6778    out[i].airmass    = in[i].airmass;
    6879    out[i].az         = in[i].az;
     
    7182    out[i].FWy        = in[i].FWy;
    7283    out[i].theta      = in[i].theta;
    73     out[i].dophot     = in[i].dophot;
    7484    out[i].photcode   = in[i].photcode;
    7585    out[i].t          = in[i].t;
    7686    out[i].averef     = in[i].averef;
    77     out[i].flags      = in[i].dbFlags;
    7887    out[i].Xccd       = in[i].Xccd;
    7988    out[i].Yccd       = in[i].Yccd;
     
    8392    out[i].Sky        = in[i].Sky;
    8493    out[i].dSky       = in[i].dSky;
    85     out[i].qPSF       = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF;
     94
     95    // changed or added for PS1_DEV_1 (2008.02.26)
     96    out[i].flags      = in[i].dbFlags;
     97    out[i].psfQual    = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual;
    8698    out[i].detID_hi   = 0;
    8799    out[i].detID_lo   = in[i].detID;
    88100    out[i].imageID_hi = 0;
    89101    out[i].imageID_lo = in[i].imageID;
     102
     103    // changed or added for PS1_DEV_2
     104    out[i].Mgal       = in[i].Map;
     105
     106    // changed or added for PS1_V1
     107    // out[i].photFlags  = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1)
     108    out[i].dophot     = in[i].photFlags >> 16;
    90109  }
    91110  return (out);
     
    105124    out[i].D             = in[i].D;     
    106125    out[i].Xp            = in[i].Xp;     
    107     out[i].Nmeasure      = in[i].Nm;     
    108     out[i].Nmissing      = in[i].Nn;     
    109     out[i].code          = in[i].code;   
    110     out[i].measureOffset = in[i].offset;
    111     out[i].missingOffset = in[i].missing;
    112126    out[i].dR            = in[i].dR;
    113127    out[i].dD            = in[i].dD;
     
    120134    out[i].objID         = in[i].objID;
    121135    out[i].catID         = in[i].catID;
     136
     137    // changed or added for PS1_DEV_2
     138    out[i].Nmeasure      = in[i].Nm;     
     139    out[i].Nmissing      = in[i].Nn;     
     140    out[i].measureOffset = in[i].offset;
     141    out[i].missingOffset = in[i].missing;
     142    out[i].Nextend       = 0;
     143    out[i].extendOffset  = 0;
     144
     145    // changed or added for PS1_V1
     146    out[i].flags         = in[i].code;   
     147    out[i].ChiSq         = 0.0;
     148    out[i].Npos          = 0.0;
     149    out[i].extID         = 0;
    122150  }
    123151  return (out);
     
    137165    out[i].D        = in[i].D;     
    138166    out[i].Xp       = in[i].Xp;     
    139     out[i].Nm       = in[i].Nmeasure;     
    140     out[i].Nn       = in[i].Nmissing;     
    141     out[i].code     = in[i].code;   
    142     out[i].offset   = in[i].measureOffset;
    143     out[i].missing  = in[i].missingOffset;
    144167    out[i].dR       = in[i].dR;
    145168    out[i].dD       = in[i].dD;
     
    152175    out[i].objID    = in[i].objID;
    153176    out[i].catID    = in[i].catID;
     177
     178    // changed or added for PS1_DEV_2
     179    out[i].Nm       = in[i].Nmeasure;     
     180    out[i].Nn       = in[i].Nmissing;     
     181    out[i].offset   = in[i].measureOffset;
     182    out[i].missing  = in[i].missingOffset;
     183
     184    // changed or added for PS1_V1
     185    out[i].code          = in[i].flags;   
    154186  }
    155187  return (out);
     
    170202    out[i].Ncode = in[i].Ncode;
    171203    out[i].Nused = in[i].Nused;
     204
     205    // changed or added for PS1_V1
     206    out[i].M_20  = 0;     
     207    out[i].M_80  = 0;     
    172208 }
    173209  return (out);
     
    226262    out[i].fwhm_y           = in[i].fwhm_y;
    227263    out[i].trate            = in[i].trate;
    228     out[i].code             = in[i].code;
    229264    out[i].ccdnum           = in[i].ccdnum;
    230     out[i].imageID          = in[i].imageID_lo;
    231265
    232266    out[i].order            = in[i].order;
     
    245279    out[i].Mxyyy            = in[i].Mxyyy;
    246280    out[i].Myyyy            = in[i].Myyyy;
     281
     282    // changed or added for PS1_DEV_1
     283    out[i].imageID          = in[i].imageID_lo;
     284
     285    // changed or added for PS1_DEV_2
     286    out[i].externID         = 0;
     287    out[i].sourceID         = 0;
     288
     289    // changed or added for PS1_V1
     290    out[i].flags            = in[i].code;
     291    out[i].parentID         = 0;
    247292  }
    248293  return (out);
     
    283328    out[i].fwhm_y           = in[i].fwhm_y;
    284329    out[i].trate            = in[i].trate;
    285     out[i].code             = in[i].code;
    286330    out[i].ccdnum           = in[i].ccdnum;
    287     out[i].imageID_hi       = 0;
    288     out[i].imageID_lo       = in[i].imageID;
    289331
    290332    out[i].order            = in[i].order;
     
    303345    out[i].Mxyyy            = in[i].Mxyyy;
    304346    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
     347
     348    // changed or added for PS1_DEV_1
     349    out[i].imageID_hi       = 0;
     350    out[i].imageID_lo       = in[i].imageID;
     351
     352    // changed or added for PS1_V1
     353    out[i].code             = in[i].flags;
     354  }
     355  return (out);
     356}
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r21408 r21418  
    1616    out[i].Mcal       = in[i].Mcal;
    1717
    18     // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
    19     // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
    20     out[i].Map        = in[i].Mgal;
    2118    out[i].airmass    = in[i].airmass;
    2219    out[i].az         = in[i].az;
     
    2522    out[i].FWy        = in[i].FWy;
    2623    out[i].theta      = in[i].theta;
    27     out[i].dophot     = in[i].dophot;
    2824    out[i].photcode   = in[i].photcode;
    2925    out[i].t          = in[i].t;
    3026    out[i].averef     = in[i].averef;
    31     out[i].dbFlags    = in[i].flags;
    3227    out[i].Xccd       = in[i].Xccd;
    3328    out[i].Yccd       = in[i].Yccd;
     
    3732    out[i].Sky        = in[i].Sky;
    3833    out[i].dSky       = in[i].dSky;
    39     out[i].qPSF       = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF;
     34
     35    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     36    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     37
     38    // changed or added for PS1_DEV_1 (2008.02.26)
     39    out[i].psfQual    = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual;
     40    out[i].dbFlags    = in[i].flags;
    4041    out[i].detID      = in[i].detID_lo;
    4142    out[i].imageID    = in[i].imageID_lo;
    42 
    43     // these don't have a correspondence
    44     out[i].psfChisq  = 0;
    45     out[i].crNsigma  = 0;
    46     out[i].extNsigma = 0;
    47     out[i].photFlags = 0;
     43    out[i].psfChisq   = 0;
     44    out[i].crNsigma   = 0;
     45    out[i].extNsigma  = 0;
     46
     47    // changed or added for PS1_DEV_2
     48    out[i].Map        = in[i].Mgal;
     49    out[i].dMcal      = 0;
     50
     51    // changed or added for PS1_V1
     52    out[i].photFlags  = in[i].dophot << 16;
     53    out[i].t_msec     = 0;
     54    out[i].extID      = 0;
     55    out[i].Mxx        = 0.0;
     56    out[i].Mxy        = 0.0;
     57    out[i].Myy        = 0.0;
     58    out[i].dTccd      = 0;
     59    out[i].Map_small  = 0;
    4860  }
    4961  return (out);
     
    6476    out[i].dM         = in[i].dM;
    6577    out[i].Mcal       = in[i].Mcal;
    66     out[i].Mgal       = in[i].Map;
    6778    out[i].airmass    = in[i].airmass;
    6879    out[i].az         = in[i].az;
     
    7182    out[i].FWy        = in[i].FWy;
    7283    out[i].theta      = in[i].theta;
    73     out[i].dophot     = in[i].dophot;
    7484    out[i].photcode   = in[i].photcode;
    7585    out[i].t          = in[i].t;
    7686    out[i].averef     = in[i].averef;
    77     out[i].flags      = in[i].dbFlags;
    7887    out[i].Xccd       = in[i].Xccd;
    7988    out[i].Yccd       = in[i].Yccd;
     
    8392    out[i].Sky        = in[i].Sky;
    8493    out[i].dSky       = in[i].dSky;
    85     out[i].qPSF       = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF;
     94
     95    // changed or added for PS1_DEV_1 (2008.02.26)
     96    out[i].flags      = in[i].dbFlags;
     97    out[i].psfQual    = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual;
    8698    out[i].detID_hi   = 0;
    8799    out[i].detID_lo   = in[i].detID;
    88100    out[i].imageID_hi = 0;
    89101    out[i].imageID_lo = in[i].imageID;
     102
     103    // changed or added for PS1_DEV_2
     104    out[i].Mgal       = in[i].Map;
     105
     106    // changed or added for PS1_V1
     107    // out[i].photFlags  = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1)
     108    out[i].dophot     = in[i].photFlags >> 16;
    90109  }
    91110  return (out);
     
    105124    out[i].D             = in[i].D;     
    106125    out[i].Xp            = in[i].Xp;     
    107     out[i].Nmeasure      = in[i].Nm;     
    108     out[i].Nmissing      = in[i].Nn;     
    109     out[i].code          = in[i].code;   
    110     out[i].measureOffset = in[i].offset;
    111     out[i].missingOffset = in[i].missing;
    112126    out[i].dR            = in[i].dR;
    113127    out[i].dD            = in[i].dD;
     
    120134    out[i].objID         = in[i].objID;
    121135    out[i].catID         = in[i].catID;
     136
     137    // changed or added for PS1_DEV_2
     138    out[i].Nmeasure      = in[i].Nm;     
     139    out[i].Nmissing      = in[i].Nn;     
     140    out[i].measureOffset = in[i].offset;
     141    out[i].missingOffset = in[i].missing;
     142    out[i].Nextend       = 0;
     143    out[i].extendOffset  = 0;
     144
     145    // changed or added for PS1_V1
     146    out[i].flags         = in[i].code;   
     147    out[i].ChiSq         = 0.0;
     148    out[i].Npos          = 0.0;
     149    out[i].extID         = 0;
    122150  }
    123151  return (out);
     
    137165    out[i].D        = in[i].D;     
    138166    out[i].Xp       = in[i].Xp;     
    139     out[i].Nm       = in[i].Nmeasure;     
    140     out[i].Nn       = in[i].Nmissing;     
    141     out[i].code     = in[i].code;   
    142     out[i].offset   = in[i].measureOffset;
    143     out[i].missing  = in[i].missingOffset;
    144167    out[i].dR       = in[i].dR;
    145168    out[i].dD       = in[i].dD;
     
    152175    out[i].objID    = in[i].objID;
    153176    out[i].catID    = in[i].catID;
     177
     178    // changed or added for PS1_DEV_2
     179    out[i].Nm       = in[i].Nmeasure;     
     180    out[i].Nn       = in[i].Nmissing;     
     181    out[i].offset   = in[i].measureOffset;
     182    out[i].missing  = in[i].missingOffset;
     183
     184    // changed or added for PS1_V1
     185    out[i].code          = in[i].flags;   
    154186  }
    155187  return (out);
     
    170202    out[i].Ncode = in[i].Ncode;
    171203    out[i].Nused = in[i].Nused;
     204
     205    // changed or added for PS1_V1
     206    out[i].M_20  = 0;     
     207    out[i].M_80  = 0;     
    172208 }
    173209  return (out);
     
    226262    out[i].fwhm_y           = in[i].fwhm_y;
    227263    out[i].trate            = in[i].trate;
    228     out[i].code             = in[i].code;
    229264    out[i].ccdnum           = in[i].ccdnum;
    230     out[i].imageID          = in[i].imageID_lo;
    231265
    232266    out[i].order            = in[i].order;
     
    245279    out[i].Mxyyy            = in[i].Mxyyy;
    246280    out[i].Myyyy            = in[i].Myyyy;
     281
     282    // changed or added for PS1_DEV_1
     283    out[i].imageID          = in[i].imageID_lo;
     284
     285    // changed or added for PS1_DEV_2
     286    out[i].externID         = 0;
     287    out[i].sourceID         = 0;
     288
     289    // changed or added for PS1_V1
     290    out[i].flags            = in[i].code;
     291    out[i].parentID         = 0;
    247292  }
    248293  return (out);
     
    283328    out[i].fwhm_y           = in[i].fwhm_y;
    284329    out[i].trate            = in[i].trate;
    285     out[i].code             = in[i].code;
    286330    out[i].ccdnum           = in[i].ccdnum;
    287     out[i].imageID_hi       = 0;
    288     out[i].imageID_lo       = in[i].imageID;
    289331
    290332    out[i].order            = in[i].order;
     
    303345    out[i].Mxyyy            = in[i].Mxyyy;
    304346    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
     347
     348    // changed or added for PS1_DEV_1
     349    out[i].imageID_hi       = 0;
     350    out[i].imageID_lo       = in[i].imageID;
     351
     352    // changed or added for PS1_V1
     353    out[i].code             = in[i].flags;
     354  }
     355  return (out);
     356}
     357
     358// XXX no photcode conversions?  this may be from before we had a photcode FITS table...
     359
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_image.c

    r21408 r21418  
    196196  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
    197197  if (db[0].format == DVO_FORMAT_PS1_DEV_3)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_3");
     198  if (db[0].format == DVO_FORMAT_PS1_V1)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V1");
    198199 
    199200  return;
  • branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_image_raw.c

    r16810 r21418  
    5454  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       ImageSize = sizeof(Image_PS1_DEV_1);
    5555  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       ImageSize = sizeof(Image_PS1_DEV_2);
     56  if (db[0].format == DVO_FORMAT_PS1_DEV_3)       ImageSize = sizeof(Image_PS1_DEV_3);
     57  if (db[0].format == DVO_FORMAT_PS1_V1)          ImageSize = sizeof(Image_PS1_V1);
    5658
    5759  /* check that filesize makes sense */
     
    7880  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       gfits_table_mkheader_Image_PS1_DEV_1 (&db[0].theader);
    7981  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_table_mkheader_Image_PS1_DEV_2 (&db[0].theader);
     82  if (db[0].format == DVO_FORMAT_PS1_DEV_3)       gfits_table_mkheader_Image_PS1_DEV_3 (&db[0].theader);
     83  if (db[0].format == DVO_FORMAT_PS1_V1)          gfits_table_mkheader_Image_PS1_V1 (&db[0].theader);
    8084   
    8185  /* read data from file */
Note: See TracChangeset for help on using the changeset viewer.