Changeset 3524 in Sophya for trunk/Cosmo


Ignore:
Timestamp:
Sep 22, 2008, 4:07:02 PM (17 years ago)
Author:
cmv
Message:

intro du remplissage du NTuple de debug cmv 22/09/2008

Location:
trunk/Cosmo/SimLSS
Files:
3 edited

Legend:

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

    r3518 r3524  
    2828     <<"      (default: no, spectrum Pk(z=z_median) for all cube)"<<endl
    2929     <<" -F : filter spectrum by pixel shape (0=no 1=yes(default)"<<endl
    30      <<" -U typ : do not poisson fluctuate with Ngal, convert directly to HI mass"<<endl
    31      <<"          (typ<0 just multiply dRho/Rho by mass_by_pixel)"<<endl
     30     <<" -U typ =0 compute <NGal>, poisson fluctuate then convert to HI mass (def)"<<endl
     31     <<"        >0 compute directly <HI mass>, do NOT poisson fluctuate with <Ngal>"<<endl
     32     <<"        <0 just multiply dRho/Rho by mass_by_pixel (possible negative pixel values)"<<endl
    3233     <<" -x nx,dx : size along x axis (npix,Mpc)"<<endl
    3334     <<" -y ny,dy : size along y axis (npix,Mpc)"<<endl
     
    100101 bool recompute_schmassdist = true;
    101102 string schmassdistfile = "";
    102  bool no_poisson = false;
    103  int no_poisson_type = 1;
     103 int no_poisson_type = 0;
    104104
    105105 double scalemass = -1.;
     
    126126 bool wslice = false;
    127127 bool compvarreal = false;
     128 unsigned long ntnent = 10000;  // 0 = do not fill NTuple
    128129
    129130 // --- Decodage arguments
     
    148149    break;
    149150  case 'U' :
    150     no_poisson = true;
    151151    sscanf(optarg,"%d",&no_poisson_type);
    152152    break;
     
    233233     <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol"
    234234     <<", schnpt="<<schnpt<<endl;
    235  if(no_poisson) cout<<"No poisson fluctuation, direct conversion to HI mass, typ="
    236                     <<no_poisson_type<<endl;
     235 if(no_poisson_type!=0) cout<<"No poisson fluctuation, direct conversion to HI mass, typ="
     236                            <<no_poisson_type<<endl;
    237237 cout<<"snoise="<<snoise<<" equivalent Msol, evolution="<<noise_evol<<endl;
    238238 cout<<"scalemass="<<scalemass<<endl;
     
    419419 if(computefourier0) fluct3d.ComputeFourier0(pkz);
    420420   else              fluct3d.ComputeFourier(pkz);
     421 fluct3d.NTupleCheck(posobs,string("ntpkgen"),ntnent);
    421422 PrtTim(">>>> End Computing a realization in Fourier space");
    422423
     
    446447   cout<<"\n--- Computing convolution by pixel shape"<<endl;
    447448   fluct3d.FilterByPixel();
     449   fluct3d.NTupleCheck(posobs,string("ntpkgenf"),ntnent);
    448450   PrtTim(">>>> End Computing convolution by pixel shape");
    449451
     
    501503 double rmin,rmax; fluct3d.MinMax(rmin,rmax);
    502504 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
     505 fluct3d.NTupleCheck(posobs,string("ntreal"),ntnent);
    503506 PrtTim(">>>> End Computing a realization in real space");
    504507
     
    509512   fluct3d.MinMax(rmin,rmax);
    510513   cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
     514   fluct3d.NTupleCheck(posobs,string("ntgrow"),ntnent);
    511515   PrtTim(">>>> End Applying growth factor");
    512516 }
     
    549553
    550554 //-----------------------------------------------------------------
    551  if(no_poisson) {
     555 if(no_poisson_type!=0) {
    552556   cout<<"\n--- Converting !!!DIRECTLY!!! mass into HI mass: mass per pixel ="
    553557       <<mass_by_pixel<<endl;
     
    558562     rm = fluct3d.TurnFluct2MeanNumber(mass_by_mpc3); // ici on doit donner Msol/Mpc^3
    559563   }
     564   fluct3d.NTupleCheck(posobs,string("ntmhi"),ntnent);
    560565 } else {
    561566   cout<<"\n--- Converting mass into galaxy number: gal per pixel ="
    562567       <<ngal_by_mpc3*fluct3d.GetDVol()<<endl;
    563568   rm = fluct3d.TurnFluct2MeanNumber(ngal_by_mpc3); // ici on doit donner Ngal/Mpc^3
     569   fluct3d.NTupleCheck(posobs,string("ntmeang"),ntnent);
    564570 }
    565571 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200);
     
    568574 PrtTim(">>>> End Converting mass into galaxy number or mass");
    569575
    570  if( !no_poisson ) {
     576 if( no_poisson_type==0 ) {
    571577
    572578   cout<<"\n--- Apply poisson on galaxy number"<<endl;
     
    575581     nm = fluct3d.MeanSigma2(rm,rs2);
    576582   double xgalmin,xgalmax; fluct3d.MinMax(xgalmin,xgalmax,0.1,1.e50);
     583   fluct3d.NTupleCheck(posobs,string("ntpois"),ntnent);
    577584   PrtTim(">>>> End Apply poisson on galaxy number");
    578585   if(wslice) {
     
    598605     cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl;
    599606     nm = fluct3d.MeanSigma2(rm,rs2);
     607   fluct3d.NTupleCheck(posobs,string("ntmhi"),ntnent);
    600608   PrtTim(">>>> End Convert Galaxy number to HI mass");
    601609
     
    622630 ////  fluct3d.AddAGN(lfjy_agn,lsigma_agn,powlaw_agn);
    623631 ////    nm = fluct3d.MeanSigma2(rm,rs2);
    624  ////   PrtTim(">>>> End Add AGN");
     632 ////  fluct3d.NTupleCheck(posobs,string("ntagn"),ntnent);
     633 ////  PrtTim(">>>> End Add AGN");
    625634 ////}
    626635
     
    632641   snoisesave = snoise;
    633642     nm = fluct3d.MeanSigma2(rm,rs2);
     643   fluct3d.NTupleCheck(posobs,string("ntnois"),ntnent);
    634644   PrtTim(">>>> End Add noise");
    635645 }
     
    644654   PrtTim(">>>> End Scale cube");
    645655 }
     656 fluct3d.NTupleCheck(posobs,string("ntfin"),ntnent);
    646657
    647658 //-----------------------------------------------------------------
     
    664675 cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
    665676 fluct3d.ReComputeFourier();
     677 fluct3d.NTupleCheck(posobs,string("ntpkrec"),ntnent);
    666678 PrtTim(">>>> End ReComputing spectrum");
    667679
  • trunk/Cosmo/SimLSS/genefluct3d.cc

    r3521 r3524  
    1515#include "fabtwriter.h"
    1616#include "fioarr.h"
     17#include "ntuple.h"
    1718
    1819#include "arrctcast.h"
     
    8384 nthread_ = 0;
    8485 lp_ = 0;
    85  array_allocated_ = false;
     86 array_allocated_ = false; array_type = 0;
    8687 cosmo_ = NULL;
    8788 growth_ = NULL;
     
    153154 try {
    154155   T_.ReSize(3,SzK_);
    155    array_allocated_ = true;
     156   array_allocated_ = true; array_type=0;
    156157   if(lp_>1) cout<<"  allocating: "<<T_.Size()*sizeof(complex<GEN3D_TYPE>)/1.e6<<" Mo"<<endl;
    157158 } catch (...) {
     
    552553
    553554//-------------------------------------------------------
     555void GeneFluct3D::NTupleCheck(POutPersist &pos,string ntname,unsigned long nent)
     556// Remplit le NTuple "ntname" avec "nent" valeurs du cube (reel ou complex) et l'ecrit dans "pos"
     557{
     558  if(ntname.size()<=0 || nent==0) return;
     559  int nvar = 0;
     560  if(array_type==1) nvar = 3;
     561  else if(array_type==2) nvar = 4;
     562  else return;
     563  char *vname[4] = {"t","z","re","im"};
     564  float xnt[4];
     565  NTuple nt(nvar,vname);
     566
     567  if(array_type==1) {
     568    unsigned long nmod = Nx_*Ny_*Nz_/nent; if(nmod==0) nmod=1;
     569    unsigned long n=0;
     570    for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) {
     571      if(n==nmod) {
     572        int_8 ip = IndexR(i,j,l);
     573        xnt[0]=sqrt(i*i+j*j); xnt[1]=l; xnt[2]=data_[ip];
     574        nt.Fill(xnt);
     575        n=0;
     576      }
     577      n++;
     578    }
     579  } else {
     580    unsigned long nmod = Nx_*Ny_*NCz_/nent; if(nmod==0) nmod=1;
     581    unsigned long n=0;
     582    for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<NCz_;l++) {
     583      if(n==nmod) {
     584        xnt[0]=sqrt(i*i+j*j); xnt[1]=l; xnt[2]=T_(l,j,i).real(); xnt[3]=T_(l,j,i).imag();
     585        nt.Fill(xnt);
     586        n=0;
     587      }
     588      n++;
     589    }
     590  }
     591
     592  pos.PutObject(nt,ntname);
     593}
     594
     595//-------------------------------------------------------
    554596void GeneFluct3D::Print(void)
    555597{
     
    611653 }
    612654
     655 array_type = 2;
     656
    613657 if(lp_>0) cout<<"...computing power"<<endl;
    614658 double p = compute_power_carte();
     
    654698 }
    655699
     700 array_type = 2;
    656701 manage_coefficients();   // gros effet pour les spectres que l'on utilise !
    657702
     
    851896 // On fait la FFT
    852897 GEN3D_FFTW_EXECUTE(pb_);
     898 array_type = 1;
    853899}
    854900
     
    861907 // On fait la FFT
    862908 GEN3D_FFTW_EXECUTE(pf_);
     909 array_type = 2;
     910
    863911 // On corrige du pb de la normalisation de FFTW3
    864912 double v = (double)NRtot_;
  • trunk/Cosmo/SimLSS/genefluct3d.h

    r3521 r3524  
    137137  void ReadPPF(string cfname);
    138138  void WriteSlicePPF(string cfname);
     139  void NTupleCheck(POutPersist &pos,string ntname,unsigned long nent);
    139140
    140141  void SetPrtLevel(int lp=0) {lp_ = lp;}
     
    177178  // le stockage du Cube de donnees et les pointeurs
    178179  bool array_allocated_;  // true if array has been allocated
     180  unsigned short array_type; // 0=empty, 1=real, 2=complex
    179181  TArray< complex<GEN3D_TYPE> > T_;
    180182  GEN3D_FFTW_COMPLEX *fdata_;
Note: See TracChangeset for help on using the changeset viewer.