Index: /trunk/SophyaProg/PMixer/skymixer.cc
===================================================================
--- /trunk/SophyaProg/PMixer/skymixer.cc	(revision 930)
+++ /trunk/SophyaProg/PMixer/skymixer.cc	(revision 931)
@@ -1,44 +1,17 @@
-#include "machdefs.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <iostream.h>
-#include <math.h>
-
-#include <string>
-#include <vector>
-
-#include "timing.h"
-#include "sambainit.h"
-#include "pexceptions.h"
-#include "datacards.h"
-#include "fitsioserver.h"
-
-#include "spherehealpix.h"
-#include "fiospherehealpix.h"
-#include "fitsspherehealpix.h"
-#include "radspecvector.h"
-#include "blackbody.h"
-#include "derivblackbody.h"
-#include "nupower.h"
-
-#include "squarefilt.h"
-#include "trianglefilt.h"
-#include "specrespvector.h"
-#include "gaussfilt.h"
+#include "pmixer.h"
 
 /*!
-  \defgroup PMixer PMixer module
-  This module contains programs which:
-  <UL>
-  <LI> add several sky components, taking into account their
-  radiation spectra and convoluting them with a given filter
-  response : skymixer
-  <LI> create a map with point source : extractRS
-  <LI> generate sky components, radiation spectra and spectral 
-  response (small generator of maps) : tgsky and tgrsr
-  </UL> 
-  A detailed description may be found at:
-*/
+ * \defgroup PMixer PMixer module
+ * This module contains programs which:
+ * <UL>
+ * <LI> add several sky components, taking into account their
+ * radiation spectra and convoluting them with a given filter
+ * response : skymixer
+ * <LI> create a map with point source : extractRS
+ * <LI> generate sky components, radiation spectra and spectral 
+ * response (small generator of maps) : tgsky and tgrsr
+ * </UL> 
+ * A detailed description may be found at:
+ */
 /*!
  * \ingroup PMixer
@@ -48,5 +21,5 @@
  *radiation spectra and convoluting them with a given filter
  *response
-*/
+ */
 
 // -----------------------------------------------------------------
@@ -59,10 +32,4 @@
 void SpectralResponse2Nt(SpectralResponse& sr, POutPersist & so, string name);
 
-// 
-// treating maps
-//---------------------------------------------------------
-template <class T> void  MeanSig(NDataBlock<T> const & dbl, double& gmoy, double& gsig);
-template <class T> void Sph2Sph(PixelMap<T>& in, PixelMap<T>& out);
-//
 // to add different sky components and corresponding tools
 //----------------------------------------------------------
@@ -710,71 +677,9 @@
 }
 
-/* Nouvelle-Fonction */
-
-template <class T>
-void Sph2Sph(PixelMap<T>& in, PixelMap<T>& out)
-  // Cette fonction remplit la sphere out a partir de la sphere in
-  // Les spheres peuvent etre de type et de pixelisations differentes
-{
-  int kin,kout;
-  double teta,phi;
-  
-  int* cnt = new int[out.NbPixels()+1];
-  for(kout=0; kout<out.NbPixels(); kout++)
-    { cnt[kout] = 0; out(kout) = 0.; }
-  
-  for(kin=0; kin<in.NbPixels(); kin++) {
-    in.PixThetaPhi(kin, teta, phi);
-    kout = out.PixIndexSph(teta, phi);
-    out(kout) += in(kin);
-    
-    cnt[kout] ++;
-    
-  }
-  
-  double moy, sig, dcn;
-  moy = 0.; sig = 0.;
-  for(kout=0; kout<out.NbPixels(); kout++) {
-    dcn = cnt[kout];  moy += dcn;	 sig += (dcn*dcn);
-    if (cnt[kout] > 0)  out(kout) /= dcn;
-    else {
-      out.PixThetaPhi(kout, teta, phi);
-      int pixel = in.PixIndexSph(teta,phi);
-      out(kout) = in.PixVal(pixel);
-    }
-  }
-  
-  moy /= out.NbPixels();
-  sig = sig/out.NbPixels() - moy*moy;
-  if (sig >= 0.)	sig = sqrt(sig);
-  
-  delete[] cnt;
-  
-  if(printlev>2)
-    {
-      printf("Sph2Sph_Info NbPix In= %d  Out= %d CntMoy,Sig= %g %g\n",
-	     in.NbPixels(), out.NbPixels(), moy, sig);
-      PrtTim("End of  Sph2Sph() ");
-    }
-}
-
-
-
-/* Nouvelle-Fonction */
-template <class T>
-void  MeanSig(NDataBlock<T> const & dbl, double& gmoy, double& gsig)
-
-{
-  gmoy=0.;
-  gsig = 0.; 
-  double valok;
-  for(int k=0; k<(int)dbl.Size(); k++) {
-    valok = dbl(k);
-    gmoy += valok;  gsig += valok*valok; 
-  }
-  gmoy /= (double)dbl.Size();
-  gsig = gsig/(double)dbl.Size() - gmoy*gmoy;
-  if (gsig >= 0.) gsig = sqrt(gsig);
-}
+
+
+
+
+/* Nouvelle-Fonction */
 
 /* Nouvelle-Fonction */
Index: /trunk/SophyaProg/PMixer/tgsky.cc
===================================================================
--- /trunk/SophyaProg/PMixer/tgsky.cc	(revision 930)
+++ /trunk/SophyaProg/PMixer/tgsky.cc	(revision 931)
@@ -1,24 +1,12 @@
-#include "machdefs.h"
-#include <iostream.h>
-#include <math.h>
+#include "pmixer.h"
+#include "mapoperation.h"
 
-#include "sambainit.h"
-#include "spherehealpix.h"
-#include "fiospherehealpix.h"
-#include "fitsioserver.h"
-#include "nbrandom.h"
-#include "bruit.h"
-#include "timing.h"
 /*! \ingroup PMixer
-  \file tgsky.cc
+ * \file tgsky.cc
  * \brief \b PROGRAM \b tgsky  <BR>
  * \l Program which generates different types of random skies
  */
+// ------------- Main program --------------
 
-// Test program to generate different type of random skies
-template <class T>
-void  MeanSig(PixelMap<T> const & map, double& gmoy, double& gsig);
-
-// ------------- Main program --------------
 int main(int narg, char* arg[]) 
 {
@@ -102,5 +90,5 @@
 
   // Computing mean and sigma on the sphere 
-  MeanSig(sph, gmoy, gsig);
+  MeanSig(sph.DataBlock(), gmoy, gsig);
   cout << "SphereHEALPix<float> Mean= " << gmoy << "  Sigma = " << gsig << endl;
   PrtTim("End of Mean-Sig ");
@@ -126,18 +114,2 @@
 }
 
-/* Nouvelle-Methode */
-template <class T>
-void  MeanSig(PixelMap<T> const & map, double& gmoy, double& gsig)
-
-{
-  gmoy=0.;
-  gsig = 0.; 
-  double valok;
-  for(int k=0; k<map.NbPixels(); k++) {
-    valok = map(k);
-    gmoy += valok;  gsig += valok*valok; 
-  }
-  gmoy /= (double)map.NbPixels();
-  gsig = gsig/(double)map.NbPixels() - gmoy*gmoy;
-  if (gsig >= 0.) gsig = sqrt(gsig);
-}
