mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

Add optional dtype argument to box routines

Open hmacdope opened this issue 3 years ago • 10 comments
trafficstars

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?

hmacdope avatar Feb 23 '22 23:02 hmacdope

test please

sorry should have made draft

hmacdope avatar Feb 23 '22 23:02 hmacdope

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.

codecov[bot] avatar Feb 23 '22 23:02 codecov[bot]

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.

hmacdope avatar Mar 14 '22 23:03 hmacdope

@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.

hmacdope avatar Mar 19 '22 00:03 hmacdope

This is basically dependent on decisions in #3707

hmacdope avatar Jul 23 '22 02:07 hmacdope

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.

hmacdope avatar Aug 31 '22 05:08 hmacdope

Hello @hmacdope! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

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

pep8speaks avatar Aug 31 '22 07:08 pep8speaks

It seems you can set the coordinates to be np.float64 at least for the memoryreader, ill dig into it.

hmacdope avatar Aug 31 '22 07:08 hmacdope

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 avatar Sep 02 '23 11:09 IAlibay

@IAlibay @tylerjereddy I think the issue was thaty you can get coordinate array promotion, I will investigate.

hmacdope avatar Oct 07 '23 05:10 hmacdope