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