Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 0fef1016 authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

read external k values for writespectraPk; rm python+clik for gcc

parent 8460ae8a
......@@ -9,7 +9,7 @@ macro cppflags " -O3 -pipe -ansi -Woverloaded-virtual -Wpedantic -Wunused -Wmay
# although it may be strange we do not compile CAMEL with OMP because CLASS is not thread safe
# no worries: CLASS is compiled with OMP
#macro_append cppflags "-fopenmp "
#macro_append cpplinkflags " -fopenmp "
macro_append cpplinkflags " -fopenmp "
#CAMEL includes
......@@ -24,8 +24,9 @@ include_dirs "../src/camel/JLA/jla_likelihood_v3/src"
#cfitsio
include_dirs "$(CLIKDIR)/include"
macro_append CAMEL_linkopts " -L$(CLIKDIR) -lcfitsio"
#include_dirs "$(CLIKDIR)/include"
#macro_append CAMEL_linkopts " -L$(CLIKDIR) -lcfitsio"
macro_append CAMEL_linkopts " -lcfitsio"
#JLA :requires cblas/lapack
macro_append cppflags ' -DJLA '
......@@ -35,9 +36,9 @@ application test_jla -group=test -s=../src/camel test/test_jla.cc
#PLANCK
macro_append cppflags " -DCLIK $(CLIKCFLAGS)"
macro_append cflags " -DCLIK $(CLIKCFLAGS)"
macro_append CAMEL_linkopts " $(CLIKLIBS) "
#macro_append cppflags " -DCLIK $(CLIKCFLAGS)"
#macro_append cflags " -DCLIK $(CLIKCFLAGS)"
#macro_append CAMEL_linkopts " $(CLIKLIBS) "
#include_dirs "$(CLIKDIR)/include"
#include_dirs "$(CLIKDIR)/src"
......@@ -48,13 +49,13 @@ macro_append CAMEL_linkopts " $(CLIKLIBS) "
# PICO
macro_append cppflags " -DPICO $(PICOINC) "
macro_append CAMEL_linkopts " -L$(PICO_CODE) -lpico -lpython2.7 "
#macro_append cppflags " -DPICO $(PICOINC) "
#macro_append CAMEL_linkopts " -L$(PICO_CODE) -lpico -lpython2.7 "
# the previous line should be sufficient otherwise try the PICOLIBS
# (set in camel_setup.sh)
#macro_append CAMEL_linkopts " $(PICOLIBS)"
macro_append cppflags ' -DPICODATA=\"$(PICO_DATA)\" '
application testPico -group=test -s=../src/camel/pico/exec testPico.cc
#macro_append cppflags ' -DPICODATA=\"$(PICO_DATA)\" '
#application testPico -group=test -s=../src/camel/pico/exec testPico.cc
###FROM THERE YOU DONT NEED TO TOUCH
###########################################################################################
......
......@@ -15,18 +15,17 @@ using namespace std;
vector<double> logspace(double kmin,double kmax, int npks){
void logspace(double kmin,double kmax, int npks,vector<double>&v){
double lmax=std::log(kmax);
double lmin=std::log(kmin);
double step=(lmax-lmin)/(npks-1);
vector<double> v(npks);
v.resize(npks);
for (size_t i=0;i<npks;i++){
double lval=lmin+step*i;
v[i]=std::exp(lval);
}
return v;
}
......@@ -59,11 +58,11 @@ int main(int argc,char** argv){
classparms.add("z_pk",z0); //polar +lens+clphi
classparms.add("z_max_pk",z0); //polar +lens+clphi
int do_nl =0;
bool do_nl =false;
try{
size_t test = classparms.findIndex("non linear");
cout << " >>> CLASS nl par found !! "<< test<<endl;
do_nl = 1 ;
do_nl = true;
}catch (Message_error& msg){
cout << " >>> CLASS nl par NOT found !! " <<endl;
......@@ -180,10 +179,10 @@ int main(int argc,char** argv){
}
}
// pk
// pk
cout << "Computing P(k) at z=" << z0 << endl;
cout << "NL spectrum will" << (do_nl==0? " NOT ":" ") << "be computed" <<endl;
cout << "NL spectrum will" << (!do_nl? " NOT ":" ") << "be computed" <<endl;
//ecriture output fits
std::vector<fitscolumn> pkcols;
......@@ -192,27 +191,39 @@ int main(int argc,char** argv){
pkcols.push_back(fitscolumn("Pknl", "(1/Mpc)^-3",1,TDOUBLE));
fout.insert_bintab(pkcols);
// def values
vector<double> kval;
string kvfile=parser.params.find<string>("kval_file","");
if (kvfile.size()!=0) {
ifstream f(kvfile.c_str());
double kk;
while (f>>kk) kval.push_back(kk);
}
else{
const int npks = parser.params.find<int>("n_pks",1000);
const double kmin = parser.params.find<double>("k_beg",8.e-4);
const double kmax = parser.params.find<double>("k_end",1);
logspace(kmin,kmax,npks,kval) ;
}
const int npks = 1000 ;
const double kmin = 8.e-4;
const double kmax = 5;
vector<double> kval=logspace(kmin,kmax,npks) ;
vector<double> pklin;
vector<double> pknl ;
for (int k =0; k<npks ; k++){
for (int k =0; k<kval.size() ; k++){
double myk=kval[k];
pklin.push_back( e->get_Pk(myk, z0) );
if ( do_nl == 1) pknl.push_back( e->get_PkNL(myk, z0) );
if ( do_nl ) pknl.push_back( e->get_PkNL(myk, z0) );
}
arr<double> apk(npks);
for (size_t i=0; i<npks ; i++) apk[i]=kval[i];
arr<double> apk(kval.size());
for (size_t i=0; i<kval.size() ; i++) apk[i]=kval[i];
fout.write_column(1,apk);
for (size_t i=0; i<npks ; i++) apk[i]=pklin[i];
for (size_t i=0; i<kval.size() ; i++) apk[i]=pklin[i];
fout.write_column(2,apk);
if ( do_nl == 1){
for (size_t i=0; i<npks ; i++) apk[i]=pknl[i];
if ( do_nl ){
for (size_t i=0; i<kval.size() ; i++) apk[i]=pknl[i];
fout.write_column(3,apk);
}
......
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