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