Changeset 3331 in Sophya
- Timestamp:
- Oct 2, 2007, 3:11:22 PM (18 years ago)
- Location:
- trunk/Cosmo/SimLSS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/cmvobserv3d.cc
r3330 r3331 23 23 <<" -a : auto init random seed (needed for multiple simul)"<<endl 24 24 <<" -0 : use ComputeFourier0 method (defaut: no, use normal way)"<<endl 25 <<" -G : compute Pk(z=0) and apply growth factor in real space"<<endl 25 <<" -G typevol: compute Pk(z=0) and apply growth factor in real space"<<endl 26 <<" typevol=1 noise evolved with distance / observateur (def)"<<endl 27 <<" typevol=2 noise evolved with distance to middle of Z planes"<<endl 26 28 <<" (default: no, spectrum Pk(z=z_median) for all cube)"<<endl 27 29 <<" -F : filter spectrum by pixel shape (0=no 1=yes(default)"<<endl … … 32 34 <<" -z nz,dz : size along z axis (redshift axis, npix,Mpc)"<<endl 33 35 <<" -Z zref : redshift for the center of the simulation cube"<<endl 34 <<" -s snoise,evol : gaussian noise sigma in equivalent Msol"<<endl 35 <<" if evol>0 noise evolved with distance (def no)"<<endl 36 <<" -s snoise,typevol : gaussian noise sigma in equivalent Msol"<<endl 37 <<" typevol=0 no evolution (def)"<<endl 38 <<" typevol=1 noise evolved with distance / observateur"<<endl 39 <<" typevol=2 noise evolved with distance to middle of Z planes"<<endl 36 40 <<" -2 : compute also 2D spectrum (default: no)"<<endl 37 41 <<" -N scalecube,offsetcube: normalize cube before doing final spectrum (default: automatic)"<<endl … … 95 99 // *** Niveau de bruit 96 100 double snoise= 0.; // en equivalent MSol 97 int isnoise_evol = 0;101 int noise_evol = 0; 98 102 99 103 // *** AGN … … 104 108 // *** type de generation 105 109 bool computefourier0=false; 106 bool use_growth_factor = false;110 int use_growth_factor = 0; 107 111 unsigned short nthread=0; 108 112 int filter_by_pixel = 1; … … 124 128 125 129 char c; 126 while((c = getopt(narg,arg,"ha0PWSV2 GUF:x:y:z:s:Z:M:A:T:N:Q:R:")) != -1) {130 while((c = getopt(narg,arg,"ha0PWSV2UG:F:x:y:z:s:Z:M:A:T:N:Q:R:")) != -1) { 127 131 int nth = 0; 128 132 switch (c) { … … 134 138 break; 135 139 case 'G' : 136 use_growth_factor = true;140 sscanf(optarg,"%d",&use_growth_factor); 137 141 break; 138 142 case 'U' : … … 152 156 break; 153 157 case 's' : 154 sscanf(optarg,"%lf,%d",&snoise,& isnoise_evol);158 sscanf(optarg,"%lf,%d",&snoise,&noise_evol); 155 159 break; 156 160 case 'Z' : … … 212 216 cout<<"Filter by pixel = "<<filter_by_pixel<<endl; 213 217 cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl; 218 cout<<"Use_growth_factor = "<<use_growth_factor<<endl; 214 219 cout<<"nstar= "<<nstar<<" mstar="<<mstar<<" alpha="<<alpha<<endl; 215 220 cout<<"schmin="<<schmin<<" ("<<lschmin … … 217 222 <<", schnpt="<<schnpt<<endl; 218 223 if(no_poisson) cout<<"No poisson fluctuation, direct conversion to HI mass"<<endl; 219 cout<<"snoise="<<snoise<<" equivalent Msol, evolution="<< isnoise_evol<<endl;224 cout<<"snoise="<<snoise<<" equivalent Msol, evolution="<<noise_evol<<endl; 220 225 cout<<"scalecube="<<scalecube<<", offsetcube="<<offsetcube<<endl; 221 226 if(do_agn) … … 385 390 //----------------------------------------------------------------- 386 391 cout<<"\n--- Computing a realization in Fourier space"<<endl; 387 if(use_growth_factor ) pkz.SetZ(0.); else pkz.SetZ(zref);392 if(use_growth_factor>0) pkz.SetZ(0.); else pkz.SetZ(zref); 388 393 cout<<"Power spectrum set at redshift: "<<pkz.GetZ()<<endl; 389 394 if(computefourier0) fluct3d.ComputeFourier0(pkz); … … 473 478 PrtTim(">>>> End Computing a realization in real space"); 474 479 475 if(use_growth_factor ) {480 if(use_growth_factor>0) { 476 481 cout<<"\n--- Apply Growth factor"<<endl; 477 482 cout<<"...D(z=0)="<<growth(0.)<<" D(z="<<zref<<")="<<growth(zref)<<endl; 478 fluct3d.ApplyGrowthFactor( );483 fluct3d.ApplyGrowthFactor(use_growth_factor); 479 484 fluct3d.MinMax(rmin,rmax); 480 485 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl; … … 607 612 double snoisesave = 0.; 608 613 if(snoise>0.) { 609 cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<", evolution="<< isnoise_evol<<endl;610 fluct3d.AddNoise2Real(snoise, (isnoise_evol>0? true:false));614 cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<", evolution="<<noise_evol<<endl; 615 fluct3d.AddNoise2Real(snoise,noise_evol); 611 616 snoisesave = snoise; 612 617 nm = fluct3d.MeanSigma2(rm,rs2); -
trunk/Cosmo/SimLSS/genefluct3d.cc
r3330 r3331 744 744 745 745 //------------------------------------------------------------------- 746 void GeneFluct3D::ApplyGrowthFactor( void)746 void GeneFluct3D::ApplyGrowthFactor(int type_evol) 747 747 // Apply Growth to real space 748 748 // Using the correspondance between redshift and los comoving distance 749 749 // describe in vector "zred_" "loscom_" 750 { 751 if(lp_>0) cout<<"--- ApplyGrowthFactor ---"<<endl; 750 // type_evol = 1 : evolution de la puissance du bruit avec la distance a l'observateur 751 // 2 : evolution de la puissance du bruit avec la distance du plan Z 752 // (tous les pixels d'un plan Z sont mis au meme redshift z que celui du milieu) 753 { 754 if(lp_>0) cout<<"--- ApplyGrowthFactor: evol="<<type_evol<<endl; 752 755 check_array_alloc(); 753 756 … … 756 759 cout<<bla<<endl; throw ParmError(bla); 757 760 } 761 if(type_evol<1 || type_evol>2) { 762 char *bla = "GeneFluct3D::ApplyGrowthFactor_Error: bad type_evol value"; 763 cout<<bla<<endl; throw ParmError(bla); 764 } 758 765 759 766 InterpFunc interpinv(loscom2zred_min_,loscom2zred_max_,loscom2zred_); … … 762 769 //CHECK: Histo hgr(0.9*zred_[0],1.1*zred_[n-1],1000); 763 770 for(long i=0;i<Nx_;i++) { 764 double dx2 = xobs_[0] - i*Dx_; dx2 *= dx2;771 double dx2 = DXcom(i); dx2 *= dx2; 765 772 for(long j=0;j<Ny_;j++) { 766 double dy2 = xobs_[1] - j*Dy_; dy2 *= dy2;773 double dy2 = DYcom(j); dy2 *= dy2; 767 774 for(long l=0;l<Nz_;l++) { 768 double dz2 = xobs_[2] - l*Dz_; dz2 *= dz2; 769 dz2 = sqrt(dx2+dy2+dz2); 770 double z = interpinv(dz2); 775 double dz = DZcom(l); 776 if(type_evol==1) dz = sqrt(dx2+dy2+dz*dz); 777 else dz = fabs(dz); // tous les plans Z au meme redshift 778 double z = interpinv(dz); 771 779 //CHECK: hgr.Add(z); 772 780 double dzgr = (*growth_)(z); // interpolation par morceau … … 1416 1424 } 1417 1425 1418 void GeneFluct3D::AddNoise2Real(double snoise, bool with_evol)1426 void GeneFluct3D::AddNoise2Real(double snoise,int type_evol) 1419 1427 // add noise to every pixels (meme les <=0 !) 1420 { 1421 if(lp_>0) cout<<"--- AddNoise2Real: snoise = "<<snoise<<" evol="<<with_evol<<endl; 1422 check_array_alloc(); 1428 // type_evol = 0 : pas d'evolution de la puissance du bruit 1429 // 1 : evolution de la puissance du bruit avec la distance a l'observateur 1430 // 2 : evolution de la puissance du bruit avec la distance du plan Z 1431 // (tous les plans Z sont mis au meme redshift z de leur milieu) 1432 { 1433 if(lp_>0) cout<<"--- AddNoise2Real: snoise = "<<snoise<<" evol="<<type_evol<<endl; 1434 check_array_alloc(); 1435 1436 if(type_evol<0) type_evol = 0; 1437 if(type_evol>2) { 1438 char *bla = "GeneFluct3D::AddNoise2Real_Error: bad type_evol value"; 1439 cout<<bla<<endl; throw ParmError(bla); 1440 } 1423 1441 1424 1442 vector<double> correction; 1425 1443 InterpFunc *intercor = NULL; 1426 1444 1427 if( with_evol) {1445 if(type_evol>0) { 1428 1446 // Sigma_Noise(en mass) : 1429 1447 // Slim ~ 1/sqrt(DNu) * sqrt(nlobe) en W/m^2Hz … … 1454 1472 } 1455 1473 1456 double dx2=0., dy2=0., dz2=0.;1474 double corrlim[2] = {1.,1.}; 1457 1475 for(long i=0;i<Nx_;i++) { 1458 d x2 = DXcom(i); dx2 *= dx2;1476 double dx2 = DXcom(i); dx2 *= dx2; 1459 1477 for(long j=0;j<Ny_;j++) { 1460 d y2 = DYcom(j); dy2 *= dy2;1478 double dy2 = DYcom(j); dy2 *= dy2; 1461 1479 for(long l=0;l<Nz_;l++) { 1462 1480 double corr = 1.; 1463 if(with_evol) { 1464 dz2 = DZcom(l); dz2 *= dz2; dz2 = sqrt(dx2+dy2+dz2); 1465 corr = (*intercor)(dz2); 1481 if(type_evol>0) { 1482 double dz = DZcom(l); 1483 if(type_evol==1) dz = sqrt(dx2+dy2+dz*dz); 1484 else dz = fabs(dz); // tous les plans Z au meme redshift 1485 corr = (*intercor)(dz); 1486 if(corr<corrlim[0]) corrlim[0]=corr; else if(corr>corrlim[1]) corrlim[1]=corr; 1466 1487 } 1467 1488 int_8 ip = IndexR(i,j,l); … … 1470 1491 } 1471 1492 } 1493 if(type_evol>0) 1494 cout<<"correction factor range: ["<<corrlim[0]<<","<<corrlim[1]<<"]"<<endl; 1472 1495 1473 1496 if(intercor!=NULL) delete intercor; -
trunk/Cosmo/SimLSS/genefluct3d.h
r3330 r3331 93 93 94 94 void ComputeReal(void); 95 void ApplyGrowthFactor( void);95 void ApplyGrowthFactor(int type_evol=1); 96 96 97 97 void ReComputeFourier(void); … … 118 118 double TurnMass2Flux(void); 119 119 void AddAGN(double lfjy,double lsigma,double powlaw=0.); 120 void AddNoise2Real(double snoise, bool with_evol=false);120 void AddNoise2Real(double snoise,int type_evol=0); 121 121 122 122 void WriteFits(string cfname,int bitpix=FLOAT_IMG);
Note:
See TracChangeset
for help on using the changeset viewer.