dynsight.trajectory.Insight

class dynsight.trajectory.Insight(dataset, meta=<factory>)[source]

Contains an analysis perfomed on a trajectory.

Parameters:
  • dataset (NDArray[np.float64])

  • meta (dict[str, Any])

dataset

The values of a some trajectory’s descriptor.

Type:

NDArray[np.float64]

meta

A dictionary containing the relevant parameters.

Type:

dict[str, Any]

Methods

dump_to_json

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

get_angular_velocity

Computes the angular displacement of a vectorial descriptor.

get_onion

Perform onion clustering.

get_onion_analysis

Perform the full onion time resolution analysis.

get_onion_smooth

Perform smooth onion clustering.

get_tica

Perform tICA on trajectories from a many-body system.

get_time_correlation

Self time correlation function of the time-series signal.

load_from_json

Load the Insight object from .json file.

spatial_average

Average the descriptor over the neighboring particles.

Attributes

dump_to_json(file_path)[source]

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

Parameters:

file_path (Path)

Return type:

None

get_angular_velocity(delay=1)[source]

Computes the angular displacement of a vectorial descriptor.

Raises:

ValueError if the dataset does not have the right dimensions.

Parameters:

delay (int)

Return type:

Insight

get_onion(delta_t, bins='auto', number_of_sigmas=2.0)[source]

Perform onion clustering.

The returned OnionInsight contains the following meta: delta_t, bins, number_of_sigma.

Parameters:
Return type:

OnionInsight

get_onion_analysis(delta_t_min=1, delta_t_max=None, delta_t_num=20, fig1_path=None, fig2_path=None, bins='auto', number_of_sigmas=3.0, max_area_overlap=0.8)[source]

Perform the full onion time resolution analysis.

Note: this method uses the “onion smooth” functions (see documentation for details).

Parameters:
  • delta_t_min (int) – Smaller value for delta_t_list.

  • delta_t_max (int | None) – Larger value for delta_t_list.

  • delta_t_num (int) – Number of values in delta_t_list.

  • fig1_path (Path | None) – If is not None, the time resolution analysis plot is saved in this location.

  • fig2_path (Path | None) – If is not None, the populations fractions plot is saved in this location.

  • bins (str | int) – The ‘bins’ parameter for onion clustering.

  • number_of_sigmas (float) – The ‘number_of_sigmas’ parameter for onion clustering.

  • max_area_overlap (float) – The ‘max_area_overlap’ parameter for onion clustering.

Returns:

  • delta_t_list: The list of ∆t used.

  • n_clust: The number of clusters at each ∆t.

  • unclass_frac: The fraction of unclassified data at each ∆t.

  • list_of_labels: Labels at each ∆t.

Return type:

tuple

get_onion_smooth(delta_t, bins='auto', number_of_sigmas=3.0, max_area_overlap=0.8)[source]

Perform smooth onion clustering.

The returned OnionInsight contains the following meta: delta_t, bins, number_of_sigma, max_area_overlap.

Parameters:
Return type:

OnionSmoothInsight

get_tica(lag_time, tica_dim)[source]

Perform tICA on trajectories from a many-body system.

The attributes “lag_time” and “tica_dim” are added to the meta.

Raises:

ValueError if the dataset does not have the right dimensions.

Parameters:
  • lag_time (int)

  • tica_dim (int)

Return type:

tuple[NDArray[np.float64], NDArray[np.float64], Insight]

get_time_correlation(max_delay=None)[source]

Self time correlation function of the time-series signal.

Parameters:

max_delay (int | None)

Return type:

tuple[NDArray[np.float64], NDArray[np.float64]]

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

Load the Insight object from .json file.

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:

Insight

spatial_average(trj, r_cut, selection='all', n_jobs=1)[source]

Average the descriptor over the neighboring particles.

The returned Insight contains the following meta: sp_av_r_cut, selection.

Parameters:
Return type:

Insight