/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/lib/__pycache__
NameSizeModeActions
arraypad.cpython-311.pyc307070644editdlrm
arraysetops.cpython-311.pyc372060644editdlrm
arrayterator.cpython-311.pyc103600644editdlrm
format.cpython-311.pyc367920644editdlrm
function_base.cpython-311.pyc2129720644editdlrm
histograms.cpython-311.pyc418690644editdlrm
index_tricks.cpython-311.pyc382250644editdlrm
mixins.cpython-311.pyc92830644editdlrm
nanfunctions.cpython-311.pyc706960644editdlrm
npyio.cpython-311.pyc1057840644editdlrm
polynomial.cpython-311.pyc562950644editdlrm
recfunctions.cpython-311.pyc704500644editdlrm
scimath.cpython-311.pyc182340644editdlrm
setup.cpython-311.pyc9470644editdlrm
shape_base.cpython-311.pyc456070644editdlrm
stride_tricks.cpython-311.pyc209800644editdlrm
twodim_base.cpython-311.pyc393220644editdlrm
type_check.cpython-311.pyc238690644editdlrm
ufunclike.cpython-311.pyc75440644editdlrm
user_array.cpython-311.pyc186240644editdlrm
utils.cpython-311.pyc461730644editdlrm
_datasource.cpython-311.pyc269920644editdlrm
_iotools.cpython-311.pyc377690644editdlrm
_version.cpython-311.pyc71360644editdlrm
__init__.cpython-311.pyc34520644editdlrm
Edit: /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/lib/__pycache__/histograms.cpython-311.pyc (41869B)
§ sÇ÷]PIã ó~—dZddlZddlZddlZddlZddlZddlmZgd¢Z ej ej d¬¦«Z e Z d„Zd„Zd „Zd „Zd „Zd „Zd „Zd„Zd„ZeeeeeeeedœZd„Zd„Zd„Zd„Zd„Zdd„Ze e¦«dd„¦«Z dd„Ze e¦«d d„¦«Z dd„Z!e e!¦«d d„¦«Z"dS)!z Histogram-related functions éN)Ú overrides)Ú histogramÚ histogramddÚhistogram_bin_edgesÚnumpy)Úmodulecój—t| ¦«| ¦«¦«S)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_subtractÚmaxÚmin)Úxs úh/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib64/python3.11/site-packages/numpy/lib/histograms.pyÚ_ptprs$€õ ˜aŸeše™gœg q§u¢u¡w¤wÑ /Ô /Ð/ócóV—~t|¦«tj|j¦«z 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. )rÚnpÚsqrtÚsize©r Úranges rÚ_hist_bin_sqrtr s"€ð" Ý �‰7Œ7•R”W˜QœV‘_”_Ñ $Ð$rcó\—~t|¦«tj|j¦«dzz 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. çð?)rrÚlog2rrs rÚ_hist_bin_sturgesr5s'€ð& Ý �‰7Œ7•b”g˜aœf‘o”o¨Ñ+Ñ ,Ð,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$€ð( Ý �‰7Œ7�c˜AœF wÑ/Ñ/Ñ 0Ð0rcóh—~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)rÚpirÚstdrs rÚ_hist_bin_scottr$ds1€ð$ Ø •2”5˜#‘:Ñ  ¤Ñ &¨)Ñ 4µr´v¸a±y´yÑ @Ð@rcóR‡‡‡‡—‰jŠt‰¦«Š‰dks‰dkrdSˆˆˆˆfd„}tdtt j‰¦«¦«¦«}t td|dz¦«|¬¦«}||krtj dtd¬¦«‰|z S) a6 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. http://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‰|‰¬¦«d‰z }d‰dz| |¦«zz |z S)N)Úbinsrrér&)rrÚdot)ÚnbinsÚhhÚp_kÚnÚptp_xrr s €€€€rÚjhatz_hist_bin_stone..jhat—sOø€Ø �U‰]ˆÝŒl˜1 5°Ð6Ñ6Ô6°qÔ9¸AÑ=ˆØ�Q˜‘U˜cŸgšg c™lœlÑ*Ñ*¨bÑ0Ð0réd)Úkeyz/The number of bins estimated may be suboptimal.é©Ú stacklevel) rrr Úintrrr Ú_rangeÚwarningsÚwarnÚRuntimeWarning)r rr0Únbins_upper_boundr+r.r/s`` @@rÚ_hist_bin_stoner<zsÑøøøø€ð0 Œ€AÝ �‰GŒG€E؈A‚v€v�˜!’�؈qð1ð1ð1ð1ð1ð1ð1ð1õ ˜C¥¥R¤W¨Q¡Z¤Z¡¤Ñ1Ô1ÐÝ •�qÐ+¨aÑ/Ñ0Ô0°dÐ ;Ñ ;Ô ;€EØ Ð!Ò!Ð!ÝŒ ÐGÝ$°ð 4ñ 4ô 4ð 4à �5‰=Ðrcó—~|jdkrÿtjd|jdz z|jdz|jdzzz ¦«}tj|¦«}|dkr°|tj|¦«z }tj|||¦«tj|d|¦«tj|¦«}t|¦«dtj|j¦«ztjdtj |¦«|z z¦«zz SdS)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_divideÚpowerrrÚabsolute)r rÚsg1ÚsigmaÚtempÚg1s rÚ_hist_bin_doanerF¤sð€ð$ Ø„v�‚z€zÝŒg�c˜QœV a™ZÑ(¨Q¬V°c©\¸a¼fÀq¹jÑ,IÑJÑKÔKˆÝ”�q‘ ” ˆØ �3Š;ˆ;ð•r”w˜q‘z”z‘>ˆDÝ ŒN˜4 ¨Ñ -Ô -Ð -Ý ŒH�T˜1˜dÑ #Ô #Ð #Ý”˜‘”ˆBݘ‘7”7˜c¥B¤G¨A¬F¡O¤OÑ3Ý$&¤G¨Cµ"´+¸b±/´/ÀCÑ2GÑ,GÑ$HÔ$HñIñJð Jà ˆ3rcój—~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. éKérgUUUUUUÕ¿)rÚsubtractÚ percentiler)r rÚiqrs rÚ _hist_bin_fdrMÇs9€ð2 Ý Œ+•r”} Q¨¨R¨Ñ1Ô1Ð 2€CØ �‰9�q”v *Ñ-Ñ -Ð-rcól—t||¦«}t||¦«}~|rt||¦«S|S)aý Histogram bin estimator that uses the minimum width of the Freedman-Diaconis and Sturges estimators if the FD bin width is non-zero. If the bin width from the FD estimator is 0, the Sturges estimator is used. 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. .. versionchanged:: 1.15.0 If there is limited variance the IQR can be 0, which results in the FD bin width being 0 too. This is not a valid bin width, so ``np.histogram_bin_edges`` chooses 1 bin instead, which may not be optimal. If the IQR is 0, it's unlikely any variance-based estimators will be of use, so we revert to the Sturges estimator, which only uses the size of the dataset in its calculation. 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. See Also -------- _hist_bin_fd, _hist_bin_sturges )rMrr )r rÚfd_bwÚ sturges_bws rÚ_hist_bin_autorQåsF€õD ˜˜EÑ "Ô "€EÝ" 1 eÑ,Ô,€JØ Ø ðÝ�5˜*Ñ%Ô%Ð%ðÐr)ÚstoneÚautoÚdoaneÚfdÚriceÚscottrÚsturgescóÒ—tj|¦«}|jtjkr^t jd |jtj¦«td¬¦«|  tj¦«}|�Gtj|¦«}|j |j krtd¦«‚|  ¦«}|  ¦«}||fS)z: Check a and weights have matching shapes, and ravel both z1Converting input from {} to {} for compatibility.r3r4Nz(weights should have the same shape as a.) rÚasarrayÚdtypeÚbool_r8r9ÚformatÚuint8r:ÚastypeÚshapeÚ ValueErrorÚravel)ÚaÚweightss rÚ_ravel_and_check_weightsresÆ€å Œ �1‰ Œ €Að „w•"”(ÒÐÝŒ ÐIß’v˜aœg¥r¤xÑ0Ô0Ý$°ð 4ñ 4ô 4ð 4ð �HŠH•R”XÑ Ô ˆàÐÝ”*˜WÑ%Ô%ˆØ Œ=˜AœGÒ #Ð #ÝØ:ñ<ô<ð <à—-’-‘/”/ˆØ �Љ Œ €AØ ˆgˆ:Ðrcó—|�f|\}}||krtd¦«‚tj|¦«rtj|¦«s#td ||¦«¦«‚n„|jdkrd\}}ns| ¦«| ¦«}}tj|¦«rtj|¦«s#td ||¦«¦«‚||kr |dz }|dz}||fS)z^ Determine the outer bin edges to use, from either the data or the range argument Nz/max must be larger than min in range parameter.z(supplied range of [{}, {}] is not finiter)rr&z,autodetected range of [{}, {}] is not finiter!)rarÚisfiniter]rr r )rcrÚ first_edgeÚ last_edges rÚ_get_outer_edgesrj0s5€ð  ÐØ %ш �IØ ˜ Ò !Ð !ÝØAñCôCð Cå” ˜JÑ'Ô'ð Z­B¬K¸ Ñ,BÔ,Bð ZÝØ:×AÒAÀ*ÈiÑXÔXñZôZð Zð Zð Œ�1Šˆà $ш �I�Ià !§¢¡¤¨¯ª©¬�Iˆ Ý” ˜JÑ'Ô'ð ^­B¬K¸ Ñ,BÔ,Bð ^ÝØ>×EÒEÀjÐR[Ñ\Ô\ñ^ô^ð ^ð�YÒÐØ #Ñ%ˆ Ø ‘Oˆ à �yÐ Ð rc ó¦—tjtjtjtjtjtjtjtjtj tj i}tj ||¦«} ||j }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 Úunsafe)Úcastingr[©r[)rÚbyteÚubyteÚshortÚushortÚintcÚuintcÚint_ÚuintÚlonglongÚ ulonglongÚ result_typeÚtyperJÚKeyError)rcÚbÚsigned_to_unsignedÚdts rr r Ns²€õ Œ•”Ý Œ•"”)Ý Œ•”Ý Œ•”Ý Œ •R”\ð Ðõ Œ˜˜1Ñ Ô €Bð=Ø  ¤Ô (ˆõ Œ{˜1˜a¨¸Ð<Ñ<Ô<Ð<øõ ð+ð+ð+ÝŒ{˜1˜a rÐ*Ñ*Ô*Ð*Ð*Ð*ð+øøøs B,Â,!CÃCcóÌ—d}d}t|t¦«rè|}|tvr"td |¦«¦«‚|�t d¦«‚t ||¦«\}}|�6||k} | ||kz} tj  | ¦«s|| }|j dkrd}�n×(Ò(¨Ñ.Ô.ð Ø�d”G�à Œ6�QŠ;ˆ;؈L‰Lõ(¨Ô1°!°jÀ)Ð5LÑMÔMˆEØð !Ý"¥2¤7Õ+=¸iÈÑ+TÔ+TÐW\Ñ+\Ñ#]Ô#]Ñ^Ô^� � ð !� � å Œ�‰Œ˜!Ò Ð ð KÝ#œ>¨$Ñ/Ô/ˆLˆLøÝð Kð Kð KÝØBñDôDØIJð Køøøøð Køøøð ˜!Ò Ð ÝÐGÑHÔHÐ Hå 0°°EÑ :Ô :ш �I�Iå Œ�‰Œ˜!Ò Ð Ý”J˜tÑ$Ô$ˆ Ý Œ6�)˜C˜R˜C”. 9¨Q¨R¨R¤=Ò0Ñ 1Ô 1ð EÝØCñEôEð Eð Eõ Ð;Ñ<Ô<Ð<àÐõ”> *¨i¸Ñ;Ô;ˆÝ Œ=˜¥2¤:Ñ .Ô .ð 7Ý”~ hµÑ6Ô6ˆHõ”KØ ˜  <°!Ñ#3Ø ð+ñ+ô+ˆ ð˜: y°,Ð?Ð?Ð?à˜$ˆÐsÄD0Ä0 EÄ:E Å Ecóž—tj| |dd…d¦«| |dd…d¦«f¦«S)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 Nr€ÚleftÚright)rÚ concatenateÚ searchsorted)rcÚvs rÚ_search_sorted_inclusiverŸÆsO€õ Œ>Ø �Š�q˜˜"˜”v˜vÑ&Ô&Ø �Š�q˜˜˜”v˜wÑ'Ô'ðñ ô ðrcó —|||fS©N©)rcr(rrds rÚ_histogram_bin_edges_dispatcherr£Òs€Ø ˆt�WÐ Ðré cóV—t||¦«\}}t||||¦«\}}|S)aY 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 `Notes` 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' Maximum of 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' (maximum 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. Examples -------- >>> 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. ]) )rer˜)rcr(rrdr’Ú_s rrrÖs5€õL*¨!¨WÑ5Ô5�J€A€wÝ! ! T¨5°'Ñ:Ô:�L€IˆqØ Ðrcó —|||fSr¡r¢)rcr(rÚdensityrds rÚ_histogram_dispatcherr©¡s€à ˆt�WÐ Ðrcó"—t||¦«\}}t||||¦«\}}|€tjtj¦«}n|j}d}|dupBtj|jtj¦«ptj|jt¦«} |��ê| �rç|\} } } tj| |¦«} | t| | ¦«z }tdt|¦«|¦«D�]—}||||z…}|€d}n ||||z…}|| k}||| kz}tj   |¦«s||}|�||}| |jd¬¦«}t|| ¦«|z}| tj¦«}||| kxxdzcc<|||k}||xxdzcc<|||dzk|| dz kz}||xxdz cc<|jdkrV| xjtj||j| ¬¦«z c_| xjtj||j| ¬¦«z c_�Œj| tj||| ¬¦« |¦«z } �Œ™�n>> 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 .. versionadded:: 1.11.0 Automated Bin Selection Methods example, using 2 peak random data with 2000 points: >>> import matplotlib.pyplot as plt >>> 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") Text(0.5, 1.0, "Histogram with 'auto' bins") >>> plt.show() NirF)Úcopyr&Úc)rdÚ minlengthrn)rer˜rr[ÚintpÚcan_castÚdoubleÚcomplexÚzerosr r7Úlenr†r‡r_ÚkindÚrealÚbincountÚimagr`ÚsortrŸÚargsortrœÚcumsumÚdiffÚarrayr�Úsum)rcr(rr¨rdr’Ú uniform_binsÚntypeÚBLOCKÚsimple_weightsrhrir‘r.ÚnormÚiÚtmp_aÚtmp_wr”Ú f_indicesÚindicesÚ decrementÚ incrementÚcum_nÚsaÚzeroÚ sorting_indexÚswÚcwÚ bin_indexÚdbs rrr¦sr€õH*¨!¨WÑ5Ô5�J€A€wå,¨Q°°e¸WÑEÔEÑ€Iˆ|ð€Ý”�œÑ!Ô!ˆˆà” ˆð €Eð �4ˆð ,Ý Œ �G”M¥2¤9Ñ-Ô-ð ,å Œ �G”M¥7Ñ+Ô+ðð Ñ NÑð/;Ñ+ˆ �I˜|õ ŒH�\ 5Ñ )Ô )ˆðÕ0°¸JÑGÔGÑGˆõ ˜�3˜q™6œ6 5Ñ)Ô)ð+ Gñ+ GˆAØ�a˜˜%™�i”LˆE؈Ø��à  ! e¡)  Ô,�ð˜ZÒ'ˆDØ �U˜iÒ'Ñ (ˆDÝ”>×(Ò(¨Ñ.Ô.ð (ؘdœ �ØÐ$Ø! $œK�Eð —L’L ¤°u�LÑ=Ô=ˆEõ+¨5°*Ñ=Ô=ÀÑDˆIØ×&Ò&¥r¤wÑ/Ô/ˆGØ �G˜|Ò+Ð ,Ð ,Ô ,°Ñ 1Ð ,Ð ,Ñ ,ð  ¨'Ô 2Ò2ˆIØ �IÐ Ð Ô  !Ñ #Ð Ð Ñ à 9¨W°q©[Ô#9Ò9Ø# |°aÑ'7Ò7ñ9ˆIà �IÐ Ð Ô  !Ñ #Ð Ð Ñ ðŒz˜SÒ Ð Ø�”�"œ+ g°u´zØ0<ð>ñ>ô>ñ>�”à�”�"œ+ g°u´zØ0<ð>ñ>ô>ñ>�”‘ð•R”[ °%Ø+7ð9ñ9ô9ß9?ºÀ¹¼ñG�‘ñU+ Gõ\”˜œ¨%Ñ0Ô0ˆØ ˆ?ݘA�s 1™vœv uÑ-Ô-ð Að A�Ý”W˜Q˜q  5¡˜yœ\Ñ*Ô*�ØÕ1°"°iÑ@Ô@Ñ@��ð Aõ”8˜A UÐ+Ñ+Ô+ˆDݘA�s 1™vœv uÑ-Ô-ð 'ð '�ؘ!˜A˜e™G˜)œ �Ø  ! E¡'  Ô*�Ý "¤ ¨5Ñ 1Ô 1� ؘ=Ô)�ؘ=Ô)�Ý”^ T¨2¯9ª9©;¬;Ð$7Ñ8Ô8�Ý4°R¸ÑCÔC� ؘ˜IœÑ&��å ŒG�E‰NŒNˆàð'Ý ŒX•b”g˜iÑ(Ô(­%Ñ 0Ô 0ˆØ�‰t�A—E’E‘G”G‰|˜YÐ&Ð&à ˆiˆ<Ðrc#ó¾K—t|d¦«r|V—n|Ed{V—†tjt¦«5|Ed{V—†ddd¦«n #1swxYwY|V—dS)Nr`)ÚhasattrÚ contextlibÚsuppressr…)Úsampler(rr¨rds rÚ_histogramdd_dispatcherr×xs¿èè€åˆv�wÑÔðØˆ ˆ ˆ ˆ àÐÐÐÐÐÐÐÝ Ô �YÑ 'Ô 'ððØˆˆˆˆˆˆˆðððñôððððððøøøððððà €M€M€M€M€Ms¹ AÁAÁAcóÖ‡‡— ‰j\}}n:#ttf$r&tj‰¦«jЉj\}}YnwxYwtj|tj¦«}|dgzŠ|dgz}|�tj|¦«} t|¦«} | |krtd¦«‚n#t$r ||gz}YnwxYw|€d|z}n"t|¦«|krtd¦«‚t|¦«D�]Ì} tj || ¦«dkr¿|| dkr"td  | ¦«¦«‚t‰dd…| f|| ¦«\} } tj|| ¦«} n5#t$r(}td  | ¦«¦«|‚d}~wwxYwtj| | | dz¦«‰| <n´tj || ¦«dkrttj|| ¦«‰| <tj‰| dd …‰| dd…k¦«r"td   | ¦«¦«‚n"td   | ¦«¦«‚t‰| ¦«dz|| <tj‰| ¦«|| <�ŒÎt)ˆˆfd „t|¦«D¦«¦«}t|¦«D]4} ‰dd…| f‰| d k}|| |xxdzcc<Œ5tj||¦«}tj||| ¦«¬ ¦«}| |¦«}| t4d¬¦«}|t7dd ¦«fz}||}|rq| ¦«}t|¦«D]H} tj|t<¦«}|| dz || <|||  |¦«z }ŒI||z}|j|dz k ¦«rt?d¦«‚|‰fS)ab 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 : list A list of D arrays describing the bin edges for each dimension. See Also -------- histogram: 1-D histogram histogram2d: 2-D histogram Examples -------- >>> r = np.random.randn(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.r¡z0range argument must have one entry per dimensionrr&z,`bins[{}]` must be positive, when an integerz,`bins[{}]` must be an integer, when a scalarr€z:`bins[{}]` must be monotonically increasing, when an arrayz'`bins[{}]` must be a scalar or 1d arrayc3óf•K—|]+}tj‰|‰dd…|fd¬¦«V—Œ,dS)Nr›)Úside)rr�)Ú.0rÃÚedgesrÖs €€rú zhistogramdd..sZøèè€ððð õ Œ˜˜aœ &¨¨¨¨A¨¤,°WÐ=Ñ=Ô=ððððððr)r­Úsafe)rmr)zInternal Shape Error) r`ÚAttributeErrorrarÚ atleast_2dÚTÚemptyr®rZr³r…r7r‰r]rjrŠr‹r�rŒr»ÚtupleÚravel_multi_indexr¶ÚprodÚreshaper_r�Úslicer½Úonesr6Ú RuntimeError)rÖr(rr¨rdÚNÚDÚnbinÚdedgesÚMrÃÚsminÚsmaxr.r–ÚNcountÚon_edgeÚxyÚhistÚcoreÚsr`rÜs` @rrrƒsÔøø€ðDàŒ|‰ˆˆ1ˆ1øÝ �JÐ 'ððð唘vÑ&Ô&Ô(ˆØŒ|‰ˆˆ1ˆ1ˆ1ðøøøõ Œ8�A•r”wÑ Ô €DØ ˆtˆf‰H€EØ �ˆv‰X€FØÐÝ”*˜WÑ%Ô%ˆðÝ �‰IŒIˆØ �Š6ˆ6Ýðñôð ð øõ ðððà�$�‰xˆˆˆðøøøð  €}ؘ!‘ ˆˆÝ ˆU‰Œ�qŠˆÝÐKÑLÔLÐLõ�A‰YŒYð&ñ&ˆÝ Œ7�4˜”7Ñ Ô ˜qÒ Ð Ø�AŒw˜Š{ˆ{Ý ØB×IÒIÈ!ÑLÔLñNôNðNå)¨&°°°°1°¬+°u¸Q´xÑ@Ô@‰JˆD�$ð Ý”N 4¨¤7Ñ+Ô+��øåð ð ð ÝØ?×FÒFÀqÑIÔIñôàðøøøøð øøøõ ”{ 4¨¨q°1©uÑ5Ô5ˆE�!‰HˆHÝ ŒW�T˜!”WÑ Ô  Ò "Ð "Ý”z $ q¤'Ñ*Ô*ˆE�!‰HÝŒv�e˜A”h˜s ˜s”m e¨A¤h¨q¨r¨r¤lÒ2Ñ3Ô3ð Ý ØPß’V˜A‘Y”Yñ ô ð ð õ Ø9×@Ò@ÀÑCÔCñEôEð Eõ�e˜A”h‘-”- !Ñ#ˆˆQ‰Ý”G˜E !œHÑ%Ô%ˆˆq‰ ‰ õðððððõ˜‘”ðñôñô€Fõ�A‰YŒYð ð ˆà˜!˜!˜!˜Q˜$”< 5¨¤8¨B¤<Ò/ˆàˆqŒ �'ÐÐÔ˜aÑÐÐÑÐõ Ô ˜f dÑ +Ô +€Bõ Œ;�r˜7¨d¯iªi©k¬kÐ :Ñ :Ô :€Dð �<Š<˜Ñ Ô €Dð �;Š;•u fˆ;Ñ -Ô -€Dð �e�A�r‰lŒlˆ_Ñ €DØ �Œ:€Dàðà �HŠH‰JŒJˆÝ˜‘”ð 3ð 3ˆAÝ”G˜A�s‘O”OˆEؘA”w ‘{ˆE�!‰Hؘ& œ)×+Ò+¨EÑ2Ô2Ñ2ˆDˆDØ �‰ ˆà Œ �d˜Q‘hÒ×#Ò#Ñ%Ô%ð$ÝØ "ñ$ô$ð $à �ˆ;Ðs9„ �4AÁA $B0Â0CÃCÅ2F Æ F?Æ#F:Æ:F?)NNN)r¤NN)NNNN)r¤NNN)#Ú__doc__rÔÚ functoolsrŠr8rrÚ numpy.corerÚ__all__ÚpartialÚarray_function_dispatchrr7rrrrr$r<rFrMrQr„rerjr r˜rŸr£rr©rr×rr¢rrúrýs|ððððÐÐÐØÐÐÐØ€€€Ø€€€àÐÐÐØ Ð Ð Ð Ð Ð à =Ð =Ð =€à+˜)Ô+Ø Ô%¨gð7ñ7ô7Ðð €ð0ð0ð0ð%ð%ð%ð*-ð-ð-ð.1ð1ð1ð0AðAðAð,'ð'ð'ðT ð ð ðF.ð.ð.ð<)ð)ð)ðX!0Ø-Ø /Ø)Ø-Ø /Ø-Ø"3ð5ð5Ððððð*!ð!ð!ð<=ð=ð=ð4[ð[ð[ð| ð ð ðððððÐÐ8Ñ9Ô9ðGðGðGñ:Ô9ðGðV9=ððððð ÐÐ.Ñ/Ô/ðNðNðNñ0Ô/ðNðbDHØ$(ðððððÐÐ0Ñ1Ô1ðjðjðjñ2Ô1ðjðjðjr