Skip to content
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

Sim stores universe kwargs if possible; refactored atomselections to address confusing API #55

Merged
merged 8 commits into from
Apr 5, 2016

Conversation

dotsdl
Copy link
Member

@dotsdl dotsdl commented Apr 4, 2016

Addresses concerns in #48 and #54. Fixes #25 pending upstream MDAnalysis/mdanalysis#813.

We will encourage setting a Sim universe directly with an existing Universe, with the hope that we can eventually hide UniverseDefinition. At the moment, though, we leave it exposed for any manual interventions that can't be handled from the Universe itself.

Also, AtomSelection getitem no longer returns an AtomGroup, but instead gives back the definition of the selection (that which was stored). It is possible to store only strings or numpy arrays of atom indices,
or tuples/lists of these in any combination. One cannot directly store AtomGroups, but can store atom indices with AG.indices.

Getting back an AtomGroup from the stored definition requires using the create method. This makes it clear that a new AtomGroup is being generated, and that there is a cost to this.

dotsdl added 7 commits April 2, 2016 14:49
The MDAnalysis.Universe does not currently hold onto its kwargs, so this
is dependent on a small upstream change.
This will remove the universe definition for the Sim
We will encourage setting a Sim universe directly with an existing
Universe, with the hope that we can eventually hide UniverseDefinition.
At the moment, though, we leave it exposed for any manual interventions
that can't be handled from the Universe itself.

Also, AtomSelection getitem no longer returns an AtomGroup, but instead
gives back the definition of the selection (that which was stored). It
is possible to store only strings or numpy arrays of atom indices,
or tuples/lists of these in any combination. One cannot directly store
AtomGroups, but can store atom indices with `AG.indices`.

Getting back an AtomGroup from the stored definition requires using the
`create` method. This makes it clear that a new AtomGroup is being
generated, and that there is a cost to this.
@dotsdl dotsdl added this to the 0.6.0 milestone Apr 4, 2016
@dotsdl dotsdl changed the title Feature ukwargs Sim stores universe kwargs if possible; refactored atomselections to address confusing API Apr 4, 2016
@dotsdl
Copy link
Member Author

dotsdl commented Apr 5, 2016

@orbeckst if you get to this before @richardjgowers, you're welcome to merge. I'm itching to get this released so we can go from there.

@orbeckst
Copy link
Contributor

orbeckst commented Apr 5, 2016

For the future: I would add an optional arg to atomselections.create(handle[, string_or_array]) so that one can do setting the definition and getting it in one go:

ag = s.atomselections.create('lid', 'protein and resid 122:159')

which would be equivalent to

s.atomselections['lid'] =  'protein and resid 122:159'
ag = s.atomselections.create('lid')

@orbeckst
Copy link
Contributor

orbeckst commented Apr 5, 2016

I haven't tested the PR but I am happy with the API changes.

@orbeckst orbeckst assigned orbeckst and unassigned richardjgowers Apr 5, 2016
@orbeckst orbeckst merged commit 7946d1b into develop Apr 5, 2016
@orbeckst orbeckst deleted the feature-ukwargs branch April 5, 2016 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants