def analyze_clusters(arr, labels, nz):
    '\n    Analyzes clusters and returns characteristics in arrays.\n    \n    Parameters\n    ----------\n    arr : ndarray\n        the analyzed array\n    labels: arr\n        cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.\n    nz : tuple\n        tuple of arrays, each array containing indices of elements in arr that are non-zero along one axis.\n        \n    Returns\n    -------\n    tuple\n        tuple containing the following arrays:\n        nlabels              # number of labels, i.e clusters\n        labels_arr           # array with label for each non zero point\n        rel_cluster_size     # array with cluster size divided by max cluster size for each\n                             # non zero point\n        cluster_avg          # array with cluster average for each non zero point\n        noise_arr            # array with points that are non zero but not in cluster\n        no_noise             # array with noise poits set to 0\n        label_counts         # tuple of two arrays: First is label number, second is number of\n                             # occurances of that label (size of cluster)\n        cluster_avg_asym     # array with average asymmetry of a points in cluster\n        asymmetry            # array of asymmetry with regard to entire array\n        cluster_size         # array with cluster size for each non zero point\n    '
    labels_arr = np.zeros_like(arr)
    noise_arr = np.zeros_like(arr)
    cluster_size = np.zeros_like(arr)
    cluster_avg = np.zeros_like(arr).astype(np.float32)
    cluster_avg_asym = np.zeros_like(arr).astype(np.float32)
    asymmetry = get_asymmetry(arr)
    label_counts = np.unique(labels, return_counts=True)
    labels_arr[nz] = labels
    noise_pts = tuple([nz[n][(labels == (- 1))] for n in range(3)])
    no_noise = arr
    noise_arr[noise_pts] = arr[noise_pts]
    no_noise[noise_pts] = 0
    nlabels = len(label_counts[0])
    for n in range(1, nlabels):
        n_lab = label_counts[0][n]
        cluspts = tuple([nz[d][(labels == n_lab)] for d in range(3)])
        cluster_size[cluspts] = label_counts[1][n]
        cluster_avg[cluspts] = (np.sum(arr[cluspts]) / cluspts[0].size)
        cluster_avg_asym[cluspts] = (np.sum(asymmetry[cluspts]) / cluspts[0].size)
    rel_cluster_size = (cluster_size / cluster_size.max())
    return (nlabels, labels_arr, rel_cluster_size, cluster_avg, noise_arr, no_noise, label_counts, cluster_avg_asym, asymmetry, cluster_size)
Analyzes clusters and returns characteristics in arrays.

Parameters
----------
arr : ndarray
    the analyzed array
labels: arr
    cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.
nz : tuple
    tuple of arrays, each array containing indices of elements in arr that are non-zero along one axis.
    
Returns
-------
tuple
    tuple containing the following arrays:
    nlabels              # number of labels, i.e clusters
    labels_arr           # array with label for each non zero point
    rel_cluster_size     # array with cluster size divided by max cluster size for each
                         # non zero point
    cluster_avg          # array with cluster average for each non zero point
    noise_arr            # array with points that are non zero but not in cluster
    no_noise             # array with noise poits set to 0
    label_counts         # tuple of two arrays: First is label number, second is number of
                         # occurances of that label (size of cluster)
    cluster_avg_asym     # array with average asymmetry of a points in cluster
    asymmetry            # array of asymmetry with regard to entire array
    cluster_size         # array with cluster size for each non zero point
def analyze_clusters(arr, labels, nz):
    '\n    Analyzes clusters and returns characteristics in arrays.\n    \n    Parameters\n    ----------\n    arr : ndarray\n        the analyzed array\n    labels: arr\n        cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.\n    nz : tuple\n        tuple of arrays, each array containing indices of elements in arr that are non-zero along one axis.\n        \n    Returns\n    -------\n    tuple\n        tuple containing the following arrays:\n        nlabels              # number of labels, i.e clusters\n        labels_arr           # array with label for each non zero point\n        rel_cluster_size     # array with cluster size divided by max cluster size for each\n                             # non zero point\n        cluster_avg          # array with cluster average for each non zero point\n        noise_arr            # array with points that are non zero but not in cluster\n        no_noise             # array with noise poits set to 0\n        label_counts         # tuple of two arrays: First is label number, second is number of\n                             # occurances of that label (size of cluster)\n        cluster_avg_asym     # array with average asymmetry of a points in cluster\n        asymmetry            # array of asymmetry with regard to entire array\n        cluster_size         # array with cluster size for each non zero point\n    '
    labels_arr = np.zeros_like(arr)
    noise_arr = np.zeros_like(arr)
    cluster_size = np.zeros_like(arr)
    cluster_avg = np.zeros_like(arr).astype(np.float32)
    cluster_avg_asym = np.zeros_like(arr).astype(np.float32)
    asymmetry = get_asymmetry(arr)
    label_counts = np.unique(labels, return_counts=True)
    labels_arr[nz] = labels
    noise_pts = tuple([nz[n][(labels == (- 1))] for n in range(3)])
    no_noise = arr
    noise_arr[noise_pts] = arr[noise_pts]
    no_noise[noise_pts] = 0
    nlabels = len(label_counts[0])
    for n in range(1, nlabels):
        n_lab = label_counts[0][n]
        cluspts = tuple([nz[d][(labels == n_lab)] for d in range(3)])
        cluster_size[cluspts] = label_counts[1][n]
        cluster_avg[cluspts] = (np.sum(arr[cluspts]) / cluspts[0].size)
        cluster_avg_asym[cluspts] = (np.sum(asymmetry[cluspts]) / cluspts[0].size)
    rel_cluster_size = (cluster_size / cluster_size.max())
    return (nlabels, labels_arr, rel_cluster_size, cluster_avg, noise_arr, no_noise, label_counts, cluster_avg_asym, asymmetry, cluster_size)