Skip to content

Commit 6c4b10f

Browse files
committed
added include_fixed_parameter_priors option
1 parent 3055f72 commit 6c4b10f

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

batch2/common.ini

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ data_dir = %LOCALDIR%data/
99
INCLUDE(likelihood.ini)
1010
INCLUDE(params_CMB_defaults.ini)
1111

12+
#whether to include prior on a parameter if it has non-varying value
13+
include_fixed_parameter_priors = F
14+
1215
#Feedback level ( 2=lots,1=chatty,0=none)
1316
feedback = 1
1417

docs/readme.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ <H3>Running the GetDist program</H3>
572572
<LI>CAMB updated to May 2016 version (including HMCode Halofit support)
573573
<LI>Added DR12 BAO (in batch3/, thanks Tom Charnock)
574574
<LI>Added batch3/HST_Riess2016.ini
575-
<LI>Latest getdist version and small fixes
575+
<LI>Added <b>include_fixed_parameter_priors</b> input option (default false, as before)
576+
<LI>Latest <A HREF="https://pypi.python.org/pypi/GetDist/">GetDist</A> version and small fixes
576577
</UL>
577578

578579
<LI><B>July 2015</B><BR>

source/BaseParameters.f90

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module BaseParameters
2727
logical :: use_fast_slow = .false.
2828
integer :: num_fast, num_slow
2929
integer :: num_semi_fast, num_semi_slow
30+
logical :: include_fixed_parameter_priors = .false.
3031
real(mcp), allocatable :: PMin(:), PMax(:), StartWidth(:), PWidth(:), center(:)
3132
logical(mcp), allocatable :: varying(:)
3233
logical :: block_semi_fast = .true.
@@ -166,11 +167,12 @@ subroutine TBaseParameters_ReadPriors(this,Ini)
166167
Type(TSettingIni) :: Combs
167168
integer params(num_params), num_lin
168169

170+
call Ini%Read('include_fixed_parameter_priors',this%include_fixed_parameter_priors)
169171
allocate(this%GaussPriors%std(num_params))
170172
allocate(this%GaussPriors%mean(num_params))
171173
this%GaussPriors%std=0 !no priors by default
172174
do i=1,num_params
173-
if (this%varying(i)) then
175+
if (this%varying(i) .or. this%include_fixed_parameter_priors) then
174176
InLine = this%NameMapping%ReadIniForParam(Ini,'prior',i)
175177
if (InLine/='') then
176178
read(InLine, *, iostat=status) this%GaussPriors%mean(i), this%GaussPriors%std(i)

source/calclike.f90

+3-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ function GetLogPriors(this, P) result(logLike)
116116

117117
logLike=0
118118
do i=1,num_params
119-
if (BaseParams%varying(i) .and. BaseParams%GaussPriors%std(i)/=0) then
120-
logLike = logLike + ((P(i)-BaseParams%GaussPriors%mean(i))/BaseParams%GaussPriors%std(i))**2
119+
if ((BaseParams%varying(i) .or. BaseParams%include_fixed_parameter_priors) &
120+
.and. BaseParams%GaussPriors%std(i)/=0) then
121+
logLike = logLike + ((P(i)-BaseParams%GaussPriors%mean(i))/BaseParams%GaussPriors%std(i))**2
121122
end if
122123
end do
123124

test_planck.ini

+3
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ DEFAULT(batch2/lowTEB.ini)
99
#Other settings same as test.ini
1010
DEFAULT(test.ini)
1111

12+
#Uncomment if you want to include priors even when parameters fixed
13+
#include_fixed_parameter_priors = T
14+
1215
#expected result for -(log like)
1316
test_check_compare = 5859.141

0 commit comments

Comments
 (0)