Changeset 3806 in Sophya
- Timestamp:
- Jul 24, 2010, 6:15:07 PM (15 years ago)
- Location:
- trunk/Cosmo/SimLSS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/cmvginit3d.cc
r3805 r3806 20 20 #include "geneutils.h" 21 21 #include "genefluct3d.h" 22 23 string decodecambarg(string arg,double& h, double& z); 22 24 23 25 void usage(void); … … 36 38 <<" -z nz,dz : size along z axis (redshift axis, npix,Mpc)"<<endl 37 39 <<" -Z zref : redshift for the center of the simulation cube"<<endl 40 <<" -f cambspec.dat,h100tab,ztab : use CAMB file (def: Eisenstein spectrum)"<<endl 38 41 <<" -1 : compute 1D spectrum (default: no)"<<endl 39 42 <<" -2 : compute 2D spectrum (default: no)"<<endl … … 69 72 unsigned short flat = 0; 70 73 double ob0 = 0.0444356; 71 double h100=0.71, om0=0.267804, or0=7.9e-05, ol0=0.73, w0=-1.;74 double h100=0.71, om0=0.267804, or0=7.9e-05, ol0=0.73, w0=-1.; 72 75 double zref = 0.5; 73 76 double perc=0.01,dzinc=-1.,dzmax=-1.; unsigned short glorder=4; … … 78 81 double sigmaR = 1.; 79 82 80 double kmin=1e-5,kmax=1000.; 81 int npt = 10000; 82 double lkmin=log10(kmin), lkmax=log10(kmax); 83 double kmin=1e-4,kmax=100.; 84 int npt = 1000; 83 85 double eps=1.e-3; 86 87 // *** Spectrum read from CAMB file 88 string cambfread = ""; 84 89 85 90 // *** type de generation … … 115 120 // --- Decodage des arguments 116 121 char c; 117 while((c = getopt(narg,arg,"haG:F:x:y:z:Z:128:v:n:CO:So:VT: ")) != -1) {122 while((c = getopt(narg,arg,"haG:F:x:y:z:Z:128:v:n:CO:So:VT:f:")) != -1) { 118 123 int nth = 0; 119 124 switch (c) { … … 175 180 nthread = (nth<1)? 0: nth; 176 181 break; 182 case 'f' : 183 cambfread = optarg; 184 break; 177 185 case 'h' : 178 186 default : … … 189 197 cout<<"zref="<<zref<<endl; 190 198 cout<<"nx="<<nx<<" dx="<<dx<<" ny="<<ny<<" dy="<<dy<<" nz="<<nz<<" dz="<<dz<<endl; 191 cout<<"kmin="<<kmin<<" ("<<l kmin<<"), kmax="<<kmax<<" ("<<lkmax<<") Mpc^-1"<<", npt="<<npt<<endl;199 cout<<"kmin="<<kmin<<" ("<<log10(kmin)<<"), kmax="<<kmax<<" ("<<log10(kmax)<<") Mpc^-1"<<", npt="<<npt<<endl; 192 200 cout<<"Filter by pixel = "<<filter_by_pixel<<endl; 193 201 if(comptransveloc) cout<<"Tansverse velocity generation requested"<<endl; 202 if(cambfread.size()>0) cout<<"use CAMB file: cambfread="<<cambfread<<endl; 194 203 cout<<"R="<<R<<" Rg="<<Rg<<" Mpc, sigmaR="<<sigmaR<<endl; 195 204 cout<<"Use_growth_factor = "<<use_growth_factor<<endl; … … 216 225 217 226 //----------------------------------------------------------------- 218 cout<<endl<<"\n--- Create Spectrum"<<endl; 219 220 InitialPowerLaw pkini(ns,as); 221 222 TransfertEisenstein tf(h100,om0-ob0,ob0,T_CMB_Par,false); 223 TransfertEisenstein tfnos(h100,om0-ob0,ob0,T_CMB_Par,false); 224 tfnos.SetNoOscEnv(2); 227 cout<<endl<<"\n--- Create GrowthFactor"<<endl; 225 228 226 229 GrowthEisenstein growth(om0,ol0); … … 229 232 cout<<"...Growth factor at z="<<zref<<" = "<<growth_at_z<<endl; 230 233 231 PkSpecCalc pkz(pkini,tf,growth,zref); 234 //----------------------------------------------------------------- 235 cout<<endl<<"\n--- Create Spectrum"<<endl; 236 237 InitialPowerLaw pkini(ns,as); 238 239 TransfertEisenstein tfnos(h100,om0-ob0,ob0,T_CMB_Par,false); 240 tfnos.SetNoOscEnv(2); 241 TransfertEisenstein tf(h100,om0-ob0,ob0,T_CMB_Par,false); 242 232 243 PkSpecCalc pkznos(pkini,tfnos,growth,zref); 233 234 //----------------------------------------------------------------- 235 pkz.SetZ(0.); 244 PkSpectrum* pkz = NULL; 245 if(cambfread.size()>0) { // read pk in CAMB file 246 double h100tab, ztab; 247 string fn = decodecambarg(cambfread,h100tab,ztab); 248 if(h100tab<=0.) h100tab = h100; 249 PkTabulate* pkzt = new PkTabulate; 250 pkzt->ReadCAMB(fn,h100tab,ztab); 251 pkzt->SetGrowthFactor(&growth); 252 pkzt->SetZ(zref); 253 pkz = pkzt; 254 // change k limits 255 kmin = pkzt->KMin(); 256 kmax = pkzt->KMax(); 257 cout<<"Change k limits to kmin="<<kmin<<" kmax="<<kmax<<endl; 258 } else { // use Eisenstein pk 259 PkSpecCalc* pkze = new PkSpecCalc(pkini,tf,growth,zref); 260 pkz = pkze; 261 } 262 263 //----------------------------------------------------------------- 264 cout<<endl<<"\n--- Normalize Spectrum"<<endl; 265 266 pkz->SetZ(0.); 236 267 pkznos.SetZ(0.); 237 cout<<endl<<"\n--- Compute variance for top-hat R="<<R<<" at z="<<pkz.GetZ()<<endl; 238 VarianceSpectrum varpk_th(pkz,R,VarianceSpectrum::TOPHAT); 239 double kfind_th = varpk_th.FindMaximum(kmin,kmax,eps); 240 double pkmax_th = varpk_th(kfind_th); 241 cout<<"kfind_th = "<<kfind_th<<" ("<<log10(kfind_th)<<"), integrand="<<pkmax_th<<endl; 242 double k1=kmin, k2=kmax; 243 int rc = varpk_th.FindLimits(pkmax_th/1.e4,k1,k2,eps); 244 cout<<"limit_th: rc="<<rc<<" : "<<k1<<" ("<<log10(k1)<<") , " 245 <<k2<<" ("<<log10(k2)<<")"<<endl; 246 247 double ldlk = (log10(k2)-log10(k1))/npt; 248 varpk_th.SetInteg(0.01,ldlk,-1.,4); 249 double sr2 = varpk_th.Variance(k1,k2); 250 cout<<"varpk_th="<<sr2<<" -> sigma="<<sqrt(sr2)<<endl; 251 252 double normpkz = sigmaR*sigmaR/sr2; 253 pkz.SetScale(normpkz); 254 pkznos.SetScale(normpkz); 255 cout<<"Spectrum normalisation = "<<pkz.GetScale()<<endl; 268 269 double normpkz[2] = {0.,0.}; 270 for(int i=0;i<2;i++) { 271 PkSpectrum* pkvar = NULL; string nam = ""; 272 if(i==0) pkvar = pkz; else {pkvar = &pkznos; nam = "NoOsc";} 273 cout<<endl<<"\n--- Compute variance for Pk "<<nam<<" with top-hat R="<<R<<" at z="<<pkvar->GetZ()<<endl; 274 VarianceSpectrum varpk_th(*pkvar,R,VarianceSpectrum::TOPHAT); 275 double kfind_th = varpk_th.FindMaximum(kmin,kmax,eps); 276 double pkmax_th = varpk_th(kfind_th); 277 cout<<"kfind_th = "<<kfind_th<<" ("<<log10(kfind_th)<<"), integrand="<<pkmax_th<<endl; 278 double k1=kmin, k2=kmax; 279 int rc = varpk_th.FindLimits(pkmax_th/1.e4,k1,k2,eps); 280 cout<<"limit_th: rc="<<rc<<" : "<<k1<<" ("<<log10(k1)<<") , " 281 <<k2<<" ("<<log10(k2)<<")"<<endl; 282 double ldlk = (log10(k2)-log10(k1))/npt; 283 varpk_th.SetInteg(0.01,ldlk,-1.,4); 284 double sr2 = varpk_th.Variance(k1,k2); 285 normpkz[i] = sigmaR*sigmaR/sr2; 286 cout<<"varpk_th="<<sr2<<" -> sigma="<<sqrt(sr2)<<" normpkz="<<normpkz[i]<<endl; 287 } 288 cout<<endl; 289 290 if(cambfread.size()>0) { 291 pkz->SetScale(1.); 292 pkznos.SetScale(normpkz[1]); 293 cout<<"Warning: CAMB spectrum, no normalisation applied, scale="<<pkz->GetScale()<<endl; 294 } else { 295 pkz->SetScale(normpkz[0]); 296 pkznos.SetScale(normpkz[0]); 297 cout<<"Spectrum normalisation (osc+noosc), scale = "<<pkz->GetScale()<<endl; 298 } 299 256 300 { 257 Histo hpkz0(l kmin,lkmax,npt); hpkz0.ReCenterBin();258 FuncToHisto( pkz,hpkz0,true);301 Histo hpkz0(log10(kmin),log10(kmax),npt); hpkz0.ReCenterBin(); 302 FuncToHisto(*pkz,hpkz0,true); 259 303 posobs.PutObject(hpkz0,"hpkz0"); 260 304 Histo hpkz0nos(hpkz0); … … 263 307 } 264 308 265 pkz .SetZ(zref);309 pkz->SetZ(zref); 266 310 pkznos.SetZ(zref); 311 267 312 { 268 Histo hpkz(l kmin,lkmax,npt); hpkz.ReCenterBin();269 FuncToHisto( pkz,hpkz,true);313 Histo hpkz(log10(kmin),log10(kmax),npt); hpkz.ReCenterBin(); 314 FuncToHisto(*pkz,hpkz,true); 270 315 posobs.PutObject(hpkz,"hpkz"); 271 316 Histo hpkznos(hpkz); … … 275 320 276 321 //----------------------------------------------------------------- 277 cout<<endl<<"\n--- Compute variance for Pk at z="<<pkz .GetZ()<<endl;278 VarianceSpectrum varpk_int( pkz,R,VarianceSpectrum::NOFILTER);322 cout<<endl<<"\n--- Compute variance for Pk at z="<<pkz->GetZ()<<endl; 323 VarianceSpectrum varpk_int(*pkz,R,VarianceSpectrum::NOFILTER); 279 324 double kfind_int = varpk_int.FindMaximum(kmin,kmax,eps); 280 325 double pkmax_int = varpk_int(kfind_int); … … 325 370 326 371 //----------------------------------------------------------------- 327 cout<<"\n--- Computing spectra variance up to Kmax at z="<<pkz .GetZ()<<endl;372 cout<<"\n--- Computing spectra variance up to Kmax at z="<<pkz->GetZ()<<endl; 328 373 // En fait on travaille sur un cube inscrit dans la sphere de rayon kmax: 329 374 // sphere: Vs = 4Pi/3 k^3 , cube inscrit (cote k*sqrt(2)): Vc = (k*sqrt(2))^3 … … 339 384 //----------------------------------------------------------------- 340 385 cout<<"\n--- Computing a realization in Fourier space"<<endl; 341 if(use_growth_factor>0) pkz .SetZ(0.); else pkz.SetZ(zref);342 cout<<"Power spectrum set at redshift: "<<pkz .GetZ()<<endl;343 fluct3d.ComputeFourier( pkz);386 if(use_growth_factor>0) pkz->SetZ(0.); else pkz->SetZ(zref); 387 cout<<"Power spectrum set at redshift: "<<pkz->GetZ()<<endl; 388 fluct3d.ComputeFourier(*pkz); 344 389 fluct3d.NTupleCheck(posobs,string("ntpkgen"),ntnent); 345 390 PrtTim(">>>> End Computing a realization in Fourier space"); … … 411 456 //----------------------------------------------------------------- 412 457 cout<<"\n--- Computing a realization in real space"<<endl; 458 double vdum1,vdum2; 413 459 fluct3d.ComputeReal(); 414 double rmin,rmax; fluct3d.MinMax(rmin,rmax);415 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;460 fluct3d.MinMax(vdum1,vdum2); 461 fluct3d.MeanSigma2(vdum1,vdum2); 416 462 fluct3d.NTupleCheck(posobs,string("ntreal"),ntnent); 417 463 PrtTim(">>>> End Computing a realization in real space"); … … 421 467 cout<<"...D(z=0)="<<growth(0.)<<" D(z="<<zref<<")="<<growth(zref)<<endl; 422 468 fluct3d.ApplyGrowthFactor(use_growth_factor); 423 fluct3d.MinMax( rmin,rmax);424 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;469 fluct3d.MinMax(vdum1,vdum2); 470 fluct3d.MeanSigma2(vdum1,vdum2); 425 471 fluct3d.NTupleCheck(posobs,string("ntgrow"),ntnent); 426 472 PrtTim(">>>> End Applying growth factor"); 427 473 } 428 429 int_8 nm;430 double rmref,rs2ref;431 cout<<"\n--- Computing reference variance in real space"<<endl;432 nm = fluct3d.MeanSigma2(rmref,rs2ref);433 cout<<" rs2ref= "<<rs2ref<<" , rmref="<<rmref<<" ("<<nm<<")"<<endl;434 PrtTim(">>>> End Computing reference variance in real space");435 474 436 475 if(whattowrt[1]&1) { … … 561 600 cout<<"\n--- Computing a realization in real space for Transverse velocity"<<endl; 562 601 fluct3d.ComputeReal(); 563 double rmin,rmax; fluct3d.MinMax(rmin,rmax);564 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;602 fluct3d.MinMax(vdum1,vdum2); 603 fluct3d.MeanSigma2(vdum1,vdum2); 565 604 fluct3d.NTupleCheck(posobs,string("nvreal"),ntnent); 566 605 PrtTim(">>>> End Computing a realization in real space"); 567 606 568 607 if(use_growth_factor>0) { 569 cout<<"\n--- Apply Growth factor "<<endl;608 cout<<"\n--- Apply Growth factor for transverse velocity"<<endl; 570 609 cout<<"...D(z=0)="<<growth(0.)<<" D(z="<<zref<<")="<<growth(zref)<<endl; 571 610 fluct3d.ApplyVelLosGrowthFactor(use_growth_factor); 572 fluct3d.MinMax( rmin,rmax);573 cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;611 fluct3d.MinMax(vdum1,vdum2); 612 fluct3d.MeanSigma2(vdum1,vdum2); 574 613 fluct3d.NTupleCheck(posobs,string("nvgrow"),ntnent); 575 614 PrtTim(">>>> End Applying growth factor"); 576 615 } 577 578 int_8 nmv;579 double vmref,vs2ref;580 cout<<"\n--- Computing reference variance in real space"<<endl;581 nmv = fluct3d.MeanSigma2(vmref,vs2ref);582 cout<<" vs2ref= "<<vs2ref<<" , vmref="<<vmref<<" ("<<nmv<<")"<<endl;583 PrtTim(">>>> End Computing reference variance in real space");584 616 585 617 if(whattowrt[1]&1) { … … 610 642 dvl("s8") = sigmaR; 611 643 dvl("Dtype") = (int_4)use_growth_factor; dvl("Pxfilt") = (int_4)filter_by_pixel; 644 if(cambfread.size()>0) dvl("fCAMB") = cambfread; 612 645 posobs.PutObject(dvl,"siminfo"); 613 646 } 614 647 615 648 delete RandGen; 649 if(pkz != NULL) delete pkz; 616 650 PrtTim(">>>> End Of Job"); 617 651 … … 634 668 } 635 669 670 #include "strutilxx.h" 671 string decodecambarg(string arg,double& h, double& z) 672 // - decode argument for CAMB generation: 673 // input: arg = "cambfilename,h100tab,ztab" 674 // output: h = h100 use to generate CAMB file 675 // z = redshift use to generate CAMB file 676 // return: CAMB file name 677 { 678 h = -1.; 679 z = 0.; 680 vector<string> vs; 681 FillVStringFrString(arg,vs,','); 682 if(vs.size()>1) h = atof(vs[1].c_str()); 683 if(vs.size()>2) z = atof(vs[2].c_str()); 684 cout<<"decodecambarg: "<<arg<<" fn=\""<<vs[0]<<"\" h="<<h<<" z="<<z<<endl; 685 return vs[0]; 686 } -
trunk/Cosmo/SimLSS/genefluct3d.cc
r3805 r3806 978 978 // (tous les pixels d'un plan Z sont mis au meme redshift z que celui du milieu) 979 979 { 980 if(lp_>0) cout<<"--- ApplyGrowthFactor: evol="<<type_evol<<endl;980 if(lp_>0) cout<<"--- ApplyGrowthFactor: evol="<<type_evol<<" (zpk="<<compute_pk_redsh_ref_<<")"<<endl; 981 981 check_array_alloc(); 982 982 … … 1035 1035 1036 1036 double zpk = compute_pk_redsh_ref_; 1037 double dpsd_orig = - cosmo_->H(zpk) * (1.+zpk) * growth_->DsDz(zpk,good_dzinc_) / (*growth_)(zpk); 1037 double grw_orig = (*growth_)(zpk); 1038 double dpsd_orig = - cosmo_->H(zpk) * (1.+zpk) * growth_->DsDz(zpk,good_dzinc_) / grw_orig; 1039 if(lp_>0) cout<<" original growth="<<grw_orig<<" dpsd="<<dpsd_orig<<" computed at z="<<zpk<<endl; 1038 1040 1039 1041 InterpFunc interpinv(loscom2zred_min_,loscom2zred_max_,loscom2zred_); … … 1049 1051 else dz = fabs(dz); // tous les plans Z au meme redshift 1050 1052 double z = interpinv(dz); // interpolation par morceau 1053 double grw = (*growth_)(z); 1051 1054 double dpsd = interdpd(z); 1052 1055 int_8 ip = IndexR(i,j,l); 1053 data_[ip] *= dpsd / dpsd_orig; 1056 // on remet le beta au bon z 1057 // on corrige du growth factor car data_ a ete calcule avec pk(zpk) 1058 data_[ip] *= (dpsd / dpsd_orig) * (grw / grw_orig); 1054 1059 } 1055 1060 } … … 1062 1067 // Calcule une realisation dans l'espace reel 1063 1068 { 1064 if(lp_>0) cout<<"--- ComputeReal ---"<<endl;1065 check_array_alloc();1066 1067 // On fait la FFT1068 GEN3D_FFTW_EXECUTE(pb_);1069 array_type = 1;1069 if(lp_>0) cout<<"--- ComputeReal --- from spectrum at z="<<compute_pk_redsh_ref_<<endl; 1070 check_array_alloc(); 1071 1072 // On fait la FFT 1073 GEN3D_FFTW_EXECUTE(pb_); 1074 array_type = 1; 1070 1075 } 1071 1076 -
trunk/Cosmo/SimLSS/pkspectrum.cc
r3805 r3806 390 390 double GrowthFactor::DsDz(double z, double) 391 391 { 392 cout<<" Error: GrowthFactor::DsDznot implemented"<<endl;393 throw AllocationError(" Error: GrowthFactor::DsDznot implemented");392 cout<<"GrowthFactor::DsDz_Error not implemented"<<endl; 393 throw AllocationError(" GrowthFactor::DsDz_Error not implemented"); 394 394 } 395 395 … … 404 404 { 405 405 if(OmegaMatter0==0.) { 406 cout<<"GrowthEisenstein::GrowthEisenstein : Errorbad OmegaMatter0 value : "<<OmegaMatter0<<endl;407 throw ParmError("GrowthEisenstein::GrowthEisenstein : Error badOmegaMatter0 value");406 cout<<"GrowthEisenstein::GrowthEisenstein_Error: bad OmegaMatter0 value : "<<OmegaMatter0<<endl; 407 throw ParmError("GrowthEisenstein::GrowthEisenstein_Error: bad OmegaMatter0 value"); 408 408 } 409 409 } … … 446 446 { 447 447 if(z<0. || dzinc<=0.) { 448 cout<<"GrowthEisenstein::DsDz : z<0 or dzinc<=0. !"<<endl;449 throw ParmError("GrowthEisenstein::DsDz : z<0 or dzinc<=0. !");448 cout<<"GrowthEisenstein::DsDz_Error: z<0 or dzinc<=0. !"<<endl; 449 throw ParmError("GrowthEisenstein::DsDz_Error: z<0 or dzinc<=0. !"); 450 450 } 451 451 … … 543 543 544 544 PkTabulate::PkTabulate(void) 545 : kmin_(1.) , kmax_(-1.) , interptyp_(0)545 : kmin_(1.) , kmax_(-1.) , interptyp_(0), d1_(NULL) 546 546 { 547 547 k_.resize(0); … … 550 550 551 551 PkTabulate::PkTabulate(PkTabulate& pkz) 552 : kmin_(pkz.kmin_) , kmax_(pkz.kmax_) , interptyp_(pkz.interptyp_) , k_(pkz.k_) , pk_(pkz.pk_) 553 { 554 } 555 552 : kmin_(pkz.kmin_) , kmax_(pkz.kmax_) , interptyp_(pkz.interptyp_) 553 , k_(pkz.k_) , pk_(pkz.pk_) 554 , d1_(pkz.d1_) 555 { 556 } 556 557 557 558 PkTabulate::~PkTabulate(void) … … 575 576 double PkTabulate::operator() (double k,double z) 576 577 { 577 cout<<"Error: PkTabulate::operator(double k,double z) not implemented"<<endl; 578 throw AllocationError("Error: PkTabulate::operator(double k,double z) not implemented"); 579 } 580 581 int PkTabulate::ReadCAMB(string filename, double h100, double zreftab) 578 cout<<"PkTabulate::operator(double k,double z)_Error: not implemented"<<endl; 579 throw AllocationError("PkTabulate::operator(double k,double z)_Error: not implemented"); 580 } 581 582 void PkTabulate::SetZ(double z) 583 { 584 if(d1_ == NULL) { 585 cout<<"PkTabulate::SetZ_Error: d1==NULL, no possible redshift change for tabulated Pk"<<endl; 586 throw ParmError("PkTabulate::SetZ_Error: d1==NULL, no possible redshift change for tabulated Pk"); 587 } 588 if(pk_.size() == 0) { 589 cout<<"PkTabulate::SetZ_Error: pk_.size()==0, no possible redshift change for tabulated Pk"<<endl; 590 throw ParmError("PkTabulate::SetZ_Error: pk_.size()==0, no possible redshift change for tabulated Pk"); 591 } 592 593 double zold = zref_; 594 if(fabs(z-zold)<1.e-4) return; 595 596 zref_ = z; 597 double d0 = (*d1_)(zold); 598 double d1 = (*d1_)(zref_); 599 double conv = d1*d1 / (d0*d0); 600 cout<<"PkTabulate::SetZ: change redshift from "<<zold<<" (d="<<d0 601 <<") to "<<zref_<<" (d="<<d1<<") conv="<<conv<<endl; 602 for(unsigned int i=0;i<pk_.size();i++) pk_[i] *= conv; 603 } 604 605 int PkTabulate::ReadCAMB(string filename, double h100tab, double zreftab) 582 606 { 583 607 FILE *file = fopen(filename.c_str(),"r"); 584 608 if(file==NULL) return -1; 585 cout<<"PkTabulate::ReadCAMB: fn="<<filename<<" h100="<<h100 <<" zreftab = "<<zreftab<<endl;609 cout<<"PkTabulate::ReadCAMB: fn="<<filename<<" h100="<<h100tab<<" zreftab = "<<zreftab<<endl; 586 610 587 611 const int lenline = 512; 588 612 char *line = new char[lenline]; 613 double h = h100tab, h3 = pow(h100tab,3.); 589 614 590 615 k_.resize(0); pk_.resize(0); 616 double kmax = 0., pkmax = 0.; 591 617 while ( fgets(line,lenline,file) != NULL ) { 592 618 double k, pk; 593 619 sscanf(line,"%lf %lf",&k,&pk); 594 k *= h100; // convert h Mpc^-1 -> Mpc^-1 595 pk /= h100*h100*h100; // convert h^-3 Mpc^3 -> Mpc^3 620 k *= h; // convert h Mpc^-1 -> Mpc^-1 621 pk /= h3; // convert h^-3 Mpc^3 -> Mpc^3 622 if(pk>pkmax) {pkmax = pk; kmax = k;} 596 623 k_.push_back(k); 597 624 pk_.push_back(pk); 598 625 } 599 626 600 SetZ(zreftab); 601 cout<<"PkTabulate::ReadCAMB nread="<<pk_.size()<<"zref="<<GetZ()<<endl; 627 zref_ = zreftab; 628 cout<<" nread="<<pk_.size()<<" zref="<<GetZ()<<" , k,pk: max="<<kmax<<","<<pkmax; 629 if(pk_.size()>0) cout<<" [0]="<<k_[0]<<","<<pk_[0] 630 <<" [n]="<<k_[pk_.size()-1]<<","<<pk_[pk_.size()-1]; 631 cout<<endl; 632 602 633 delete [] line; 603 634 … … 667 698 { 668 699 if(R<=0.) { 669 cout<<"VarianceSpectrum::SetRadius : ErrorR<=0"<<endl;670 throw ParmError("VarianceSpectrum::SetRadius : ErrorR<=0");700 cout<<"VarianceSpectrum::SetRadius_Error: R<=0"<<endl; 701 throw ParmError("VarianceSpectrum::SetRadius_Error: R<=0"); 671 702 } 672 703 R_ = R; … … 737 768 { 738 769 if(kmin<=0 || kmax<=0. || kmin>=kmax) { 739 cout<<"VarianceSpectrum::Variance : Errorkmin<=0 or kmax<=0 or kmin>=kmax"<<endl;740 throw ParmError("VarianceSpectrum::Variance : Errorkmin<=0 or kmax<=0 or kmin>=kmax");770 cout<<"VarianceSpectrum::Variance_Error: kmin<=0 or kmax<=0 or kmin>=kmax"<<endl; 771 throw ParmError("VarianceSpectrum::Variance_Error: kmin<=0 or kmax<=0 or kmin>=kmax"); 741 772 } 742 773 … … 759 790 { 760 791 if(kmin<=0 || kmax<=0. || kmin>=kmax) { 761 cout<<"VarianceSpectrum::FindMaximum : Errorkmin<=0 or kmax<=0 or kmin>=kmax || eps<=0"<<endl;762 throw ParmError("VarianceSpectrum::FindMaximum : Errorkmin<=0 or kmax<=0 or kmin>=kmax || eps<=0");792 cout<<"VarianceSpectrum::FindMaximum_Error: kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0"<<endl; 793 throw ParmError("VarianceSpectrum::FindMaximum_Error: kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0"); 763 794 } 764 795 … … 802 833 { 803 834 if(kmin<=0 || kmax<=0. || kmin>=kmax || eps<=0.) { 804 cout<<"VarianceSpectrum::FindLimits : Errorkmin<=0 or kmax<=0 or kmin>=kmax or eps<=0"<<endl;805 throw ParmError("VarianceSpectrum::FindLimits : Errorkmin<=0 or kmax<=0 or kmin>=kmax || eps<=0");835 cout<<"VarianceSpectrum::FindLimits_Error: kmin<=0 or kmax<=0 or kmin>=kmax or eps<=0"<<endl; 836 throw ParmError("VarianceSpectrum::FindLimits_Error: kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0"); 806 837 } 807 838 -
trunk/Cosmo/SimLSS/pkspectrum.h
r3805 r3806 154 154 virtual double operator() (double k); 155 155 virtual double operator() (double k,double z); 156 virtual void SetZ(double z); 156 157 int NPoints(void) {return k_.size();} 157 158 void SetInterpTyp(int typ=0); 158 int ReadCAMB(string filename, double h100=0.71, double zreftab = 0.); 159 int ReadCAMB(string filename, double h100tab=0.71, double zreftab=0.); 160 void SetGrowthFactor(GrowthFactor* d1) {d1_ = d1;} 161 GrowthFactor* GetGrowthFactor(void) {return d1_;} 162 double KMin(void) {if(k_.size()!=0) return k_[0]; else return 0.;} 163 double KMax(void) {if(k_.size()!=0) return k_[k_.size()-1]; else return 0.;} 159 164 protected: 160 165 double kmin_,kmax_; 161 166 int interptyp_; 162 167 vector<double> k_, pk_; 168 GrowthFactor* d1_; 163 169 }; 164 170
Note:
See TracChangeset
for help on using the changeset viewer.