uvisbox.Core.CellsCrossingProb.crossing_probability_mc

Module Contents

uvisbox.Core.CellsCrossingProb.crossing_probability_mc.crossing_probability_squares_monte_carlo(ensemble_images, isovalue, num_samples=200, n_jobs=None)[source]

Perform probabilistic marching squares on a 2D scalar field with uncertainty. This function calculates the probability of the isocontour passing through each cell in the grid based on an ensemble of scalar fields. The method is based on the paper: K. Pothkow and H. -C. Hege, “Positional Uncertainty of Isocontours: Condition Analysis and Probabilistic Measures,” in IEEE Transactions on Visualization and Computer Graphics, vol. 17, no. 10, pp. 1393-1406, Oct. 2011, doi: 10.1109/TVCG.2010.247

This parallelized version processes cells concurrently using multiprocessing for improved performance.

Parameters:
  • ensemble_images (np.ndarray) – 3D array of shape [y, x, n_ensemble] representing the scalar field with ensemble members.

  • isovalue (float) – The isovalue for which to compute the contour.

  • num_samples (int, optional) – Number of Monte Carlo samples to draw for estimating the probability of contour presence in each cell.

  • n_jobs (int, optional) – Number of parallel processes to use. If None, uses all available CPU cores. Set to 1 for serial execution (useful for debugging).

Returns:

probability_contour – 2D array of shape (y-1, x-1) with probabilities of contour presence in each cell.

Return type:

np.ndarray

uvisbox.Core.CellsCrossingProb.crossing_probability_mc.crossing_probability_triangles_monte_carlo(ensemble_data, triangle_mesh, isovalue, num_samples=200, n_jobs=None)[source]

Perform probabilistic marching triangles on a 2D scalar field with uncertainty. This function calculates the probability of the isocontour passing through each triangle in the triangulated mesh based on an ensemble of scalar fields.

The method is based on the paper: Pöthkow, K., Petz, C. and Hege, H.C., 2013. Approximate level-crossing probabilities for interactive visualization of uncertain isocontours. International Journal for Uncertainty Quantification, 3(2). doi: 10.1615/Int.J.UncertaintyQuantification.2012003958

This parallelized version processes triangles concurrently using multiprocessing for improved performance.

Parameters:
  • ensemble_data (np.ndarray) – 2D array of shape (n_points, n_ensemble) representing the scalar field with ensemble members.

  • triangle_mesh (np.ndarray) – 2D array of shape (n_triangles, 3) representing the triangulation connectivity.

  • isovalue (float) – The isovalue for which to compute the contour.

  • num_samples (int, optional) – Number of Monte Carlo samples to draw for estimating the probability of contour presence in each triangle.

  • n_jobs (int, optional) – Number of parallel processes to use. If None, uses all available CPU cores. Set to 1 for serial execution (useful for debugging).

Returns:

probability_contour – 1D array of shape (n_triangles,) with probabilities of contour presence in each triangle.

Return type:

np.ndarray

uvisbox.Core.CellsCrossingProb.crossing_probability_mc.crossing_probability_cubes_monte_carlo(ensemble_images, isovalue, num_samples=200, n_jobs=None)[source]

Perform probabilistic marching cubes on a 3D scalar field with uncertainty. This function calculates the probability of the isosurface passing through each cell in the grid based on an ensemble of scalar fields. The method is based on the paper: Pöthkow, K., Weber, B. and Hege, H.-C. (2011), Probabilistic Marching Cubes. Computer Graphics Forum, 30: 931-940. https://doi.org/10.1111/j.1467-8659.2011.01942.x

This parallelized version processes cells concurrently using multiprocessing for improved performance.

Parameters:
  • ensemble_images (np.ndarray) – 4D array of shape (n_z, n_y, n_x, n_ensemble) representing the scalar field with ensemble members.

  • isovalue (float) – The isovalue for which to compute the isosurface.

  • num_samples (int, optional) – Number of Monte Carlo samples to draw for estimating the probability of contour presence in each cell.

  • n_jobs (int, optional) – Number of parallel processes to use. If None, uses all available CPU cores. Set to 1 for serial execution (useful for debugging).

Returns:

probability_contour – 3D array of shape (n_z-1, n_y-1, n_x-1) with probabilities of contour presence in each cell.

Return type:

np.ndarray

uvisbox.Core.CellsCrossingProb.crossing_probability_mc.crossing_probability_tetrahedra_monte_carlo(ensemble_data, tetrahedral_mesh, isovalue, num_samples=200, n_jobs=None)[source]

Perform probabilistic marching tetrahedra on an ensemble of scalar fields defined on a tetrahedral mesh. The function calculates the probability of the isosurface passing through each tetrahedron based on Monte Carlo sampling.

This parallelized version processes tetrahedra concurrently using multiprocessing for improved performance.

Parameters:
  • ensemble_data (np.ndarray) – 2D array of shape (num_points, n_ensemble) where each column is a realization and each row corresponds to a vertex in the tetrahedral mesh.

  • tetrahedral_mesh (np.ndarray) – 2D array of shape (num_tetrahedra, 4) representing the tetrahedra. Each row contains the indices of the four vertices forming a tetrahedron.

  • isovalue (float) – The isovalue for which to compute the isosurface.

  • num_samples (int, optional) – Number of Monte Carlo samples to draw for estimating the probability of contour presence in each tetrahedron.

  • n_jobs (int, optional) – Number of parallel processes to use. If None, uses all available CPU cores. Set to 1 for serial execution (useful for debugging).

Returns:

probability_contour – 1D array of shape (num_tetrahedra,) with probabilities of contour presence in each tetrahedron.

Return type:

np.ndarray