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
There is some strange behavior when using @ureg.wraps...
When I use my function without @ureg.wraps result has correct dimension and also intermediate results are correct:
sensor : 10 standard_gravity
sensor_range : 5 volt
ouput : 5 volt
without amplifier:
10.0 standard_gravity
with amplifier (10) and same volt range (5 volt):
1.0 standard_gravity
with amplifier (10) and knowing that volt range has been stretched from 5 volt to 10 volt:
0.5 standard_gravity
sensor : 25
sensor_range : 5
ouput : 5
without amplifier:
25.0
with amplifier (10) and same volt range (5):
2.5 dimensionless
with amplifier (10) and knowing that volt range has been stretched from 5 to 10:
1.25 dimensionless
which then throws an DimensionalityError: Cannot convert from 'dimensionless' (dimensionless) to 'standard_gravity'
why suddenly is this dimensionless have been calculated? well it is not wrong since volt/volt results in dimensionless, but it seems @ureg.wraps can not handle that in the end... ???
Python 3.12.0
pip 24.0
Pint 0.24.1
Regards
Schabi
The text was updated successfully, but these errors were encountered:
I found a solution. When using None within ureg.wraps the value passed should not be declared as a pint.Quantity without an unit. In my case the function works when I use amplifier = 10 instead of Q_("10")
Hi guys,
There is some strange behavior when using @ureg.wraps...
When I use my function without @ureg.wraps result has correct dimension and also intermediate results are correct:
this results in:
When I use the @ureg.wraps decorator as follows:
this results in:
which then throws an DimensionalityError: Cannot convert from 'dimensionless' (dimensionless) to 'standard_gravity'
why suddenly is this dimensionless have been calculated? well it is not wrong since volt/volt results in dimensionless, but it seems @ureg.wraps can not handle that in the end... ???
Python 3.12.0
pip 24.0
Pint 0.24.1
Regards
Schabi
The text was updated successfully, but these errors were encountered: