I've been getting dynesty errors from nan loglikelihoods during construction of the Dynesty sampler object. I was stepping through the bilby internals with pdb and was finding that the nan loglikelihoods were happening in `get_initial_points_from_prior`

in the `base_sampler.py`

. I was confused as to why the function `check_draw`

wasn't preventing `theta`

's which produce nan loglikelihoods from being added to the returned list. I believe the reason is a bug in `check_draw`

, which has the following implementation.

```
def check_draw(self, theta, warning=True):
bad_values = [np.inf, np.nan_to_num(np.inf), np.nan]
if abs(self.log_prior(theta)) in bad_values:
if warning:
logger.warning('Prior draw {} has inf prior'.format(theta))
return False
if abs(self.log_likelihood(theta)) in bad_values:
if warning:
logger.warning('Prior draw {} has inf likelihood'.format(theta))
return False
return True
```

However, nan's don't behave as other values with respect to equality. `nan != nan`

is `True`

, so if `self.log_likelihood(theta)`

is nan, then the check becomes `abs(np.nan) in [np.nan]`

which is `False`

, so the function returns `True`

when it shouldn't.