Changeset 3329 in Sophya
- Timestamp:
- Sep 27, 2007, 6:21:55 PM (18 years ago)
- Location:
- trunk/Cosmo/SimLSS
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/Makefile
r3317 r3329 14 14 MYLIB = $(SOPHYAEXTSLBLIST) -L$(LIB) -lcmvsimbao -lfftw3_threads -lfftw3 -lm 15 15 16 #---- Les programmes utilitaires de calcul de cartes17 16 PROGS = \ 18 17 $(EXE)cmvtuniv $(EXE)cmvtransf $(EXE)cmvtgrowth $(EXE)cmvtstpk \ -
trunk/Cosmo/SimLSS/cmvobserv3d.cc
r3323 r3329 26 26 <<" (default: no, spectrum Pk(z=z_median) for all cube)"<<endl 27 27 <<" -F : filter spectrum by pixel shape (0=no 1=yes(default)"<<endl 28 <<" -U : do not poisson fluctuate with Ngal, convert directly to HI mass"<<endl 28 29 <<" -x nx,dx : size along x axis (npix,Mpc)"<<endl 29 30 <<" -y ny,dy : size along y axis (npix,Mpc)"<<endl … … 90 91 bool recompute_schmassdist = true; 91 92 string schmassdistfile = ""; 93 bool no_poisson = false; 92 94 93 95 // *** Niveau de bruit … … 122 124 123 125 char c; 124 while((c = getopt(narg,arg,"ha0PWSV2G F:x:y:z:s:Z:M:A:T:N:Q:R:")) != -1) {126 while((c = getopt(narg,arg,"ha0PWSV2GUF:x:y:z:s:Z:M:A:T:N:Q:R:")) != -1) { 125 127 int nth = 0; 126 128 switch (c) { … … 133 135 case 'G' : 134 136 use_growth_factor = true; 137 break; 138 case 'U' : 139 no_poisson = true; 135 140 break; 136 141 case 'F' : … … 211 216 <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol" 212 217 <<", schnpt="<<schnpt<<endl; 218 if(no_poisson) cout<<"No poisson fluctuation, direct conversion to HI mass"<<endl; 213 219 cout<<"snoise="<<snoise<<" equivalent Msol, evolution="<<isnoise_evol<<endl; 214 220 cout<<"scalecube="<<scalecube<<", offsetcube="<<offsetcube<<endl; … … 385 391 PrtTim(">>>> End Computing a realization in Fourier space"); 386 392 387 /*388 // CMVTEST389 for(int l=0;l<pkgen.SizeX();l++)390 for(int j=0;j<pkgen.SizeY();j++)391 for(int i=0;i<pkgen.SizeZ();i++) {392 double k2 = fluct3d.Kx(i)*fluct3d.Kx(i)393 +fluct3d.Ky(j)*fluct3d.Ky(j)394 +fluct3d.Kz(l)*fluct3d.Kz(l);395 double pk = (k2>0.)? 1./k2: 0.;396 //pkgen(l,j,i) = ComplexGaussRan(sqrt(pk/2.));397 //pkgen(l,j,i) = sqrt(pk/2.);398 pkgen(l,j,i) = 1.;399 }400 // CMVTEST401 */402 403 393 cout<<"\n--- Checking realization spectra"<<endl; 404 394 HistoErr hpkgen(0.,knyqmax,nherr); … … 512 502 } 513 503 514 //STOP_HERE_FOR QUICK_DEBUG515 // return -41;516 517 504 //----------------------------------------------------------------- 518 505 cout<<endl<<"\n--- Converting fluctuations into mass"<<endl; … … 521 508 PrtTim(">>>> End Converting fluctuations into mass"); 522 509 523 cout<<"\n--- Converting mass into galaxy number: gal per pixel =" 524 <<ngal_by_mpc3*fluct3d.GetDVol()<<endl; 525 rm = fluct3d.TurnMass2MeanNumber(ngal_by_mpc3); 526 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200); 527 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 528 PrtTim(">>>> End Converting mass into galaxy number"); 529 530 cout<<"\n--- Set negative and null pixels to BAD"<<endl; 531 nm = fluct3d.SetToVal(0.,1e+200,-999.); 532 PrtTim(">>>> End Set negative pixels to BAD etc..."); 533 534 cout<<"\n--- Apply poisson on galaxy number"<<endl; 535 fluct3d.ApplyPoisson(); 536 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200); 537 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 538 double xgalmin,xgalmax; fluct3d.MinMax(xgalmin,xgalmax,0.1,1.e50); 539 PrtTim(">>>> End Apply poisson on galaxy number"); 540 if(wslice) { 541 fluct3d.WriteSlicePPF("cmvobserv3d_s_rn.ppf"); 542 PrtTim(">>>> End WriteSlicePPF"); 543 } 544 545 cout<<"\n--- Convert Galaxy number to HI mass"<<endl; 546 double mhi = 0.; 547 if(use_schmassdist) { 548 if(recompute_schmassdist) { 549 int ngalmax = int(xgalmax+0.5); 550 schmdist.SetNgalLim(ngalmax,1,naleagal); 551 PrtTim(">>>> End creating tabulated histograms for trials"); 510 if(no_poisson) { 511 512 cout<<"\n--- Converting !!!DIRECTLY!!! mass into HI mass: mass per pixel =" 513 <<mass_by_mpc3*fluct3d.GetDVol()<<endl; 514 rm = fluct3d.TurnMass2HIMass(mass_by_mpc3); 515 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200); 516 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 517 PrtTim(">>>> End Converting !!!DIRECTLY!!! mass into HI mass"); 518 519 } else { 520 521 cout<<"\n--- Converting mass into galaxy number: gal per pixel =" 522 <<ngal_by_mpc3*fluct3d.GetDVol()<<endl; 523 rm = fluct3d.TurnMass2MeanNumber(ngal_by_mpc3); 524 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200); 525 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 526 PrtTim(">>>> End Converting mass into galaxy number"); 527 528 cout<<"\n--- Set negative and null pixels to BAD"<<endl; 529 nm = fluct3d.SetToVal(0.,1e+200,-999.); 530 PrtTim(">>>> End Set negative pixels to BAD etc..."); 531 532 cout<<"\n--- Apply poisson on galaxy number"<<endl; 533 fluct3d.ApplyPoisson(); 534 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200); 535 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 536 double xgalmin,xgalmax; fluct3d.MinMax(xgalmin,xgalmax,0.1,1.e50); 537 PrtTim(">>>> End Apply poisson on galaxy number"); 538 if(wslice) { 539 fluct3d.WriteSlicePPF("cmvobserv3d_s_rn.ppf"); 540 PrtTim(">>>> End WriteSlicePPF"); 552 541 } 553 mhi = fluct3d.TurnNGal2MassQuick(schmdist); 554 schmdist.PrintStatus(); 555 } else { 556 mhi = fluct3d.TurnNGal2Mass(tirhmdndm,true); 557 } 558 cout<<mhi<<" MSol in survey / "<<mass_by_mpc3*fluct3d.GetVol()<<endl; 559 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200); 560 cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl; 561 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 562 PrtTim(">>>> End Convert Galaxy number to HI mass"); 563 564 cout<<"\n--- Set BAD pixels to Zero"<<endl; 565 nm = fluct3d.SetToVal(-998.,1e+200,0.); 566 PrtTim(">>>> End Set BAD pixels to Zero etc..."); 542 543 cout<<"\n--- Convert Galaxy number to HI mass"<<endl; 544 double mhi = 0.; 545 if(use_schmassdist) { 546 if(recompute_schmassdist) { 547 int ngalmax = int(xgalmax+0.5); 548 schmdist.SetNgalLim(ngalmax,1,naleagal); 549 PrtTim(">>>> End creating tabulated histograms for trials"); 550 } 551 mhi = fluct3d.TurnNGal2MassQuick(schmdist); 552 schmdist.PrintStatus(); 553 } else { 554 mhi = fluct3d.TurnNGal2Mass(tirhmdndm,true); 555 } 556 cout<<mhi<<" MSol in survey / "<<mass_by_mpc3*fluct3d.GetVol()<<endl; 557 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200); 558 cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl; 559 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.); 560 PrtTim(">>>> End Convert Galaxy number to HI mass"); 561 562 cout<<"\n--- Set BAD pixels to Zero"<<endl; 563 nm = fluct3d.SetToVal(-998.,1e+200,0.); 564 PrtTim(">>>> End Set BAD pixels to Zero etc..."); 565 566 } 567 567 568 568 if(wfits) { … … 579 579 } 580 580 581 //----------------------------------------------------------------- 581 582 if(do_agn) { 582 583 cout<<"\n--- Add AGN: <log10(S Jy)>="<<lfjy_agn<<" , sigma="<<lsigma_agn … … 587 588 } 588 589 590 //----------------------------------------------------------------- 589 591 if(snoise>0.) { 590 592 cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<", evolution="<<isnoise_evol<<endl; -
trunk/Cosmo/SimLSS/cmvtvarspec.cc
r3246 r3329 24 24 double ob0 = 0.0444356; 25 25 // -- WMAP 26 double h100=0.71, om0=0.267804, o r0=7.9e-05, ol0=0.73,w0=-1.;26 double h100=0.71, om0=0.267804, ol0=0.73; 27 27 // -- ouvert matter only 28 //double h100=0.71, om0=0.3, o r0=0., ol0=0.,w0=-1.;28 //double h100=0.71, om0=0.3, ol0=0.; 29 29 // -- plat matter only 30 //double h100=0.71, om0=1., o r0=0., ol0=0.,w0=-1.;30 //double h100=0.71, om0=1., ol0=0.; 31 31 32 32 double ns = 1., as = 1.; -
trunk/Cosmo/SimLSS/genefluct3d.cc
r3325 r3329 1054 1054 } 1055 1055 1056 double GeneFluct3D::TurnMass2HIMass(double m_by_mpc3) 1057 { 1058 if(lp_>0) cout<<"--- TurnMass2HIMass : "<<m_by_mpc3<<" Msol/Mpc^3"<<endl; 1059 1060 double mall=0., mgood=0.; 1061 int_8 nall=0, ngood=0; 1062 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) { 1063 int_8 ip = IndexR(i,j,l); 1064 mall += data_[ip]; nall++; 1065 if(data_[ip]>0.) {mgood += data_[ip]; ngood++;} 1066 } 1067 if(ngood>0) mgood /= (double)ngood; 1068 if(nall>0) mall /= (double)nall; 1069 if(lp_>0) cout<<"...ngood="<<ngood<<" mgood="<<mgood 1070 <<", nall="<<nall<<" mall="<<mall<<endl; 1071 if(ngood<=0 || mall<=0.) { 1072 cout<<"TurnMass2HIMass_Error: ngood="<<ngood<<" <=0 || mall="<<mall<<" <=0"<<endl; 1073 throw RangeCheckError("TurnMass2HIMass_Error: ngood<=0 || mall<=0"); 1074 } 1075 1076 // On doit mettre m*Vol masse de HI dans notre survey 1077 // On en met uniquement dans les pixels de masse >0. 1078 // On MET a zero les pixels <0 1079 // On renormalise sur les pixels>0 pour qu'on ait m*Vol masse de HI 1080 // comme on ne prend que les pixels >0, on doit normaliser 1081 // a la moyenne de <1+d_rho/rho> sur ces pixels 1082 // (rappel sur tout les pixels <1+d_rho/rho>=1) 1083 // masse de HI a mettre ds 1 px: 1084 double dm = m_by_mpc3*Vol_/ (mgood/mall) /(double)ngood; 1085 if(lp_>0) cout<<"...HI mass density move from " 1086 <<m_by_mpc3*Vol_/double(NRtot_)<<" to "<<dm<<" / pixel"<<endl; 1087 1088 double sum = 0.; 1089 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) { 1090 int_8 ip = IndexR(i,j,l); 1091 if(data_[ip]<=0.) data_[ip] = 0.; 1092 else { 1093 data_[ip] *= dm; // par coherence on multiplie aussi les <=0 1094 sum += data_[ip]; // mais on ne les compte pas 1095 } 1096 } 1097 1098 if(lp_>0) cout<<sum<<"...mass HI put into survey / "<<m_by_mpc3*Vol_<<endl; 1099 1100 return sum; 1101 } 1102 1056 1103 double GeneFluct3D::TurnMass2MeanNumber(double n_by_mpc3) 1057 1104 // do NOT treate negative or nul values 1058 1105 { 1059 if(lp_>0) cout<<"--- TurnMass2MeanNumber ---"<<endl;1106 if(lp_>0) cout<<"--- TurnMass2MeanNumber : "<<n_by_mpc3<<" gal/Mpc^3"<<endl; 1060 1107 1061 1108 double mall=0., mgood=0.; -
trunk/Cosmo/SimLSS/genefluct3d.h
r3325 r3329 99 99 100 100 void TurnFluct2Mass(void); 101 double TurnMass2HIMass(double m_by_mpc3); 101 102 double TurnMass2MeanNumber(double n_by_mpc3); 102 103 double ApplyPoisson(void); -
trunk/Cosmo/SimLSS/geneutils.cc
r3325 r3329 64 64 : _ymin(0.) , _ymax(0.) , _x(x) , _y(y) 65 65 { 66 int_4 ns = _x.size();66 uint_4 ns = _x.size(); 67 67 if(ns<3 || _y.size()<=0 || ns!=_y.size()) 68 68 throw ParmError("InverseFunc::InverseFunc_Error: bad array size"); 69 69 70 70 // Check "x" strictement monotone croissant 71 for( int_4 i=0;i<ns-1;i++)71 for(uint_4 i=0;i<ns-1;i++) 72 72 if(_x[i+1]<=_x[i]) { 73 73 cout<<"InverseFunc::InverseFunc_Error: _x array not stricly growing"<<endl; … … 76 76 77 77 // Check "y" monotone croissant 78 for( int_4 i=0;i<ns-1;i++)78 for(uint_4 i=0;i<ns-1;i++) 79 79 if(_y[i+1]<_y[i]) { 80 80 cout<<"InverseFunc::InverseFunc_Error: _y array not growing"<<endl; … … 134 134 // Protection 135 135 if(i1<0) {i1++; i2++; i3++;} 136 if(i3== _y.size()) {i1--; i2--; i3--;}136 if(i3==(long)_y.size()) {i1--; i2--; i3--;} 137 137 // Interpolation parabolique 138 138 double dy = _y[i3]-_y[i1]; … … 163 163 { 164 164 long n = X.size(); 165 if( Y.size()<n|| n<2)165 if(n>(long)Y.size() || n<2) 166 166 throw ParmError("InterpTab_Error : incompatible size between X and Y tables!"); 167 167 -
trunk/Cosmo/SimLSS/pkspectrum.cc
r3325 r3329 78 78 O0_ = Oc_ + Ob_; 79 79 if(nobaryon_) {O0_ = Oc_; Ob_ = 0.;} 80 if(lp_) cout<<"h100="<<h_<<" Omatter="<<O0_<<" Ocdm="<<Oc_<<" Ob="<<Ob_<<endl;81 82 80 double H0 = 100. * h_, h2 = h_*h_; 81 if(lp_) cout<<"h100="<<h_<<" H0="<<H0<<") Omatter="<<O0_<<" Ocdm="<<Oc_<<" Ob="<<Ob_<<endl; 82 83 83 84 84 if(tcmb_<0.) tcmb_ = T_CMB_Par;
Note:
See TracChangeset
for help on using the changeset viewer.