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
write a test for spherical selections tokens using the periodic kdtree #1733
write a test for spherical selections tokens using the periodic kdtree #1733
Conversation
This looks like it'll be a good addition. If we can get the kdtree version of all selections working, we should probably make that the only option. |
@richardjgowers I just opened issue #1736 to test cylindrical selections 😄 |
@orbeckst @richardjgowers I'm running into a bit of a problem here. |
The trajectory was simulated without PBC. If you need a trajectory with PBC, use TPR/XTC. You could fudge the PSF/DCD test by setting the dimensions to some reasonable value before doing the selections. ( Incidentally, failing with undefined box is a good corner case to catch. |
@orbeckst So do I understand that if I load a trajectory with no PBC, MDAnalysis will always assign |
Yes, that's what we put when there is no box. |
OK, then I'll insert a box checking to prevent the combination of |
Isn't this more a quirk of the topology file saying the box is 0,0,0 rather
than Mda saying it? I'll look into this before we uglify the code with
checks
…On Tue, 12 Dec 2017, 11:48 p.m. Jose Borreguero, ***@***.***> wrote:
OK, then I'll insert a box checking to prevent the combination of dimensions=[0,
0, 0, 90, 90, 90] and the default
MDAnalysis.core.flags['use_periodic_selections']=True to end up fooling
DistanceSelection.apply()
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1733 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI0jBxbyRd3R8VL7a86pbXfuK7YNRqUwks5s_xDjgaJpZM4Q96qU>
.
|
The topology says nothing about the box. The trajectory has box information – or not. However... I checked for our XYZ example, which does not contain box information, and I get Thus, it is not true that we always set the box to
whereas the XYZ reader just uses the base defaults (all 0). Barring a comprehensive survey, I am assuming that having no box information will at least lead to all(dimensions[:3] == 0) == True (or the float equivalent |
(I opened #1738 so that this point is not forgotten.) |
I think the hack here for dimensions is fine, and then one day in the future we'll have nicer handling that is universal across the package |
@orbeckst @richardjgowers I'm having an error with one of the builds that seems unrelated to the code changes. Have you ever encountered something similar? |
I've seen this one before. For some reason, on the Mac OSX workers, pytest sometimes fails to create a temp directory; possibly an issue with the xdist plugin for running in parallel (??). Not quite sure. (Or maybe we wrote an incorrect pytest fixture somewhere.) I restarted https://travis-ci.org/MDAnalysis/mdanalysis/jobs/315961274 , maybe it goes away... |
I restarted the Mac OS X travis job again, but if it fails again, I'd be willing to ignore it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes as far as I can see.
Maybe @richardjgowers or @kain88-de can also have a quick look?
package/MDAnalysis/core/selection.py
Outdated
Returns | ||
------- | ||
None or numpy.ndarray | ||
Returns argument dimensions if system is periodic, otherwise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description "if system is periodic" is ambiguous because self.periodic
is an external choice if periodicity ought to be taken into account. Can you please say more clearly what goes into deciding if None
or the box is returned?
Also make clear that we only consider full 3D periodicity as periodic, we don't support periodicity in only some dimensions (or arbitrary space group operators... that would be fun).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the wording can be changed "periodic in all three dimensions" and the validation code can be changed to:
if self.periodic and all(dimensions[:3]):
return dimensions
return None
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sounds good.
package/MDAnalysis/core/selection.py
Outdated
ref = sel.center_of_geometry().reshape(1, 3).astype(np.float32) | ||
|
||
box = group.dimensions if self.periodic else None | ||
periodic = False if self.validate_dimensions(group.dimensions) is None\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorter
periodic = self.validate_dimensions(group.dimensions) is not None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But even better, rearrange your code to avoid calling the same method twice:
box = self.validate_dimensions(group.dimensions)
periodic = box is not None
ref = sel.center_of_geometry(pbc=periodic).reshape(1, 3).astype(np.float32)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
package/MDAnalysis/core/selection.py
Outdated
ref = sel.center_of_geometry().reshape(1, 3).astype(np.float32) | ||
|
||
box = group.dimensions if self.periodic else None | ||
periodic = False if self.validate_dimensions(group.dimensions) is None\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorter
periodic = self.validate_dimensions(group.dimensions) is not None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But even better, rearrange your code to avoid calling the same method twice:
box = self.validate_dimensions(group.dimensions)
periodic = box is not None
ref = sel.center_of_geometry(pbc=periodic).reshape(1, 3).astype(np.float32)
Please also update CHANGELOG and docs - probably somewhere under selections. |
e295452
to
ff7f4d9
Compare
Generally, we're ok with accuracy to single (float32) precision, which is about 6-7 decimals. Double is nice to have but I don't have a problem if you decrease the number of decimals for the test. If it passes at 10 decimals then that's still good.
…--
Oliver Beckstein
email: orbeckst@gmail.com
Am Jan 13, 2018 um 14:46 schrieb Jose Borreguero ***@***.***>:
@orbeckst One test is failing because of errors at the 12th decimal place. Is this accuracy unacceptable?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@orbeckst There seem to be a conflict in the python 3.4 build because the numpy requirement is incompatible with this python version:
I guess this will affect all pull requests |
@jmborr I'll fix this on the build server sometime this week. Anything else effected by this PR? |
@kain88-de If you want, you could take a look to this Mac OS-X build flagged as "allowed to fail". |
yeah, that is expected. No idea what is wrong with OSX right now. None of us has the time to look into it currently. Therefore it is set to be allowed to fail. |
I travel in the same tight ship, so that's fine with me 😸 |
You can restart the python 3.4 test if this PR is merged. conda-forge/numpy-feedstock#76 |
@kain88-de is the conda-forge/numpy-feedstock#76 PR on ice ? |
Travis is on ice for the last couple days. They still struggle with OS X builds. We are trying to get those to pass. That will likely still take some time.
… On 19. Jan 2018, at 17:02, Jose Borreguero ***@***.***> wrote:
@kain88-de is the conda-forge/numpy-feedstock#76 PR on ice ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@kain88-de I wasn't aware Travis was having such an issue, good to know 👍 |
Fixes #1731
IN PROGRESS
PR Checklist