IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 17, 2014, 10:10:16 AM (12 years ago)
Author:
eugene
Message:

major re-work of dvo photcode-based-field parsing; adding PS1_V5 and lensing parameters, adding reference colors blue & red

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r35162 r37035  
    22
    33/* convert elixir-format measures to internal measures */
    4 Measure *Measure_Elixir_ToInternal (Measure_Elixir *in, off_t Nvalues) {
     4Measure *Measure_Elixir_ToInternal (Average *ave, Measure_Elixir *in, off_t Nvalues) {
    55
    66  off_t i;
     
    1515    out[i].averef   = in[i].averef;
    1616
     17    // changed for PS1_V5
     18    int averef = out[i].averef;
     19    out[i].R          = (in[i].dR == NAN_S_SHORT) ? NAN : ave[averef].R - 0.01 * in[i].dR / 3600.0;
     20    out[i].D          = (in[i].dD == NAN_S_SHORT) ? NAN : ave[averef].D - 0.01 * in[i].dD / 3600.0;
     21
    1722    // changed for PANSTARRS_DEV_0
    18     out[i].dR       = (in[i].dR      == NAN_S_SHORT) ? NAN : in[i].dR     * 0.01;
    19     out[i].dD       = (in[i].dD      == NAN_S_SHORT) ? NAN : in[i].dD     * 0.01;
    2023    out[i].M        = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
    2124    out[i].dM       = (in[i].dM      == NAN_U_CHAR)  ? NAN : in[i].dM     * 0.001;
     
    4750
    4851/* convert internal measures to elixir-format measures */
    49 Measure_Elixir *MeasureInternalTo_Elixir (Measure *in, off_t Nvalues) {
     52Measure_Elixir *MeasureInternalTo_Elixir (Average *ave, Measure *in, off_t Nvalues) {
    5053
    5154  off_t i;
     
    5962    out[i].averef  = in[i].averef;
    6063
     64    // changed for PS1_V5
     65    int averef = in[i].averef;
     66    int isBad = isnan(in[i].R) || isnan(in[i].D);
     67    out[i].dR     = isBad ? NAN_S_SHORT : 100.0*3600.0*(ave[averef].R - in[i].R);
     68    out[i].dD     = isBad ? NAN_S_SHORT : 100.0*3600.0*(ave[averef].D - in[i].D);
     69
    6170    // changed for PANSTARRS_DEV_0
    62     out[i].dR       = isnan(in[i].dR     ) ? NAN_S_SHORT : in[i].dR      *  100.0;
    63     out[i].dD       = isnan(in[i].dD     ) ? NAN_S_SHORT : in[i].dD      *  100.0;
    6471    out[i].M        = isnan(in[i].M      ) ? NAN_S_SHORT : in[i].M       * 1000.0;
    6572    out[i].dM       = isnan(in[i].dM     ) ? NAN_U_CHAR  : in[i].dM      * 1000.0;
     
    104111    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
    105112    primary[0][i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;     
    106     primary[0][i].Xm    = in[i].Xm;     
     113    primary[0][i].Mchisq= pow (10.0, 0.01*in[i].Xm);     
    107114
    108115    // added for PANSTARRS_DEV_0
     
    137144    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
    138145    out[i].dM      = isnan(primary[i].dM) ? NAN_S_SHORT : primary[i].dM  * 1000.0;
    139     out[i].Xm      = primary[i].Xm;     
     146    out[i].Xm      = 100.0*log10(primary[i].Mchisq);     
    140147
    141148    // changed or added for PS1_DEV_2
     
    162169    dvo_secfilt_init (&out[i]);
    163170
    164     out[i].Xm    = in[i].Xm;     
     171    out[i].Mchisq = pow (10.0, 0.01*in[i].Xm);     
    165172
    166173    // added or changed for PANSTARRS_DEV_0
     
    180187
    181188  for (i = 0; i < Nvalues; i++) {
    182     out[i].Xm    = in[i].Xm;     
     189    out[i].Xm    = 100.0*log10(in[i].Mchisq);     
    183190
    184191    // added or changed for PANSTARRS_DEV_0
     
    188195  return (out);
    189196}
     197
     198# define RAW_IMAGE_NAME_LEN 32
    190199
    191200/* convert elixir-format images to internal images */
     
    203212    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    204213
    205     strncpy (out[i].name, in[i].name, 31); // in[32], out[128]
    206     out[i].name[31] = 0; // force termination
     214    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
     215    strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
     216    out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
    207217
    208218    out[i].tzero            = in[i].tzero;
     
    272282    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    273283
    274     strncpy (out[i].name, in[i].name, 31); // out[32], in[128]
    275     out[i].name[31] = 0; // force termination
     284    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
     285    strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
     286    out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
    276287
    277288    out[i].tzero            = in[i].tzero;
Note: See TracChangeset for help on using the changeset viewer.