Comments (3)
You have to give selections a name in order to generate them later; the usage should look like:
ag = 'bynum 0:10'
S.selections.add('my favorite atoms', ag)
Selections are stored as (lists of) selection strings, and they are applied on call to give back an AtomGroup from the active universe. I think it should be possible to feed AtomGroups in directly instead of selection strings, storing a list of atom indices instead of strings for the selection definition.
BTW, you can avoid the (admittedly awkward) add
syntax by using setitem
syntax:
S.selections['my favorite atoms'] = 'bynum 1:10'
and get the corresponding AtomGroup from the selection definition with:
ag = S.selections['my favorite atoms']
I don't know if there's a clean way to handle +=
as an operation, especially if some selections are defined as lists of strings while others are defined by lists of atoms. I think maintaining a predictable atom order would get very tricky real fast.
from mdsynthesis.
Yeah I don't mind hacking in adding AtomGroups directly myself, I hate working in terms of selection strings myself.
For the second point, there's the python method __iadd__
(and friends), which lets you handle augmented assignment in special ways.
https://docs.python.org/2/library/operator.html#operator.iadd
I forgot they're all key: value pairs, so possible things you could do
S.selections += {'something': 'sel 1', 'somethign else': 'sel 2'}
S.selections += 'key', 'value'
Food for thought at least
from mdsynthesis.
I don't mind adding in these kind of enhancements so long as they can be unambiguously implemented at both the interface and persistence levels. I would suggest the following:
- add a new table definition to
persistence.SimFile
for_SelectionAtoms
, which stores integers in a single column representing the atom indices of the selection - add logic to
persistence.SimFile.add_selection
to create a_SelectionAtoms
table for integers given asselection
, as well as the usual_Selection
table for selection strings given asselection
(current behavior) - add logic to
aggregators.Selections
add
and__setitem__
(or better, change__setitem__
to calladd
, and change onlyadd
) to handle AtomGroups. That is, to pull out their atom indexes and feed them toself._backend.add_selection
I prefer to keep MDAnalysis calls out of persistence
as much as possible to limit the complexity of the File
classes; this separation preserves that.
from mdsynthesis.
Related Issues (20)
- Failing in adding a Universe creates bad state HOT 2
- failed to store DataFrame with column multi-index HOT 4
- One Sim, one Universe: remove multiple Universes functionality HOT 15
- first release HOT 12
- Setting Sim.universe to universe with chain reader doesn't work HOT 1
- Support auxilliaries in Universe definitions HOT 3
- create sim from existing Treant HOT 4
- handle folders with several simulations HOT 2
- The current release doesn't work with MDAnalysis 0.16.0dev HOT 3
- make a 1.0 release? HOT 11
- Remove Sim treanttype HOT 3
- Move to MDAnalysis org HOT 9
- Removing all tags/categories HOT 2
- python 3 release? HOT 3
- add conversion script from 0.8 to 1.0 HOT 3
- Error when using sim.tags/sim.categories HOT 3
- So much faster! HOT 1
- Is it possible to store in data or somewhere else files or paths to them? HOT 8
- Two different documentations online? HOT 1
- Order of Treants in a Bundle HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdsynthesis.