Simplify Trajectory.__getattr__ - #879
Merged
Merged
Conversation
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This simplifies
Trajectory.__getattr__and may fix #878.It adds a small restriction on snapshot "features" -- if you have a snapshot feature named
foo, and if you create a function-type snapshot feature calledtrajectory_foo, thentrajectory_foomust be a function that takes a trajectory and returns the values forfoo. (I don't think this is going to cause any problems for anyone.)I'm using those trajectory function features for the following: With the OpenMM engine, a trajectory returns a
simtk.unit.Quantitywrapping a numpy array of the results of some snapshot feature, as opposed to making a list/numpy array containing multipleQuantityobjects. I've now moved the code that supports this behavior into the OpenMM engine (as trajectory function features specific to it), instead of the baseTrajectoryobject.This allows us to remove more OpenMM-specific code that made
Trajectory.__getattr__a much more complicated and hard-to-maintain function before.