IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 4, 2008, 12:39:41 PM (18 years ago)
Author:
eugene
Message:

merge changes from eam_branch_20080223 : updates to DVO output format, addstar (SDSS and 2MASS flags), relastro (FitChip)

Location:
trunk/Ohana/src/libdvo
Files:
2 added
2 deleted
17 edited

Legend:

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

    r16139 r16810  
    2929$(DESTINC)/panstarrs_dev_0_defs.h \
    3030$(DESTINC)/panstarrs_dev_1_defs.h \
    31 $(DESTINC)/ps1_dev_1_defs.h
     31$(DESTINC)/ps1_dev_1_defs.h \
     32$(DESTINC)/ps1_dev_2_defs.h
    3233
    3334INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h
     
    3738$(SRC)/coordops.$(ARCH).o        \
    3839$(SRC)/dvosorts.$(ARCH).o        \
    39 $(SRC)/dvo_photcode_ops.$(ARCH).o \
    40 $(SRC)/dvo_photcode_convert_elixir.$(ARCH).o \
    41 $(SRC)/dvo_photcode_convert_ps1_dev_1.$(ARCH).o \
    4240$(SRC)/dvo_photcode_ops.$(ARCH).o \
    4341$(SRC)/LoadPhotcodes.$(ARCH).o   \
     
    6462$(SRC)/dvo_convert_panstarrs_DEV_1.$(ARCH).o \
    6563$(SRC)/dvo_convert_PS1_DEV_1.$(ARCH).o \
     64$(SRC)/dvo_convert_PS1_DEV_2.$(ARCH).o \
    6665$(SRC)/skyregion_io.$(ARCH).o    \
    6766$(SRC)/skyregion_gsc.$(ARCH).o    \
  • trunk/Ohana/src/libdvo/include/dvo.h

    r16057 r16810  
    1616              DVO_FORMAT_PANSTARRS_DEV_0,
    1717              DVO_FORMAT_PANSTARRS_DEV_1,
    18               DVO_FORMAT_PS1_DEV_1
     18              DVO_FORMAT_PS1_DEV_1,
     19              DVO_FORMAT_PS1_DEV_2
    1920} DVOTableFormat;
    2021
     
    215216  struct Catalog *secfilt_catalog;              /* secfilt catalog data (split) */
    216217
     218  unsigned int objID;
     219  unsigned int catID;
     220
    217221  /* extra catalog information */
    218222  int lockmode;
     
    383387# include "panstarrs_dev_1_defs.h"
    384388# include "ps1_dev_1_defs.h"
     389# include "ps1_dev_2_defs.h"
    385390
    386391/*** DVO image db I/O Functions ***/
  • trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c

    r15694 r16810  
    5050    photcode = PhotCode_PS1_DEV_1_To_Internal (photcode_ps1_dev_1, Ncode);
    5151    free (photcode_ps1_dev_1);
     52  }
     53
     54  if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_2")) {
     55    PhotCode_PS1_DEV_2 *photcode_ps1_dev_2 = gfits_table_get_PhotCode_PS1_DEV_2 (&db.ftable, &Ncode, &db.swapped);
     56    photcode = PhotCode_PS1_DEV_2_To_Internal (photcode_ps1_dev_2, Ncode);
     57    free (photcode_ps1_dev_2);
    5258  }
    5359
  • trunk/Ohana/src/libdvo/src/LoadPhotcodesText.c

    r15694 r16810  
    2727  char *c;
    2828  char line[256], **c1_names, **c2_names, **eq_names;
    29   char name[32], type[32], Zero[32], Airmass[32], Offset[32],
    30     C1[32], C2[32], Slope[32], Color[32], Primary[32];
     29  char name[32], type[32], Zero[32], Airmass[32], Offset[32];
     30  char C1[32], C2[32], Slope[32], Color[32], Primary[32];
     31  char astromErrSys[32], astromErrScale[32], astromErrMagScale[32], photomErrSys[32];
    3132
    3233  table = GetPhotcodeTable ();
     
    6061    for (c = line; isspace (*c); c++);
    6162    if (*c == '#') continue;
    62     Nfield = sscanf (c, "%d %s %s %s %s %s %s %s %s %s %s",
    63                      &code, name, type, Zero, Airmass, Offset, C1, C2, Slope, Color, Primary);
    64 
    65     // XXX to add the AstromError (and PhotError) terms, we need to add them to the photcode structure, and
    66     // define methods to read (at least) the old and the new photcode versions.
    67 
    68     if (Nfield != 11) { continue; }
    69    
     63    Nfield = sscanf (c, "%d %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
     64                     &code, name, type, Zero, Airmass, Offset, C1, C2, Slope, Color, Primary, astromErrSys, astromErrScale, astromErrMagScale, photomErrSys);
     65
     66    switch (Nfield) {
     67      case 11:
     68        // minimum number of fields : original elixir layout
     69        strcpy (astromErrSys,      "0.0");
     70        strcpy (astromErrScale,    "0.0");
     71        strcpy (astromErrMagScale, "0.0");
     72        strcpy (photomErrSys,      "0.0");
     73        break;
     74      case 14:
     75        // allow only astrom elements
     76        strcpy (photomErrSys,      "0.0");
     77        break;
     78      case 15:
     79        // all fields defined
     80        break;
     81      default:
     82        // skip unknown layouts
     83        continue;
     84    }
     85
    7086    if (!code) {
    7187        fprintf (stderr, "photcode values may not be 0: fix %s\n", name);
     
    95111      photcode[Ncode].type  = PHOT_ALT;
    96112    }
     113
     114    photcode[Ncode].astromErrSys      = atof (astromErrSys);
     115    photcode[Ncode].astromErrScale    = atof (astromErrScale);
     116    photcode[Ncode].astromErrMagScale = atof (astromErrMagScale);
     117    photcode[Ncode].photomErrSys      = atof (photomErrSys);
    97118
    98119    switch (photcode[Ncode].type) {
  • trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c

    r15694 r16810  
    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_1 *photcode_output = PhotCode_Internal_To_PS1_DEV_1 (table[0].code, table[0].Ncode);
     31  PhotCode_PS1_DEV_2 *photcode_output = PhotCode_Internal_To_PS1_DEV_2 (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_1 (&db.ftable, photcode_output, table[0].Ncode);
     35  gfits_table_set_PhotCode_PS1_DEV_2 (&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

    r16057 r16810  
    5151  if (!strcasecmp (catformat, "PANSTARRS_DEV_1")) return (DVO_FORMAT_PANSTARRS_DEV_1);
    5252  if (!strcasecmp (catformat, "PS1_DEV_1"))       return (DVO_FORMAT_PS1_DEV_1);
     53  if (!strcasecmp (catformat, "PS1_DEV_2"))       return (DVO_FORMAT_PS1_DEV_2);
    5354  return (DVO_FORMAT_UNDEF);
    5455}
  • trunk/Ohana/src/libdvo/src/dvo_catalog_chipcoords.c

    r12332 r16810  
    5454 
    5555  for (i = 0; i < catalog[0].Naverage; i++) {
    56     m = average[i].offset;
    57     for (j = 0; j < average[i].Nm; j++, m++) {
     56    m = average[i].measureOffset;
     57    for (j = 0; j < average[i].Nmeasure; j++, m++) {
    5858      ra  = average[i].R - measure[m].dR / 3600.0;
    5959      dec = average[i].D - measure[m].dD / 3600.0;
  • trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c

    r15743 r16810  
    7373      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    7474      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     75      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    7576
    7677    default:
     
    188189  if (catalog[0].catflags & LOAD_AVES) {
    189190    for (i = Nmeas = Nmiss = 0; i < catalog[0].Naverage; i++) {
    190       Nmeas += catalog[0].average[i].Nm;
    191       Nmiss += catalog[0].average[i].Nn;
     191      Nmeas += catalog[0].average[i].Nmeasure;
     192      Nmiss += catalog[0].average[i].Nmissing;
    192193    }
    193194    if ((Nmeas != catalog[0].Nmeasure) || (Nmiss != catalog[0].Nmissing)) {
     
    256257  if (catalog[0].catformat == DVO_FORMAT_PANSTARRS_DEV_1) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_1");
    257258  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_1)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_1");
     259  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
    258260
    259261  /* rewind file pointers and truncate file */
     
    350352      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    351353      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     354      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    352355
    353356    default:
     
    395398      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    396399      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     400      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    397401
    398402    default:
     
    444448      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    445449      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     450      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    446451
    447452    default:
     
    489494      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    490495      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     496      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    491497
    492498    default:
     
    538544      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    539545      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     546      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    540547
    541548    default:
     
    583590      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    584591      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     592      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    585593
    586594    default:
  • trunk/Ohana/src/libdvo/src/dvo_convert.c

    r15487 r16810  
    4848  CONVERT_FORMAT ("DVO_AVERAGE_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    4949  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     50  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    5051# undef CONVERT_FORMAT
    5152
     
    7778      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    7879      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     80      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    7981# undef FORMAT_CASE
    8082
     
    119121  CONVERT_FORMAT ("DVO_MEASURE_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    120122  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     123  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    121124# undef CONVERT_FORMAT
    122125
     
    148151      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    149152      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     153      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    150154# undef FORMAT_CASE
    151155
     
    190194  CONVERT_FORMAT ("DVO_SECFILT_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    191195  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     196  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    192197# undef CONVERT_FORMAT
    193198
     
    219224      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    220225      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     226      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    221227# undef FORMAT_CASE
    222228
     
    281287  CONVERT_FORMAT ("DVO_IMAGE_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    282288  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     289  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    283290# undef CONVERT_FORMAT
    284291
     
    313320      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    314321      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     322      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    315323# undef FORMAT_CASE
    316324
     
    361369      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    362370      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     371      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    363372# undef FORMAT_CASE
    364373
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r15038 r16810  
    11# include <dvo.h>
    22
    3 // XXX these functions ahve to be adjusted to agree with the new definition of PS1_DEV_1
    4 
    5 /* convert panstarrs-format measures to internal measures */
     3/* convert PS1_DEV_1 formats to internal formats */
     4
    65Measure *Measure_PS1_DEV_1_ToInternal (Measure_PS1_DEV_1 *in, int Nvalues) {
    76
     
    1615    out[i].M          = in[i].M;
    1716    out[i].Mcal       = in[i].Mcal;
    18     out[i].Mgal       = in[i].Mgal;
     17    out[i].Map        = in[i].Mgal;
    1918    out[i].dM         = in[i].dM;
    2019    out[i].dt         = in[i].dt;
     
    3029    out[i].imageID    = in[i].imageID;
    3130    out[i].qPSF       = in[i].qPSF;
    32     out[i].psfProb    = in[i].psfProb;
     31    out[i].psfChisq   = in[i].psfChisq;
    3332    out[i].crNsigma   = in[i].crNsigma;
    3433    out[i].extNsigma  = in[i].extNsigma;
     
    4746}
    4847
    49 /* convert internal measures to panstarrs-format measures */
    5048Measure_PS1_DEV_1 *MeasureInternalTo_PS1_DEV_1 (Measure *in, int Nvalues) {
    5149
     
    6058    out[i].M          = in[i].M;
    6159    out[i].Mcal       = in[i].Mcal;
    62     out[i].Mgal       = in[i].Mgal;
     60    out[i].Mgal       = in[i].Map;
    6361    out[i].dM         = in[i].dM;
    6462    out[i].dt         = in[i].dt;
     
    7472    out[i].imageID    = in[i].imageID;
    7573    out[i].qPSF       = in[i].qPSF;
    76     out[i].psfProb    = in[i].psfProb;
     74    out[i].psfChisq   = in[i].psfChisq;
    7775    out[i].crNsigma   = in[i].crNsigma;
    7876    out[i].extNsigma  = in[i].extNsigma;
     
    9189}
    9290
    93 /* convert panstarrs-format averages to internal averages */
    94 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
     91// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
    9592Average *Average_PS1_DEV_1_ToInternal (Average_PS1_DEV_1 *in, int Nvalues, SecFilt **primary) {
    9693
     
    9996
    10097  ALLOCATE (out, Average, Nvalues);
     98
     99  for (i = 0; i < Nvalues; i++) {
     100    out[i].R             = in[i].R;     
     101    out[i].D             = in[i].D;     
     102    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    out[i].dR            = in[i].dR;
     109    out[i].dD            = in[i].dD;
     110    out[i].uR            = in[i].uR;
     111    out[i].uD            = in[i].uD;
     112    out[i].duR           = in[i].duR;
     113    out[i].duD           = in[i].duD;
     114    out[i].P             = in[i].P;
     115    out[i].dP            = in[i].dP;
     116    out[i].objID         = in[i].objID;
     117    out[i].catID         = in[i].catID;
     118  }
     119  return (out);
     120}
     121
     122// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
     123Average_PS1_DEV_1 *AverageInternalTo_PS1_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
     124
     125  int i;
     126  Average_PS1_DEV_1 *out;
     127
     128  ALLOCATE (out, Average_PS1_DEV_1, Nvalues);
    101129
    102130  for (i = 0; i < Nvalues; i++) {
     
    104132    out[i].D        = in[i].D;     
    105133    out[i].Xp       = in[i].Xp;     
    106     out[i].Nm       = in[i].Nm;     
    107     out[i].Nn       = in[i].Nn;     
     134    out[i].Nm       = in[i].Nmeasure;     
     135    out[i].Nn       = in[i].Nmissing;     
    108136    out[i].code     = in[i].code;   
    109     out[i].offset   = in[i].offset;
    110     out[i].missing  = in[i].missing;
     137    out[i].offset   = in[i].measureOffset;
     138    out[i].missing  = in[i].missingOffset;
    111139    out[i].dR       = in[i].dR;
    112140    out[i].dD       = in[i].dD;
     
    117145    out[i].P        = in[i].P;
    118146    out[i].dP       = in[i].dP;
    119     out[i].objID_hi = in[i].objID_hi;
    120     out[i].objID_lo = in[i].objID_lo;
    121   }
    122   return (out);
    123 }
    124 
    125 /* convert internal averages to panstarrs-format averages */
    126 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
    127 Average_PS1_DEV_1 *AverageInternalTo_PS1_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
    128 
    129   int i;
    130   Average_PS1_DEV_1 *out;
    131 
    132   ALLOCATE (out, Average_PS1_DEV_1, Nvalues);
    133 
    134   for (i = 0; i < Nvalues; i++) {
    135     out[i].R        = in[i].R;     
    136     out[i].D        = in[i].D;     
    137     out[i].Xp       = in[i].Xp;     
    138     out[i].Nm       = in[i].Nm;     
    139     out[i].Nn       = in[i].Nn;     
    140     out[i].code     = in[i].code;   
    141     out[i].offset   = in[i].offset;
    142     out[i].missing  = in[i].missing;
    143     out[i].dR       = in[i].dR;
    144     out[i].dD       = in[i].dD;
    145     out[i].uR       = in[i].uR;
    146     out[i].uD       = in[i].uD;
    147     out[i].duR      = in[i].duR;
    148     out[i].duD      = in[i].duD;
    149     out[i].P        = in[i].P;
    150     out[i].dP       = in[i].dP;
    151     out[i].objID_hi = in[i].objID_hi;
    152     out[i].objID_lo = in[i].objID_lo;
    153   }
    154   return (out);
    155 }
    156 
    157 /* convert panstarrs-format secfilts to internal secfilts */
     147    out[i].objID    = in[i].objID;
     148    out[i].catID    = in[i].catID;
     149  }
     150  return (out);
     151}
     152
    158153SecFilt *SecFilt_PS1_DEV_1_ToInternal (SecFilt_PS1_DEV_1 *in, int Nvalues) {
    159154
     
    173168}
    174169
    175 /* convert internal secfilts to panstarrs-format secfilts */
    176170SecFilt_PS1_DEV_1 *SecFiltInternalTo_PS1_DEV_1 (SecFilt *in, int Nvalues) {
    177171
     
    191185}
    192186
    193 /* convert panstarrs-format images to internal images */
    194187Image *Image_PS1_DEV_1_ToInternal (Image_PS1_DEV_1 *in, int Nvalues) {
    195188
     
    300293  return (out);
    301294}
     295
     296PhotCode_PS1_DEV_1 *PhotCode_Internal_To_PS1_DEV_1 (PhotCode *in, int Nvalues) {
     297
     298  int i;
     299  PhotCode_PS1_DEV_1 *out;
     300
     301  ALLOCATE (out, PhotCode_PS1_DEV_1, Nvalues);
     302
     303  for (i = 0; i < Nvalues; i++) {
     304    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     305    out[i].name[31] = 0; // force termination
     306
     307    out[i].code = in[i].code;         
     308    out[i].type = in[i].type;         
     309    out[i].C    = in[i].C;           
     310    out[i].dC   = in[i].dC;           
     311    out[i].dX   = in[i].dX;           
     312    out[i].K    = in[i].K;           
     313    out[i].c1   = in[i].c1;           
     314    out[i].c2   = in[i].c2;           
     315    out[i].equiv = in[i].equiv;       
     316    out[i].Nc = in[i].Nc;           
     317    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     318
     319    out[i].astromErrMagScale = out[i].astromErrMagScale;
     320    out[i].photomErrSys      = out[i].photomErrSys;
     321
     322  }
     323  return (out);
     324}
     325
     326PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {
     327
     328  int i;
     329  PhotCode *out;
     330
     331  ALLOCATE (out, PhotCode, Nvalues);
     332
     333  for (i = 0; i < Nvalues; i++) {
     334    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     335    out[i].name[31] = 0; // force termination
     336
     337    out[i].code  = in[i].code;         
     338    out[i].type  = in[i].type;         
     339    out[i].C     = in[i].C;           
     340    out[i].dC    = in[i].dC;           
     341    out[i].dX    = in[i].dX;           
     342    out[i].K     = in[i].K;           
     343    out[i].c1    = in[i].c1;           
     344    out[i].c2    = in[i].c2;           
     345    out[i].equiv = in[i].equiv;       
     346    out[i].Nc    = in[i].Nc;           
     347
     348    // not defined in PS1_DEV_1
     349    out[i].astromErrSys      = 0.0;
     350    out[i].astromErrScale    = 0.0;
     351    out[i].astromErrMagScale = in[i].astromErrMagScale;
     352    out[i].photomErrSys      = in[i].photomErrSys;
     353
     354    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     355
     356  }
     357  return (out);
     358}
  • trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r15511 r16810  
    1616    out[i].dt       = (in[i].dt      == NAN_S_SHORT) ? NAN : in[i].dt     * 0.001;
    1717    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
    18     out[i].Mgal     = (in[i].Mgal    == NAN_S_SHORT) ? NAN : in[i].Mgal   * 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
     21    out[i].Map      = (in[i].Mgal    == NAN_S_SHORT) ? NAN : in[i].Mgal   * 0.001;
    1922    out[i].airmass  = (in[i].airmass == NAN_S_SHORT) ? NAN : in[i].airmass* 0.001;
    2023    out[i].FWx      = in[i].FWx;
     
    3942    out[i].dSky      = 0;
    4043    out[i].qPSF      = 0;
    41     out[i].psfProb   = 0;
     44    out[i].psfChisq  = 0;
    4245    out[i].crNsigma  = 0;
    4346    out[i].extNsigma = 0;
     
    6669    out[i].dt       = isnan(in[i].dt     ) ? NAN_S_SHORT : in[i].dt      * 1000.0;
    6770    out[i].Mcal     = isnan(in[i].Mcal   ) ? NAN_S_SHORT : in[i].Mcal    * 1000.0;
    68     out[i].Mgal     = isnan(in[i].Mgal   ) ? NAN_S_SHORT : in[i].Mgal    * 1000.0;
     71    out[i].Mgal     = isnan(in[i].Map    ) ? NAN_S_SHORT : in[i].Map     * 1000.0;
    6972    out[i].airmass  = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0;
    7073
     
    9598
    9699  for (i = 0; i < Nvalues; i++) {
    97     out[i].R       = in[i].R;     
    98     out[i].D       = in[i].D;     
    99     out[i].Xp      = in[i].Xp;     
    100     out[i].Nm      = in[i].Nm;     
    101     out[i].Nn      = in[i].Nn;     
    102     out[i].code    = in[i].code;   
    103     out[i].offset = in[i].offset;
    104     out[i].missing = in[i].missing;
     100    out[i].R             = in[i].R;     
     101    out[i].D             = in[i].D;     
     102    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;
    105108
    106109    /* these don't exist in Elixir */
     
    115118
    116119    /* XXX add these later */
    117     out[i].objID_hi = 0;
    118     out[i].objID_lo = 0;
     120    out[i].objID  = 0;
     121    out[i].catID  = 0;
    119122
    120123    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     
    139142    out[i].D       = in[i].D;     
    140143    out[i].Xp      = in[i].Xp;     
    141     out[i].Nm      = in[i].Nm;     
    142     out[i].Nn      = in[i].Nn;     
     144    out[i].Nm      = in[i].Nmeasure;     
     145    out[i].Nn      = in[i].Nmissing;     
    143146    out[i].code    = in[i].code;   
    144     out[i].offset  = in[i].offset;
    145     out[i].missing = in[i].missing;
     147    out[i].offset  = in[i].measureOffset;
     148    out[i].missing = in[i].missingOffset;
    146149
    147150    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
     
    297300  return (out);
    298301}
     302
     303PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) {
     304
     305  int i;
     306  PhotCode_Elixir *out;
     307
     308  ALLOCATE (out, PhotCode_Elixir, Nvalues);
     309
     310  for (i = 0; i < Nvalues; i++) {
     311    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     312    out[i].name[31] = 0; // force termination
     313
     314    out[i].code  = in[i].code;         
     315    out[i].type  = in[i].type;         
     316    out[i].C     = in[i].C;           
     317    out[i].dC    = in[i].dC;           
     318    out[i].dX    = in[i].dX;           
     319    out[i].K     = in[i].K;           
     320    out[i].c1    = in[i].c1;           
     321    out[i].c2    = in[i].c2;           
     322    out[i].equiv = in[i].equiv;       
     323    out[i].Nc    = in[i].Nc;           
     324    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     325  }
     326  return (out);
     327}
     328
     329PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) {
     330
     331  int i;
     332  PhotCode *out;
     333
     334  ALLOCATE (out, PhotCode, Nvalues);
     335
     336  for (i = 0; i < Nvalues; i++) {
     337    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     338    out[i].name[31] = 0; // force termination
     339
     340    out[i].code  = in[i].code;         
     341    out[i].type  = in[i].type;         
     342    out[i].C     = in[i].C;           
     343    out[i].dC    = in[i].dC;           
     344    out[i].dX    = in[i].dX;           
     345    out[i].K     = in[i].K;           
     346    out[i].c1    = in[i].c1;           
     347    out[i].c2    = in[i].c2;           
     348    out[i].equiv = in[i].equiv;       
     349    out[i].Nc    = in[i].Nc;           
     350    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     351
     352    // not defined in Elixir:
     353    out[i].astromErrSys      = 0.0;
     354    out[i].astromErrScale    = 0.0;
     355    out[i].astromErrMagScale = 0.0;
     356    out[i].photomErrSys      = 0.0;
     357  }
     358  return (out);
     359}
  • trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r15511 r16810  
    2424
    2525    /* these values don't exist in the Loneos format */
    26     out[i].Mgal     = out[i].M;
    27     out[i].dt       = 0;
    28     out[i].airmass  = 0;
    29     out[i].az       = 0;
    30     out[i].FWx      = 0;
    31     out[i].FWy      = 0;
    32     out[i].theta    = 0;
    33     out[i].stargal  = 0;
    34     out[i].Sky      = 0;
    35     out[i].dSky     = 0;
    36     out[i].qPSF     = 0;
    37     out[i].psfProb   = 0;
     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;
     30    out[i].dt        = 0;
     31    out[i].airmass   = 0;
     32    out[i].az        = 0;
     33    out[i].FWx       = 0;
     34    out[i].FWy       = 0;
     35    out[i].theta     = 0;
     36    out[i].stargal   = 0;
     37    out[i].Sky       = 0;
     38    out[i].dSky      = 0;
     39    out[i].qPSF      = 0;
     40    out[i].psfChisq  = 0;
    3841    out[i].crNsigma  = 0;
    3942    out[i].extNsigma = 0;
     
    8790
    8891  for (i = 0; i < Nvalues; i++) {
    89     out[i].R       = in[i].R;     
    90     out[i].D       = in[i].D;     
    91     out[i].Xp      = in[i].Xp;     
    92     out[i].Nm      = in[i].Nm;     
    93     out[i].Nn      = in[i].Nn;     
    94     out[i].code    = in[i].code;   
    95     out[i].offset = in[i].offset;
    96     out[i].missing = in[i].missing;
     92    out[i].R             = in[i].R;     
     93    out[i].D             = in[i].D;     
     94    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;
    97100
    98101    /* these don't exist in Loneos */
     
    107110
    108111    /* XXX add these later */
    109     out[i].objID_hi = 0;
    110     out[i].objID_lo = 0;
     112    out[i].objID  = 0;
     113    out[i].catID  = 0;
    111114
    112115    primary[0][i].M  = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     
    131134    out[i].D       = in[i].D;     
    132135    out[i].Xp      = in[i].Xp;     
    133     out[i].Nm      = in[i].Nm;     
    134     out[i].Nn      = in[i].Nn;     
     136    out[i].Nm      = in[i].Nmeasure;     
     137    out[i].Nn      = in[i].Nmissing;     
    135138    out[i].code    = in[i].code;   
    136     out[i].offset  = in[i].offset;
    137     out[i].missing = in[i].missing;
     139    out[i].offset  = in[i].measureOffset;
     140    out[i].missing = in[i].missingOffset;
    138141
    139142    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r15511 r16810  
    1515    out[i].dM         = in[i].dM;
    1616    out[i].Mcal       = in[i].Mcal;
    17     out[i].Mgal       = in[i].Mgal;
     17
     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;
    1821    out[i].airmass    = in[i].airmass;
    1922    out[i].az         = in[i].az;
     
    3942
    4043    // these don't have a correspondence
    41     out[i].psfProb   = 0;
     44    out[i].psfChisq  = 0;
    4245    out[i].crNsigma  = 0;
    4346    out[i].extNsigma = 0;
     
    6164    out[i].dM         = in[i].dM;
    6265    out[i].Mcal       = in[i].Mcal;
    63     out[i].Mgal       = in[i].Mgal;
     66    out[i].Mgal       = in[i].Map;
    6467    out[i].airmass    = in[i].airmass;
    6568    out[i].az         = in[i].az;
     
    99102
    100103  for (i = 0; i < Nvalues; i++) {
     104    out[i].R             = in[i].R;     
     105    out[i].D             = in[i].D;     
     106    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;
     112    out[i].dR            = in[i].dR;
     113    out[i].dD            = in[i].dD;
     114    out[i].uR            = in[i].uR;
     115    out[i].uD            = in[i].uD;
     116    out[i].duR           = in[i].duR;
     117    out[i].duD           = in[i].duD;
     118    out[i].P             = in[i].P;
     119    out[i].dP            = in[i].dP;
     120    out[i].objID         = in[i].objID;
     121    out[i].catID         = in[i].catID;
     122  }
     123  return (out);
     124}
     125
     126/* convert internal averages to panstarrs-format averages */
     127// 'primary is needed to conform with the API for Loneos and Elixir, but is not used
     128Average_Panstarrs_DEV_0 *AverageInternalTo_Panstarrs_DEV_0 (Average *in, int Nvalues, SecFilt *primary) {
     129
     130  int i;
     131  Average_Panstarrs_DEV_0 *out;
     132
     133  ALLOCATE (out, Average_Panstarrs_DEV_0, Nvalues);
     134
     135  for (i = 0; i < Nvalues; i++) {
    101136    out[i].R        = in[i].R;     
    102137    out[i].D        = in[i].D;     
    103138    out[i].Xp       = in[i].Xp;     
    104     out[i].Nm       = in[i].Nm;     
    105     out[i].Nn       = in[i].Nn;     
     139    out[i].Nm       = in[i].Nmeasure;     
     140    out[i].Nn       = in[i].Nmissing;     
    106141    out[i].code     = in[i].code;   
    107     out[i].offset   = in[i].offset;
    108     out[i].missing  = in[i].missing;
     142    out[i].offset   = in[i].measureOffset;
     143    out[i].missing  = in[i].missingOffset;
    109144    out[i].dR       = in[i].dR;
    110145    out[i].dD       = in[i].dD;
     
    115150    out[i].P        = in[i].P;
    116151    out[i].dP       = in[i].dP;
    117     out[i].objID_hi = in[i].objID_hi;
    118     out[i].objID_lo = in[i].objID_lo;
    119   }
    120   return (out);
    121 }
    122 
    123 /* convert internal averages to panstarrs-format averages */
    124 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
    125 Average_Panstarrs_DEV_0 *AverageInternalTo_Panstarrs_DEV_0 (Average *in, int Nvalues, SecFilt *primary) {
    126 
    127   int i;
    128   Average_Panstarrs_DEV_0 *out;
    129 
    130   ALLOCATE (out, Average_Panstarrs_DEV_0, Nvalues);
    131 
    132   for (i = 0; i < Nvalues; i++) {
    133     out[i].R        = in[i].R;     
    134     out[i].D        = in[i].D;     
    135     out[i].Xp       = in[i].Xp;     
    136     out[i].Nm       = in[i].Nm;     
    137     out[i].Nn       = in[i].Nn;     
    138     out[i].code     = in[i].code;   
    139     out[i].offset   = in[i].offset;
    140     out[i].missing  = in[i].missing;
    141     out[i].dR       = in[i].dR;
    142     out[i].dD       = in[i].dD;
    143     out[i].uR       = in[i].uR;
    144     out[i].uD       = in[i].uD;
    145     out[i].duR      = in[i].duR;
    146     out[i].duD      = in[i].duD;
    147     out[i].P        = in[i].P;
    148     out[i].dP       = in[i].dP;
    149     out[i].objID_hi = in[i].objID_hi;
    150     out[i].objID_lo = in[i].objID_lo;
     152    out[i].objID    = in[i].objID;
     153    out[i].catID    = in[i].catID;
    151154  }
    152155  return (out);
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r15511 r16810  
    1515    out[i].dM         = in[i].dM;
    1616    out[i].Mcal       = in[i].Mcal;
    17     out[i].Mgal       = in[i].Mgal;
     17
     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;
    1821    out[i].airmass    = in[i].airmass;
    1922    out[i].az         = in[i].az;
     
    3942
    4043    // these don't have a correspondence
    41     out[i].psfProb   = 0;
     44    out[i].psfChisq  = 0;
    4245    out[i].crNsigma  = 0;
    4346    out[i].extNsigma = 0;
     
    6164    out[i].dM         = in[i].dM;
    6265    out[i].Mcal       = in[i].Mcal;
    63     out[i].Mgal       = in[i].Mgal;
     66    out[i].Mgal       = in[i].Map;
    6467    out[i].airmass    = in[i].airmass;
    6568    out[i].az         = in[i].az;
     
    99102
    100103  for (i = 0; i < Nvalues; i++) {
     104    out[i].R             = in[i].R;     
     105    out[i].D             = in[i].D;     
     106    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;
     112    out[i].dR            = in[i].dR;
     113    out[i].dD            = in[i].dD;
     114    out[i].uR            = in[i].uR;
     115    out[i].uD            = in[i].uD;
     116    out[i].duR           = in[i].duR;
     117    out[i].duD           = in[i].duD;
     118    out[i].P             = in[i].P;
     119    out[i].dP            = in[i].dP;
     120    out[i].objID         = in[i].objID;
     121    out[i].catID         = in[i].catID;
     122  }
     123  return (out);
     124}
     125
     126/* convert internal averages to panstarrs-format averages */
     127// 'primary is needed to conform with the API for Loneos and Elixir, but is not used
     128Average_Panstarrs_DEV_1 *AverageInternalTo_Panstarrs_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
     129
     130  int i;
     131  Average_Panstarrs_DEV_1 *out;
     132
     133  ALLOCATE (out, Average_Panstarrs_DEV_1, Nvalues);
     134
     135  for (i = 0; i < Nvalues; i++) {
    101136    out[i].R        = in[i].R;     
    102137    out[i].D        = in[i].D;     
    103138    out[i].Xp       = in[i].Xp;     
    104     out[i].Nm       = in[i].Nm;     
    105     out[i].Nn       = in[i].Nn;     
     139    out[i].Nm       = in[i].Nmeasure;     
     140    out[i].Nn       = in[i].Nmissing;     
    106141    out[i].code     = in[i].code;   
    107     out[i].offset   = in[i].offset;
    108     out[i].missing  = in[i].missing;
     142    out[i].offset   = in[i].measureOffset;
     143    out[i].missing  = in[i].missingOffset;
    109144    out[i].dR       = in[i].dR;
    110145    out[i].dD       = in[i].dD;
     
    115150    out[i].P        = in[i].P;
    116151    out[i].dP       = in[i].dP;
    117     out[i].objID_hi = in[i].objID_hi;
    118     out[i].objID_lo = in[i].objID_lo;
    119   }
    120   return (out);
    121 }
    122 
    123 /* convert internal averages to panstarrs-format averages */
    124 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
    125 Average_Panstarrs_DEV_1 *AverageInternalTo_Panstarrs_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
    126 
    127   int i;
    128   Average_Panstarrs_DEV_1 *out;
    129 
    130   ALLOCATE (out, Average_Panstarrs_DEV_1, Nvalues);
    131 
    132   for (i = 0; i < Nvalues; i++) {
    133     out[i].R        = in[i].R;     
    134     out[i].D        = in[i].D;     
    135     out[i].Xp       = in[i].Xp;     
    136     out[i].Nm       = in[i].Nm;     
    137     out[i].Nn       = in[i].Nn;     
    138     out[i].code     = in[i].code;   
    139     out[i].offset   = in[i].offset;
    140     out[i].missing  = in[i].missing;
    141     out[i].dR       = in[i].dR;
    142     out[i].dD       = in[i].dD;
    143     out[i].uR       = in[i].uR;
    144     out[i].uD       = in[i].uD;
    145     out[i].duR      = in[i].duR;
    146     out[i].duD      = in[i].duD;
    147     out[i].P        = in[i].P;
    148     out[i].dP       = in[i].dP;
    149     out[i].objID_hi = in[i].objID_hi;
    150     out[i].objID_lo = in[i].objID_lo;
     152    out[i].objID    = in[i].objID;
     153    out[i].catID    = in[i].catID;
    151154  }
    152155  return (out);
  • trunk/Ohana/src/libdvo/src/dvo_image.c

    r15749 r16810  
    194194  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_1");
    195195  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_1");
     196  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
    196197 
    197198  return;
  • trunk/Ohana/src/libdvo/src/dvo_image_raw.c

    r15487 r16810  
    5353  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) ImageSize = sizeof(Image_Panstarrs_DEV_1);
    5454  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       ImageSize = sizeof(Image_PS1_DEV_1);
     55  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       ImageSize = sizeof(Image_PS1_DEV_2);
    5556
    5657  /* check that filesize makes sense */
     
    7677  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) gfits_table_mkheader_Image_Panstarrs_DEV_1 (&db[0].theader);
    7778  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       gfits_table_mkheader_Image_PS1_DEV_1 (&db[0].theader);
     79  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_table_mkheader_Image_PS1_DEV_2 (&db[0].theader);
    7880   
    7981  /* read data from file */
  • trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c

    r15514 r16810  
    370370  if (color == NULL) return (NAN);
    371371  if (color[0].type == PHOT_REF) {
    372     for (i = 0; (i < average[0].Nm) && (isnan(m1)); i++) {
     372    for (i = 0; (i < average[0].Nmeasure) && (isnan(m1)); i++) {
    373373      if (measure[i].photcode == color[0].code) {
    374374        m1 = measure[i].M;
     
    384384  if (color == NULL) return (NAN);
    385385  if (color[0].type == PHOT_REF) {
    386     for (i = 0; (i < average[0].Nm) && (isnan(m2)); i++) {
     386    for (i = 0; (i < average[0].Nmeasure) && (isnan(m2)); i++) {
    387387      if (measure[i].photcode == color[0].code) {
    388388        m2 = measure[i].M;
     
    466466  if (code == NULL) return (FALSE);
    467467  if (code[0].type == PHOT_REF) {
    468     for (i = 0; i < average[0].Nm; i++) {
     468    for (i = 0; i < average[0].Nmeasure; i++) {
    469469      if (measure[i].photcode == c1) {
    470470        M1 = measure[i].M;
     
    482482  if (code == NULL) return (FALSE);
    483483  if (code[0].type == PHOT_REF) {
    484     for (i = 0; i < average[0].Nm; i++) {
     484    for (i = 0; i < average[0].Nmeasure; i++) {
    485485      if (measure[i].photcode == c2) {
    486486        M2 = measure[i].M;
Note: See TracChangeset for help on using the changeset viewer.