toad.postprocessing.member_support_consensus

Per-voxel member-support spacetime consensus.

Pipeline (read top to bottom in this module):

  1. _accumulate_member_support() — dilated vote counts per native event voxel

  2. _build_member_support_dataset() — threshold, label, assemble xarray output

  3. Connectivity helpers — group retained voxels into consensus cluster ids

compute_consensus() orchestrates these steps (grid context, empty result, finalize attrs on td.data).

Native 8-neighbour grid edges (native_spatial_edges()) are not left over from the old edge-vote (EAC) algorithm. They are used only when stitch_meridian=True to build spatial adjacency for connected-component labelling across the longitude seam. Support counting uses box dilation (_dilate_boolean_support_mask()); non-stitch labelling uses scipy.ndimage.label or a KD-tree Chebyshev graph.

Functions

min_consensus_members(n_inputs, min_consensus)

Minimum distinct inputs required to retain a native event voxel.

native_spatial_edges(mask2d, flat_idx_2d, *)

Undirected native 8-neighbour edges for cells where mask2d is True.

Classes

SpacetimeGridContext(spatial_dims, time_dim, ...)

Fixed grid layout for one member-support consensus run.

class toad.postprocessing.member_support_consensus.SpacetimeGridContext(spatial_dims, time_dim, T, y_len, x_len, coords_spatial, time_coord, n_space, spatial_er, spatial_ec, stitch_meridian)

Bases: object

Fixed grid layout for one member-support consensus run.

Parameters:
  • spatial_dims (tuple[str, str])

  • time_dim (str)

  • T (int)

  • y_len (int)

  • x_len (int)

  • coords_spatial (dict[str, Any])

  • time_coord (DataArray)

  • n_space (int)

  • spatial_er (ndarray)

  • spatial_ec (ndarray)

  • stitch_meridian (bool)

T: int
coords_spatial: dict[str, Any]
n_space: int
spatial_dims: tuple[str, str]
spatial_ec: ndarray
spatial_er: ndarray
stitch_meridian: bool
time_coord: DataArray
time_dim: str
x_len: int
y_len: int
toad.postprocessing.member_support_consensus.min_consensus_members(n_inputs, min_consensus)

Minimum distinct inputs required to retain a native event voxel.

Parameters:
  • n_inputs (int)

  • min_consensus (float)

Return type:

int

toad.postprocessing.member_support_consensus.native_spatial_edges(mask2d, flat_idx_2d, *, stitch_longitude=False)

Undirected native 8-neighbour edges for cells where mask2d is True.

Parameters:
  • mask2d (ndarray)

  • flat_idx_2d (ndarray)

  • stitch_longitude (bool)

Return type:

tuple[list[int], list[int]]