1 | #include "sopnamsp.h"
|
---|
2 | #include "machdefs.h"
|
---|
3 | #include <iostream>
|
---|
4 | #include <stdlib.h>
|
---|
5 | #include <stdio.h>
|
---|
6 | #include <string.h>
|
---|
7 | #include <math.h>
|
---|
8 | #include <unistd.h>
|
---|
9 | #include "sophyainit.h"
|
---|
10 | #include "timing.h"
|
---|
11 | #include "ntuple.h"
|
---|
12 | #include "matharr.h"
|
---|
13 | #include "randfmt.h"
|
---|
14 | //#include "randr48.h"
|
---|
15 | #include "srandgen.h"
|
---|
16 |
|
---|
17 | #include "constcosmo.h"
|
---|
18 | #include "cosmocalc.h"
|
---|
19 | #include "geneutils.h"
|
---|
20 | #include "genefluct3d.h"
|
---|
21 |
|
---|
22 | void usage(void);
|
---|
23 | void usage(void)
|
---|
24 | {
|
---|
25 | cout<<"cmvobserv3d [...options...]"<<endl
|
---|
26 | <<" -a : auto init random seed (needed for multiple simul)"<<endl
|
---|
27 | <<" -0 : use ComputeFourier0 method (defaut: no, use normal way)"<<endl
|
---|
28 | <<" -G typevol: compute Pk(z=0) and apply growth factor in real space"<<endl
|
---|
29 | <<" typevol=1 evolved with distance / observateur (def)"<<endl
|
---|
30 | <<" typevol=2 evolved with distance to middle of Z planes"<<endl
|
---|
31 | <<" else : no evol, spectrum Pk(z=z_median) for all cube (def)"<<endl
|
---|
32 | <<" -F : filter spectrum by pixel shape (0=no 1=yes(default)"<<endl
|
---|
33 | <<" -U typ =0 compute <NGal>, poisson fluctuate then convert to HI mass (def)"<<endl
|
---|
34 | <<" >0 compute directly <HI mass>, do NOT poisson fluctuate with <Ngal>"<<endl
|
---|
35 | <<" <0 just multiply dRho/Rho by mass_by_pixel (possible negative pixel values)"<<endl
|
---|
36 | <<" -x nx,dx : size along x axis (npix,Mpc)"<<endl
|
---|
37 | <<" -y ny,dy : size along y axis (npix,Mpc)"<<endl
|
---|
38 | <<" if ny or dy <=0 take same value as for x"<<endl
|
---|
39 | <<" -z nz,dz : size along z axis (redshift axis, npix,Mpc)"<<endl
|
---|
40 | <<" -Z zref : redshift for the center of the simulation cube"<<endl
|
---|
41 | <<" -s snoise,typevol : gaussian noise sigma in equivalent Msol"<<endl
|
---|
42 | <<" typevol=0 no evolution (def)"<<endl
|
---|
43 | <<" typevol=1 noise evolved with distance / observateur"<<endl
|
---|
44 | <<" typevol=2 noise evolved with distance to middle of Z planes"<<endl
|
---|
45 | <<" -2 : compute also 2D spectrum (default: no)"<<endl
|
---|
46 | <<" -N scalemass: facteur d\'unite pour la masse (default: -1)"<<endl
|
---|
47 | <<" ex: si on veut unites 10^8 Msol -> scalemass=1.e-8"<<endl
|
---|
48 | <<" si <0 alors facteur=-scalemass*Mpix"<<endl
|
---|
49 | <<" -M schmin,schmax,nsch : min,max mass and nb points for schechter HI"<<endl
|
---|
50 | <<" If nsch<0 alors no,bre de points par decade"<<endl
|
---|
51 | <<" -Q naleagal : use quick method for turning ngal to mass"<<endl
|
---|
52 | <<" -R schmassdist.ppf : read mass distribution for trials from file"<<endl
|
---|
53 | <<" instead of computing it (ONLY if \"-Q\" option is activated)"<<endl
|
---|
54 | <<" -8 sigmaR,R : normalisation du spectre de puissance, R en Mpc"<<endl
|
---|
55 | <<" (default sigmaR=1, R=8/h100 Mpc)"<<endl
|
---|
56 | <<" -W : write cube in FITS format (complex cube is coded as real cube)"<<endl
|
---|
57 | <<" -P : write cube in PPF format"<<endl
|
---|
58 | <<" -O a,b,c,d,e : tell what you want to write (with the -W and -P options)"<<endl
|
---|
59 | <<" a=1 : write generated fourier cube (_k0)"<<endl
|
---|
60 | <<" b=1 : write real space cube dRho/Rho at z (_r0)"<<endl
|
---|
61 | <<" c=1 : write real space cube conv to gal,poiss,mass etc... (_r)"<<endl
|
---|
62 | <<" d=1 : write previous real space cube + noise (_rf)"<<endl
|
---|
63 | <<" e=1 : write fourier transform of previous cube (_k)"<<endl
|
---|
64 | <<" -S : write cube slices in PPF format"<<endl
|
---|
65 | <<" -o root_name_out : root string for output file name (def: cmvobserv3d)"<<endl
|
---|
66 | <<" -V : compute variance from real space (for check, default: no)"<<endl
|
---|
67 | <<" -T nth : nombre de threads (si compil multi-thread, default: 0)"<<endl
|
---|
68 | <<endl;
|
---|
69 | ////<<" -A <log10(S_agn in Jy at 1.4 GHz)>,sigma,powlaw :"<<endl
|
---|
70 | ////<<" AGN mean and sigma gaussian equiv. distrib. for solid angle of centeral pixel"<<endl
|
---|
71 | ////<<" powlaw: apply S_agn evolution as (Nu/1.4)^powlaw"<<endl
|
---|
72 | }
|
---|
73 |
|
---|
74 | int main(int narg,char *arg[])
|
---|
75 | {
|
---|
76 | SophyaInit();
|
---|
77 | InitTim();
|
---|
78 |
|
---|
79 | //-----------------------------------------------------------------
|
---|
80 | // *** Survey definition
|
---|
81 | long nx=360, ny=-1, nz=64; double dx=1., dy=-1., dz=-1.;
|
---|
82 | //long nx=1000, ny=-1, nz=128; double dx=3., dy=-1., dz=6.;
|
---|
83 | //long nx=1200, ny=-1, nz=128; double dx=1., dy=-1., dz=3;
|
---|
84 |
|
---|
85 | // *** Cosmography definition (WMAP)
|
---|
86 | unsigned short flat = 0;
|
---|
87 | double ob0 = 0.0444356;
|
---|
88 | double h100=0.71, om0=0.267804, or0=7.9e-05, ol0=0.73,w0=-1.;
|
---|
89 | double zref = 0.5;
|
---|
90 | double perc=0.01,dzinc=-1.,dzmax=-1.; unsigned short glorder=4;
|
---|
91 |
|
---|
92 | // *** Spectrum and variance definition
|
---|
93 | double ns = 1., as = 1.;
|
---|
94 | double R=8./h100, Rg=R/sqrt(5.);
|
---|
95 | double sigmaR = 1.;
|
---|
96 |
|
---|
97 | double kmin=1e-5,kmax=1000.;
|
---|
98 | int npt = 10000;
|
---|
99 | double lkmin=log10(kmin), lkmax=log10(kmax);
|
---|
100 | double eps=1.e-3;
|
---|
101 |
|
---|
102 | // *** Schechter mass function definition
|
---|
103 | double h75 = h100 / 0.75;
|
---|
104 | double nstar = 0.006*pow(h75,3.);
|
---|
105 | double mstar = pow(10.,9.8); // MSol
|
---|
106 | double alpha = -1.37;
|
---|
107 |
|
---|
108 | double schmin=1.e7, schmax=1.e13;
|
---|
109 | int schnpt = -100;
|
---|
110 | bool use_schmassdist = false;
|
---|
111 | long naleagal = 100000;
|
---|
112 | bool recompute_schmassdist = true;
|
---|
113 | string schmassdistfile = "";
|
---|
114 | int no_poisson_type = 0;
|
---|
115 |
|
---|
116 | double scalemass = -1.;
|
---|
117 |
|
---|
118 | // *** Niveau de bruit
|
---|
119 | double snoise= 0.; // en equivalent MSol
|
---|
120 | int noise_evol = 0;
|
---|
121 |
|
---|
122 | //// *** AGN
|
---|
123 | ////bool do_agn = false;
|
---|
124 | ////double lfjy_agn=-99., lsigma_agn=0.; // en Jy
|
---|
125 | ////double powlaw_agn = 0.;
|
---|
126 |
|
---|
127 | // *** type de generation
|
---|
128 | bool computefourier0=false;
|
---|
129 | int use_growth_factor = 0;
|
---|
130 | unsigned short nthread=0;
|
---|
131 | int filter_by_pixel = 1;
|
---|
132 |
|
---|
133 | // *** What to do
|
---|
134 | bool comp2dspec = false;
|
---|
135 | bool wfits = false;
|
---|
136 | bool wppf = false;
|
---|
137 | bool wslice = false;
|
---|
138 | bool compvarreal = false;
|
---|
139 | unsigned short whattowrt[5] = {1,1,1,1,1};
|
---|
140 | string rootnameout = "cmvobserv3d";
|
---|
141 |
|
---|
142 | // *** Number of entries in control NTuple
|
---|
143 | unsigned long ntnent = 10000; // 0 = do not fill NTuple
|
---|
144 |
|
---|
145 | // --- Decodage arguments
|
---|
146 | if(narg>0) {
|
---|
147 | cout<<"\n--- Arguments: "<<endl;
|
---|
148 | for(int i=0;i<narg;i++) cout<<arg[i]<<" ";
|
---|
149 | cout<<endl;
|
---|
150 | }
|
---|
151 | system("date -u");
|
---|
152 |
|
---|
153 | // --- Choix du generateur aleatoire (a faire ICI imperativement avant AutoInitRand)
|
---|
154 | FMTRandGen *RandGen = new FMTRandGen;
|
---|
155 | RandGen->SelectGaussianAlgo(C_Gaussian_RandLibSNorm);
|
---|
156 | RandGen->SelectPoissonAlgo(C_Poisson_Ahrens);
|
---|
157 | RandomGeneratorInterface::SetGlobalRandGenP(RandGen);
|
---|
158 |
|
---|
159 | // --- Decodage des arguments
|
---|
160 | char c;
|
---|
161 | while((c = getopt(narg,arg,"ha0PWSV2U:G:F:x:y:z:s:Z:M:A:T:N:Q:R:8:O:o:")) != -1) {
|
---|
162 | int nth = 0;
|
---|
163 | switch (c) {
|
---|
164 | case 'a' :
|
---|
165 | AutoInitRand(5);
|
---|
166 | break;
|
---|
167 | case '0' :
|
---|
168 | computefourier0 = true;
|
---|
169 | break;
|
---|
170 | case 'G' :
|
---|
171 | sscanf(optarg,"%d",&use_growth_factor);
|
---|
172 | break;
|
---|
173 | case 'U' :
|
---|
174 | sscanf(optarg,"%d",&no_poisson_type);
|
---|
175 | break;
|
---|
176 | case 'F' :
|
---|
177 | sscanf(optarg,"%d",&filter_by_pixel);
|
---|
178 | break;
|
---|
179 | case 'x' :
|
---|
180 | sscanf(optarg,"%ld,%lf",&nx,&dx);
|
---|
181 | break;
|
---|
182 | case 'y' :
|
---|
183 | sscanf(optarg,"%ld,%lf",&ny,&dy);
|
---|
184 | break;
|
---|
185 | case 'z' :
|
---|
186 | sscanf(optarg,"%ld,%lf",&nz,&dz);
|
---|
187 | break;
|
---|
188 | case 's' :
|
---|
189 | sscanf(optarg,"%lf,%d",&snoise,&noise_evol);
|
---|
190 | break;
|
---|
191 | case 'Z' :
|
---|
192 | sscanf(optarg,"%lf",&zref);
|
---|
193 | break;
|
---|
194 | case '2' :
|
---|
195 | comp2dspec = true;
|
---|
196 | break;
|
---|
197 | case 'N' :
|
---|
198 | sscanf(optarg,"%lf",&scalemass);
|
---|
199 | if(scalemass==0.) scalemass = 1.;
|
---|
200 | break;
|
---|
201 | case 'M' :
|
---|
202 | sscanf(optarg,"%lf,%lf,%d",&schmin,&schmax,&schnpt);
|
---|
203 | break;
|
---|
204 | case 'Q' :
|
---|
205 | use_schmassdist = true;
|
---|
206 | sscanf(optarg,"%ld",&naleagal);
|
---|
207 | break;
|
---|
208 | case 'R' :
|
---|
209 | schmassdistfile = optarg;
|
---|
210 | break;
|
---|
211 | //// case 'A' :
|
---|
212 | ////do_agn = true;
|
---|
213 | ////sscanf(optarg,"%lf,%lf,%lf",&lfjy_agn,&lsigma_agn,&powlaw_agn);
|
---|
214 | ////break;
|
---|
215 | case '8' :
|
---|
216 | sscanf(optarg,"%lf,%lf",&sigmaR,&R);
|
---|
217 | break;
|
---|
218 | case 'V' :
|
---|
219 | compvarreal = true;
|
---|
220 | break;
|
---|
221 | case 'W' :
|
---|
222 | wfits = true;
|
---|
223 | break;
|
---|
224 | case 'P' :
|
---|
225 | wppf = true;
|
---|
226 | break;
|
---|
227 | case 'O' :
|
---|
228 | sscanf(optarg,"%hu,%hu,%hu,%hu,%hu"
|
---|
229 | ,&whattowrt[0],&whattowrt[1],&whattowrt[2],&whattowrt[3],&whattowrt[4]);
|
---|
230 | break;
|
---|
231 | case 'S' :
|
---|
232 | wslice = true;
|
---|
233 | break;
|
---|
234 | case 'o' :
|
---|
235 | rootnameout = optarg;
|
---|
236 | break;
|
---|
237 | case 'T' :
|
---|
238 | sscanf(optarg,"%d",&nth);
|
---|
239 | nthread = (nth<1)? 0: nth;
|
---|
240 | break;
|
---|
241 | case 'h' :
|
---|
242 | default :
|
---|
243 | usage(); return -1;
|
---|
244 | }
|
---|
245 | }
|
---|
246 |
|
---|
247 | //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH
|
---|
248 | try {
|
---|
249 | //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH
|
---|
250 |
|
---|
251 | double lschmin=log10(schmin), lschmax=log10(schmax);
|
---|
252 | if(schnpt<=0) { // alors c'est un nombre de points par decade
|
---|
253 | schnpt = long( (-schnpt)*(lschmax-lschmin+1.) + 0.5 );
|
---|
254 | if(schnpt<=2) schnpt = 1000;
|
---|
255 | }
|
---|
256 | if(naleagal<=2) naleagal = 100000;
|
---|
257 |
|
---|
258 | cout<<"zref="<<zref<<endl;
|
---|
259 | cout<<"nx="<<nx<<" dx="<<dx<<" ny="<<ny<<" dy="<<dy<<" nz="<<nz<<" dz="<<dz<<endl;
|
---|
260 | cout<<"kmin="<<kmin<<" ("<<lkmin<<"), kmax="<<kmax<<" ("<<lkmax<<") Mpc^-1"
|
---|
261 | <<", npt="<<npt<<endl;
|
---|
262 | cout<<"Filter by pixel = "<<filter_by_pixel<<endl;
|
---|
263 | cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl;
|
---|
264 | cout<<"Use_growth_factor = "<<use_growth_factor<<endl;
|
---|
265 | cout<<"nstar= "<<nstar<<" mstar="<<mstar<<" alpha="<<alpha<<endl;
|
---|
266 | cout<<"schmin="<<schmin<<" ("<<lschmin
|
---|
267 | <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol"
|
---|
268 | <<", schnpt="<<schnpt<<endl;
|
---|
269 | if(no_poisson_type!=0) cout<<"No poisson fluctuation, direct conversion to HI mass, typ="
|
---|
270 | <<no_poisson_type<<endl;
|
---|
271 | cout<<"snoise="<<snoise<<" equivalent Msol, evolution="<<noise_evol<<endl;
|
---|
272 | cout<<"scalemass="<<scalemass<<endl;
|
---|
273 | ////if(do_agn)
|
---|
274 | //// cout<<"AGN: <log10(Jy)>="<<lfjy_agn<<" , sigma="<<lsigma_agn
|
---|
275 | //// <<" , powlaw="<<powlaw_agn<<endl;
|
---|
276 | cout<<"wfits="<<wfits<<" wppf="<<wppf<<" wslice="<<wslice<<" what?="
|
---|
277 | <<whattowrt[0]<<","<<whattowrt[1]<<","<<whattowrt[2]<<","<<whattowrt[3]<<","
|
---|
278 | <<whattowrt[4]<<endl;
|
---|
279 | cout<<"rootnameout="<<rootnameout<<endl;
|
---|
280 | ShowRandom();
|
---|
281 | cout<<" First random is: "<<drand01()<<endl;
|
---|
282 |
|
---|
283 | string tagobs = rootnameout + ".ppf";
|
---|
284 | POutPersist posobs(tagobs);
|
---|
285 |
|
---|
286 | //-----------------------------------------------------------------
|
---|
287 | cout<<endl<<"\n--- Create Cosmology"<<endl;
|
---|
288 |
|
---|
289 | CosmoCalc univ(flat,true,zref+1.);
|
---|
290 | univ.SetInteg(perc,dzinc,dzmax,glorder);
|
---|
291 | univ.SetDynParam(h100,om0,or0,ol0,w0);
|
---|
292 | univ.PrtInteg();
|
---|
293 | univ.Print();
|
---|
294 | double loscomref = univ.Dloscom(zref);
|
---|
295 | cout<<"\nzref = "<<zref<<" -> dloscom = "<<loscomref<<" Mpc"<<endl;
|
---|
296 | univ.Print(zref);
|
---|
297 |
|
---|
298 | //-----------------------------------------------------------------
|
---|
299 | cout<<endl<<"\n--- Create Spectrum"<<endl;
|
---|
300 |
|
---|
301 | InitialSpectrum pkini(ns,as);
|
---|
302 |
|
---|
303 | TransfertEisenstein tf(h100,om0-ob0,ob0,T_CMB_Par,false);
|
---|
304 | //tf.SetNoOscEnv(2);
|
---|
305 |
|
---|
306 | GrowthFactor growth(om0,ol0);
|
---|
307 | // GrowthFactor growth(1.,0.); // D(z) = 1/(1+z)
|
---|
308 | double growth_at_z = growth(zref);
|
---|
309 | cout<<"...Growth factor at z="<<zref<<" = "<<growth_at_z<<endl;
|
---|
310 |
|
---|
311 | PkSpectrum0 pk0(pkini,tf);
|
---|
312 |
|
---|
313 | PkSpectrumZ pkz(pk0,growth,zref);
|
---|
314 |
|
---|
315 | //-----------------------------------------------------------------
|
---|
316 | pkz.SetZ(0.);
|
---|
317 | cout<<endl<<"\n--- Compute variance for top-hat R="<<R
|
---|
318 | <<" at z="<<pkz.GetZ()<<endl;
|
---|
319 | VarianceSpectrum varpk_th(pkz,R,VarianceSpectrum::TOPHAT);
|
---|
320 | double kfind_th = varpk_th.FindMaximum(kmin,kmax,eps);
|
---|
321 | double pkmax_th = varpk_th(kfind_th);
|
---|
322 | cout<<"kfind_th = "<<kfind_th<<" ("<<log10(kfind_th)<<"), integrand="<<pkmax_th<<endl;
|
---|
323 | double k1=kmin, k2=kmax;
|
---|
324 | int rc = varpk_th.FindLimits(pkmax_th/1.e4,k1,k2,eps);
|
---|
325 | cout<<"limit_th: rc="<<rc<<" : "<<k1<<" ("<<log10(k1)<<") , "
|
---|
326 | <<k2<<" ("<<log10(k2)<<")"<<endl;
|
---|
327 |
|
---|
328 | double ldlk = (log10(k2)-log10(k1))/npt;
|
---|
329 | varpk_th.SetInteg(0.01,ldlk,-1.,4);
|
---|
330 | double sr2 = varpk_th.Variance(k1,k2);
|
---|
331 | cout<<"varpk_th="<<sr2<<" -> sigma="<<sqrt(sr2)<<endl;
|
---|
332 |
|
---|
333 | double normpkz = sigmaR*sigmaR/sr2;
|
---|
334 | pkz.SetScale(normpkz);
|
---|
335 | cout<<"Spectrum normalisation = "<<pkz.GetScale()<<endl;
|
---|
336 |
|
---|
337 | {
|
---|
338 | Histo hpkz0(lkmin,lkmax,npt); hpkz0.ReCenterBin();
|
---|
339 | FuncToHisto(pkz,hpkz0,true);
|
---|
340 | tagobs = "hpkz0"; posobs.PutObject(hpkz0,tagobs);
|
---|
341 | }
|
---|
342 |
|
---|
343 | pkz.SetZ(zref);
|
---|
344 |
|
---|
345 | {
|
---|
346 | Histo hpkz(lkmin,lkmax,npt); hpkz.ReCenterBin();
|
---|
347 | FuncToHisto(pkz,hpkz,true);
|
---|
348 | tagobs = "hpkz"; posobs.PutObject(hpkz,tagobs);
|
---|
349 | }
|
---|
350 |
|
---|
351 | //-----------------------------------------------------------------
|
---|
352 | cout<<endl<<"\n--- Compute variance for Pk at z="<<pkz.GetZ()<<endl;
|
---|
353 | VarianceSpectrum varpk_int(pkz,R,VarianceSpectrum::NOFILTER);
|
---|
354 |
|
---|
355 | double kfind_int = varpk_int.FindMaximum(kmin,kmax,eps);
|
---|
356 | double pkmax_int = varpk_int(kfind_int);
|
---|
357 | cout<<"kfind_int = "<<kfind_int<<" ("<<log10(kfind_int)<<"), integrand="<<pkmax_int<<endl;
|
---|
358 | double k1int=kmin, k2int=kmax;
|
---|
359 | int rcint = varpk_int.FindLimits(pkmax_int/1.e4,k1int,k2int,eps);
|
---|
360 | cout<<"limit_int: rc="<<rcint<<" : "<<k1int<<" ("<<log10(k1int)<<") , "
|
---|
361 | <<k2int<<" ("<<log10(k2int)<<")"<<endl;
|
---|
362 |
|
---|
363 | double ldlkint = (log10(k2int)-log10(k1int))/npt;
|
---|
364 | varpk_int.SetInteg(0.01,ldlkint,-1.,4);
|
---|
365 | double sr2int = varpk_int.Variance(k1int,k2int);
|
---|
366 | cout<<"varpk_int="<<sr2int<<" -> sigma="<<sqrt(sr2int)<<endl;
|
---|
367 |
|
---|
368 | //-----------------------------------------------------------------
|
---|
369 | cout<<endl<<"\n--- Create mass function, compute number/mass density, init mass trials"<<endl;
|
---|
370 |
|
---|
371 | Schechter sch(nstar,mstar,alpha);
|
---|
372 | sch.Print();
|
---|
373 |
|
---|
374 | sch.SetOutValue(0);
|
---|
375 | cout<<"sch(mstar) = "<<sch(mstar)<<" /Mpc^3/Msol"<<endl;
|
---|
376 | double ngal_by_mpc3 = sch.Integrate(schmin,schmax,schnpt);
|
---|
377 | cout<<"Galaxy density number = "<<ngal_by_mpc3<<" /Mpc^3 between limits"<<endl;
|
---|
378 |
|
---|
379 | sch.SetOutValue(1);
|
---|
380 | cout<<"mstar*sch(mstar) = "<<sch(mstar)<<" Msol/Mpc^3/Msol"<<endl;
|
---|
381 | double mass_by_mpc3 = sch.Integrate(schmin,schmax,schnpt);
|
---|
382 | cout<<"Galaxy mass density= "<<mass_by_mpc3<<" Msol/Mpc^3 between limits"<<endl;
|
---|
383 | cout<<"Omega_HI at z=0 is "<<mass_by_mpc3/(univ.Rhoc(0.)*GCm3toMsolMpc3_Cst)<<endl
|
---|
384 | <<" at z="<<zref<<" is "<<mass_by_mpc3/(univ.Rhoc(zref)*GCm3toMsolMpc3_Cst)<<endl;
|
---|
385 |
|
---|
386 | SchechterMassDist schmdist(sch,schmin,schmax,schnpt);
|
---|
387 | if(use_schmassdist && schmassdistfile.size()>0) {
|
---|
388 | cout<<"\nSchechterMassDist read from "<<schmassdistfile<<endl;
|
---|
389 | schmdist.ReadPPF(schmassdistfile);
|
---|
390 | bool compsch = IsCompatible(sch,schmdist.GetSchechter());
|
---|
391 | double m1,m2; schmdist.GetMassLim(m1,m2);
|
---|
392 | if( !compsch || fabs(m1-schmin)>1e-4*schmin || fabs(m2-schmax)>1e-4*schmax) {
|
---|
393 | cout<<"FATAL_ERROR: INCONSISTENT SchechterMassDist file / Schechter or limits"<<endl;
|
---|
394 | cout<<"Schechter:"<<endl; sch.Print();
|
---|
395 | cout<<"schmin="<<schmin<<" schmax="<<schmax<<endl;
|
---|
396 | cout<<"SchechterMassDist:"<<endl; schmdist.Print();
|
---|
397 | return -10;
|
---|
398 | }
|
---|
399 | recompute_schmassdist = false;
|
---|
400 | }
|
---|
401 | schmdist.Print();
|
---|
402 | Histo hmdndm = schmdist.GetHmDnDm();
|
---|
403 | FunRan tirhmdndm = schmdist.GetTmDnDm();
|
---|
404 | {
|
---|
405 | tagobs = "hmdndm"; posobs.PutObject(hmdndm,tagobs);
|
---|
406 | Histo hdum1(tirhmdndm);
|
---|
407 | tagobs = "tirhmdndm"; posobs.PutObject(hdum1,tagobs);
|
---|
408 | }
|
---|
409 |
|
---|
410 | PrtTim(">>>> End of definition");
|
---|
411 |
|
---|
412 | //-----------------------------------------------------------------
|
---|
413 | // FFTW3 (p26): faster if sizes 2^a 3^b 5^c 7^d 11^e 13^f with e+f=0 ou 1
|
---|
414 | cout<<endl<<"\n--- Initialisation de GeneFluct3D"<<endl;
|
---|
415 |
|
---|
416 | GeneFluct3D fluct3d(nx,ny,nz,dx,dy,dz,nthread,2);
|
---|
417 | fluct3d.SetCosmology(univ);
|
---|
418 | fluct3d.SetGrowthFactor(growth);
|
---|
419 | fluct3d.SetObservator(zref,-nz/2.);
|
---|
420 | fluct3d.LosComRedshift(0.001,-1);
|
---|
421 | //TArray< complex<GEN3D_TYPE> >& pkgen = fluct3d.GetComplexArray();
|
---|
422 | //TArray<GEN3D_TYPE>& rgen = fluct3d.GetRealArray();
|
---|
423 | cout<<endl; fluct3d.Print();
|
---|
424 | cout<<"\nMean number of galaxies per pixel = "<<ngal_by_mpc3*fluct3d.GetDVol()<<endl;
|
---|
425 | double mass_by_pixel = mass_by_mpc3 * fluct3d.GetDVol();
|
---|
426 | cout<<"Mean mass per pixel = "<<mass_by_pixel<<endl;
|
---|
427 |
|
---|
428 | double dkmin = fluct3d.GetKincMin();
|
---|
429 | double knyqmax = fluct3d.GetKmax();
|
---|
430 | long nherr = long(knyqmax/dkmin+0.5);
|
---|
431 | cout<<"\nFor HistoErr: d="<<dkmin<<" max="<<knyqmax<<" n="<<nherr<<endl;
|
---|
432 |
|
---|
433 | double dktmin = fluct3d.GetKTincMin();
|
---|
434 | double ktnyqmax = fluct3d.GetKTmax();
|
---|
435 | long nherrt = long(ktnyqmax/dktmin+0.5);
|
---|
436 | double dkzmin = fluct3d.GetKinc()[2];
|
---|
437 | double kznyqmax = fluct3d.GetKnyq()[2];
|
---|
438 | long nherrz = long(kznyqmax/dkzmin+0.5);
|
---|
439 | cout<<"For Histo2DErr: d="<<dktmin<<","<<dkzmin
|
---|
440 | <<" max="<<ktnyqmax<<","<<kznyqmax<<" n="<<nherrt<<","<<nherrz<<endl;
|
---|
441 |
|
---|
442 | //-----------------------------------------------------------------
|
---|
443 | cout<<"\n--- Computing spectra variance up to Kmax at z="<<pkz.GetZ()<<endl;
|
---|
444 | // En fait on travaille sur un cube inscrit dans la sphere de rayon kmax:
|
---|
445 | // sphere: Vs = 4Pi/3 k^3 , cube inscrit (cote k*sqrt(2)): Vc = (k*sqrt(2))^3
|
---|
446 | // Vc/Vs = 0.675 -> keff = kmax * (0.675)^(1/3) = kmax * 0.877
|
---|
447 | double knyqmax_mod = 0.877*knyqmax;
|
---|
448 | ldlkint = (log10(knyqmax_mod)-log10(k1int))/npt;
|
---|
449 | varpk_int.SetInteg(0.01,ldlkint,-1.,4);
|
---|
450 | double sr2int_kmax = varpk_int.Variance(k1int,knyqmax_mod);
|
---|
451 | cout<<"varpk_int(<"<<knyqmax_mod<<")="<<sr2int_kmax<<" -> sigma="<<sqrt(sr2int_kmax)<<endl;
|
---|
452 |
|
---|
453 | PrtTim(">>>> End Initialisation de GeneFluct3D");
|
---|
454 |
|
---|
455 | //-----------------------------------------------------------------
|
---|
456 | cout<<"\n--- Computing a realization in Fourier space"<<endl;
|
---|
457 | if(use_growth_factor>0) pkz.SetZ(0.); else pkz.SetZ(zref);
|
---|
458 | cout<<"Power spectrum set at redshift: "<<pkz.GetZ()<<endl;
|
---|
459 | if(computefourier0) fluct3d.ComputeFourier0(pkz);
|
---|
460 | else fluct3d.ComputeFourier(pkz);
|
---|
461 | fluct3d.NTupleCheck(posobs,string("ntpkgen"),ntnent);
|
---|
462 | PrtTim(">>>> End Computing a realization in Fourier space");
|
---|
463 |
|
---|
464 | cout<<"\n--- Checking realization spectra"<<endl;
|
---|
465 | HistoErr hpkgen(0.,knyqmax,nherr);
|
---|
466 | hpkgen.ReCenterBin(); hpkgen.Zero();
|
---|
467 | hpkgen.Show();
|
---|
468 | fluct3d.ComputeSpectrum(hpkgen);
|
---|
469 | {
|
---|
470 | tagobs = "hpkgen"; posobs.PutObject(hpkgen,tagobs);
|
---|
471 | }
|
---|
472 | PrtTim(">>>> End Checking realization spectra");
|
---|
473 |
|
---|
474 | if(comp2dspec) {
|
---|
475 | cout<<"\n--- Checking realization 2D spectra"<<endl;
|
---|
476 | Histo2DErr hpkgen2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
477 | hpkgen2.ReCenterBin(); hpkgen2.Zero();
|
---|
478 | hpkgen2.Show();
|
---|
479 | fluct3d.ComputeSpectrum2D(hpkgen2);
|
---|
480 | {
|
---|
481 | tagobs = "hpkgen2"; posobs.PutObject(hpkgen2,tagobs);
|
---|
482 | }
|
---|
483 | PrtTim(">>>> End Checking realization 2D spectra");
|
---|
484 | }
|
---|
485 |
|
---|
486 | if(filter_by_pixel!=0) {
|
---|
487 | cout<<"\n--- Computing convolution by pixel shape"<<endl;
|
---|
488 | fluct3d.FilterByPixel();
|
---|
489 | fluct3d.NTupleCheck(posobs,string("ntpkgenf"),ntnent);
|
---|
490 | PrtTim(">>>> End Computing convolution by pixel shape");
|
---|
491 |
|
---|
492 | cout<<"\n--- Checking realization spectra after pixel shape convol."<<endl;
|
---|
493 | HistoErr hpkgenfb(0.,knyqmax,nherr);
|
---|
494 | hpkgenfb.ReCenterBin(); hpkgenfb.Zero();
|
---|
495 | hpkgenfb.Show();
|
---|
496 | fluct3d.ComputeSpectrum(hpkgenfb);
|
---|
497 | {
|
---|
498 | tagobs = "hpkgenfb"; posobs.PutObject(hpkgenfb,tagobs);
|
---|
499 | }
|
---|
500 | PrtTim(">>>> End Checking realization spectra");
|
---|
501 |
|
---|
502 | cout<<"\n--- Checking realization spectra after pixel shape convol. with pixel correc."<<endl;
|
---|
503 | HistoErr hpkgenf(hpkgenfb); hpkgenf.Zero();
|
---|
504 | fluct3d.ComputeSpectrum(hpkgenf,0.,filter_by_pixel);
|
---|
505 | {
|
---|
506 | tagobs = "hpkgenf"; posobs.PutObject(hpkgenf,tagobs);
|
---|
507 | }
|
---|
508 | PrtTim(">>>> End Checking realization spectra with pixel correc.");
|
---|
509 |
|
---|
510 | if(comp2dspec) {
|
---|
511 | cout<<"\n--- Checking realization 2D spectra after pixel shape convol."<<endl;
|
---|
512 | Histo2DErr hpkgenfb2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
513 | hpkgenfb2.ReCenterBin(); hpkgenfb2.Zero();
|
---|
514 | hpkgenfb2.Show();
|
---|
515 | fluct3d.ComputeSpectrum2D(hpkgenfb2);
|
---|
516 | {
|
---|
517 | tagobs = "hpkgenfb2"; posobs.PutObject(hpkgenfb2,tagobs);
|
---|
518 | }
|
---|
519 | PrtTim(">>>> End Checking realization 2D spectra");
|
---|
520 |
|
---|
521 | cout<<"\n--- Checking realization 2D spectra after pixel shape convol. with pixel correc."<<endl;
|
---|
522 | Histo2DErr hpkgenf2(hpkgenfb2); hpkgenf2.Zero();
|
---|
523 | fluct3d.ComputeSpectrum2D(hpkgenf2,0.,filter_by_pixel);
|
---|
524 | {
|
---|
525 | tagobs = "hpkgenf2"; posobs.PutObject(hpkgenf2,tagobs);
|
---|
526 | }
|
---|
527 | PrtTim(">>>> End Checking realization 2D spectra with pixel correc.");
|
---|
528 | }
|
---|
529 | }
|
---|
530 |
|
---|
531 | if(whattowrt[0]==1) {
|
---|
532 | if(wfits) {
|
---|
533 | tagobs = "!" + rootnameout + "_k0.fits";
|
---|
534 | fluct3d.WriteFits(tagobs);
|
---|
535 | PrtTim(">>>> End WriteFits");
|
---|
536 | }
|
---|
537 | if(wppf) {
|
---|
538 | tagobs = rootnameout + "_k0.ppf";
|
---|
539 | fluct3d.WritePPF(tagobs,false);
|
---|
540 | PrtTim(">>>> End WritePPF");
|
---|
541 | }
|
---|
542 | }
|
---|
543 |
|
---|
544 | //-----------------------------------------------------------------
|
---|
545 | cout<<"\n--- Computing a realization in real space"<<endl;
|
---|
546 | fluct3d.ComputeReal();
|
---|
547 | double rmin,rmax; fluct3d.MinMax(rmin,rmax);
|
---|
548 | cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
|
---|
549 | fluct3d.NTupleCheck(posobs,string("ntreal"),ntnent);
|
---|
550 | PrtTim(">>>> End Computing a realization in real space");
|
---|
551 |
|
---|
552 | if(use_growth_factor>0) {
|
---|
553 | cout<<"\n--- Apply Growth factor"<<endl;
|
---|
554 | cout<<"...D(z=0)="<<growth(0.)<<" D(z="<<zref<<")="<<growth(zref)<<endl;
|
---|
555 | fluct3d.ApplyGrowthFactor(use_growth_factor);
|
---|
556 | fluct3d.MinMax(rmin,rmax);
|
---|
557 | cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
|
---|
558 | fluct3d.NTupleCheck(posobs,string("ntgrow"),ntnent);
|
---|
559 | PrtTim(">>>> End Applying growth factor");
|
---|
560 | }
|
---|
561 |
|
---|
562 | int_8 nm;
|
---|
563 | double rmref,rs2ref;
|
---|
564 | cout<<"\n--- Computing reference variance in real space"<<endl;
|
---|
565 | nm = fluct3d.MeanSigma2(rmref,rs2ref);
|
---|
566 | cout<<" rs2ref= "<<rs2ref<<" , rmref="<<rmref<<" ("<<nm<<")"<<endl;
|
---|
567 | PrtTim(">>>> End Computing reference variance in real space");
|
---|
568 |
|
---|
569 | if(whattowrt[1]==1) {
|
---|
570 | if(wfits) {
|
---|
571 | tagobs = "!" + rootnameout + "_r0.fits";
|
---|
572 | fluct3d.WriteFits(tagobs);
|
---|
573 | PrtTim(">>>> End WriteFits");
|
---|
574 | }
|
---|
575 | if(wppf) {
|
---|
576 | tagobs = rootnameout + "_r0.ppf";
|
---|
577 | fluct3d.WritePPF(tagobs,true);
|
---|
578 | PrtTim(">>>> End WritePPF");
|
---|
579 | }
|
---|
580 | if(wslice) {
|
---|
581 | tagobs = rootnameout + "_s_r0.ppf";
|
---|
582 | fluct3d.WriteSlicePPF(tagobs);
|
---|
583 | PrtTim(">>>> End WriteSlicePPF");
|
---|
584 | }
|
---|
585 | }
|
---|
586 |
|
---|
587 | cout<<"\n--- Check mean and variance in real space"<<endl;
|
---|
588 | fluct3d.NumberOfBad(-1.,1e+200);
|
---|
589 | double rm,rs2;
|
---|
590 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
591 | PrtTim(">>>> End Check mean and variance in real space");
|
---|
592 |
|
---|
593 | if(compvarreal) {
|
---|
594 | cout<<"\n--- Check variance sigmaR in real space"<<endl;
|
---|
595 | double varr;
|
---|
596 | fluct3d.VarianceFrReal(R,varr);
|
---|
597 | cout<<"...Computed variance = "<<varr
|
---|
598 | <<" , Theorical variance at (z=0) = "<<pow(sigmaR,2.)
|
---|
599 | <<" , at (z="<<zref<<") = "<<pow(sigmaR*growth_at_z,2.)<<endl;
|
---|
600 | PrtTim(">>>> End Check variance sigmaR in real space");
|
---|
601 | }
|
---|
602 |
|
---|
603 | //-----------------------------------------------------------------
|
---|
604 | if(no_poisson_type!=0) {
|
---|
605 | cout<<"\n--- Converting !!!DIRECTLY!!! mass into HI mass: mass per pixel ="
|
---|
606 | <<mass_by_pixel<<endl;
|
---|
607 | if(no_poisson_type<0) {
|
---|
608 | cout<<"!!!WARNING!!! dRho/Rho is just multiplied by "<<mass_by_pixel<<endl;
|
---|
609 | fluct3d.ScaleOffset(mass_by_pixel);
|
---|
610 | } else {
|
---|
611 | rm = fluct3d.TurnFluct2MeanNumber(mass_by_mpc3); // ici on doit donner Msol/Mpc^3
|
---|
612 | }
|
---|
613 | fluct3d.NTupleCheck(posobs,string("ntmhi"),ntnent);
|
---|
614 | } else {
|
---|
615 | cout<<"\n--- Converting mass into galaxy number: gal per pixel ="
|
---|
616 | <<ngal_by_mpc3*fluct3d.GetDVol()<<endl;
|
---|
617 | rm = fluct3d.TurnFluct2MeanNumber(ngal_by_mpc3); // ici on doit donner Ngal/Mpc^3
|
---|
618 | fluct3d.NTupleCheck(posobs,string("ntmeang"),ntnent);
|
---|
619 | }
|
---|
620 | nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200);
|
---|
621 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
622 | if(rm>0.) cout<<"normalised sigma(dM/M) is "<<sqrt(rs2)/rm<<endl;
|
---|
623 | PrtTim(">>>> End Converting mass into galaxy number or mass");
|
---|
624 |
|
---|
625 | if( no_poisson_type==0 ) {
|
---|
626 |
|
---|
627 | cout<<"\n--- Apply poisson on galaxy number"<<endl;
|
---|
628 | fluct3d.ApplyPoisson();
|
---|
629 | nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200);
|
---|
630 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
631 | double xgalmin,xgalmax; fluct3d.MinMax(xgalmin,xgalmax,0.1,1.e50);
|
---|
632 | fluct3d.NTupleCheck(posobs,string("ntpois"),ntnent);
|
---|
633 | PrtTim(">>>> End Apply poisson on galaxy number");
|
---|
634 | if(wslice) {
|
---|
635 | tagobs = rootnameout + "_s_rn.ppf";
|
---|
636 | fluct3d.WriteSlicePPF(tagobs);
|
---|
637 | PrtTim(">>>> End WriteSlicePPF");
|
---|
638 | }
|
---|
639 |
|
---|
640 | cout<<"\n--- Convert Galaxy number to HI mass"<<endl;
|
---|
641 | double mhi = 0.;
|
---|
642 | if(use_schmassdist) {
|
---|
643 | if(recompute_schmassdist) {
|
---|
644 | int ngalmax = int(xgalmax+0.5);
|
---|
645 | schmdist.SetNgalLim(ngalmax,1,naleagal);
|
---|
646 | PrtTim(">>>> End creating tabulated histograms for trials");
|
---|
647 | }
|
---|
648 | mhi = fluct3d.TurnNGal2MassQuick(schmdist);
|
---|
649 | schmdist.PrintStatus();
|
---|
650 | } else {
|
---|
651 | mhi = fluct3d.TurnNGal2Mass(tirhmdndm,true);
|
---|
652 | }
|
---|
653 | cout<<mhi<<" MSol in survey / "<<mass_by_mpc3*fluct3d.GetVol()<<endl;
|
---|
654 | nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200);
|
---|
655 | cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl;
|
---|
656 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
657 | fluct3d.NTupleCheck(posobs,string("ntmhi"),ntnent);
|
---|
658 | PrtTim(">>>> End Convert Galaxy number to HI mass");
|
---|
659 |
|
---|
660 | }
|
---|
661 |
|
---|
662 | //-----------------------------------------------------------------
|
---|
663 | if(whattowrt[2]==1) {
|
---|
664 | if(wfits) {
|
---|
665 | tagobs = "!" + rootnameout + "_r.fits";
|
---|
666 | fluct3d.WriteFits(tagobs);
|
---|
667 | PrtTim(">>>> End WriteFits");
|
---|
668 | }
|
---|
669 | if(wppf) {
|
---|
670 | tagobs = rootnameout + "_r.ppf";
|
---|
671 | fluct3d.WritePPF(tagobs,true);
|
---|
672 | PrtTim(">>>> End WritePPF");
|
---|
673 | }
|
---|
674 | if(wslice) {
|
---|
675 | tagobs = rootnameout + "_s_r.ppf";
|
---|
676 | fluct3d.WriteSlicePPF(tagobs);
|
---|
677 | PrtTim(">>>> End WriteSlicePPF");
|
---|
678 | }
|
---|
679 | }
|
---|
680 |
|
---|
681 | //-----------------------------------------------------------------
|
---|
682 | ////if(do_agn) {
|
---|
683 | //// cout<<"\n--- Add AGN: <log10(S Jy)>="<<lfjy_agn<<" , sigma="<<lsigma_agn
|
---|
684 | //// <<" , powlaw="<<powlaw_agn<<endl;
|
---|
685 | //// fluct3d.AddAGN(lfjy_agn,lsigma_agn,powlaw_agn);
|
---|
686 | //// nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
687 | //// fluct3d.NTupleCheck(posobs,string("ntagn"),ntnent);
|
---|
688 | //// PrtTim(">>>> End Add AGN");
|
---|
689 | ////}
|
---|
690 |
|
---|
691 | //-----------------------------------------------------------------
|
---|
692 | double snoisesave = 0.;
|
---|
693 | if(snoise>0.) {
|
---|
694 | cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<", evolution="<<noise_evol<<endl;
|
---|
695 | fluct3d.AddNoise2Real(snoise,noise_evol);
|
---|
696 | snoisesave = snoise;
|
---|
697 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
698 | fluct3d.NTupleCheck(posobs,string("ntnois"),ntnent);
|
---|
699 | PrtTim(">>>> End Add noise");
|
---|
700 | }
|
---|
701 |
|
---|
702 | //-----------------------------------------------------------------
|
---|
703 | if(scalemass!=0. && scalemass!=1.) { // Si scalemass==0 pas de normalisation
|
---|
704 | if(scalemass<0.) scalemass = 1. / (-scalemass * mass_by_pixel);
|
---|
705 | cout<<"\n--- Scale cube scale="<<scalemass<<endl;
|
---|
706 | fluct3d.ScaleOffset(scalemass);
|
---|
707 | snoisesave *= scalemass;
|
---|
708 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
709 | PrtTim(">>>> End Scale cube");
|
---|
710 | }
|
---|
711 | fluct3d.NTupleCheck(posobs,string("ntfin"),ntnent);
|
---|
712 |
|
---|
713 | //-----------------------------------------------------------------
|
---|
714 | if(whattowrt[3]==1) {
|
---|
715 | if(wfits) {
|
---|
716 | tagobs = "!" + rootnameout + "_rf.fits";
|
---|
717 | fluct3d.WriteFits(tagobs);
|
---|
718 | PrtTim(">>>> End WriteFits");
|
---|
719 | }
|
---|
720 | if(wppf) {
|
---|
721 | tagobs = rootnameout + "_rf.ppf";
|
---|
722 | fluct3d.WritePPF(tagobs,true);
|
---|
723 | PrtTim(">>>> End WritePPF");
|
---|
724 | }
|
---|
725 | if(wslice) {
|
---|
726 | tagobs = rootnameout + "_s_rf.ppf";
|
---|
727 | fluct3d.WriteSlicePPF(tagobs);
|
---|
728 | PrtTim(">>>> End WriteSlicePPF");
|
---|
729 | }
|
---|
730 | }
|
---|
731 |
|
---|
732 | //-----------------------------------------------------------------
|
---|
733 | // -- NE PAS FAIRE CA SI ON VEUT CONTINUER LA SIMULATION -> d_rho/rho ecrase
|
---|
734 |
|
---|
735 | cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
|
---|
736 | fluct3d.ReComputeFourier();
|
---|
737 | fluct3d.NTupleCheck(posobs,string("ntpkrec"),ntnent);
|
---|
738 | PrtTim(">>>> End ReComputing spectrum");
|
---|
739 |
|
---|
740 | if(whattowrt[4]==1) {
|
---|
741 | if(wfits) {
|
---|
742 | tagobs = "!" + rootnameout + "_k.fits";
|
---|
743 | fluct3d.WriteFits(tagobs);
|
---|
744 | PrtTim(">>>> End WriteFits");
|
---|
745 | }
|
---|
746 | if(wppf) {
|
---|
747 | tagobs = rootnameout + "_k.ppf";
|
---|
748 | fluct3d.WritePPF(tagobs,false);
|
---|
749 | PrtTim(">>>> End WritePPF");
|
---|
750 | }
|
---|
751 | }
|
---|
752 |
|
---|
753 | cout<<endl<<"\n--- Computing final spectrum"<<endl;
|
---|
754 | HistoErr hpkrecb(0.,knyqmax,nherr); hpkrecb.Zero();
|
---|
755 | hpkrecb.ReCenterBin();
|
---|
756 | hpkrecb.Show();
|
---|
757 | fluct3d.ComputeSpectrum(hpkrecb);
|
---|
758 | {
|
---|
759 | tagobs = "hpkrecb"; posobs.PutObject(hpkrecb,tagobs);
|
---|
760 | }
|
---|
761 | PrtTim(">>>> End Computing final spectrum");
|
---|
762 |
|
---|
763 | cout<<endl<<"\n--- Computing final spectrum with pixel deconv."<<endl;
|
---|
764 | HistoErr hpkrec(hpkrecb); hpkrec.Zero();
|
---|
765 | fluct3d.ComputeSpectrum(hpkrec,snoisesave,filter_by_pixel);
|
---|
766 | {
|
---|
767 | tagobs = "hpkrec"; posobs.PutObject(hpkrec,tagobs);
|
---|
768 | }
|
---|
769 | PrtTim(">>>> End Computing final spectrum with pixel deconv.");
|
---|
770 |
|
---|
771 | if(comp2dspec) {
|
---|
772 | cout<<"\n--- Computing final 2D spectrum"<<endl;
|
---|
773 | Histo2DErr hpkrecb2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
774 | hpkrecb2.ReCenterBin(); hpkrecb2.Zero();
|
---|
775 | hpkrecb2.Show();
|
---|
776 | fluct3d.ComputeSpectrum2D(hpkrecb2);
|
---|
777 | {
|
---|
778 | tagobs = "hpkrecb2"; posobs.PutObject(hpkrecb2,tagobs);
|
---|
779 | }
|
---|
780 | PrtTim(">>>> End Computing final 2D spectrum");
|
---|
781 |
|
---|
782 | cout<<"\n--- Computing final 2D spectrum with pixel deconv."<<endl;
|
---|
783 | Histo2DErr hpkrec2(hpkrecb2); hpkrec2.Zero();
|
---|
784 | fluct3d.ComputeSpectrum2D(hpkrec2,snoisesave,filter_by_pixel);
|
---|
785 | {
|
---|
786 | tagobs = "hpkrec2"; posobs.PutObject(hpkrec2,tagobs);
|
---|
787 | }
|
---|
788 | PrtTim(">>>> End Computing final 2D spectrum with pixel deconv.");
|
---|
789 |
|
---|
790 | }
|
---|
791 |
|
---|
792 | //-----------------------------------------------------------------
|
---|
793 | delete RandGen;
|
---|
794 | PrtTim(">>>> End Of Job");
|
---|
795 |
|
---|
796 | //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH
|
---|
797 | } catch (PException& exc) {
|
---|
798 | cerr<<"cmvobserv3d.cc catched PException"<<exc.Msg()<<endl;
|
---|
799 | return 77;
|
---|
800 | } catch (std::exception& sex) {
|
---|
801 | cerr << "cmvobserv3d.cc std::exception :"
|
---|
802 | << (string)typeid(sex).name() << "\n msg= "
|
---|
803 | << sex.what() << endl;
|
---|
804 | return 78;
|
---|
805 | } catch (...) {
|
---|
806 | cerr << "cmvobserv3d.cc catched unknown (...) exception " << endl;
|
---|
807 | return 79;
|
---|
808 | }
|
---|
809 | //----TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH-TRY-CATCH
|
---|
810 |
|
---|
811 | return 0;
|
---|
812 | }
|
---|
813 |
|
---|