simularium_metrics_calculator.calculators package

Submodules

simularium_metrics_calculator.calculators.agents_calculator module

class simularium_metrics_calculator.calculators.agents_calculator.AgentsCalculator(time_indices: List[int] | None = None)[source]

Bases: Calculator

Calculates the agent IDs at the given timestep.

Parameters:
time_indices: List[int]

Which time step(s) to use. Default: first step

traces(traj_data: TrajectoryData) Dict[str, ndarray][source]

Return the agent IDs at the given 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

units(traj_data: TrajectoryData) str[source]

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

simularium_metrics_calculator.calculators.calculator module

class simularium_metrics_calculator.calculators.calculator.Calculator[source]

Bases: ABC

calculate(traj_data: TrajectoryData) Tuple[Dict[str, ndarray], str][source]

Return the calculated traces and the units label to use.

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.

str

A label for the units, formatted as ” (units)”.

formatted_units(traj_data: TrajectoryData) str[source]
abstract traces(traj_data: TrajectoryData) Dict[str, ndarray][source]
abstract units(traj_data: TrajectoryData) str[source]

simularium_metrics_calculator.calculators.nearest_neighbor_calculator module

class simularium_metrics_calculator.calculators.nearest_neighbor_calculator.NearestNeighborCalculator(time_indices: List[int] | None = None)[source]

Bases: Calculator

Calculates the distance to the nearest neighbor for each agent at a given time index.

Parameters:
time_indices: List[int]

Which time step(s) to use. Default: first and last

traces(traj_data: TrajectoryData) Dict[str, ndarray][source]

Return the distance to the nearest neighbor for each agent at the requested time indices (by default first and last).

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.

units(traj_data: TrajectoryData) str[source]

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.

simularium_metrics_calculator.calculators.number_of_agents_calculator module

class simularium_metrics_calculator.calculators.number_of_agents_calculator.NumberOfAgentsCalculator(stride: int = 1, exclude_types: List[str] | None = None)[source]

Bases: Calculator

Calculates the number of agents of each type over time.

Parameters:
stride: int (optional)

Include every nth timestep. Default: 1

exclude_typesList[str] (optional)

Type names for agents to ignore. Default: include all type names found in the trajectory

traces(traj_data: TrajectoryData) Dict[str, ndarray][source]

Return the number of agents of each type over time.

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.

units(traj_data: TrajectoryData) str[source]

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.

simularium_metrics_calculator.calculators.times_calculator module

class simularium_metrics_calculator.calculators.times_calculator.TimesCalculator(stride: int = 1)[source]

Bases: Calculator

Calculates the times over the course of the trajectory.

Parameters:
stride: int (optional)

use every nth time step. Default: 1

traces(traj_data: TrajectoryData) Dict[str, ndarray][source]

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.

units(traj_data: TrajectoryData) str[source]

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.

Module contents

Calculators scripts package for simularium_metrics_calculator.