Index: trunk/SophyaExt/FitsIOServer/fitsfile.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 1217)
+++ trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 1218)
@@ -8,4 +8,89 @@
 
 
+void BnTblLine::setFormat(int dc, int fc, int ic, int cc, vector<string> names)
+   {
+    int nbcols = dc + fc + ic + cc;
+    int maxName = names.size();
+    if (nbcols != maxName)
+      {
+	cout << " WARNING: BnTblLine:: length of vector of column names not equal to total number of columns" << endl;
+	maxName = nbcols < maxName ? nbcols : maxName;
+      }
+    ColName_ = vector<string>(nbcols);
+     for (int k=0; k < maxName; k++) ColName_[k] = names[k];
+    if (dc >0) ddata_ = vector<double>(dc);
+    if (fc >0) fdata_ = vector<float>(fc);
+    if (ic >0) idata_ = vector<int>(fc);
+    if (cc >0) cdata_ = vector<string>(fc);
+   }
+
+bool BnTblLine::sameFormat(const BnTblLine& btl) const
+   {
+     if (btl.ddata_.size() == ddata_.size() && btl.fdata_.size() == fdata_.size() && btl.idata_.size() == idata_.size() && btl.cdata_.size() == cdata_.size()) return true;
+     else return false;
+   }
+
+void BnTblLine::Print()
+   {
+     int k;
+     cout << " ********* ligne ************* " << endl;
+     cout << " *** noms de variables  " << endl;
+     for (k=0; k < ColName_.size(); k++) cout << ColName_[k] << " ";
+     cout << endl;
+     cout << " *** variables doubles  " << endl;
+     for (k=0; k < ddata_.size(); k++) cout << ddata_[k] << " ";
+     cout << endl;
+     cout << " *** variables float  " << endl;
+     for (k=0; k < fdata_.size(); k++) cout << fdata_[k] << " ";
+     cout << endl;
+     cout << " *** variables int  " << endl;
+     for (k=0; k < idata_.size(); k++) cout << idata_[k] << " ";
+     cout << endl;
+     cout << " *** variables string  " << endl;
+     for (k=0; k < cdata_.size(); k++) cout << cdata_[k] << " ";
+     cout << endl;
+     cout << " ***************************** " << endl;
+   }
+
+
+
+/*!
+  \class SOPHYA::FitsIOHandler
+The class structure is analogous to Sophya-PPersist system :
+Each SOPHYA object XXX is associated with a object of class FITS_XXX 
+ (inheriting from FitsFileHandler), to which input/output operations with FITS 
+ files are delegated (through a class Hierarchy : FitsFile (virtual), 
+ FitsInFile, FitsOutFile) . A typical example of use is the following : 
+
+\verbatim
+  int m=... ;
+  SphereHEALPix<r_8> sphere1(m);           // definition of the SOPHYA object
+  .... fill the sphere ....
+
+  FITS_SphereHEALPix<r_8> fits_sph1(sphere1); 
+                                           // delegated object
+  fits_sph.Write("myfile.fits");           // writing on FITS file
+
+   FITS_SphereHEALPix<r_8> fits_sph2("myfile.fits"); 
+                                           // load a delegated object 
+                                           // from FITS file
+   SphereHEALPix<r_8> sphere2=(SphereHEALPix<r_8>)fits_sph2; 
+                                           // casting the delegated object
+                                           // into a SOPHYA object
+\endverbatim
+  
+
+*/
+
+/*! \fn void  SOPHYA::FitsIOHandler::Read(char flnm[],int hdunum)
+
+this method is called from inherited objects : 
+
+opens a file 'flnm' 
+
+gets parameters in extension-header (hdunum)
+
+calls the method 'ReadFromFits' from the inherited  object
+*/ 
 void   FitsIOHandler::Read(char flnm[],int hdunum)
 {
@@ -13,4 +98,8 @@
   Read(ifts, hdunum);
 }
+
+  /*! \fn void SOPHYA::FitsIOHandler::Read(FitsInFile& is, int hdunum)
+Read the data on extension hdunum (or primary header, if hdunum=1) from FitsInFIle. If hdunum is not addressed, , one reads the next extension, with respect to the current position. 
+   */
 void FitsIOHandler::Read(FitsInFile& is, int hdunum) 
 {
@@ -21,4 +110,20 @@
 
 
+/*! \fn void SOPHYA::FitsIOHandler::Write(char flnm[])
+this method is called from inherited objects. 
+
+for writing a new object in a new fits-extension :
+
+\warning By convention, primary header does not contain fits-image data : i.e. 
+all data are fits-extensions. The first relevant header will have hdunum=2.
+For switching off this convention use the method : 
+
+firstImageOnPrimaryHeader() (see below)
+
+In that case do not forget to precise hdunum=1 when reading data on primary header.
+
+calls the method 'WriteToFits' from the inherited  object
+
+*/ 
 void FitsIOHandler::Write(char flnm[]) 
 
@@ -33,4 +138,9 @@
 }
 
+
+/*!
+  \class SOPHYA::FitsIOHandler
+Class (virtual) for managing FITS format files
+*/
 
 
@@ -87,9 +197,15 @@
 }
 
+/*!
+  \class SOPHYA::FitsInFile
+
+class for saving  SOPHYA objects on FITS Format Files (uses cfitsio lib)
+*/
+
 FitsInFile::FitsInFile()
 {
   InitNull();
 }
-//FitsInFile::FitsInFile(char flnm[], int hdunum)
+
 FitsInFile::FitsInFile(char flnm[])
 {
@@ -118,4 +234,7 @@
 }
 
+//////////////////////////////////////////////////////////
+//     methods with general purpose
+/////////////////////////////////////////////////////////
 
 int FitsInFile::NbBlocks(char flnm[])
@@ -200,4 +319,48 @@
 }
 
+
+void FitsInFile::ReadFInit(int hdunum) 
+{
+   InitNull();
+  // int status = 0;
+  
+  //  fits_open_file(&fptr_,flnm,READONLY,&status);
+  //  if( status ) printerror( status );
+
+  int status = 0;
+
+  if (hdunum <= 1) 
+    {
+      hdunum_ = 1; 
+      // presence of image ?
+      int naxis= 0;
+      fits_read_key(fptr_,TINT,"NAXIS",&naxis,NULL,&status);
+      if( status ) printerror( status );
+      if (naxis > 0 )       // there is an image
+	{
+	  hdutype_ = IMAGE_HDU;
+	  GetImageParameters (fptr_, bitpix_, naxis_, naxisn_);
+	  nbData_ =  1;
+	  int k;
+	  for (k=0; k<naxis_; k++) if (naxisn_[k] > 0) nbData_ *= naxisn_[k];
+	  KeywordsIntoDVList(fptr_, dvl_,hdunum_);
+	}
+      else
+	{
+	  throw PException(" first header : no image, probably error in hdunum");
+	}
+  //
+    }
+  else 
+    {
+      hdunum_ = hdunum-1; 
+      int hdutype;
+      fits_movabs_hdu(fptr_,hdunum_,&hdutype,&status);
+      if( status ) printerror( status,":FitsFile::ReadF : erreur movabs");
+      moveToFollowingHeader();
+    }
+}
+
+
 void FitsInFile::GetImageParameters (fitsfile* fileptr,int& bitpix,int& naxis,vector<int>& naxisn)
 {
@@ -230,46 +393,11 @@
 
 
-void FitsInFile::ReadFInit(int hdunum) 
-{
-   InitNull();
-  // int status = 0;
-  
-  //  fits_open_file(&fptr_,flnm,READONLY,&status);
-  //  if( status ) printerror( status );
-
-  int status = 0;
-
-  if (hdunum <= 1) 
-    {
-      hdunum_ = 1; 
-      // presence of image ?
-      int naxis= 0;
-      fits_read_key(fptr_,TINT,"NAXIS",&naxis,NULL,&status);
-      if( status ) printerror( status );
-      if (naxis > 0 )       // there is an image
-	{
-	  hdutype_ = IMAGE_HDU;
-	  GetImageParameters (fptr_, bitpix_, naxis_, naxisn_);
-	  nbData_ =  1;
-	  int k;
-	  for (k=0; k<naxis_; k++) if (naxisn_[k] > 0) nbData_ *= naxisn_[k];
-	  KeywordsIntoDVList(fptr_, dvl_,hdunum_);
-	}
-      else
-	{
-	  throw PException(" first header : no image, probably error in hdunum");
-	}
-  //
-    }
-  else 
-    {
-      hdunum_ = hdunum-1; 
-      int hdutype;
-      fits_movabs_hdu(fptr_,hdunum_,&hdutype,&status);
-      if( status ) printerror( status,":FitsFile::ReadF : erreur movabs");
-      moveToFollowingHeader();
-    }
-}
-
+
+
+  /*! \fn DVList SOPHYA::FitsInFile::DVListFromPrimaryHeader() const
+
+   \return the keywords of primary header in a DVList 
+
+*/
 DVList  FitsInFile::DVListFromPrimaryHeader() const
    {
@@ -308,4 +436,10 @@
 
 
+
+
+
+/*! \fn int  SOPHYA::FitsInFile::NbColsFromFits() const
+\return number of columns (return 1 if IMAGE) 
+*/
 int  FitsInFile::NbColsFromFits() const
 {
@@ -320,4 +454,8 @@
 }
 
+/*! \fn  int SOPHYA::FitsInFile::NentriesFromFits(int nocol) const
+\return number of data in the current IMAGE extension on FITS file, or number
+ of data of column number 'nocol' of the current BINTABLE extension
+*/
 int FitsInFile::NentriesFromFits(int nocol) const
 {
@@ -334,4 +472,18 @@
 }
 
+/*! \fn char SOPHYA::FitsInFile::ColTypeFromFits(int nocol) const
+
+return a character denoting data type of column number 'nocol' in a BINTABLE :
+
+D : double
+
+E : float 
+
+I : integer
+    
+S : character string 
+
+  */
+
 char FitsInFile::ColTypeFromFits(int nocol) const
 {
@@ -342,4 +494,11 @@
   return types_[nocol];
 }
+
+
+/*! \fn string SOPHYA::FitsInFile::ColNameFromFits(int nocol) const
+
+\return name of the column number 'nocol' of the current BINTABLE extension
+   */
+
 string FitsInFile::ColNameFromFits(int nocol) const
 {
@@ -350,4 +509,9 @@
   return noms_[nocol];
 }
+
+/*! \fn int DSOPHYA::FitsInFile::ColStringLengthFromFits(int nocol) const
+
+ \return number of characters of each data  for the column number 'nocol' (if char* typed) of the current BINTABLE extension
+*/
 
 int FitsInFile::ColStringLengthFromFits(int nocol) const
@@ -365,4 +529,12 @@
   return  taille_des_chaines_[index];
 }
+
+
+
+/*! \fn void  SOPHYA::FitsInFile::GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char ** cdata)
+
+Get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
+  */
+
 void  FitsInFile::GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char ** cdata) 
 {
@@ -405,4 +577,7 @@
 }
 
+/*! \fn void   SOPHYA::FitsInFile::GetBinTabLine(long NoLine,  BnTblLine& ligne)
+Get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
+*/
 void   FitsInFile::GetBinTabLine(long NoLine,  BnTblLine& ligne) 
 {
@@ -447,4 +622,8 @@
 }
 
+/*! \fn void SOPHYA::FitsInFile::GetBinTabLine(int NoLine, float* fdata)
+
+Get the NoLine-th float 'line'  from the current BINTABLE extension on FITS file,
+*/
 void FitsInFile::GetBinTabLine(int NoLine, float* fdata) 
 {
@@ -466,4 +645,10 @@
 
 
+/*! \fn void SPOPHYA::FitsInFile::GetBinTabFCol(double* valeurs,int nentries, int NoCol) const
+
+fill the array 'valeurs' with double data from the current BINTABLE extension on FITS file, from column number 'NoCol'
+
+\param <nentries>  number of data to be read
+*/
 void FitsInFile::GetBinTabFCol(double* valeurs,int nentries, int NoCol) const
     {
@@ -499,4 +684,8 @@
     }
 
+/*! \fn  void SOPHYA::FitsInFile::GetBinTabFCol(float* valeurs,int nentries, int NoCol) const
+
+ same as previous method with float data 
+*/
 void FitsInFile::GetBinTabFCol(float* valeurs,int nentries, int NoCol) const
     {
@@ -531,4 +720,9 @@
     }
 
+/*! \fn void SOPHYA::FitsInFile::GetBinTabFCol(int* valeurs,int nentries, int NoCol) const
+
+ same as previous method with int data 
+*/
+
 void FitsInFile::GetBinTabFCol(int* valeurs,int nentries, int NoCol) const
     {
@@ -561,4 +755,9 @@
     }
 
+/*! \fn void SOPHYA::FitsInFile::GetBinTabFCol(char** valeurs, int nentries, int NoCol) const
+
+ same as previous method with char* data 
+*/
+
 void FitsInFile::GetBinTabFCol(char** valeurs, int nentries, int NoCol) const
     {
@@ -587,4 +786,10 @@
     }
 
+/*! \fn void SOPHYA::FitsInFile::GetSingleColumn(double* map, int nentries) const
+fill the array 'map' with double data from the current extension on FITS file.
+If the extension is BINTABLE, the first column is provided. 
+
+\param <nentries>  number of data to be read
+*/
 void FitsInFile::GetSingleColumn(double* map, int nentries) const
 { 
@@ -619,4 +824,7 @@
 }
 
+/*! \fn void SOPHYA::FitsInFile::GetSingleColumn(float* map, int nentries) const
+same as above with float data 
+*/
 void FitsInFile::GetSingleColumn(float* map, int nentries) const
 {
@@ -649,4 +857,7 @@
 }
 
+/*! \fn void SOPHYA::FitsInFile::GetSingleColumn( int* map, int nentries) const
+ same as above with int data 
+*/
 void FitsInFile::GetSingleColumn( int* map, int nentries) const
 {
@@ -866,4 +1077,10 @@
 } 
 
+
+/*!
+  \class SOPHYA::FitsOutFile
+ Class for loading  SOPHYA objects from FITS Format Files (uses cfitsio lib)
+*/
+
 FitsOutFile::FitsOutFile()
 {
@@ -871,4 +1088,9 @@
 }
 
+   /*! \fn SOPHYA::FitsOutFile::FitsOutFile(char flnm[], WriteMode wrm)
+
+\param <WriteMode>  enum , WriteMode = clear -> if alreadyy exists, the file will be overwritten (else created) ; WriteMode = append -> further objects will be appended to the file if it exists (else : file created). WriteMode = unknown -> file created if does not exist, else : exception. (the last situation is the default)
+
+   */
 FitsOutFile::FitsOutFile(char flnm[], WriteMode wrm)
 {
@@ -929,4 +1151,11 @@
 
 
+/*! \fn void SOPHYA::FitsOutFile::makeHeaderImageOnFits(char type, int nbdim, int* naxisn,  DVList &dvl) 
+
+create an IMAGE header on FITS file.
+\param <type> type of data (see method ColTypeFromFits)
+\param <nbdim>  number of dimensions : 1D, 2D, 3D etc. = NAXIS
+\param <naxisn>  array containind sizes of the different dimensions
+*/
 void FitsOutFile::makeHeaderImageOnFits(char type, int nbdim, int* naxisn,  DVList &dvl) 
 {
@@ -968,4 +1197,11 @@
 
 }
+
+
+/*! \fn void SOPHYA::FitsOutFile::PutImageToFits(int nbData, double* map) const
+
+write double data from array 'map'on an IMAGE extension 
+\param <nbData>  number of data to be written
+*/
 void FitsOutFile::PutImageToFits(int nbData, double* map) const
 {
@@ -977,4 +1213,8 @@
 }
 
+/*! \fn void SOPHYA::FitsOutFile::PutImageToFits(int nbData, float* map) const
+
+same as previous method with float data 
+*/
 void FitsOutFile::PutImageToFits(int nbData, float* map) const
 {
@@ -986,4 +1226,8 @@
 
 }
+
+  /*! \fn void SOPHYA::FitsOutFile::PutImageToFits( int nbData, int* map) const
+
+ same as previous method with int data */
 void FitsOutFile::PutImageToFits( int nbData, int* map) const
 {
@@ -998,4 +1242,16 @@
 
 
+/*! \fn void SOPHYA::FitsOutFile::makeHeaderBntblOnFits( string fieldType, vector<string> Noms, int nentries, int tfields, DVList &dvl, string extname, vector<int> taille_des_chaines)
+
+create an BINTABLE header on FITS file.
+\param <fieldType> array conta
+ining characters denoting types of the different column (see method ColTypeFromFits)
+\param <Noms>  array of the names of columns
+\param <nentries>  number of data of each column
+\param <tfields> number of columns
+\param <dvl> a SOPHYA DVList containing keywords to be appended
+\param <extname> keyword EXTNAME for FITS file
+\param <taille_des_chaines> vector containing the number of characters of  data  for each char* typed column, with order of appearance in 'fieldType'
+*/
 void FitsOutFile::makeHeaderBntblOnFits( string fieldType, vector<string> Noms, int nentries, int tfields, DVList &dvl, string extname, vector<int> taille_des_chaines) 
 { 
@@ -1092,4 +1348,9 @@
 }
 
+/*! \fn void SOPHYA::FitsOutFile::PutColToFits(int nocol, int nentries, double* donnees) const
+
+write double data from array 'donnees ' on column number 'nocol' of a BINTABLE  extension.
+\param <nentries>  number of data to be written
+*/
 void FitsOutFile::PutColToFits(int nocol, int nentries, double* donnees) const
 {
@@ -1114,4 +1375,11 @@
   if( status )  printerror( status,"erreur ecriture du fichier fits" );
 }
+
+
+
+  /*! \fn void SOPHYA::FitsOutFile::PutColToFits(int nocol, int nentries, float* donnees) const
+
+same as previous method with float data 
+*/
 void FitsOutFile::PutColToFits(int nocol, int nentries, float* donnees) const
 {
@@ -1140,4 +1408,10 @@
   if( status )  printerror( status,"erreur ecriture du fichier fits" );
 }
+
+
+/*! \fn void FitsOutFile::PutColToFits(int nocol, int nentries, int* donnees) const
+
+same as previous method with int data 
+*/
 void FitsOutFile::PutColToFits(int nocol, int nentries, int* donnees) const
 {
@@ -1166,4 +1440,9 @@
   if( status )  printerror( status," ecriture du fichier fits" );
 }
+
+
+/*! \fn void SOPHYA::FitsOutFile::PutColToFits(int nocol, int nentries, char** donnees) const
+same as previous method with char* data 
+*/
 void FitsOutFile::PutColToFits(int nocol, int nentries, char** donnees) const
 {
@@ -1228,4 +1507,8 @@
 
 
+/* \fn void  SOPHYA::FitsOutFile::DVListIntoPrimaryHeader(DVList& dvl) const
+
+Put keywords from a DVList into the primary header of the fits-file 
+*/
 void  FitsOutFile::DVListIntoPrimaryHeader(DVList& dvl) const
 {
Index: trunk/SophyaExt/FitsIOServer/fitsfile.h
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsfile.h	(revision 1217)
+++ trunk/SophyaExt/FitsIOServer/fitsfile.h	(revision 1218)
@@ -10,199 +10,69 @@
 #define LEN_KEYWORD 9
 
+// classes for saving/loading SOPHYA objects to/from FITS files...
+// Guy le Meur (september 2000)
+
+
 namespace SOPHYA {
 
-struct BnTblLine 
- {
-BnTblLine() {}
-void setFormat(int dc, int fc, int ic, int cc, vector<string> names)
-   {
-    int nbcols = dc + fc + ic + cc;
-    int maxName = names.size();
-    if (nbcols != maxName)
-      {
-	cout << " WARNING: BnTblLine:: length of vector of column names not equal to total number of columns" << endl;
-	maxName = nbcols < maxName ? nbcols : maxName;
-      }
-    ColName_ = vector<string>(nbcols);
-     for (int k=0; k < maxName; k++) ColName_[k] = names[k];
-    if (dc >0) ddata_ = vector<double>(dc);
-    if (fc >0) fdata_ = vector<float>(fc);
-    if (ic >0) idata_ = vector<int>(fc);
-    if (cc >0) cdata_ = vector<string>(fc);
-   }
-
-bool sameFormat(const BnTblLine& btl) const
-   {
-     if (btl.ddata_.size() == ddata_.size() && btl.fdata_.size() == fdata_.size() && btl.idata_.size() == idata_.size() && btl.cdata_.size() == cdata_.size()) return true;
-     else return false;
-   }
-
-void Print()
-   {
-     int k;
-     cout << " ********* ligne ************* " << endl;
-     cout << " *** noms de variables  " << endl;
-     for (k=0; k < ColName_.size(); k++) cout << ColName_[k] << " ";
-     cout << endl;
-     cout << " *** variables doubles  " << endl;
-     for (k=0; k < ddata_.size(); k++) cout << ddata_[k] << " ";
-     cout << endl;
-     cout << " *** variables float  " << endl;
-     for (k=0; k < fdata_.size(); k++) cout << fdata_[k] << " ";
-     cout << endl;
-     cout << " *** variables int  " << endl;
-     for (k=0; k < idata_.size(); k++) cout << idata_[k] << " ";
-     cout << endl;
-     cout << " *** variables string  " << endl;
-     for (k=0; k < cdata_.size(); k++) cout << cdata_[k] << " ";
-     cout << endl;
-     cout << " ***************************** " << endl;
-   }
-  vector<double> ddata_;
-  vector<float>  fdata_;
-  vector<int>    idata_;
-  vector<string>  cdata_;
-  vector<string> ColName_;
-
- };
-
- class FitsFile;
- class FitsInFile;
- class FitsOutFile;
- enum WriteMode {append, clear, unknown};
-
+  struct BnTblLine;
+  class FitsFile;
+  class FitsInFile;
+  class FitsOutFile;
+  enum WriteMode {append, clear, unknown};
+  
 
 //
 //! Class for managing Interface for SOPHYA objects to FITS Format Files (uses cfitsio lib)
 
-/*! 
-The class structure is analogous to Sophya-PPersist system :
-Each SOPHYA object XXX is associated with a object of class FITS_XXX 
- (inheriting from FitsFileHandler), to which input/output operations with FITS 
- files are delegated (through a class Hierarchy : FitsFile (virtual), 
- FitsInFile, FitsOutFile) . A typical example of use is the following : 
-
-\verbatim
-  int m=... ;
-  SphereHEALPix<r_8> sphere1(m);           // definition of the SOPHYA object
-  .... fill the sphere ....
-
-  FITS_SphereHEALPix<r_8> fits_sph1(sphere1); 
-                                           // delegated object
-  fits_sph.Write("myfile.fits");           // writing on FITS file
-
-   FITS_SphereHEALPix<r_8> fits_sph2("myfile.fits"); 
-                                           // load a delegated object 
-                                           // from FITS file
-   SphereHEALPix<r_8> sphere2=(SphereHEALPix<r_8>)fits_sph2; 
-                                           // casting the delegated object
-                                           // into a SOPHYA object
-\endverbatim
-
-*/
-
-class FitsIOHandler {
-
-
-  public:
-
-virtual ~FitsIOHandler() {}
-/*!
-this method is called from inherited objects : 
-
-opens a file 'flnm' 
-
-gets parameters in extension-header (hdunum)
-
-calls the method 'ReadFromFits' from the inherited  object
-
-
-*/ 
-  void   Read(char flnm[],int hdunum= 0);
-/*!
-this method is called from inherited objects : 
-
-for writing a new object in a new fits-extension :
-
-???
-
- at the end of 
-
-the existing file (flnm), if OldFile=true. 
-
-If OldFile=false, an exception occurs
+ class FitsIOHandler {
+
+
+ public:
+
+   virtual ~FitsIOHandler() {}
+   void   Read(char flnm[],int hdunum= 0);
+   void   Write(char flnm[]) ;
+   void   Read(FitsInFile& ifts, int hdunum=0);
+   void   Write(FitsOutFile& ofts) ;
+
+
+ protected:
+  
+   virtual void    ReadFromFits(FitsInFile& is)=0;           
+   virtual void    WriteToFits(FitsOutFile& os) =0;   
+        
+   friend class FitsInFile;
+   friend class FitsOutFile;
+  };
+
+
+//! Class (virtual) for managing FITS format files
+ class FitsFile {
+
+ public:
+
+   FitsFile() { InitNull(); };
+   virtual ~FitsFile();
+   static string GetErrStatus(int status);
+   inline  int   statusF() const { return fits_status_;}
  
-By convention, primary header does not contain fits-image data : i.e. 
-all data are fits-extensions. The first relevant header will have hdunum=2.
-For switching off this convention use the method : 
-
-firstImageOnPrimaryHeader() (see below)
-
-In that case do not forget to precise hdunum=1 when reading data on primary header.
-
-calls the method 'WriteToFits' from the inherited  object
-
-*/ 
-  void   Write(char flnm[]) ;
-
-  /*!
-Read the data on extension hdunum (or primary header, if hdunum=1) from FitsInFIle. With default value for hdunum, one reads the next extension, with respect to the current position. 
-   */
-  void   Read(FitsInFile& ifts, int hdunum=0);
-  void   Write(FitsOutFile& ofts) ;
-
-
-  protected:  
-  virtual void    ReadFromFits(FitsInFile& is)=0;           
-  virtual void    WriteToFits(FitsOutFile& os) =0;           
-  friend class FitsInFile;
-  friend class FitsOutFile;
-  private :
-  };
-
-
-
-class FitsFile
-{
-
-public:
-
-FitsFile() 
-{ 
- InitNull();
-};
-  virtual ~FitsFile();
-
-  static string GetErrStatus(int status);
-
-
-
-
-inline  int statusF() const { return fits_status_;}
- 
-
-protected:
-
-   void ResetStatus(int& status) ; 
+
+ protected:
+
+   void         ResetStatus(int& status) ; 
    static  void printerror(int&) ;
    static  void printerror(int&,char* texte) ;
-   inline void InitNull() {fptr_ = NULL; hdutype_= 0; hdunum_ = 1; 
+   inline void  InitNull() {fptr_ = NULL; hdutype_= 0; hdunum_ = 1; 
    fits_status_ = 0;}
 
-  //! pointer to the FITS file, defined in fitsio.h 
-  fitsfile *fptr_; 
-  
-  //!  image or bintable ?
-  int hdutype_;
-
-//! index of header to be read/written
-  int hdunum_;  
-
-  //! last status returned by fitsio library. updated only by several methods
-  int fits_status_;
-
-    
-};
-
+   fitsfile *fptr_;     /**<  pointer to the FITS file, defined in fitsio.h */
+   int hdutype_;        /**<  image or bintable ? */
+   int hdunum_;         /**<   index of header to be read/written */
+   int fits_status_;    /**< last status returned by fitsio library. updated only by several methods */
+
+ };
+
+//! Class for saving  SOPHYA objects on FITS Format Files (uses cfitsio lib)
 
  class FitsInFile : public  FitsFile {
@@ -210,31 +80,18 @@
  public:
    FitsInFile();
-   //   FitsInFile(char flnm[], int hdunum=0);
    FitsInFile(char flnm[]);
    ~FitsInFile() { ; };
 
-
-//////////////////////////////////////////////////////////
-//     methods with general purpose
-///////////////////////////////////////
-
-
-
-  static int NbBlocks(char flnm[]);
-  static void GetBlockType(char flnm[], int hdunum, string& typeOfExtension, int& naxis, vector<int>& naxisn, string& dataType, DVList& dvl  );
-
-
-
-  //  void ReadFInit(char flnm[],int hdunum=0);
-  void ReadFInit(int hdunum);
+   static int  NbBlocks(char flnm[]);
+   static void GetBlockType(char flnm[], int hdunum, string& typeOfExtension, int& naxis, vector<int>& naxisn, string& dataType, DVList& dvl  );
+   void        ReadFInit(int hdunum);
  
-  /*! return a reference on a DVList containing the keywords from FITS file
-   */
-inline const DVList& DVListFromFits() const { return dvl_;}
-
-/* get the keywords of primary header in a DVList */
-DVList  DVListFromPrimaryHeader() const;
-
-void moveToFollowingHeader();
+  /*! \return a reference on a DVList containing the keywords from FITS file */
+  inline const DVList& DVListFromFits() const { return dvl_;}
+
+  DVList  DVListFromPrimaryHeader() const;
+  void    moveToFollowingHeader();
+
+
 
 
@@ -242,5 +99,4 @@
        ///////   methods for managing extensions ////////////////
        //////////////////////////////////////////////////////////
-
 
 
@@ -250,18 +106,18 @@
 
 
-/*! return true if the current header  corresponds to a FITS image extension */
+
+/*! \return true if the current header  corresponds to a FITS image extension */
 inline bool IsFitsImage() const { return (hdutype_ == IMAGE_HDU);}
 
 
 
-  /*! number of dimensions of an image extension : NAXIS parameter (in FITS notations)
-   */
+  /*! \return number of dimensions of an image extension : NAXIS parameter (in FITS notations)   */
 inline int nbDimOfImage() const {return naxis_;}
-/*! a reference on a vector containing sizes of the NAXIS dimensions : NAXIS1, NAXIS2, NAXIS3 wtc.
- */
+
+/*! \return a reference on a vector containing sizes of the NAXIS dimensions : NAXIS1, NAXIS2, NAXIS3 etc.  */
  inline const vector<int>& dimOfImageAxes() const { return naxisn_;}
-/*!
- total number of data in the current IMAGE extension
- */
+
+
+/*! \return total number of data in the current IMAGE extension */
 inline int nbOfImageData() const { return nbData_; }
 
@@ -275,67 +131,24 @@
 
 
-/*! return true if the current header  corresponds to a FITS ASCII or BINTABLE extension */
+/*! \return true if the current header  corresponds to a FITS ASCII or BINTABLE extension */
 inline bool IsFitsTable() const {return (hdutype_ == ASCII_TBL || hdutype_ == BINARY_TBL);}
 
 
-static  void GetBinTabParameters(fitsfile* fileptr, int& nbcols, int& nrows,
+ static  void GetBinTabParameters(fitsfile* fileptr, int& nbcols, int& nrows,
 				  vector<int>& repeat,
 				  vector<string>& noms, 
 				  vector<char>& types,   
 				  vector<int>&  taille_des_chaines);
-
-
-
-  /*! return a character denoting data type of column number 'nocol' in a BINTABLE :
-
-D : double
-
-E : float 
-
-I : integer
-    
-S : character string 
-
-  */
-  char    ColTypeFromFits(int nocol) const;
-  /*! name of the column number 'nocol' of the current BINTABLE extension
-   */
-  string  ColNameFromFits(int nocol) const;
-
-  /*! number of characters of each data  for the column number 'nocol' (if char* typed) of the current BINTABLE extension
-   */
-  int     ColStringLengthFromFits(int nocol) const;
-
-
-
-  /*!
-Get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
-  */
-  void GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char
+ char   ColTypeFromFits(int nocol) const;
+ string ColNameFromFits(int nocol) const;
+ int    ColStringLengthFromFits(int nocol) const;
+ void   GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char
 ** cdata) ;
-  /*!
-Get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
-  */
-  void GetBinTabLine(long NoLine, BnTblLine& ligne) ;
-
-  /*!
-Get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
-  */
-  void GetBinTabLine(int NoLine, float* fdata) ;
-
-/*!
-fill the array 'valeurs' with double data from the current BINTABLE extension on FITS file, from column number 'NoCol'
-
-\param <nentries>  number of data to be read
-  */
-  void GetBinTabFCol(double* valeurs, int nentries, int NoCol) const;
-
-  /*! same as previous method with float data */
-  void GetBinTabFCol(float* valeurs, int nentries, int NoCol) const;
-  /*! same as previous method with int data */
-  void GetBinTabFCol(int* valeurs, int nentries,  int NoCol) const;
-  /*! same as previous method with char* data */
-  void GetBinTabFCol(char** valeurs,int nentries, int NoCol) const;
-  // Write elements into the FITS data array
+ void   GetBinTabLine(long NoLine, BnTblLine& ligne) ;
+ void   GetBinTabLine(int NoLine, float* fdata) ;
+ void   GetBinTabFCol(double* valeurs, int nentries, int NoCol) const;
+ void   GetBinTabFCol(float* valeurs, int nentries, int NoCol) const;
+ void   GetBinTabFCol(int* valeurs, int nentries,  int NoCol) const;
+ void   GetBinTabFCol(char** valeurs,int nentries, int NoCol) const;
 
 /////////////////////////////////////////////////////////////
@@ -343,24 +156,12 @@
 ////////////////////////////////////////////////////////
 
- /*! return number of columns (return 1 if IMAGE) */
   int     NbColsFromFits() const;
-  /*! number of data in the current IMAGE extension on FITS file, or number
- of data of column number 'nocol' of the current BINTABLE extension
-  */
   int     NentriesFromFits(int nocol) const;
 
 
-/*!
-fill the array 'map' with double data from the current extension on FITS file.
-If the extension is BINTABLE, the first column is provided. 
-
-\param <nentries>  number of data to be read
-  */
   void    GetSingleColumn(double* map, int nentries) const;
 
-  /*! same as above with float data */
   void    GetSingleColumn(float*  map, int nentries) const;
 
-  /*! same as above with int data */
   void    GetSingleColumn(int* map, int nentries) const;
 
@@ -371,43 +172,19 @@
 static  void GetImageParameters (fitsfile* fileptr,int& bitpix,int& naxis,vector<int>& naxisn);
 
-
- 
-
-  //! fits-Image parameter 
-  int bitpix_;
-
-  //! fits-Image parameter 
-  int naxis_;
-
-  //! fits-Image parameters : sizes of dimensions
-  vector<int> naxisn_;
-
-  //! fits-Image parameter: number of data 
-  int nbData_;
-
-  //! Bintable parameter
-  int nrows_;
-
-  //! Bintable parameter
-  vector<int> repeat_;
-
-  //! Bintable parameter
-  int nbcols_;
-
-  //! Bintable parameter: column names
-  vector<string> noms_; 
-
-  //! Bintable parameters: types of columns (D: double, E: float, I: integers,  A: char*)
-  vector<char> types_;   
-
-  //! Bintable parameters:   length of the char* variables                 
-  vector<int>  taille_des_chaines_;
-
-  //! DVList for transferring keywords
-  DVList dvl_;
-
-
- };
-
+ int bitpix_;          /**< fits-Image parameter */
+ int naxis_;           /**< fits-Image parameter */
+ vector<int> naxisn_;  /**< fits-Image parameters : sizes of dimensions */
+ int nbData_;          /*< fits-Image parameter: number of data */
+ int nrows_;           /**< Bintable parameter */
+ vector<int> repeat_;  /**< Bintable parameter */
+ int nbcols_;          /**< Bintable parameter */
+ vector<string> noms_; /**< Bintable parameter: column names */
+ vector<char> types_;  /**< Bintable parameters: types of columns (D: double, E: float, I: integers,  A: char*) */
+ DVList dvl_;          /**< DVList for transferring keywords */
+ vector<int>  taille_des_chaines_; /**< Bintable parameters:   length of the char* variables */
+
+ };
+
+//! Class for loading  SOPHYA objects from FITS Format Files (uses cfitsio lib)
 
  class FitsOutFile : public  FitsFile {
@@ -417,8 +194,4 @@
 
    FitsOutFile();
-   /*!
-\param <WriteMode>  enum , WriteMode = clear -> if alreadyy exists, the file will be overwritten (else created) ; WriteMode = append -> further objects will be appended to the file if it exists (else : file created). WriteMode = unknown -> file created if does not exist, else : exception. (the last situation is the default)
-
-   */
    FitsOutFile(char flnm[], WriteMode wrm = unknown );
    ~FitsOutFile() { ;};
@@ -437,24 +210,8 @@
 
    inline void firstImageOnPrimaryHeader() {imageOnPrimary_=true;}
-
-  /*! create an IMAGE header on FITS file.
-\param <type> type of data (see method ColTypeFromFits)
-\param <nbdim>  number of dimensions : 1D, 2D, 3D etc. = NAXIS
-\param <naxisn>  array containind sizes of the different dimensions
-  */
-  void makeHeaderImageOnFits(char type, int nbdim, int* naxisn,  DVList &dvl) ;
-
-
-  /*! write double data from array 'map'on an IMAGE extension 
-\param <nbData>  number of data to be written
-
-   */
-  void PutImageToFits( int nbData, double* map) const;
-
-  /*! same as previous method with float data */
-  void PutImageToFits(int nbData, float* map ) const;
-
-  /*! same as previous method with int data */
-  void PutImageToFits(int nbData, int* map) const;
+   void makeHeaderImageOnFits(char type, int nbdim, int* naxisn, DVList &dvl) ;
+   void PutImageToFits( int nbData, double* map) const;
+   void PutImageToFits(int nbData, float* map ) const;
+   void PutImageToFits(int nbData, int* map) const;
 
 
@@ -466,32 +223,10 @@
 
 
-  /*! create an BINTABLE header on FITS file.
-\param <fieldType> array conta
-ining characters denoting types of the different column (see method ColTypeFromFits)
-\param <Noms>  array of the names of columns
-\param <nentries>  number of data of each column
-\param <tfields> number of columns
-\param <dvl> a SOPHYA DVList containing keywords to be appended
-\param <extname> keyword EXTNAME for FITS file
-\param <taille_des_chaines> vector containing the number of characters of  data  for each char* typed column, with order of appearance in 'fieldType'
-   */
    void makeHeaderBntblOnFits ( string fieldType, vector<string> Noms, int nentries, int tfields, DVList &dvl, string extname,  vector<int> taille_des_chaines) ;
-
-  /*! write double data from array 'donnees ' on column number 'nocol' of a BINTABLE  extension.
-\param <nentries>  number of data to be written
-
-   */
-  void PutColToFits(int nocol, int nentries, double* donnees) const;
-
-  /*! same as previous method with float data */
-  void PutColToFits(int nocol, int nentries, float* donnees) const;
-
-  /*! same as previous method with int data */
-  void PutColToFits(int nocol, int nentries, int* donnees) const;
-
-  /*! same as previous method with char* data */
-  void PutColToFits(int nocol, int nentries, char** donnees) const;
-
-  void PutBinTabLine(long NoLine,  BnTblLine& ligne) const;
+   void PutColToFits(int nocol, int nentries, double* donnees) const;
+   void PutColToFits(int nocol, int nentries, float* donnees) const;
+   void PutColToFits(int nocol, int nentries, int* donnees) const;
+   void PutColToFits(int nocol, int nentries, char** donnees) const;
+   void PutBinTabLine(long NoLine,  BnTblLine& ligne) const;
 
 
@@ -501,5 +236,4 @@
 
 
-/* Put keywords from a DVList into the primary header of the fits-file */
 void  DVListIntoPrimaryHeader(DVList& dvl) const;
 
@@ -515,4 +249,19 @@
  };
 
+ struct BnTblLine 
+ {
+   BnTblLine() {}
+   void setFormat(int dc, int fc, int ic, int cc, vector<string> names);
+   bool sameFormat(const BnTblLine& btl) const;
+
+   void Print();
+
+   vector<double> ddata_;
+   vector<float>  fdata_;
+   vector<int>    idata_;
+   vector<string>  cdata_;
+   vector<string> ColName_;
+
+ };
 
 
Index: trunk/SophyaLib/Samba/lambdaBuilder.cc
===================================================================
--- trunk/SophyaLib/Samba/lambdaBuilder.cc	(revision 1217)
+++ trunk/SophyaLib/Samba/lambdaBuilder.cc	(revision 1218)
@@ -1,4 +1,15 @@
 #include "lambdaBuilder.h"
 #include "nbconst.h"
+
+
+/*!
+  \class SOPHYA::Legendre
+generate Legendre polynomials : use in two steps : 
+
+a) instanciate Legendre(\f$x\f$, \f$lmax\f$) ; \f$x\f$ is the value for wich Legendre polynomials will be required (usually equal to \f$\cos \theta\f$) and \f$lmax\f$ is the MAXIMUM value of the order of polynomials wich will be required in the following code (all polynomials, from \f$l=0 to lmax\f$, are computed once for all by an iterative formula).
+
+b) get the value of Legendre polynomial for a particular value of \f$l\f$ by calling the method getPl.
+
+*/
 
 
@@ -12,4 +23,9 @@
   array_init(lmax);
 }
+   
+/*! \fn void SOPHYA::Legendre::array_init(int_4 lmax)
+
+compute all \f$P_l(x,l_{max})\f$ for \f$l=1,l_{max}\f$ 
+*/
 void Legendre::array_init(int_4 lmax)
 {
@@ -28,4 +44,27 @@
 TVector<r_8>* LambdaLMBuilder::normal_l_     = NULL;
 
+
+
+/*! \class SOPHYA::LambdaLMBuilder
+
+
+This class generate the coefficients :
+\f[
+            \lambda_l^m=\sqrt{\frac{2l+1}{4\pi}\frac{(l-m)!}{(l+m)!}}
+	    P_l^m(\cos{\theta})
+\f]
+where \f$P_l^m\f$ are the associated Legendre polynomials.  The above coefficients contain the theta-dependance of spheric harmonics : 
+\f[
+            Y_{lm}(\cos{\theta})=\lambda_l^m(\cos{\theta}) e^{im\phi}.
+\f]
+
+Each object has a fixed theta (radians), and maximum l and m to be calculated
+(lmax and mmax).
+ use the class in two steps : 
+a) instanciate  LambdaLMBuilder(\f$\theta\f$, \f$lmax\f$, \f$mmax\f$) ;  \f$lmax\f$ and \f$mmax\f$ are  MAXIMUM values for which \f$\lambda_l^m\f$ will be required in the following code (all coefficients, from \f$l=0 to lmax\f$, are computed once for all by an iterative formula).
+b) get the values of coefficients for  particular values of \f$l\f$ and \f$m\f$ by calling the method lamlm.
+*/
+
+
 LambdaLMBuilder::LambdaLMBuilder(r_8 theta,int_4 lmax, int_4 mmax)
     {
@@ -84,4 +123,8 @@
 
 
+/*! \fn void  SOPHYA::LambdaLMBuilder::updateArrayRecurrence(int_4 lmax)
+
+ compute a static array of coefficients independant from theta (common to all instances of the LambdaBuilder Class 
+*/
 void  LambdaLMBuilder::updateArrayRecurrence(int_4 lmax)
    {
@@ -98,5 +141,8 @@
    }
 
-
+/*! \fn void  SOPHYA::LambdaLMBuilder::updateArrayLamNorm()
+
+ compute  static arrays of coefficients independant from theta (common to all instances of the derived  classes 
+*/
 void  LambdaLMBuilder::updateArrayLamNorm()
      {
@@ -119,4 +165,37 @@
 
 
+/*! \class SOPHYA::LambdaWXBuilder
+
+This class generates the coefficients :
+\f[
+            _{w}\lambda_l^m=-2\sqrt{\frac{2(l-2)!}{(l+2)!}\frac{(2l+1)}{4\pi}\frac{(l-m)!}{(l+m)!}} G^+_{lm}
+\f]
+\f[
+            _{x}\lambda_l^m=-2\sqrt{\frac{2(l-2)!}{(l+2)!}\frac{(2l+1)}{4\pi}\frac{(l-m)!}{(l+m)!}}G^-_{lm}
+\f]
+where
+\f[G^+_{lm}(\cos{\theta})=-\left( \frac{l-m^2}{\sin^2{\theta}}+\frac{1}{2}l\left(l-1\right)\right)P_l^m(\cos{\theta})+\left(l+m\right)\frac{\cos{\theta}}{\sin^2{\theta}}P^m_{l-1}(\cos{\theta})
+\f]
+and
+\f[G^-_{lm}(\cos{\theta})=\frac{m}{\sin^2{\theta}}\left(\left(l-1\right)\cos{\theta}P^m_l(\cos{\theta})-\left(l+m\right)P^m_{l-1}(\cos{\theta})\right)
+\f]
+ \f$P_l^m\f$ are the associated Legendre polynomials.
+
+The coefficients express the theta-dependance of the \f$W_{lm}(\cos{\theta})\f$ and \f$X_{lm}(\cos{\theta})\f$ functions :
+\f[W_{lm}(\cos{\theta}) = \sqrt{\frac{(l+2)!}{2(l-2)!}}_w\lambda_l^m(\cos{\theta})e^{im\phi}
+\f]
+\f[X_{lm}(\cos{\theta}) = -i\sqrt{\frac{(l+2)!}{2(l-2)!}}_x\lambda_l^m(\cos{\theta})e^{im\phi}
+\f]
+ where \f$W_{lm}(\cos{\theta})\f$ and \f$X_{lm}(\cos{\theta})\f$ are defined as :
+
+\f[
+W_{lm}(\cos{\theta})=-\frac{1}{2}\sqrt{\frac{(l+2)!}{(l-2)!}}\left(
+_{+2}Y_l^m(\cos{\theta})+_{-2}Y_l^m(\cos{\theta})\right)
+\f]
+\f[X_{lm}(\cos{\theta})=-\frac{i}{2}\sqrt{\frac{(l+2)!}{(l-2)!}}\left(
+_{+2}Y_l^m(\cos{\theta})-_{-2}Y_l^m(\cos{\theta})\right)
+\f]
+
+*/
 
 
@@ -173,4 +252,21 @@
    }
 
+/*!   \class SOPHYA::LambdaPMBuilder
+
+This class generates the coefficients
+\f[
+            _{\pm}\lambda_l^m=2\sqrt{\frac{(l-2)!}{(l+2)!}\frac{(2l+1)}{4\pi}\frac{(l-m)!}{(l+m)!}}\left( G^+_{lm} \mp G^-_{lm}\right)
+\f]
+where
+\f[G^+_{lm}(\cos{\theta})=-\left( \frac{l-m^2}{\sin^2{\theta}}+\frac{1}{2}l\left(l-1\right)\right)P_l^m(\cos{\theta})+\left(l+m\right)\frac{\cos{\theta}}{\sin^2{\theta}}P^m_{l-1}(\cos{\theta})
+\f]
+and
+\f[G^-_{lm}(\cos{\theta})=\frac{m}{\sin^2{\theta}}\left(\left(l-1\right)\cos{\theta}P^m_l(\cos{\theta})-\left(l+m\right)P^m_{l-1}(\cos{\theta})\right)
+\f]
+and \f$P_l^m\f$ are the associated Legendre polynomials.
+The coefficients express the theta-dependance of the  spin-2 spherical harmonics :
+\f[_{\pm2}Y_l^m(\cos{\theta})=_\pm\lambda_l^m(\cos{\theta})e^{im\phi}
+\f]
+*/
 
 LambdaPMBuilder::LambdaPMBuilder(r_8 theta, int_4 lmax, int_4 mmax) : LambdaLMBuilder(theta, lmax, mmax)
Index: trunk/SophyaLib/Samba/lambdaBuilder.h
===================================================================
--- trunk/SophyaLib/Samba/lambdaBuilder.h	(revision 1217)
+++ trunk/SophyaLib/Samba/lambdaBuilder.h	(revision 1218)
@@ -10,11 +10,5 @@
 namespace SOPHYA {
 
-/*! 
-generate Legendre polynomials : use in two steps : 
-
-a) instanciate Legendre(\f$x\f$, \f$lmax\f$) ; \f$x\f$ is the value for wich Legendre polynomials will be required (usually equal to \f$\cos \theta\f$) and \f$lmax\f$ is the MAXIMUM value of the order of polynomials wich will be required in the following code (all polynomials, from \f$l=0 to lmax\f$, are computed once for all by an iterative formula).
-
-b) get the value of Legendre polynomial for a particular value of \f$l\f$ by calling the method getPl.
-*/
+/*!  classe pour les polynomes de legendre*/
 class Legendre {
 
@@ -32,5 +26,4 @@
 
  private : 
-   /*! compute all \f$P_l(x,l_{max})\f$ for \f$l=1,l_{max}\f$ */
   void array_init(int_4 lmax);
 
@@ -42,21 +35,4 @@
 
 
-/*! 
-This class generate the coefficients :
-\f[
-            \lambda_l^m=\sqrt{\frac{2l+1}{4\pi}\frac{(l-m)!}{(l+m)!}}
-	    P_l^m(\cos{\theta})
-\f]
-where \f$P_l^m\f$ are the associated Legendre polynomials.  The above coefficients contain the theta-dependance of spheric harmonics : 
-\f[
-            Y_{lm}(\cos{\theta})=\lambda_l^m(\cos{\theta}) e^{im\phi}.
-\f]
-
-Each object has a fixed theta (radians), and maximum l and m to be calculated
-(lmax and mmax).
- use the class in two steps : 
-a) instanciate  LambdaLMBuilder(\f$\theta\f$, \f$lmax\f$, \f$mmax\f$) ;  \f$lmax\f$ and \f$mmax\f$ are  MAXIMUM values for which \f$\lambda_l^m\f$ will be required in the following code (all coefficients, from \f$l=0 to lmax\f$, are computed once for all by an iterative formula).
-b) get the values of coefficients for  particular values of \f$l\f$ and \f$m\f$ by calling the method lamlm.
-*/
  class LambdaLMBuilder {
 
@@ -71,5 +47,4 @@
 
  private:
-/*! compute a static array of coefficients independant from theta (common to all instances of the LambdaBuilder Class */
  void updateArrayRecurrence(int_4 lmax);
 
@@ -82,5 +57,4 @@
  protected :
 
-/*! compute  static arrays of coefficients independant from theta (common to all instances of the derived  classes */
  void updateArrayLamNorm();
 
@@ -96,37 +70,4 @@
 
 
-/*! 
-
-This class generates the coefficients :
-\f[
-            _{w}\lambda_l^m=-2\sqrt{\frac{2(l-2)!}{(l+2)!}\frac{(2l+1)}{4\pi}\frac{(l-m)!}{(l+m)!}} G^+_{lm}
-\f]
-\f[
-            _{x}\lambda_l^m=-2\sqrt{\frac{2(l-2)!}{(l+2)!}\frac{(2l+1)}{4\pi}\frac{(l-m)!}{(l+m)!}}G^-_{lm}
-\f]
-where
-\f[G^+_{lm}(\cos{\theta})=-\left( \frac{l-m^2}{\sin^2{\theta}}+\frac{1}{2}l\left(l-1\right)\right)P_l^m(\cos{\theta})+\left(l+m\right)\frac{\cos{\theta}}{\sin^2{\theta}}P^m_{l-1}(\cos{\theta})
-\f]
-and
-\f[G^-_{lm}(\cos{\theta})=\frac{m}{\sin^2{\theta}}\left(\left(l-1\right)\cos{\theta}P^m_l(\cos{\theta})-\left(l+m\right)P^m_{l-1}(\cos{\theta})\right)
-\f]
- \f$P_l^m\f$ are the associated Legendre polynomials.
-
-The coefficients express the theta-dependance of the \f$W_{lm}(\cos{\theta})\f$ and \f$X_{lm}(\cos{\theta})\f$ functions :
-\f[W_{lm}(\cos{\theta}) = \sqrt{\frac{(l+2)!}{2(l-2)!}}_w\lambda_l^m(\cos{\theta})e^{im\phi}
-\f]
-\f[X_{lm}(\cos{\theta}) = -i\sqrt{\frac{(l+2)!}{2(l-2)!}}_x\lambda_l^m(\cos{\theta})e^{im\phi}
-\f]
- where \f$W_{lm}(\cos{\theta})\f$ and \f$X_{lm}(\cos{\theta})\f$ are defined as :
-
-\f[
-W_{lm}(\cos{\theta})=-\frac{1}{2}\sqrt{\frac{(l+2)!}{(l-2)!}}\left(
-_{+2}Y_l^m(\cos{\theta})+_{-2}Y_l^m(\cos{\theta})\right)
-\f]
-\f[X_{lm}(\cos{\theta})=-\frac{i}{2}\sqrt{\frac{(l+2)!}{(l-2)!}}\left(
-_{+2}Y_l^m(\cos{\theta})-_{-2}Y_l^m(\cos{\theta})\right)
-\f]
-
-*/
 class LambdaWXBuilder : public LambdaLMBuilder
 {
@@ -156,21 +97,4 @@
 };
 
-/*! 
-
-This class generates the coefficients
-\f[
-            _{\pm}\lambda_l^m=2\sqrt{\frac{(l-2)!}{(l+2)!}\frac{(2l+1)}{4\pi}\frac{(l-m)!}{(l+m)!}}\left( G^+_{lm} \mp G^-_{lm}\right)
-\f]
-where
-\f[G^+_{lm}(\cos{\theta})=-\left( \frac{l-m^2}{\sin^2{\theta}}+\frac{1}{2}l\left(l-1\right)\right)P_l^m(\cos{\theta})+\left(l+m\right)\frac{\cos{\theta}}{\sin^2{\theta}}P^m_{l-1}(\cos{\theta})
-\f]
-and
-\f[G^-_{lm}(\cos{\theta})=\frac{m}{\sin^2{\theta}}\left(\left(l-1\right)\cos{\theta}P^m_l(\cos{\theta})-\left(l+m\right)P^m_{l-1}(\cos{\theta})\right)
-\f]
-and \f$P_l^m\f$ are the associated Legendre polynomials.
-The coefficients express the theta-dependance of the  spin-2 spherical harmonics :
-\f[_{\pm2}Y_l^m(\cos{\theta})=_\pm\lambda_l^m(\cos{\theta})e^{im\phi}
-\f]
-*/
 class LambdaPMBuilder : public LambdaLMBuilder
 {
Index: trunk/SophyaLib/Samba/sphericaltransformserver.cc
===================================================================
--- trunk/SophyaLib/Samba/sphericaltransformserver.cc	(revision 1217)
+++ trunk/SophyaLib/Samba/sphericaltransformserver.cc	(revision 1218)
@@ -8,5 +8,143 @@
 #include "nbmath.h"
 
-
+/*! \class SOPHYA::SphericalTransformServer
+
+ Class for performing analysis and synthesis of sky maps using spin-0 or spin-2 spherical harmonics.
+
+Maps must be SOPHYA SphericalMaps (SphereGorski or SphereThetaPhi).
+
+Temperature and polarization (Stokes parameters) can be developped on spherical harmonics : 
+\f[
+\frac{\Delta T}{T}(\hat{n})=\sum_{lm}a_{lm}^TY_l^m(\hat{n})
+\f]
+\f[
+Q(\hat{n})=\frac{1}{\sqrt{2}}\sum_{lm}N_l\left(a_{lm}^EW_{lm}(\hat{n})+a_{lm}^BX_{lm}(\hat{n})\right)
+\f]
+\f[
+U(\hat{n})=-\frac{1}{\sqrt{2}}\sum_{lm}N_l\left(a_{lm}^EX_{lm}(\hat{n})-a_{lm}^BW_{lm}(\hat{n})\right)
+\f]
+\f[
+\left(Q \pm iU\right)(\hat{n})=\sum_{lm}a_{\pm 2lm}\, _{\pm 2}Y_l^m(\hat{n})
+\f]
+
+\f[
+Y_l^m(\hat{n})=\lambda_l^m(\theta)e^{im\phi}
+\f]
+\f[
+_{\pm}Y_l^m(\hat{n})=_{\pm}\lambda_l^m(\theta)e^{im\phi}
+\f]
+\f[
+W_{lm}(\hat{n})=\frac{1}{N_l}\,_{w}\lambda_l^m(\theta)e^{im\phi}
+\f]
+\f[
+X_{lm}(\hat{n})=\frac{-i}{N_l}\,_{x}\lambda_l^m(\theta)e^{im\phi}
+\f]
+
+(see LambdaLMBuilder, LambdaPMBuilder, LambdaWXBuilder classes)
+
+power spectra : 
+
+\f[
+C_l^T=\frac{1}{2l+1}\sum_{m=0}^{+ \infty }\left|a_{lm}^T\right|^2=\langle\left|a_{lm}^T\right|^2\rangle 
+\f]
+\f[
+C_l^E=\frac{1}{2l+1}\sum_{m=0}^{+\infty}\left|a_{lm}^E\right|^2=\langle\left|a_{lm}^E\right|^2\rangle 
+\f]
+\f[
+C_l^B=\frac{1}{2l+1}\sum_{m=0}^{+\infty}\left|a_{lm}^B\right|^2=\langle\left|a_{lm}^B\right|^2\rangle 
+\f]
+
+\arg
+\b Synthesis : Get temperature and polarization maps  from \f$a_{lm}\f$ coefficients or from power spectra, (methods GenerateFrom...).
+
+\b Temperature:
+\f[
+\frac{\Delta T}{T}(\hat{n})=\sum_{lm}a_{lm}^TY_l^m(\hat{n}) = \sum_{-\infty}^{+\infty}b_m(\theta)e^{im\phi}
+\f]
+
+with 
+\f[
+b_m(\theta)=\sum_{l=\left|m\right|}^{+\infty}a_{lm}^T\lambda_l^m(\theta)
+\f]
+
+\b Polarisation
+\f[
+Q \pm iU = \sum_{-\infty}^{+\infty}b_m^{\pm}(\theta)e^{im\phi}
+\f]
+
+where :
+\f[
+b_m^{\pm}(\theta) = \sum_{l=\left|m\right|}^{+\infty}a_{\pm 2lm}\,_{\pm}\lambda_l^m(\theta)
+\f]
+
+or :
+\f[
+Q  = \sum_{-\infty}^{+\infty}b_m^{Q}(\theta)e^{im\phi}
+\f]
+\f[
+U  = \sum_{-\infty}^{+\infty}b_m^{U}(\theta)e^{im\phi}
+\f]
+
+where: 
+\f[
+b_m^{Q}(\theta) = \frac{1}{\sqrt{2}}\sum_{l=\left|m\right|}^{+\infty}\left(a_{lm}^E\,_{w}\lambda_l^m(\theta)-ia_{lm}^B\,_{x}\lambda_l^m(\theta)\right)
+\f]
+\f[
+b_m^{U}(\theta) = \frac{1}{\sqrt{2}}\sum_{l=\left|m\right|}^{+\infty}\left(ia_{lm}^E\,_{x}\lambda_l^m(\theta)+a_{lm}^B\,_{w}\lambda_l^m(\theta)\right)
+\f]
+
+Since the pixelization provides "slices" with constant \f$\theta\f$ and \f$\phi\f$ equally distributed  on \f$2\pi\f$  \f$\frac{\Delta T}{T}\f$, \f$Q\f$,\f$U\f$  can be computed by FFT.
+
+
+\arg
+\b Analysis :  Get \f$a_{lm}\f$ coefficients or  power spectra from temperature and polarization maps   (methods DecomposeTo...). 
+
+\b Temperature:
+\f[
+a_{lm}^T=\int\frac{\Delta T}{T}(\hat{n})Y_l^{m*}(\hat{n})d\hat{n}
+\f]
+
+approximated as : 
+\f[
+a_{lm}^T=\sum_{\theta_k}\omega_kC_m(\theta_k)\lambda_l^m(\theta_k)
+\f]
+where :
+\f[
+C_m (\theta _k)=\sum_{\phi _{k\prime}}\frac{\Delta T}{T}(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
+\f]
+Since the pixelization provides "slices" with constant \f$\theta\f$ and \f$\phi\f$ equally distributed  on \f$2\pi\f$ (\f$\omega_k\f$ is the solid angle of each pixel of the slice \f$\theta_k\f$) \f$C_m\f$ can be computed by FFT.
+
+\b polarisation:
+
+\f[
+a_{\pm 2lm}=\sum_{\theta_k}\omega_kC_m^{\pm}(\theta_k)\,_{\pm}\lambda_l^m(\theta_k)
+\f]
+where :
+\f[
+C_m^{\pm} (\theta _k)=\sum_{\phi _{k\prime}}\left(Q \pm iU\right)(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
+\f]
+or :
+
+\f[
+a_{lm}^E=\frac{1}{\sqrt{2}}\sum_{\theta_k}\omega_k\left(C_m^{Q}(\theta_k)\,_{w}\lambda_l^m(\theta_k)-iC_m^{U}(\theta_k)\,_{x}\lambda_l^m(\theta_k)\right)
+\f]
+\f[
+a_{lm}^B=\frac{1}{\sqrt{2}}\sum_{\theta_k}\omega_k\left(iC_m^{Q}(\theta_k)\,_{x}\lambda_l^m(\theta_k)+C_m^{U}(\theta_k)\,_{w}\lambda_l^m(\theta_k)\right)
+\f]
+
+where : 
+\f[
+C_m^{Q} (\theta _k)=\sum_{\phi _{k\prime}}Q(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
+\f]
+\f[
+C_m^{U} (\theta _k)=\sum_{\phi _{k\prime}}U(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
+\f]
+
+ */
+
+ /*! \fn void SOPHYA::SphericalTransformServer::GenerateFromAlm( SphericalMap<T>& map, int_4 pixelSizeIndex, const Alm<T>& alm) const
+
+ synthesis of a temperature  map from  Alm coefficients 
+*/
 template<class T>
 void SphericalTransformServer<T>::GenerateFromAlm( SphericalMap<T>& map, int_4 pixelSizeIndex, const Alm<T>& alm) const
@@ -125,4 +263,10 @@
 
 
+  /*! \fn TVector< complex<T> >  SOPHYA::SphericalTransformServer::fourierSynthesisFromB(const Bm<complex<T> >& b_m,  int_4 nph, r_8 phi0) const
+
+\return a vector with nph elements  which are  sums :\f$\sum_{m=-mmax}^{mmax}b_m(\theta)e^{im\varphi}\f$ for nph values of \f$\varphi\f$ regularly distributed in \f$[0,\pi]\f$ ( calculated by FFT)
+
+  The object b_m (\f$b_m\f$) of the class Bm is a special vector which index goes from -mmax to mmax. 
+  */
 template<class T>
 TVector< complex<T> >  SphericalTransformServer<T>::fourierSynthesisFromB(const Bm<complex<T> >& b_m,  int_4 nph, r_8 phi0) const
@@ -205,4 +349,7 @@
 
 //********************************************
+/*! \fn TVector<T>  SOPHYA::SphericalTransformServer::RfourierSynthesisFromB(const Bm<complex<T> >& b_m,  int_4 nph, r_8 phi0) const
+
+same as fourierSynthesisFromB, but return a real vector, taking into account the fact that b(-m) is conjugate of b(m) */
 template<class T>
 TVector<T>  SphericalTransformServer<T>::RfourierSynthesisFromB(const Bm<complex<T> >& b_m,  int_4 nph, r_8 phi0) const
@@ -285,4 +432,12 @@
 //*******************************************
 
+ /*! \fn  Alm<T> SOPHYA::SphericalTransformServer::DecomposeToAlm(const SphericalMap<T>& map, int_4 nlmax, r_8 cos_theta_cut) const
+
+\return the Alm coefficients from analysis of a temperature map.
+
+    \param<nlmax> : maximum value of the l index
+
+     \param<cos_theta_cut> : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
+  */ 
 template<class T>
  Alm<T> SphericalTransformServer<T>::DecomposeToAlm(const SphericalMap<T>& map, int_4 nlmax, r_8 cos_theta_cut) const
@@ -346,4 +501,9 @@
   return alm;
 }
+  /*! \fn TVector< complex<T> > SOPHYA::SphericalTransformServer::CFromFourierAnalysis(int_4 nmmax, const TVector<complex<T> >datain, r_8 phi0) const
+
+\return a vector with mmax elements  which are  sums :
+\f$\sum_{k=0}^{nphi}datain(\theta,\varphi_k)e^{im\varphi_k}\f$ for (mmax+1) values of \f$m\f$ from 0 to mmax.
+   */
 template<class T>
 TVector< complex<T> > SphericalTransformServer<T>::CFromFourierAnalysis(int_4 nmmax, const TVector<complex<T> >datain, r_8 phi0) const
@@ -384,4 +544,7 @@
 
 //&&&&&&&&& nouvelle version
+/* \fn TVector< complex<T> > SOPHYA::SphericalTransformServer::CFromFourierAnalysis(int_4 nmmax, const TVector<T> datain, r_8 phi0) const
+
+same as previous one, but with a "datain" which is real (not complex) */
 template<class T>
 TVector< complex<T> > SphericalTransformServer<T>::CFromFourierAnalysis(int_4 nmmax, const TVector<T> datain, r_8 phi0) const
@@ -445,4 +608,11 @@
 }
 
+ /*! \fn void SOPHYA::SphericalTransformServer::GenerateFromAlm(SphericalMap<T>& mapq,
+					       SphericalMap<T>& mapu, 
+					       int_4 pixelSizeIndex,
+					       const Alm<T>& alme,
+					       const Alm<T>& almb) const
+
+synthesis of a polarization map from  Alm coefficients. The spheres mapq and mapu contain respectively the Stokes parameters. */
 template<class T>
 void SphericalTransformServer<T>::GenerateFromAlm(SphericalMap<T>& mapq,
@@ -521,4 +691,20 @@
 
 
+ /*! \fn void SOPHYA::SphericalTransformServer::DecomposeToAlm(const SphericalMap<T>& mapq,
+					      const SphericalMap<T>& mapu,
+					      Alm<T>& alme,
+					      Alm<T>& almb,
+					      int_4 nlmax,
+					      r_8 cos_theta_cut) const
+
+analysis of a polarization map into Alm coefficients.
+
+ The spheres \c mapq and \c mapu contain respectively the Stokes parameters. 
+
+ \c a2lme and \c a2lmb will receive respectively electric and magnetic Alm's
+    nlmax : maximum value of the l index
+
+ \c cos_theta_cut : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
+ */ 
 template<class T>
 void SphericalTransformServer<T>::DecomposeToAlm(const SphericalMap<T>& mapq,
@@ -578,4 +764,27 @@
 
 
+ /*! \fn void SOPHYA::SphericalTransformServer::almFromWX(int_4 nlmax, int_4 nmmax,
+					 r_8 phi0, r_8 domega, 
+					 r_8 theta, 
+					 const TVector<T>& dataq, 
+					 const TVector<T>& datau,
+					 Alm<T>& alme,
+					 Alm<T>& almb) const
+
+Compute polarized Alm's as : 
+\f[
+a_{lm}^E=\frac{1}{\sqrt{2}}\sum_{slices}{\omega_{pix}\left(\,_{w}\lambda_l^m\tilde{Q}-i\,_{x}\lambda_l^m\tilde{U}\right)}
+\f]
+\f[
+a_{lm}^B=\frac{1}{\sqrt{2}}\sum_{slices}{\omega_{pix}\left(i\,_{x}\lambda_l^m\tilde{Q}+\,_{w}\lambda_l^m\tilde{U}\right)}
+\f]
+
+where \f$\tilde{Q}\f$ and \f$\tilde{U}\f$ are C-coefficients computed by FFT (method CFromFourierAnalysis, called by present method) from the Stokes parameters.
+
+\f$\omega_{pix}\f$ are solid angle of each pixel.
+
+dataq, datau : Stokes parameters.
+
+  */
 template<class T>
 void SphericalTransformServer<T>::almFromWX(int_4 nlmax, int_4 nmmax,
@@ -628,6 +837,31 @@
 
 
-template<class T>
-void SphericalTransformServer<T>::almFromPM(int_4 nph, int_4 nlmax, int_4 nmmax,
+ /*! \fn void SOPHYA::SphericalTransformServer::almFromPM(int_4 nph, int_4 nlmax, 
+                                         int_4 nmmax,
+					 r_8 phi0, r_8 domega,  
+					 r_8 theta, 
+					 const TVector<T>& dataq, 
+					 const TVector<T>& datau,
+					 Alm<T>& alme,
+					 Alm<T>& almb) const
+
+Compute polarized Alm's as : 
+\f[
+a_{lm}^E=-\frac{1}{2}\sum_{slices}{\omega_{pix}\left(\,_{+}\lambda_l^m\tilde{P^+}+\,_{-}\lambda_l^m\tilde{P^-}\right)}
+\f]
+\f[
+a_{lm}^B=\frac{i}{2}\sum_{slices}{\omega_{pix}\left(\,_{+}\lambda_l^m\tilde{P^+}-\,_{-}\lambda_l^m\tilde{P^-}\right)}
+\f]
+
+where \f$\tilde{P^{\pm}}=\tilde{Q}\pm\tilde{U}\f$  computed by FFT (method CFromFourierAnalysis, called by present method) from the Stokes parameters,\f$Q\f$ and \f$U\f$ .
+
+\f$\omega_{pix}\f$ are solid angle of each pixel.
+
+dataq, datau : Stokes parameters.
+
+  */
+template<class T>
+void SphericalTransformServer<T>::almFromPM(int_4 nph, int_4 nlmax, 
+                                         int_4 nmmax,
 					 r_8 phi0, r_8 domega,  
 					 r_8 theta, 
@@ -673,4 +907,30 @@
 
 
+/*! \fn void SOPHYA::SphericalTransformServer::mapFromWX(int_4 nlmax, int_4 nmmax,
+					 SphericalMap<T>& mapq,
+					 SphericalMap<T>& mapu, 
+					 const Alm<T>& alme,
+					 const Alm<T>& almb) const
+
+synthesis of Stokes parameters following formulae : 
+
+\f[
+Q=\sum_{m=-mmax}^{mmax}b_m^qe^{im\varphi}
+\f]
+\f[
+U=\sum_{m=-mmax}^{mmax}b_m^ue^{im\varphi}
+\f]
+
+computed by FFT (method fourierSynthesisFromB called by the present one)
+
+with :
+
+\f[
+b_m^q=-\frac{1}{\sqrt{2}}\sum_{l=|m|}^{lmax}{\left(\,_{w}\lambda_l^ma_{lm}^E-i\,_{x}\lambda_l^ma_{lm}^B\right) }
+\f]
+\f[
+b_m^u=\frac{1}{\sqrt{2}}\sum_{l=|m|}^{lmax}{\left(i\,_{x}\lambda_l^ma_{lm}^E+\,_{w}\lambda_l^ma_{lm}^B\right) }
+\f]
+ */
 template<class T>
 void SphericalTransformServer<T>::mapFromWX(int_4 nlmax, int_4 nmmax,
@@ -744,4 +1004,30 @@
     } 
 }
+/*! \fn void SOPHYA::SphericalTransformServer::mapFromPM(int_4 nlmax, int_4 nmmax,
+					 SphericalMap<T>& mapq,
+					 SphericalMap<T>& mapu, 
+					 const Alm<T>& alme,
+					 const Alm<T>& almb) const
+
+synthesis of polarizations following formulae : 
+
+\f[
+P^+ = \sum_{m=-mmax}^{mmax} {b_m^+e^{im\varphi} }
+\f]
+\f[
+P^- = \sum_{m=-mmax}^{mmax} {b_m^-e^{im\varphi} }
+\f]
+
+computed by FFT (method fourierSynthesisFromB called by the present one)
+
+with :
+
+\f[
+b_m^+=-\sum_{l=|m|}^{lmax}{\,_{+}\lambda_l^m \left( a_{lm}^E+ia_{lm}^B \right) }
+\f]
+\f[
+b_m^-=-\sum_{l=|m|}^{lmax}{\,_{+}\lambda_l^m \left( a_{lm}^E-ia_{lm}^B \right) }
+\f]
+ */
 template<class T>
 void SphericalTransformServer<T>::mapFromPM(int_4 nlmax, int_4 nmmax,
@@ -809,4 +1095,14 @@
 
 
+  /*! \fn void SOPHYA::SphericalTransformServer::GenerateFromCl(SphericalMap<T>& sphq, 
+					      SphericalMap<T>& sphu, 
+					      int_4 pixelSizeIndex,
+					      const TVector<T>& Cle, 
+					      const TVector<T>& Clb, 
+					      const r_8 fwhm) const
+
+synthesis of a polarization  map from  power spectra electric-Cl and magnetic-Cl (Alm's are generated randomly, following a gaussian distribution). 
+  \param fwhm FWHM in arcmin for random generation of Alm's (eg. 5) 
+*/
 template<class T>
 void SphericalTransformServer<T>::GenerateFromCl(SphericalMap<T>& sphq, 
@@ -833,4 +1129,10 @@
   GenerateFromAlm(sphq,sphu,pixelSizeIndex,a2lme,a2lmb); 
 }
+ /*! \fn void SOPHYA::SphericalTransformServer::GenerateFromCl(SphericalMap<T>& sph,
+						 int_4 pixelSizeIndex, 
+					      const TVector<T>& Cl, 
+						 const r_8 fwhm)  const
+
+synthesis of a temperature  map from  power spectrum Cl (Alm's are generated randomly, following a gaussian distribution). */
 template<class T>
 void SphericalTransformServer<T>::GenerateFromCl(SphericalMap<T>& sph,
@@ -846,4 +1148,12 @@
 
 
+/*! \fn TVector<T>  SOPHYA::SphericalTransformServer::DecomposeToCl(const SphericalMap<T>& sph, int_4 nlmax, r_8 cos_theta_cut) const
+
+\return power spectrum from analysis of a temperature map.
+
+     \param<nlmax> : maximum value of the l index
+
+     \param<cos_theta_cut> : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
+  */ 
 template <class T>
 TVector<T>  SphericalTransformServer<T>::DecomposeToCl(const SphericalMap<T>& sph, int_4 nlmax, r_8 cos_theta_cut) const
Index: trunk/SophyaLib/Samba/sphericaltransformserver.h
===================================================================
--- trunk/SophyaLib/Samba/sphericaltransformserver.h	(revision 1217)
+++ trunk/SophyaLib/Samba/sphericaltransformserver.h	(revision 1218)
@@ -11,137 +11,5 @@
 namespace SOPHYA {
 
-//
-/*! Class for performing analysis and synthesis of sky maps using spin-0 or spin-2 spherical harmonics.
 
-Maps must be SOPHYA SphericalMaps (SphereGorski or SphereThetaPhi).
-
-Temperature and polarization (Stokes parameters) can be developped on spherical harmonics : 
-\f[
-\frac{\Delta T}{T}(\hat{n})=\sum_{lm}a_{lm}^TY_l^m(\hat{n})
-\f]
-\f[
-Q(\hat{n})=\frac{1}{\sqrt{2}}\sum_{lm}N_l\left(a_{lm}^EW_{lm}(\hat{n})+a_{lm}^BX_{lm}(\hat{n})\right)
-\f]
-\f[
-U(\hat{n})=-\frac{1}{\sqrt{2}}\sum_{lm}N_l\left(a_{lm}^EX_{lm}(\hat{n})-a_{lm}^BW_{lm}(\hat{n})\right)
-\f]
-\f[
-\left(Q \pm iU\right)(\hat{n})=\sum_{lm}a_{\pm 2lm}\, _{\pm 2}Y_l^m(\hat{n})
-\f]
-
-\f[
-Y_l^m(\hat{n})=\lambda_l^m(\theta)e^{im\phi}
-\f]
-\f[
-_{\pm}Y_l^m(\hat{n})=_{\pm}\lambda_l^m(\theta)e^{im\phi}
-\f]
-\f[
-W_{lm}(\hat{n})=\frac{1}{N_l}\,_{w}\lambda_l^m(\theta)e^{im\phi}
-\f]
-\f[
-X_{lm}(\hat{n})=\frac{-i}{N_l}\,_{x}\lambda_l^m(\theta)e^{im\phi}
-\f]
-
-(see LambdaLMBuilder, LambdaPMBuilder, LambdaWXBuilder classes)
-
-power spectra : 
-
-\f[
-C_l^T=\frac{1}{2l+1}\sum_{m=0}^{+ \infty }\left|a_{lm}^T\right|^2=\langle\left|a_{lm}^T\right|^2\rangle 
-\f]
-\f[
-C_l^E=\frac{1}{2l+1}\sum_{m=0}^{+\infty}\left|a_{lm}^E\right|^2=\langle\left|a_{lm}^E\right|^2\rangle 
-\f]
-\f[
-C_l^B=\frac{1}{2l+1}\sum_{m=0}^{+\infty}\left|a_{lm}^B\right|^2=\langle\left|a_{lm}^B\right|^2\rangle 
-\f]
-
-\arg
-\b Synthesis : Get temperature and polarization maps  from \f$a_{lm}\f$ coefficients or from power spectra, (methods GenerateFrom...).
-
-\b Temperature:
-\f[
-\frac{\Delta T}{T}(\hat{n})=\sum_{lm}a_{lm}^TY_l^m(\hat{n}) = \sum_{-\infty}^{+\infty}b_m(\theta)e^{im\phi}
-\f]
-
-with 
-\f[
-b_m(\theta)=\sum_{l=\left|m\right|}^{+\infty}a_{lm}^T\lambda_l^m(\theta)
-\f]
-
-\b Polarisation
-\f[
-Q \pm iU = \sum_{-\infty}^{+\infty}b_m^{\pm}(\theta)e^{im\phi}
-\f]
-
-where :
-\f[
-b_m^{\pm}(\theta) = \sum_{l=\left|m\right|}^{+\infty}a_{\pm 2lm}\,_{\pm}\lambda_l^m(\theta)
-\f]
-
-or :
-\f[
-Q  = \sum_{-\infty}^{+\infty}b_m^{Q}(\theta)e^{im\phi}
-\f]
-\f[
-U  = \sum_{-\infty}^{+\infty}b_m^{U}(\theta)e^{im\phi}
-\f]
-
-where: 
-\f[
-b_m^{Q}(\theta) = \frac{1}{\sqrt{2}}\sum_{l=\left|m\right|}^{+\infty}\left(a_{lm}^E\,_{w}\lambda_l^m(\theta)-ia_{lm}^B\,_{x}\lambda_l^m(\theta)\right)
-\f]
-\f[
-b_m^{U}(\theta) = \frac{1}{\sqrt{2}}\sum_{l=\left|m\right|}^{+\infty}\left(ia_{lm}^E\,_{x}\lambda_l^m(\theta)+a_{lm}^B\,_{w}\lambda_l^m(\theta)\right)
-\f]
-
-Since the pixelization provides "slices" with constant \f$\theta\f$ and \f$\phi\f$ equally distributed  on \f$2\pi\f$  \f$\frac{\Delta T}{T}\f$, \f$Q\f$,\f$U\f$  can be computed by FFT.
-
-
-\arg
-\b Analysis :  Get \f$a_{lm}\f$ coefficients or  power spectra from temperature and polarization maps   (methods DecomposeTo...). 
-
-\b Temperature:
-\f[
-a_{lm}^T=\int\frac{\Delta T}{T}(\hat{n})Y_l^{m*}(\hat{n})d\hat{n}
-\f]
-
-approximated as : 
-\f[
-a_{lm}^T=\sum_{\theta_k}\omega_kC_m(\theta_k)\lambda_l^m(\theta_k)
-\f]
-where :
-\f[
-C_m (\theta _k)=\sum_{\phi _{k\prime}}\frac{\Delta T}{T}(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
-\f]
-Since the pixelization provides "slices" with constant \f$\theta\f$ and \f$\phi\f$ equally distributed  on \f$2\pi\f$ (\f$\omega_k\f$ is the solid angle of each pixel of the slice \f$\theta_k\f$) \f$C_m\f$ can be computed by FFT.
-
-\b polarisation:
-
-\f[
-a_{\pm 2lm}=\sum_{\theta_k}\omega_kC_m^{\pm}(\theta_k)\,_{\pm}\lambda_l^m(\theta_k)
-\f]
-where :
-\f[
-C_m^{\pm} (\theta _k)=\sum_{\phi _{k\prime}}\left(Q \pm iU\right)(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
-\f]
-or :
-
-\f[
-a_{lm}^E=\frac{1}{\sqrt{2}}\sum_{\theta_k}\omega_k\left(C_m^{Q}(\theta_k)\,_{w}\lambda_l^m(\theta_k)-iC_m^{U}(\theta_k)\,_{x}\lambda_l^m(\theta_k)\right)
-\f]
-\f[
-a_{lm}^B=\frac{1}{\sqrt{2}}\sum_{\theta_k}\omega_k\left(iC_m^{Q}(\theta_k)\,_{x}\lambda_l^m(\theta_k)+C_m^{U}(\theta_k)\,_{w}\lambda_l^m(\theta_k)\right)
-\f]
-
-where : 
-\f[
-C_m^{Q} (\theta _k)=\sum_{\phi _{k\prime}}Q(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
-\f]
-\f[
-C_m^{U} (\theta _k)=\sum_{\phi _{k\prime}}U(\theta _k,\phi_{k\prime})e^{-im\phi _{k\prime}}
-\f]
-
- */
 template <class T>
 class SphericalTransformServer
@@ -150,177 +18,70 @@
  public:
 
- SphericalTransformServer()  
-{
-    fftIntfPtr_=new FFTPackServer;
-    fftIntfPtr_->setNormalize(false);
-};
- ~SphericalTransformServer(){ if (fftIntfPtr_!=NULL) delete fftIntfPtr_;};
-/*!
+  SphericalTransformServer()  
+    {
+      fftIntfPtr_=new FFTPackServer;
+      fftIntfPtr_->setNormalize(false);
+    };
+  ~SphericalTransformServer(){ if (fftIntfPtr_!=NULL) delete fftIntfPtr_;};
+  
+ /*!
  Set a fft server. The constructor sets a default fft server (fft-pack). So it is not necessary to call this method for a standard use.
 */
- void SetFFTServer(FFTServerInterface* srv=NULL) 
-{
-  if (fftIntfPtr_!=NULL) delete fftIntfPtr_;
-  fftIntfPtr_=srv;
-  fftIntfPtr_->setNormalize(false);
-}
- /*! synthesis of a temperature  map from  Alm coefficients */
- void GenerateFromAlm( SphericalMap<T>& map, int_4 pixelSizeIndex, const Alm<T>& alm) const; 
- /*! synthesis of a polarization map from  Alm coefficients. The spheres mapq and mapu contain respectively the Stokes parameters. */
- void GenerateFromAlm(SphericalMap<T>& mapq, SphericalMap<T>& mapu, int_4 pixelSizeIndex, const Alm<T>& alme,    const Alm<T>& almb) const;
+  void SetFFTServer(FFTServerInterface* srv=NULL) 
+    {
+      if (fftIntfPtr_!=NULL) delete fftIntfPtr_;
+      fftIntfPtr_=srv;
+      fftIntfPtr_->setNormalize(false);
+    }
 
- /*! synthesis of a temperature  map from  power spectrum Cl (Alm's are generated randomly, following a gaussian distribution). */
- void GenerateFromCl(SphericalMap<T>& sph, int_4 pixelSizeIndex,
+  void GenerateFromAlm( SphericalMap<T>& map, int_4 pixelSizeIndex, const Alm<T>& alm) const; 
+  void GenerateFromAlm(SphericalMap<T>& mapq, SphericalMap<T>& mapu, int_4 pixelSizeIndex, const Alm<T>& alme,    const Alm<T>& almb) const;
+
+  void GenerateFromCl(SphericalMap<T>& sph, int_4 pixelSizeIndex,
 		     const TVector<T>& Cl, const r_8 fwhm) const; 
-  /*! synthesis of a polarization  map from  power spectra electric-Cl and magnetic-Cl (Alm's are generated randomly, following a gaussian distribution). 
-  \param fwhm FWHM in arcmin for random generation of Alm's (eg. 5) 
-
-*/
- void GenerateFromCl(SphericalMap<T>& sphq, SphericalMap<T>& sphu, 
+  void GenerateFromCl(SphericalMap<T>& sphq, SphericalMap<T>& sphu, 
 		     int_4 pixelSizeIndex,
 		     const TVector<T>& Cle, const TVector<T>& Clb, 
 		    const r_8 fwhm) const; 
- /*!return the Alm coefficients from analysis of a temperature map.
-
-    \param<nlmax> : maximum value of the l index
-
-     \param<cos_theta_cut> : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
-  */ 
 
 
-Alm<T> DecomposeToAlm(const SphericalMap<T>& map, int_4 nlmax, r_8 cos_theta_cut) const;
- /*!analysis of a polarization map into Alm coefficients.
+  Alm<T> DecomposeToAlm(const SphericalMap<T>& map, int_4 nlmax, r_8 cos_theta_cut) const;
 
- The spheres \c mapq and \c mapu contain respectively the Stokes parameters. 
-
- \c a2lme and \c a2lmb will receive respectively electric and magnetic Alm's
-    nlmax : maximum value of the l index
-
- \c cos_theta_cut : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
- */ 
-
- void DecomposeToAlm(const SphericalMap<T>& mapq, const SphericalMap<T>& mapu,
+  void DecomposeToAlm(const SphericalMap<T>& mapq, const SphericalMap<T>& mapu,
 		     Alm<T>& a2lme, Alm<T>& a2lmb,
 		     int_4 nlmax, r_8 cos_theta_cut) const;
 
-/*!return power spectrum from analysis of a temperature map.
-
-     \param<nlmax> : maximum value of the l index
-
-     \param<cos_theta_cut> : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
-  */ 
- TVector<T>  DecomposeToCl(const SphericalMap<T>& sph,  
+  TVector<T>  DecomposeToCl(const SphericalMap<T>& sph,  
 			   int_4 nlmax, r_8 cos_theta_cut) const;
 
 
-  private:
-  /*! return a vector with nph elements  which are  sums :\f$\sum_{m=-mmax}^{mmax}b_m(\theta)e^{im\varphi}\f$ for nph values of \f$\varphi\f$ regularly distributed in \f$[0,\pi]\f$ ( calculated by FFT)
-
-  The object b_m (\f$b_m\f$) of the class Bm is a special vector which index goes from -mmax to mmax. 
-  */
- TVector< complex<T> >  fourierSynthesisFromB(const Bm<complex<T> >& b_m,  
+ private:
+  TVector< complex<T> >  fourierSynthesisFromB(const Bm<complex<T> >& b_m,  
 				  int_4 nph, r_8 phi0) const;
-/*! same as fourierSynthesisFromB, but return a real vector, taking into account the fact that b(-m) is conjugate of b(m) */
- TVector<T>  RfourierSynthesisFromB(const Bm<complex<T> >& b_m,  
+  TVector<T>  RfourierSynthesisFromB(const Bm<complex<T> >& b_m,  
 				  int_4 nph, r_8 phi0) const;
 
-  /*! return a vector with mmax elements  which are  sums :
-\f$\sum_{k=0}^{nphi}datain(\theta,\varphi_k)e^{im\varphi_k}\f$ for (mmax+1) values of \f$m\f$ from 0 to mmax.
-   */
- TVector< complex<T> > CFromFourierAnalysis(int_4 mmax, 
+  TVector< complex<T> > CFromFourierAnalysis(int_4 mmax, 
 				  const TVector<complex<T> > datain,
 				  r_8 phi0) const;
-/* same as previous one, but with a "datain" which is real (not complex) */
- TVector< complex<T> > CFromFourierAnalysis(int_4 mmax, 
+  TVector< complex<T> > CFromFourierAnalysis(int_4 mmax, 
 			 const TVector<T> datain,  
 				  r_8 phi0) const;
 
- /*! 
-Compute polarized Alm's as : 
-\f[
-a_{lm}^E=\frac{1}{\sqrt{2}}\sum_{slices}{\omega_{pix}\left(\,_{w}\lambda_l^m\tilde{Q}-i\,_{x}\lambda_l^m\tilde{U}\right)}
-\f]
-\f[
-a_{lm}^B=\frac{1}{\sqrt{2}}\sum_{slices}{\omega_{pix}\left(i\,_{x}\lambda_l^m\tilde{Q}+\,_{w}\lambda_l^m\tilde{U}\right)}
-\f]
-
-where \f$\tilde{Q}\f$ and \f$\tilde{U}\f$ are C-coefficients computed by FFT (method CFromFourierAnalysis, called by present method) from the Stokes parameters.
-
-\f$\omega_{pix}\f$ are solid angle of each pixel.
-
-dataq, datau : Stokes parameters.
-
-  */
-void almFromWX(int_4 nlmax, int_4 nmmax, r_8 phi0, 
+  void almFromWX(int_4 nlmax, int_4 nmmax, r_8 phi0, 
 	       r_8 domega, r_8 theta, 
 	       const TVector<T>& dataq, const TVector<T>& datau,
 	       Alm<T>& alme, Alm<T>& almb) const;
- /*! 
-Compute polarized Alm's as : 
-\f[
-a_{lm}^E=-\frac{1}{2}\sum_{slices}{\omega_{pix}\left(\,_{+}\lambda_l^m\tilde{P^+}+\,_{-}\lambda_l^m\tilde{P^-}\right)}
-\f]
-\f[
-a_{lm}^B=\frac{i}{2}\sum_{slices}{\omega_{pix}\left(\,_{+}\lambda_l^m\tilde{P^+}-\,_{-}\lambda_l^m\tilde{P^-}\right)}
-\f]
-
-where \f$\tilde{P^{\pm}}=\tilde{Q}\pm\tilde{U}\f$  computed by FFT (method CFromFourierAnalysis, called by present method) from the Stokes parameters,\f$Q\f$ and \f$U\f$ .
-
-\f$\omega_{pix}\f$ are solid angle of each pixel.
-
-dataq, datau : Stokes parameters.
-
-  */
-void almFromPM(int_4 nph, int_4 nlmax, int_4 nmmax, 
+  void almFromPM(int_4 nph, int_4 nlmax, int_4 nmmax, 
 	       r_8 phi0, r_8 domega, r_8 theta, 
 	       const TVector<T>& dataq, const TVector<T>& datau,
 	       Alm<T>& alme, Alm<T>& almb) const;
 
-/*! synthesis of Stokes parameters following formulae : 
-
-\f[
-Q=\sum_{m=-mmax}^{mmax}b_m^qe^{im\varphi}
-\f]
-\f[
-U=\sum_{m=-mmax}^{mmax}b_m^ue^{im\varphi}
-\f]
-
-computed by FFT (method fourierSynthesisFromB called by the present one)
-
-with :
-
-\f[
-b_m^q=-\frac{1}{\sqrt{2}}\sum_{l=|m|}^{lmax}{\left(\,_{w}\lambda_l^ma_{lm}^E-i\,_{x}\lambda_l^ma_{lm}^B\right) }
-\f]
-\f[
-b_m^u=\frac{1}{\sqrt{2}}\sum_{l=|m|}^{lmax}{\left(i\,_{x}\lambda_l^ma_{lm}^E+\,_{w}\lambda_l^ma_{lm}^B\right) }
-\f]
- */
-void mapFromWX(int_4 nlmax, int_4 nmmax,
+  void mapFromWX(int_4 nlmax, int_4 nmmax,
 	       SphericalMap<T>& mapq, SphericalMap<T>& mapu, 
 	       const Alm<T>& alme, const Alm<T>& almb) const;
 
-/*! synthesis of polarizations following formulae : 
 
-\f[
-P^+ = \sum_{m=-mmax}^{mmax} {b_m^+e^{im\varphi} }
-\f]
-\f[
-P^- = \sum_{m=-mmax}^{mmax} {b_m^-e^{im\varphi} }
-\f]
-
-computed by FFT (method fourierSynthesisFromB called by the present one)
-
-with :
-
-\f[
-b_m^+=-\sum_{l=|m|}^{lmax}{\,_{+}\lambda_l^m \left( a_{lm}^E+ia_{lm}^B \right) }
-\f]
-\f[
-b_m^-=-\sum_{l=|m|}^{lmax}{\,_{+}\lambda_l^m \left( a_{lm}^E-ia_{lm}^B \right) }
-\f]
- */
-
-void mapFromPM(int_4 nlmax, int_4 nmmax,
+  void mapFromPM(int_4 nlmax, int_4 nmmax,
 	       SphericalMap<T>& mapq, SphericalMap<T>& mapu, 
 	       const Alm<T>& alme, const Alm<T>& almb) const;
