def as_histogram(self, keep_channels=True, bins='unique'):
        r"""
        Histogram binning of the values of this image.

        Parameters
        ----------
        keep_channels : `bool`, optional
            If set to ``False``, it returns a single histogram for all the
            channels of the image. If set to ``True``, it returns a `list` of
            histograms, one for each channel.
        bins : ``{unique}``, positive `int` or sequence of scalars, optional
            If set equal to ``'unique'``, the bins of the histograms are centred
            on the unique values of each channel. If set equal to a positive
            `int`, then this is the number of bins. If set equal to a
            sequence of scalars, these will be used as bins centres.

        Returns
        -------
        hist : `ndarray` or `list` with ``n_channels`` `ndarrays` inside
            The histogram(s). If ``keep_channels=False``, then hist is an
            `ndarray`. If ``keep_channels=True``, then hist is a `list` with
            ``len(hist)=n_channels``.
        bin_edges : `ndarray` or `list` with `n_channels` `ndarrays` inside
            An array or a list of arrays corresponding to the above histograms
            that store the bins' edges.

        Raises
        ------
        ValueError
            Bins can be either 'unique', positive int or a sequence of scalars.

        Examples
        --------
        Visualizing the histogram when a list of array bin edges is provided:

        >>> hist, bin_edges = image.as_histogram()
        >>> for k in range(len(hist)):
        >>>     plt.subplot(1,len(hist),k)
        >>>     width = 0.7 * (bin_edges[k][1] - bin_edges[k][0])
        >>>     centre = (bin_edges[k][:-1] + bin_edges[k][1:]) / 2
        >>>     plt.bar(centre, hist[k], align='center', width=width)
        """
        # parse options
        if isinstance(bins, basestring):
            if bins == 'unique':
                bins = 0
            else:
                raise ValueError("Bins can be either 'unique', positive int or"
                                 "a sequence of scalars.")
        elif isinstance(bins, int) and 1 < bins:
            raise ValueError("Bins can be either 'unique', positive int or a "
                             "sequence of scalars.")
        # compute histogram
        vec = self.as_vector(keep_channels=keep_channels)
        if len(vec.shape) == 1 or vec.shape[0] == 1:
            if bins == 0:
                bins = np.unique(vec)
            hist, bin_edges = np.histogram(vec, bins=bins)
        else:
            hist = []
            bin_edges = []
            num_bins = bins
            for ch in range(vec.shape[0]):
                if bins == 0:
                    num_bins = np.unique(vec[ch, :])
                h_tmp, c_tmp = np.histogram(vec[ch, :], bins=num_bins)
                hist.append(h_tmp)
                bin_edges.append(c_tmp)
        return hist, bin_edges
dataset/ETHPy150Open menpo/menpo/menpo/image/base.py/Image.as_histogram/swapped operands of `<`