
    IR-ez	                          d dl mZ dgZddZdS )    )calculate_bin_edgeshist
   N     j@c                 \   |                     dd          }|                     dd          }t          | |||          }t          |          |k    r0t          d                    t          |                              |ddlm} |                                } |j        | |fi |S )a  Enhanced histogram function.

    This is a histogram function that enables the use of more sophisticated
    algorithms for determining bins.  Aside from the ``bins`` argument allowing
    a string specified how bins are computed, the parameters are the same
    as pylab.hist().

    This function was ported from astroML: https://www.astroml.org/

    Parameters
    ----------
    x : array-like
        array of data to be histogrammed

    bins : int, list, or str, optional
        If bins is a string, then it must be one of:

        - 'blocks' : use bayesian blocks for dynamic bin widths

        - 'knuth' : use Knuth's rule to determine bins

        - 'scott' : use Scott's rule to determine bins

        - 'freedman' : use the Freedman-Diaconis rule to determine bins

    ax : `~matplotlib.axes.Axes` instance, optional
        Specify the Axes on which to draw the histogram. If not specified,
        then the current active axes will be used.

    max_bins : int, optional
        Maximum number of bins allowed. With more than a few thousand bins
        the performance of matplotlib will not be great. If the number of
        bins is large *and* the number of input data points is large then
        the it will take a very long time to compute the histogram.

    **kwargs :
        other keyword arguments are described in ``plt.hist()``.

    Notes
    -----
    Return values are the same as for ``plt.hist()``

    See Also
    --------
    astropy.stats.histogram
    rangeNweights)r   r	   zHistogram has too many bins: {nbin}. Use max_bins to increase the number of allowed bins or range to restrict the histogram range.)nbinr   )	getr   len
ValueErrorformatmatplotlib.pyplotpyplotgcar   )xbinsaxmax_binskwargsr   r	   plts           :lib/python3.11/site-packages/astropy/visualization/hist.pyr   r      s    b JJw%%EjjD))Gq$eWEEED
4yy8# $*6s4yy6#9#9	
 
 	
 
z''''''WWYY271d%%f%%%    )r   Nr   )astropy.stats.histogramr   __all__r    r   r   <module>r      sD    8 7 7 7 7 7(C& C& C& C& C& C&r   