TrajectorySubset

class mdcraft.core.TrajectorySubset(trajectory: Trajectory, frame_indices: slice | range | Iterable[int])[source]

Bases: object

Trajectory subset.

Individual frames can be accessed through relative indexing or iteration.

Parameters:
trajectoryTrajectory

Full simulation trajectory.

frame_indicesslice or array-like

Indices of frames to keep in the trajectory subset.

Methods

get_frames

Gets one or more frames from the trajectory subset.

property dt: float | None[source]

Time step size between timesteps in the trajectory subset. If None, the time step size is not constant across frames or could not be determined from the subset.

Reference unit: \(\mathrm{ps}\).

get_frames(indices: int | slice | Iterable[int], /) TrajectoryFrame | list[TrajectoryFrame][source]

Gets one or more frames from the trajectory subset.

Parameters:
indicesint, slice, or array-like, positional-only

Indices of frames in the subset to get.

Returns:
framesTrajectoryFrame or list

Trajectory frame(s).

property n_atoms: int

Number of atoms in each frame. If None, the number of atoms is not constant across frames or the trajectory subset does not contain atom data.

property n_frames: int

Number of frames in the trajectory subset.

property time_step: float | None[source]

Time step between frames in the trajectory subset. If None, the time step is not constant across frames.

Reference unit: \(\mathrm{ps}\).

property times: ndarray[float64][source]

Simulation times found in the trajectory subset.

Reference unit: \(\mathrm{ps}\).

property timesteps: ndarray[uint32] | None[source]

Simulation timesteps found in the trajectory subset. If None, the timesteps could not be determined from the subset.