Skip to content

Commit

Permalink
Small add
Browse files Browse the repository at this point in the history
  • Loading branch information
mraveri committed Aug 12, 2020
1 parent a4bd7c1 commit e948333
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Other examples are provided for specific tasks.
mcmc_tension
gaussian_tension
chains_convergence
parameter_reporting
cosmosis_interface
utilities

Expand Down
7 changes: 7 additions & 0 deletions docs/source/parameter_reporting.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tensiometer.parameter_reporting
==================================

.. currentmodule:: tensiometer.parameter_reporting

.. automodule:: tensiometer.parameter_reporting
:members:
19 changes: 18 additions & 1 deletion tensiometer/parameter_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,28 @@
# utility functions to get mean and 1d mode:


def get_mode1d(chain, param_names):
def get_mode1d(chain, param_names, settings=None):
"""
Utility to compute the peak of the 1d posterior distribution for all
parameters (parameter 1d mode).
This depends and relies on the precomputed KDE smoothing so one can
feed different analysis settings to change that.
:param chain: :class:`~getdist.mcsamples.MCSamples` the input chain.
:param param_names: optional choice of parameter names to
restrict the calculation. Default is all parameters.
:param settings: optional dictionary with GetDist analysis settings
to use for the 1d mode calculation.
This will change the analysis settings of the chain globally.
:return: an array with the 1d mode.
"""
# initial check of parameter names:
if param_names is None:
param_names = chain.getParamNames().list()
param_names = gtens._check_param_names(chain, param_names)
# KDE settings:
if settings is not None:
chain.updateSettings(settings=settings, doUpdate=True)
# get the maximum probability from the precomputed pdf:
param_mode = []
for p in param_names:
Expand All @@ -57,6 +72,8 @@ def get_mean(chain, param_names):
#
return chain.getMeans(_indexes)

###############################################################################
#



Expand Down

0 comments on commit e948333

Please sign in to comment.