Open SamG-01 opened 2 years ago
I am having the same issue! Is there any intention to add this functionality?
I followed the error. It turns out that Measurement
in pint only defines a ufloat. In order to remove this error, you need to define the Measurement
with an uncertainty.unumpy.uarray instead. I am not sure what the correct pint-ian(?) way of implementing an uncertainty.unumpy.uarray
would be.
Related side-note: There is another error raised if you add a list of std_dev instead of a single std_dev : ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
That comes from the if error < 0: ...
line, which could be replaced by if np.any(error < 0): ...
to alleviate the issue.
I want to build an array with Measurements 1 +/- 0.1 km, 2 +/- 0.1 km, and 3 +/- 0.1 km. I start with the list
[1, 2, 3]
and the error0.1
, so I try to make a Measurement object:However, this returns an error
AttributeError: 'list' object has no attribute 'strip'
fromuncertainties/core.py
.Other than a manual loop
, the only way to get something close (but not quite sufficient) is to create a Quantity instead (see #1614):