[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"
|
---|
| 14 | #include "schechter.h"
|
---|
| 15 | #include "geneutils.h"
|
---|
| 16 | #include "integfunc.h"
|
---|
| 17 | #include "genefluct3d.h"
|
---|
| 18 |
|
---|
| 19 | void usage(void);
|
---|
| 20 | void usage(void)
|
---|
| 21 | {
|
---|
| 22 | cout<<"cmvobserv3d [-a] [-0]"<<endl
|
---|
| 23 | <<" -a : init auto de l aleatoire"<<endl
|
---|
| 24 | <<" -0 : use methode ComputeFourier0"<<endl
|
---|
| 25 | <<" -x nx,dx : taille en x (npix,Mpc)"<<endl
|
---|
| 26 | <<" -y ny,dy : taille en y (npix,Mpc)"<<endl
|
---|
| 27 | <<" -z nz,dz : taille en z (npix,Mpc)"<<endl
|
---|
| 28 | <<" -Z zref : redshift median"<<endl
|
---|
[3120] | 29 | <<" -s snoise : sigma du bruit en Msol"<<endl
|
---|
[3115] | 30 | <<endl;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | int main(int narg,char *arg[])
|
---|
| 34 | {
|
---|
| 35 | InitTim();
|
---|
| 36 |
|
---|
| 37 | //-----------------------------------------------------------------
|
---|
| 38 | // *** Survey definition
|
---|
[3129] | 39 | long nx=360, ny=-1, nz=64; double dx=1., dy=-1., dz=-1.;
|
---|
| 40 | //long nx=1000, ny=-1, nz=128; double dx=3., dy=-1., dz=6.;
|
---|
| 41 | //long nx=1200, ny=-1, nz=128; double dx=1., dy=-1., dz=3;
|
---|
[3115] | 42 |
|
---|
| 43 | // *** Cosmography definition (WMAP)
|
---|
| 44 | double ob0 = 0.0444356;
|
---|
| 45 | double h100=0.71, om0=0.267804, or0=7.9e-05, ol0=0.73,w0=-1.;
|
---|
| 46 | double zref = 0.5;
|
---|
| 47 |
|
---|
| 48 | // *** Spectrum and variance definition
|
---|
| 49 | double ns = 1., as = 1.;
|
---|
| 50 | double R=8./h100, Rg=R/sqrt(5.);
|
---|
| 51 | double sigmaR = 1.;
|
---|
| 52 |
|
---|
| 53 | double kmin=1e-5,kmax=1000.;
|
---|
| 54 | int npt = 10000;
|
---|
| 55 | double lkmin=log10(kmin), lkmax=log10(kmax);
|
---|
| 56 | double eps=1.e-3;
|
---|
| 57 |
|
---|
| 58 | // *** Schechter mass function definition
|
---|
| 59 | double h75 = 0.71 / 0.75;
|
---|
| 60 | double nstar = 0.006*pow(h75,3.);
|
---|
| 61 | double mstar = pow(10.,9.8/(h75*h75)); // MSol
|
---|
| 62 | double alpha = -1.37;
|
---|
| 63 |
|
---|
| 64 | double schmin=1e8, schmax=1e12;
|
---|
| 65 | int schnpt = 1000;
|
---|
| 66 | double lschmin=log10(schmin), lschmax=log10(schmax), dlsch=(lschmax-lschmin)/schnpt;
|
---|
| 67 |
|
---|
| 68 | // *** Niveau de bruit
|
---|
| 69 | double snoise= 0.; // en equivalent MSol
|
---|
| 70 |
|
---|
| 71 | // *** type de generation
|
---|
| 72 | bool computefourier0=false;
|
---|
| 73 | unsigned short nthread=4;
|
---|
| 74 |
|
---|
| 75 | // --- Decodage arguments
|
---|
| 76 |
|
---|
| 77 | char c;
|
---|
| 78 | while((c = getopt(narg,arg,"ha0x:y:z:s:Z:")) != -1) {
|
---|
| 79 | switch (c) {
|
---|
| 80 | case 'a' :
|
---|
| 81 | Auto_Ini_Ranf(5);
|
---|
| 82 | break;
|
---|
| 83 | case '0' :
|
---|
| 84 | computefourier0 = true;
|
---|
| 85 | break;
|
---|
| 86 | case 'x' :
|
---|
[3129] | 87 | sscanf(optarg,"%ld,%lf",&nx,&dx);
|
---|
[3115] | 88 | break;
|
---|
| 89 | case 'y' :
|
---|
[3129] | 90 | sscanf(optarg,"%ld,%lf",&ny,&dy);
|
---|
[3115] | 91 | break;
|
---|
| 92 | case 'z' :
|
---|
[3129] | 93 | sscanf(optarg,"%ld,%lf",&nz,&dz);
|
---|
[3115] | 94 | break;
|
---|
| 95 | case 's' :
|
---|
| 96 | sscanf(optarg,"%lf",&snoise);
|
---|
| 97 | break;
|
---|
| 98 | case 'Z' :
|
---|
| 99 | sscanf(optarg,"%lf",&zref);
|
---|
| 100 | break;
|
---|
| 101 | case 'h' :
|
---|
| 102 | default :
|
---|
| 103 | usage(); return -1;
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | string tagobs = "cmvobserv3d.ppf";
|
---|
| 108 | POutPersist posobs(tagobs);
|
---|
| 109 |
|
---|
| 110 | cout<<"zref="<<zref<<endl;
|
---|
| 111 | cout<<"nx="<<nx<<" dx="<<dx<<" ny="<<ny<<" dy="<<dy<<" nz="<<nz<<" dz="<<dz<<endl;
|
---|
| 112 | cout<<"kmin="<<kmin<<" ("<<lkmin<<"), kmax="<<kmax<<" ("<<lkmax<<") Mpc^-1"
|
---|
| 113 | <<", npt="<<npt<<endl;
|
---|
| 114 | cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl;
|
---|
| 115 | cout<<"nstar= "<<nstar<<" mstar="<<mstar<<" alpha="<<alpha<<endl;
|
---|
| 116 | cout<<"schmin="<<schmin<<" ("<<lschmin
|
---|
| 117 | <<"), schmax="<<schmax<<" ("<<lschmax<<") Msol"
|
---|
| 118 | <<", schnpt="<<schnpt<<endl;
|
---|
| 119 | cout<<"snoise="<<snoise<<" equivalent Msol"<<endl;
|
---|
| 120 |
|
---|
| 121 | //-----------------------------------------------------------------
|
---|
| 122 | cout<<endl<<"\n--- Create Spectrum and mass function"<<endl;
|
---|
| 123 |
|
---|
| 124 | InitialSpectrum pkini(ns,as);
|
---|
| 125 |
|
---|
| 126 | TransfertEisenstein tf(h100,om0-ob0,ob0,T_CMB_Par,false);
|
---|
| 127 | //tf.SetNoOscEnv(2);
|
---|
| 128 |
|
---|
| 129 | GrowthFactor d1(om0,ol0);
|
---|
| 130 |
|
---|
| 131 | PkSpectrum0 pk0(pkini,tf);
|
---|
| 132 |
|
---|
| 133 | PkSpectrumZ pkz(pk0,d1,zref);
|
---|
| 134 |
|
---|
| 135 | Schechter sch(nstar,mstar,alpha);
|
---|
| 136 |
|
---|
| 137 | //-----------------------------------------------------------------
|
---|
| 138 | pkz.SetZ(0.);
|
---|
| 139 | cout<<endl<<"\n--- Compute variance for top-hat R="<<R
|
---|
| 140 | <<" at z="<<pkz.GetZ()<<endl;
|
---|
| 141 | VarianceSpectrum varpk_th(pkz,0);
|
---|
| 142 | double kfind_th = varpk_th.FindMaximum(R,kmin,kmax,eps);
|
---|
| 143 | double pkmax_th = varpk_th(kfind_th);
|
---|
| 144 | cout<<"kfind_th = "<<kfind_th<<" ("<<log10(kfind_th)<<"), integrand="<<pkmax_th<<endl;
|
---|
| 145 | double k1=kmin, k2=kmax;
|
---|
| 146 | int rc = varpk_th.FindLimits(R,pkmax_th/1.e4,k1,k2,eps);
|
---|
| 147 | cout<<"limit_th: rc="<<rc<<" : "<<k1<<" ("<<log10(k1)<<") , "
|
---|
| 148 | <<k2<<" ("<<log10(k2)<<")"<<endl;
|
---|
| 149 |
|
---|
| 150 | double ldlk = (log10(k2)-log10(k1))/npt;
|
---|
| 151 | varpk_th.SetInteg(0.01,ldlk,-1.,4);
|
---|
| 152 | double sr2 = varpk_th.Variance(R,k1,k2);
|
---|
| 153 | cout<<"varpk_th="<<sr2<<" -> sigma="<<sqrt(sr2)<<endl;
|
---|
| 154 |
|
---|
| 155 | double normpkz = sigmaR*sigmaR/sr2;
|
---|
| 156 | pkz.SetScale(normpkz);
|
---|
| 157 | cout<<"Spectrum normalisation = "<<pkz.GetScale()<<endl;
|
---|
| 158 |
|
---|
| 159 | pkz.SetZ(zref);
|
---|
| 160 |
|
---|
[3120] | 161 | Histo hpkz(lkmin,lkmax,npt); hpkz.ReCenterBin();
|
---|
[3115] | 162 | FuncToHisto(pkz,hpkz,true);
|
---|
| 163 | {
|
---|
| 164 | tagobs = "hpkz"; posobs.PutObject(hpkz,tagobs);
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | //-----------------------------------------------------------------
|
---|
| 168 | cout<<endl<<"\n--- Compute variance for Pk at z="<<pkz.GetZ()<<endl;
|
---|
| 169 | VarianceSpectrum varpk_int(pkz,2);
|
---|
| 170 |
|
---|
| 171 | double kfind_int = varpk_int.FindMaximum(R,kmin,kmax,eps);
|
---|
| 172 | double pkmax_int = varpk_int(kfind_int);
|
---|
| 173 | cout<<"kfind_int = "<<kfind_int<<" ("<<log10(kfind_int)<<"), integrand="<<pkmax_int<<endl;
|
---|
| 174 | double k1int=kmin, k2int=kmax;
|
---|
| 175 | int rcint = varpk_int.FindLimits(R,pkmax_int/1.e4,k1int,k2int,eps);
|
---|
| 176 | cout<<"limit_int: rc="<<rcint<<" : "<<k1int<<" ("<<log10(k1int)<<") , "
|
---|
| 177 | <<k2int<<" ("<<log10(k2int)<<")"<<endl;
|
---|
| 178 |
|
---|
| 179 | double ldlkint = (log10(k2int)-log10(k1int))/npt;
|
---|
| 180 | varpk_int.SetInteg(0.01,ldlkint,-1.,4);
|
---|
| 181 | double sr2int = varpk_int.Variance(R,k1int,k2int);
|
---|
| 182 | cout<<"varpk_int="<<sr2int<<" -> sigma="<<sqrt(sr2int)<<endl;
|
---|
| 183 |
|
---|
| 184 | PrtTim("End of definition");
|
---|
| 185 |
|
---|
| 186 | //-----------------------------------------------------------------
|
---|
| 187 | cout<<endl<<"\n--- Compute galaxies density number"<<endl;
|
---|
| 188 |
|
---|
| 189 | sch.SetOutValue(0);
|
---|
| 190 | cout<<"sch(mstar) = "<<sch(mstar)<<" /Mpc^3/Msol"<<endl;
|
---|
| 191 | double ngal_by_mpc3 = IntegrateFuncLog(sch,lschmin,lschmax,0.01,dlsch,10.*dlsch,4);
|
---|
| 192 | cout<<"Galaxy density number = "<<ngal_by_mpc3<<" /Mpc^3 between limits"<<endl;
|
---|
| 193 |
|
---|
| 194 | sch.SetOutValue(1);
|
---|
| 195 | cout<<"mstar*sch(mstar) = "<<sch(mstar)<<" Msol/Mpc^3/Msol"<<endl;
|
---|
| 196 | double mass_by_mpc3 = IntegrateFuncLog(sch,lschmin,lschmax,0.01,dlsch,10.*dlsch,4);
|
---|
| 197 | cout<<"Galaxy mass density= "<<mass_by_mpc3<<" Msol/Mpc^3 between limits"<<endl;
|
---|
| 198 |
|
---|
| 199 | //-----------------------------------------------------------------
|
---|
| 200 | // FFTW3 (p26): faster if sizes 2^a 3^b 5^c 7^d 11^e 13^f with e+f=0 ou 1
|
---|
| 201 | cout<<endl<<"\n--- Compute Spectrum Realization"<<endl;
|
---|
| 202 |
|
---|
| 203 | pkz.SetZ(zref);
|
---|
| 204 | TArray< complex<r_8> > pkgen;
|
---|
[3141] | 205 | GeneFluct3D fluct3d(pkgen);
|
---|
[3115] | 206 | fluct3d.SetNThread(nthread);
|
---|
| 207 | fluct3d.SetSize(nx,ny,nz,dx,dy,dz);
|
---|
[3141] | 208 | TArray<r_8>& rgen = fluct3d.GetRealArray();
|
---|
[3115] | 209 | fluct3d.Print();
|
---|
[3141] | 210 |
|
---|
| 211 | double dkmin = fluct3d.GetKincMin();
|
---|
[3115] | 212 | double knyqmax = fluct3d.GetKmax();
|
---|
[3141] | 213 | long nherr = long(knyqmax/dkmin+0.5);
|
---|
| 214 | cout<<"For HistoErr: d="<<dkmin<<" max="<<knyqmax<<" n="<<nherr<<endl;
|
---|
[3115] | 215 |
|
---|
[3141] | 216 | double dktmin = fluct3d.GetKTincMin();
|
---|
| 217 | double ktnyqmax = fluct3d.GetKTmax();
|
---|
| 218 | long nherrt = long(ktnyqmax/dktmin+0.5);
|
---|
| 219 | double dkzmin = fluct3d.GetKinc()[2];
|
---|
| 220 | double kznyqmax = fluct3d.GetKnyq()[2];
|
---|
| 221 | long nherrz = long(kznyqmax/dkzmin+0.5);
|
---|
| 222 | cout<<"For Histo2DErr: d="<<dktmin<<","<<dkzmin
|
---|
| 223 | <<" max="<<ktnyqmax<<","<<kznyqmax<<" n="<<nherrt<<","<<nherrz<<endl;
|
---|
| 224 |
|
---|
[3115] | 225 | cout<<"\n--- Computing spectra variance up to Kmax at z="<<pkz.GetZ()<<endl;
|
---|
| 226 | // En fait on travaille sur un cube inscrit dans la sphere de rayon kmax:
|
---|
| 227 | // sphere: Vs = 4Pi/3 k^3 , cube inscrit (cote k*sqrt(2)): Vc = (k*sqrt(2))^3
|
---|
| 228 | // Vc/Vs = 0.675 -> keff = kmax * (0.675)^(1/3) = kmax * 0.877
|
---|
[3141] | 229 | double knyqmax_mod = 0.877*knyqmax;
|
---|
| 230 | ldlkint = (log10(knyqmax_mod)-log10(k1int))/npt;
|
---|
[3115] | 231 | varpk_int.SetInteg(0.01,ldlkint,-1.,4);
|
---|
[3141] | 232 | double sr2int_kmax = varpk_int.Variance(R,k1int,knyqmax_mod);
|
---|
| 233 | cout<<"varpk_int(<"<<knyqmax_mod<<")="<<sr2int_kmax<<" -> sigma="<<sqrt(sr2int_kmax)<<endl;
|
---|
[3115] | 234 |
|
---|
| 235 | cout<<"\n--- Computing a realization in Fourier space"<<endl;
|
---|
[3141] | 236 | if(computefourier0) fluct3d.ComputeFourier0(pkz);
|
---|
| 237 | else fluct3d.ComputeFourier(pkz);
|
---|
[3115] | 238 |
|
---|
[3141] | 239 | if(1) {
|
---|
| 240 | cout<<"\n--- Checking realization spectra"<<endl;
|
---|
| 241 | HistoErr hpkgen(0.,knyqmax,nherr);
|
---|
| 242 | hpkgen.ReCenterBin(); hpkgen.Zero();
|
---|
| 243 | hpkgen.Show();
|
---|
| 244 | fluct3d.ComputeSpectrum(hpkgen);
|
---|
| 245 | {
|
---|
| 246 | tagobs = "hpkgen"; posobs.PutObject(hpkgen,tagobs);
|
---|
| 247 | }
|
---|
[3115] | 248 | }
|
---|
| 249 |
|
---|
| 250 | if(1) {
|
---|
[3141] | 251 | cout<<"\n--- Checking realization 2D spectra"<<endl;
|
---|
| 252 | Histo2DErr hpkgen2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
| 253 | hpkgen2.ReCenterBin(); hpkgen2.Zero();
|
---|
| 254 | hpkgen2.Show();
|
---|
| 255 | fluct3d.ComputeSpectrum2D(hpkgen2);
|
---|
| 256 | {
|
---|
| 257 | tagobs = "hpkgen2"; posobs.PutObject(hpkgen2,tagobs);
|
---|
| 258 | }
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | if(1) {
|
---|
[3115] | 262 | cout<<"\n--- Computing convolution by pixel shape"<<endl;
|
---|
| 263 | fluct3d.FilterByPixel();
|
---|
[3141] | 264 | }
|
---|
[3115] | 265 |
|
---|
[3141] | 266 | if(1) fluct3d.WriteFits("!cmvobserv3d_k.fits");
|
---|
| 267 | if(1) fluct3d.WritePPF("cmvobserv3d_k.ppf",false);
|
---|
| 268 |
|
---|
| 269 | if(1) {
|
---|
[3115] | 270 | cout<<"\n--- Checking realization spectra after pixel shape convol."<<endl;
|
---|
[3141] | 271 | HistoErr hpkgenf(0.,knyqmax,nherr);
|
---|
| 272 | hpkgenf.ReCenterBin(); hpkgenf.Zero();
|
---|
| 273 | hpkgenf.Show();
|
---|
[3115] | 274 | fluct3d.ComputeSpectrum(hpkgenf);
|
---|
| 275 | {
|
---|
| 276 | tagobs = "hpkgenf"; posobs.PutObject(hpkgenf,tagobs);
|
---|
| 277 | }
|
---|
| 278 | }
|
---|
| 279 |
|
---|
[3141] | 280 | if(1) {
|
---|
| 281 | cout<<"\n--- Checking realization 2D spectra after pixel shape convol."<<endl;
|
---|
| 282 | Histo2DErr hpkgenf2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
| 283 | hpkgenf2.ReCenterBin(); hpkgenf2.Zero();
|
---|
| 284 | hpkgenf2.Show();
|
---|
| 285 | fluct3d.ComputeSpectrum2D(hpkgenf2);
|
---|
| 286 | {
|
---|
| 287 | tagobs = "hpkgenf2"; posobs.PutObject(hpkgenf2,tagobs);
|
---|
| 288 | }
|
---|
[3115] | 289 | }
|
---|
| 290 |
|
---|
| 291 | cout<<"\n--- Computing a realization in real space"<<endl;
|
---|
| 292 | fluct3d.ComputeReal();
|
---|
| 293 | double rmin,rmax; rgen.MinMax(rmin,rmax);
|
---|
| 294 | cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
|
---|
| 295 |
|
---|
[3141] | 296 | if(1) fluct3d.WriteFits("!cmvobserv3d_r0.fits");
|
---|
| 297 | if(1) fluct3d.WritePPF("cmvobserv3d_r0.ppf",true);
|
---|
[3115] | 298 |
|
---|
[3141] | 299 | int_8 nm;
|
---|
| 300 | double rm,rs2;
|
---|
[3115] | 301 | if(1) {
|
---|
[3141] | 302 | cout<<"\n--- Check mean and variance in real space"<<endl;
|
---|
| 303 | int_8 nlowone = fluct3d.NumberOfBad(-1.,1e+200);
|
---|
| 304 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
| 305 | cout<<"rgen:("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 306 | <<rs2<<" -> "<<sqrt(rs2)<<", n(<-1)="<<nlowone<<endl;
|
---|
| 307 | }
|
---|
| 308 |
|
---|
| 309 | if(1) {
|
---|
[3115] | 310 | cout<<"\n--- Check variance sigmaR in real space"<<endl;
|
---|
| 311 | double varr;
|
---|
[3134] | 312 | int_8 nvarr = fluct3d.VarianceFrReal(R,varr);
|
---|
[3115] | 313 | cout<<"R="<<R<<" : sigmaR^2="<<varr<<" -> "<<sqrt(varr)<<", n="<<nvarr<<endl;
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | //-----------------------------------------------------------------
|
---|
| 317 | cout<<endl<<"\n--- Converting fluctuations into mass"<<endl;
|
---|
| 318 | fluct3d.TurnFluct2Mass();
|
---|
| 319 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
| 320 | cout<<"1+rgen: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 321 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
| 322 |
|
---|
| 323 | cout<<"\n--- Converting mass into galaxy number"<<endl;
|
---|
| 324 | rm = fluct3d.TurnMass2MeanNumber(ngal_by_mpc3);
|
---|
| 325 | cout<<rm<<" galaxies put into survey"<<endl;
|
---|
| 326 | nm = fluct3d.MeanSigma2(rm,rs2,0.);
|
---|
| 327 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 328 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
| 329 |
|
---|
| 330 | cout<<"\n--- Set negative pixels to BAD"<<endl;
|
---|
| 331 | nm = fluct3d.SetToVal(0.,1e+200,-999.);
|
---|
| 332 | cout<<nm<<" negative in survey set to BAD"<<endl;
|
---|
| 333 | nm = fluct3d.MeanSigma2(rm,rs2,-998.);
|
---|
| 334 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 335 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
| 336 |
|
---|
| 337 | cout<<"\n--- Apply poisson on galaxie number"<<endl;
|
---|
| 338 | nm = fluct3d.ApplyPoisson();
|
---|
| 339 | cout<<nm<<" galaxies into survey after poisson"<<endl;
|
---|
| 340 | nm = fluct3d.MeanSigma2(rm,rs2,-998.);
|
---|
| 341 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 342 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
| 343 |
|
---|
| 344 | cout<<"\n--- Convert Galaxies number to HI mass"<<endl;
|
---|
[3129] | 345 | long nhmdndm = long( (lschmax-lschmin+1.)*100. + 0.5);
|
---|
[3115] | 346 | Histo hmdndm(lschmin,lschmax,nhmdndm);
|
---|
| 347 | sch.SetOutValue(1);
|
---|
| 348 | FuncToHisto(sch,hmdndm,true);
|
---|
| 349 | FunRan tirhmdndm(hmdndm,true);
|
---|
| 350 | {
|
---|
| 351 | tagobs = "hmdndm"; posobs.PutObject(hmdndm,tagobs);
|
---|
| 352 | Histo hdum1(tirhmdndm);
|
---|
| 353 | tagobs = "tirhmdndm"; posobs.PutObject(hdum1,tagobs);
|
---|
| 354 | }
|
---|
| 355 | double mhi = fluct3d.TurnNGal2Mass(tirhmdndm,true);
|
---|
| 356 | cout<<mhi<<" MSol in survey / "<<mass_by_mpc3*fluct3d.GetVol()<<endl;
|
---|
| 357 | nm = fluct3d.MeanSigma2(rm,rs2,0.);
|
---|
| 358 | cout<<"HI mass: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 359 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
| 360 | cout<<"Equivalent: "<<rm*nm/fluct3d.NPix()<<" Msol / pixels"<<endl;
|
---|
| 361 |
|
---|
| 362 | cout<<"\n--- Set BAD pixels to Zero"<<endl;
|
---|
| 363 | nm = fluct3d.SetToVal(-998.,1e+200,0.);
|
---|
| 364 | cout<<nm<<" BAD in survey set to zero"<<endl;
|
---|
| 365 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
| 366 | cout<<"galaxy: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 367 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
| 368 |
|
---|
[3141] | 369 | if(1) fluct3d.WriteFits("!cmvobserv3d_r.fits");
|
---|
| 370 | if(1) fluct3d.WritePPF("cmvobserv3d_r.ppf",true);
|
---|
[3120] | 371 |
|
---|
[3115] | 372 | cout<<"\n--- Add noise to HI Flux snoise="<<snoise<<endl;
|
---|
| 373 | fluct3d.AddNoise2Real(snoise);
|
---|
| 374 | nm = fluct3d.MeanSigma2(rm,rs2);
|
---|
| 375 | cout<<"HI mass with noise: ("<<nm<<") Mean = "<<rm<<", Sigma^2 = "
|
---|
| 376 | <<rs2<<" -> "<<sqrt(rs2)<<endl;
|
---|
| 377 |
|
---|
| 378 | //-----------------------------------------------------------------
|
---|
| 379 | // -- NE PAS FAIRE CA SI ON VEUT CONTINUER LA SIMULATION -> d_rho/rho ecrase
|
---|
[3141] | 380 |
|
---|
[3115] | 381 | if(1) {
|
---|
| 382 | cout<<endl<<"\n--- ReComputing spectrum from real space"<<endl;
|
---|
| 383 | fluct3d.ReComputeFourier();
|
---|
[3141] | 384 | }
|
---|
| 385 |
|
---|
| 386 | if(1) {
|
---|
| 387 | cout<<endl<<"\n--- Computing final spectrum"<<endl;
|
---|
| 388 | HistoErr hpkrec(0.,knyqmax,nherr);
|
---|
[3115] | 389 | hpkrec.ReCenterBin();
|
---|
[3141] | 390 | hpkrec.Show();
|
---|
[3115] | 391 | fluct3d.ComputeSpectrum(hpkrec);
|
---|
| 392 | tagobs = "hpkrec"; posobs.PutObject(hpkrec,tagobs);
|
---|
| 393 | }
|
---|
| 394 |
|
---|
[3141] | 395 | if(1) {
|
---|
| 396 | cout<<"\n--- Computing final 2D spectrum"<<endl;
|
---|
| 397 | Histo2DErr hpkrec2(0.,ktnyqmax,nherrt,0.,kznyqmax,nherrz);
|
---|
| 398 | hpkrec2.ReCenterBin(); hpkrec2.Zero();
|
---|
| 399 | hpkrec2.Show();
|
---|
| 400 | fluct3d.ComputeSpectrum2D(hpkrec2);
|
---|
| 401 | {
|
---|
| 402 | tagobs = "hpkrec2"; posobs.PutObject(hpkrec2,tagobs);
|
---|
| 403 | }
|
---|
| 404 | }
|
---|
| 405 |
|
---|
[3115] | 406 | return 0;
|
---|
| 407 | }
|
---|
| 408 |
|
---|
| 409 | /*
|
---|
[3141] | 410 | ######################################################
|
---|
| 411 | readfits cmvobserv3d_k.fits
|
---|
| 412 | readfits cmvobserv3d_r0.fits
|
---|
| 413 | readfits cmvobserv3d_r.fits
|
---|
| 414 |
|
---|
| 415 | openppf cmvobserv3d_k.ppf
|
---|
| 416 | openppf cmvobserv3d_r0.ppf
|
---|
| 417 | openppf cmvobserv3d_r.ppf
|
---|
| 418 |
|
---|
| 419 | # pour le plot 2D d'une slice en Z du 3D: to2d nom_obj3D num_slice
|
---|
| 420 | defscript to2d
|
---|
| 421 | objaoper $1 sliceyz $2
|
---|
| 422 | mv sliceyz_${2} ${1}_$2
|
---|
| 423 | disp ${1}_$2
|
---|
| 424 | echo display slice $2 of $1
|
---|
| 425 | endscript
|
---|
| 426 |
|
---|
| 427 | to2d $cobj 0
|
---|
| 428 |
|
---|
| 429 | ######################################################
|
---|
[3115] | 430 | openppf cmvobserv3d.ppf
|
---|
| 431 |
|
---|
[3141] | 432 | zone
|
---|
[3120] | 433 | n/plot hpkz.val%x ! ! "nsta connectpoints"
|
---|
| 434 | n/plot hpkgen.val%log10(x) x>0 ! "nsta same red connectpoints"
|
---|
| 435 | n/plot hpkgenf.val%log10(x) x>0 ! "nsta same orange connectpoints"
|
---|
| 436 | n/plot hpkrec.val%log10(x) x>0 ! "nsta same blue connectpoints"
|
---|
[3115] | 437 |
|
---|
| 438 | set k pow(10.,x)
|
---|
| 439 | n/plot hpkz.val*$k*$k/(2*M_PI*M_PI)%x ! "connectpoints"
|
---|
| 440 |
|
---|
[3141] | 441 | zone 2 2
|
---|
| 442 | imag hpkgen2
|
---|
| 443 | imag hpkgenf2
|
---|
| 444 | imag hpkrec2
|
---|
[3115] | 445 |
|
---|
[3141] | 446 | zone
|
---|
[3120] | 447 | disp hmdndm
|
---|
| 448 | disp tirhmdndm
|
---|
| 449 | addline 0 1 20 1 "red"
|
---|
| 450 |
|
---|
[3115] | 451 | */
|
---|