Index: /trunk/SophyaExt/FitsIOServer/fitsfile.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 972)
@@ -126,5 +126,5 @@
       if (naxis > 0 )       // there is an image
 	{
-	  hdutype_ == IMAGE_HDU;
+	  hdutype_ = IMAGE_HDU;
 	  GetImageParameters (fptr_, bitpix_, naxis_, naxisn_);
 	  nbData_ =  1;
Index: /trunk/SophyaExt/FitsIOServer/fitsntuple.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsntuple.cc	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitsntuple.cc	(revision 972)
@@ -43,10 +43,10 @@
 }
 
-void FITS_NTuple::Write(char outputfile[], int hdunum)
+void FITS_NTuple::Write(char outputfile[], bool OldFile)
 {
-  WriteF(outputfile, hdunum);
+  WriteF(outputfile, OldFile);
 }
 
-void FITS_NTuple::ReadFromFits(const FitsFile& fn)
+void FITS_NTuple::ReadFromFits(FitsFile& fn)
 {
   if (!fn.IsFitsTable())
@@ -115,5 +115,5 @@
   dobj_->Info()=fn.DVListFromFits();
 }
-void FITS_NTuple::WriteToFits(const FitsFile& fn)
+void FITS_NTuple::WriteToFits(FitsFile& fn)
 {
   if(dobj_ == NULL) 
Index: /trunk/SophyaExt/FitsIOServer/fitsntuple.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsntuple.h	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitsntuple.h	(revision 972)
@@ -23,5 +23,5 @@
 FITS_NTuple(const NTuple & obj);
 virtual ~FITS_NTuple();
-void Write(char outputfile[], int hdunum=2);
+void Write(char outputfile[], bool OldFile=false);
 inline operator NTuple() { return(*dobj_); }
 
@@ -29,6 +29,6 @@
 
   // implementation de FitsFile
-virtual void ReadFromFits(const FitsFile& fn);
-virtual void WriteToFits(const FitsFile& fn);
+virtual void ReadFromFits(FitsFile& fn);
+virtual void WriteToFits(FitsFile& fn);
 
 float*  getColFromObj(int colNr);
Index: /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc	(revision 972)
@@ -69,7 +69,7 @@
 
 template <class T>
-void FITS_SphereHEALPix<T>::Write(char outputfile[],int hdunum)
-{
-  WriteF(outputfile, hdunum);
+void FITS_SphereHEALPix<T>::Write(char outputfile[], bool OldFile)
+{
+  WriteF(outputfile, OldFile);
 }
 template <class T>
@@ -80,5 +80,5 @@
 
 template <class T>
-void FITS_SphereHEALPix<T>::WriteToFits(const FitsFile& fn)
+void FITS_SphereHEALPix<T>::WriteToFits(FitsFile& fn)
 {
   if(dobj_ == NULL) 
@@ -94,12 +94,18 @@
   dvl["COORDSYS"]= description;
 
+  dvl["PIXTYPE"] = "HEALPIX";
+  dvl.SetComment("PIXTYPE", "HEALPIX Pixelization");
   dvl["ORDERING"]= dobj_->TypeOfMap();
+  dvl.SetComment("ORDERING", "Pixel ordering scheme, either RING or NESTED");
   
   int nSide= dobj_->SizeIndex();
   dvl["NSIDE"]= nSide;
+  dvl.SetComment("NSIDE","Resolution parameter for HEALPIX" );
 
   int nPix= dobj_->NbPixels();
   dvl["FIRSTPIX"]= 0;
+  dvl.SetComment("FIRSTPIX", "First pixel # (0 based)");
   dvl["LASTPIX"]= nPix-1;
+  dvl.SetComment("LASTPIX", "Last pixel # (0 based)");
   dvl["Content"]= "SphereHEALPix";
   dvl["EXTNAME"]= "SIMULATION";
@@ -131,5 +137,5 @@
 
 template <class T> 
-void FITS_SphereHEALPix<T>::ReadFromFits(const FitsFile& fn)
+void FITS_SphereHEALPix<T>::ReadFromFits(FitsFile& fn)
 {
   if(dobj_ == NULL) 
@@ -164,11 +170,11 @@
   int id= SphereCoordSys_NEUTRAL;
   string description= "NEUTRAL SphereCoordSystem";
-  const char* coordsys= dvl.GetS("COORDSYS").c_str();    
-  if(strncmp(coordsys,"ROTATION",8) == 0)
+  string coordsys= dvl.GetS("COORDSYS");    
+  if(coordsys.compare(0,7,"ROTATION",0,7) == 0)
     {
       id= SphereCoordSys_ROTATION;
       description= "ROTATION SphereCoordSystem";
     } 
-  else if(strncmp(coordsys,"OTHER",5) == 0)
+  else if(coordsys.compare(0,4,"OTHER",0,4) == 0)
     {
       id= SphereCoordSys_OTHER;
@@ -177,6 +183,6 @@
   dobj_->SetCoordSys(new SphereCoordSys(id,description));   
 
-  const char* ordering= dvl.GetS("ORDERING").c_str();
-  if(strncmp(ordering,"RING",4) != 0)
+  string ordering= dvl.GetS("ORDERING");
+  if(ordering.compare(0,3,"RING",0,3) != 0)
     { 
       cout << " ORDERING= " << ordering << endl;
Index: /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h	(revision 972)
@@ -29,12 +29,12 @@
 virtual void        SetDataObj(AnyDataObj & o);
 
-inline operator SphereHEALPix<T>() {return(*dobj_); }
+inline operator SphereHEALPix<T>() { return(*dobj_); }
  void Read(char inputfile[],int hdunum=2);
-void Write(char outputfile[], int hdunum=2);
+void Write(char outputfile[], bool Oldfile=false);
 
 protected:
 
-virtual void ReadFromFits(const FitsFile& fn);
-virtual void WriteToFits(const FitsFile& fn);
+virtual void ReadFromFits(FitsFile& fn);
+virtual void WriteToFits(FitsFile& fn);
 SphereHEALPix<T>* dobj_;
 bool ownobj;
Index: /trunk/SophyaExt/FitsIOServer/fitstarray.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitstarray.cc	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitstarray.cc	(revision 972)
@@ -46,7 +46,7 @@
 
 template <class T>
-void FITS_TArray<T>::Write(char outputfile[])
+void FITS_TArray<T>::Write(char outputfile[], bool OldFile)
 {
-  WriteF(outputfile);
+  WriteF(outputfile, OldFile);
 }
 
@@ -60,5 +60,5 @@
 
 template <class T>
-void FITS_TArray<T>::ReadFromFits(const FitsFile& fn)
+void FITS_TArray<T>::ReadFromFits(FitsFile& fn)
 {
 
@@ -91,5 +91,5 @@
 
   template <class T>
-void FITS_TArray<T>::WriteToFits(const FitsFile& fn)  
+void FITS_TArray<T>::WriteToFits(FitsFile& fn)  
 {
   if(dobj_ == NULL) return;
Index: /trunk/SophyaExt/FitsIOServer/fitstarray.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitstarray.h	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitstarray.h	(revision 972)
@@ -31,10 +31,10 @@
 virtual AnyDataObj* DataObj();
 inline operator TArray<T>() { return(*dobj_); }
-void Write(char outputfile[]);
+void Write(char outputfile[], bool OldFile=false);
 
 protected :
 
-void ReadFromFits(const FitsFile& fn);
-void WriteToFits(const FitsFile& fn);
+void ReadFromFits(FitsFile& fn);
+void WriteToFits(FitsFile& fn);
 
   TArray<T> * dobj_;
Index: /trunk/SophyaExt/FitsIOServer/fitsxntuple.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsxntuple.cc	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitsxntuple.cc	(revision 972)
@@ -60,10 +60,10 @@
   if (ownobj && dobj_ != NULL) delete dobj_;
 }
-void FITS_XNTuple::Write(char outputfile[],int hdunum)
+void FITS_XNTuple::Write(char outputfile[], bool OldFile)
 {       
-  WriteF(outputfile, hdunum);
+  WriteF(outputfile, OldFile);
 } 
  
-void FITS_XNTuple::ReadFromFits(const FitsFile& fn)
+void FITS_XNTuple::ReadFromFits(FitsFile& fn)
 {   
   if (!fn.IsFitsTable())
@@ -230,5 +230,5 @@
 
 }
-void FITS_XNTuple::WriteToFits(const FitsFile& fn)
+void FITS_XNTuple::WriteToFits(FitsFile& fn)
 {
   if(dobj_ == NULL) 
Index: /trunk/SophyaExt/FitsIOServer/fitsxntuple.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsxntuple.h	(revision 971)
+++ /trunk/SophyaExt/FitsIOServer/fitsxntuple.h	(revision 972)
@@ -23,5 +23,5 @@
 FITS_XNTuple(const XNTuple & obj);
 ~FITS_XNTuple();
-void Write(char outputfile[], int hdunum=2);
+void Write(char outputfile[], bool OldFile=false);
 inline operator XNTuple() { return(*dobj_); }
 
@@ -29,6 +29,6 @@
 
   // implementation de FitsFile
-  virtual void  ReadFromFits(const FitsFile& fn);
-virtual void    WriteToFits(const FitsFile& fn);
+  virtual void  ReadFromFits(FitsFile& fn);
+virtual void    WriteToFits(FitsFile& fn);
 void*   getColFromObj(int colNr);
 double* getColDFromObj(int colNr);
