Adding sample to existing SamplesDict
The purpose of this MR is to fix a small bug in the SamplesDict
class when trying to add a new sample to an existing SamplesDict object. An example traceback can be seen below:
>>> from pesummary.utils.samples_dict import SamplesDict
>>> f = SamplesDict({"a": 1, "b": 2})
>>> f["c"] = 3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "../pesummary/pesummary/utils/samples_dict.py", line 138, in __setitem__
self.samples = np.vstack([self.samples, value])
File "<__array_function__ internals>", line 180, in vstack
File "../python3.8/site-packages/numpy/core/shape_base.py", line 282, in vstack
return _nx.concatenate(arrs, 0)
File "<__array_function__ internals>", line 180, in concatenate
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 2 and the array at index 1 has size 1
This bug does not occur when 1 and 2 are list/arrays:
>>> f = SamplesDict({"a": [1], "b": [2]})
>>> f["c"] = [3]
>>>