dynsight.trajectory.OnionInsight

class dynsight.trajectory.OnionInsight(labels, state_list, reshaped_data, meta=<factory>)[source]

Contains an onion-clustering analysis.

Parameters:
  • labels (NDArray[np.int64])

  • state_list (list[StateUni] | list[StateMulti])

  • reshaped_data (NDArray[np.float64])

  • meta (dict[str, Any])

labels

The labels assigned by the clustering algorithm.

state_list

List of the onion-clustering Gaussian states.

Type:

list[StateUni] | list[StateMulti]

reshaped_data

The input data reshaped for onion-clustering.

Type:

NDArray[np.float64]

meta

A dictionary containing the relevant parameters.

Type:

dict[str, Any]

Methods

dump_to_json

Save the OnionInsight to a JSON file and .npy file.

load_from_json

Load the OnionInsight object from JSON and .npy files.

plot_medoids

Plot the average sequence of each onion cluster.

plot_one_trj

Plot one particle's trajectory colored according to clustering.

plot_output

Plot the overall onion clustering result.

plot_sankey

Plot the Sankey diagram of the onion clustering.

plot_state_populations

Plot each state's population along the trajectory.

Attributes

dump_to_json(file_path)[source]

Save the OnionInsight to a JSON file and .npy file.

Parameters:

file_path (Path)

Return type:

None

classmethod load_from_json(file_path, mmap_mode=None)[source]

Load the OnionInsight object from JSON and .npy files.

Parameters:
  • file_path (Path) – Path to the .json file.

  • mmap_mode (Literal['r', 'r+', 'w+', 'c'] | None) – If given, used as np.load(…, mmap_mode=mmap_mode) for memory mapping.

Raises:

ValueError – if required keys are missing.

Return type:

OnionInsight

plot_medoids(file_path, data_insight)[source]

Plot the average sequence of each onion cluster.

Parameters:
  • file_path (Path)

  • data_insight (Insight)

Return type:

None

plot_one_trj(file_path, data_insight, particle_id)[source]

Plot one particle’s trajectory colored according to clustering.

Parameters:
  • file_path (Path)

  • data_insight (Insight)

  • particle_id (int)

Return type:

None

plot_output(file_path, data_insight)[source]

Plot the overall onion clustering result.

Parameters:
  • file_path (Path)

  • data_insight (Insight)

Return type:

None

plot_sankey(file_path, data_insight, frame_list)[source]

Plot the Sankey diagram of the onion clustering.

Parameters:
Return type:

None

plot_state_populations(file_path, data_insight)[source]

Plot each state’s population along the trajectory.

Parameters:
  • file_path (Path)

  • data_insight (Insight)

Return type:

None