-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unyt
breaking changes
#6
Comments
we probably also need a minimum |
@JBorrow could that break things in swiftsimio too? Overall, unyt has some dangerous behaviours when comparing to 0 or when handling single elements. It's not a bad thing if they become more pedantic. But it means we have to be more careful too. |
I did raise this on the |
I agree that a silent change in behaviour is not great. :) |
I guess this is because the 0 has dissimilar units...? |
It must be. Bert had sanitized part of our pipeline code relying on sSFR < 0.01 (with no units on the RHS) which would now likely fail. Though if they intended that fix, throwing an exception of non-matchin units rather than returning false would be better. |
Yeah, that is what usually happens when comparing to another unyt quantity, but not with constants. That would probably be the best behaviour. |
(unrelated) The other gotcha we often hit is that when accessing single elements of an array no type check is done. That's dangerous. Though I have been too lazy to open an issue on their side. |
Indeed and doing assignments, e.g.
doesn't convert units... |
This should fix it, was regarded as a unintentional change: yt-project/unyt#371 Can close, though maybe worthwhile discussion of how we do these comparisons? Should we open a separate issue or keep this open? Or memory-hole the whole episode? |
I got motivated to list my grievances on their github... |
OK! closing this... |
Wait should we not list unyt==2.9.2 as an actual dependency? |
Given that John appears to have fixed the core issue, I'd recommend close this. |
I have been wrestling with SOAP issues, and realised that the most recent
unyt
version introduces breaking changes, such as breaking zero comparison, as in e.g.SOAP/mask_cells.py
Line 30 in 0aec352
in
unyt v2.9.2
this comparison yieldsTrue
for a0 dimensionless
entry, butFalse
inv2.9.4
This can be seen using
unyt
alone, first withunyt
2.9.4
:Then with
unyt
2.9.2
(latest previous version tested):comparing
i.value == 0
yieldsTrue
s in both cases, but my short term suggestion is to modifyrequirements.txt
to limitunyt<=2.9.2
as I don't know how pervasive the issue is (and know from testing this zero comparison issue comes up elsewhere).The text was updated successfully, but these errors were encountered: