# Path: paratemp/utils.py
# def calc_fes_1d(data, temp, bins=None):
#     d_bins = _parse_bin_input(bins)
#     n, _bins = np.histogram(data, **d_bins)
#     n = [float(j) for j in n]
#     # TODO find better way to account for zeros here rather than
#     # just adding a small amount to each.
#     prob = np.array([j / max(n) for j in n]) + 1e-40
#     delta_g = np.array([-r * temp * np.log(p) for p in prob])
#     bin_mids = running_mean(_bins, 2)
#     return delta_g, bin_mids
# 
# def _parse_ax_input(ax):
#     if ax is None:
#         fig, ax = plt.subplots()
#     else:
#         fig = ax.figure
#     return fig, ax
# 
# Path: paratemp/exceptions.py
# class InputError(Exception):
#     """Exception raised for errors in the input.
# 
#     Attributes:
#         expr -- input expression in which the error occurred
#         msg  -- explanation of the error
#     """
# 
#     def __init__(self, expr, msg):
#         self.expr = expr
#         self.msg = msg
# 
#     def __str__(self):
#         output = 'Incorrect input "{}". {}'.format(self.expr, self.msg)
#         return repr(output)


import math
import matplotlib as mpl
from matplotlib import pyplot as plt
from six.moves import range
from .utils import calc_fes_1d, _parse_ax_input
from .exceptions import InputError
        fig, axes = plt.subplots(nrows=2, ncols=2, sharey=True, sharex=True)
    else:
        try:
            fig = axes.flat[3].figure
        except (IndexError, TypeError):
            raise InputError(
                "axes={}".format(axes),
                "Input axes must be " "able to plot at least four things",
            )
        except AttributeError:
            try:
                fig = axes[3].figure
            except IndexError:
                raise InputError(
                    "axes={}".format(axes),
                    "Input axes must " "be able to plot at least four things",
                )
    if labels is None:
        _labels = data.columns[:3]
    elif len(labels) >= 3:
        _labels = labels[:3]
    else:
        raise InputError(labels, "len(labels) must be >= 3 if not None")
    delta_gs = []
    bin_data = []
    handles = []
    # Use whatever the default colors for the system are
    # TODO find a more elegant way to do this
    colors = mpl.rcParams["axes.prop_cycle"].by_key()["color"]
    for i, key in enumerate(_labels):

# Path: paratemp/utils.py
# def calc_fes_1d(data, temp, bins=None):
#     d_bins = _parse_bin_input(bins)
#     n, _bins = np.histogram(data, **d_bins)
#     n = [float(j) for j in n]
#     # TODO find better way to account for zeros here rather than
#     # just adding a small amount to each.
#     prob = np.array([j / max(n) for j in n]) + 1e-40
#     delta_g = np.array([-r * temp * np.log(p) for p in prob])
#     bin_mids = running_mean(_bins, 2)
#     return delta_g, bin_mids
# 
# def _parse_ax_input(ax):
#     if ax is None:
#         fig, ax = plt.subplots()
#     else:
#         fig = ax.figure
#     return fig, ax
# 
# Path: paratemp/exceptions.py
# class InputError(Exception):
#     """Exception raised for errors in the input.
# 
#     Attributes:
#         expr -- input expression in which the error occurred
#         msg  -- explanation of the error
#     """
# 
#     def __init__(self, expr, msg):
#         self.expr = expr
#         self.msg = msg
# 
#     def __str__(self):
#         output = 'Incorrect input "{}". {}'.format(self.expr, self.msg)
#         return repr(output)


# Path: paratemp/plotting.py
import math
import matplotlib as mpl
from matplotlib import pyplot as plt
from six.moves import range
from .utils import calc_fes_1d, _parse_ax_input
from .exceptions import InputError

        fig, axes = plt.subplots(nrows=2, ncols=2, sharey=True, sharex=True)
    else:
        try:
            fig = axes.flat[3].figure
        except (IndexError, TypeError):
            raise InputError(
                "axes={}".format(axes),
                "Input axes must be " "able to plot at least four things",
            )
        except AttributeError:
            try:
                fig = axes[3].figure
            except IndexError:
                raise InputError(
                    "axes={}".format(axes),
                    "Input axes must " "be able to plot at least four things",
                )
    if labels is None:
        _labels = data.columns[:3]
    elif len(labels) >= 3:
        _labels = labels[:3]
    else:
        raise InputError(labels, "len(labels) must be >= 3 if not None")
    delta_gs = []
    bin_data = []
    handles = []
    # Use whatever the default colors for the system are
    # TODO find a more elegant way to do this
    colors = mpl.rcParams["axes.prop_cycle"].by_key()["color"]
    for i, key in enumerate(_labels):

        delta_g, bin_mids = calc_fes_1d(data[key], temp=temp, bins=bins)