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