hari_plotter.interface module

class hari_plotter.interface.HariDynamicsInterface(data)[source]

Bases: Interface

Interface specifically designed for the HariDynamics class.

REQUIRED_TYPE

alias of Dynamics

property available_parameters: list

Retrieves the list of available parameters/methods from the data gatherer.

Returns:

A list of available parameters or methods.

Return type:

list

property time_range: list[float]
class hari_plotter.interface.HariGraphInterface(data)[source]

Bases: Interface

Interface specifically designed for the HariGraph class.

REQUIRED_TYPE

alias of Graph

property available_parameters: list

Retrieves the list of available parameters/methods from the data gatherer.

Returns:

A list of available parameters or methods.

Return type:

list

property time_range: list[float]
class hari_plotter.interface.Interface(data: Any, group_length: int = 0)[source]

Bases: ABC

Abstract base class to define interface behaviors.

REQUIRED_TYPE

Expected type for the data attribute.

Type:

Type[Any] | None

available_classes

dictionary mapping REQUIRED_TYPEs to their corresponding classes.

Type:

dict[Type[Any], Type[hari_plotter.interface.Interface]]

class ClusterTracker(interface)[source]

Bases: object

clean()[source]
cluster_graph(cluster_settings: dict[str, Any], clusters_dynamics: list[list[Clustering]] | None = None) DiGraph[source]

Constructs a graph representing the cluster dynamics, optionally using provided cluster dynamics.

Parameters:
  • cluster_settings – Settings for clusterization.

  • clusters_dynamics – A list of lists where each sub-list represents the clusters in a frame.

Returns:

A directed graph where nodes represent clusters and edges represent the temporal evolution of clusters.

static generate_node_id(frame_index, cluster_identifier)[source]
get_cluster_presence(clusterization_settings: dict | list[dict]) list[dict[str, list[int]]][source]

Retrieves a list of dictionaries, each mapping unique clusters to the frames in which they appear, based on the given clusterization settings. Each dictionary corresponds to one clustering type if multiple types are provided.

Parameters:

clusterization_settings – The settings used for clusterization, either a single dictionary or a list of dictionaries for multiple types.

Returns:

A list of dictionaries, each mapping unique cluster names to frame presence for one type of clustering.

Example:

Output

[{'Cluster 0': [0, 1, 2], 'Cluster 1': [0, 1, 2], 'Cluster 2': [0, 1]}]

means that Cluster 0, Cluster 1, and Cluster 2 are present in frame 0 and 1, and only Cluster 0 and 1 are present in frame 2.

get_clustering(clusterization_settings: dict | list[dict]) list[list[Clustering]][source]

Retrieves the clusterization for the given settings.

Parameters:

clusterization_settings – The settings for clusterization, either a single dictionary for all frames or a list of dictionaries for each frame.

Returns:

A list of Clustering objects representing the clusterization for each frame.

get_final_value(clusterization_settings: dict | list[dict], parameter) dict[str, float][source]

Returns the value of the parameter in the last group cluster appeared

get_unique_clusters(clusterization_settings: dict | list[dict]) list[list[str]][source]

Retrieves a list of lists, each containing unique clusters based on the given clusterization settings. Each inner list corresponds to one clustering type if multiple types are provided.

Parameters:

clusterization_settings – The settings used for clusterization, either a single dictionary or a list of dictionaries for multiple types.

Returns:

A list of lists, each containing unique cluster names for one type of clustering.

is_tracked(clusterization_settings: dict | list[dict]) list[bool][source]

Tracks the clusters across frames based on the provided clusterization settings.

Parameters:

clusterization_settings – The settings for clusterization, either a single dictionary for all frames or a list of dictionaries for each frame.

Returns:

A list of dictionaries where each dictionary maps frame indices to lists of cluster labels.

track_clusters(clusterization_settings: dict | list[dict]) list[dict[int, dict[str, str]]][source]

Tracks the clusters across frames based on the provided clusterization settings.

Parameters:

clusterization_settings – The settings for clusterization, either a single dictionary for all frames or a list of dictionaries for each frame.

Returns:

A list of dictionaries where each dictionary maps frame indices to lists of cluster labels.

class DynamicDataCache(interface_instance, i: int)[source]

Bases: object

clean()[source]
class GroupIterable(interface_instance: Interface)[source]

Bases: object

REQUIRED_TYPE: Type[Any] | None = None
class StaticDataCache(interface_instance)[source]

Bases: object

clean()[source]
available_classes: dict[Type[Any], Type[Interface]] = {<class 'hari_plotter.dynamics.Dynamics'>: <class 'hari_plotter.interface.HariDynamicsInterface'>, <class 'hari_plotter.graph.Graph'>: <class 'hari_plotter.interface.HariGraphInterface'>, <class 'hari_plotter.simulation.Simulation'>: <class 'hari_plotter.interface.SimulationInterface'>}
abstract property available_parameters: list
clean_cache()[source]
classmethod create_interface(data: Any) Interface[source]

Create an interface for the given data.

Parameters:

data – The underlying data object to which the interface applies.

Returns:

Instance of a subclass of Interface based on data’s type.

Raises:

ValueError – If no matching interface is found for the data type.

group_time_range() list[float][source]
classmethod info() str[source]

Return a string representation of the available classes and their mapping.

Returns:

A string detailing the available classes and their mappings.

property node_parameters
property nodes
regroup(num_intervals: int, interval_size: int = 1, offset: int = 0)[source]
static request_to_tuple(request)[source]
abstract property time_range: list[float]
class hari_plotter.interface.SimulationInterface(data)[source]

Bases: Interface

Interface specifically designed for the Simulation class.

REQUIRED_TYPE

alias of Simulation

property available_parameters: list

Retrieves the list of available parameters/methods from the data gatherer.

Returns:

A list of available parameters or methods.

Return type:

list

property time_range: list[float]