-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix hashing #121
base: master
Are you sure you want to change the base?
Fix hashing #121
Conversation
Ah, so @stenczelt, while this does fix the comparison failed. Mismatched elements: 8 / 9:
Max absolute difference: 4.723046176380308e-09
Max relative difference: 2.2429495787383598e-08
Index | Obtained | Expected
(0, 0) | 0.77395605 | 0.7739560485559633 ± 1.0e-10
(0, 1) | 0.43887844 | 0.4388784397520523 ± 1.0e-10
(1, 0) | 0.69736803 | 0.6973680290593639 ± 1.0e-10
(1, 1) | 0.09417735 | 0.09417734788764953 ± 1.0e-10
(1, 2) | 0.97562235 | 0.9756223516367559 ± 1.0e-10
(2, 0) | 0.7611397 | 0.761139701990353 ± 1.0e-10
(2, 1) | 0.78606431 | 0.7860643052769538 ± 1.0e-10
(2, 2) | 0.12811363 | 0.12811363267554587 ± 1.0e-10 Since Do we want to try truncating the precision used in the hash to try to fix this? It feels slightly dangerous, but I'm not sure what the alternative is, unless we accept that this is a limitation. |
I agree it would be dangerous to truncate positions, especially since then it's not really a hash or checksum of the object but turning into some similarity metric (albeit a poor one). |
For some file formats e.g. castep-cell there's a precision option, but I'm not sure we can control it for (ext)xyz files, or more generally. Perhaps we stick with this for now as a starting point for fixing hashing, since this fixes a source of similar errors? #118 isn't resolved, but I think the existing tests do all work in the way that you would expect, including the read/write example - I don't think it's wrong to test that the hash is preserved in that example, as long as we're aware that we can't guarantee it'll always be preserved for now. |
Fixes the hasher definition, as discussed in the issue.
Also updates the deprecated
utcnow
, and tidies the code slightly.Edit:
hash_strucutre
seems fixed intest_write_and_read
, but actually I'm not sure the example in the issue quite works yet, so I'll leave this as a draft for now.