Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
cosmotools
CAMEL
Commits
32c7dfca
Commit
32c7dfca
authored
Jun 25, 2019
by
Plaszczynski Stephane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some nice features from v3_euclid
parent
e1756e02
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
16 deletions
+19
-16
src/camel/Class/ClassEngine.cc
src/camel/Class/ClassEngine.cc
+1
-3
src/camel/Class/MnClassEngine.hh
src/camel/Class/MnClassEngine.hh
+1
-1
src/camel/Lensing/Chi2Lensing.hh
src/camel/Lensing/Chi2Lensing.hh
+1
-1
src/camel/MCMC/MCMC_adaptive.cc
src/camel/MCMC/MCMC_adaptive.cc
+2
-1
src/camel/MCMC/MCMC_sampler.cc
src/camel/MCMC/MCMC_sampler.cc
+2
-2
src/camel/MCMC/MCMC_sampler.hh
src/camel/MCMC/MCMC_sampler.hh
+2
-2
src/camel/MCMC/exec/mainMCMC.cc
src/camel/MCMC/exec/mainMCMC.cc
+10
-6
No files found.
src/camel/Class/ClassEngine.cc
View file @
32c7dfca
...
...
@@ -654,7 +654,6 @@ double ClassEngine::get_Dv(double z)
//call to fill pvecback
background_at_tau
(
&
ba
,
tau
,
ba
.
long_info
,
ba
.
inter_normal
,
&
index
,
pvecback
);
double
H_z
=
pvecback
[
ba
.
index_bg_H
];
double
D_ang
=
pvecback
[
ba
.
index_bg_ang_distance
];
#ifdef DBUG
...
...
@@ -663,8 +662,7 @@ double ClassEngine::get_Dv(double z)
#endif
double
D_v
;
D_v
=
pow
(
D_ang
*
(
1
+
z
),
2
)
*
z
/
H_z
;
D_v
=
pow
(
D_v
,
1.
/
3.
);
D_v
=
std
::
pow
(
D_ang
*
(
1
+
z
)
*
D_ang
*
(
1
+
z
)
*
z
/
H_z
,
1.
/
3.
);
#ifdef DBUG
cout
<<
D_v
<<
endl
;
#endif
...
...
src/camel/Class/MnClassEngine.hh
View file @
32c7dfca
...
...
@@ -38,7 +38,7 @@ public:
const
std
::
string
&
prefile
);
// destructor
~
MnClassEngine
();
virtual
~
MnClassEngine
();
//this will update the CLASS computations for a realization of par
//conistent with the MnUserVariables
...
...
src/camel/Lensing/Chi2Lensing.hh
View file @
32c7dfca
...
...
@@ -35,7 +35,7 @@ public:
Chi2Lensing
(
LensingLikelihood
*
ll
,
const
Variables
&
pars
,
Engine
*
_klass
);
// destructor
~
Chi2Lensing
();
virtual
~
Chi2Lensing
();
//operator to override: must return something comptible with -2log(L)
double
chi2_eff
(
const
std
::
vector
<
double
>&
par
)
const
;
...
...
src/camel/MCMC/MCMC_adaptive.cc
View file @
32c7dfca
...
...
@@ -323,7 +323,8 @@ void MCMC_adaptive::fill_chain(pdf* target_func, pdf* proposal,int init_step, co
int
gate
=
_bunchSize
;
if
(
i
%
gate
==
0
)
{
if
(
_verbose
)
cout
<<
"dump at index "
<<
i
<<
" from "
<<
i
-
gate
<<
" to "
<<
i
-
1
<<
endl
;
//if (_verbose) cout << "dump at index " << i << " from " << i-gate << " to " << i-1 << endl;
cout
<<
i
<<
" written"
<<
endl
;
chain_running
.
open
(
chain_run_name
,
fstream
::
app
);
for
(
int
k
=
i
-
gate
;
k
<
i
;
k
++
)
...
...
src/camel/MCMC/MCMC_sampler.cc
View file @
32c7dfca
...
...
@@ -136,7 +136,7 @@ void MCMC_sampler::write_chain(char* str)
}
void
MCMC_sampler
::
write_if_useful
(
vector
<
double
>&
vec
,
char
*
str
)
void
MCMC_sampler
::
write_if_useful
(
vector
<
double
>&
vec
,
const
char
*
str
)
{
cout
<<
"output written in:"
<<
str
<<
endl
;
...
...
@@ -149,7 +149,7 @@ void MCMC_sampler::write_if_useful(vector<double>& vec,char* str)
}
void
MCMC_sampler
::
write_vecHep
(
vector
<
HepVector
>&
vec
,
char
*
str
)
void
MCMC_sampler
::
write_vecHep
(
vector
<
HepVector
>&
vec
,
const
char
*
str
)
{
cout
<<
"output written in:"
<<
str
<<
endl
;
...
...
src/camel/MCMC/MCMC_sampler.hh
View file @
32c7dfca
...
...
@@ -67,8 +67,8 @@ public:
void
compute_mean
(
int
stop
,
HepVector
mean
);
void
write_rearranged_chain
(
char
*
str
);
//rec, value, lkh
void
set_par
(
Parser
parser
);
// set parameters value using Parser
void
write_if_useful
(
std
::
vector
<
double
>&
vec
,
char
*
str
);
void
write_vecHep
(
std
::
vector
<
HepVector
>&
vec
,
char
*
str
);
void
write_if_useful
(
std
::
vector
<
double
>&
vec
,
const
char
*
str
);
void
write_vecHep
(
std
::
vector
<
HepVector
>&
vec
,
const
char
*
str
);
//accessors
...
...
src/camel/MCMC/exec/mainMCMC.cc
View file @
32c7dfca
...
...
@@ -48,7 +48,12 @@ int main(int argc, char *argv[])
std
::
cout
<<
"output file "
+
fileName
+
" already exists: removing it"
<<
endl
;
remove_file
(
fileName
);
}
string
ar_file
=
string
(
"ar_vs_length_"
)
+
fileName
;
string
scale_file
=
string
(
"scale_"
)
+
fileName
;
string
cor_file
=
string
(
"prop_cov_"
)
+
fileName
;
cout
<<
"output files:"
<<
endl
;
cout
<<
ar_file
<<
" "
<<
scale_file
<<
" "
<<
cor_file
<<
" "
<<
endl
;
//MCMC specific parameters
const
string
algo
=
parser
.
params
.
find
<
string
>
(
"algo"
,
"ada"
);
...
...
@@ -151,8 +156,7 @@ int main(int argc, char *argv[])
if
(
use_ext_cov
)
{
cout
<<
"Read proposal cov matrix.."
<<
endl
;
cout
<<
proposal_cov
.
c_str
()
<<
endl
;
cout
<<
"Read proposal cov matrix="
<<
proposal_cov
.
c_str
()
<<
endl
;
proposal
->
set_cov
(
proposal_cov
.
c_str
());
}
else
{
...
...
@@ -245,21 +249,21 @@ int main(int argc, char *argv[])
{
ar_vs_length
.
push_back
(
chain
->
acc_rate
(
0
,
step
));}
}
chain
->
write_if_useful
(
ar_vs_length
,
"
ar_
vs_length.txt"
);
chain
->
write_if_useful
(
ar_vs_length
,
ar_
file
.
c_str
()
);
if
(
algo
==
"ada"
)
{
MCMC_adaptive
*
ada
=
dynamic_cast
<
MCMC_adaptive
*>
(
chain
);
chain
->
write_if_useful
(
proposal
->
_scale_vs_length
,
"
scale_
vs_length.txt"
);
chain
->
write_if_useful
(
proposal
->
_scale_vs_length
,
scale_
file
.
c_str
()
);
ofstream
f
(
"
cor
r.txt"
);
ofstream
f
(
cor
_file
.
c_str
()
);
if
(
!
f
)
{
cout
<<
"Error in file creation!"
;
}
f
<<
ada
->
mean
()
<<
endl
//mean
<<
proposal
->
Get_cov_matrix
()
<<
endl
;
//cov matrix
f
.
close
();
cout
<<
"
output written in:corr.txt"
<<
endl
;;
cout
<<
"
proposal cov written in "
<<
cor_file
<<
endl
;;
}
delete
chi2
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment