You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AttributeError: 'decimal.Decimal' object has no attribute 'log'. Did you mean: 'logb'?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/plasmahh/src/python/./uhash.py", line 8, in <module>
uset.add(db)
File "/home/plasmahh/.local/lib/python3.11/site-packages/pint/facets/plain/quantity.py", line 283, in __hash__
self_base = self.to_base_units()
^^^^^^^^^^^^^^^^^^^^
File "/home/plasmahh/.local/lib/python3.11/site-packages/pint/facets/plain/quantity.py", line 566, in to_base_units
magnitude = self._convert_magnitude_not_inplace(other)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/plasmahh/.local/lib/python3.11/site-packages/pint/facets/plain/quantity.py", line 472, in _convert_magnitude_not_inplace
return self._REGISTRY.convert(self._magnitude, self._units, other)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/plasmahh/.local/lib/python3.11/site-packages/pint/facets/plain/registry.py", line 1036, in convert
return self._convert(value, src, dst, inplace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/plasmahh/.local/lib/python3.11/site-packages/pint/facets/context/registry.py", line 404, in _convert
return super()._convert(value, src, dst, inplace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/plasmahh/.local/lib/python3.11/site-packages/pint/facets/nonmultiplicative/registry.py", line 266, in _convert
value = self._units[src_offset_unit].converter.to_reference(value, inplace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/plasmahh/.local/lib/python3.11/site-packages/pint/facets/nonmultiplicative/definitions.py", line 115, in to_reference
value = self.scale * exp(log(self.logbase) * (value / self.logfactor))
^^^^^^^^^^^^^^^^^
TypeError: loop of ufunc does not support argument 0 of type decimal.Decimal which has no callable log method
when numpy is used as numpy.log does not seem to have decimal support. Using math.log instead works:
>>> import decimal,numpy,math
>>> d=decimal.Decimal(1)
>>> math.log(d)
0.0
>>> numpy.log(d)
AttributeError: 'decimal.Decimal' object has no attribute 'log'. Did you mean: 'logb'?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: loop of ufunc does not support argument 0 of type decimal.Decimal which has no callable log method
>>>
The text was updated successfully, but these errors were encountered:
Running code like this:
leads to the error:
when numpy is used as numpy.log does not seem to have decimal support. Using math.log instead works:
The text was updated successfully, but these errors were encountered: