K i fdZddlZddlZddlZddlZddlZddlmZgdZ ejejdZ e Z dZdZd Zd Zd Zd Zd ZdZdZeeeeeeeedZdZdZdZdZdZddZe eddZ ddZe eddZ ddZ!e e!ddZ"y) z Histogram-related functions N) overrides) histogram histogramddhistogram_bin_edgesnumpy)modulecRt|j|jS)aPeak-to-peak value of x. This implementation avoids the problem of signed integer arrays having a peak-to-peak value that cannot be represented with the array's data type. This function returns an unsigned value for signed integer arrays. )_unsigned_subtractmaxmin)xs `/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/numpy/lib/_histograms_impl.py_ptprs aeegquuw //cZ~t|tj|jz S)a~ Square root histogram bin estimator. Bin width is inversely proportional to the data size. Used by many programs for its simplicity. Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. Returns ------- h : An estimate of the optimal bin width for the given data. )rnpsqrtsizer ranges r_hist_bin_sqrtr s""  7RWWQVV_ $$rc`~t|tj|jdzz S)a Sturges histogram bin estimator. A very simplistic estimator based on the assumption of normality of the data. This estimator has poor performance for non-normal data, which becomes especially obvious for large data sets. The estimate depends only on size of the data. Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. Returns ------- h : An estimate of the optimal bin width for the given data. ?)rrlog2rrs r_hist_bin_sturgesr5s'&  7bggaffo+ ,,rc@~t|d|jdzzz S)aI Rice histogram bin estimator. Another simple estimator with no normality assumption. It has better performance for large data than Sturges, but tends to overestimate the number of bins. The number of bins is proportional to the cube root of data size (asymptotically optimal). The estimate depends only on size of the data. Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. Returns ------- h : An estimate of the optimal bin width for the given data. @UUUUUU?)rrrs r_hist_bin_ricerLs$(  7cAFFw// 00rc|~dtjdzz|jz dztj|zS)a Scott histogram bin estimator. The binwidth is proportional to the standard deviation of the data and inversely proportional to the cube root of data size (asymptotically optimal). Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. Returns ------- h : An estimate of the optimal bin width for the given data. g8@?r)rpirstdrs r_hist_bin_scottr$ds5$  255#:  &) 4rvvay @@rc.jtdksdk(ryfd}tdtt j }t td|dz|}||k(rtjdtd|z S) a; Histogram bin estimator based on minimizing the estimated integrated squared error (ISE). The number of bins is chosen by minimizing the estimated ISE against the unknown true distribution. The ISE is estimated using cross-validation and can be regarded as a generalization of Scott's rule. https://en.wikipedia.org/wiki/Histogram#Scott.27s_normal_reference_rule This paper by Stone appears to be the origination of this rule. https://digitalassets.lib.berkeley.edu/sdtr/ucb/text/34.pdf Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. range : (float, float) The lower and upper range of the bins. Returns ------- h : An estimate of the optimal bin width for the given data. rc|z }tj|dz }ddz|j|zz |z S)N)binsrrr&)rrdot)nbinshhp_knptp_xrr s rjhatz_hist_bin_stone..jhatsI U]ll156q9A=QUcggcl**b00rd)keyz/The number of bins estimated may be suboptimal. stacklevel) rrr intrrr _rangewarningswarnRuntimeWarning)r rr0nbins_upper_boundr+r.r/s`` @@r_hist_bin_stoner<zs2 A GEAv!1 CRWWQZ1 q+a/0d ;E !! G$ 4 5=rcT~|jdkDrtjd|jdz z|jdz|jdzzz }tj|}|dkDr|tj|z }tj |||tj |d|tj|}t|dtj|jztjdtj||z zzz Sy)a Doane's histogram bin estimator. Improved version of Sturges' formula which works better for non-normal data. See stats.stackexchange.com/questions/55134/doanes-formula-for-histogram-binning Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. Returns ------- h : An estimate of the optimal bin width for the given data. r)g@rr3g) rrrr#mean true_dividepowerrrabsolute)r rsg1sigmatempg1s r_hist_bin_doanerFs$ vvzggcQVVaZ(QVVc\affqj,IJKq  3;rwwqz>D NN4 - HHT1d #B7cBGGAFFO3$&GGC"++b/C2G,G$HIJ J rc~~tjtj|ddg}d|z|jdzzS)a= The Freedman-Diaconis histogram bin estimator. The Freedman-Diaconis rule uses interquartile range (IQR) to estimate binwidth. It is considered a variation of the Scott rule with more robustness as the IQR is less affected by outliers than the standard deviation. However, the IQR depends on fewer points than the standard deviation, so it is less accurate, especially for long tailed distributions. If the IQR is 0, this function returns 0 for the bin width. Binwidth is inversely proportional to the cube root of data size (asymptotically optimal). Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. Returns ------- h : An estimate of the optimal bin width for the given data. KrgUUUUUUտ)rsubtract percentiler)r riqrs r _hist_bin_fdrMs<2  ++r}}QR1 2C 9qvv*- --rct||}t||}t||}t||dz }t ||S)a Histogram bin estimator that uses the minimum width of a relaxed Freedman-Diaconis and Sturges estimators if the FD bin width does not result in a large number of bins. The relaxed Freedman-Diaconis estimator limits the bin width to half the sqrt estimated to avoid small bins. The FD estimator is usually the most robust method, but its width estimate tends to be too large for small `x` and bad for data with limited variance. The Sturges estimator is quite good for small (<1000) datasets and is the default in the R language. This method gives good off-the-shelf behaviour. Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. May not be empty. range : Tuple with range for the histogram Returns ------- h : An estimate of the optimal bin width for the given data. See Also -------- _hist_bin_fd, _hist_bin_sturges r))rMrrr r )r rfd_bw sturges_bwsqrt_bwfd_bw_correcteds r_hist_bin_autorSsE: E "E"1e,JQ&G%1-O  ++r)stoneautodoanefdricescottrsturgesctj|}|jtjk(r\d|jdtjd}t j |td|jtj}|Itj|}|j|jk7r td|j}|j}||fS)z: Check a and weights have matching shapes, and ravel both zConverting input from z to z for compatibility.r3r4z(weights should have the same shape as a.) rasarraydtypebooluint8r8r9r:astypeshape ValueErrorravel)aweightsmsgs r_ravel_and_check_weightsrgs 1 A ww"''&qwwitBHH:=PQ c>a8 HHRXX **W% ==AGG #:< <--/  A g:rc|Q|\}}||kDr tdtj|rtj|std|d|d|jdk(rd\}}n\|j |j }}tj|rtj|std|d|d||k(r |dz }|dz}||fS) z^ Determine the outer bin edges to use, from either the data or the range argument z/max must be larger than min in range parameter.zsupplied range of [z, z] is not finiter)rr&zautodetected range of [r!)rbrisfiniterr r )rdr first_edge last_edges r_get_outer_edgesrl*s   % I  !AC C J'BKK ,B%j\I;oNP P 1 $ I !I  J'BKK ,B)*R {/RT TY#% O y  rc Rtjtjtjtjtj tj tjtjtjtji}tj||} ||j}tjtj||tj||d|S#t$rtj|||cYSwxYw)z Subtract two values where a >= b, and produce an unsigned result This is needed when finding the difference between the upper and lower bound of an int16 histogram r]unsafe)castingr])rbyteubyteshortushortintcuintcint_uintlonglong ulonglong result_typetyperJr\KeyError)rdbsigned_to_unsigneddt unsigned_dts rr r Hs  "))   R\\  1 B @(1 {{2::ar2BJJq4K#+;@ @ +{{1ar**+s0D!D&%D&cd}d}t|tr|}|tvrt|d| t dt ||\}}|1||k\} | ||kz} t jj| s|| }|jdk(rd}n(t||||f} | rct j|jt jr| dkrd} t||} tt j| | z }nd}nt j |dk(r6 t#j$|}|dkr tdt ||\}}nat j |dk(r>t j&|}t j(|dd|ddkDrtd td |t j*|} t j| t jrt j*| t,} t j.|||dzd | }t j(|dd|ddk\rtd |d||||ffS|dfS#t$r} t d| d} ~ wwxYw)a Computes the bins used internally by `histogram`. Parameters ========== a : ndarray Ravelled data array bins, range Forwarded arguments from `histogram`. weights : ndarray, optional Ravelled weights array, or None Returns ======= bin_edges : ndarray Array of bin edges uniform_bins : (Number, Number, int): The upper bound, lowerbound, and number of bins, used in the optimized implementation of `histogram` that works on uniform bins. Nz$ is not a valid estimator for `bins`zMAutomated estimation of the number of bins is not supported for weighted datarr&z0`bins` must be an integer, a string, or an arrayz(`bins` must be positive, when an integerz1`bins` must increase monotonically, when an arrayz `bins` must be 1d, when an arrayT)endpointr]z,Too many bins for data range. Cannot create z finite-sized bins.) isinstancestr_hist_bin_selectorsrb TypeErrorrlr logical_andreducer issubdtyper]integerr r6ceilndimoperatorindexr\anyr{floatlinspace)rdr(rre n_equal_bins bin_edgesbin_namerjrkkeepwidthdeltaebin_types r_get_bin_edgesrds,LI$ . .,BCE E  FG G!1E : I  OD Q)^ $D>>((.dG 66Q;L(1!j)5LME=="**5%!)E*9jA"27755=#9:  ! !  K#>>$/L ! GH H 0E : I ! JJt$ 66)CR.9QR=0 1CE E;<<>>*i; ==2:: .~~h6HKK  |nM%&' ':y,???$G KBDIJ K Ks!I## I=, I88I=c|tj|j|ddd|j|dddfS)z Like `searchsorted`, but where the last item in `v` is placed on the right. In the context of a histogram, this makes the last bin edge inclusive Nrleftright)r concatenate searchsorted)rdvs r_search_sorted_inclusiversB >> q"vv& qvw' rc |||fSN)rdr(rres r_histogram_bin_edges_dispatcherrs tW rcFt||\}}t||||\}}|S)a Function to calculate only the edges of the bins used by the `histogram` function. Parameters ---------- a : array_like Input data. The histogram is computed over the flattened array. bins : int or sequence of scalars or str, optional If `bins` is an int, it defines the number of equal-width bins in the given range (10, by default). If `bins` is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths. If `bins` is a string from the list below, `histogram_bin_edges` will use the method chosen to calculate the optimal bin width and consequently the number of bins (see the Notes section for more detail on the estimators) from the data that falls within the requested range. While the bin width will be optimal for the actual data in the range, the number of bins will be computed to fill the entire range, including the empty portions. For visualisation, using the 'auto' option is suggested. Weighted data is not supported for automated bin size selection. 'auto' Minimum bin width between the 'sturges' and 'fd' estimators. Provides good all-around performance. 'fd' (Freedman Diaconis Estimator) Robust (resilient to outliers) estimator that takes into account data variability and data size. 'doane' An improved version of Sturges' estimator that works better with non-normal datasets. 'scott' Less robust estimator that takes into account data variability and data size. 'stone' Estimator based on leave-one-out cross-validation estimate of the integrated squared error. Can be regarded as a generalization of Scott's rule. 'rice' Estimator does not take variability into account, only data size. Commonly overestimates number of bins required. 'sturges' R's default method, only accounts for data size. Only optimal for gaussian data and underestimates number of bins for large non-gaussian datasets. 'sqrt' Square root (of data size) estimator, used by Excel and other programs for its speed and simplicity. range : (float, float), optional The lower and upper range of the bins. If not provided, range is simply ``(a.min(), a.max())``. Values outside the range are ignored. The first element of the range must be less than or equal to the second. `range` affects the automatic bin computation as well. While bin width is computed to be optimal based on the actual data within `range`, the bin count will fill the entire range including portions containing no data. weights : array_like, optional An array of weights, of the same shape as `a`. Each value in `a` only contributes its associated weight towards the bin count (instead of 1). This is currently not used by any of the bin estimators, but may be in the future. Returns ------- bin_edges : array of dtype float The edges to pass into `histogram` See Also -------- histogram Notes ----- The methods to estimate the optimal number of bins are well founded in literature, and are inspired by the choices R provides for histogram visualisation. Note that having the number of bins proportional to :math:`n^{1/3}` is asymptotically optimal, which is why it appears in most estimators. These are simply plug-in methods that give good starting points for number of bins. In the equations below, :math:`h` is the binwidth and :math:`n_h` is the number of bins. All estimators that compute bin counts are recast to bin width using the `ptp` of the data. The final bin count is obtained from ``np.round(np.ceil(range / h))``. The final bin width is often less than what is returned by the estimators below. 'auto' (minimum bin width of the 'sturges' and 'fd' estimators) A compromise to get a good value. For small datasets the Sturges value will usually be chosen, while larger datasets will usually default to FD. Avoids the overly conservative behaviour of FD and Sturges for small and large datasets respectively. Switchover point is usually :math:`a.size \approx 1000`. 'fd' (Freedman Diaconis Estimator) .. math:: h = 2 \frac{IQR}{n^{1/3}} The binwidth is proportional to the interquartile range (IQR) and inversely proportional to cube root of a.size. Can be too conservative for small datasets, but is quite good for large datasets. The IQR is very robust to outliers. 'scott' .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}} The binwidth is proportional to the standard deviation of the data and inversely proportional to cube root of ``x.size``. Can be too conservative for small datasets, but is quite good for large datasets. The standard deviation is not very robust to outliers. Values are very similar to the Freedman-Diaconis estimator in the absence of outliers. 'rice' .. math:: n_h = 2n^{1/3} The number of bins is only proportional to cube root of ``a.size``. It tends to overestimate the number of bins and it does not take into account data variability. 'sturges' .. math:: n_h = \log _{2}(n) + 1 The number of bins is the base 2 log of ``a.size``. This estimator assumes normality of data and is too conservative for larger, non-normal datasets. This is the default method in R's ``hist`` method. 'doane' .. math:: n_h = 1 + \log_{2}(n) + \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right) g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right] \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}} An improved version of Sturges' formula that produces better estimates for non-normal datasets. This estimator attempts to account for the skew of the data. 'sqrt' .. math:: n_h = \sqrt n The simplest and fastest estimator. Only takes into account the data size. Additionally, if the data is of integer dtype, then the binwidth will never be less than 1. Examples -------- >>> import numpy as np >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) >>> np.histogram_bin_edges(arr, bins='auto', range=(0, 1)) array([0. , 0.25, 0.5 , 0.75, 1. ]) >>> np.histogram_bin_edges(arr, bins=2) array([0. , 2.5, 5. ]) For consistency with histogram, an array of pre-computed bins is passed through unmodified: >>> np.histogram_bin_edges(arr, [1, 2]) array([1, 2]) This function allows one set of bins to be computed, and reused across multiple histograms: >>> shared_bins = np.histogram_bin_edges(arr, bins='auto') >>> shared_bins array([0., 1., 2., 3., 4., 5.]) >>> group_id = np.array([0, 1, 1, 0, 1, 1, 0, 1, 1]) >>> hist_0, _ = np.histogram(arr[group_id == 0], bins=shared_bins) >>> hist_1, _ = np.histogram(arr[group_id == 1], bins=shared_bins) >>> hist_0; hist_1 array([1, 1, 0, 1, 0]) array([2, 0, 1, 1, 2]) Which gives more easily comparable results than using separate bins for each histogram: >>> hist_0, bins_0 = np.histogram(arr[group_id == 0], bins='auto') >>> hist_1, bins_1 = np.histogram(arr[group_id == 1], bins='auto') >>> hist_0; hist_1 array([1, 1, 1]) array([2, 1, 1, 2]) >>> bins_0; bins_1 array([0., 1., 2., 3.]) array([0. , 1.25, 2.5 , 3.75, 5. ]) )rgr)rdr(rrer_s rrrs/T*!W5JAw!!T5':LIq rc |||fSrr)rdr(rdensityres r_histogram_dispatcherrs tW rct||\}}t||||\}}|$tjtj}n |j}d}|duxsTtj |jtj xs$tj |jt} || r|\} } } tj| |} | }t| | }tdt||D]}||||z}|d}n||||z}|| k\}||| kz}tjj|s ||}|||}|j|jd}t|| |z |z}|jtj}||| k(xxdzcc<|||k}||xxdzcc<|||dzk\|| dz k7z}||xxdz cc<|jdk(rl| xj tj"||j | z c_| xj$tj"||j$| z c_`| tj"||| j|z } ntj|j&|}|Ftdt||D],}tj(||||z}|t+||z }.ntjd| }tdt||D]j}||||z}||||z}tj,|}||}||}tj.||j1f}t+||}|||z }ltj2|} |rEtj4tj2|t6}| |z | j9z |fS| |fS) a Compute the histogram of a dataset. Parameters ---------- a : array_like Input data. The histogram is computed over the flattened array. bins : int or sequence of scalars or str, optional If `bins` is an int, it defines the number of equal-width bins in the given range (10, by default). If `bins` is a sequence, it defines a monotonically increasing array of bin edges, including the rightmost edge, allowing for non-uniform bin widths. If `bins` is a string, it defines the method used to calculate the optimal bin width, as defined by `histogram_bin_edges`. range : (float, float), optional The lower and upper range of the bins. If not provided, range is simply ``(a.min(), a.max())``. Values outside the range are ignored. The first element of the range must be less than or equal to the second. `range` affects the automatic bin computation as well. While bin width is computed to be optimal based on the actual data within `range`, the bin count will fill the entire range including portions containing no data. weights : array_like, optional An array of weights, of the same shape as `a`. Each value in `a` only contributes its associated weight towards the bin count (instead of 1). If `density` is True, the weights are normalized, so that the integral of the density over the range remains 1. Please note that the ``dtype`` of `weights` will also become the ``dtype`` of the returned accumulator (`hist`), so it must be large enough to hold accumulated values as well. density : bool, optional If ``False``, the result will contain the number of samples in each bin. If ``True``, the result is the value of the probability *density* function at the bin, normalized such that the *integral* over the range is 1. Note that the sum of the histogram values will not be equal to 1 unless bins of unity width are chosen; it is not a probability *mass* function. Returns ------- hist : array The values of the histogram. See `density` and `weights` for a description of the possible semantics. If `weights` are given, ``hist.dtype`` will be taken from `weights`. bin_edges : array of dtype float Return the bin edges ``(length(hist)+1)``. See Also -------- histogramdd, bincount, searchsorted, digitize, histogram_bin_edges Notes ----- All but the last (righthand-most) bin is half-open. In other words, if `bins` is:: [1, 2, 3, 4] then the first bin is ``[1, 2)`` (including 1, but excluding 2) and the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which *includes* 4. Examples -------- >>> import numpy as np >>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3]) (array([0, 2, 1]), array([0, 1, 2, 3])) >>> np.histogram(np.arange(4), bins=np.arange(5), density=True) (array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) (array([1, 4, 1]), array([0, 1, 2, 3])) >>> a = np.arange(5) >>> hist, bin_edges = np.histogram(a, density=True) >>> hist array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) >>> hist.sum() 2.4999999999999996 >>> np.sum(hist * np.diff(bin_edges)) 1.0 Automated Bin Selection Methods example, using 2 peak random data with 2000 points. .. plot:: :include-source: import matplotlib.pyplot as plt import numpy as np rng = np.random.RandomState(10) # deterministic random data a = np.hstack((rng.normal(size=1000), rng.normal(loc=5, scale=2, size=1000))) plt.hist(a, bins='auto') # arguments are passed to np.histogram plt.title("Histogram with 'auto' bins") plt.show() NirF)copyr&c)re minlengthrn)rgrrr]intpcan_castdoublecomplexzerosr r7lenrrr`kindrealbincountimagrasortrargsortrcumsumdiffarrayrsum) rdr(rrrer uniform_binsntypeBLOCKsimple_weightsrjrkrr.norm_numerator norm_denomitmp_atmp_wr f_indicesindices decrement incrementcum_nsazero sorting_indexswcw bin_indexdbs rrrsR*!W5JAw,QeWEI|!  E 4 , GMM299- , GMM7+ N/;+ I| HH\5 )&' :> 3q65), GAaE NE!e),Z'D Ui' (D>>((.d $!$KE LLuL=E-UJ?*L)*I&&rww/G G|+ , 1 , ' 22I I ! # 9Wq[#99#|a'779I I ! # zzS "++guzz0<>>"++guzz0<>>R[[%+799?GW, G^%0 ?As1vu- AWWQqU^,1"i@@ A88AU+DAs1vu- '!AI!e), " 5 1 =)=)^^T299;$784RC I& ' GGEN XXbggi(% 02v** i<rc#Kt|dr|n |Ed{tjt5|Ed{ddd|y757#1swYxYww)Nra)hasattr contextlibsuppressr)sampler(rrres r_histogramdd_dispatcherrsVvw    Y ' M s6AAAAAAAAAAcR j\}}tj |tj}|dgz|dgz}|tj|} t|} | |k7r td |d|z}nt||k7r tdt|D],} tj|| dk(rg|| dkrtd| dtdd| f|| \} } tj|| } tj | | | dz| <nxtj|| dk(rNtj|| | <tj"| dd | ddkDrtd| d td| d t| dz|| <tj$| || </t'fd t|D}t|D]$} dd| f| d k(}|| |xxdzcc<&tj(||}tj*|||j-}|j/|}|j1t2d}|t5dd fz}||}|ra|j7}t|D]>} tj8|t:}|| dz || <||| j/|z }@||z}|j|dz k7j#r t=d|fS#ttf$r2tjj j\}}Y[wxYw#t$r ||gz}Y wxYw#t$r}td| d |d}~wwxYw)a Compute the multidimensional histogram of some data. Parameters ---------- sample : (N, D) array, or (N, D) array_like The data to be histogrammed. Note the unusual interpretation of sample when an array_like: * When an array, each row is a coordinate in a D-dimensional space - such as ``histogramdd(np.array([p1, p2, p3]))``. * When an array_like, each element is the list of values for single coordinate - such as ``histogramdd((X, Y, Z))``. The first form should be preferred. bins : sequence or int, optional The bin specification: * A sequence of arrays describing the monotonically increasing bin edges along each dimension. * The number of bins for each dimension (nx, ny, ... =bins) * The number of bins for all dimensions (nx=ny=...=bins). range : sequence, optional A sequence of length D, each an optional (lower, upper) tuple giving the outer bin edges to be used if the edges are not given explicitly in `bins`. An entry of None in the sequence results in the minimum and maximum values being used for the corresponding dimension. The default, None, is equivalent to passing a tuple of D None values. density : bool, optional If False, the default, returns the number of samples in each bin. If True, returns the probability *density* function at the bin, ``bin_count / sample_count / bin_volume``. weights : (N,) array_like, optional An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. Weights are normalized to 1 if density is True. If density is False, the values of the returned histogram are equal to the sum of the weights belonging to the samples falling into each bin. Returns ------- H : ndarray The multidimensional histogram of sample x. See density and weights for the different possible semantics. edges : tuple of ndarrays A tuple of D arrays describing the bin edges for each dimension. See Also -------- histogram: 1-D histogram histogram2d: 2-D histogram Examples -------- >>> import numpy as np >>> rng = np.random.default_rng() >>> r = rng.normal(size=(100,3)) >>> H, edges = np.histogramdd(r, bins = (5, 8, 4)) >>> H.shape, edges[0].size, edges[1].size, edges[2].size ((5, 8, 4), 6, 9, 5) NzEThe dimension of bins must be equal to the dimension of the sample x.rz0range argument must have one entry per dimensionrr&z`bins[z$]` must be positive, when an integerz$]` must be an integer, when a scalarrz2]` must be monotonically increasing, when an arrayz]` must be a scalar or 1d arrayc3bK|]&}tj|dd|fd(yw)Nr)side)rr).0redgesrs r zhistogramdd..s7  a&A,W==s,/)rsafe)rpr)zInternal Shape Error)raAttributeErrorrbr atleast_2dTemptyrr\rrr7rrlrrrrrtupleravel_multi_indexrprodreshaper`rsliceronesr6 RuntimeError)rr(rrreNDnbindedgesMrsminsmaxr.rNcounton_edgexyhistcoresrars` @rrrsH||1 88Arww D JE $ZF**W% I 6   }!  UqKLLAY& 7747 q Aw{ QCCDFF)&A,aAJD$ NN47+{{4q1u5E!H WWT!W  "zz$q'*E!HvveAhsmeAhqrl23 QCQRTT:;= =eAh-!#QGGE!H%q 3&8FAY !Q$<58B</q 'a    fd +B ;;r7diik :D << D ;;uf; -D a  D :D HHJ 3AGGAsOEAw{E!H&)++E22D 3   dQh##% "$ $ ;K J 'v&((||1" D6z( QCCD s;L.M23N.=M/.M/2NN N&N!!N&)NNN) NN)NNNN)rNNN)#__doc__r functoolsrr8rr numpy._corer__all__partialarray_function_dispatchrr7rrrrr$r<rFrMrSrrgrlr rrrrrrrrrrrrs+! =+)++ %%g7 0%*-.10A,(V F.<",L!0- /)- /-"35(!<@8bJ 89K:K^9= ./U0UpDH$(01k2kr