trim_disconnected_clusters#

trim_disconnected_clusters(**kwargs)[source]#

Computes actual node and edge occupancy based on connectivity to the given inlets

Parameters:
  • b_labels (ndarray) – An array of cluster labels assigned to each bond. -1 indicates unoccupied

  • s_labels (ndarray) – An array of cluster labels assigned to each site. -1 indicates unoccupied. Site cluster numbers must correspond to the bond clusters, such that if bond j has a cluster number N, then both sites on each end of j are also labeled N.

  • inlets (ndarray) – An array containing node indices that are to be treated as inlets. Any clusters labels not found in these nodes will be considered disconnected and set to -1.

Returns:

occupancy – The returned tuple containing arrays of cluster numbers of occupied_sites and occupied_bonds, after accounting for connection to the inlets.

Return type:

tuple of ndarrays

Notes

The b_labels and s_labels arrays are returned from the bond_percolation or site_percolation function.