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

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

cmv 14/06/2007

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