From b78a989e71fabc0ed9022e9a387c55dd7aaf2de6 Mon Sep 17 00:00:00 2001 From: Sevy Harris <30695172+sevyharris@users.noreply.github.com> Date: Thu, 22 Jan 2026 16:04:13 -0500 Subject: [PATCH] add warning not to initialize walkers in same starting place Add validation for walker initial positions. --- zeus/ensemble.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)