uvisbox.Core.BandDepths.vector_depths

Module Contents

uvisbox.Core.BandDepths.vector_depths.calculate_spread_2D(vectors, depths, percentile)[source]

Calculate the spread in 2D polar coordinates. :param vectors: Array of shape (n, 2) in polar coordinates (magnitude, angle) :type vectors: numpy.ndarray :param depths: Array of shape (n,) representing the depth of each vector :type depths: numpy.ndarray :param percentile: Percentage of the deepest vectors to include (0-100). :type percentile: float

Returns:

Indices of vectors with min/max magnitude and angle among those passing the depth threshold.

Return type:

tuple

uvisbox.Core.BandDepths.vector_depths.calculate_spread_3D(vectors, depths, percentile)[source]

Calculate the spread in 3D spherical coordinates.

Parameters:
  • vectors (numpy.ndarray) – Array of shape (n, 3) in spherical coordinates (magnitude, theta, phi)

  • depths (numpy.ndarray) – Array of shape (n,) representing the depth of each vector

  • percentile (float) – Percentage of the deepest vectors to include (0-100).

Returns:

Indices of vectors with min/max magnitude, theta, and phi among those passing the depth threshold.

Return type:

tuple

uvisbox.Core.BandDepths.vector_depths.cartesian_to_polar(vectors)[source]

Convert 2D Cartesian vectors to polar coordinates (magnitude, angle).

Parameters:

vectors (numpy.ndarray) – Array of shape (n, 2) representing 2D Cartesian vectors.

Returns:

polar_coords – Array of shape (n, 2) with columns [magnitude, angle in radians].

Return type:

numpy.ndarray

uvisbox.Core.BandDepths.vector_depths.cartesian_to_spherical(vectors)[source]

Convert 3D Cartesian vectors to spherical coordinates (magnitude, theta, phi).

Parameters:

vectors (numpy.ndarray) – Array of shape (n, 3) representing 3D Cartesian vectors.

Returns:

spherical_coords – Array of shape (n, 3) with columns [magnitude, theta, phi].

Return type:

numpy.ndarray

uvisbox.Core.BandDepths.vector_depths.angular_spread(vectors)[source]

Calculate the angular spread and magnitude spread of a set of vectors.

Parameters:

vectors (numpy.ndarray) – Array of shape (n, 2) representing 2D Cartesian vectors.

Returns:

  • angular_spread_deg (float) – The angular spread in degrees.

  • magnitude_spread (float) – The magnitude spread.

  • min_idx (int) – Index of the vector with the minimum angle.

  • max_idx (int) – Index of the vector with the maximum angle.

uvisbox.Core.BandDepths.vector_depths.magnitude_spread(vectors)[source]

Calculate the magnitude spread of a set of vectors. :param vectors: Array of shape (n, 2) representing 2D Cartesian vectors. :type vectors: numpy.ndarray

Returns:

  • magnitude_spread (float) – The magnitude spread.

  • min_mag_idx (int) – Index of the vector with the minimum magnitude.

  • max_mag_idx (int) – Index of the vector with the maximum magnitude.

uvisbox.Core.BandDepths.vector_depths.compute_vector_depths_2D(vectors, workers=None)[source]

Compute the depth of each vector in the ensemble using optimized vectorized operations. The vector depth calculation is based on T. A. J. Ouermi, J. Li, Z. Morrow, B. Van Bloemen Waanders and C. R. Johnson, “Glyph-Based Uncertainty Visualization and Analysis of Time-Varying Vector Fields,” 2024 IEEE Workshop on Uncertainty Visualization: Applications, Techniques, Software, and Decision Frameworks, St Pete Beach, FL, USA, 2024, pp. 73-77, doi: 10.1109/UncertaintyVisualization63963.2024.00014.

Parameters:
  • vectors (numpy.ndarray) – Array of shape (n, 2) representing 2D Cartesian vectors.

  • workers (int, optional) – Number of worker processes for parallel computation. Default is None (sequential). Set to a positive integer to enable multiprocessing.

Returns:

depths – Array of shape (n,) with the depth of each vector.

Return type:

numpy.ndarray

Notes

Optimized version using: 1. Vectorized angle/magnitude computation (precomputed once) 2. Algorithm optimization (avoid redundant computations) 3. Optional parallelization for large ensembles

uvisbox.Core.BandDepths.vector_depths.compute_vector_depths_3D(vectors, workers=None)[source]

Compute the depth of each vector in the ensemble in 3D using optimized vectorized operations. Assumes vectors are in spherical coordinates (magnitude, theta, phi). The vector depth calculation is based on T. A. J. Ouermi, J. Li, Z. Morrow, B. Van Bloemen Waanders and C. R. Johnson, “Glyph-Based Uncertainty Visualization and Analysis of Time-Varying Vector Fields,” 2024 IEEE Workshop on Uncertainty Visualization: Applications, Techniques, Software, and Decision Frameworks, St Pete Beach, FL, USA, 2024, pp. 73-77, doi: 10.1109/UncertaintyVisualization63963.2024.00014.

Parameters:
  • vectors (numpy.ndarray) – Array of shape (n, 3) representing 3D spherical coordinates (magnitude, theta, phi).

  • workers (int, optional) – Number of worker processes for parallel computation. Default is None (sequential). Set to a positive integer to enable multiprocessing.

Returns:

depths – Array of shape (n,) with the depth of each vector.

Return type:

numpy.ndarray

Notes

Optimized version using: 1. Vectorized magnitude/angle computation (precomputed once) 2. Algorithm optimization (avoid redundant computations) 3. Optional parallelization for large ensembles