-
Notifications
You must be signed in to change notification settings - Fork 663
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
trajectory writer interface is inconsistent #206
Comments
Original comment by
|
The testing for Writers is pretty haphazard right now, which is arguably how they've ended up diverging. After the next release I can write some tests like I did for Timesteps where there's a mixin test for Writer and then each format. Timestep tests: Original comment by |
So I've bumped into this a little when playing with the ncdf Writer (Issue #257). This was previously not deciding on whether to write velocities/forces on creation, but instead deciding when passed its first Timestep to write. So previously: W = mda.Writer('out.ncdf', numatoms=100)
# at this point, W hasn't created the header of the file, and isn't commited to writing velocities
W.write(ts)
# once passed a Timestep, it looked if _velocities were present, then wrote the header with velocities and forces fields And now: W = mda.Writer('out.ncdf', numatoms=100, velocities=True, forces=True)
# W is now commited to writing velocities and forces
W.write(ts) # this will now expect Velocities and Forces Which I think gives much better control, eg you can choose to write a new trajectory without vels and forces if you want. Treatment of velocities and forces is something that needs defining in the API however. |
Perhaps we can combine this by allowing
with the following meanings:
Writers that do not allow the per-Timestep decision should raise an exception ( Would this make sense? |
Yes, you're right @orbeckst, TRR writers can assume nothing from the start (see #162). I didn't realize earlier I this discussion this could also be a problem. The following is a common setup for GROMACS run outputs: In this case there'll be frames only with positions, and others with all three properties. The TRR format only writes what's there, i.e., if there's no velocities/forces only positions get written to file; no space is reserved for the missing properties. A somewhat more uncommon, but equally possible and valid, situation is to have all three x v f steps different and not multiple of each other. In this case there might be frames with any combination of positions velocities and forces. If the user wants to replicate such a behavior either: The second option is also the most faithful to the format, which doesn't even require any sort of regular spacing, and even allows for frames without any positions/velocities/forces. |
So this has cropped up with #350 and #308 with delta and dt being used interchangeably in different modules. The official API (which is based on DCD) defines delta as the MD integrator step (~1fs) and dt as the time step between saved frames (~1ps). TRR/XTC/NCDF used "delta" for time between frames. I'm changing the "delta" writers to use "dt" instead. |
fixed, skip_timestep, periodic, skip and delta no longer required for Readers (Issue #350) All writers now refer to time between steps as "dt" (was previously delta in XTC, TRR and NCDF Writers) (Issue #206) Timesteps now have a default dt of 1.0 ps (and issue warning when using this) Timestep attribute time now tries to return data['time'] first, then dt * frame, using the default value of 1.0 ps if necessary. (Issue #308)
I think somewhere in these long discussions we decided to use "dt" for the time between frames. delta can then be one the data variables because it's not provided by all readers. On 19 Jul, 2015, at 06:46, Richard Gowers wrote:
Oliver Beckstein * orbeckst@gmx.net |
Yeah the problem is the Writers wanted differently named kwargs for this |
Ok, I'm raising this issue from the dead, we're (@micaela-matta) trying to write a TXYZ Writer... So currently Is it OK for Writers to just throw a failure if they get a |
Can't we just deprecate the |
@kain88-de I'd prefer that yeah. Timestep is in AtomGroup, but not vice versa |
ok |
The interface to our trajectory writers is inconsistent and should be fixed.
The Trajectory API is actually vague on what Writers have to accept. This should be tightened and synced with the docs to writer().
At a minimum
start
,stop
,step
,delta
in the same manner**kwargs
Opinions?
Original issue reported on code.google.com by
orbeckst
on 20 Jan 2015 at 7:02The text was updated successfully, but these errors were encountered: