source: Sophya/trunk/Cosmo/SimLSS/cmvobserv3d.cc@ 3271

Last change on this file since 3271 was 3271, checked in by cmv, 18 years ago

intro evolution bruit avec redshift cmv 20/06/2007

File size: 19.1 KB
Line 
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 "cosmocalc.h"
15#include "schechter.h"
16#include "geneutils.h"
17#include "genefluct3d.h"
18
19void usage(void);
20void usage(void)
21{
22 cout<<"cmvobserv3d [...options...]"<<endl
23 <<" -a : auto init random seed (needed for multiple simul)"<<endl
24 <<" -0 : use ComputeFourier0 method (defaut: no, use normal way)"<<endl
25 <<" -G : compute Pk(z=0) and apply growth factor in real space"<<endl
26 <<" (default: no, spectrum Pk(z=z_median) for all cube)"<<endl
27 <<" -x nx,dx : size along x axis (npix,Mpc)"<<endl
28 <<" -y ny,dy : size along y axis (npix,Mpc)"<<endl
29 <<" if ny or dy <=0 take same value as for x"<<endl
30 <<" -z nz,dz : size along z axis (redshift axis, npix,Mpc)"<<endl
31 <<" -Z zref : redshift for the center of the simulation cube"<<endl
32 <<" -s snoise,evol : gaussian noise sigma in equivalent Msol"<<endl
33 <<" if evol>0 noise evolved with distance (def no)"<<endl
34 <<" -2 : compute also 2D spectrum (default: no)"<<endl
35 <<" -M schmin,schmax,nsch : min,max mass and nb points for schechter HI"<<endl
36 <<" -A <log10(S_agn in Jy at 1.4 GHz)>,sigma,powlaw :"<<endl
37 <<" AGN mean and sigma gaussian equiv. distrib. for solid angle of centeral pixel"<<endl
38 <<" powlaw: apply S_agn evolution as (Nu/1.4)^powlaw"<<endl
39 <<" -W : write cube in FITS format (complex cube is coded as real cube)"<<endl
40 <<" -P : write cube in PPF format"<<endl
41 <<" -V : compute variance from real space (for check, default: no)"<<endl
42 <<endl;
43}
44
45int main(int narg,char *arg[])
46{
47 InitTim();
48
49 //-----------------------------------------------------------------
50 // *** Survey definition
51 long nx=360, ny=-1, nz=64; double dx=1., dy=-1., dz=-1.;
52 //long nx=1000, ny=-1, nz=128; double dx=3., dy=-1., dz=6.;
53 //long nx=1200, ny=-1, nz=128; double dx=1., dy=-1., dz=3;
54
55 // *** Cosmography definition (WMAP)
56 unsigned short flat = 0;
57 double ob0 = 0.0444356;
58 double h100=0.71, om0=0.267804, or0=7.9e-05, ol0=0.73,w0=-1.;
59 double zref = 0.5;
60 double perc=0.01,dzinc=-1.,dzmax=5.; unsigned short glorder=4;
61
62 // *** Spectrum and variance definition
63 double ns = 1., as = 1.;
64 double R=8./h100, Rg=R/sqrt(5.);
65 double sigmaR = 1.;
66
67 double kmin=1e-5,kmax=1000.;
68 int npt = 10000;
69 double lkmin=log10(kmin), lkmax=log10(kmax);
70 double eps=1.e-3;
71
72 // *** Schechter mass function definition
73 double h75 = h100 / 0.75;
74 double nstar = 0.006*pow(h75,3.);
75 double mstar = pow(10.,9.8/(h75*h75)); // MSol
76 double alpha = -1.37;
77
78 double schmin=1e8, schmax=1e12;
79 int schnpt = 1000;
80
81 // *** Niveau de bruit
82 double snoise= 0.; // en equivalent MSol
83 int isnoise_evol = 0;
84
85 // *** AGN
86 bool do_agn = false;
87 double lfjy_agn=-99., lsigma_agn=0.; // en Jy
88 double powlaw_agn = 0.;
89
90 // *** type de generation
91 bool computefourier0=false;
92 bool use_growth_factor = false;
93 unsigned short nthread=4;
94
95 // *** What to do
96 bool comp2dspec = false;
97 bool wfits = false;
98 bool wppf = false;
99 bool compvarreal = false;
100
101 // --- Decodage arguments
102 if(narg>0) {
103 for(int i=0;i<narg;i++) cout<<arg[i]<<" ";
104 cout<<endl;
105 }
106
107 char c;
108 while((c = getopt(narg,arg,"ha0PWV2Gx:y:z:s:Z:M:A:")) != -1) {
109 switch (c) {
110 case 'a' :
111 Auto_Ini_Ranf(5);
112 break;
113 case '0' :
114 computefourier0 = true;
115 break;
116 case 'G' :
117 use_growth_factor = true;
118 break;
119 case 'x' :
120 sscanf(optarg,"%ld,%lf",&nx,&dx);
121 break;
122 case 'y' :
123 sscanf(optarg,"%ld,%lf",&ny,&dy);
124 break;
125 case 'z' :
126 sscanf(optarg,"%ld,%lf",&nz,&dz);
127 break;
128 case 's' :
129 sscanf(optarg,"%lf,%d",&snoise,&isnoise_evol);
130 break;
131 case 'Z' :
132 sscanf(optarg,"%lf",&zref);
133 break;
134 case '2' :
135 comp2dspec = true;
136 break;
137 case 'M' :
138 sscanf(optarg,"%lf,%lf,%d",&schmin,&schmax,&schnpt);
139 break;
140 case 'A' :
141 do_agn = true;
142 sscanf(optarg,"%lf,%lf,%lf",&lfjy_agn,&lsigma_agn,&powlaw_agn);
143 break;
144 case 'V' :
145 compvarreal = true;
146 break;
147 case 'W' :
148 wfits = true;
149 break;
150 case 'P' :
151 wppf = true;
152 break;
153 case 'h' :
154 default :
155 usage(); return -1;
156 }
157 }
158
159 double lschmin=log10(schmin), lschmax=log10(schmax), dlsch=(lschmax-lschmin)/schnpt;
160
161 string tagobs = "cmvobserv3d.ppf";
162 POutPersist posobs(tagobs);
163
164 cout<<"zref="<<zref<<endl;
165 cout<<"nx="<<nx<<" dx="<<dx<<" ny="<<ny<<" dy="<<dy<<" nz="<<nz<<" dz="<<dz<<endl;
166 cout<<"kmin="<<kmin<<" ("<<lkmin<<"), kmax="<<kmax<<" ("<<lkmax<<") Mpc^-1"
167 <<", npt="<<npt<<endl;
168 cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl;
169 cout<<"nstar= "<<nstar<<" mstar="<<mstar<<" alpha="<<alpha<<endl;
170 cout<<"schmin="<<schmin<<" ("<<lschmin
171 <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol"
172 <<", schnpt="<<schnpt<<endl;
173 cout<<"snoise="<<snoise<<" equivalent Msol, evolution="<<isnoise_evol<<endl;
174 if(do_agn)
175 cout<<"AGN: <log10(Jy)>="<<lfjy_agn<<" , sigma="<<lsigma_agn
176 <<" , powlaw="<<powlaw_agn<<endl;
177
178 //-----------------------------------------------------------------
179 cout<<endl<<"\n--- Create Cosmology"<<endl;
180
181 CosmoCalc univ(flat,true,zref+1.);
182 univ.SetInteg(perc,dzinc,dzmax,glorder);
183 univ.SetDynParam(h100,om0,or0,ol0,w0);
184 univ.Print();
185 double loscomref = univ.Dloscom(zref);
186 cout<<"\nzref = "<<zref<<" -> dloscom = "<<loscomref<<" Mpc"<<endl;
187 univ.Print(zref);
188
189 //-----------------------------------------------------------------
190 cout<<endl<<"\n--- Create Spectrum"<<endl;
191
192 InitialSpectrum pkini(ns,as);
193
194 TransfertEisenstein tf(h100,om0-ob0,ob0,T_CMB_Par,false);
195 //tf.SetNoOscEnv(2);
196
197 GrowthFactor growth(om0,ol0);
198 // GrowthFactor growth(1.,0.); // D(z) = 1/(1+z)
199
200 PkSpectrum0 pk0(pkini,tf);
201
202 PkSpectrumZ pkz(pk0,growth,zref);
203
204 //-----------------------------------------------------------------
205 cout<<endl<<"\n--- Create mass function"<<endl;
206
207 Schechter sch(nstar,mstar,alpha);
208 sch.Print();
209
210 //-----------------------------------------------------------------
211 pkz.SetZ(0.);
212 cout<<endl<<"\n--- Compute variance for top-hat R="<<R
213 <<" at z="<<pkz.GetZ()<<endl;
214 VarianceSpectrum varpk_th(pkz,0);
215 double kfind_th = varpk_th.FindMaximum(R,kmin,kmax,eps);
216 double pkmax_th = varpk_th(kfind_th);
217 cout<<"kfind_th = "<<kfind_th<<" ("<<log10(kfind_th)<<"), integrand="<<pkmax_th<<endl;
218 double k1=kmin, k2=kmax;
219 int rc = varpk_th.FindLimits(R,pkmax_th/1.e4,k1,k2,eps);
220 cout<<"limit_th: rc="<<rc<<" : "<<k1<<" ("<<log10(k1)<<") , "
221 <<k2<<" ("<<log10(k2)<<")"<<endl;
222
223 double ldlk = (log10(k2)-log10(k1))/npt;
224 varpk_th.SetInteg(0.01,ldlk,-1.,4);
225 double sr2 = varpk_th.Variance(R,k1,k2);
226 cout<<"varpk_th="<<sr2<<" -> sigma="<<sqrt(sr2)<<endl;
227
228 double normpkz = sigmaR*sigmaR/sr2;
229 pkz.SetScale(normpkz);
230 cout<<"Spectrum normalisation = "<<pkz.GetScale()<<endl;
231
232 pkz.SetZ(zref);
233
234 Histo hpkz(lkmin,lkmax,npt); hpkz.ReCenterBin();
235 FuncToHisto(pkz,hpkz,true);
236 {
237 tagobs = "hpkz"; posobs.PutObject(hpkz,tagobs);
238 }
239
240 //-----------------------------------------------------------------
241 cout<<endl<<"\n--- Compute variance for Pk at z="<<pkz.GetZ()<<endl;
242 VarianceSpectrum varpk_int(pkz,2);
243
244 double kfind_int = varpk_int.FindMaximum(R,kmin,kmax,eps);
245 double pkmax_int = varpk_int(kfind_int);
246 cout<<"kfind_int = "<<kfind_int<<" ("<<log10(kfind_int)<<"), integrand="<<pkmax_int<<endl;
247 double k1int=kmin, k2int=kmax;
248 int rcint = varpk_int.FindLimits(R,pkmax_int/1.e4,k1int,k2int,eps);
249 cout<<"limit_int: rc="<<rcint<<" : "<<k1int<<" ("<<log10(k1int)<<") , "
250 <<k2int<<" ("<<log10(k2int)<<")"<<endl;
251
252 double ldlkint = (log10(k2int)-log10(k1int))/npt;
253 varpk_int.SetInteg(0.01,ldlkint,-1.,4);
254 double sr2int = varpk_int.Variance(R,k1int,k2int);
255 cout<<"varpk_int="<<sr2int<<" -> sigma="<<sqrt(sr2int)<<endl;
256
257 //-----------------------------------------------------------------
258 cout<<endl<<"\n--- Compute galaxy density number"<<endl;
259
260 sch.SetOutValue(0);
261 cout<<"sch(mstar) = "<<sch(mstar)<<" /Mpc^3/Msol"<<endl;
262 double ngal_by_mpc3 = IntegrateFuncLog(sch,lschmin,lschmax,0.01,dlsch,10.*dlsch,4);
263 cout<<"Galaxy density number = "<<ngal_by_mpc3<<" /Mpc^3 between limits"<<endl;
264
265 sch.SetOutValue(1);
266 cout<<"mstar*sch(mstar) = "<<sch(mstar)<<" Msol/Mpc^3/Msol"<<endl;
267 double mass_by_mpc3 = IntegrateFuncLog(sch,lschmin,lschmax,0.01,dlsch,10.*dlsch,4);
268 cout<<"Galaxy mass density= "<<mass_by_mpc3<<" Msol/Mpc^3 between limits"<<endl;
269 cout<<"Omega_HI at z=0 is "<<mass_by_mpc3/(univ.Rhoc(0.)*GCm3toMsolMpc3_Cst)<<endl
270 <<" at z="<<zref<<" is "<<mass_by_mpc3/(univ.Rhoc(zref)*GCm3toMsolMpc3_Cst)<<endl;
271
272 PrtTim(">>>> End of definition");
273
274 //-----------------------------------------------------------------
275 // FFTW3 (p26): faster if sizes 2^a 3^b 5^c 7^d 11^e 13^f with e+f=0 ou 1
276 cout<<endl<<"\n--- Initialisation de GeneFluct3D"<<endl;
277
278 TArray< complex<r_8> > pkgen;
279 GeneFluct3D fluct3d(pkgen);
280 fluct3d.SetPrtLevel(2);
281 fluct3d.SetNThread(nthread);
282 fluct3d.SetSize(nx,ny,nz,dx,dy,dz);
283 fluct3d.SetObservator(zref,-nz/2.);
284 fluct3d.SetCosmology(univ);
285 fluct3d.SetGrowthFactor(growth);
286 fluct3d.LosComRedshift(0.001,-1);
287 TArray<r_8>& rgen = fluct3d.GetRealArray();
288 cout<<endl; fluct3d.Print();
289
290 double dkmin = fluct3d.GetKincMin();
291 double knyqmax = fluct3d.GetKmax();
292 long nherr = long(knyqmax/dkmin+0.5);
293 cout<<"For HistoErr: d="<<dkmin<<" max="<<knyqmax<<" n="<<nherr<<endl;
294
295 double dktmin = fluct3d.GetKTincMin();
296 double ktnyqmax = fluct3d.GetKTmax();
297 long nherrt = long(ktnyqmax/dktmin+0.5);
298 double dkzmin = fluct3d.GetKinc()[2];
299 double kznyqmax = fluct3d.GetKnyq()[2];
300 long nherrz = long(kznyqmax/dkzmin+0.5);
301 cout<<"For Histo2DErr: d="<<dktmin<<","<<dkzmin
302 <<" max="<<ktnyqmax<<","<<kznyqmax<<" n="<<nherrt<<","<<nherrz<<endl;
303
304 //-----------------------------------------------------------------
305 cout<<"\n--- Computing spectra variance up to Kmax at z="<<pkz.GetZ()<<endl;
306 // En fait on travaille sur un cube inscrit dans la sphere de rayon kmax:
307 // sphere: Vs = 4Pi/3 k^3 , cube inscrit (cote k*sqrt(2)): Vc = (k*sqrt(2))^3
308 // Vc/Vs = 0.675 -> keff = kmax * (0.675)^(1/3) = kmax * 0.877
309 double knyqmax_mod = 0.877*knyqmax;
310 ldlkint = (log10(knyqmax_mod)-log10(k1int))/npt;
311 varpk_int.SetInteg(0.01,ldlkint,-1.,4);
312 double sr2int_kmax = varpk_int.Variance(R,k1int,knyqmax_mod);
313 cout<<"varpk_int(<"<<knyqmax_mod<<")="<<sr2int_kmax<<" -> sigma="<<sqrt(sr2int_kmax)<<endl;
314
315 PrtTim(">>>> End Initialisation de GeneFluct3D");
316
317 //-----------------------------------------------------------------
318 cout<<"\n--- Computing a realization in Fourier space"<<endl;
319 if(use_growth_factor) pkz.SetZ(0.); else pkz.SetZ(zref);
320 cout<<"Power spectrum set at redshift: "<<pkz.GetZ()<<endl;
321 if(computefourier0) fluct3d.ComputeFourier0(pkz);
322 else fluct3d.ComputeFourier(pkz);
323 PrtTim(">>>> End Computing a realization in Fourier space");
324
325 if(1) {
326 cout<<"\n--- Checking realization spectra"<<endl;
327 HistoErr hpkgen(0.,knyqmax,nherr);
328 hpkgen.ReCenterBin(); hpkgen.Zero();
329 hpkgen.Show();
330 fluct3d.ComputeSpectrum(hpkgen);
331 {
332 tagobs = "hpkgen"; posobs.PutObject(hpkgen,tagobs);
333 }
334 PrtTim(">>>> End Checking realization spectra");
335 }
336
337 if(comp2dspec) {
338 cout<<"\n--- Checking realization 2D spectra"<<endl;
339 Histo2DErr hpkgen2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
340 hpkgen2.ReCenterBin(); hpkgen2.Zero();
341 hpkgen2.Show();
342 fluct3d.ComputeSpectrum2D(hpkgen2);
343 {
344 tagobs = "hpkgen2"; posobs.PutObject(hpkgen2,tagobs);
345 }
346 PrtTim(">>>> End Checking realization 2D spectra");
347 }
348
349 if(1) {
350 cout<<"\n--- Computing convolution by pixel shape"<<endl;
351 fluct3d.FilterByPixel();
352 PrtTim(">>>> End Computing convolution by pixel shape");
353 }
354
355 if(wfits) {
356 fluct3d.WriteFits("!cmvobserv3d_k0.fits");
357 PrtTim(">>>> End WriteFits");
358 }
359 if(wppf) {
360 fluct3d.WritePPF("cmvobserv3d_k0.ppf",false);
361 PrtTim(">>>> End WritePPF");
362 }
363
364 if(1) {
365 cout<<"\n--- Checking realization spectra after pixel shape convol."<<endl;
366 HistoErr hpkgenf(0.,knyqmax,nherr);
367 hpkgenf.ReCenterBin(); hpkgenf.Zero();
368 hpkgenf.Show();
369 fluct3d.ComputeSpectrum(hpkgenf);
370 {
371 tagobs = "hpkgenf"; posobs.PutObject(hpkgenf,tagobs);
372 }
373 PrtTim(">>>> End Checking realization spectra");
374 }
375
376 if(comp2dspec) {
377 cout<<"\n--- Checking realization 2D spectra after pixel shape convol."<<endl;
378 Histo2DErr hpkgenf2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
379 hpkgenf2.ReCenterBin(); hpkgenf2.Zero();
380 hpkgenf2.Show();
381 fluct3d.ComputeSpectrum2D(hpkgenf2);
382 {
383 tagobs = "hpkgenf2"; posobs.PutObject(hpkgenf2,tagobs);
384 }
385 PrtTim(">>>> End Checking realization 2D spectra");
386 }
387
388 //-----------------------------------------------------------------
389 cout<<"\n--- Computing a realization in real space"<<endl;
390 fluct3d.ComputeReal();
391 double rmin,rmax; rgen.MinMax(rmin,rmax);
392 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
393 PrtTim(">>>> End Computing a realization in real space");
394
395 if(use_growth_factor) {
396 cout<<"\n--- Apply Growth factor"<<endl;
397 cout<<"...D(z=0)="<<growth(0.)<<" D(z="<<zref<<")="<<growth(zref)<<endl;
398 fluct3d.ApplyGrowthFactor();
399 rgen.MinMax(rmin,rmax);
400 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
401 PrtTim(">>>> End Applying growth factor");
402 }
403
404 if(wfits) {
405 fluct3d.WriteFits("!cmvobserv3d_r0.fits");
406 PrtTim(">>>> End WriteFits");
407 }
408 if(wppf) {
409 fluct3d.WritePPF("cmvobserv3d_r0.ppf",true);
410 PrtTim(">>>> End WritePPF");
411 }
412
413 int_8 nm;
414 double rm,rs2;
415 if(1) {
416 cout<<"\n--- Check mean and variance in real space"<<endl;
417 fluct3d.NumberOfBad(-1.,1e+200);
418 nm = fluct3d.MeanSigma2(rm,rs2);
419 PrtTim(">>>> End Check mean and variance in real space");
420 }
421
422 if(compvarreal) {
423 cout<<"\n--- Check variance sigmaR in real space"<<endl;
424 double varr;
425 fluct3d.VarianceFrReal(R,varr);
426 PrtTim(">>>> End Check variance sigmaR in real space");
427 }
428
429 //-----------------------------------------------------------------
430 cout<<endl<<"\n--- Converting fluctuations into mass"<<endl;
431 fluct3d.TurnFluct2Mass();
432 nm = fluct3d.MeanSigma2(rm,rs2);
433 PrtTim(">>>> End Converting fluctuations into mass");
434
435 cout<<"\n--- Converting mass into galaxy number"<<endl;
436 rm = fluct3d.TurnMass2MeanNumber(ngal_by_mpc3);
437 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200);
438 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.);
439 PrtTim(">>>> End Converting mass into galaxy number");
440
441 cout<<"\n--- Set negative and null pixels to BAD"<<endl;
442 nm = fluct3d.SetToVal(0.,1e+200,-999.);
443 PrtTim(">>>> End Set negative pixels to BAD etc...");
444
445 cout<<"\n--- Apply poisson on galaxy number"<<endl;
446 fluct3d.ApplyPoisson();
447 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200);
448 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.);
449 PrtTim(">>>> End Apply poisson on galaxy number");
450
451 cout<<"\n--- Convert Galaxy number to HI mass"<<endl;
452 long nhmdndm = long( (lschmax-lschmin+1.)*100. + 0.5);
453 Histo hmdndm(lschmin,lschmax,nhmdndm);
454 sch.SetOutValue(1);
455 FuncToHisto(sch,hmdndm,true);
456 FunRan tirhmdndm(hmdndm,true);
457 {
458 tagobs = "hmdndm"; posobs.PutObject(hmdndm,tagobs);
459 Histo hdum1(tirhmdndm);
460 tagobs = "tirhmdndm"; posobs.PutObject(hdum1,tagobs);
461 }
462 double mhi = fluct3d.TurnNGal2Mass(tirhmdndm,true);
463 cout<<mhi<<" MSol in survey / "<<mass_by_mpc3*fluct3d.GetVol()<<endl;
464 nm = fluct3d.MeanSigma2(rm,rs2,-998.,1e200);
465 cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl;
466 nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.);
467 PrtTim(">>>> End Convert Galaxy number to HI mass");
468
469 cout<<"\n--- Set BAD pixels to Zero"<<endl;
470 nm = fluct3d.SetToVal(-998.,1e+200,0.);
471 PrtTim(">>>> End Set BAD pixels to Zero etc...");
472
473 if(wfits) {
474 fluct3d.WriteFits("!cmvobserv3d_r.fits");
475 PrtTim(">>>> End WriteFits");
476 }
477 if(wppf) {
478 fluct3d.WritePPF("cmvobserv3d_r.ppf",true);
479 PrtTim(">>>> End WritePPF");
480 }
481
482 if(do_agn) {
483 cout<<"\n--- Add AGN: <log10(S Jy)>="<<lfjy_agn<<" , sigma="<<lsigma_agn
484 <<" , powlaw="<<powlaw_agn<<endl;
485 fluct3d.AddAGN(lfjy_agn,lsigma_agn,powlaw_agn);
486 nm = fluct3d.MeanSigma2(rm,rs2);
487 PrtTim(">>>> End Add AGN");
488 }
489
490 if(snoise>0.) {
491 cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<", evolution="<<isnoise_evol<<endl;
492 fluct3d.AddNoise2Real(snoise,(isnoise_evol>0? true:false));
493 nm = fluct3d.MeanSigma2(rm,rs2);
494 PrtTim(">>>> End Add noise");
495 }
496
497 if(wfits) {
498 fluct3d.WriteFits("!cmvobserv3d_rf.fits");
499 PrtTim(">>>> End WriteFits");
500 }
501 if(wppf) {
502 fluct3d.WritePPF("cmvobserv3d_rf.ppf",true);
503 PrtTim(">>>> End WritePPF");
504 }
505
506 //-----------------------------------------------------------------
507 // -- NE PAS FAIRE CA SI ON VEUT CONTINUER LA SIMULATION -> d_rho/rho ecrase
508
509 if(1) {
510 cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
511 fluct3d.ReComputeFourier();
512 PrtTim(">>>> End ReComputing spectrum");
513 }
514
515 if(wfits) {
516 fluct3d.WriteFits("!cmvobserv3d_k.fits");
517 PrtTim(">>>> End WriteFits");
518 }
519 if(wppf) {
520 fluct3d.WritePPF("cmvobserv3d_k.ppf",false);
521 PrtTim(">>>> End WritePPF");
522 }
523
524 if(1) {
525 cout<<endl<<"\n--- Computing final spectrum"<<endl;
526 HistoErr hpkrec(0.,knyqmax,nherr);
527 hpkrec.ReCenterBin();
528 hpkrec.Show();
529 fluct3d.ComputeSpectrum(hpkrec);
530 tagobs = "hpkrec"; posobs.PutObject(hpkrec,tagobs);
531 PrtTim(">>>> End Computing final spectrum");
532 }
533
534 if(comp2dspec) {
535 cout<<"\n--- Computing final 2D spectrum"<<endl;
536 Histo2DErr hpkrec2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
537 hpkrec2.ReCenterBin(); hpkrec2.Zero();
538 hpkrec2.Show();
539 fluct3d.ComputeSpectrum2D(hpkrec2);
540 {
541 tagobs = "hpkrec2"; posobs.PutObject(hpkrec2,tagobs);
542 }
543 PrtTim(">>>> End Computing final 2D spectrum");
544 }
545
546 PrtTim(">>>> End Of Job");
547 return 0;
548}
549
550/*
551######################################################
552readfits cmvobserv3d_k0.fits
553readfits cmvobserv3d_k.fits
554readfits cmvobserv3d_r0.fits
555readfits cmvobserv3d_r.fits
556readfits cmvobserv3d_rf.fits
557
558openppf cmvobserv3d_k0.ppf
559openppf cmvobserv3d_k.ppf
560openppf cmvobserv3d_r0.ppf
561openppf cmvobserv3d_r.ppf
562openppf cmvobserv3d_rf.ppf
563
564# pour le plot 2D d'une slice en Z du 3D: xy2d nom_obj3D num_slice
565defscript xy2d
566 objaoper $1 sliceyz $2
567 mv sliceyz_${2} ${1}_Z_$2
568 disp ${1}_Z_$2
569 echo display slice $2 of $1 name is ${1}_Z_$2
570endscript
571
572# pour le plot 2D d'une slice en Y du 3D: xz2d nom_obj3D num_slice
573defscript xz2d
574 objaoper $1 slicexy $2
575 mv slicexy_${2} ${1}_Y_$2
576 disp ${1}_Y_$2
577 echo display slice $2 of $1 name is ${1}_Y_$2
578endscript
579
580# pour le plot 2D d'une slice en X du 3D: yz2d nom_obj3D num_slice
581defscript yz2d
582 objaoper $1 slicexz $2
583 mv slicexz_${2} ${1}_X_$2
584 disp ${1}_X_$2
585 echo display slice $2 of $1 name is ${1}_X_$2
586endscript
587
588xy2d $cobj 0
589xz2d $cobj 0
590yz2d $cobj 0
591
592######################################################
593openppf cmvobserv3d.ppf
594
595zone
596set k pow(10.,x)
597n/plot hpkz.val*$k*$k/(2*M_PI*M_PI)%x ! "connectpoints"
598
599echo ${hpkgen.sum}
600echo ${hpkgenf.sum}
601echo ${hpkrec.sum}
602
603zone
604n/plot hpkz.val%x ! ! "nsta connectpoints"
605n/plot hpkgen.val%log10(x) x>0 ! "nsta same red connectpoints"
606n/plot hpkgenf.val%log10(x) x>0 ! "nsta same orange connectpoints"
607n/plot hpkrec.val%log10(x) x>0 ! "nsta same blue connectpoints"
608
609disp hpkgen "hbincont err"
610disp hpkgenf "hbincont err"
611disp hpkrec "hbincont err"
612
613zone 2 2
614imag hpkgen2
615imag hpkgenf2
616imag hpkrec2
617
618zone 2 1
619disp hmdndm "nsta"
620disp tirhmdndm "nsta"
621addline 0 1 20 1 "red"
622
623 */
Note: See TracBrowser for help on using the repository browser.