diff --git a/zeus/ensemble.py b/zeus/ensemble.py index 4242d87..368986a 100644 --- a/zeus/ensemble.py +++ b/zeus/ensemble.py @@ -494,6 +494,9 @@ def sample(self, if not np.all(np.isfinite(Z)): raise ValueError('Invalid walker initial positions! \n' + 'Initialise walkers from positions of finite log probability.') + if self.nwalkers > 1 and (X == X[0]).all(): + raise ValueError('Invalid walker initial positions! \n' + + 'Initialise walkers from different starting positions.') batch = list(np.arange(self.nwalkers)) # Extend saving space @@ -724,4 +727,4 @@ def sample(self, class sampler(EnsembleSampler): def __init__(self, *args, **kwargs): logging.warning('The sampler class has been deprecated. Please use the new EnsembleSampler class.') - super().__init__(*args, **kwargs) \ No newline at end of file + super().__init__(*args, **kwargs)