[docs]classTimesCalculator(Calculator):def__init__(self,stride:int=1):""" Calculates the times over the course of the trajectory. Parameters ---------- stride: int (optional) use every nth time step. Default: 1 """self.stride=stride
[docs]deftraces(self,traj_data:TrajectoryData)->Dict[str,np.ndarray]:""" Return the time at each time step. Parameters ---------- traj_data: TrajectoryData Trajectory data for which to calculate metrics. Returns ------- Dict[str, np.ndarray] The name of each trace mapped to an array of the data for that trace. """return{"Time":traj_data.agent_data.times[::self.stride]}
[docs]defunits(self,traj_data:TrajectoryData)->str:""" Return a string label for the units to use on the axis title. Parameters ---------- traj_data: TrajectoryData Trajectory data for which to calculate the metric. Returns ------- str A label for the units. """returnstr(traj_data.time_units)