uvisbox.Core.BandDepths.contour_banddepth

Module Contents

uvisbox.Core.BandDepths.contour_banddepth.choose2(x)[source]

Helper function to compute x choose 2

Parameters:

x (int) – number of elements

Returns:

[] – x choose 2

Return type:

int

uvisbox.Core.BandDepths.contour_banddepth.get_combinations(n)[source]

returns (n_combination, 2) as list of pair of indices for n elements, get all 2-subsets

Parameters:

n (int) – number of elements

Returns:

combinations – array of shape (n_choose_2, 2)

Return type:

np.ndarray

uvisbox.Core.BandDepths.contour_banddepth.contour_banddepth(data, combination=None, allow_portion=False, eps=0, workers=12)[source]

Calculates the band depth of binary contour data using pairwise combinations. R. T. Whitaker, M. Mirzargar and R. M. Kirby, “Contour Boxplots: A Method for Characterizing Uncertainty in Feature Sets from Simulation Ensembles,” in IEEE Transactions on Visualization and Computer Graphics, vol. 19, no. 12, pp. 2713-2722, Dec. 2013, doi: 10.1109/TVCG.2013.143

Parameters:
  • data (np.ndarray) – Input data representing binary contours. Should be convertible to a boolean NumPy array.

  • combination (list of tuples, optional) – List of index pairs (xdx, ydx) specifying which images to combine for band depth calculation. If None, combinations are generated automatically.

  • allow_portion (bool, default False) – If True, uses a portion-based subset calculation for depth; otherwise, uses epsilon-based subset.

  • eps (float, default 0) – Epsilon tolerance for subset checks when allow_portion is False.

  • workers (int, default 12) – Number of parallel workers for multiprocessing. Set to 1 to disable parallel processing.

Returns:

depths – Array of band depth values for each image in the input data.

Return type:

np.ndarray

Raises:

ValueError: – If the input data cannot be converted to a boolean array.

Notes

  • The function expects binary contour data, where each image is represented as a boolean array.

  • Depth is computed by evaluating how each image fits within the intersection and union of pairs of images.

  • Helper functions _portion_subset and _epsilon_subset are used for subset checks.

  • Uses the operating system’s default multiprocessing context.