IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12399


Ignore:
Timestamp:
Mar 9, 2007, 9:10:33 PM (19 years ago)
Author:
eugene
Message:

fixed table byteswap errors

Location:
trunk/Ohana/src
Files:
2 edited

Legend:

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

    r7054 r12399  
    6464
    6565  /* interpret format */
    66   sprintf (field, "TSCAL%d", Nfields);
     66  sprintf (field, "TSCAL%d", N);
    6767  gfits_scan (header, field, "%lf", 1, &Bscale);
    68   sprintf (field, "TZERO%d", Nfields);
     68  sprintf (field, "TZERO%d", N);
    6969  gfits_scan (header, field, "%lf", 1, &Bzero);
    7070  sprintf (field, "TFORM%d", N);
  • trunk/Ohana/src/tools/src/ftable.c

    r12333 r12399  
    350350  if (Binary) {
    351351    if (!gfits_get_bintable_column_type (header, Colname, type, &Nv)) return;
    352     if (!strcmp (type, "char")) return;
     352    // if (!strcmp (type, "char")) return;
    353353    if (!gfits_get_bintable_column (header, table, Colname, (void **)&data)) return;
     354    // this results in an array of Ny*Nv entries
    354355
    355356    for (i = 0; i < Ny; i++) {
     
    360361        for (j = 0; j < Nv; j++) {
    361362          if (!strcmp (type, "int")) {
    362             memcpy (line, &data[i*Nx + Nstart + Nb*j], Nb);
    363             ByteSwap (line, Nb, 1, "int");
    364             Ti = (int *)line;
    365             fprintf (stdout, "%d ", Ti[0]);
     363            memcpy (line, &data[i*Nv*Nb + Nb*j], Nb);
     364            fprintf (stdout, "%d ", *(int *)line);
    366365          }
    367366          if (!strcmp (type, "float")) {
    368             memcpy (line, &data[i*Nx + Nstart + Nb*j], Nb);
    369             ByteSwap (line, Nb, 1, "float");
    370             Tf = (float *)line;
    371             fprintf (stdout, "%f ", Tf[0]);
     367            memcpy (line, &data[i*Nv*Nb + Nb*j], Nb);
     368            fprintf (stdout, "%e ", *(float *)line);
    372369          }
    373370        }
Note: See TracChangeset for help on using the changeset viewer.