Commit fa6015dc authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

try to understand at the damned diff with CF

parent 326f8179
......@@ -186,7 +186,7 @@ ClassEngine::ClassEngine(const ClassParams& pars,const string & precision_file):
//cout <<"creating " << sp.ct_size << " arrays" <<endl;
cl=new double[sp.ct_size];
//printFC();
printFC();
}
......
......@@ -37,17 +37,19 @@ int main(int argc,char** argv){
theChi2->getEngine()->writeCls(of);
}
//print a number of cosmological values
char* extra[]={"H0","z_reio","tau_reio"};
char* extra[]={"H0","z_reio","tau_reio","z_drag","rs_drag","Dv(0.57)","Da(0.57)","H(0.57)", "f(0.57)","sigma8","sigma8(0.57)"};
const int N=sizeof(extra)/sizeof(char*);
for (size_t i=0;i<N;i++) {
double val(0.);
try{
val= theChi2->getEngine()->get(extra[i]);
cout << extra[i] << "\t" << val << endl;
}
catch (Message_error &e){
//std::cerr << "maybe your are using pico?"<< std::endl;
// std::cerr << "could not get: " << e.what() << std::endl;
cout <<"bon c'est pas tres grave non plus" << endl;
}
cout << extra[i] << "\t" << val << endl;
}
......
......@@ -13,39 +13,37 @@ using namespace std;
// example run: one can specify as a second argument a preicison file
int main(int argc,char** argv){
//jusqu'a ou en l
const int l_max_scalars=10;
const int l_max_scalars=2500;
//CLASS config
ClassParams pars;
pars.add("100*theta_s",1.041);
pars.add("omega_b",0.0222);
pars.add("omega_cdm",0.1116);
pars.add("A_s",2.42e-9);
pars.add("n_s",.96);
pars.add("z_reio",10.4);
pars.add("100*theta_s",1.04222);
pars.add("omega_b",0.0227278);
pars.add("omega_cdm",0.116019);
pars.add("A_s",2.642551445334747e-09);
pars.add("n_s",0.979186);
pars.add("tau_reio",0.174138);
//example of list-parameter
pars.add("N_ncdm",1);
vector<double> m_ncdm(1);
m_ncdm[0]=0.06;
pars.add("m_ncdm",0.06);
//example of list-parameter
//vector<double> m_ncdm(1);
//m_ncdm[0]=0.06;
//m_ncdm[1]=0.04;
//m_ncdm[2]=0.04;
pars.addList("m_ncdm",m_ncdm);
//pars.addList("m_ncdm",m_ncdm);
pars.add("N_eff",2.046);
//other params
pars.add("k_pivot",0.05);
pars.add("YHe",0.25);
pars.add("sBBN file","/sps/planck/Users/plaszczy/CAPTAINFLAM/HEAD/par/bbn/sBBN.dat");
pars.add("l_max_scalars",l_max_scalars);
pars.add("lensing",true); //note boolean
pars.add("modes","s"); //scalars
pars.add("ic","ad"); //adiabatic
pars.add("output","tCl,pCl,lCl,mPk"); //pol +clphi-> mPk added for sigma8
//need to compute P(k,z) for sigma8(z)
......@@ -66,26 +64,43 @@ int main(int argc,char** argv){
else{
engine=new ClassEngine(pars);
}
double H0=engine->get_H0();
double theta=engine->theta();
cout << " expansion: H0=" << H0 << " 100*theta_s=" << 100*theta << endl << endl;;
cout << " Omega_m=" << engine->Omega_m() << endl ;
//YHE
cout << " YHe=" << engine->YHe() << endl << endl;;
//reio
double tau=engine->get("tau_reio");
double zreio=engine->get("z_reio");
cout << " reionization : tau_reio=" << tau << " z_reio=" << zreio << endl << endl;;
//write output
engine->writeCls(std::cout);
//derived parameters
for (size_t i=0;i<Nder;i++) {
cout << derived_par[i] << "\t" << engine->get(derived_par[i]) << endl;
}
// engine->writeCls(std::cout);
// //derived parameters
// for (size_t i=0;i<Nder;i++) {
// cout << derived_par[i] << "\t" << engine->get(derived_par[i]) << endl;
// }
//test update: change H0
int j=pars.findIndex("omega_b");
pars.updateVal(j,"0.01");//here : use str() or a string
// int j=pars.findIndex("omega_b");
// pars.updateVal(j,"0.01");//here : use str() or a string
engine->updateParValues(pars);
// engine->updateParValues(pars);
//write output
engine->writeCls(std::cout);
// //write output
// engine->writeCls(std::cout);
//derived parameters
for (size_t i=0;i<Nder;i++) {
cout << derived_par[i] << "\t" << engine->get(derived_par[i]) << endl;
}
// //derived parameters
// for (size_t i=0;i<Nder;i++) {
// cout << derived_par[i] << "\t" << engine->get(derived_par[i]) << endl;
// }
delete engine;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment