/* * @(#)ReadFits.java $Revision: 1.5 $ $Date: 2007-01-04 09:32:23 $ * * Copyright (C) 1999 European Southern Observatory * License: GNU General Public License version 2 or later */ package org.eso.fits; import java.util.*; import java.io.*; /** TestFits class provides a static main method for testing the * FITS class library. It also shows a typical usage of the * classes. * * @version $Id: TestFits.java,v 1.5 2007-01-04 09:32:23 pgrosbol Exp $ * @author P.Grosbol, ESO, */ public class TestFits{ /** Static method for testing the FITS class library. * * @param argv array of arguments i.e. FITS files */ public static void main(String[] argv) { if (argv.length < 1) { System.out.println("Error: must have at least one argument"); System.exit(1); } System.out.println("-- Test FITS files --------"); FitsFile file = null; for (int na=0; na" + argv[na] + "<"); continue; } catch (IOException e) { System.out.println("Error: cannot open file >" + argv[na] + "<"); continue; } int noHDU = file.getNoHDUnits(); System.out.println("FITS file has " + noHDU + " HDUnits"); for (int i=0; i" + hdr.getName() + "< of type >" + Fits.getType(type) + "< with " + noKw + " keywords" + " and " + size + " bytes of data"); System.out.println(" Keywords:"); ListIterator itr = hdr.getKeywords(); while (itr.hasNext()) { FitsKeyword kw = (FitsKeyword) itr.next(); System.out.print(" " + kw.getName()); switch (kw.getType()) { case FitsKeyword.COMMENT: System.out.print("(C) " + kw.getComment()); break; case FitsKeyword.STRING: System.out.print("(S)= '" + kw.getString() + "'"); break; case FitsKeyword.BOOLEAN: System.out.print("(B)= " + kw.getBool()); break; case FitsKeyword.INTEGER: System.out.print("(I)= " + kw.getInt()); break; case FitsKeyword.REAL: System.out.print("(R)= " + kw.getReal()); break; case FitsKeyword.DATE: System.out.print("(D)= " + kw.getString()); break; default: } if (0" + col[n].getLabel() + "<, "); System.out.print(col[n].getRepeat() + " "); System.out.print(col[n].getDataType() + ", >"); System.out.print(col[n].getDisplay() + "<, >"); System.out.println(col[n].getUnit() + "<"); if (col[n].getDataType() == 'F' || col[n].getDataType() == 'E' || col[n].getDataType() == 'D') { int npix = 0; double mean, rms, val; mean = rms = 0.0; long time = System.currentTimeMillis(); for (int nr=0; nr