diff --git a/bilby/core/prior/dict.py b/bilby/core/prior/dict.py index c2aa966505254fdba9d9dd44b08c9f9e423ca69f..ca2eed960589fe5cb8d0bdfc05ca470fa00dfce5 100644 --- a/bilby/core/prior/dict.py +++ b/bilby/core/prior/dict.py @@ -364,6 +364,12 @@ class PriorDict(dict): return sample else: needed = np.prod(size) + constraint_keys = list() + for ii, key in enumerate(keys[-1::-1]): + if isinstance(self[key], Constraint): + constraint_keys.append(-ii - 1) + for ii in constraint_keys[-1::-1]: + del keys[ii] all_samples = {key: np.array([]) for key in keys} _first_key = list(all_samples.keys())[0] while len(all_samples[_first_key]) < needed: