Changeset 3329 in Sophya for trunk/Cosmo/SimLSS/cmvobserv3d.cc


Ignore:
Timestamp:
Sep 27, 2007, 6:21:55 PM (18 years ago)
Author:
cmv
Message:

possibilite de ne pas faire poisson sur Ngal cmv 27/09/2007

File:
1 edited

Legend:

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

    r3323 r3329  
    2626     <<"      (default: no, spectrum Pk(z=z_median) for all cube)"<<endl
    2727     <<" -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
    2829     <<" -x nx,dx : size along x axis (npix,Mpc)"<<endl
    2930     <<" -y ny,dy : size along y axis (npix,Mpc)"<<endl
     
    9091 bool recompute_schmassdist = true;
    9192 string schmassdistfile = "";
     93 bool no_poisson = false;
    9294
    9395 // *** Niveau de bruit
     
    122124
    123125 char c;
    124  while((c = getopt(narg,arg,"ha0PWSV2GF: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) {
    125127  int nth = 0;
    126128  switch (c) {
     
    133135  case 'G' :
    134136    use_growth_factor = true;
     137    break;
     138  case 'U' :
     139    no_poisson = true;
    135140    break;
    136141  case 'F' :
     
    211216     <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol"
    212217     <<", schnpt="<<schnpt<<endl;
     218 if(no_poisson) cout<<"No poisson fluctuation, direct conversion to HI mass"<<endl;
    213219 cout<<"snoise="<<snoise<<" equivalent Msol, evolution="<<isnoise_evol<<endl;
    214220 cout<<"scalecube="<<scalecube<<", offsetcube="<<offsetcube<<endl;
     
    385391 PrtTim(">>>> End Computing a realization in Fourier space");
    386392
    387  /*
    388  // CMVTEST
    389  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    // CMVTEST
    401    */
    402 
    403393 cout<<"\n--- Checking realization spectra"<<endl;
    404394 HistoErr hpkgen(0.,knyqmax,nherr);
     
    512502 }
    513503
    514  //STOP_HERE_FOR QUICK_DEBUG
    515  // return -41;
    516 
    517504 //-----------------------------------------------------------------
    518505 cout<<endl<<"\n--- Converting fluctuations into mass"<<endl;
     
    521508 PrtTim(">>>> End Converting fluctuations into mass");
    522509
    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");
    552541   }
    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 }
    567567
    568568 if(wfits) {
     
    579579 }
    580580
     581 //-----------------------------------------------------------------
    581582 if(do_agn) {
    582583   cout<<"\n--- Add AGN: <log10(S Jy)>="<<lfjy_agn<<" , sigma="<<lsigma_agn
     
    587588 }
    588589
     590 //-----------------------------------------------------------------
    589591 if(snoise>0.) {
    590592   cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<", evolution="<<isnoise_evol<<endl;
Note: See TracChangeset for help on using the changeset viewer.