#include "sopnamsp.h" #include "machdefs.h" #include #include #include #include #include #include #include "sophyainit.h" #include "timing.h" #include "dvlist.h" #include "ntuple.h" #include "matharr.h" #include "randfmt.h" //#include "randr48.h" #include "srandgen.h" #include "constcosmo.h" #include "geneutils.h" #include "genefluct3d.h" string decodecambarg(string arg,double& h, double& z); void usage(void); void usage(void) { cout<<"cmvginit3d [...options...]"<0 : compute beta = OmegaM(z)^fixed_beta"<0) { cout<<"\n--- Arguments: "<SelectGaussianAlgo(C_Gaussian_RandLibSNorm); RandomGeneratorInterface::SetGlobalRandGenP(RandGen); // --- Decodage des arguments char c; while((c = getopt(narg,arg,"haG:F:LKB:x:y:z:Z:128:v:n:CO:So:VT:f:")) != -1) { int nth = 0; switch (c) { case 'a' : AutoInitRand(5); break; case 'G' : use_growth_factor = atoi(optarg); break; case 'F' : filter_by_pixel = atoi(optarg); break; case 'L' : use_noosc = true; break; case 'K' : kaiser_modify = true; break; case 'B' : sscanf(optarg,"%d,%lf",&type_beta,&fixed_beta); break; case 'x' : sscanf(optarg,"%ld,%lf",&nx,&dx); break; case 'y' : sscanf(optarg,"%ld,%lf",&ny,&dy); break; case 'z' : sscanf(optarg,"%ld,%lf",&nz,&dz); break; case 'Z' : zref = atof(optarg); break; case 'v' : comptransveloc = true; temporay_file = optarg; break; case '1' : compdspec |= 1; break; case '2' : compdspec |= 2; break; case 'C' : compdspec |= 4; break; case '8' : sscanf(optarg,"%lf,%lf",&sigmaR,&R); break; case 'V' : compvarreal = true; break; case 'n': ntnent = atol(optarg); if(ntnent<0) ntnent = 0; break; case 'O' : sscanf(optarg,"%hu,%hu",&whattowrt[0],&whattowrt[1]); break; case 'S' : wslice = true; break; case 'o' : rootnameout = optarg; break; case 'T' : nth = atoi(optarg); nthread = (nth<1)? 0: nth; break; case 'f' : cambfread = optarg; break; case 'h' : default : usage(); return -1; } } //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH try { //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH //----------------------------------------------------------------- cout<0) cout<<"Beta: Pk factor is (1 + OmegaM^"<0) cout<<"use CAMB file: cambfread="< dloscom = "<0) { // read pk in CAMB file cout<<"...using CAMB spectrum"<ReadCAMB(fn,h100tab,ztab); pkzt->SetGrowthFactor(&growth); pkzt->SetInterpTyp(2); pkzt->SetZ(zref); pkz = pkzt; // change k limits kmin = pkzt->KMin(); kmax = pkzt->KMax(); cout<<"Change k limits to kmin="<SetZ(0.); pkzwos.SetZ(0.); pkznos.SetZ(0.); double normpkz[2] = {0.,0.}; for(int i=0;i<2;i++) { PkSpectrum* pkvar = NULL; string nam = "With-BAO"; if(i==0) pkvar = &pkzwos; else {pkvar = &pkznos; nam = "No-BAO";} cout< sigma="<SetZ(zref); pkznos.SetZ(zref); pkzwos.SetZ(zref); { Histo hpkz(log10(kmin),log10(kmax),npt); hpkz.ReCenterBin(); FuncToHisto(*pkz,hpkz,true); posobs.PutObject(hpkz,"hpkz"); Histo hpkznos(hpkz); FuncToHisto(pkznos,hpkznos,true); posobs.PutObject(hpkznos,"hpkznos"); Histo hpkzwos(hpkz); FuncToHisto(pkzwos,hpkzwos,true); posobs.PutObject(hpkzwos,"hpkzwos"); } //----------------------------------------------------------------- cout< sigma="<>>> End of definition"); //----------------------------------------------------------------- // Le cube et sa cosmlogie // FFTW3 (p26): faster if sizes 2^a 3^b 5^c 7^d 11^e 13^f with e+f=0 ou 1 cout< >& pkgen = fluct3d.GetComplexArray(); //TArray& rgen = fluct3d.GetRealArray(); cout<>>> End Initialisation of GeneFluct3D"); //----------------------------------------------------------------- cout<<"\n--- Computing a realization in Fourier space"<0) pkz->SetZ(0.); else pkz->SetZ(zref); cout<<"Power spectrum set at redshift: "<GetZ()<>>> End Computing a realization in Fourier space"); HistoErr hpkgen(0.,knyqmax,nherr); if(compdspec&1) { cout<<"\n--- Checking realization spectra"<>>> End Checking realization 1D spectra"); } Histo2DErr hpkgen2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz); if(compdspec&2) { cout<<"\n--- Checking realization 2D spectra"<>>> End Checking realization 2D spectra"); } //----------------------------------------------------------------- bool spec_is_modified = false; if(filter_by_pixel!=0) { cout<<"\n--- Computing convolution by pixel shape"<>>> End Computing convolution by pixel shape"); } //----------------------------------------------------------------- if(kaiser_modify) { cout<<"\n--- Modify spectrum coeff with Kaiser redshift distorted formula"<>>> End Computing Modify spectrum coeff with Kaiser"); } //----------------------------------------------------------------- if(spec_is_modified) fluct3d.NTupleCheck(posobs,string("ntpkgenf"),ntnent); if(compdspec&1) { HistoErr hpkgenf(hpkgen); if(spec_is_modified) { cout<<"\n--- Checking realization spectra"<>>> End Checking realization 1D spectra"); } posobs.PutObject(hpkgenf,"hpkgenf"); } if(compdspec&2) { Histo2DErr hpkgenf2(hpkgen2); if(spec_is_modified) { cout<<"\n--- Checking realization 2D spectra"<>>> End Checking realization 2D spectra"); } posobs.PutObject(hpkgenf2,"hpkgenf2"); } //----------------------------------------------------------------- if(whattowrt[0]&1) { tagobs = rootnameout + "_k.ppf"; fluct3d.WritePPF(tagobs,false); PrtTim(">>>> End WritePPF"); temporay_file = tagobs; } if(whattowrt[0]&2) { tagobs = "!" + rootnameout + "_k.fits"; fluct3d.WriteFits(tagobs); PrtTim(">>>> End WriteFits"); } if(comptransveloc && !(whattowrt[0]&1)) { cout<<">>> Writing FT cube (for transv veloc.) in "<>>> End Writing FT cube"); } //----------------------------------------------------------------- cout<<"\n--- Computing a realization in real space"<>>> End Computing a realization in real space"); if(use_growth_factor>0) { cout<<"\n--- Apply Growth factor"<>>> End Applying growth factor"); } if(whattowrt[1]&1) { tagobs = rootnameout + "_r.ppf"; fluct3d.WritePPF(tagobs,true); PrtTim(">>>> End WritePPF"); } if(whattowrt[1]&2) { tagobs = "!" + rootnameout + "_r.fits"; fluct3d.WriteFits(tagobs); PrtTim(">>>> End WriteFits"); } if(wslice) { tagobs = rootnameout + "_s_r.ppf"; fluct3d.WriteSlicePPF(tagobs); PrtTim(">>>> End WriteSlicePPF"); } //----------------------------------------------------------------- if(compvarreal) { cout<<"\n--- Check variance sigmaR in real space"<>>> End Check variance sigmaR in real space"); } //----------------------------------------------------------------- if(compdspec&4) { // ATTENTION: d_rho/rho ecrase cout<>>> End ReComputing spectrum"); cout<>>> End Computing final spectrum"); HistoErr hpkrec(hpkrecb); if(filter_by_pixel!=0) { cout<>>> End Computing final spectrum with pixel deconv."); } posobs.PutObject(hpkrec,"hpkrec"); cout<<"\n--- Computing final 2D spectrum"<>>> End Computing final 2D spectrum"); Histo2DErr hpkrec2(hpkrecb2); if(filter_by_pixel!=0) { cout<<"\n--- Computing final 2D spectrum with pixel deconv."<>>> End Computing final 2D spectrum with pixel deconv."); } posobs.PutObject(hpkrec2,"hpkrec2"); } //----------------------------------------------------------------- //----------------------------------------------------------------- //----------------------------------------------------------------- if(comptransveloc) { cout<<"\n\n\n"<<"---------------------------------------------\n" <<"--- Transverse velocity space computation ---\n" <<"---------------------------------------------\n"<>>> End Reading the Pk(vec(k)) cube"); if(compdspec&1) { cout<<"\n--- Check realization spectra that has been re-read"<>>> End Checking re-read realization 1D spectra"); posobs.PutObject(hpkgenf_rr,"hpkgenf_rr"); } //----------------------------------------------------------------- cout<<"\n--- Modifying cube for Transverse velocity"<>>> End Modifying cube for Transverse velocity"); if(compdspec&1) { cout<<"\n--- Checking realization spectra"<>>> End Checking realization 1D spectra"); } if(compdspec&2) { cout<<"\n--- Checking realization 2D spectra"<>>> End Checking realization 2D spectra"); } if(whattowrt[0]&1) { tagobs = rootnameout + "_kv.ppf"; fluct3d.WritePPF(tagobs,false); PrtTim(">>>> End WritePPF"); } if(whattowrt[0]&2) { tagobs = "!" + rootnameout + "_kv.fits"; fluct3d.WriteFits(tagobs); PrtTim(">>>> End WriteFits"); } //----------------------------------------------------------------- cout<<"\n--- Computing a realization in real space for Transverse velocity"<>>> End Computing a realization in real space"); if(use_growth_factor>0) { cout<<"\n--- Apply Growth factor for transverse velocity"<>>> End Applying growth factor"); } if(whattowrt[1]&1) { tagobs = rootnameout + "_rv.ppf"; fluct3d.WritePPF(tagobs,true); PrtTim(">>>> End WritePPF"); } if(whattowrt[1]&2) { tagobs = "!" + rootnameout + "_rv.fits"; fluct3d.WriteFits(tagobs); PrtTim(">>>> End WriteFits"); } if(wslice) { tagobs = rootnameout + "_s_rv.ppf"; fluct3d.WriteSlicePPF(tagobs); PrtTim(">>>> End WriteSlicePPF"); } } //// Fin de Transverse velocity space computation //----------------------------------------------------------------- { DVList dvl; dvl("Nx") = (int_4)fluct3d.Nx(); dvl("Ny") = (int_4)fluct3d.Ny(); dvl("Nz") = (int_4)fluct3d.Nz(); dvl("Dx") = fluct3d.Dx(); dvl("Dy") = fluct3d.Dy(); dvl("Dz") = fluct3d.Dz(); dvl("Z") = fluct3d.Zref(); dvl("Zpk") = fluct3d.ZrefPk(); dvl("D") = fluct3d.Dref(); dvl("Dpk") = fluct3d.DrefPk(); dvl("s8") = sigmaR; dvl("Dtype") = (int_4)use_growth_factor; dvl("Pxfilt") = (int_4)filter_by_pixel; if(cambfread.size()>0) dvl("fCAMB") = cambfread; posobs.PutObject(dvl,"siminfo"); } delete RandGen; if(pkz != NULL) delete pkz; PrtTim(">>>> End Of Job"); //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH } catch (PException& exc) { cerr<<"cmvginit3d.cc catched PException"< vs; FillVStringFrString(arg,vs,','); if(vs.size()>1) h = atof(vs[1].c_str()); if(vs.size()>2) z = atof(vs[2].c_str()); cout<<"decodecambarg: "<