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 "timing.h"
|
---|
10 | #include "ntuple.h"
|
---|
11 | #include "matharr.h"
|
---|
12 |
|
---|
13 | #include "constcosmo.h"
|
---|
14 | #include "schechter.h"
|
---|
15 | #include "geneutils.h"
|
---|
16 | #include "integfunc.h"
|
---|
17 | #include "genefluct3d.h"
|
---|
18 |
|
---|
19 | void usage(void);
|
---|
20 | void usage(void)
|
---|
21 | {
|
---|
22 | cout<<"cmvobserv3d [-a] [-0]"<<endl
|
---|
23 | <<" -a : init auto de l aleatoire"<<endl
|
---|
24 | <<" -0 : use methode ComputeFourier0"<<endl
|
---|
25 | <<" -x nx,dx : taille en x (npix,Mpc)"<<endl
|
---|
26 | <<" -y ny,dy : taille en y (npix,Mpc)"<<endl
|
---|
27 | <<" -z nz,dz : taille en z (npix,Mpc)"<<endl
|
---|
28 | <<" -Z zref : redshift median"<<endl
|
---|
29 | <<" -s snoise : sigma du bruit en Msol"<<endl
|
---|
30 | <<endl;
|
---|
31 | }
|
---|
32 |
|
---|
33 | int main(int narg,char *arg[])
|
---|
34 | {
|
---|
35 | InitTim();
|
---|
36 |
|
---|
37 | //-----------------------------------------------------------------
|
---|
38 | // *** Survey definition
|
---|
39 | long nx=360, ny=-1, nz=64; double dx=1., dy=-1., dz=-1.;
|
---|
40 | //long nx=1000, ny=-1, nz=128; double dx=3., dy=-1., dz=6.;
|
---|
41 | //long nx=1200, ny=-1, nz=128; double dx=1., dy=-1., dz=3;
|
---|
42 |
|
---|
43 | // *** Cosmography definition (WMAP)
|
---|
44 | double ob0 = 0.0444356;
|
---|
45 | double h100=0.71, om0=0.267804, or0=7.9e-05, ol0=0.73,w0=-1.;
|
---|
46 | double zref = 0.5;
|
---|
47 |
|
---|
48 | // *** Spectrum and variance definition
|
---|
49 | double ns = 1., as = 1.;
|
---|
50 | double R=8./h100, Rg=R/sqrt(5.);
|
---|
51 | double sigmaR = 1.;
|
---|
52 |
|
---|
53 | double kmin=1e-5,kmax=1000.;
|
---|
54 | int npt = 10000;
|
---|
55 | double lkmin=log10(kmin), lkmax=log10(kmax);
|
---|
56 | double eps=1.e-3;
|
---|
57 |
|
---|
58 | // *** Schechter mass function definition
|
---|
59 | double h75 = 0.71 / 0.75;
|
---|
60 | double nstar = 0.006*pow(h75,3.);
|
---|
61 | double mstar = pow(10.,9.8/(h75*h75)); // MSol
|
---|
62 | double alpha = -1.37;
|
---|
63 |
|
---|
64 | double schmin=1e8, schmax=1e12;
|
---|
65 | int schnpt = 1000;
|
---|
66 | double lschmin=log10(schmin), lschmax=log10(schmax), dlsch=(lschmax-lschmin)/schnpt;
|
---|
67 |
|
---|
68 | // *** Niveau de bruit
|
---|
69 | double snoise= 0.; // en equivalent MSol
|
---|
70 |
|
---|
71 | // *** type de generation
|
---|
72 | bool computefourier0=false;
|
---|
73 | unsigned short nthread=4;
|
---|
74 |
|
---|
75 | // --- Decodage arguments
|
---|
76 |
|
---|
77 | char c;
|
---|
78 | while((c = getopt(narg,arg,"ha0x:y:z:s:Z:")) != -1) {
|
---|
79 | switch (c) {
|
---|
80 | case 'a' :
|
---|
81 | Auto_Ini_Ranf(5);
|
---|
82 | break;
|
---|
83 | case '0' :
|
---|
84 | computefourier0 = true;
|
---|
85 | break;
|
---|
86 | case 'x' :
|
---|
87 | sscanf(optarg,"%ld,%lf",&nx,&dx);
|
---|
88 | break;
|
---|
89 | case 'y' :
|
---|
90 | sscanf(optarg,"%ld,%lf",&ny,&dy);
|
---|
91 | break;
|
---|
92 | case 'z' :
|
---|
93 | sscanf(optarg,"%ld,%lf",&nz,&dz);
|
---|
94 | break;
|
---|
95 | case 's' :
|
---|
96 | sscanf(optarg,"%lf",&snoise);
|
---|
97 | break;
|
---|
98 | case 'Z' :
|
---|
99 | sscanf(optarg,"%lf",&zref);
|
---|
100 | break;
|
---|
101 | case 'h' :
|
---|
102 | default :
|
---|
103 | usage(); return -1;
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 | string tagobs = "cmvobserv3d.ppf";
|
---|
108 | POutPersist posobs(tagobs);
|
---|
109 |
|
---|
110 | cout<<"zref="<<zref<<endl;
|
---|
111 | cout<<"nx="<<nx<<" dx="<<dx<<" ny="<<ny<<" dy="<<dy<<" nz="<<nz<<" dz="<<dz<<endl;
|
---|
112 | cout<<"kmin="<<kmin<<" ("<<lkmin<<"), kmax="<<kmax<<" ("<<lkmax<<") Mpc^-1"
|
---|
113 | <<", npt="<<npt<<endl;
|
---|
114 | cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl;
|
---|
115 | cout<<"nstar= "<<nstar<<" mstar="<<mstar<<" alpha="<<alpha<<endl;
|
---|
116 | cout<<"schmin="<<schmin<<" ("<<lschmin
|
---|
117 | <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol"
|
---|
118 | <<", schnpt="<<schnpt<<endl;
|
---|
119 | cout<<"snoise="<<snoise<<" equivalent Msol"<<endl;
|
---|
120 |
|
---|
121 | //-----------------------------------------------------------------
|
---|
122 | cout<<endl<<"\n--- Create Spectrum and mass function"<<endl;
|
---|
123 |
|
---|
124 | InitialSpectrum pkini(ns,as);
|
---|
125 |
|
---|
126 | TransfertEisenstein tf(h100,om0-ob0,ob0,T_CMB_Par,false);
|
---|
127 | //tf.SetNoOscEnv(2);
|
---|
128 |
|
---|
129 | GrowthFactor d1(om0,ol0);
|
---|
130 |
|
---|
131 | PkSpectrum0 pk0(pkini,tf);
|
---|
132 |
|
---|
133 | PkSpectrumZ pkz(pk0,d1,zref);
|
---|
134 |
|
---|
135 | Schechter sch(nstar,mstar,alpha);
|
---|
136 |
|
---|
137 | //-----------------------------------------------------------------
|
---|
138 | pkz.SetZ(0.);
|
---|
139 | cout<<endl<<"\n--- Compute variance for top-hat R="<<R
|
---|
140 | <<" at z="<<pkz.GetZ()<<endl;
|
---|
141 | VarianceSpectrum varpk_th(pkz,0);
|
---|
142 | double kfind_th = varpk_th.FindMaximum(R,kmin,kmax,eps);
|
---|
143 | double pkmax_th = varpk_th(kfind_th);
|
---|
144 | cout<<"kfind_th = "<<kfind_th<<" ("<<log10(kfind_th)<<"), integrand="<<pkmax_th<<endl;
|
---|
145 | double k1=kmin, k2=kmax;
|
---|
146 | int rc = varpk_th.FindLimits(R,pkmax_th/1.e4,k1,k2,eps);
|
---|
147 | cout<<"limit_th: rc="<<rc<<" : "<<k1<<" ("<<log10(k1)<<") , "
|
---|
148 | <<k2<<" ("<<log10(k2)<<")"<<endl;
|
---|
149 |
|
---|
150 | double ldlk = (log10(k2)-log10(k1))/npt;
|
---|
151 | varpk_th.SetInteg(0.01,ldlk,-1.,4);
|
---|
152 | double sr2 = varpk_th.Variance(R,k1,k2);
|
---|
153 | cout<<"varpk_th="<<sr2<<" -> sigma="<<sqrt(sr2)<<endl;
|
---|
154 |
|
---|
155 | double normpkz = sigmaR*sigmaR/sr2;
|
---|
156 | pkz.SetScale(normpkz);
|
---|
157 | cout<<"Spectrum normalisation = "<<pkz.GetScale()<<endl;
|
---|
158 |
|
---|
159 | pkz.SetZ(zref);
|
---|
160 |
|
---|
161 | Histo hpkz(lkmin,lkmax,npt); hpkz.ReCenterBin();
|
---|
162 | FuncToHisto(pkz,hpkz,true);
|
---|
163 | {
|
---|
164 | tagobs = "hpkz"; posobs.PutObject(hpkz,tagobs);
|
---|
165 | }
|
---|
166 |
|
---|
167 | //-----------------------------------------------------------------
|
---|
168 | cout<<endl<<"\n--- Compute variance for Pk at z="<<pkz.GetZ()<<endl;
|
---|
169 | VarianceSpectrum varpk_int(pkz,2);
|
---|
170 |
|
---|
171 | double kfind_int = varpk_int.FindMaximum(R,kmin,kmax,eps);
|
---|
172 | double pkmax_int = varpk_int(kfind_int);
|
---|
173 | cout<<"kfind_int = "<<kfind_int<<" ("<<log10(kfind_int)<<"), integrand="<<pkmax_int<<endl;
|
---|
174 | double k1int=kmin, k2int=kmax;
|
---|
175 | int rcint = varpk_int.FindLimits(R,pkmax_int/1.e4,k1int,k2int,eps);
|
---|
176 | cout<<"limit_int: rc="<<rcint<<" : "<<k1int<<" ("<<log10(k1int)<<") , "
|
---|
177 | <<k2int<<" ("<<log10(k2int)<<")"<<endl;
|
---|
178 |
|
---|
179 | double ldlkint = (log10(k2int)-log10(k1int))/npt;
|
---|
180 | varpk_int.SetInteg(0.01,ldlkint,-1.,4);
|
---|
181 | double sr2int = varpk_int.Variance(R,k1int,k2int);
|
---|
182 | cout<<"varpk_int="<<sr2int<<" -> sigma="<<sqrt(sr2int)<<endl;
|
---|
183 |
|
---|
184 | PrtTim("End of definition");
|
---|
185 |
|
---|
186 | //-----------------------------------------------------------------
|
---|
187 | cout<<endl<<"\n--- Compute galaxies density number"<<endl;
|
---|
188 |
|
---|
189 | sch.SetOutValue(0);
|
---|
190 | cout<<"sch(mstar) = "<<sch(mstar)<<" /Mpc^3/Msol"<<endl;
|
---|
191 | double ngal_by_mpc3 = IntegrateFuncLog(sch,lschmin,lschmax,0.01,dlsch,10.*dlsch,4);
|
---|
192 | cout<<"Galaxy density number = "<<ngal_by_mpc3<<" /Mpc^3 between limits"<<endl;
|
---|
193 |
|
---|
194 | sch.SetOutValue(1);
|
---|
195 | cout<<"mstar*sch(mstar) = "<<sch(mstar)<<" Msol/Mpc^3/Msol"<<endl;
|
---|
196 | double mass_by_mpc3 = IntegrateFuncLog(sch,lschmin,lschmax,0.01,dlsch,10.*dlsch,4);
|
---|
197 | cout<<"Galaxy mass density= "<<mass_by_mpc3<<" Msol/Mpc^3 between limits"<<endl;
|
---|
198 |
|
---|
199 | //-----------------------------------------------------------------
|
---|
200 | // FFTW3 (p26): faster if sizes 2^a 3^b 5^c 7^d 11^e 13^f with e+f=0 ou 1
|
---|
201 | cout<<endl<<"\n--- Compute Spectrum Realization"<<endl;
|
---|
202 |
|
---|
203 | pkz.SetZ(zref);
|
---|
204 | TArray< complex<r_8> > pkgen;
|
---|
205 | GeneFluct3D fluct3d(pkgen);
|
---|
206 | fluct3d.SetPrtLevel(3);
|
---|
207 | fluct3d.SetNThread(nthread);
|
---|
208 | fluct3d.SetSize(nx,ny,nz,dx,dy,dz);
|
---|
209 | TArray<r_8>& rgen = fluct3d.GetRealArray();
|
---|
210 | fluct3d.Print();
|
---|
211 |
|
---|
212 | double dkmin = fluct3d.GetKincMin();
|
---|
213 | double knyqmax = fluct3d.GetKmax();
|
---|
214 | long nherr = long(knyqmax/dkmin+0.5);
|
---|
215 | cout<<"For HistoErr: d="<<dkmin<<" max="<<knyqmax<<" n="<<nherr<<endl;
|
---|
216 |
|
---|
217 | double dktmin = fluct3d.GetKTincMin();
|
---|
218 | double ktnyqmax = fluct3d.GetKTmax();
|
---|
219 | long nherrt = long(ktnyqmax/dktmin+0.5);
|
---|
220 | double dkzmin = fluct3d.GetKinc()[2];
|
---|
221 | double kznyqmax = fluct3d.GetKnyq()[2];
|
---|
222 | long nherrz = long(kznyqmax/dkzmin+0.5);
|
---|
223 | cout<<"For Histo2DErr: d="<<dktmin<<","<<dkzmin
|
---|
224 | <<" max="<<ktnyqmax<<","<<kznyqmax<<" n="<<nherrt<<","<<nherrz<<endl;
|
---|
225 |
|
---|
226 | cout<<"\n--- Computing spectra variance up to Kmax at z="<<pkz.GetZ()<<endl;
|
---|
227 | // En fait on travaille sur un cube inscrit dans la sphere de rayon kmax:
|
---|
228 | // sphere: Vs = 4Pi/3 k^3 , cube inscrit (cote k*sqrt(2)): Vc = (k*sqrt(2))^3
|
---|
229 | // Vc/Vs = 0.675 -> keff = kmax * (0.675)^(1/3) = kmax * 0.877
|
---|
230 | double knyqmax_mod = 0.877*knyqmax;
|
---|
231 | ldlkint = (log10(knyqmax_mod)-log10(k1int))/npt;
|
---|
232 | varpk_int.SetInteg(0.01,ldlkint,-1.,4);
|
---|
233 | double sr2int_kmax = varpk_int.Variance(R,k1int,knyqmax_mod);
|
---|
234 | cout<<"varpk_int(<"<<knyqmax_mod<<")="<<sr2int_kmax<<" -> sigma="<<sqrt(sr2int_kmax)<<endl;
|
---|
235 |
|
---|
236 | cout<<"\n--- Computing a realization in Fourier space"<<endl;
|
---|
237 | if(computefourier0) fluct3d.ComputeFourier0(pkz);
|
---|
238 | else fluct3d.ComputeFourier(pkz);
|
---|
239 |
|
---|
240 | if(1) {
|
---|
241 | cout<<"\n--- Checking realization spectra"<<endl;
|
---|
242 | HistoErr hpkgen(0.,knyqmax,nherr);
|
---|
243 | hpkgen.ReCenterBin(); hpkgen.Zero();
|
---|
244 | hpkgen.Show();
|
---|
245 | fluct3d.ComputeSpectrum(hpkgen);
|
---|
246 | {
|
---|
247 | tagobs = "hpkgen"; posobs.PutObject(hpkgen,tagobs);
|
---|
248 | }
|
---|
249 | }
|
---|
250 |
|
---|
251 | if(1) {
|
---|
252 | cout<<"\n--- Checking realization 2D spectra"<<endl;
|
---|
253 | Histo2DErr hpkgen2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
254 | hpkgen2.ReCenterBin(); hpkgen2.Zero();
|
---|
255 | hpkgen2.Show();
|
---|
256 | fluct3d.ComputeSpectrum2D(hpkgen2);
|
---|
257 | {
|
---|
258 | tagobs = "hpkgen2"; posobs.PutObject(hpkgen2,tagobs);
|
---|
259 | }
|
---|
260 | }
|
---|
261 |
|
---|
262 | if(1) {
|
---|
263 | cout<<"\n--- Computing convolution by pixel shape"<<endl;
|
---|
264 | fluct3d.FilterByPixel();
|
---|
265 | }
|
---|
266 |
|
---|
267 | if(1) fluct3d.WriteFits("!cmvobserv3d_k.fits");
|
---|
268 | if(1) fluct3d.WritePPF("cmvobserv3d_k.ppf",false);
|
---|
269 |
|
---|
270 | if(1) {
|
---|
271 | cout<<"\n--- Checking realization spectra after pixel shape convol."<<endl;
|
---|
272 | HistoErr hpkgenf(0.,knyqmax,nherr);
|
---|
273 | hpkgenf.ReCenterBin(); hpkgenf.Zero();
|
---|
274 | hpkgenf.Show();
|
---|
275 | fluct3d.ComputeSpectrum(hpkgenf);
|
---|
276 | {
|
---|
277 | tagobs = "hpkgenf"; posobs.PutObject(hpkgenf,tagobs);
|
---|
278 | }
|
---|
279 | }
|
---|
280 |
|
---|
281 | if(1) {
|
---|
282 | cout<<"\n--- Checking realization 2D spectra after pixel shape convol."<<endl;
|
---|
283 | Histo2DErr hpkgenf2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
284 | hpkgenf2.ReCenterBin(); hpkgenf2.Zero();
|
---|
285 | hpkgenf2.Show();
|
---|
286 | fluct3d.ComputeSpectrum2D(hpkgenf2);
|
---|
287 | {
|
---|
288 | tagobs = "hpkgenf2"; posobs.PutObject(hpkgenf2,tagobs);
|
---|
289 | }
|
---|
290 | }
|
---|
291 |
|
---|
292 | cout<<"\n--- Computing a realization in real space"<<endl;
|
---|
293 | fluct3d.ComputeReal();
|
---|
294 | double rmin,rmax; rgen.MinMax(rmin,rmax);
|
---|
295 | cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
|
---|
296 |
|
---|
297 | if(1) fluct3d.WriteFits("!cmvobserv3d_r0.fits");
|
---|
298 | if(1) fluct3d.WritePPF("cmvobserv3d_r0.ppf",true);
|
---|
299 |
|
---|
300 | int_8 nm;
|
---|
301 | double rm,rs2;
|
---|
302 | if(1) {
|
---|
303 | cout<<"\n--- Check mean and variance in real space"<<endl;
|
---|
304 | int_8 nlowone = fluct3d.NumberOfBad(-1.,1e+200);
|
---|
305 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
306 | cout<<"rgen:("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
307 | <<rs2<<" -> "<<sqrt(rs2)<<", n(<-1)="<<nlowone<<endl;
|
---|
308 | }
|
---|
309 |
|
---|
310 | if(1) {
|
---|
311 | cout<<"\n--- Check variance sigmaR in real space"<<endl;
|
---|
312 | double varr;
|
---|
313 | int_8 nvarr = fluct3d.VarianceFrReal(R,varr);
|
---|
314 | cout<<"R="<<R<<" : sigmaR^2="<<varr<<" -> "<<sqrt(varr)<<", n="<<nvarr<<endl;
|
---|
315 | }
|
---|
316 |
|
---|
317 | //-----------------------------------------------------------------
|
---|
318 | cout<<endl<<"\n--- Converting fluctuations into mass"<<endl;
|
---|
319 | fluct3d.TurnFluct2Mass();
|
---|
320 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
321 | cout<<"1+rgen: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
322 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
323 |
|
---|
324 | cout<<"\n--- Converting mass into galaxy number"<<endl;
|
---|
325 | rm = fluct3d.TurnMass2MeanNumber(ngal_by_mpc3);
|
---|
326 | cout<<rm<<" galaxies put into survey"<<endl;
|
---|
327 | nm = fluct3d.MeanSigma2(rm,rs2,0.);
|
---|
328 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
329 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
330 |
|
---|
331 | cout<<"\n--- Set negative pixels to BAD"<<endl;
|
---|
332 | nm = fluct3d.SetToVal(0.,1e+200,-999.);
|
---|
333 | cout<<nm<<" negative in survey set to BAD"<<endl;
|
---|
334 | nm = fluct3d.MeanSigma2(rm,rs2,-998.);
|
---|
335 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
336 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
337 |
|
---|
338 | cout<<"\n--- Apply poisson on galaxie number"<<endl;
|
---|
339 | nm = fluct3d.ApplyPoisson();
|
---|
340 | cout<<nm<<" galaxies into survey after poisson"<<endl;
|
---|
341 | nm = fluct3d.MeanSigma2(rm,rs2,-998.);
|
---|
342 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
343 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
344 |
|
---|
345 | cout<<"\n--- Convert Galaxies number to HI mass"<<endl;
|
---|
346 | long nhmdndm = long( (lschmax-lschmin+1.)*100. + 0.5);
|
---|
347 | Histo hmdndm(lschmin,lschmax,nhmdndm);
|
---|
348 | sch.SetOutValue(1);
|
---|
349 | FuncToHisto(sch,hmdndm,true);
|
---|
350 | FunRan tirhmdndm(hmdndm,true);
|
---|
351 | {
|
---|
352 | tagobs = "hmdndm"; posobs.PutObject(hmdndm,tagobs);
|
---|
353 | Histo hdum1(tirhmdndm);
|
---|
354 | tagobs = "tirhmdndm"; posobs.PutObject(hdum1,tagobs);
|
---|
355 | }
|
---|
356 | double mhi = fluct3d.TurnNGal2Mass(tirhmdndm,true);
|
---|
357 | cout<<mhi<<" MSol in survey / "<<mass_by_mpc3*fluct3d.GetVol()<<endl;
|
---|
358 | nm = fluct3d.MeanSigma2(rm,rs2,0.);
|
---|
359 | cout<<"HI mass: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
360 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
361 | cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl;
|
---|
362 |
|
---|
363 | cout<<"\n--- Set BAD pixels to Zero"<<endl;
|
---|
364 | nm = fluct3d.SetToVal(-998.,1e+200,0.);
|
---|
365 | cout<<nm<<" BAD in survey set to zero"<<endl;
|
---|
366 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
367 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
368 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
369 |
|
---|
370 | if(1) fluct3d.WriteFits("!cmvobserv3d_r.fits");
|
---|
371 | if(1) fluct3d.WritePPF("cmvobserv3d_r.ppf",true);
|
---|
372 |
|
---|
373 | cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<endl;
|
---|
374 | fluct3d.AddNoise2Real(snoise);
|
---|
375 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
376 | cout<<"HI mass with noise: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
377 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
378 |
|
---|
379 | //-----------------------------------------------------------------
|
---|
380 | // -- NE PAS FAIRE CA SI ON VEUT CONTINUER LA SIMULATION -> d_rho/rho ecrase
|
---|
381 |
|
---|
382 | if(1) {
|
---|
383 | cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
|
---|
384 | fluct3d.ReComputeFourier();
|
---|
385 | }
|
---|
386 |
|
---|
387 | if(1) {
|
---|
388 | cout<<endl<<"\n--- Computing final spectrum"<<endl;
|
---|
389 | HistoErr hpkrec(0.,knyqmax,nherr);
|
---|
390 | hpkrec.ReCenterBin();
|
---|
391 | hpkrec.Show();
|
---|
392 | fluct3d.ComputeSpectrum(hpkrec);
|
---|
393 | tagobs = "hpkrec"; posobs.PutObject(hpkrec,tagobs);
|
---|
394 | }
|
---|
395 |
|
---|
396 | if(1) {
|
---|
397 | cout<<"\n--- Computing final 2D spectrum"<<endl;
|
---|
398 | Histo2DErr hpkrec2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
399 | hpkrec2.ReCenterBin(); hpkrec2.Zero();
|
---|
400 | hpkrec2.Show();
|
---|
401 | fluct3d.ComputeSpectrum2D(hpkrec2);
|
---|
402 | {
|
---|
403 | tagobs = "hpkrec2"; posobs.PutObject(hpkrec2,tagobs);
|
---|
404 | }
|
---|
405 | }
|
---|
406 |
|
---|
407 | return 0;
|
---|
408 | }
|
---|
409 |
|
---|
410 | /*
|
---|
411 | ######################################################
|
---|
412 | readfits cmvobserv3d_k.fits
|
---|
413 | readfits cmvobserv3d_r0.fits
|
---|
414 | readfits cmvobserv3d_r.fits
|
---|
415 |
|
---|
416 | openppf cmvobserv3d_k.ppf
|
---|
417 | openppf cmvobserv3d_r0.ppf
|
---|
418 | openppf cmvobserv3d_r.ppf
|
---|
419 |
|
---|
420 | # pour le plot 2D d'une slice en Z du 3D: to2d nom_obj3D num_slice
|
---|
421 | defscript to2d
|
---|
422 | objaoper $1 sliceyz $2
|
---|
423 | mv sliceyz_${2} ${1}_$2
|
---|
424 | disp ${1}_$2
|
---|
425 | echo display slice $2 of $1
|
---|
426 | endscript
|
---|
427 |
|
---|
428 | to2d $cobj 0
|
---|
429 |
|
---|
430 | ######################################################
|
---|
431 | openppf cmvobserv3d.ppf
|
---|
432 |
|
---|
433 | zone
|
---|
434 | set k pow(10.,x)
|
---|
435 | n/plot hpkz.val*$k*$k/(2*M_PI*M_PI)%x ! "connectpoints"
|
---|
436 |
|
---|
437 | zone
|
---|
438 | n/plot hpkz.val%x ! ! "nsta connectpoints"
|
---|
439 | n/plot hpkgen.val%log10(x) x>0 ! "nsta same red connectpoints"
|
---|
440 | n/plot hpkgenf.val%log10(x) x>0 ! "nsta same orange connectpoints"
|
---|
441 | n/plot hpkrec.val%log10(x) x>0 ! "nsta same blue connectpoints"
|
---|
442 |
|
---|
443 | disp hpkgen "hbincont err"
|
---|
444 | disp hpkgenf "hbincont err"
|
---|
445 | disp hpkrec "hbincont err"
|
---|
446 |
|
---|
447 | zone 2 2
|
---|
448 | imag hpkgen2
|
---|
449 | imag hpkgenf2
|
---|
450 | imag hpkrec2
|
---|
451 |
|
---|
452 | zone 2 1
|
---|
453 | disp hmdndm "nsta"
|
---|
454 | disp tirhmdndm "nsta"
|
---|
455 | addline 0 1 20 1 "red"
|
---|
456 |
|
---|
457 | */
|
---|