Selection Resolve Helper

GitHub Link to Code.

Trajectory selection resolution utilities.

class mdxplain.trajectory.helper.process_helper.selection_resolve_helper.SelectionResolveHelper

Utility class for resolving trajectory selections to indices.

static get_indices_to_process(traj_data: TrajectoryData, traj_selection: int | str | List[int | str] | 'all') List[int]

Get list of trajectory indices to process.

Parameters

traj_dataTrajectoryData

Trajectory data object

traj_selectionint, str, list, or “all”

Selection criteria:

  • int: trajectory index

  • str: trajectory name, tag (prefixed with “tag:”) or advanced formats:

    • Range: “0-3”, “id 0-3” → [0, 1, 2, 3]

    • Comma list: “1,2,4,5”, “id 1,2,4,5” → [1, 2, 4, 5]

    • Single number: “7”, “id 7” → [7]

    • Pattern: “system_*” → fnmatch pattern matching

  • list: mix of indices/names/tags/patterns

  • “all”: all trajectories

Returns

list

List of trajectory indices to process

Examples

>>> # Process all trajectories
>>> indices = SelectionResolveHelper.get_indices_to_process(traj_data, "all")
>>> # Process single trajectory
>>> indices = SelectionResolveHelper.get_indices_to_process(traj_data, 0)
>>> # Process by tag
>>> indices = SelectionResolveHelper.get_indices_to_process(traj_data, "tag:system_A")
>>> # Process specific trajectories
>>> indices = SelectionResolveHelper.get_indices_to_process(
...     traj_data, [0, "traj1", "tag:biased"]
... )
static get_all_trajectories_with_tag(tag: str, traj_data: TrajectoryData) List[int]

Get all trajectory indices that have the specified tag.

Parameters

tagstr

Tag to search for

traj_dataTrajectoryData

Trajectory data object

Returns

List[int]

List of trajectory indices that have the tag

Examples

>>> # Get all trajectories with "system_A" tag
>>> indices = SelectionResolveHelper.get_all_trajectories_with_tag(
...     "system_A", traj_data
... )