Index: trunk/Cosmo/SimLSS/cmvobserv3d.cc
===================================================================
--- trunk/Cosmo/SimLSS/cmvobserv3d.cc	(revision 3285)
+++ trunk/Cosmo/SimLSS/cmvobserv3d.cc	(revision 3289)
@@ -25,4 +25,5 @@
      <<" -G : compute Pk(z=0) and apply growth factor in real space"<<endl
      <<"      (default: no, spectrum Pk(z=z_median) for all cube)"<<endl
+     <<" -F : filter spectrum by pixel shape (0=no 1=yes(default)"<<endl
      <<" -x nx,dx : size along x axis (npix,Mpc)"<<endl
      <<" -y ny,dy : size along y axis (npix,Mpc)"<<endl
@@ -94,4 +95,5 @@
  bool use_growth_factor = false;
  unsigned short nthread=0;
+ int filter_by_pixel = 1;
 
  // *** What to do
@@ -109,5 +111,5 @@
 
  char c;
- while((c = getopt(narg,arg,"ha0PWSV2Gx:y:z:s:Z:M:A:T:")) != -1) {
+ while((c = getopt(narg,arg,"ha0PWSV2GF:x:y:z:s:Z:M:A:T:")) != -1) {
   int nth = 0;
   switch (c) {
@@ -121,4 +123,7 @@
     use_growth_factor = true;
     break;
+  case 'F' :
+    sscanf(optarg,"%d",&filter_by_pixel);
+    break;
   case 'x' :
     sscanf(optarg,"%ld,%lf",&nx,&dx);
@@ -177,4 +182,5 @@
  cout<<"kmin="<<kmin<<" ("<<lkmin<<"), kmax="<<kmax<<" ("<<lkmax<<") Mpc^-1"
      <<", npt="<<npt<<endl;
+ cout<<"Filter by pixel = "<<filter_by_pixel<<endl;
  cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl;
  cout<<"nstar= "<<nstar<<"  mstar="<<mstar<<"  alpha="<<alpha<<endl;
@@ -337,15 +343,13 @@
  PrtTim(">>>> End Computing a realization in Fourier space");
 
- if(1) {
-   cout<<"\n--- Checking realization spectra"<<endl;
-   HistoErr hpkgen(0.,knyqmax,nherr);
-   hpkgen.ReCenterBin(); hpkgen.Zero();
-   hpkgen.Show();
-   fluct3d.ComputeSpectrum(hpkgen);
-   {
-   tagobs = "hpkgen"; posobs.PutObject(hpkgen,tagobs);
-   }
-   PrtTim(">>>> End Checking realization spectra");
- }
+ cout<<"\n--- Checking realization spectra"<<endl;
+ HistoErr hpkgen(0.,knyqmax,nherr);
+ hpkgen.ReCenterBin(); hpkgen.Zero();
+ hpkgen.Show();
+ fluct3d.ComputeSpectrum(hpkgen);
+ {
+ tagobs = "hpkgen"; posobs.PutObject(hpkgen,tagobs);
+ }
+ PrtTim(">>>> End Checking realization spectra");
 
  if(comp2dspec) {
@@ -361,20 +365,12 @@
  }
 
- if(1) {
+ if(filter_by_pixel!=0) {
+   // A_FAIRE (???) ne faut-il pas dans le cas ou on demande
+   // use_growth_factor filtrer uniquement apres avoir appliquer
+   // le facteur de croissance  ??????
    cout<<"\n--- Computing convolution by pixel shape"<<endl;
    fluct3d.FilterByPixel();
    PrtTim(">>>> End Computing convolution by pixel shape");
- }
-
- if(wfits) {
-   fluct3d.WriteFits("!cmvobserv3d_k0.fits");
-   PrtTim(">>>> End WriteFits");
- }
- if(wppf) {
-   fluct3d.WritePPF("cmvobserv3d_k0.ppf",false);
-   PrtTim(">>>> End WritePPF");
- }
-
- if(1) {
+
    cout<<"\n--- Checking realization spectra after pixel shape convol."<<endl;
    HistoErr hpkgenf(0.,knyqmax,nherr);
@@ -386,16 +382,25 @@
    }
    PrtTim(">>>> End Checking realization spectra");
- }
-
- if(comp2dspec) {
-   cout<<"\n--- Checking realization 2D spectra after pixel shape convol."<<endl;
-   Histo2DErr hpkgenf2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
-   hpkgenf2.ReCenterBin(); hpkgenf2.Zero();
-   hpkgenf2.Show();
-   fluct3d.ComputeSpectrum2D(hpkgenf2);
-   {
-   tagobs = "hpkgenf2"; posobs.PutObject(hpkgenf2,tagobs);
+
+   if(comp2dspec) {
+     cout<<"\n--- Checking realization 2D spectra after pixel shape convol."<<endl;
+     Histo2DErr hpkgenf2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
+     hpkgenf2.ReCenterBin(); hpkgenf2.Zero();
+     hpkgenf2.Show();
+     fluct3d.ComputeSpectrum2D(hpkgenf2);
+     {
+     tagobs = "hpkgenf2"; posobs.PutObject(hpkgenf2,tagobs);
+     }
+     PrtTim(">>>> End Checking realization 2D spectra");
    }
-   PrtTim(">>>> End Checking realization 2D spectra");
+ }
+
+ if(wfits) {
+   fluct3d.WriteFits("!cmvobserv3d_k0.fits");
+   PrtTim(">>>> End WriteFits");
+ }
+ if(wppf) {
+   fluct3d.WritePPF("cmvobserv3d_k0.ppf",false);
+   PrtTim(">>>> End WritePPF");
  }
 
@@ -414,5 +419,8 @@
    cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
    PrtTim(">>>> End Applying growth factor");
- }
+   // A_FAIRE (???) ne faut-il pas maintenant retourner dans fourier
+   // appliquer les filtre des pixels et re-retourner dans reel ?
+ }
+
 
  if(wfits) {
@@ -431,10 +439,8 @@
  int_8 nm;
  double rm,rs2;
- if(1) {
-   cout<<"\n--- Check mean and variance in real space"<<endl;
-   fluct3d.NumberOfBad(-1.,1e+200);
-   nm = fluct3d.MeanSigma2(rm,rs2);
-   PrtTim(">>>> End Check mean and variance in real space");
- }
+ cout<<"\n--- Check mean and variance in real space"<<endl;
+ fluct3d.NumberOfBad(-1.,1e+200);
+ nm = fluct3d.MeanSigma2(rm,rs2);
+ PrtTim(">>>> End Check mean and variance in real space");
 
  if(compvarreal) {
@@ -549,9 +555,7 @@
  // -- NE PAS FAIRE CA SI ON VEUT CONTINUER LA SIMULATION -> d_rho/rho ecrase
  
- if(1) {
-   cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
-   fluct3d.ReComputeFourier();
-   PrtTim(">>>> End ReComputing spectrum");
- }
+ cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
+ fluct3d.ReComputeFourier();
+ PrtTim(">>>> End ReComputing spectrum");
 
  if(wfits) {
@@ -564,13 +568,11 @@
  }
 
- if(1) {
-   cout<<endl<<"\n--- Computing final spectrum"<<endl;
-   HistoErr hpkrec(0.,knyqmax,nherr);
-   hpkrec.ReCenterBin();
-   hpkrec.Show();
-   fluct3d.ComputeSpectrum(hpkrec);
-   tagobs = "hpkrec"; posobs.PutObject(hpkrec,tagobs);
-   PrtTim(">>>> End Computing final spectrum");
- }
+ cout<<endl<<"\n--- Computing final spectrum"<<endl;
+ HistoErr hpkrec(0.,knyqmax,nherr);
+ hpkrec.ReCenterBin();
+ hpkrec.Show();
+ fluct3d.ComputeSpectrum(hpkrec);
+ tagobs = "hpkrec"; posobs.PutObject(hpkrec,tagobs);
+ PrtTim(">>>> End Computing final spectrum");
 
  if(comp2dspec) {
