CodeEntropy.levels.dihedrals.angle_observations module

Selected-frame dihedral angle observation helpers.

This module contains the frame-aware angle collection logic used by the conformational state workflow. It preserves the MDAnalysis frame-index contract: Dihedral.run(...) receives active analysis-universe frame bounds, while the returned results.angles array is indexed locally from zero.

class CodeEntropy.levels.dihedrals.angle_observations.ConformationChunkTask(group_id: int, molecule_id: Any, molecule_order: int, chunk_id: int, frame_indices: tuple[int, ...], frame_selection: FrameSelection)[source]

Bases: object

Serial conformational work item for one molecule and frame chunk.

Variables:
  • group_id (int) – Molecule group id.

  • molecule_id (Any) – Molecule id.

  • molecule_order (int) – Position of the molecule within the group.

  • chunk_id (int) – Deterministic frame-chunk index.

  • frame_indices (tuple[int, ...]) – Absolute analysis trajectory indices in this chunk.

  • frame_selection (CodeEntropy.trajectory.frames.FrameSelection) – FrameSelection covering this chunk.

chunk_id: int
frame_indices: tuple[int, ...]
frame_selection: FrameSelection
group_id: int
molecule_id: Any
molecule_order: int
class CodeEntropy.levels.dihedrals.angle_observations.DihedralAngleCollector[source]

Bases: DihedralTopologyDiscovery

Collect dihedral angle observations from selected trajectory frames.

class CodeEntropy.levels.dihedrals.angle_observations.DihedralAngleObservable(task: ConformationChunkTask, num_residues: int, ua_angles_by_residue: dict[int, ndarray], residue_angles: ndarray | None)[source]

Bases: object

Chunk-local dihedral angle arrays for one molecule/frame chunk.

Variables:
  • task (CodeEntropy.levels.dihedrals.angle_observations.ConformationChunkTask) – Source molecule/frame chunk task.

  • num_residues (int) – Number of residues in the molecule.

  • ua_angles_by_residue (dict[int, numpy.ndarray]) – Positive-angle arrays by residue index. Each array has shape (n_chunk_frames, n_dihedrals).

  • residue_angles (numpy.ndarray | None) – Positive-angle residue-level array with shape (n_chunk_frames, n_residue_dihedrals), or None when the residue level is disabled or has no dihedrals.

num_residues: int
residue_angles: ndarray | None
task: ConformationChunkTask
ua_angles_by_residue: dict[int, ndarray]