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