IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

distinguish "byte" and "char" column fields (char is interpretted as a string)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/table/F_table_format.c

    r28241 r37039  
    1919  if ((Nv == 0) && (Fchar == format)) Nv = 1;
    2020
     21  // NOTE: X, L, B all are stored in 1-byte columns (X by default has at least room for 8 bits)
     22  // I report these as type 'byte' as opposed to 'char', which is interpreted as a string
     23
    2124  *Nbytes = 0;
    2225  switch (*Fchar) {
    2326  case  'X':
    24     { *Nbytes = 1;  strcpy (type, "char");   *Nval = 1 + (int) Nv / 8; }
     27    { *Nbytes = 1;  strcpy (type, "byte");   *Nval = 1 + (int) Nv / 8; }
    2528    break;
    2629  case  'L':
    27     { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
     30    { *Nbytes = 1;  strcpy (type, "byte");   *Nval = Nv;               }
    2831    break;
    2932  case  'A':
     
    3134    break;
    3235  case  'B':
    33     { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
     36    { *Nbytes = 1;  strcpy (type, "byte");   *Nval = Nv;               }
    3437    break;
    3538  case  'I':
     
    268271    }
    269272
     273    // Does it make sense to scale 'char' data (as opposed to 'byte')?
    270274    if (!strcmp (type, "char"))   {
     275      for (j = 0; j < Ny; j++) {
     276        for (n = 0; n < Nval; n++) {
     277          tmpChar = (char *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     278          *tmpChar = *tmpChar * tscale + tzero;
     279        }
     280      }
     281    }
     282    if (!strcmp (type, "byte"))   {
    271283      for (j = 0; j < Ny; j++) {
    272284        for (n = 0; n < Nval; n++) {
     
    352364    }
    353365
     366    // does this make sense? (see note above)
    354367    if (!strcmp (type, "char"))   {
    355368      for (j = 0; j < Ny; j++) {
     
    360373      }
    361374    }
     375    if (!strcmp (type, "byte"))   {
     376      for (j = 0; j < Ny; j++) {
     377        for (n = 0; n < Nval; n++) {
     378          tmpChar = (char *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
     379          *tmpChar = (*tmpChar - tzero) / tscale;
     380        }
     381      }
     382    }
    362383    if (!strcmp (type, "short"))   {
    363384      for (j = 0; j < Ny; j++) {
Note: See TracChangeset for help on using the changeset viewer.