Index: /trunk/SophyaProg/Tests/obj_fits.cc
===================================================================
--- /trunk/SophyaProg/Tests/obj_fits.cc	(revision 1232)
+++ /trunk/SophyaProg/Tests/obj_fits.cc	(revision 1232)
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <iostream.h>
+
+#include "histinit.h"
+#include "dvlist.h"
+#include "ntuple.h"
+#include "xntuple.h"
+#include "fitsxntuple.h"
+#include "fitsntuple.h"
+#include "fitstarray.h"
+#include "array.h"
+
+int main(int narg, char *arg[])
+{
+  if (narg < 3) {
+    cout << "obj_fits/Erreur arg - Usage obj_fits r/w fitsfilename \n" << endl;
+    cout << "  w : Create a FITS file with a matrix and an NTuple \n" << endl;
+    cout << "  r : Read a matrix and an NTuple from a Fits File \n" << endl;
+    exit(1);
+  }
+  try {
+    SophyaInit();
+    string flnm = arg[2];
+    if (*arg[1] == 'r') {
+      cout << " obj_fits/Info: Opening input FitsFile " << endl;
+      FitsInFile fiis(flnm);
+      cout << " Reading Matrix m from FITS " << endl;
+      Matrix m(1,1);
+      fiis >> m;
+      cout << m << endl;
+
+      cout << " Reading NTuple from FITS " << endl;
+      NTuple nt;
+      fiis >> nt ;
+      nt.Show();
+    }
+    else {
+      cout << " obj_fits/Info: Opening output FitsFile " << endl;
+      FitsOutFile fios(flnm);
+      fios.firstImageOnPrimaryHeader();
+      cout << " Creating Matrix m " << endl;
+      Matrix m(50,70);
+      m = RegularSequence(35., 0.2);
+      cout << m << endl;
+      
+      cout << " Writing Matrix m to FITS " << endl;
+      fios << m ;
+      
+      cout << " Creating NTuple " << endl;
+      char * names[3] = {"XPos", "YPos", "Val"};
+      int i,j, k;
+      float xnt[3];
+      
+      NTuple  nt1(3, names, 20);
+      
+      k = 0;
+      for(j=0; j<8; j++)
+	for(i=0; i<12; i++)
+	  { xnt[0] = i+0.5;  xnt[1] = j+0.5;  xnt[2] = k;
+	  nt1.Fill(xnt); k++; }
+      
+      nt1.Info().Comment() = "NTuple de Test - Cree par obj_fits.cc";
+      nt1.Info()["Version"] = SophyaVersion();
+      nt1.Show();
+      
+      cout << " Writing NTuple to FITS " << endl;
+      fios << nt1 ;
+    }
+  }
+  catch (PThrowable & exc) {
+    cerr << " Catched Exception " << (string)typeid(exc).name()
+         << " - Msg= " << exc.Msg() << endl;
+  }
+  catch (...) {
+    cerr << " some other exception was caught ! " << endl;
+  }
+
+}
Index: /trunk/SophyaProg/Tests/scanfits.cc
===================================================================
--- /trunk/SophyaProg/Tests/scanfits.cc	(revision 1232)
+++ /trunk/SophyaProg/Tests/scanfits.cc	(revision 1232)
@@ -0,0 +1,61 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <iostream.h>
+
+#include "histinit.h"
+#include "dvlist.h"
+#include "ntuple.h"
+#include "xntuple.h"
+#include "fitsxntuple.h"
+#include "fitsntuple.h"
+
+int main(int narg, char *arg[])
+{
+  if (narg < 2) {
+    cerr << "scanfits/Erreur arg - Usage scanfits nomfits \n" << endl;
+    exit(0);
+  }
+  try {
+    SophyaInit();
+    string flnm = arg[1];
+    int nbblk = FitsInFile::NbBlocks(arg[1]);
+    cout << " :::: File " << flnm << " has " << nbblk << " blocks " << endl;
+    DVList header;
+    FitsFile::FitsExtensionType exttype;
+    FitsFile::FitsDataType datatype;
+
+    cout << " FitsFile::FitsExtensionType : FitsExtensionType_IMAGE= " <<
+      (int)FitsFile::FitsExtensionType_IMAGE << 
+      "  FitsExtensionType_ASCII_TBL= " << (int)FitsFile::FitsExtensionType_ASCII_TBL <<
+      "  FitsExtensionType_BINARY_TBL= " << (int)FitsFile::FitsExtensionType_BINARY_TBL << endl;
+    cout << " FitsFile::FitsDataType: FitsDataType_double= " <<
+      (int)FitsFile::FitsDataType_double << 
+      " FitsDataType_float= " << (int)FitsFile::FitsDataType_float <<
+      " FitsDataType_int= " << (int)FitsFile::FitsDataType_int <<
+      " FitsDataType_char= " << (int)FitsFile::FitsDataType_char <<
+      " FitsDataType_ASCII= " << (int)FitsFile::FitsDataType_ASCII << endl << endl;
+
+    int naxis;
+    vector<int> axis;
+    for(int i=1; i<=nbblk; i++) {
+      FitsInFile::GetBlockType(arg[1], i, exttype, naxis, axis, datatype, header);
+      cout << " --------- Header Num " << i << " Type " << (int)exttype 
+	   << " NAxis= " << naxis << " (" << axis.size() << " )" 
+	   << " DataType= " << (int)datatype << endl;
+      for(int j=0; j<axis.size(); j++) cout  << axis[j] << " x "  ;
+      cout << endl;
+      cout << header << endl;
+      cout << "----------------------------------------------------" << endl;
+    } 
+ 
+  }
+  catch (PThrowable & exc) {
+    cerr << " Catched Exception " << (string)typeid(exc).name()
+         << " - Msg= " << exc.Msg() << endl;
+  }
+  catch (...) {
+    cerr << " some other exception was caught ! " << endl;
+  }
+
+}
