`add_multiple_results.py` fails
Using 47d29e5a installed under Python 3.5 I find that the add_multiple_results.py
example fails. It seems that the __add__
method of the Results()
class is failing as it can't find a samples
attribute in the class. Digging a bit deeper, somewhere between samples attribute being set here and the samplers being added the samples
attribute is being deleted by samples_to_posterior()
.
Shoud the __add__
method really be more like:
def __add__(self, other):
matches = ['sampler', 'search_parameter_keys']
for match in matches:
# The 1 and 0 here ensure that if either doesn't have a match for
# some reason, a error will be thrown.
if getattr(other, match, 1) != getattr(self, match, 0):
raise ValueError(
"Unable to add results generated with different {}".format(match))
if not hasattr(self, 'samples') and not hasattr(other, 'samples'):
if not hasattr(self, 'posterior') and not hasattr(other, 'posterior'):
raise ValueError("Unable to add results")
else:
self.posterior = pd.concat([self.posterior, other.posterior])
else:
self.samples = np.concatenate([self.samples, other.samples])
return self
Edited by Matthew Pitkin