Closed leonardoghizoni closed 4 years ago
This appears to be a problem of the astropy.units package, which is used for physical units support (in particular logarithmic units). What astropy
version do you have installed? On recent versions of astropy
the problem disappeared (at least on my machine). A (nasty) work-around has always been to force the unit to the linear-scale first, e.g.,
(-total_atten).to(cnv.dimless).value
would be equivalent to
(1 / total_atten.to(cnv.dimless)).value
The path attenuation example returns an error for the gain computation:
File "pathattenuation.py", line 32, in
axes[0, 1].plot(_freqs, (-total_atten).to(cnv.dimless).value, linestyle, label=label)
File "/home/lghizoni/.local/lib/python3.6/site-packages/astropy/units/function/core.py", line 574, in __array_ufunc
.format(function.name__))
astropy.units.core.UnitTypeError: Cannot use ufunc 'negative' with function quantities
The problem seems to be the "(-total_atten)"