Conversation
|
I think support for this can be added in a few functions, eg I am unsure on using this in more places as it would change behaviour where units currently cancel out. |
Could set behaviour with a registry setting like |
|
For information I have au use case that made me open #2256 |
would you be willing to look through this PR and review it? |
poke @mutricyl |
|
Hey Andrew, sorry will not be available top have a look before march.
Vacation time :-/
Le dim. 15 févr. 2026, 23:57, andrewgsavage ***@***.***> a
écrit :
… *andrewgsavage* left a comment (hgrecco/pint#1993)
<#1993 (comment)>
For information I have au use case that made me open #2256
<#2256> I often use transfer
function in my industry. You have to compute the response of the system
when excited and divide it by the amplitude of the exciting process. To be
more specific vessel motion (meter) divided by wave amplitude (meter). As I
always normalize results with wave amplitude (m), I use a custom formatter
to force displaying dimensionless to m/m
would you be willing to look through this PR and review it?
poke @mutricyl <https://github.com/mutricyl>
—
Reply to this email directly, view it on GitHub
<#1993 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4JRUQC6L2VCNMND777HXC34MD2XFAVCNFSM6AAAAACUP66NKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSMBVGMZTMNRYGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
mutricyl
left a comment
There was a problem hiding this comment.
Andrew,
I have played a little bit with the NonReducing feature but I came accross the following issue:
ureg_t = UnitRegistry(auto_reduce_units=True)
ureg_f = UnitRegistry(auto_reduce_units=False)
ureg_t('1.0 kN.m') # fine: <Quantity(1.0, 'kilonewton * meter')>
ureg_f('1.0 kN.m') # NOK:
# pint\util.py", line 628, in __copy__
# out._one = self._one
# ^^^^^^^^^
# AttributeError: 'NonReducingUnitsContainer' object has no attribute '_one'
ureg_f.Unit('kN.m') # OK; <Unit('kilonewton * meter')>
ureg_f(kN) # OK: <Quantity(1, 'kilonewton')>
ureg_f('m/s/m') # NOK: same AttributeError as above in pint.util.UnitsContainer.__copy__Parsing of a new Quantity with auto_reduce_units set to false sometimes fails when it come to copy the UnitContainer. The Error is not present when auto_reduce_units is set to tue or when Unit method is used.
Co-authored-by: mutricyl <118692416+mutricyl@users.noreply.github.com>
pre-commit run --all-fileswith no errors