Refactor trajectory handling to explicit frame-index execution#344
Open
harryswift01 wants to merge 17 commits into
Open
Refactor trajectory handling to explicit frame-index execution#344harryswift01 wants to merge 17 commits into
harryswift01 wants to merge 17 commits into
Conversation
jimboid
approved these changes
May 22, 2026
Member
jimboid
left a comment
There was a problem hiding this comment.
A solid improvement to how the frames are being handled in CE. Instead of relying on MDA frame pointers to implicitly address frames this now explicitly sets the frame index at many different parts of the code which will eliminate issues around which frame is actually being used in different parts of the code. This should tighten the numerical certainty of the code.
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.
Summary
This PR refactors CodeEntropy’s trajectory handling to use explicit frame-index driven execution throughout the main analysis workflow.
Previously, several parts of the codebase relied on implicit MDAnalysis trajectory cursor state, physical frame slicing, or local reduced-trajectory frame indices. This made frame ownership difficult to reason about and could contribute to unstable or hard-to-debug regression differences.
This PR introduces a single explicit frame contract using
FrameSelectionandFrameSource, removes physical trajectory frame slicing from the main workflow path, and updates the DAG, neighbour search, conformational/dihedral analysis, and MDAnalysis utility code to follow that contract.This prepares the codebase for future Dask frame-level parallelisation without implementing Dask in this PR.
Changes
Explicit frame abstraction
FrameSelectionto define the selected absolute trajectory frame indices.FrameSourceas the single owner of MDAnalysis trajectory seeking.frame_selectionframe_sourceTrajectorySlicemigration object.Workflow frame handling
_build_reduced_universe()now applies atom selection only.FrameSource.FrameSelection.Frame DAG execution
LevelDAGto iterate over explicit frame indices fromFrameSource.FrameGraphso frame-local execution owns trajectory seeking viaframe_source.seek(frame_index).Neighbour and search logic
FrameSourceand explicit frame indices.universe.trajectory.ts.frame.Conformational and dihedral analysis
FrameSelectionthrough conformational-state construction.dihedral_results.results.angles.MDAnalysis utility cleanup
AnalysisFromFunctionusage from workflow-relevant utility paths.Unit tests
FrameSelection/FrameSourcecontract.Impact