mdanalysis
mdanalysis copied to clipboard
Add optional dtype argument to box routines
Fixes #3500
Changes made in this Pull Request:
- Add an optional dtype argument to the box routines.
As we don't guarantee the input is an ndarray we can't pass the dtype on from the input array. Regardless the compulsory squash to np.float32 has been removed and a dtype can be specified if required.
The previous behaviour is still preserved with np.float32 being the default.
PR Checklist
- [x] Tests?
- [X] Docs?
- [x] CHANGELOG updated?
- [X] Issue raised/referenced?
test please
sorry should have made draft
Codecov Report
Base: 94.31% // Head: 94.31% // No change to project coverage :thumbsup:
Coverage data is based on head (
3bb9048) compared to base (ba491be). Patch coverage: 100.00% of modified lines in pull request are covered.
:exclamation: Current head 3bb9048 differs from pull request most recent head 640498f. Consider uploading reports for the commit 640498f to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## develop #3544 +/- ##
========================================
Coverage 94.31% 94.31%
========================================
Files 192 192
Lines 24781 24781
Branches 3341 3341
========================================
Hits 23371 23371
Misses 1362 1362
Partials 48 48
| Impacted Files | Coverage Δ | |
|---|---|---|
| package/MDAnalysis/lib/mdamath.py | 100.00% <100.00%> (ø) |
|
| package/MDAnalysis/lib/util.py | 90.98% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Could there be a test to make sure the type of the positions is not affected when a method like
AtomGroup.wrap, that uses both positions and the box, is called?
can do! I'll fix changelog also.
@jbarnoud you make a really good point in that if an np.float64 box is passed, any mixed precision box-coordinate operations can promote the result to np.float64, which may have flow on effects. I will investigate further.
This is basically dependent on decisions in #3707
Given discussion on #3545 #3707 and #3797 I think there is some support gathering to push forward on this. I will add the tests that @jbarnoud was asking for and we can go from there.
Hello @hmacdope! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
- In the file
testsuite/MDAnalysisTests/lib/test_util.py:
Line 2187:1: E302 expected 2 blank lines, found 1 Line 2194:1: W293 blank line contains whitespace
Comment last updated at 2022-08-31 07:56:45 UTC
It seems you can set the coordinates to be np.float64 at least for the memoryreader, ill dig into it.
Seems like tests were still broken when we last got to a review here, what needs to get done to get this merged @hmacdope ?
@IAlibay @tylerjereddy I think the issue was thaty you can get coordinate array promotion, I will investigate.