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

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

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