IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 16, 2009, 11:33:52 AM (17 years ago)
Author:
eugene
Message:

merge changes from eam_branch_20090208: add PS1_V1 formats; rename average.code to flags, image.code to flags; some opihi function name clarification; drop Stars as autocode struct; rework addstar to isolate input -> Measure conversions

Location:
trunk/Ohana/src/libdvo
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/Makefile

    r17419 r21508  
    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    \
  • trunk/Ohana/src/libdvo/doc/notes.txt

    r12332 r21508  
    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...
  • trunk/Ohana/src/libdvo/include/dvo.h

    r21153 r21508  
    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 ***/
     
    444446void sort_image_subset (Image *image, int *subset, int N);
    445447void sort_coords_index (double *X, double *Y, int *S, int N);
    446 void sort_stars_ra (Stars *stars, int N);
    447448void sort_regions (SkyRegion *region, int N);
    448449
  • trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c

    r17190 r21508  
    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
  • trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c

    r17190 r21508  
    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);
  • trunk/Ohana/src/libdvo/src/dvo_catalog.c

    r20981 r21508  
    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}
  • trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c

    r20982 r21508  
    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:
  • trunk/Ohana/src/libdvo/src/dvo_convert.c

    r19185 r21508  
    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
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r19185 r21508  
    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;
     
    4039    out[i].dbFlags    = in[i].dbFlags;
    4140    out[i].photFlags  = in[i].photFlags;
    42     out[i].stargal    = in[i].stargal;
    43     out[i].dophot     = in[i].dophot;
     41
     42    // changed or added for PS1_DEV_2
     43    out[i].Map        = in[i].Mgal;
     44    out[i].dMcal      = 0;
     45
     46    // changed or added for PS1_V1
     47    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
     48    out[i].t_msec     = 0;
     49    out[i].extID      = 0;
     50    out[i].objID      = 0;
     51    out[i].catID      = 0;
     52    out[i].Mxx        = 0.0;
     53    out[i].Mxy        = 0.0;
     54    out[i].Myy        = 0.0;
     55    out[i].posangle   = 0;
     56    out[i].pltscale   = 0;
     57    out[i].psfNdof    = 0;
     58    out[i].psfNpix    = 0;
    4459  }
    4560  return (out);
     
    5873    out[i].M          = in[i].M;
    5974    out[i].Mcal       = in[i].Mcal;
    60     out[i].Mgal       = in[i].Map;
    6175    out[i].dM         = in[i].dM;
    6276    out[i].dt         = in[i].dt;
     
    7185    out[i].detID      = in[i].detID;
    7286    out[i].imageID    = in[i].imageID;
    73     out[i].qPSF       = in[i].qPSF;
     87    out[i].psfQual    = in[i].psfQual;
    7488    out[i].psfChisq   = in[i].psfChisq;
    7589    out[i].crNsigma   = in[i].crNsigma;
     
    8296    out[i].dYccd      = in[i].dYccd;
    8397    out[i].dbFlags    = in[i].dbFlags;
    84     out[i].photFlags  = in[i].photFlags;
    85     out[i].stargal    = in[i].stargal;
    86     out[i].dophot     = in[i].dophot;
     98
     99    // changed or added for PS1_DEV_2
     100    out[i].Mgal       = in[i].Map;
     101
     102    // changed or added for PS1_V1
     103    out[i].photFlags  = in[i].photFlags & 0x0000ffff;
     104    out[i].dophot     = in[i].photFlags >> 16;
    87105  }
    88106  return (out);
     
    101119    out[i].D             = in[i].D;     
    102120    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;
    108121    out[i].dR            = in[i].dR;
    109122    out[i].dD            = in[i].dD;
     
    116129    out[i].objID         = in[i].objID;
    117130    out[i].catID         = in[i].catID;
     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;
    118145  }
    119146  return (out);
     
    129156
    130157  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;
     158    out[i].R             = in[i].R;     
     159    out[i].D             = in[i].D;     
     160    out[i].Xp            = in[i].Xp;     
     161    out[i].dR            = in[i].dR;
     162    out[i].dD            = in[i].dD;
     163    out[i].uR            = in[i].uR;
     164    out[i].uD            = in[i].uD;
     165    out[i].duR           = in[i].duR;
     166    out[i].duD           = in[i].duD;
     167    out[i].P             = in[i].P;
     168    out[i].dP            = in[i].dP;
     169    out[i].objID         = in[i].objID;
     170    out[i].catID         = in[i].catID;
     171
     172    // changed or added for PS1_DEV_2
     173    out[i].Nm            = in[i].Nmeasure;     
     174    out[i].Nn            = in[i].Nmissing;     
     175    out[i].offset        = in[i].measureOffset;
     176    out[i].missing       = in[i].missingOffset;
     177
     178    // changed or added for PS1_V1
     179    out[i].code          = in[i].flags;   
    149180  }
    150181  return (out);
     
    164195    out[i].Ncode = in[i].Ncode;
    165196    out[i].Nused = in[i].Nused;
     197
     198    // changed or added for PS1_V1
     199    out[i].M_20  = 0;     
     200    out[i].M_80  = 0;     
    166201 }
    167202  return (out);
     
    218253    out[i].fwhm_y           = in[i].fwhm_y;
    219254    out[i].trate            = in[i].trate;
    220     out[i].code             = in[i].code;
    221255    out[i].ccdnum           = in[i].ccdnum;
    222256    out[i].imageID          = in[i].imageID;
     
    237271    out[i].Mxyyy            = in[i].Mxyyy;
    238272    out[i].Myyyy            = in[i].Myyyy;
     273
     274    // changed or added for PS1_DEV_2
     275    out[i].externID         = 0;
     276    out[i].sourceID         = 0;
     277
     278    // changed or added for PS1_V1
     279    out[i].flags            = in[i].code;
     280    out[i].parentID         = 0;
    239281  }
    240282  return (out);
     
    275317    out[i].fwhm_y           = in[i].fwhm_y;
    276318    out[i].trate            = in[i].trate;
    277     out[i].code             = in[i].code;
    278319    out[i].ccdnum           = in[i].ccdnum;
    279320    out[i].imageID          = in[i].imageID;
     
    294335    out[i].Mxyyy            = in[i].Mxyyy;
    295336    out[i].Myyyy            = in[i].Myyyy;
     337
     338    // changed or added for PS1_V1
     339    out[i].code             = in[i].flags;
     340  }
     341  return (out);
     342}
     343
     344PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {
     345
     346  int i;
     347  PhotCode *out;
     348
     349  ALLOCATE (out, PhotCode, Nvalues);
     350
     351  for (i = 0; i < Nvalues; i++) {
     352    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     353    out[i].name[31] = 0; // force termination
     354
     355    out[i].code  = in[i].code;         
     356    out[i].type  = in[i].type;         
     357    out[i].C     = in[i].C;           
     358    out[i].dC    = in[i].dC;           
     359    out[i].dX    = in[i].dX;           
     360    out[i].K     = in[i].K;           
     361    out[i].c1    = in[i].c1;           
     362    out[i].c2    = in[i].c2;           
     363    out[i].equiv = in[i].equiv;       
     364    out[i].Nc    = in[i].Nc;           
     365    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     366
     367    out[i].astromErrMagScale = in[i].astromErrMagScale;
     368    out[i].photomErrSys      = in[i].photomErrSys;
     369
     370    // changed or added for PS1_DEV_2
     371    out[i].astromErrSys      = 0.0;
     372    out[i].astromErrScale    = 0.0;
     373
     374    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     375    out[i].photomPoorMask      = 0;
     376    out[i].photomBadMask       = 0;
     377    out[i].astromPoorMask      = 0;
     378    out[i].astromBadMask       = 0;
    296379  }
    297380  return (out);
     
    323406    out[i].astromErrMagScale = out[i].astromErrMagScale;
    324407    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 }
     408  }
     409  return (out);
     410}
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r19185 r21508  
    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;
    43     out[i].stargal    = in[i].stargal;
    44     out[i].dophot     = in[i].dophot;
     42
     43    // changed or added for PS1_V1
     44    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
     45    out[i].t_msec     = 0;
     46    out[i].extID      = 0;
     47    out[i].objID      = 0;
     48    out[i].catID      = 0;
     49    out[i].Mxx        = 0.0;
     50    out[i].Mxy        = 0.0;
     51    out[i].Myy        = 0.0;
     52    out[i].posangle   = 0;
     53    out[i].pltscale   = 0;
     54    out[i].psfNdof    = 0;
     55    out[i].psfNpix    = 0;
    4556  }
    4657  return (out);
     
    7384    out[i].detID      = in[i].detID;
    7485    out[i].imageID    = in[i].imageID;
    75     out[i].qPSF       = in[i].qPSF;
     86    out[i].psfQual    = in[i].psfQual;
    7687    out[i].psfChisq   = in[i].psfChisq;
    7788    out[i].crNsigma   = in[i].crNsigma;
     
    8495    out[i].dYccd      = in[i].dYccd;
    8596    out[i].dbFlags    = in[i].dbFlags;
    86     out[i].photFlags  = in[i].photFlags;
    87     out[i].stargal    = in[i].stargal;
    88     out[i].dophot     = in[i].dophot;
     97
     98    // changed or added for PS1_V1
     99    out[i].photFlags  = in[i].photFlags & 0x0000ffff;
     100    out[i].dophot     = in[i].photFlags >> 16;
    89101  }
    90102  return (out);
     
    114126    out[i].Nmissing      = in[i].Nmissing;     
    115127    out[i].Nextend       = in[i].Nextend;     
    116     out[i].code          = in[i].code;   
    117128    out[i].measureOffset = in[i].measureOffset;
    118129    out[i].missingOffset = in[i].missingOffset;
     
    120131    out[i].objID         = in[i].objID;
    121132    out[i].catID         = in[i].catID;
     133
     134    // changed or added for PS1_V1
     135    out[i].flags         = in[i].code;   
     136    out[i].ChiSq         = 0.0;
     137    out[i].Npos          = 0.0;
     138    out[i].extID         = 0;
    122139  }
    123140  return (out);
     
    147164    out[i].Nmissing      = in[i].Nmissing;     
    148165    out[i].Nextend       = in[i].Nextend;     
    149     out[i].code          = in[i].code;   
    150166    out[i].measureOffset = in[i].measureOffset;
    151167    out[i].missingOffset = in[i].missingOffset;
     
    153169    out[i].objID         = in[i].objID;
    154170    out[i].catID         = in[i].catID;
     171
     172    // changed or added for PS1_V1
     173    out[i].code          = in[i].flags;   
    155174  }
    156175  return (out);
     
    170189    out[i].Ncode = in[i].Ncode;
    171190    out[i].Nused = in[i].Nused;
     191
     192    // changed or added for PS1_V1
     193    out[i].M_20  = 0;     
     194    out[i].M_80  = 0;     
    172195 }
    173196  return (out);
     
    201224    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    202225
    203     strncpy (out[i].name, in[i].name, 63); // out[128], int[64]
     226    strncpy (out[i].name, in[i].name, 63); // out[121], int[64]
    204227    out[i].name[63] = 0; // force termination
    205228
     
    224247    out[i].fwhm_y           = in[i].fwhm_y;
    225248    out[i].trate            = in[i].trate;
    226     out[i].code             = in[i].code;
    227249    out[i].ccdnum           = in[i].ccdnum;
    228250    out[i].imageID          = in[i].imageID;
     
    245267    out[i].Mxyyy            = in[i].Mxyyy;
    246268    out[i].Myyyy            = in[i].Myyyy;
     269
     270    // changed or added for PS1_V1
     271    out[i].flags            = in[i].code;
     272    out[i].parentID         = 0;
    247273  }
    248274  return (out);
     
    259285    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    260286
    261     strncpy (out[i].name, in[i].name, 63); // in[128], out[64]
     287    strncpy (out[i].name, in[i].name, 63); // in[121], out[64]
    262288    out[i].name[63] = 0; // force termination
    263289
     
    282308    out[i].fwhm_y           = in[i].fwhm_y;
    283309    out[i].trate            = in[i].trate;
    284     out[i].code             = in[i].code;
    285310    out[i].ccdnum           = in[i].ccdnum;
    286311    out[i].imageID          = in[i].imageID;
     
    303328    out[i].Mxyyy            = in[i].Mxyyy;
    304329    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);
     330
     331    // changed or added for PS1_V1
     332    out[i].code             = in[i].flags;
     333  }
     334  return (out);
     335}
     336
     337PhotCode *PhotCode_PS1_DEV_2_To_Internal (PhotCode_PS1_DEV_2 *in, int Nvalues) {
     338
     339  int i;
     340  PhotCode *out;
     341
     342  ALLOCATE (out, PhotCode, Nvalues);
    315343
    316344  for (i = 0; i < Nvalues; i++) {
     
    334362    out[i].astromErrMagScale = in[i].astromErrMagScale;
    335363    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);
     364
     365    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     366    out[i].photomPoorMask      = 0;
     367    out[i].photomBadMask       = 0;
     368    out[i].astromPoorMask      = 0;
     369    out[i].astromBadMask       = 0;
     370  }
     371  return (out);
     372}
     373
     374PhotCode_PS1_DEV_2 *PhotCode_Internal_To_PS1_DEV_2 (PhotCode *in, int Nvalues) {
     375
     376  int i;
     377  PhotCode_PS1_DEV_2 *out;
     378
     379  ALLOCATE (out, PhotCode_PS1_DEV_2, Nvalues);
    346380
    347381  for (i = 0; i < Nvalues; i++) {
     
    365399    out[i].astromErrMagScale = in[i].astromErrMagScale;
    366400    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 }
     401  }
     402  return (out);
     403}
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c

    r19185 r21508  
    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 }
  • trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r19185 r21508  
    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;
    40     out[i].stargal   = 0;
    4135    out[i].Sky       = 0;
    4236    out[i].dSky      = 0;
    43     out[i].qPSF      = 0;
     37    out[i].psfQual   = 0;
    4438    out[i].psfChisq  = 0;
    4539    out[i].crNsigma  = 0;
    4640    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;
     41    out[i].detID     = 0;  // determine on-the-fly
     42    out[i].imageID   = 0;  // determine on-the-fly
     43
     44    // changed or added for PS1_DEV_1 (2008.02.26)
     45    out[i].dbFlags    = in[i].flags;
     46    out[i].detID      = 0;
     47    out[i].imageID    = 0;
     48
     49    // changed or added for PS1_DEV_2
     50    out[i].Map        = in[i].Mgal;
     51    out[i].dMcal      = 0;
     52
     53    // changed or added for PS1_V1
     54    out[i].photFlags  = in[i].dophot << 16;
     55    out[i].t_msec     = 0;
     56    out[i].extID      = 0;
     57    out[i].objID      = 0;
     58    out[i].catID      = 0;
     59    out[i].Mxx        = 0.0;
     60    out[i].Mxy        = 0.0;
     61    out[i].Myy        = 0.0;
     62    out[i].posangle   = 0;
     63    out[i].pltscale   = 0;
     64    out[i].psfNdof    = 0;
     65    out[i].psfNpix    = 0;
    5266  }
    5367  return (out);
     
    6377
    6478  for (i = 0; i < Nvalues; i++) {
     79    out[i].FWx     = in[i].FWx;
     80    out[i].t       = in[i].t;
     81    out[i].averef  = in[i].averef;
     82
     83    // changed for PANSTARRS_DEV_0
    6584    out[i].dR       = isnan(in[i].dR     ) ? NAN_S_SHORT : in[i].dR      *  100.0;
    6685    out[i].dD       = isnan(in[i].dD     ) ? NAN_S_SHORT : in[i].dD      *  100.0;
     
    7190    out[i].Mgal     = isnan(in[i].Map    ) ? NAN_S_SHORT : in[i].Map     * 1000.0;
    7291    out[i].airmass  = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0;
     92    out[i].fwy      = in[i].FWy * 100.0 / in[i].FWx;
     93    out[i].theta    = in[i].theta*(0x100/ 0x10000);
     94    out[i].source   = in[i].photcode;
    7395
    7496    if (out[i].M < 0) {
     
    7698    }
    7799
    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;
     100    // changed or added for PS1_DEV_1 (2008.02.26)
    85101    out[i].flags   = in[i].dbFlags;
     102
     103    // changed or added for PS1_V1
     104    out[i].dophot  = in[i].photFlags >> 16;
    86105  }
    87106  return (out);
     
    101120    out[i].D             = in[i].D;     
    102121    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 */
     122
     123    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     124    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     125    primary[0][i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;     
     126    primary[0][i].Xm    = in[i].Xm;     
     127
     128    primary[0][i].Ncode = 0;     
     129    primary[0][i].Nused = 0;
     130
     131    // added for PANSTARRS_DEV_0
    110132    out[i].dR      = 0;
    111133    out[i].dD      = 0;
     
    116138    out[i].P       = 0;
    117139    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;
     140    out[i].objID   = 0; // determine on-the-fly
     141    out[i].catID   = 0; // determine on-the-fly
     142
     143    // changed or added for PS1_DEV_2
     144    out[i].Nmeasure      = in[i].Nm;     
     145    out[i].Nmissing      = in[i].Nn;     
     146    out[i].measureOffset = in[i].offset;
     147    out[i].missingOffset = in[i].missing;
     148    out[i].Nextend       = 0;
     149    out[i].extendOffset  = 0;
     150
     151    // changed or added for PS1_V1
     152    out[i].flags         = in[i].code;   
     153    out[i].ChiSq         = 0.0;
     154    out[i].Npos          = 0.0;
     155    out[i].extID         = 0;
    128156  }
    129157  return (out);
     
    142170    out[i].D       = in[i].D;     
    143171    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 
     172
     173    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
    150174    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
    151175    out[i].dM      = isnan(primary[i].dM) ? NAN_S_SHORT : primary[i].dM  * 1000.0;
    152176    out[i].Xm      = primary[i].Xm;     
     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;   
    153186  }
    154187  return (out);
     
    164197
    165198  for (i = 0; i < Nvalues; i++) {
     199    out[i].Xm    = in[i].Xm;     
     200
     201    // added or changed for PANSTARRS_DEV_0
    166202    out[i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M   * 0.001;
    167203    out[i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM  * 0.001;
    168     out[i].Xm    = in[i].Xm;     
    169204    out[i].Ncode = 0;
    170205    out[i].Nused = 0;
     206
     207    // changed or added for PS1_V1
     208    out[i].M_20  = 0;     
     209    out[i].M_80  = 0;     
    171210  }
    172211  return (out);
     
    182221
    183222  for (i = 0; i < Nvalues; i++) {
     223    out[i].Xm    = in[i].Xm;     
     224
     225    // added or changed for PANSTARRS_DEV_0
    184226    out[i].M     = isnan(in[i].M)  ? NAN_S_SHORT : in[i].M   * 1000.0;
    185227    out[i].dM    = isnan(in[i].dM) ? NAN_S_SHORT : in[i].dM  * 1000.0;
    186     out[i].Xm    = in[i].Xm;     
    187228  }
    188229  return (out);
     
    207248    out[i].NX               = in[i].NX;
    208249    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;
    214250    out[i].Xm               = in[i].Xm;
    215251    out[i].photcode         = in[i].source;
     
    221257    out[i].fwhm_y           = in[i].fwhm_y;
    222258    out[i].trate            = in[i].trate;
    223     out[i].code             = in[i].code;
    224259    out[i].ccdnum           = in[i].ccdnum;
    225260
     
    240275    out[i].Myyyy            = in[i].Myyyy;
    241276
    242     /* XXX add these later */
    243     out[i].imageID = 0;
    244 
    245     // not available in ELIXIR
     277    // added or changed for PANSTARRS_DEV_0
     278    out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
     279    out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
     280    out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
     281    out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
     282    out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
    246283    out[i].sidtime          = NAN;
    247284    out[i].latitude         = NAN;
     285    out[i].imageID          = 0; // determine on-the-fly
     286
     287    // changed or added for PS1_DEV_2
     288    out[i].externID         = 0;
     289    out[i].sourceID         = 0;
     290
     291    // changed or added for PS1_V1
     292    out[i].flags            = in[i].code;
     293    out[i].parentID         = 0;
    248294  }
    249295  return (out);
     
    268314    out[i].NX               = in[i].NX;
    269315    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;
     316
    275317    out[i].Xm               = in[i].Xm;
    276318    out[i].source           = in[i].photcode;
     
    282324    out[i].fwhm_y           = in[i].fwhm_y;
    283325    out[i].trate            = in[i].trate;
    284     out[i].code             = in[i].code;
    285326    out[i].ccdnum           = in[i].ccdnum;
    286327
     
    300341    out[i].Mxyyy            = in[i].Mxyyy;
    301342    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);
     343
     344    // added or changed for PANSTARRS_DEV_0
     345    out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
     346    out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
     347    out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
     348    out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
     349    out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     350
     351    // changed or added for PS1_V1
     352    out[i].code             = in[i].flags;
     353  }
     354  return (out);
     355}
     356
     357PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) {
     358
     359  int i;
     360  PhotCode *out;
     361
     362  ALLOCATE (out, PhotCode, Nvalues);
    312363
    313364  for (i = 0; i < Nvalues; i++) {
     
    326377    out[i].Nc    = in[i].Nc;           
    327378    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);
     379
     380    // changed or added for PS1_DEV_1
     381    out[i].astromErrMagScale = 0.0;
     382    out[i].photomErrSys      = 0.0;
     383
     384    // changed or added for PS1_DEV_2
     385    out[i].astromErrSys      = 0.0;
     386    out[i].astromErrScale    = 0.0;
     387
     388    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     389    out[i].photomPoorMask      = 0;
     390    out[i].photomBadMask       = 0;
     391    out[i].astromPoorMask      = 0;
     392    out[i].astromBadMask       = 0;
     393  }
     394  return (out);
     395}
     396
     397PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) {
     398
     399  int i;
     400  PhotCode_Elixir *out;
     401
     402  ALLOCATE (out, PhotCode_Elixir, Nvalues);
    338403
    339404  for (i = 0; i < Nvalues; i++) {
     
    352417    out[i].Nc    = in[i].Nc;           
    353418    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 }
     419  }
     420  return (out);
     421}
  • trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r19185 r21508  
    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;
    36     out[i].stargal   = 0;
    3739    out[i].Sky       = 0;
    3840    out[i].dSky      = 0;
    39     out[i].qPSF      = 0;
     41    out[i].psfQual   = 0;
    4042    out[i].psfChisq  = 0;
    4143    out[i].crNsigma  = 0;
    4244    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;
     45    out[i].detID     = 0;  // determine on-the-fly
     46    out[i].imageID   = 0;  // determine on-the-fly
     47
     48    // changed or added for PS1_DEV_1 (2008.02.26)
     49    out[i].detID      = 0;
     50    out[i].imageID    = 0;
     51
     52    // changed or added for PS1_DEV_2
     53    out[i].dMcal      = 0;
     54
     55    // changed or added for PS1_V1
     56    out[i].photFlags  = in[i].dophot << 16;
     57    out[i].t_msec     = 0;
     58    out[i].extID      = 0;
     59    out[i].objID      = 0;
     60    out[i].catID      = 0;
     61    out[i].Mxx        = 0.0;
     62    out[i].Mxy        = 0.0;
     63    out[i].Myy        = 0.0;
     64    out[i].posangle   = 0;
     65    out[i].pltscale   = 0;
     66    out[i].psfNdof    = 0;
     67    out[i].psfNpix    = 0;
    5468  }
    5569  return (out);
     
    6579
    6680  for (i = 0; i < Nvalues; i++) {
     81
     82    // changed for PANSTARRS_DEV_0
    6783    out[i].dR     = isnan(in[i].dR     ) ? NAN_S_SHORT : in[i].dR      *  100.0;
    6884    out[i].dD     = isnan(in[i].dD     ) ? NAN_S_SHORT : in[i].dD      *  100.0;
     
    7086    out[i].dM     = isnan(in[i].dM     ) ? NAN_U_CHAR  : in[i].dM      * 1000.0;
    7187    out[i].Mcal   = isnan(in[i].Mcal   ) ? NAN_S_SHORT : in[i].Mcal    * 1000.0;
    72     out[i].dophot = in[i].dophot;
    7388    out[i].source = in[i].photcode;
    7489    out[i].t      = in[i].t;
     
    7691    /* flags and averef are merged in Loneos */
    7792    out[i].averef =  (in[i].averef & 0x00ffffff) | (in[i].dbFlags << 24);
     93
     94    // changed or added for PS1_V1
     95    out[i].dophot  = in[i].photFlags >> 16;
    7896  }
    7997  return (out);
     
    93111    out[i].D             = in[i].D;     
    94112    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 */
     113
     114    // added for ELIXIR
     115    primary[0][i].dM    = NAN;
     116
     117    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     118    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     119    primary[0][i].Xm    = in[i].Xm;     
     120    primary[0][i].Ncode = 0;     
     121    primary[0][i].Nused = 0;
     122
     123    // added for PANSTARRS_DEV_0
    102124    out[i].dR      = 0;
    103125    out[i].dD      = 0;
     
    108130    out[i].P       = 0;
    109131    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;
     132    out[i].objID   = 0; // determine on-the-fly
     133    out[i].catID   = 0; // determine on-the-fly
     134
     135    // changed or added for PS1_DEV_2
     136    out[i].Nmeasure      = in[i].Nm;     
     137    out[i].Nmissing      = in[i].Nn;     
     138    out[i].measureOffset = in[i].offset;
     139    out[i].missingOffset = in[i].missing;
     140    out[i].Nextend       = 0;
     141    out[i].extendOffset  = 0;
     142
     143    // changed or added for PS1_V1
     144    out[i].flags         = in[i].code;   
     145    out[i].ChiSq         = 0.0;
     146    out[i].Npos          = 0.0;
     147    out[i].extID         = 0;
    120148  }
    121149  return (out);
     
    134162    out[i].D       = in[i].D;     
    135163    out[i].Xp      = in[i].Xp;     
     164
     165    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     166    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
     167    out[i].Xm      = primary[i].Xm;     
     168
     169    // changed or added for PS1_DEV_2
    136170    out[i].Nm      = in[i].Nmeasure;     
    137171    out[i].Nn      = in[i].Nmissing;     
    138     out[i].code    = in[i].code;   
    139172    out[i].offset  = in[i].measureOffset;
    140173    out[i].missing = in[i].missingOffset;
    141174
    142     out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
    143     out[i].Xm      = primary[i].Xm;     
     175    // changed or added for PS1_V1
     176    out[i].code    = in[i].flags;   
    144177  }
    145178  return (out);
     
    155188
    156189  for (i = 0; i < Nvalues; i++) {
     190    out[i].Xm    = in[i].Xm;     
     191
     192    // added for ELIXIR
     193    out[i].dM    = NAN;
     194
     195    // added or changed for PANSTARRS_DEV_0
    157196    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;
    160197    out[i].Ncode = 0;
    161198    out[i].Nused = 0;
     199
     200    // changed or added for PS1_V1
     201    out[i].M_20  = 0;     
     202    out[i].M_80  = 0;     
    162203  }
    163204  return (out);
     
    173214
    174215  for (i = 0; i < Nvalues; i++) {
     216    out[i].Xm   = in[i].Xm;     
     217
     218    // added or changed for PANSTARRS_DEV_0
    175219    out[i].M    = isnan(in[i].M)  ? NAN_S_SHORT : in[i].M * 1000.0;
    176     out[i].Xm   = in[i].Xm;     
    177220  }
    178221  return (out);
     
    197240    out[i].NX               = in[i].NX;
    198241    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;
    205242
    206243    out[i].Xm               = in[i].Xm;
     
    213250    out[i].fwhm_y           = in[i].fwhm_y;
    214251    out[i].trate            = in[i].trate;
    215     out[i].code             = in[i].code;
    216252    out[i].ccdnum           = in[i].ccdnum;
     253
    217254    out[i].order            = in[i].order;
    218255    out[i].Mx               = in[i].Mx;
     
    231268    out[i].Myyyy            = in[i].Myyyy;
    232269
    233     /* XXX add these later */
    234     out[i].imageID = 0;
     270    // added or changed for PANSTARRS_DEV_0
     271    out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
     272    out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
     273    out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
     274    out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
     275    out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
     276    out[i].sidtime          = NAN;
     277    out[i].latitude         = NAN;
     278    out[i].imageID          = 0; // determine on-the-fly
     279
     280    // changed or added for PS1_DEV_2
     281    out[i].externID         = 0;
     282    out[i].sourceID         = 0;
     283
     284    // changed or added for PS1_V1
     285    out[i].flags            = in[i].code;
     286    out[i].parentID         = 0;
    235287  }
    236288  return (out);
     
    255307    out[i].NX               = in[i].NX;
    256308    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;
    263309
    264310    out[i].Xm               = in[i].Xm;
     
    271317    out[i].fwhm_y           = in[i].fwhm_y;
    272318    out[i].trate            = in[i].trate;
    273     out[i].code             = in[i].code;
    274319    out[i].ccdnum           = in[i].ccdnum;
     320
    275321    out[i].order            = in[i].order;
    276322    out[i].Mx               = in[i].Mx;
     
    288334    out[i].Mxyyy            = in[i].Mxyyy;
    289335    out[i].Myyyy            = in[i].Myyyy;
    290   }
    291   return (out);
    292 }
     336
     337    // added or changed for PANSTARRS_DEV_0
     338    out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
     339    out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
     340    out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
     341    out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
     342    out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     343
     344    // changed or added for PS1_V1
     345    out[i].code             = in[i].flags;
     346  }
     347  return (out);
     348}
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r19185 r21508  
    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;
    3429    out[i].dXccd      = in[i].dXccd;
    3530    out[i].dYccd      = in[i].dYccd;
    36     out[i].stargal    = in[i].stargal;
    3731    out[i].Sky        = in[i].Sky;
    3832    out[i].dSky       = in[i].dSky;
    39     out[i].qPSF       = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF;
     33
     34    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     35    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     36
     37    // changed or added for PS1_DEV_1 (2008.02.26)
     38    out[i].psfQual    = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual;
     39    out[i].dbFlags    = in[i].flags;
    4040    out[i].detID      = in[i].detID_lo;
    4141    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;
     42    out[i].psfChisq   = 0;
     43    out[i].crNsigma   = 0;
     44    out[i].extNsigma  = 0;
     45
     46    // changed or added for PS1_DEV_2
     47    out[i].Map        = in[i].Mgal;
     48    out[i].dMcal      = 0;
     49
     50    // changed or added for PS1_V1
     51    out[i].photFlags  = in[i].dophot << 16;
     52    out[i].t_msec     = 0;
     53    out[i].extID      = 0;
     54    out[i].objID      = 0;
     55    out[i].catID      = 0;
     56    out[i].Mxx        = 0.0;
     57    out[i].Mxy        = 0.0;
     58    out[i].Myy        = 0.0;
     59    out[i].posangle   = 0;
     60    out[i].pltscale   = 0;
     61    out[i].psfNdof    = 0;
     62    out[i].psfNpix    = 0;
    4863  }
    4964  return (out);
     
    6479    out[i].dM         = in[i].dM;
    6580    out[i].Mcal       = in[i].Mcal;
    66     out[i].Mgal       = in[i].Map;
    6781    out[i].airmass    = in[i].airmass;
    6882    out[i].az         = in[i].az;
     
    7185    out[i].FWy        = in[i].FWy;
    7286    out[i].theta      = in[i].theta;
    73     out[i].dophot     = in[i].dophot;
    7487    out[i].photcode   = in[i].photcode;
    7588    out[i].t          = in[i].t;
    7689    out[i].averef     = in[i].averef;
    77     out[i].flags      = in[i].dbFlags;
    7890    out[i].Xccd       = in[i].Xccd;
    7991    out[i].Yccd       = in[i].Yccd;
    8092    out[i].dXccd      = in[i].dXccd;
    8193    out[i].dYccd      = in[i].dYccd;
    82     out[i].stargal    = in[i].stargal;
    8394    out[i].Sky        = in[i].Sky;
    8495    out[i].dSky       = in[i].dSky;
    85     out[i].qPSF       = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF;
     96
     97    // changed or added for PS1_DEV_1 (2008.02.26)
     98    out[i].flags      = in[i].dbFlags;
     99    out[i].psfQual    = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual;
    86100    out[i].detID_hi   = 0;
    87101    out[i].detID_lo   = in[i].detID;
    88102    out[i].imageID_hi = 0;
    89103    out[i].imageID_lo = in[i].imageID;
     104
     105    // changed or added for PS1_DEV_2
     106    out[i].Mgal       = in[i].Map;
     107
     108    // changed or added for PS1_V1
     109    // out[i].photFlags  = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1)
     110    out[i].dophot     = in[i].photFlags >> 16;
    90111  }
    91112  return (out);
     
    105126    out[i].D             = in[i].D;     
    106127    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;
    112128    out[i].dR            = in[i].dR;
    113129    out[i].dD            = in[i].dD;
     
    120136    out[i].objID         = in[i].objID;
    121137    out[i].catID         = in[i].catID;
     138
     139    // changed or added for PS1_DEV_2
     140    out[i].Nmeasure      = in[i].Nm;     
     141    out[i].Nmissing      = in[i].Nn;     
     142    out[i].measureOffset = in[i].offset;
     143    out[i].missingOffset = in[i].missing;
     144    out[i].Nextend       = 0;
     145    out[i].extendOffset  = 0;
     146
     147    // changed or added for PS1_V1
     148    out[i].flags         = in[i].code;   
     149    out[i].ChiSq         = 0.0;
     150    out[i].Npos          = 0.0;
     151    out[i].extID         = 0;
    122152  }
    123153  return (out);
     
    137167    out[i].D        = in[i].D;     
    138168    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;
    144169    out[i].dR       = in[i].dR;
    145170    out[i].dD       = in[i].dD;
     
    152177    out[i].objID    = in[i].objID;
    153178    out[i].catID    = in[i].catID;
     179
     180    // changed or added for PS1_DEV_2
     181    out[i].Nm       = in[i].Nmeasure;     
     182    out[i].Nn       = in[i].Nmissing;     
     183    out[i].offset   = in[i].measureOffset;
     184    out[i].missing  = in[i].missingOffset;
     185
     186    // changed or added for PS1_V1
     187    out[i].code          = in[i].flags;   
    154188  }
    155189  return (out);
     
    170204    out[i].Ncode = in[i].Ncode;
    171205    out[i].Nused = in[i].Nused;
     206
     207    // changed or added for PS1_V1
     208    out[i].M_20  = 0;     
     209    out[i].M_80  = 0;     
    172210 }
    173211  return (out);
     
    226264    out[i].fwhm_y           = in[i].fwhm_y;
    227265    out[i].trate            = in[i].trate;
    228     out[i].code             = in[i].code;
    229266    out[i].ccdnum           = in[i].ccdnum;
    230     out[i].imageID          = in[i].imageID_lo;
    231267
    232268    out[i].order            = in[i].order;
     
    245281    out[i].Mxyyy            = in[i].Mxyyy;
    246282    out[i].Myyyy            = in[i].Myyyy;
     283
     284    // changed or added for PS1_DEV_1
     285    out[i].imageID          = in[i].imageID_lo;
     286
     287    // changed or added for PS1_DEV_2
     288    out[i].externID         = 0;
     289    out[i].sourceID         = 0;
     290
     291    // changed or added for PS1_V1
     292    out[i].flags            = in[i].code;
     293    out[i].parentID         = 0;
    247294  }
    248295  return (out);
     
    283330    out[i].fwhm_y           = in[i].fwhm_y;
    284331    out[i].trate            = in[i].trate;
    285     out[i].code             = in[i].code;
    286332    out[i].ccdnum           = in[i].ccdnum;
    287     out[i].imageID_hi       = 0;
    288     out[i].imageID_lo       = in[i].imageID;
    289333
    290334    out[i].order            = in[i].order;
     
    303347    out[i].Mxyyy            = in[i].Mxyyy;
    304348    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
     349
     350    // changed or added for PS1_DEV_1
     351    out[i].imageID_hi       = 0;
     352    out[i].imageID_lo       = in[i].imageID;
     353
     354    // changed or added for PS1_V1
     355    out[i].code             = in[i].flags;
     356  }
     357  return (out);
     358}
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r19185 r21508  
    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;
    3429    out[i].dXccd      = in[i].dXccd;
    3530    out[i].dYccd      = in[i].dYccd;
    36     out[i].stargal    = in[i].stargal;
    3731    out[i].Sky        = in[i].Sky;
    3832    out[i].dSky       = in[i].dSky;
    39     out[i].qPSF       = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF;
     33
     34    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     35    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     36
     37    // changed or added for PS1_DEV_1 (2008.02.26)
     38    out[i].psfQual    = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual;
     39    out[i].dbFlags    = in[i].flags;
    4040    out[i].detID      = in[i].detID_lo;
    4141    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;
     42    out[i].psfChisq   = 0;
     43    out[i].crNsigma   = 0;
     44    out[i].extNsigma  = 0;
     45
     46    // changed or added for PS1_DEV_2
     47    out[i].Map        = in[i].Mgal;
     48    out[i].dMcal      = 0;
     49
     50    // changed or added for PS1_V1
     51    out[i].photFlags  = in[i].dophot << 16;
     52    out[i].t_msec     = 0;
     53    out[i].extID      = 0;
     54    out[i].objID      = 0;
     55    out[i].catID      = 0;
     56    out[i].Mxx        = 0.0;
     57    out[i].Mxy        = 0.0;
     58    out[i].Myy        = 0.0;
     59    out[i].posangle   = 0;
     60    out[i].pltscale   = 0;
     61    out[i].psfNdof    = 0;
     62    out[i].psfNpix    = 0;
    4863  }
    4964  return (out);
     
    6479    out[i].dM         = in[i].dM;
    6580    out[i].Mcal       = in[i].Mcal;
    66     out[i].Mgal       = in[i].Map;
    6781    out[i].airmass    = in[i].airmass;
    6882    out[i].az         = in[i].az;
     
    7185    out[i].FWy        = in[i].FWy;
    7286    out[i].theta      = in[i].theta;
    73     out[i].dophot     = in[i].dophot;
    7487    out[i].photcode   = in[i].photcode;
    7588    out[i].t          = in[i].t;
    7689    out[i].averef     = in[i].averef;
    77     out[i].flags      = in[i].dbFlags;
    7890    out[i].Xccd       = in[i].Xccd;
    7991    out[i].Yccd       = in[i].Yccd;
    8092    out[i].dXccd      = in[i].dXccd;
    8193    out[i].dYccd      = in[i].dYccd;
    82     out[i].stargal    = in[i].stargal;
    8394    out[i].Sky        = in[i].Sky;
    8495    out[i].dSky       = in[i].dSky;
    85     out[i].qPSF       = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF;
     96
     97    // changed or added for PS1_DEV_1 (2008.02.26)
     98    out[i].flags      = in[i].dbFlags;
     99    out[i].psfQual    = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual;
    86100    out[i].detID_hi   = 0;
    87101    out[i].detID_lo   = in[i].detID;
    88102    out[i].imageID_hi = 0;
    89103    out[i].imageID_lo = in[i].imageID;
     104
     105    // changed or added for PS1_DEV_2
     106    out[i].Mgal       = in[i].Map;
     107
     108    // changed or added for PS1_V1
     109    // out[i].photFlags  = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1)
     110    out[i].dophot     = in[i].photFlags >> 16;
    90111  }
    91112  return (out);
     
    105126    out[i].D             = in[i].D;     
    106127    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;
    112128    out[i].dR            = in[i].dR;
    113129    out[i].dD            = in[i].dD;
     
    120136    out[i].objID         = in[i].objID;
    121137    out[i].catID         = in[i].catID;
     138
     139    // changed or added for PS1_DEV_2
     140    out[i].Nmeasure      = in[i].Nm;     
     141    out[i].Nmissing      = in[i].Nn;     
     142    out[i].measureOffset = in[i].offset;
     143    out[i].missingOffset = in[i].missing;
     144    out[i].Nextend       = 0;
     145    out[i].extendOffset  = 0;
     146
     147    // changed or added for PS1_V1
     148    out[i].flags         = in[i].code;   
     149    out[i].ChiSq         = 0.0;
     150    out[i].Npos          = 0.0;
     151    out[i].extID         = 0;
    122152  }
    123153  return (out);
     
    137167    out[i].D        = in[i].D;     
    138168    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;
    144169    out[i].dR       = in[i].dR;
    145170    out[i].dD       = in[i].dD;
     
    152177    out[i].objID    = in[i].objID;
    153178    out[i].catID    = in[i].catID;
     179
     180    // changed or added for PS1_DEV_2
     181    out[i].Nm       = in[i].Nmeasure;     
     182    out[i].Nn       = in[i].Nmissing;     
     183    out[i].offset   = in[i].measureOffset;
     184    out[i].missing  = in[i].missingOffset;
     185
     186    // changed or added for PS1_V1
     187    out[i].code          = in[i].flags;   
    154188  }
    155189  return (out);
     
    170204    out[i].Ncode = in[i].Ncode;
    171205    out[i].Nused = in[i].Nused;
     206
     207    // changed or added for PS1_V1
     208    out[i].M_20  = 0;     
     209    out[i].M_80  = 0;     
    172210 }
    173211  return (out);
     
    226264    out[i].fwhm_y           = in[i].fwhm_y;
    227265    out[i].trate            = in[i].trate;
    228     out[i].code             = in[i].code;
    229266    out[i].ccdnum           = in[i].ccdnum;
    230     out[i].imageID          = in[i].imageID_lo;
    231267
    232268    out[i].order            = in[i].order;
     
    245281    out[i].Mxyyy            = in[i].Mxyyy;
    246282    out[i].Myyyy            = in[i].Myyyy;
     283
     284    // changed or added for PS1_DEV_1
     285    out[i].imageID          = in[i].imageID_lo;
     286
     287    // changed or added for PS1_DEV_2
     288    out[i].externID         = 0;
     289    out[i].sourceID         = 0;
     290
     291    // changed or added for PS1_V1
     292    out[i].flags            = in[i].code;
     293    out[i].parentID         = 0;
    247294  }
    248295  return (out);
     
    283330    out[i].fwhm_y           = in[i].fwhm_y;
    284331    out[i].trate            = in[i].trate;
    285     out[i].code             = in[i].code;
    286332    out[i].ccdnum           = in[i].ccdnum;
    287     out[i].imageID_hi       = 0;
    288     out[i].imageID_lo       = in[i].imageID;
    289333
    290334    out[i].order            = in[i].order;
     
    303347    out[i].Mxyyy            = in[i].Mxyyy;
    304348    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
     349
     350    // changed or added for PS1_DEV_1
     351    out[i].imageID_hi       = 0;
     352    out[i].imageID_lo       = in[i].imageID;
     353
     354    // changed or added for PS1_V1
     355    out[i].code             = in[i].flags;
     356  }
     357  return (out);
     358}
     359
     360// XXX no photcode conversions?  this may be from before we had a photcode FITS table...
     361
  • trunk/Ohana/src/libdvo/src/dvo_image.c

    r19185 r21508  
    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;
  • trunk/Ohana/src/libdvo/src/dvo_image_raw.c

    r16810 r21508  
    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 */
  • trunk/Ohana/src/libdvo/src/dvosorts.c

    r16040 r21508  
    4646}
    4747
    48 void sort_stars_ra (Stars *stars, int N) {
    49 
    50 # define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; }
    51 # define COMPARE(A,B)(stars[A].R < stars[B].R)
    52 
    53   OHANA_SORT (N, COMPARE, SWAPFUNC);
    54 
    55 # undef SWAPFUNC
    56 # undef COMPARE
    57 
    58 }
    59 
    6048void sort_regions (SkyRegion *region, int N) {
    6149
     
    7058}
    7159
     60# if (0)
     61// deprecated along with Stars as an autocode type
     62void sort_stars_ra (Stars *stars, int N) {
     63
     64# define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; }
     65# define COMPARE(A,B)(stars[A].R < stars[B].R)
     66
     67  OHANA_SORT (N, COMPARE, SWAPFUNC);
     68
     69# undef SWAPFUNC
     70# undef COMPARE
     71
     72}
     73# endif
Note: See TracChangeset for help on using the changeset viewer.