Comments (6)
Aspects of the issue that still need to be addressed:
- The image property (and possibly others) should be supported)
Bonds, groups, angle data etc. supported in GSD but not readable in glotzformats
from garnett.
Images are supported
The image property is supported now, as of ef49605.
The others (bonds, groups, angles...) are not yet supported. I think it's okay to leave that where it is for now, and consider it for a future improvement if/when someone needs it. These properties are much more important for biochemical studies where particles form molecules. Also only GSD and GTAR would support storing those, to my knowledge (would need to confirm this guess).
Handling Defaults
There is a bit of work left to do with handling defaults. This was discussed at a code development meeting on February 5, 2019.
Suppose you try to read a trajectory that doesn't store some piece of information (e.g. POS files don't store masses), like this:
>>> import glotzformats as gf
>>> with gf.read('FeSiUC.pos') as traj:
... assert traj[0].mass is None
...
>>>
Currently, those "unstored" properties are set as None
. At the meeting we decided that it would be better to raise AttributeError
or similar if the user attempts to access a property that isn't defined by the original trajectory file. It's a question of how much we want to assume about the user's data, and it's probably safer to assume as little as possible. Let's discuss this further at our next meeting.
from garnett.
@bdice I think implementing the __getattribute__
method to the Frame
class as illustrated below:
def __getattribute__(self, attr):
value = super(Frame, self).__getattribute__(attr);
if value is None:
raise AttributeError
else:
return value;
will produce the desired behavior. However, it will break other parts of the code, specially the tests and writers that consistently check if attributes are None
. These parts would need to be modified to appropriately catch the AttributeError
instead of checking if frame.attribute is not None
. Is this the way to go about this?
from garnett.
@lyrivera You're correct, the tests and writers would need to be changed as you described.
For the tests, you can use self.assertRaises
like in this example, except for AttributeError
: https://github.com/glotzerlab/glotzformats/blob/master/tests/test_trajectory.py#L88
For the writers, you'll want to try:
...(write the attribute data)... except AttributeError:
...(don't write anything, or write defaults if required by the format).
from garnett.
Sounds good. I'll work on it.
from garnett.
Resolved on PR #68. Closing now.
from garnett.
Related Issues (20)
- Refactor GSD into a hard/soft dependency HOT 7
- Host documentation on ReadTheDocs
- Enable installation through pip and conda HOT 2
- Add GitHub CODEOWNERS / PR, Issue templates
- Trajectory attribute for all box objects HOT 2
- Test for trajectory with varying number of particles per frame
- Old Links HOT 6
- Box regularization yields wrong orientations HOT 2
- __main__ entry point for file conversion HOT 3
- Enable/read user defined logged quantities from GSD files. HOT 4
- Add option to explicitly set number of dimensions on read/write (specific use case: DCD) HOT 2
- Use types and typeid properties consistent with HOOMD HOT 4
- Refactor and test hoomd snapshot functions in the Frame and Trajectory class
- Make FrameData private and merge _RawFrameData and FrameData
- Update GSD reader/writer for GSD 2.0 HOT 1
- Add badges for PyPI / conda-forge, etc.
- Modernize DCD Reader's use of NumPy
- Update usage of `read_frame` when reading hoomd trajectories
- CI deploy key not enabled for this repository
- Support GSD 3.0
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 garnett.