Commit d343e429 authored by Matthieu Tristram's avatar Matthieu Tristram
Browse files

Merge branch 'master' of https://gitlab.in2p3.fr/cosmotools/CAMEL

parents 9c845981 2eabc76a
...@@ -2,9 +2,13 @@ ...@@ -2,9 +2,13 @@
#cmt stuff #cmt stuff
if [ -z "$CMTCLASS" ] ; then if [ -z "$CMTCLASS" ] ; then
echo "CMTCLASS is undefined" echo "CMTCLASS is undefined"
exit 1 return
else else
if [ -z "$CMTPATH" ] ; then
export CMTPATH=${CMTCLASS} export CMTPATH=${CMTCLASS}
else
export CMTPATH=${CMTPATH}:${CMTCLASS}
fi
fi fi
if [ ! -f setup.sh ] ; then if [ ! -f setup.sh ] ; then
...@@ -16,18 +20,18 @@ fi ...@@ -16,18 +20,18 @@ fi
source ./setup.sh source ./setup.sh
if [ -z "$CAMELROOT" ] ; then if [ -z "$CAMELROOT" ] ; then
echo "CAMELROOT undefined ...something went wrong. do you have a requirements file?" echo "CAMELROOT undefined ...something went wrong. do you have a requirements file?"
exit 1 return
fi fi
#creating link #creating link
if [ -z "${CAMEL_DATA}" ] ; then if [ -z "${CAMEL_DATA}" ] ; then
echo "CAMEL_DATA undefined: review your installation (see http://camel.in2p3.fr/wiki/pmwiki.php?n=Main.Install)" echo "CAMEL_DATA undefined: review your installation (see http://camel.in2p3.fr/wiki/pmwiki.php?n=Main.Install)"
exit 1 return
fi fi
if [ ! -d "${CAMEL_DATA}" ] ; then if [ ! -d "${CAMEL_DATA}" ] ; then
echo "empty CAMEL_DATA directory : please fix (see http://camel.in2p3.fr/wiki/pmwiki.php?n=Main.Install)" echo "empty CAMEL_DATA directory : please fix (see http://camel.in2p3.fr/wiki/pmwiki.php?n=Main.Install)"
exit 1 return
fi fi
echo CAMEL_DATA="${CAMEL_DATA}" echo CAMEL_DATA="${CAMEL_DATA}"
......
...@@ -4,7 +4,7 @@ use class HEAD ...@@ -4,7 +4,7 @@ use class HEAD
#compiler options #compiler options
#default is gcc here are the C++ compiler options #default is gcc here are the C++ compiler options
macro cppflags " -O3 -pipe -ansi -Woverloaded-virtual -Wpedantic -Wunused -Wmaybe-uninitialized -Wno-deprecated -Wno-div-by-zero " macro cppflags " -g -pipe -ansi -Woverloaded-virtual -Wpedantic -Wunused -Wmaybe-uninitialized -Wno-deprecated -Wno-div-by-zero "
# although it may be strange we do not compile CAMEL with OMP because CLASS is not thread safe # 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 # no worries: CLASS is compiled with OMP
...@@ -13,14 +13,14 @@ macro_append cpplinkflags " -fopenmp " ...@@ -13,14 +13,14 @@ macro_append cpplinkflags " -fopenmp "
#CAMEL includes #CAMEL includes
include_dirs " ../src" include_dirs " $(CAMELROOT)/src"
include_dirs "../src/camel" include_dirs " $(CAMELROOT)/src/camel"
include_dirs "../src/Minuit2-5.28.00/src" include_dirs " $(CAMELROOT)/src/Minuit2-5.28.00/src"
include_dirs "../src/Minuit2-5.28.00/inc" include_dirs " $(CAMELROOT)/src/Minuit2-5.28.00/inc"
include_dirs "../src/cxxsupport" include_dirs "$(CAMELROOT)/src/cxxsupport"
include_dirs "../src/AbsRand" include_dirs "$(CAMELROOT)/src/AbsRand"
include_dirs "../src/camel/JLA" include_dirs "$(CAMELROOT)/src/camel/JLA"
include_dirs "../src/camel/JLA/jla_likelihood_v3/src" include_dirs "$(CAMELROOT)/src/camel/JLA/jla_likelihood_v3/src"
#cfitsio #cfitsio
...@@ -32,7 +32,7 @@ macro_append CAMEL_linkopts " -lcfitsio" ...@@ -32,7 +32,7 @@ macro_append CAMEL_linkopts " -lcfitsio"
#macro_append cppflags ' -DJLA ' #macro_append cppflags ' -DJLA '
#include_dirs "/usr/include/atlas" #include_dirs "/usr/include/atlas"
#macro_append CAMEL_linkopts " -L/usr/lib64/atlas -lcblas -llapack -ljla " #macro_append CAMEL_linkopts " -L/usr/lib64/atlas -lcblas -llapack -ljla "
#application test_jla -group=test -s=../src/camel test/test_jla.cc #application test_jla -group=test -s=$(CAMELROOT)/src/camel test/test_jla.cc
#PLANCK #PLANCK
...@@ -46,8 +46,8 @@ macro_append CAMEL_linkopts " -lcfitsio" ...@@ -46,8 +46,8 @@ macro_append CAMEL_linkopts " -lcfitsio"
#macro_append cflags " -DCLIK " #macro_append cflags " -DCLIK "
#macro_append CAMEL_linkopts "-L$(CLIKDIR)/lib -lclik " #macro_append CAMEL_linkopts "-L$(CLIKDIR)/lib -lclik "
#path_append LD_LIBRARY_PATH "$(CLIKDIR)/lib" #path_append LD_LIBRARY_PATH "$(CLIKDIR)/lib"
#application dump_clik -group=test -s=../src/camel test/test_clik.cc #application dump_clik -group=test -s=$(CAMELROOT)/src/camel test/test_clik.cc
#application dump_lensing -group=test -s=../src/camel test/test_lensing.cc #application dump_lensing -group=test -s=$(CAMELROOT)/src/camel test/test_lensing.cc
# PICO # PICO
...@@ -57,44 +57,48 @@ macro_append CAMEL_linkopts " -lcfitsio" ...@@ -57,44 +57,48 @@ macro_append CAMEL_linkopts " -lcfitsio"
# (set in camel_setup.sh) # (set in camel_setup.sh)
#macro_append CAMEL_linkopts " $(PICOLIBS)" #macro_append CAMEL_linkopts " $(PICOLIBS)"
#macro_append cppflags ' -DPICODATA=\"$(PICO_DATA)\" ' #macro_append cppflags ' -DPICODATA=\"$(PICO_DATA)\" '
#application testPico -group=test -s=../src/camel/pico/exec testPico.cc #application testPico -group=test -s=$(CAMELROOT)/src/camel/pico/exec testPico.cc
#CLASS optional FastPk access
macro_append cppflags " -DFASTPK "
###FROM THERE YOU DONT NEED TO TOUCH ###FROM THERE YOU DONT NEED TO TOUCH
########################################################################################### ###########################################################################################
#CAMEL LIBRARIES #CAMEL LIBRARIES
library Minuit -no_share ../src/Minuit2-5.28.00/src/*.cxx library Minuit -no_share $(CAMELROOT)/src/Minuit2-5.28.00/src/*.cxx
library Util -no_share -x=ddl.cc ../src/cxxsupport/*.cc library Util -no_share -x=ddl.cc $(CAMELROOT)/src/cxxsupport/*.cc
library AbsRand -no_share ../src/AbsRand/*.cc library AbsRand -no_share $(CAMELROOT)/src/AbsRand/*.cc
library CLHEP -no_share ../src/CLHEP/src/*.cc library CLHEP -no_share $(CAMELROOT)/src/CLHEP/src/*.cc
library jla -no_share ../src/camel/JLA/jla_likelihood_v3/src/ini.c ../src/camel/JLA/jla_likelihood_v3/src/jla.cc library jla -no_share $(CAMELROOT)/src/camel/JLA/jla_likelihood_v3/src/ini.c $(CAMELROOT)/src/camel/JLA/jla_likelihood_v3/src/jla.cc
macro camelsrc "*.cc CMB/*.cc BAO/*.cc Lensing/*.cc pico/*.cc JLA/*.cc Class/*.cc Constraints/*.cc" macro camelsrc "*.cc CMB/*.cc BAO/*.cc Lensing/*.cc pico/*.cc JLA/*.cc Class/*.cc Constraints/*.cc"
library MinuitFit -no_share -s=../src/camel $(camelsrc) library MinuitFit -no_share -s=$(CAMELROOT)/src/camel $(camelsrc)
library MCMC -no_share -s=../src/camel/MCMC *.cc library MCMC -no_share -s=$(CAMELROOT)/src/camel/MCMC *.cc
macro CAMEL_linkopts "-L$(CAMEL_root)/${CMTCONFIG} -lMinuitFit -lMinuit -lMCMC -lCLHEP -lAbsRand -lUtil " macro CAMEL_linkopts "-L$(CAMELROOT)/${CMTCONFIG} -lMinuitFit -lMinuit -lMCMC -lCLHEP -lAbsRand -lUtil "
macro_append cppflags ' -DRELPATH=\"$(CAMELROOT)/lik\" ' macro_append cppflags ' -DRELPATH=\"$(CAMELROOT)/lik\" '
#CAMEL applications #CAMEL applications
# pour relinker si changement: toutes les application du package # pour relinker si changement: toutes les application du package
macro CAMEL_stamps " $(PACKAGE_ROOT)/$(CMTCONFIG)/MinuitFit.stamp $(PACKAGE_ROOT)/$(CMTCONFIG)/MCMC.stamp " macro CAMEL_stamps " $(CAMELROOT)/$(CMTCONFIG)/MinuitFit.stamp $(CAMELROOT)/$(CMTCONFIG)/MCMC.stamp "
macro application_suffix "" macro application_suffix ""
#groupe exec #groupe exec
application writeChi2 -group=exec -s=../src/camel exec/writeChi2.cc application writeChi2 -group=exec -s=$(CAMELROOT)/src/camel exec/writeChi2.cc
application writeSpectra -group=exec -s=../src/camel exec/writeSpectra.cc application writeSpectra -group=exec -s=$(CAMELROOT)/src/camel exec/writeSpectra.cc
application writeSpectraPk -group=exec -s=../src/camel exec/writeSpectraPk.cc application writeSpectraPk -group=exec -s=$(CAMELROOT)/src/camel exec/writeSpectraPk.cc
application Minimize -group=exec -s=../src/camel exec/Minimize.cc application Minimize -group=exec -s=$(CAMELROOT)/src/camel exec/Minimize.cc
application Profile -group=exec -s=../src/camel exec/Profile.cc application Profile -group=exec -s=$(CAMELROOT)/src/camel exec/Profile.cc
application ScanParam -group=exec -s=../src/camel exec/ScanParam.cc application ScanParam -group=exec -s=$(CAMELROOT)/src/camel exec/ScanParam.cc
application mcmc -group=exec -s=../src/camel/MCMC exec/mainMCMC.cc application mcmc -group=exec -s=$(CAMELROOT)/src/camel/MCMC exec/mainMCMC.cc
#tests #tests
application testKlass -group=test -s=../src/camel test/testKlass.cc application testKlass -group=test -s=$(CAMELROOT)/src/camel test/testKlass.cc
application testCLHEP -group=test -s=../src/camel/test testCLHEP.cc application testCLHEP -group=test -s=$(CAMELROOT)/src/camel/test testCLHEP.cc
application testBAO -group=test -s=../src/camel/test testBAO.cc application testBAO -group=test -s=$(CAMELROOT)/src/camel/test testBAO.cc
application testHiLLiPOP -group=test -s=../src/camel/test testHiLLiPOP.cc application testHiLLiPOP -group=test -s=$(CAMELROOT)/src/camel/test testHiLLiPOP.cc
#lIST OF ALL DEPENDENCIES #lIST OF ALL DEPENDENCIES
macro_append Minimize_dependencies " MinuitFit " macro_append Minimize_dependencies " MinuitFit "
...@@ -113,5 +117,4 @@ macro_append testCLHEP_dependencies " CLHEP " ...@@ -113,5 +117,4 @@ macro_append testCLHEP_dependencies " CLHEP "
macro_append testBAO_dependencies " MinuitFit " macro_append testBAO_dependencies " MinuitFit "
macro_append testHiLLiPOP_dependencies " MinuitFit " macro_append testHiLLiPOP_dependencies " MinuitFit "
macro_append test_jla_dependencies " MinuitFit " macro_append test_jla_dependencies " MinuitFit "
macro_append testPico_dependencies " MinuitFit "
...@@ -7,20 +7,20 @@ macro cpp "icpc" ...@@ -7,20 +7,20 @@ macro cpp "icpc"
macro cppflags " -O2 -ip -ansi_alias -align -Wbrief -Wdeprecated -Wuninitialized -align -Wbrief -Wunused-function -Wpointer-arith -Wreturn-type" macro cppflags " -O2 -ip -ansi_alias -align -Wbrief -Wdeprecated -Wuninitialized -align -Wbrief -Wunused-function -Wpointer-arith -Wreturn-type"
#CAMEL includes #CAMEL includes
include_dirs " ../src" include_dirs " $(CAMELROOT)/src"
include_dirs "../src/camel" include_dirs "$(CAMELROOT)/src/camel"
include_dirs "../src/Minuit2-5.28.00/src" include_dirs "$(CAMELROOT)/src/Minuit2-5.28.00/src"
include_dirs "../src/Minuit2-5.28.00/inc" include_dirs "$(CAMELROOT)/src/Minuit2-5.28.00/inc"
include_dirs "../src/cxxsupport" include_dirs "$(CAMELROOT)/src/cxxsupport"
include_dirs "../src/AbsRand" include_dirs "$(CAMELROOT)/src/AbsRand"
include_dirs "../src/camel/JLA" include_dirs "$(CAMELROOT)/src/camel/JLA"
include_dirs "../src/camel/JLA/jla_likelihood_v3/src" include_dirs "$(CAMELROOT)/src/camel/JLA/jla_likelihood_v3/src"
#JLA :requires cblas/lapack (use intel versions) #JLA :requires cblas/lapack (use intel versions)
macro_append cppflags " -DJLA " macro_append cppflags " -DJLA "
macro_append CAMEL_linkopts " -L$(MKLROOT)/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -ljla " macro_append CAMEL_linkopts " -L$(MKLROOT)/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -ljla "
application test_jla -group=test -s=../src/camel test/test_jla.cc application test_jla -group=test -s=$(CAMELROOT)/src/camel test/test_jla.cc
#cfitsio #cfitsio
#cfitsio: here the CLIK version (below) will be used so no need #cfitsio: here the CLIK version (below) will be used so no need
...@@ -38,20 +38,20 @@ macro_append CAMEL_linkopts " $(CLIKLIBS) " ...@@ -38,20 +38,20 @@ macro_append CAMEL_linkopts " $(CLIKLIBS) "
macro_append cppflags " -DPICO $(PICOINC) " macro_append cppflags " -DPICO $(PICOINC) "
macro_append CAMEL_linkopts " $(PICOLIBS)" macro_append CAMEL_linkopts " $(PICOLIBS)"
macro_append cppflags ' -DPICODATA=\"$(PICO_DATA)\" ' macro_append cppflags ' -DPICODATA=\"$(PICO_DATA)\" '
application testPico -group=test -s=../src/camel/pico/exec testPico.cc application testPico -group=test -s=$(CAMELROOT)/src/camel/pico/exec testPico.cc
application FitClassFromPico -group=exec -s=../src/camel exec/FitClassFromPico.cc application FitClassFromPico -group=exec -s=$(CAMELROOT)/src/camel exec/FitClassFromPico.cc
#CAMEL LIBRARIES #CAMEL LIBRARIES
library Minuit -no_share ../src/Minuit2-5.28.00/src/*.cxx library Minuit -no_share $(CAMELROOT)/src/Minuit2-5.28.00/src/*.cxx
library Util -no_share -x=ddl.cc ../src/cxxsupport/*.cc library Util -no_share -x=ddl.cc $(CAMELROOT)/src/cxxsupport/*.cc
library AbsRand -no_share ../src/AbsRand/*.cc library AbsRand -no_share $(CAMELROOT)/src/AbsRand/*.cc
library CLHEP -no_share ../src/CLHEP/src/*.cc library CLHEP -no_share $(CAMELROOT)/src/CLHEP/src/*.cc
library jla -no_share ../src/camel/JLA/jla_likelihood_v3/src/ini.c ../src/camel/JLA/jla_likelihood_v3/src/jla.cc library jla -no_share $(CAMELROOT)/src/camel/JLA/jla_likelihood_v3/src/ini.c $(CAMELROOT)/src/camel/JLA/jla_likelihood_v3/src/jla.cc
macro camelsrc "*.cc CMB/*.cc BAO/*.cc Lensing/*.cc pico/*.cc JLA/*.cc Class/*.cc Constraints/*.cc" macro camelsrc "*.cc CMB/*.cc BAO/*.cc Lensing/*.cc pico/*.cc JLA/*.cc Class/*.cc Constraints/*.cc"
library MinuitFit -no_share -s=../src/camel $(camelsrc) library MinuitFit -no_share -s=$(CAMELROOT)/src/camel $(camelsrc)
library MCMC -no_share -s=../src/camel/MCMC *.cc library MCMC -no_share -s=$(CAMELROOT)/src/camel/MCMC *.cc
macro CAMEL_linkopts "-L$(CAMEL_root)/${CMTCONFIG} -lMinuitFit -lMinuit -lMCMC -lCLHEP -lAbsRand -lUtil " macro CAMEL_linkopts "-L$(CAMEL_root)/${CMTCONFIG} -lMinuitFit -lMinuit -lMCMC -lCLHEP -lAbsRand -lUtil "
macro_append cppflags ' -DRELPATH=\"$(CAMELROOT)/lik\" ' macro_append cppflags ' -DRELPATH=\"$(CAMELROOT)/lik\" '
...@@ -59,26 +59,26 @@ macro_append cppflags ' -DRELPATH=\"$(CAMELROOT)/lik\" ' ...@@ -59,26 +59,26 @@ macro_append cppflags ' -DRELPATH=\"$(CAMELROOT)/lik\" '
#CAMEL applications #CAMEL applications
# pour relinker si changement: toutes les application du package # pour relinker si changement: toutes les application du package
macro CAMEL_stamps " $(PACKAGE_ROOT)/$(CMTCONFIG)/MinuitFit.stamp $(PACKAGE_ROOT)/$(CMTCONFIG)/MCMC.stamp " macro CAMEL_stamps " $(CAMELROOT)/$(CMTCONFIG)/MinuitFit.stamp $(CAMELROOT)/$(CMTCONFIG)/MCMC.stamp "
macro application_suffix "" macro application_suffix ""
#groupe exec #groupe exec
application writeChi2 -group=exec -s=../src/camel exec/writeChi2.cc application writeChi2 -group=exec -s=$(CAMELROOT)/src/camel exec/writeChi2.cc
application writeSpectra -group=exec -s=../src/camel exec/writeSpectra.cc application writeSpectra -group=exec -s=$(CAMELROOT)/src/camel exec/writeSpectra.cc
application writeSpectraPk -group=exec -s=../src/camel exec/writeSpectraPk.cc application writeSpectraPk -group=exec -s=$(CAMELROOT)/src/camel exec/writeSpectraPk.cc
application Minimize -group=exec -s=../src/camel exec/Minimize.cc application Minimize -group=exec -s=$(CAMELROOT)/src/camel exec/Minimize.cc
application Profile -group=exec -s=../src/camel exec/Profile.cc application Profile -group=exec -s=$(CAMELROOT)/src/camel exec/Profile.cc
application ScanParam -group=exec -s=../src/camel exec/ScanParam.cc application ScanParam -group=exec -s=$(CAMELROOT)/src/camel exec/ScanParam.cc
application mcmc -group=exec -s=../src/camel/MCMC exec/mainMCMC.cc application mcmc -group=exec -s=$(CAMELROOT)/src/camel/MCMC exec/mainMCMC.cc
#tests #tests
application testKlass -group=test -s=../src/camel test/testKlass.cc application testKlass -group=test -s=$(CAMELROOT)/src/camel test/testKlass.cc
application testCLHEP -group=test -s=../src/camel/test testCLHEP.cc application testCLHEP -group=test -s=$(CAMELROOT)/src/camel/test testCLHEP.cc
application testBAO -group=test -s=../src/camel/test testBAO.cc application testBAO -group=test -s=$(CAMELROOT)/src/camel/test testBAO.cc
application testHiLLiPOP -group=test -s=../src/camel/test testHiLLiPOP.cc application testHiLLiPOP -group=test -s=$(CAMELROOT)/src/camel/test testHiLLiPOP.cc
application dump_clik -group=test -s=../src/camel test/test_clik.cc application dump_clik -group=test -s=$(CAMELROOT)/src/camel test/test_clik.cc
application dump_lensing -group=test -s=../src/camel test/test_lensing.cc application dump_lensing -group=test -s=$(CAMELROOT)/src/camel test/test_lensing.cc
#lIST OF ALL DEPENDENCIES #lIST OF ALL DEPENDENCIES
macro_append Minimize_dependencies " MinuitFit " macro_append Minimize_dependencies " MinuitFit "
......
MultipolesRange = camel_data/Hillipop/Binning/binning.fits
Beams = camel_data/Hillipop/Data/DX11d_r3_HM/LALmaskSuperExt-ConservativeCO/bell/beam
XSpectra = camel_data/Hillipop/Data/DX11d_r3_HM/LALmaskSuperExt-ConservativeCO/spectra/cross_DX11d_HM_SuperExtCO
XSpectraErrors = camel_data/Hillipop/Data/DX11d_r3_HM/LALmaskSuperExt-ConservativeCO/spectra/cross_DX11d_HM_SuperExtCO
CovMatrix = camel_data/Hillipop/Data/DX11d_r3_HM/LALmaskSuperExt-ConservativeCO/pclcvm/invfll_DX11dr3HM_SG_pack
SZ = camel_data/Hillipop/Foregrounds/ClSZ_poiss_corr_MD2_cppp_bestCl_NILC_extra12_cibps_lmax10000.fits
kSZ = camel_data/Hillipop/Foregrounds/ksz_shaw_bat_PWAS_MD_tau062.fits
CIB = camel_data/Hillipop/Foregrounds/CIB_v3
SZxCIB = camel_data/Hillipop/Foregrounds/SZxCIB
Dust = camel_data/Hillipop/Foregrounds/Dust_LALmaskSuperExt-ConservativeCO_DX11d
TT = 0
EE = 0
BB = 0
TE = 1
ET = 1
map = 6
freq0 = 100
freq1 = 100
freq2 = 143
freq3 = 143
freq4 = 217
freq5 = 217
FileOut =
...@@ -159,9 +159,10 @@ Chi2Factory::gimeChi2(Parser& parser){ ...@@ -159,9 +159,10 @@ Chi2Factory::gimeChi2(Parser& parser){
allCl->add(acte); allCl->add(acte);
} }
cout << "NUMBER OF LIKELIHOODS=" << allCl->nLik() << endl; cout << "NUMBER OF CMB LIKELIHOODS=" << allCl->nLik() << endl;
cout << "TTmax=" << allCl->getTTmax() << endl;
int lmax=allCl->getTTmax(); int lmax=allCl->getTTmax();
cout << "TTmax=" << lmax << endl;
//lensing may affect lmax too //lensing may affect lmax too
#ifdef CLIK #ifdef CLIK
...@@ -175,18 +176,10 @@ Chi2Factory::gimeChi2(Parser& parser){ ...@@ -175,18 +176,10 @@ Chi2Factory::gimeChi2(Parser& parser){
if (!fid && lensing->lmax() > lmax) lmax=lensing->lmax(); if (!fid && lensing->lmax() > lmax) lmax=lensing->lmax();
} }
#endif #endif
//overide if you want
if (parser.params.param_present("lmax")){
int Lmax=parser.params.find<int>("lmax");
if (lmax != Lmax)
cout << " WARNING your specified LMAX=" << Lmax <<" differs from the guessed TT range:" << lmax <<" use at you own risks!" << endl;
lmax=Lmax;
}
cout << "#########################################" << endl; cout << "#########################################" << endl;
cout << "Engine lmax=" << lmax << endl; cout << "Engine lmax=" << lmax << endl;
//2. creation ENGINE //2. creation ENGINE
...@@ -207,17 +200,24 @@ lmax=Lmax; ...@@ -207,17 +200,24 @@ lmax=Lmax;
//extra class params //extra class params
ClassParams classparms(parser.classparms); ClassParams classparms(parser.classparms);
//CMB //CMB
string output=""; string output="";
if (lmax>0) { if (lmax>0) {
classparms.add("l_max_scalars",lmax); classparms.add("l_max_scalars",lmax);
output+="tCl,pCl,lCl"; output="tCl,pCl,lCl";
} }
//if P(k) needed //if P(k) needed
const bool doPk=parser.params.find<bool>("do_mPk",false); const bool doPk=parser.params.find<bool>("do_mPk",false);
if (doPk) output+=",mPk";
//if pk asked or no CMB
if (doPk || lmax<2) {
output+=(output.size()==0? "mPk" : ",mPk");
}
cout << ">>> CLASS output will be: " << output << endl;
classparms.add("output",output); //polar +lens+clphi classparms.add("output",output); //polar +lens+clphi
for (size_t i=0;i<classparms.size();i++) for (size_t i=0;i<classparms.size();i++)
...@@ -230,7 +230,6 @@ lmax=Lmax; ...@@ -230,7 +230,6 @@ lmax=Lmax;
} }
cout << "CLASS \t--> precision =" << pre << endl; cout << "CLASS \t--> precision =" << pre << endl;
//le calculateur de spectres //le calculateur de spectres
//MnUserVariables upar(parser.upar); //MnUserVariables upar(parser.upar);
e=new MnClassEngine(parser.vars(), e=new MnClassEngine(parser.vars(),
...@@ -244,9 +243,10 @@ lmax=Lmax; ...@@ -244,9 +243,10 @@ lmax=Lmax;
//4. observables: //4. observables:
//rajoute l'engine aux Cl //rajoute l'engine aux Cl
allCl->setEngine(e); if (lmax>=2 ){
allCl->setEngine(e);
comb->add(allCl); comb->add(allCl);
}
//lensing //lensing
#ifdef CLIK #ifdef CLIK
......
...@@ -85,8 +85,8 @@ void ClassParams::updateVal(const unsigned& i,const string& newval) {pars[i].sec ...@@ -85,8 +85,8 @@ void ClassParams::updateVal(const unsigned& i,const string& newval) {pars[i].sec
//--------------- //---------------
// Constructors -- // Constructors --
//---------------- //----------------
ClassEngine::ClassEngine(const ClassParams& pars): cl(0),dofree(true),_hasPk(false){ ClassEngine::ClassEngine(const ClassParams& pars): cl(0),dofree(true),pvecback(0){
_lmax=-1; //default _lmax=-1; //default
cout << "Running CLASS version " << _VERSION_ << endl; cout << "Running CLASS version " << _VERSION_ << endl;
...@@ -108,13 +108,13 @@ ClassEngine::ClassEngine(const ClassParams& pars): cl(0),dofree(true),_hasPk(fal ...@@ -108,13 +108,13 @@ ClassEngine::ClassEngine(const ClassParams& pars): cl(0),dofree(true),_hasPk(fal
istringstream strstrm(pars.value(i)); istringstream strstrm(pars.value(i));
strstrm >> _lmax; strstrm >> _lmax;
} }
if (pars.key(i)=="output") { //store class output
if (pars.value(i).find("mPk") != std::string::npos) _hasPk=true; if (pars.key(i)=="output") _output=pars.value(i);
}
}
cout << __FILE__ << " : using lmax=" << _lmax <<endl;
assert(_lmax>0);
//is nonlinear set
if (pars.key(i)=="non linear") _nonlin=true;
}
//input //input
if (input_init(&fc,&pr,&ba,&th,&pt,&tr,&pm,&sp,&nl,&le,&op,_errmsg) == _FAILURE_) if (input_init(&fc,&pr,&ba,&th,&pt,&tr,&pm,&sp,&nl,&le,&op,_errmsg) == _FAILURE_)
throw invalid_argument(_errmsg); throw invalid_argument(_errmsg);
...@@ -134,7 +134,7 @@ ClassEngine::ClassEngine(const ClassParams& pars): cl(0),dofree(true),_hasPk(fal ...@@ -134,7 +134,7 @@ ClassEngine::ClassEngine(const ClassParams& pars): cl(0),dofree(true),_hasPk(fal
} }
ClassEngine::ClassEngine(const ClassParams& pars,const string & precision_file): cl(0),dofree(true),_hasPk(false){ ClassEngine::ClassEngine(const ClassParams& pars,const string & precision_file): cl(0),dofree(true),pvecback(0){
cout << "Running CLASS version " << _VERSION_ << endl; cout << "Running CLASS version " << _VERSION_ << endl;
...@@ -162,17 +162,12 @@ ClassEngine::ClassEngine(const ClassParams& pars,const string & precision_file): ...@@ -162,17 +162,12 @@ ClassEngine::ClassEngine(const ClassParams& pars,const string & precision_file):
istringstream strstrm(pars.value(i)); istringstream strstrm(pars.value(i));
strstrm >> _lmax; strstrm >> _lmax;
} }
if (pars.key(i)=="output") { //store class output
if (pars.value(i).find("mPk") != std::string::npos) { if (pars.key(i)=="output") _output=pars.value(i);
_hasPk=true; //is nonlinear set?
cout << "found Pk: status" << (int)hasPk() << endl; if (pars.key(i)=="non linear") _nonlin=true;
}
}
}
cout << __FILE__ << " : using lmax=" << _lmax <<endl;
assert(_lmax>0);
}
//concatenate both //concatenate both
if (parser_cat(&fc_input,&fc_precision,&fc,_errmsg) == _FAILURE_) throw invalid_argument(_errmsg); if (parser_cat(&fc_input,&fc_precision,&fc,_errmsg) == _FAILURE_) throw invalid_argument(_errmsg);
...@@ -276,11 +271,14 @@ int ClassEngine::class_main( ...@@ -276,11 +271,14 @@ int ClassEngine::class_main(
return _FAILURE_; return _FAILURE_;
} }
delete [] pvecback;
if (background_init(ppr,pba) == _FAILURE_) { if (background_init(ppr,pba) == _FAILURE_) {
printf("\n\nError running background_init \n=>%s\n",pba->error_message); printf("\n\nError running background_init \n=>%s\n",pba->error_message);
dofree=false; dofree=false;
return _FAILURE_; return _FAILURE_;
} }
pvecback=new double[ba.bg_size];
if (thermodynamics_init(ppr,pba,pth) == _FAILURE_) { if (thermodynamics_init(ppr,pba,pth) == _FAILURE_) {
printf("\n\nError in thermodynamics_init \n=>%s\n",pth->error_message); printf("\n\nError in thermodynamics_init \n=>%s\n",pth->error_message);
...@@ -530,62 +528,56 @@ double ClassEngine::get_f(double z) ...@@ -530,62 +528,56 @@ double ClassEngine::get_f(double z)
{ {
double tau; double tau;
int index; int index;
double *pvecback;
//transform redshift in conformal time //transform redshift in conformal time
background_tau_of_z(&ba,z,&tau); background_tau_of_z(&ba,z,&tau);
//pvecback must be allocated
pvecback=(double *)malloc(ba.bg_size*sizeof(double));