Changeset 3262 in Sophya for trunk/Cosmo/SimLSS/genefluct3d.cc
- Timestamp:
- Jun 5, 2007, 7:52:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.