pint icon indicating copy to clipboard operation
pint copied to clipboard

TypeError with measurements

Open mjfwest opened this issue 2 years ago • 1 comments

I think this has something to do with using numpy with measurements. Perhaps it is not supposed to work: in this case error is not MISSING, but can't be compared to 0

https://github.com/hgrecco/pint/blob/208d36a5bb051465296dad846296bb19628e2307/pint/facets/measurement/objects.py#L70

     68 if error is MISSING:
     69     mag = value
---> 70 elif error < 0:
     71     raise ValueError("The magnitude of the error cannot be negative")
     72 else:

TypeError: '<' not supported between instances of 'UnitsContainer' and 'int'

mjfwest avatar Sep 05 '22 16:09 mjfwest

Do you have a minimal example ?

jules-ch avatar Sep 06 '22 15:09 jules-ch