Changeset 3155 in Sophya for trunk/Cosmo/SimLSS


Ignore:
Timestamp:
Jan 19, 2007, 6:18:38 PM (19 years ago)
Author:
cmv
Message:

PrtTim deplaces de genefluct3d.cc -> cmvobserv3d.cc cmv 19/01/2007

Location:
trunk/Cosmo/SimLSS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/cmvobserv3d.cc

    r3154 r3155  
    135135     <<", npt="<<npt<<endl;
    136136 cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl;
    137  cout<<"nstar= "<<nstar<<"  mstar="<<mstar<<"  alpha="<<alpha<<endl;
     137 cout<<"nstar= "<<nstar<<"  mstar="<<mstar<<"  alpa="<<alpha<<endl;
    138138 cout<<"schmin="<<schmin<<" ("<<lschmin
    139139     <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol"
     
    204204 cout<<"varpk_int="<<sr2int<<"  ->  sigma="<<sqrt(sr2int)<<endl;
    205205
    206  PrtTim("End of definition");
    207 
    208206 //-----------------------------------------------------------------
    209207 cout<<endl<<"\n--- Compute galaxy density number"<<endl;
     
    219217 cout<<"Galaxy mass density= "<<mass_by_mpc3<<" Msol/Mpc^3 between limits"<<endl;
    220218
     219 PrtTim(">>>> End of definition");
     220
    221221 //-----------------------------------------------------------------
    222222 // FFTW3 (p26): faster if sizes 2^a 3^b 5^c 7^d 11^e 13^f  with e+f=0 ou 1
    223  cout<<endl<<"\n--- Compute Spectrum Realization"<<endl;
     223 cout<<endl<<"\n--- Initialisation de GeneFluct3D"<<endl;
    224224
    225225 pkz.SetZ(zref);
    226226 TArray< complex<r_8> > pkgen;
    227227 GeneFluct3D fluct3d(pkgen);
    228  fluct3d.SetPrtLevel(3);
     228 fluct3d.SetPrtLevel(2);
    229229 fluct3d.SetNThread(nthread);
    230230 fluct3d.SetSize(nx,ny,nz,dx,dy,dz);
     
    256256 cout<<"varpk_int(<"<<knyqmax_mod<<")="<<sr2int_kmax<<"  ->  sigma="<<sqrt(sr2int_kmax)<<endl;
    257257
     258 PrtTim(">>>> End Initialisation de GeneFluct3D");
     259
    258260 cout<<"\n--- Computing a realization in Fourier space"<<endl;
    259261 if(computefourier0) fluct3d.ComputeFourier0(pkz);
    260262   else              fluct3d.ComputeFourier(pkz);
     263 PrtTim(">>>> End Computing a realization in Fourier space");
    261264
    262265 if(1) {
     
    269272   tagobs = "hpkgen"; posobs.PutObject(hpkgen,tagobs);
    270273   }
     274   PrtTim(">>>> End Checking realization spectra");
    271275 }
    272276
     
    280284   tagobs = "hpkgen2"; posobs.PutObject(hpkgen2,tagobs);
    281285   }
     286   PrtTim(">>>> End Checking realization 2D spectra");
    282287 }
    283288
     
    285290   cout<<"\n--- Computing convolution by pixel shape"<<endl;
    286291   fluct3d.FilterByPixel();
    287  }
    288 
    289  if(wfits) fluct3d.WriteFits("!cmvobserv3d_k0.fits");
    290  if(wppf) fluct3d.WritePPF("cmvobserv3d_k0.ppf",false);
     292   PrtTim(">>>> End Computing convolution by pixel shape");
     293 }
     294
     295 if(wfits) {
     296   fluct3d.WriteFits("!cmvobserv3d_k0.fits");
     297   PrtTim(">>>> End WriteFits");
     298 }
     299 if(wppf) {
     300   fluct3d.WritePPF("cmvobserv3d_k0.ppf",false);
     301   PrtTim(">>>> End WritePPF");
     302 }
    291303
    292304 if(1) {
     
    299311   tagobs = "hpkgenf"; posobs.PutObject(hpkgenf,tagobs);
    300312   }
     313   PrtTim(">>>> End Checking realization spectra");
    301314 }
    302315
     
    310323   tagobs = "hpkgenf2"; posobs.PutObject(hpkgenf2,tagobs);
    311324   }
     325   PrtTim(">>>> End Checking realization 2D spectra");
    312326 }
    313327
     
    316330 double rmin,rmax; rgen.MinMax(rmin,rmax);
    317331 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
    318 
    319  if(wfits) fluct3d.WriteFits("!cmvobserv3d_r0.fits");
    320  if(wppf) fluct3d.WritePPF("cmvobserv3d_r0.ppf",true);
     332   PrtTim(">>>> End Computing a realization in real space");
     333
     334 if(wfits) {
     335   fluct3d.WriteFits("!cmvobserv3d_r0.fits");
     336   PrtTim(">>>> End WriteFits");
     337 }
     338 if(wppf) {
     339   fluct3d.WritePPF("cmvobserv3d_r0.ppf",true);
     340   PrtTim(">>>> End WritePPF");
     341 }
    321342
    322343 int_8 nm;
     
    328349   cout<<"rgen:("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
    329350       <<rs2<<" -> "<<sqrt(rs2)<<",  n(<-1)="<<nlowone<<endl;
     351   PrtTim(">>>> End Check mean and variance in real space");
    330352 }
    331353
     
    335357   int_8 nvarr = fluct3d.VarianceFrReal(R,varr);
    336358   cout<<"R="<<R<<" : sigmaR^2="<<varr<<" -> "<<sqrt(varr)<<",   n="<<nvarr<<endl;
     359   PrtTim(">>>> End Check variance sigmaR in real space");
    337360 }
    338361
     
    343366 cout<<"1+rgen: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
    344367     <<rs2<<" -> "<<sqrt(rs2)<<endl;
     368 PrtTim(">>>> End Converting fluctuations into mass");
    345369
    346370 cout<<"\n--- Converting mass into galaxy number"<<endl;
     
    350374 cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
    351375     <<rs2<<" -> "<<sqrt(rs2)<<endl;
     376 PrtTim(">>>> End Converting mass into galaxy number");
    352377
    353378 cout<<"\n--- Set negative pixels to BAD"<<endl;
     
    357382 cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
    358383     <<rs2<<" -> "<<sqrt(rs2)<<endl;
     384 PrtTim(">>>> End Set negative pixels to BAD etc...");
    359385
    360386 cout<<"\n--- Apply poisson on galaxy number"<<endl;
     
    364390 cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
    365391     <<rs2<<" -> "<<sqrt(rs2)<<endl;
     392 PrtTim(">>>> End Apply poisson on galaxy number");
    366393
    367394 cout<<"\n--- Convert Galaxy number to HI mass"<<endl;
     
    382409     <<rs2<<" -> "<<sqrt(rs2)<<endl;
    383410 cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl;
     411 PrtTim(">>>> End Convert Galaxy number to HI mass");
    384412
    385413 cout<<"\n--- Set BAD pixels to Zero"<<endl;
     
    389417 cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
    390418     <<rs2<<" -> "<<sqrt(rs2)<<endl;
    391 
    392  if(wfits) fluct3d.WriteFits("!cmvobserv3d_r.fits");
    393  if(wppf) fluct3d.WritePPF("cmvobserv3d_r.ppf",true);
     419 PrtTim(">>>> End Set BAD pixels to Zero etc...");
     420
     421 if(wfits) {
     422   fluct3d.WriteFits("!cmvobserv3d_r.fits");
     423   PrtTim(">>>> End WriteFits");
     424 }
     425 if(wppf) {
     426   fluct3d.WritePPF("cmvobserv3d_r.ppf",true);
     427   PrtTim(">>>> End WritePPF");
     428 }
    394429
    395430 cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<endl;
     
    398433 cout<<"HI mass with noise: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
    399434     <<rs2<<" -> "<<sqrt(rs2)<<endl;
     435 PrtTim(">>>> End Add noise");
    400436
    401437 //-----------------------------------------------------------------
     
    405441   cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
    406442   fluct3d.ReComputeFourier();
    407  }
    408 
    409  if(wfits) fluct3d.WriteFits("!cmvobserv3d_k.fits");
    410  if(wppf) fluct3d.WritePPF("cmvobserv3d_k.ppf",false);
     443   PrtTim(">>>> End ReComputing spectrum");
     444 }
     445
     446 if(wfits) {
     447   fluct3d.WriteFits("!cmvobserv3d_k.fits");
     448   PrtTim(">>>> End WriteFits");
     449 }
     450 if(wppf) {
     451   fluct3d.WritePPF("cmvobserv3d_k.ppf",false);
     452   PrtTim(">>>> End WritePPF");
     453 }
    411454
    412455 if(1) {
     
    417460   fluct3d.ComputeSpectrum(hpkrec);
    418461   tagobs = "hpkrec"; posobs.PutObject(hpkrec,tagobs);
     462   PrtTim(">>>> End Computing final spectrum");
    419463 }
    420464
     
    428472   tagobs = "hpkrec2"; posobs.PutObject(hpkrec2,tagobs);
    429473   }
    430  }
    431 
     474   PrtTim(">>>> End Computing final 2D spectrum");
     475 }
     476
     477 PrtTim(">>>> End Of Job");
    432478 return 0;
    433479}
  • trunk/Cosmo/SimLSS/genefluct3d.cc

    r3154 r3155  
    88#include <unistd.h>
    99
    10 #include "timing.h"
    1110#include "tarray.h"
    1211#include "pexceptions.h"
     
    7473void GeneFluct3D::setsize(long nx,long ny,long nz,double dx,double dy,double dz)
    7574{
     75 if(lp_>1) cout<<"--- GeneFluct3D::setsize: N="<<nx<<","<<ny<<","<<nz
     76                <<" D="<<dx<<","<<dy<<","<<dz<<endl;
    7677 if(nx<=0 || dx<=0.) {
    77    cout<<"GeneFluct3D::SetSize_Error: bad value(s)"<<endl;
    78    throw ParmError("GeneFluct3D::SetSize_Error: bad value(s)");
     78   cout<<"GeneFluct3D::setsize_Error: bad value(s)"<<endl;
     79   throw ParmError("GeneFluct3D::setsize_Error: bad value(s)");
    7980 }
    8081
     
    112113void GeneFluct3D::setalloc(void)
    113114{
     115 if(lp_>1) cout<<"--- GeneFluct3D::setalloc ---"<<endl;
    114116 // Dimensionnement du tableau complex<r_8>
    115117 // ATTENTION: TArray adresse en memoire a l'envers du C
     
    120122   array_allocated_ = true;
    121123 } catch (...) {
    122    cout<<"GeneFluct3D::SetSize_Error: Problem allocating T_"<<endl;
     124   cout<<"GeneFluct3D::setalloc_Error: Problem allocating T_"<<endl;
    123125 }
    124126 T_.SetMemoryMapping(BaseArray::CMemoryMapping);
     
    127129void GeneFluct3D::setpointers(bool from_real)
    128130{
     131 if(lp_>1) cout<<"--- GeneFluct3D::setpointers ---"<<endl;
    129132 if(from_real) T_ = ArrCastR2C(R_);
    130133   else        R_ = ArrCastC2R(T_);
     
    147150{
    148151 // --- Initialisation de fftw3 (attention data est sur-ecrit a l'init)
    149  if(lp_>1) PrtTim("--- GeneFluct3D::init_fftw: before fftw_plan ---");
     152 if(lp_>1) cout<<"--- GeneFluct3D::init_fftw ---"<<endl;
    150153#ifdef FFTW_THREAD
    151154 if(nthread_>0) {
    152    cout<<"Computing with "<<nthread_<<" threads"<<endl;
     155   cout<<"...Computing with "<<nthread_<<" threads"<<endl;
    153156   fftw_init_threads();
    154157   fftw_plan_with_nthreads(nthread_);
    155158 }
    156159#endif
     160 if(lp_>1) cout<<"...forward plan"<<endl;
    157161 pf_ = fftw_plan_dft_r2c_3d(Nx_,Ny_,Nz_,data_,fdata_,FFTW_ESTIMATE);
     162 if(lp_>1) cout<<"...backward plan"<<endl;
    158163 pb_ = fftw_plan_dft_c2r_3d(Nx_,Ny_,Nz_,fdata_,data_,FFTW_ESTIMATE);
    159  if(lp_>1) PrtTim("--- GeneFluct3D::init_fftw: after fftw_plan ---");
    160164}
    161165
     
    164168void GeneFluct3D::WriteFits(string cfname,int bitpix)
    165169{
    166  cout<<"GeneFluct3D::WriteFits: Writing Cube to "<<cfname<<endl;
     170 cout<<"--- GeneFluct3D::WriteFits: Writing Cube to "<<cfname<<endl;
    167171 try {
    168172   FitsImg3DWriter fwrt(cfname.c_str(),bitpix,5);
     
    191195void GeneFluct3D::ReadFits(string cfname)
    192196{
    193  cout<<"GeneFluct3D::ReadFits: Reading Cube from "<<cfname<<endl;
     197 cout<<"--- GeneFluct3D::ReadFits: Reading Cube from "<<cfname<<endl;
    194198 try {
    195199   FitsImg3DRead fimg(cfname.c_str(),0,5);
     
    220224// On ecrit soit le TArray<r_8> ou le TArray<complex <r_8> >
    221225{
    222  cout<<"GeneFluct3D::WritePPF: Writing Cube (real="<<write_real<<") to "<<cfname<<endl;
     226 cout<<"--- GeneFluct3D::WritePPF: Writing Cube (real="<<write_real<<") to "<<cfname<<endl;
    223227 try {
    224228   R_.Info()["NX"] = (int_8)Nx_;
     
    245249void GeneFluct3D::ReadPPF(string cfname)
    246250{
    247  cout<<"GeneFluct3D::ReadPPF: Reading Cube from "<<cfname<<endl;
     251 cout<<"--- GeneFluct3D::ReadPPF: Reading Cube from "<<cfname<<endl;
    248252 try {
    249253   bool from_real = true;
     
    306310
    307311 // --- realisation d'un tableau de tirage gaussiens
    308  if(lp_>1) PrtTim("--- ComputeFourier0: before gaussian filling ---");
     312 if(lp_>0) cout<<"--- ComputeFourier0: before gaussian filling ---"<<endl;
    309313 // On tient compte du pb de normalisation de FFTW3
    310314 double sntot = sqrt((double)NRtot_);
     
    313317   data_[ip] = NorRand()/sntot;
    314318 }
    315  if(lp_>1) PrtTim("--- ComputeFourier0: after gaussian filling ---");
    316319
    317320 // --- realisation d'un tableau de tirage gaussiens
    318  if(lp_>1) PrtTim("--- ComputeFourier0: before fft real ---");
     321 if(lp_>0) cout<<"...before fft real ---"<<endl;
    319322 fftw_execute(pf_);
    320  if(lp_>1) PrtTim("--- ComputeFourier0: after fft real ---");
    321323
    322324 // --- On remplit avec une realisation
    323  if(lp_>1) PrtTim("--- ComputeFourier0: before Fourier realization filling ---");
     325 if(lp_>0) cout<<"...before Fourier realization filling ---"<<endl;
    324326 T_(0,0,0) = complex<r_8>(0.);  // on coupe le continue et on l'initialise
    325327 long lmod = Nx_/10; if(lmod<1) lmod=1;
     
    327329   long ii = (i>Nx_/2) ? Nx_-i : i;
    328330   double kx = ii*Dkx_;  kx *= kx;
    329    if(lp_>1 && i%lmod==0) cout<<"i="<<i<<" ii="<<ii<<endl;
     331   if(lp_>0 && i%lmod==0) cout<<"i="<<i<<" ii="<<ii<<endl;
    330332   for(long j=0;j<Ny_;j++) {
    331333     long jj = (j>Ny_/2) ? Ny_-j : j;
     
    342344   }
    343345 }
    344  if(lp_>1) PrtTim("--- ComputeFourier0: after Fourier realization filling ---");
    345 
     346
     347 if(lp_>0) cout<<"...computing power"<<endl;
    346348 double p = compute_power_carte();
    347  cout<<"Puissance dans la realisation: "<<p<<endl;
    348  if(lp_>1) PrtTim("--- ComputeFourier0: after Computing power ---");
     349 if(lp_>0) cout<<"Puissance dans la realisation: "<<p<<endl;
    349350
    350351}
     
    365366
    366367 // --- On remplit avec une realisation
    367  if(lp_>1) PrtTim("--- ComputeFourier: before Fourier realization filling ---");
     368 if(lp_>0) cout<<"--- ComputeFourier ---"<<endl;
    368369 long lmod = Nx_/10; if(lmod<1) lmod=1;
    369370 for(long i=0;i<Nx_;i++) {
    370371   long ii = (i>Nx_/2) ? Nx_-i : i;
    371372   double kx = ii*Dkx_;  kx *= kx;
    372    if(lp_>1 && i%lmod==0) cout<<"i="<<i<<" ii="<<ii<<endl;
     373   if(lp_>0 && i%lmod==0) cout<<"i="<<i<<" ii="<<ii<<endl;
    373374   for(long j=0;j<Ny_;j++) {
    374375     long jj = (j>Ny_/2) ? Ny_-j : j;
     
    386387   }
    387388 }
    388  if(lp_>1) PrtTim("--- ComputeFourier: after Fourier realization filling ---");
    389389
    390390 manage_coefficients();   // gros effet pour les spectres que l'on utilise !
    391  if(lp_>1) PrtTim("--- ComputeFourier: after managing coefficients ---");
    392 
     391
     392 if(lp_>0) cout<<"...computing power"<<endl;
    393393 double p = compute_power_carte();
    394  cout<<"Puissance dans la realisation: "<<p<<endl;
    395  if(lp_>1) PrtTim("--- ComputeFourier: after before Computing power ---");
     394 if(lp_>0) cout<<"Puissance dans la realisation: "<<p<<endl;
    396395
    397396}
     
    401400// because we want a realization of a real data in real space
    402401{
     402 if(lp_>1) cout<<"...managing coefficients"<<endl;
    403403 check_array_alloc();
    404404
     
    421421   }
    422422 }
    423  cout<<"Number of forced real number ="<<nreal<<endl;
     423 if(lp_>1) cout<<"Number of forced real number ="<<nreal<<endl;
    424424
    425425 // 2./ Les elements complexe conjugues (tous dans le plan k=0,Nyquist)
     
    451451   }
    452452 }
    453  cout<<"Number of forced conjugate on cont+nyq ="<<nconj1<<endl;
     453 if(lp_>1) cout<<"Number of forced conjugate on cont+nyq ="<<nconj1<<endl;
    454454
    455455 // b./ les lignes et colonnes hors continu et de nyquist
     
    469469   }
    470470 }
    471  cout<<"Number of forced conjugate hors cont+nyq ="<<nconj2<<endl;
    472 
    473  cout<<"Check: ddl= "<<NRtot_<<" =?= "<<2*(Nx_*Ny_*NCz_-nconj1-nconj2)-8<<endl;
     471 if(lp_>1) cout<<"Number of forced conjugate hors cont+nyq ="<<nconj2<<endl;
     472
     473 if(lp_>1) cout<<"Check: ddl= "<<NRtot_<<" =?= "<<2*(Nx_*Ny_*NCz_-nconj1-nconj2)-8<<endl;
    474474
    475475 return nreal+nconj1+nconj2;
     
    507507//                          avec y = k_x*dx/2
    508508{
    509  check_array_alloc();
    510 
    511  if(lp_>1) PrtTim("--- FilterByPixel: before ---");
     509 if(lp_>0) cout<<"--- FilterByPixel ---"<<endl;
     510 check_array_alloc();
    512511
    513512 for(long i=0;i<Nx_;i++) {
     
    527526 }
    528527
    529  if(lp_>1) PrtTim("--- FilterByPixel: after ---");
    530528}
    531529
     
    534532// Calcule une realisation dans l'espace reel
    535533{
     534 if(lp_>0) cout<<"--- ComputeReal ---"<<endl;
    536535 check_array_alloc();
    537536
    538537 // On fait la FFT
    539  if(lp_>1) PrtTim("--- ComputeReal: before fftw backward ---");
    540538 fftw_execute(pb_);
    541  if(lp_>1) PrtTim("--- ComputeReal: after fftw backward ---");
    542539}
    543540
     
    545542void GeneFluct3D::ReComputeFourier(void)
    546543{
     544 if(lp_>0) cout<<"--- ReComputeFourier ---"<<endl;
    547545 check_array_alloc();
    548546
    549547 // On fait la FFT
    550  if(lp_>1) PrtTim("--- ComputeReal: before fftw forward ---");
    551548 fftw_execute(pf_);
    552549 // On corrige du pb de la normalisation de FFTW3
     
    556553     for(long l=0;l<NCz_;l++) T_(l,j,i) /= complex<r_8>(v);
    557554
    558  if(lp_>1) PrtTim("--- ComputeReal: after fftw forward ---");
    559555}
    560556
     
    565561// cad T(kz,ky,kx) avec  0<kz<kz_nyq  -ky_nyq<ky<ky_nyq  -kx_nyq<kx<kx_nyq
    566562{
    567  check_array_alloc();
    568  if(lp_>1) PrtTim("--- ComputeSpectrum: before ---");
     563 if(lp_>0) cout<<"--- ComputeSpectrum ---"<<endl;
     564 check_array_alloc();
    569565
    570566 if(herr.NBins()<0) return -1;
     
    592588 herr *= norm;
    593589
    594  if(lp_>1) PrtTim("--- ComputeSpectrum: after ---");
    595 
    596590 return 0;
    597591}
     
    599593int GeneFluct3D::ComputeSpectrum2D(Histo2DErr& herr)
    600594{
    601  check_array_alloc();
    602  if(lp_>1) PrtTim("--- ComputeSpectrum2D: before ---");
     595 if(lp_>0) cout<<"--- ComputeSpectrum2D ---"<<endl;
     596 check_array_alloc();
    603597
    604598 if(herr.NBinX()<0 || herr.NBinY()<0) return -1;
     
    626620 herr *= norm;
    627621
    628  if(lp_>1) PrtTim("--- ComputeSpectrum2D: after ---");
    629 
    630622 return 0;
    631623}
     
    635627// Recompute MASS variance in spherical top-hat (rayon=R)
    636628{
    637  check_array_alloc();
    638 
    639  if(lp_>1) PrtTim("--- VarianceFrReal: before computation ---");
     629 if(lp_>0) cout<<"--- VarianceFrReal ---"<<endl;
     630 check_array_alloc();
    640631
    641632 long dnx = long(R/Dx_+0.5); if(dnx<=0) dnx = 1;
    642633 long dny = long(R/Dy_+0.5); if(dny<=0) dny = 1;
    643634 long dnz = long(R/Dz_+0.5); if(dnz<=0) dnz = 1;
    644  cout<<"dnx="<<dnx<<" dny="<<dny<<" dnz="<<dnz<<endl;
     635 if(lp_>0) cout<<"dnx="<<dnx<<" dny="<<dny<<" dnz="<<dnz<<endl;
    645636
    646637 double sum=0., sum2=0., r2 = R*R; int_8 nsum=0;
     
    673664 sum /= nsum;
    674665 sum2 = sum2/nsum - sum*sum;
    675  if(lp_) cout<<"VarianceFrReal: nsum="<<nsum<<" <M>="<<sum<<" <(M-<M>)^2>="<<sum2<<endl;
     666 if(lp_>0) cout<<"VarianceFrReal: nsum="<<nsum<<" <M>="<<sum<<" <(M-<M>)^2>="<<sum2<<endl;
    676667
    677668 var = sum2/(sum*sum);  // <dM>^2/<M>^2
    678  if(lp_) cout<<"sigmaR^2="<<var<<" -> "<<sqrt(var)<<endl;
    679 
    680  if(lp_>1) PrtTim("--- VarianceFrReal: after computation ---");
     669 if(lp_>0) cout<<"sigmaR^2="<<var<<" -> "<<sqrt(var)<<endl;
     670
    681671 return nsum;
    682672}
     
    745735// d_rho/rho -> Mass  (add one!)
    746736{
    747  check_array_alloc();
    748 
    749  if(lp_>1) PrtTim("--- TurnFluct2Mass: before computation ---");
     737 if(lp_>0) cout<<"--- TurnFluct2Mass ---"<<endl;
     738 check_array_alloc();
     739
    750740
    751741 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) {
     
    753743   data_[ip] += 1.;
    754744 }
    755 
    756  if(lp_>1) PrtTim("--- TurnFluct2Mass: after computation ---");
    757745}
    758746
     
    760748// do NOT treate negative or nul values
    761749{
    762  if(lp_>1) PrtTim("--- TurnMass2MeanNumber: before computation ---");
     750 if(lp_>0) cout<<"--- TurnMass2MeanNumber ---"<<endl;
    763751
    764752 double m,s2;
    765753 int_8 ngood = MeanSigma2(m,s2,0.,1e+200);
    766  if(lp_) cout<<"TurnMass2MeanNumber: ngood="<<ngood
    767             <<" m="<<m<<" s2="<<s2<<" -> "<<sqrt(s2)<<endl;
     754 if(lp_>0) cout<<"...ngood="<<ngood
     755               <<" m="<<m<<" s2="<<s2<<" -> "<<sqrt(s2)<<endl;
    768756
    769757 // On doit mettre n*Vol galaxies dans notre survey
     
    775763 //   (rappel sur tout les pixels <1+d_rho/rho>=1)
    776764 double dn = n_by_mpc3*Vol_/m /(double)ngood;  // nb de gal a mettre ds 1 px
    777  if(lp_) cout<<"galaxy density move from "
    778             <<n_by_mpc3*Vol_/double(NRtot_)<<" to "<<dn<<" / pixel"<<endl;
     765 if(lp_>0) cout<<"...galaxy density move from "
     766               <<n_by_mpc3*Vol_/double(NRtot_)<<" to "<<dn<<" / pixel"<<endl;
    779767 double sum = 0.;
    780768 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) {
     
    783771   if(data_[ip]>0.) sum += data_[ip];  // mais on ne les compte pas
    784772 }
    785  if(lp_) cout<<sum<<" galaxies put into survey / "<<n_by_mpc3*Vol_<<endl;
    786 
    787  if(lp_>1) PrtTim("--- TurnMass2MeanNumber: after computation ---");
     773 if(lp_>0) cout<<sum<<"...galaxies put into survey / "<<n_by_mpc3*Vol_<<endl;
     774
    788775 return sum;
    789776}
     
    792779// do NOT treate negative or nul mass  -> let it as it is
    793780{
    794  check_array_alloc();
    795 
    796  if(lp_>1) PrtTim("--- ApplyPoisson: before computation ---");
     781 if(lp_>0) cout<<"--- ApplyPoisson ---"<<endl;
     782 check_array_alloc();
    797783
    798784 double sum = 0.;
     
    806792   }
    807793 }
    808  if(lp_) cout<<sum<<" galaxies put into survey"<<endl;
    809 
    810  if(lp_>1) PrtTim("--- ApplyPoisson: before computation ---");
     794 if(lp_>0) cout<<sum<<" galaxies put into survey"<<endl;
     795
    811796 return sum;
    812797}
     
    820805// RETURN la masse totale
    821806{
    822  check_array_alloc();
    823 
    824  if(lp_>1) PrtTim("--- TurnNGal2Mass: before computation ---");
     807 if(lp_>0) cout<<"--- TurnNGal2Mass ---"<<endl;
     808 check_array_alloc();
    825809
    826810 double sum = 0.;
     
    839823   }
    840824 }
    841  if(lp_) cout<<sum<<" MSol HI mass put into survey"<<endl;
    842 
    843  if(lp_>1) PrtTim("--- TurnNGal2Mass: after computation ---");
     825 if(lp_>0) cout<<sum<<" MSol HI mass put into survey"<<endl;
     826
    844827 return sum;
    845828}
     
    848831// add noise to every pixels (meme les <=0 !)
    849832{
    850  check_array_alloc();
    851 
    852  if(lp_>1) PrtTim("--- AddNoise2Real: before computation ---");
     833 if(lp_>0) cout<<"--- AddNoise2Real: snoise = "<<snoise<<endl;
     834 check_array_alloc();
    853835
    854836 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) {
     
    856838   data_[ip] += snoise*NorRand();
    857839 }
    858 
    859  if(lp_>1) PrtTim("--- AddNoise2Real: after computation ---");
    860 }
     840}
Note: See TracChangeset for help on using the changeset viewer.