#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" void usage(void); void usage(void) { cout<<"cmvobserv3d [...options...]"<0) { cout<<"\n--- Arguments: "<SelectGaussianAlgo(C_Gaussian_RandLibSNorm); RandomGeneratorInterface::SetGlobalRandGenP(RandGen); // --- Decodage des arguments char c; while((c = getopt(narg,arg,"haG:F:x:y:z:Z:128:v:n:CO:So:VT:")) != -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 '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 '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< dloscom = "< sigma="< 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< sigma="<>>> 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: "<>>> 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"); } //----------------------------------------------------------------- if(filter_by_pixel!=0) { cout<<"\n--- Computing convolution by pixel shape"<>>> End Computing convolution by pixel shape"); } if(compdspec&1) { HistoErr hpkgenf(hpkgen); if(filter_by_pixel!=0) { cout<<"\n--- Checking realization spectra"<>>> End Checking realization 1D spectra"); } posobs.PutObject(hpkgenf,"hpkgenf"); } if(compdspec&2) { Histo2DErr hpkgenf2(hpkgen2); if(filter_by_pixel!=0) { 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"); } int_8 nm; double rmref,rs2ref; cout<<"\n--- Computing reference variance in real space"<>>> End Computing reference variance in real space"); 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"); //----------------------------------------------------------------- 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"<>>> End Applying growth factor"); } int_8 nmv; double vmref,vs2ref; cout<<"\n--- Computing reference variance in real space"<>>> End Computing reference variance in real space"); 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"); } } //----------------------------------------------------------------- { 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; posobs.PutObject(dvl,"siminfo"); } delete RandGen; PrtTim(">>>> End Of Job"); //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH } catch (PException& exc) { cerr<<"cmvginit3d.cc catched PException"<