The left_edge and right_edge variables defined in minimum_credible_intervals() (under the analyze.py module, line 780) are computed based on numpy.max(). From the documentation:
$ python -c "import numpy; help(numpy.max)"
<...>
amax(a, axis=None, out=None, keepdims=<class numpy._globals._NoValue>)
Return the maximum of an array or maximum along an axis.
Hence, given a float x, numpy.max(x, 0.) is always equal to x. In particular, it can be negative and decrease the norm variable (lines 797-798). Furthermore, passing a float index is deprecated since Numpy v1.12, which causes me the following error whenever analysing a chain with Numpy v1.12:
<...>
File "/home/francesco/Documents/Codes/montepython-all/montepython_public/montepython/analyze.py", line 791, in minimum_credible_intervals
left_edge = np.max(histogram[0] - 0.5*(histogram[1]-histogram[0]), 0.)
File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 2249, in amax
return amax(axis=axis, out=out, **kwargs)
File "/usr/lib/python2.7/dist-packages/numpy/core/_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
TypeError: 'float' object cannot be interpreted as an index
As far as I can tell, numpy.max(x, 0.) should be replaced by max(x, 0.) when computing left_edge and right_edge?
Hi!
The
left_edge
andright_edge
variables defined inminimum_credible_intervals()
(under theanalyze.py
module, line 780) are computed based onnumpy.max()
. From the documentation:Hence, given a float
x
,numpy.max(x, 0.)
is always equal tox
. In particular, it can be negative and decrease thenorm
variable (lines 797-798). Furthermore, passing a float index is deprecated since Numpy v1.12, which causes me the following error whenever analysing a chain with Numpy v1.12:As far as I can tell,
numpy.max(x, 0.)
should be replaced bymax(x, 0.)
when computingleft_edge
andright_edge
?Thanks, Francesco