Changeset 3262 in Sophya for trunk/Cosmo/SimLSS
- Timestamp:
- Jun 5, 2007, 7:52:59 PM (18 years ago)
- Location:
- trunk/Cosmo/SimLSS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/cmvobserv3d.cc
r3261 r3262 100 100 101 101 // --- Decodage arguments 102 if(narg>0) { 103 for(int i=0;i<narg;i++) cout<<arg[i]<<" "; 104 cout<<endl; 105 } 102 106 103 107 char c; … … 414 418 if(1) { 415 419 cout<<"\n--- Check mean and variance in real space"<<endl; 416 int_8 nlowone =fluct3d.NumberOfBad(-1.,1e+200);420 fluct3d.NumberOfBad(-1.,1e+200); 417 421 nm = fluct3d.MeanSigma2(rm,rs2); 418 cout<<"rgen:("<<nm<<") Mean = "<<rm<<", Sigma^2 = "419 <<rs2<<" -> "<<sqrt(rs2)<<", n(<-1)="<<nlowone<<endl;420 422 PrtTim(">>>> End Check mean and variance in real space"); 421 423 } … … 424 426 cout<<"\n--- Check variance sigmaR in real space"<<endl; 425 427 double varr; 426 int_8 nvarr = fluct3d.VarianceFrReal(R,varr); 427 cout<<"R="<<R<<" : sigmaR^2="<<varr<<" -> "<<sqrt(varr)<<", n="<<nvarr<<endl; 428 fluct3d.VarianceFrReal(R,varr); 428 429 PrtTim(">>>> End Check variance sigmaR in real space"); 429 430 } … … 432 433 cout<<endl<<"\n--- Converting fluctuations into mass"<<endl; 433 434 fluct3d.TurnFluct2Mass(); 434 nm = fluct3d.MeanSigma2(rm,rs2); 435 cout<<"1+rgen: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 436 <<rs2<<" -> "<<sqrt(rs2)<<endl; 437 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 438 cout<<"1+rgen with_neg_a_zero: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 439 <<rs2<<" -> "<<sqrt(rs2)<<endl; 435 nm = fluct3d.MeanSigma2(rm,rs2); 440 436 PrtTim(">>>> End Converting fluctuations into mass"); 441 437 442 438 cout<<"\n--- Converting mass into galaxy number"<<endl; 443 439 rm = fluct3d.TurnMass2MeanNumber(ngal_by_mpc3); 444 cout<<rm<<" galaxies put into survey"<<endl; 445 nm = fluct3d.MeanSigma2(rm,rs2,0.); 446 cout<<"galaxy mass: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 447 <<rs2<<" -> "<<sqrt(rs2)<<endl; 448 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 449 cout<<"galaxy mass with_neg_a_zero: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 450 <<rs2<<" -> "<<sqrt(rs2)<<endl; 451 PrtTim(">>>> End Converting mass into galaxy number"); 440 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200); 441 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 442 PrtTim(">>>> End Converting mass into galaxy number"); 452 443 453 444 cout<<"\n--- Set negative and null pixels to BAD"<<endl; 454 445 nm = fluct3d.SetToVal(0.,1e+200,-999.); 455 cout<<nm<<" negative in survey set to BAD"<<endl;456 nm = fluct3d.MeanSigma2(rm,rs2,-998.);457 cout<<"galaxy mass: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "458 <<rs2<<" -> "<<sqrt(rs2)<<endl;459 446 PrtTim(">>>> End Set negative pixels to BAD etc..."); 460 447 461 448 cout<<"\n--- Apply poisson on galaxy number"<<endl; 462 nm = fluct3d.ApplyPoisson(); 463 cout<<nm<<" galaxies into survey after poisson"<<endl; 464 nm = fluct3d.MeanSigma2(rm,rs2,-998.); 465 cout<<"galaxy number: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 466 <<rs2<<" -> "<<sqrt(rs2)<<endl; 467 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 468 cout<<"galaxy number with_neg_a_zero: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 469 <<rs2<<" -> "<<sqrt(rs2)<<endl; 449 fluct3d.ApplyPoisson(); 450 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200); 451 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 470 452 PrtTim(">>>> End Apply poisson on galaxy number"); 471 453 … … 483 465 double mhi = fluct3d.TurnNGal2Mass(tirhmdndm,true); 484 466 cout<<mhi<<" MSol in survey / "<<mass_by_mpc3*fluct3d.GetVol()<<endl; 485 nm = fluct3d.MeanSigma2(rm,rs2,-998.); 486 cout<<"HI mass: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 487 <<rs2<<" -> "<<sqrt(rs2)<<endl; 488 cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl; 489 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 490 cout<<"HI mass with_neg_a_zero: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 491 <<rs2<<" -> "<<sqrt(rs2)<<endl; 467 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200); 468 cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl; 469 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 492 470 PrtTim(">>>> End Convert Galaxy number to HI mass"); 493 471 494 472 cout<<"\n--- Set BAD pixels to Zero"<<endl; 495 473 nm = fluct3d.SetToVal(-998.,1e+200,0.); 496 cout<<nm<<" BAD in survey set to zero"<<endl;497 nm = fluct3d.MeanSigma2(rm,rs2);498 cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "499 <<rs2<<" -> "<<sqrt(rs2)<<endl;500 474 PrtTim(">>>> End Set BAD pixels to Zero etc..."); 501 475 … … 513 487 <<" , powlaw="<<powlaw_agn<<endl; 514 488 fluct3d.AddAGN(lfjy_agn,lsigma_agn,powlaw_agn); 515 nm = fluct3d.MeanSigma2(rm,rs2); 516 cout<<"HI mass with AGN: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 517 <<rs2<<" -> "<<sqrt(rs2)<<endl; 489 nm = fluct3d.MeanSigma2(rm,rs2); 518 490 PrtTim(">>>> End Add AGN"); 519 491 } … … 522 494 cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<endl; 523 495 fluct3d.AddNoise2Real(snoise); 524 nm = fluct3d.MeanSigma2(rm,rs2); 525 cout<<"HI mass with noise: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = " 526 <<rs2<<" -> "<<sqrt(rs2)<<endl; 496 nm = fluct3d.MeanSigma2(rm,rs2); 527 497 PrtTim(">>>> End Add noise"); 528 498 } -
trunk/Cosmo/SimLSS/genefluct3d.cc
r3261 r3262 381 381 bool found_tag_k = pis.GotoNameTag("pkgen"); 382 382 if(found_tag_k) { 383 cout<<" ...reading spectru ninto TArray<complex <r_8> >"<<endl;383 cout<<" ...reading spectrum into TArray<complex <r_8> >"<<endl; 384 384 pis >> PPFNameTag("pkgen") >> T_; 385 385 from_real = false; … … 792 792 // Recompute MASS variance in spherical top-hat (rayon=R) 793 793 { 794 if(lp_>0) cout<<"--- VarianceFrReal ---"<<endl;794 if(lp_>0) cout<<"--- VarianceFrReal R="<<R<<endl; 795 795 check_array_alloc(); 796 796 … … 829 829 sum /= nsum; 830 830 sum2 = sum2/nsum - sum*sum; 831 if(lp_>0) cout<<" VarianceFrReal:nsum="<<nsum<<" <M>="<<sum<<" <(M-<M>)^2>="<<sum2<<endl;831 if(lp_>0) cout<<"...nsum="<<nsum<<" <M>="<<sum<<" <(M-<M>)^2>="<<sum2<<endl; 832 832 833 833 var = sum2/(sum*sum); // <dM>^2/<M>^2 834 if(lp_>0) cout<<" sigmaR^2="<<var<<" -> "<<sqrt(var)<<endl;834 if(lp_>0) cout<<"...sigmaR^2="<<var<<" -> "<<sqrt(var)<<endl; 835 835 836 836 return nsum; … … 851 851 } 852 852 853 if(lp_>0) cout<<"--- NumberOfBad "<<nbad<<" px out of ]"<<vmin<<","<<vmax<<"["<<endl; 853 854 return nbad; 854 855 } … … 863 864 bool tstval = (vmax>vmin)? true: false; 864 865 if(lp_>0) { 865 cout<<"--- MeanSigma2 :";866 if(tstval) cout<<" range=]"<<vmin<<","<<vmax<<"[";866 cout<<"--- MeanSigma2"; 867 if(tstval) cout<<" range=]"<<vmin<<","<<vmax<<"["; 867 868 if(useout) cout<<", useout="<<useout<<" vout="<<vout; 868 869 cout<<endl; … … 898 899 // cad set to "val0" if in [vmin,vmax] -> vmin and vmax are set to val0 899 900 { 900 if(lp_>0) cout<<"--- SetToVal set to="<<val0901 <<" when in range=["<<vmin<<","<<vmax<<"]"<<endl;902 901 check_array_alloc(); 903 902 … … 909 908 } 910 909 910 if(lp_>0) cout<<"--- SetToVal "<<nbad<<" px set to="<<val0 911 <<" because out of range=]"<<vmin<<","<<vmax<<"["<<endl; 911 912 return nbad; 912 913 } … … 931 932 if(lp_>0) cout<<"--- TurnMass2MeanNumber ---"<<endl; 932 933 933 double m,s2; 934 int_8 ngood = MeanSigma2(m,s2,0.,1e+200); 935 if(lp_>0) cout<<"...ngood="<<ngood 936 <<" m="<<m<<" s2="<<s2<<" -> "<<sqrt(s2)<<endl; 934 double mall=0., mgood=0.; 935 int_8 nall=0, ngood=0; 936 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) { 937 int_8 ip = IndexR(i,j,l); 938 mall += data_[ip]; nall++; 939 if(data_[ip]>0.) {mgood += data_[ip]; ngood++;} 940 } 941 if(ngood>0) mgood /= (double)ngood; 942 if(nall>0) mall /= (double)nall; 943 if(lp_>0) cout<<"...ngood="<<ngood<<" mgood="<<mgood 944 <<", nall="<<nall<<" mall="<<mall<<endl; 945 if(ngood<=0 || mall<=0.) { 946 cout<<"TurnMass2MeanNumber_Error: ngood="<<ngood<<" <=0 || mall="<<mall<<" <=0"<<endl; 947 throw RangeCheckError("TurnMass2MeanNumber_Error: ngood<=0 || mall<=0"); 948 } 937 949 938 950 // On doit mettre n*Vol galaxies dans notre survey … … 943 955 // a la moyenne de <1+d_rho/rho> sur ces pixels 944 956 // (rappel sur tout les pixels <1+d_rho/rho>=1) 945 double dn = n_by_mpc3*Vol_/m /(double)ngood; // nb de gal a mettre ds 1 px 957 // nb de gal a mettre ds 1 px: 958 double dn = n_by_mpc3*Vol_/ (mgood/mall) /(double)ngood; 946 959 if(lp_>0) cout<<"...galaxy density move from " 947 960 <<n_by_mpc3*Vol_/double(NRtot_)<<" to "<<dn<<" / pixel"<<endl; 961 948 962 double sum = 0.; 949 963 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) { … … 952 966 if(data_[ip]>0.) sum += data_[ip]; // mais on ne les compte pas 953 967 } 968 954 969 if(lp_>0) cout<<sum<<"...galaxies put into survey / "<<n_by_mpc3*Vol_<<endl; 955 970
Note:
See TracChangeset
for help on using the changeset viewer.