<commit_before>from __future__ import division, print_function, absolute_import, unicode_literals

from warnings import warn

import h5py
import matplotlib as mpl
import numpy as np
import scipy
from matplotlib import pyplot as plt

from pyUSID import USIDataset
from pyUSID.io.hdf_utils import get_attr
from pyUSID.viz.plot_utils import plot_complex_spectra, plot_map_stack, default_cmap, unicode, plot_map, \
    discrete_cmap, plot_line_family, make_scalar_mappable, plot_curves


def plot_cluster_h5_group(h5_group, labels_kwargs=None, centroids_kwargs=None):
    """
    Plots the cluster labels and mean response for each cluster

    Parameters
    ----------
    h5_group : h5py.Datagroup object
        H5 group containing the labels and mean response
    labels_kwargs : dict, optional
        keyword arguments for the labels plot. NOT enabled yet.
    centroids_kwargs : dict, optional
        keyword arguments for the centroids plot. NOT enabled yet.

    Returns
    -------
    fig_labels : figure handle
        Figure containing the labels
    fig_centroids : figure handle
        Figure containing the centroids
    """<commit_msg>corrected error in importing unicode in cluster_utils<commit_after>from __future__ import division, print_function, absolute_import, unicode_literals
import sys
from warnings import warn
import h5py
import matplotlib as mpl
import numpy as np
import scipy
from matplotlib import pyplot as plt

if sys.version_info.major == 3:
    unicode = str

from pyUSID import USIDataset
from pyUSID.io.hdf_utils import get_attr
from pyUSID.viz.plot_utils import plot_complex_spectra, plot_map_stack, default_cmap, plot_map, \
    discrete_cmap, plot_line_family, make_scalar_mappable, plot_curves


def plot_cluster_h5_group(h5_group, labels_kwargs=None, centroids_kwargs=None):
    """
    Plots the cluster labels and mean response for each cluster

    Parameters
    ----------
    h5_group : h5py.Datagroup object
        H5 group containing the labels and mean response
    labels_kwargs : dict, optional
        keyword arguments for the labels plot. NOT enabled yet.
    centroids_kwargs : dict, optional
        keyword arguments for the centroids plot. NOT enabled yet.

    Returns
    -------
    fig_labels : figure handle
        Figure containing the labels
    fig_centroids : figure handle
        Figure containing the centroids
    """
{'fraction_non_alphanumeric': 0.05307145842039281, 'fraction_numerical': 0.005432511491851233, 'mean_word_length': 3.6216216216216215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2207453', 'n_tokens_mistral': 683, 'n_tokens_neox': 679, 'n_words': 240}