IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9607


Ignore:
Timestamp:
Oct 16, 2006, 5:37:15 PM (20 years ago)
Author:
eugene
Message:

cleanups

Location:
trunk/Ohana/src/misc
Files:
2 edited

Legend:

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

    r5240 r9607  
    7272
    7373install:
    74         for i in $(PROGRAMS); do make $$i.install; done
     74        for i in $(PROGRAMS); do make $$i.install || exit; done
    7575
    7676clean:
  • trunk/Ohana/src/misc/src/ftable.c

    r7080 r9607  
    160160
    161161  FILE *f;
    162   int Nx, Ny, extend, Nbytes;
    163   char extname[82];
     162  int i, Naxis, Nelem, Ncomp, extend, Nbytes, status;
     163  char extname[82], exttype[82], axisname[32];
    164164  Header header;
    165165
     
    170170  }
    171171
    172   if (!gfits_fread_header (f, &header)) {
    173     fprintf (stderr, "can't read header from %s\n", file);
    174     exit (1);
    175   }
    176 
    177   extend = FALSE;
    178   gfits_scan (&header, "EXTEND", "%t", 1, &extend);
    179   if (!extend) {
    180     fprintf (stderr, "no extensions listed in file\n");
    181   }
    182 
    183   Nbytes = gfits_matrix_size (&header);
    184   fseek (f, Nbytes, SEEK_CUR);
    185 
     172  /*
     173     if (!gfits_fread_header (f, &header)) {
     174     fprintf (stderr, "can't read header from %s\n", file);
     175     exit (1);
     176     }
     177     Nbytes = gfits_matrix_size (&header);
     178     fseek (f, Nbytes, SEEK_CUR);
     179  */
     180
     181  fprintf (stdout, "%-30s %-15s NAXIS NAXIS(i)...\n", "extname", "datatype");
     182
     183  Ncomp = 0;
    186184  while (gfits_fread_header (f, &header)) {
    187     gfits_scan (&header, "EXTNAME", "%s", 1, extname);
    188     gfits_scan (&header, "NAXIS1",  "%d", 1, &Nx);
    189     gfits_scan (&header, "NAXIS2",  "%d", 1, &Ny);
    190     fprintf (stdout, "%-30s %6d %6d\n", extname, Nx, Ny);
     185    /* extract the EXTNAME for this component (set to PHU for 0th component) */
     186    status = gfits_scan (&header, "EXTNAME", "%s", 1, extname);
     187    if (!status) {
     188      if (Ncomp == 0) {
     189        strcpy (extname, "PHU");
     190      } else {
     191        strcpy (extname, "UNKNOWN");
     192      }
     193    }
     194    fprintf (stdout, "%-30s ", extname);
     195
     196    /* extract the datatype for this component (IMAGE for 0th component) */
     197    if (Ncomp == 0) {
     198      strcpy (exttype, "IMAGE");
     199    } else {
     200      status = gfits_scan (&header, "XTENSION", "%s", 1, exttype);
     201      if (!status) {
     202        strcpy (exttype, "UNKNOWN");
     203      }
     204    }
     205    fprintf (stdout, "%-15s ", exttype);
     206
     207    /* extract the rank of the component */
     208    status = gfits_scan (&header, "NAXIS",  "%d", 1, &Naxis);
     209    if (!status) {
     210      fprintf (stderr, "component %d is missing Naxis!\n", Ncomp);
     211      Ncomp ++;
     212      continue;
     213    }
     214    fprintf (stdout, " %4d", Naxis);
     215
     216    /* extract the individual axes */
     217    for (i = 0; i < Naxis; i++) {
     218      sprintf (axisname, "NAXIS%d", i+1);
     219      status = gfits_scan (&header, axisname,  "%d", 1, &Nelem);
     220      if (!status) {
     221        fprintf (stderr, "missing %s\n", axisname);
     222      }
     223      fprintf (stdout, " %7d", Nelem);
     224    }
     225    fprintf (stdout, "\n");
     226
     227    /* are extensions identified? (we will scan for them anyway) */
     228    if (Ncomp == 0) {
     229      extend = FALSE;
     230      gfits_scan (&header, "EXTEND", "%t", 1, &extend);
     231      if (!extend) {
     232        fprintf (stderr, "no extensions listed in file\n");
     233      }
     234    }
    191235
    192236    Nbytes = gfits_matrix_size (&header);
    193237    fseek (f, Nbytes, SEEK_CUR);
     238
     239    Ncomp ++;
    194240  }
    195241  fclose (f);
Note: See TracChangeset for help on using the changeset viewer.