incompatibility when multiplying a unit by a numpy.float64
- Dominant language
- Python
- Stars
- 66
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
This code:
import numpy as np
import scimath
from scimath.units.time import second
print 'version = ',scimath.**version**
t = 3.0 \* second
k = 1.0 / second
print 4 \* t
print t \* np.exp(-k*t)
gives this error:
version = 4.1.0
12.0_s
Traceback (most recent call last):
File "C:\users\jkitchin\Dropbox.spyder2.temp.py", line 19, in
print t \* np.exp(-k_t)
File "C:\Python27\lib\site-packages\scimath\units\unit.py", line 78, in **mul**
value = self.value \* other.value
AttributeError: 'numpy.float64' object has no attribute 'value'
the problem seems to be the return value from the np.exp is missing the value attribute.
this works fine:
print t \* float(np.exp(-k*t))
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.