(vals, t, **kwargs)
return clusters
Find clusters in <vals> using hierarchical clustering with parameter <t>. Further parameters need to be passed via
    <kwargs>. Uses *fclusterdata* from *scipy.cluster.hierarchy*.
Find clusters in <vals> using hierarchical clustering with parameter <t>. Further parameters need to be passed via
    <kwargs>. Uses *fclusterdata* from *scipy.cluster.hierarchy*.
Find clusters in <vals > using hierarchical clustering with parameter <t > . Further parameters need to be passed via <kwargs > . Uses * fclusterdata * from * scipy . cluster . hierarchy * .
def find_clusters_1d_hierarchical(vals, t, **kwargs):
    """
    Find clusters in <vals> using hierarchical clustering with parameter <t>. Further parameters need to be passed via
    <kwargs>. Uses *fclusterdata* from *scipy.cluster.hierarchy*.
    """
    from scipy.cluster.hierarchy import fclusterdata
    
    data = vals.reshape((len(vals), 1))
    ind = fclusterdata(data, t, **kwargs)
    
    clusters = [np.where(ind == c_id)[0] for c_id in np.unique(ind)]
    
    assert len(vals) == sum(map(len, clusters))
    
    return clusters
def find_clusters_1d_hierarchical ( vals , t , * * kwargs ) : from scipy . cluster . hierarchy import fclusterdata data = vals . reshape ( ( len ( vals ) , 1 ) ) ind = fclusterdata ( data , t , * * kwargs ) clusters = [ np . where ( ind == c_id ) [ 0 ] for c_id in np . unique ( ind ) ] assert len ( vals ) == sum ( map ( len , clusters ) ) return clusters