Modules.UncertaintyTube package
Submodules
Modules.UncertaintyTube.uncertainty_tubes module
- Modules.UncertaintyTube.uncertainty_tubes.uncertainty_tubes(trajectories, colormap='viridis', plotter=None, resolution=20, e_proj=1, sym=False, clim=None, n_jobs=1)[source]
Generate and visualize 3D uncertainty tubes from trajectories.
- Parameters:
trajectories (np.ndarray) – Array of shape (n_steps, n_starting_locations, n_ensemble_members, 3) representing the 3D trajectories.
(str (colormap) – Colormap to use for rendering the tube. Defaults to “viridis”.
optional) – Colormap to use for rendering the tube. Defaults to “viridis”.
pyvista.Plotter (plotter (matplotlib.axes.Axes or) – The plotting object to use. If None, a new Matplotlib figure/axis is created.
optional) – The plotting object to use. If None, a new Matplotlib figure/axis is created.
(int (n_jobs) – Number of points to sample on each cross-section boundary. Defaults to 20.
optional) – Number of points to sample on each cross-section boundary. Defaults to 20.
(float (e_proj) – Exponent controlling the superellipse shape. e_proj=1 creates a standard ellipse. Defaults to 1.
optional) – Exponent controlling the superellipse shape. e_proj=1 creates a standard ellipse. Defaults to 1.
(bool (sym) – If True, forces the superellipse to be symmetric. Defaults to False.
optional) – If True, forces the superellipse to be symmetric. Defaults to False.
(int – Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
optional) – Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
- Returns:
matplotlib.axes.Axes or pyvista.Plotter
- Return type:
The plotting object with the visualization.
Modules.UncertaintyTube.uncertainty_tubes_mesh module
- Modules.UncertaintyTube.uncertainty_tubes_mesh.align_cross_sections(ellipsoids, seed_idx, n_steps, resolution)[source]
Align cross-sections to minimize twisting for a given seed.
- Modules.UncertaintyTube.uncertainty_tubes_mesh.apply_circular_alignment(points, best_shift, best_is_reversed)[source]
Apply circular alignment transformation to a set of points based on the calculated shift and orientation.
Parameters:
- points (np.ndarray):
Points to transform (shape: n_points × num_dims)
- best_shift (int):
Number of positions to shift
- best_is_reversed (bool):
Whether to reverse point order
Returns:
- aligned (np.ndarray):
Transformed points
- point_correspondence_map (np.ndarray):
Index mapping from original to transformed points
- Modules.UncertaintyTube.uncertainty_tubes_mesh.calculate_mesh_dimensions(n_steps, n_seeds, resolution)[source]
Calculate dimensions needed for mesh arrays.
- Modules.UncertaintyTube.uncertainty_tubes_mesh.circular_align_min_twist(points_ref, points_target, stride=1)[source]
Aligns two sets of points forming closed loops with minimal twist.
Parameters:
- points_ref (np.ndarray):
Reference point set (shape: n_points × num_dims)
- points_target (np.ndarray):
Target point set to align (shape: n_points × num_dims)
- stride (int):
Stride for sampling subset of points (for efficiency)
Returns:
- aligned_points (np.ndarray):
Aligned target points
- correspondence_map (np.ndarray):
Index mapping from original to aligned points
- Modules.UncertaintyTube.uncertainty_tubes_mesh.compute_alignment_scores(reference, target, shifts)[source]
Compute alignment scores for all possible shifts of target relative to reference.
- Parameters:
reference (np.ndarray) – Reference point set (shape: n_points × num_dims)
target (np.ndarray) – Target point set to align (shape: n_points × num_dims)
shifts (np.ndarray) – Array of shift values to try
- Returns:
Scores for each shift (lower is better)
- Return type:
np.ndarray
- Modules.UncertaintyTube.uncertainty_tubes_mesh.uncertainty_tubes_mesh(summary_statistics, resolution=20, e_proj=1, sym=False, n_jobs=1)[source]
Generate the 3D mesh for uncertainty tubes.
Parameters:
- summary_statistics (dict):
Dictionary containing “mean_trajectory”, “eigen_values”, and “eigen_vectors”.
- resolution (int, optional):
Number of points to sample on each cross-section boundary. Defaults to 20.
- e_proj (float, optional):
Exponent controlling the superellipse shape. e_proj=1 creates a standard ellipse. Defaults to 1.
- sym (bool, optional):
If True, forces the superellipse to be symmetric. Defaults to False.
- n_jobs (int, optional):
Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
Returns:
- dict:
“vertices” (np.ndarray): Tube mesh vertices.
“faces” (np.ndarray): Triangle indices.
“uv_coords” (np.ndarray): UV coordinates for texture mapping.
Modules.UncertaintyTube.uncertainty_tubes_stats module
- Modules.UncertaintyTube.uncertainty_tubes_stats.project_points_to_plane(point0, point1, points)[source]
Projects points onto a plane perpendicular to the line segment from point0 to point1.
- Parameters:
point0 (np.ndarray) – Define the line segment direction
point1 (np.ndarray) – Define the line segment direction
points (np.ndarray) – Points to project (shape: (n_points, num_dims))
- Returns:
Projected points on the orthogonal plane
- Return type:
np.ndarray
- Modules.UncertaintyTube.uncertainty_tubes_stats.uncertainty_tubes_summary_statistics(trajectories, n_jobs=1)[source]
Compute 3D uncertainty summary statistics along trajectory paths.
- Parameters:
trajectories (np.ndarray) – Ensemble trajectories with shape (n_steps, n_starting_locations, n_samples, num_dims).
n_jobs (int, optional) – Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
- Returns:
“mean_trajectory” (np.ndarray): The mean trajectory with shape (n_steps, n_starting_locations, num_dims).
”eigen_values” (np.ndarray): Eigenvalues for each cross-section with shape (n_steps, n_starting_locations, 2).
”eigen_vectors” (np.ndarray): Eigenvectors for each cross-section with shape (n_steps, n_starting_locations, num_dims, 2).
- Return type:
dict
Modules.UncertaintyTube.uncertainty_tubes_vis module
- Modules.UncertaintyTube.uncertainty_tubes_vis.visualize_uncertainty_tubes(mesh_data, colormap='viridis', clim=None, plotter=None)[source]
Visualize 3D uncertainty tubes using either Matplotlib or PyVista.
Parameters:
- mesh_data (dict):
Dictionary containing “vertices”, “faces”, and “uv_coords” from uncertainty_tube_mesh.
- colormap (str, optional):
Colormap to use for rendering the tube. Defaults to “viridis”.
- plotter (matplotlib.axes.Axes or pyvista.Plotter, optional):
The plotting object to use. If None, a new Matplotlib figure/axis is created. If a Matplotlib Axes3D object, it plots on that. If a PyVista Plotter object, it adds the mesh to it.
Returns:
matplotlib.axes.Axes or pyvista.Plotter: The plotting object with the visualization.
Module contents
UncertaintyTube Module
This module provides uncertainty tube functionality for uncertainty visualization.
- Modules.UncertaintyTube.uncertainty_tubes(trajectories, colormap='viridis', plotter=None, resolution=20, e_proj=1, sym=False, clim=None, n_jobs=1)[source]
Generate and visualize 3D uncertainty tubes from trajectories.
- Parameters:
trajectories (np.ndarray) – Array of shape (n_steps, n_starting_locations, n_ensemble_members, 3) representing the 3D trajectories.
(str (colormap) – Colormap to use for rendering the tube. Defaults to “viridis”.
optional) – Colormap to use for rendering the tube. Defaults to “viridis”.
pyvista.Plotter (plotter (matplotlib.axes.Axes or) – The plotting object to use. If None, a new Matplotlib figure/axis is created.
optional) – The plotting object to use. If None, a new Matplotlib figure/axis is created.
(int (n_jobs) – Number of points to sample on each cross-section boundary. Defaults to 20.
optional) – Number of points to sample on each cross-section boundary. Defaults to 20.
(float (e_proj) – Exponent controlling the superellipse shape. e_proj=1 creates a standard ellipse. Defaults to 1.
optional) – Exponent controlling the superellipse shape. e_proj=1 creates a standard ellipse. Defaults to 1.
(bool (sym) – If True, forces the superellipse to be symmetric. Defaults to False.
optional) – If True, forces the superellipse to be symmetric. Defaults to False.
(int – Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
optional) – Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
- Returns:
matplotlib.axes.Axes or pyvista.Plotter
- Return type:
The plotting object with the visualization.
- Modules.UncertaintyTube.uncertainty_tubes_mesh(summary_statistics, resolution=20, e_proj=1, sym=False, n_jobs=1)[source]
Generate the 3D mesh for uncertainty tubes.
Parameters:
- summary_statistics (dict):
Dictionary containing “mean_trajectory”, “eigen_values”, and “eigen_vectors”.
- resolution (int, optional):
Number of points to sample on each cross-section boundary. Defaults to 20.
- e_proj (float, optional):
Exponent controlling the superellipse shape. e_proj=1 creates a standard ellipse. Defaults to 1.
- sym (bool, optional):
If True, forces the superellipse to be symmetric. Defaults to False.
- n_jobs (int, optional):
Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
Returns:
- dict:
“vertices” (np.ndarray): Tube mesh vertices.
“faces” (np.ndarray): Triangle indices.
“uv_coords” (np.ndarray): UV coordinates for texture mapping.
- Modules.UncertaintyTube.uncertainty_tubes_summary_statistics(trajectories, n_jobs=1)[source]
Compute 3D uncertainty summary statistics along trajectory paths.
- Parameters:
trajectories (np.ndarray) – Ensemble trajectories with shape (n_steps, n_starting_locations, n_samples, num_dims).
n_jobs (int, optional) – Number of parallel jobs to use. If n_jobs=1, uses sequential processing. Defaults to 1.
- Returns:
“mean_trajectory” (np.ndarray): The mean trajectory with shape (n_steps, n_starting_locations, num_dims).
”eigen_values” (np.ndarray): Eigenvalues for each cross-section with shape (n_steps, n_starting_locations, 2).
”eigen_vectors” (np.ndarray): Eigenvectors for each cross-section with shape (n_steps, n_starting_locations, num_dims, 2).
- Return type:
dict
- Modules.UncertaintyTube.visualize_uncertainty_tubes(mesh_data, colormap='viridis', clim=None, plotter=None)[source]
Visualize 3D uncertainty tubes using either Matplotlib or PyVista.
Parameters:
- mesh_data (dict):
Dictionary containing “vertices”, “faces”, and “uv_coords” from uncertainty_tube_mesh.
- colormap (str, optional):
Colormap to use for rendering the tube. Defaults to “viridis”.
- plotter (matplotlib.axes.Axes or pyvista.Plotter, optional):
The plotting object to use. If None, a new Matplotlib figure/axis is created. If a Matplotlib Axes3D object, it plots on that. If a PyVista Plotter object, it adds the mesh to it.
Returns:
matplotlib.axes.Axes or pyvista.Plotter: The plotting object with the visualization.