# 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
    :param str xlabel: Default: 'distance / $\\mathrm{\\AA}$'. The label for
        the x axis.

    :type ax: matplotlib.axes.Axes
    :param ax: Default: None. The axes objects on which to make the plots.
        If None is supplied, new axes objects will be created.

    :param data: Default: None.
        If given, this must be an object that can be indexed by `x` to give
        the series from which the FES should be made.

        For example, these are equivalent:

        >>> fes_1d(data[x], temp)

        >>> fes_1d(x, temp, data=data)

    :param kwargs: keyword arguments to pass to the plotter

    :rtype: Tuple(np.ndarray, np.ndarray, matplotlib.lines.Line2D,
        matplotlib.figure.Figure, matplotlib.axes.Axes)

    :return: The delta G values, the bin centers, the lines object, the
        figure and the axes
    """
    if data is not None:
        _x = data[x]
    else:
        _x = x
    _fig, _ax = _parse_ax_input(ax)

# 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

    :param str xlabel: Default: 'distance / $\\mathrm{\\AA}$'. The label for
        the x axis.

    :type ax: matplotlib.axes.Axes
    :param ax: Default: None. The axes objects on which to make the plots.
        If None is supplied, new axes objects will be created.

    :param data: Default: None.
        If given, this must be an object that can be indexed by `x` to give
        the series from which the FES should be made.

        For example, these are equivalent:

        >>> fes_1d(data[x], temp)

        >>> fes_1d(x, temp, data=data)

    :param kwargs: keyword arguments to pass to the plotter

    :rtype: Tuple(np.ndarray, np.ndarray, matplotlib.lines.Line2D,
        matplotlib.figure.Figure, matplotlib.axes.Axes)

    :return: The delta G values, the bin centers, the lines object, the
        figure and the axes
    """
    if data is not None:
        _x = data[x]
    else:
        _x = x
    _fig, _ax = _parse_ax_input(ax)

    delta_g, bin_mids = calc_fes_1d(_x, temp=temp, bins=bins)