Changeset 3331 in Sophya


Ignore:
Timestamp:
Oct 2, 2007, 3:11:22 PM (18 years ago)
Author:
cmv
Message:

mise en place evolution seulement sur distance au plan Z , cmv 02/10/2007

Location:
trunk/Cosmo/SimLSS
Files:
3 edited

Legend:

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

    r3330 r3331  
    2323     <<" -a : auto init random seed (needed for multiple simul)"<<endl
    2424     <<" -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
    2628     <<"      (default: no, spectrum Pk(z=z_median) for all cube)"<<endl
    2729     <<" -F : filter spectrum by pixel shape (0=no 1=yes(default)"<<endl
     
    3234     <<" -z nz,dz : size along z axis (redshift axis, npix,Mpc)"<<endl
    3335     <<" -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
    3640     <<" -2 : compute also 2D spectrum (default: no)"<<endl
    3741     <<" -N scalecube,offsetcube: normalize cube before doing final spectrum (default: automatic)"<<endl
     
    9599 // *** Niveau de bruit
    96100 double snoise= 0.;   // en equivalent MSol
    97  int isnoise_evol = 0;
     101 int noise_evol = 0;
    98102
    99103 // *** AGN
     
    104108 // *** type de generation
    105109 bool computefourier0=false;
    106  bool use_growth_factor = false;
     110 int use_growth_factor = 0;
    107111 unsigned short nthread=0;
    108112 int filter_by_pixel = 1;
     
    124128
    125129 char c;
    126  while((c = getopt(narg,arg,"ha0PWSV2GUF: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) {
    127131  int nth = 0;
    128132  switch (c) {
     
    134138    break;
    135139  case 'G' :
    136     use_growth_factor = true;
     140    sscanf(optarg,"%d",&use_growth_factor);
    137141    break;
    138142  case 'U' :
     
    152156    break;
    153157  case 's' :
    154     sscanf(optarg,"%lf,%d",&snoise,&isnoise_evol);
     158    sscanf(optarg,"%lf,%d",&snoise,&noise_evol);
    155159    break;
    156160  case 'Z' :
     
    212216 cout<<"Filter by pixel = "<<filter_by_pixel<<endl;
    213217 cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl;
     218 cout<<"Use_growth_factor = "<<use_growth_factor<<endl;
    214219 cout<<"nstar= "<<nstar<<"  mstar="<<mstar<<"  alpha="<<alpha<<endl;
    215220 cout<<"schmin="<<schmin<<" ("<<lschmin
     
    217222     <<", schnpt="<<schnpt<<endl;
    218223 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;
    220225 cout<<"scalecube="<<scalecube<<", offsetcube="<<offsetcube<<endl;
    221226 if(do_agn)
     
    385390 //-----------------------------------------------------------------
    386391 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);
    388393 cout<<"Power spectrum set at redshift: "<<pkz.GetZ()<<endl;
    389394 if(computefourier0) fluct3d.ComputeFourier0(pkz);
     
    473478 PrtTim(">>>> End Computing a realization in real space");
    474479
    475  if(use_growth_factor) {
     480 if(use_growth_factor>0) {
    476481   cout<<"\n--- Apply Growth factor"<<endl;
    477482   cout<<"...D(z=0)="<<growth(0.)<<"  D(z="<<zref<<")="<<growth(zref)<<endl;
    478    fluct3d.ApplyGrowthFactor();
     483   fluct3d.ApplyGrowthFactor(use_growth_factor);
    479484   fluct3d.MinMax(rmin,rmax);
    480485   cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
     
    607612 double snoisesave = 0.;
    608613 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);
    611616   snoisesave = snoise;
    612617     nm = fluct3d.MeanSigma2(rm,rs2);
  • trunk/Cosmo/SimLSS/genefluct3d.cc

    r3330 r3331  
    744744
    745745//-------------------------------------------------------------------
    746 void GeneFluct3D::ApplyGrowthFactor(void)
     746void GeneFluct3D::ApplyGrowthFactor(int type_evol)
    747747// Apply Growth to real space
    748748// Using the correspondance between redshift and los comoving distance
    749749// 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;
    752755 check_array_alloc();
    753756
     
    756759   cout<<bla<<endl; throw ParmError(bla);
    757760 }
     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 }
    758765
    759766 InterpFunc interpinv(loscom2zred_min_,loscom2zred_max_,loscom2zred_);
     
    762769 //CHECK: Histo hgr(0.9*zred_[0],1.1*zred_[n-1],1000);
    763770 for(long i=0;i<Nx_;i++) {
    764    double dx2 = xobs_[0] - i*Dx_; dx2 *= dx2;
     771   double dx2 = DXcom(i); dx2 *= dx2;
    765772   for(long j=0;j<Ny_;j++) {
    766      double dy2 = xobs_[1] - j*Dy_; dy2 *= dy2;
     773     double dy2 = DYcom(j); dy2 *= dy2;
    767774     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);
    771779       //CHECK: hgr.Add(z);
    772780       double dzgr = (*growth_)(z);   // interpolation par morceau
     
    14161424}
    14171425
    1418 void GeneFluct3D::AddNoise2Real(double snoise,bool with_evol)
     1426void GeneFluct3D::AddNoise2Real(double snoise,int type_evol)
    14191427// 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 }
    14231441
    14241442 vector<double> correction;
    14251443 InterpFunc *intercor = NULL;
    14261444
    1427  if(with_evol) {
     1445 if(type_evol>0) {
    14281446   // Sigma_Noise(en mass) :
    14291447   //      Slim ~ 1/sqrt(DNu) * sqrt(nlobe)   en W/m^2Hz
     
    14541472 }
    14551473
    1456  double dx2=0., dy2=0., dz2=0.;
     1474 double corrlim[2] = {1.,1.};
    14571475 for(long i=0;i<Nx_;i++) {
    1458    dx2 = DXcom(i); dx2 *= dx2;
     1476   double dx2 = DXcom(i); dx2 *= dx2;
    14591477   for(long j=0;j<Ny_;j++) {
    1460      dy2 = DYcom(j); dy2 *= dy2;
     1478     double dy2 = DYcom(j); dy2 *= dy2;
    14611479     for(long l=0;l<Nz_;l++) {
    14621480       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;
    14661487       }
    14671488       int_8 ip = IndexR(i,j,l);
     
    14701491   }
    14711492 }
     1493 if(type_evol>0)
     1494   cout<<"correction factor range: ["<<corrlim[0]<<","<<corrlim[1]<<"]"<<endl;
    14721495
    14731496 if(intercor!=NULL) delete intercor;
  • trunk/Cosmo/SimLSS/genefluct3d.h

    r3330 r3331  
    9393
    9494  void ComputeReal(void);
    95   void ApplyGrowthFactor(void);
     95  void ApplyGrowthFactor(int type_evol=1);
    9696
    9797  void ReComputeFourier(void);
     
    118118  double TurnMass2Flux(void);
    119119  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);
    121121
    122122  void WriteFits(string cfname,int bitpix=FLOAT_IMG);
Note: See TracChangeset for help on using the changeset viewer.