Changeset 9607
- Timestamp:
- Oct 16, 2006, 5:37:15 PM (20 years ago)
- Location:
- trunk/Ohana/src/misc
- Files:
-
- 2 edited
-
Makefile (modified) (1 diff)
-
src/ftable.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/misc/Makefile
r5240 r9607 72 72 73 73 install: 74 for i in $(PROGRAMS); do make $$i.install ; done74 for i in $(PROGRAMS); do make $$i.install || exit; done 75 75 76 76 clean: -
trunk/Ohana/src/misc/src/ftable.c
r7080 r9607 160 160 161 161 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]; 164 164 Header header; 165 165 … … 170 170 } 171 171 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; 186 184 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 } 191 235 192 236 Nbytes = gfits_matrix_size (&header); 193 237 fseek (f, Nbytes, SEEK_CUR); 238 239 Ncomp ++; 194 240 } 195 241 fclose (f);
Note:
See TracChangeset
for help on using the changeset viewer.
