Skip to content
Snippets Groups Projects
Commit 7ddbcf6d authored by Colm Talbot's avatar Colm Talbot
Browse files

Revert "Make initial draw checking more robust"

This reverts commit 1a35249c
parent 1a35249c
No related branches found
No related tags found
No related merge requests found
Pipeline #107875 passed
......@@ -439,11 +439,7 @@ class Sampler(object):
return np.array(unit_cube), np.array(parameters), np.array(likelihood)
def check_draw(self, theta, warning=True):
"""
Checks if the draw will generate an infinite or nan prior or likelihood
This also identifies if the likelihood/prior have been passed through
`np.nan_to_num`.
""" Checks if the draw will generate an infinite prior or likelihood
Parameters
----------
......@@ -456,12 +452,11 @@ class Sampler(object):
True if the likelihood and prior are finite, false otherwise
"""
bad_values = [np.inf, np.nan_to_num(np.inf), np.nan]
if abs(self.log_prior(theta)) in bad_values:
if np.isinf(self.log_prior(theta)):
if warning:
logger.warning('Prior draw {} has inf prior'.format(theta))
return False
if abs(self.log_likelihood(theta)) in bad_values:
if np.isinf(self.log_likelihood(theta)):
if warning:
logger.warning('Prior draw {} has inf likelihood'.format(theta))
return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment