Un Bound Histogram
This UnBoundhHistogram has bins with a fixed width. It is sparse and thus does not allocate memory for bins with zero content. It’s range is almost un-bound (integer limits). Bins are allocated and populated as needed during assignment. Making a histogram in an almost un bound range is usefule when one does not know the range of the data in advance and when streaming thrhough the data is costly. UnBoundhHistogram was created to histogram vast streams of data generated in costly simulations for particle physics. Buzz word bingo: big data.
Install
pip install un_bound_histogram
Usage
import un_bound_histogram
import numpy
prng = numpy.random.Generator(numpy.random.PCG64(1337))
h = un_bound_histogram.UnBoundHistogram(bin_width=0.1)
h.assign(x=prng.normal(loc=5.0, scale=2.0, size=1000000))
# assign multiple times to grow the histogram.
h.assign(x=prng.normal(loc=-3.0, scale=1.0, size=1000000))
h.assign(x=prng.normal(loc=1.0, scale=0.5, size=1000000))
assert 0.9 < h.percentile(50) < 1.1
assert h.sum() == 3 * 1000000
The UnBoundHistogram has a few statistical estimators built in, such as modus() and quantile()/percentile().
There is also a two dimensional implementation UnBoundHistogram2d. See tests for examples.
import un_bound_histogram
import numpy as np
prng = np.random.Generator(np.random.PCG64(9))
SIZE = 100000
XLOC = 3.0
YLOC = -4.5
ubh = un_bound_histogram.UnBoundHistogram2d(
x_bin_width=0.1,
y_bin_width=0.1,
)
ubh.assign(
x=prng.normal(loc=XLOC, scale=1.0, size=SIZE),
y=prng.normal(loc=YLOC, scale=1.0, size=SIZE),
)
xb_max, yb_max = ubh.argmax()
x_max = xb_max * ubh.x_bin_width
y_max = yb_max * ubh.y_bin_width
assert XLOC - 0.5 < x_max < XLOC + 0.5
assert YLOC - 0.5 < y_max < YLOC + 0.5
x_range, y_range = ubh.range()
assert x_range[0] <= xb_max <= x_range[1]
assert y_range[0] <= yb_max <= y_range[1]
assert ubh.sum() == SIZE
Metadata
Release files for un-bound-histogram 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| un_bound_histogram-0.1.0.tar.gz | 5.4 kB | Without provenance | Details for un_bound_histogram-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| un_bound_histogram-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for un_bound_histogram-0.1.0-py3-none-any.whl |
Total release size: 11.2 kB
Release files / un_bound_histogram-0.1.0.tar.gz
| Download URL | un_bound_histogram-0.1.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
813961d5b7e56965beff5367950b8e81f5b2e8b3de9bd735241180c3bf2af923
|
|
BLAKE2b-256 checksum How to use checksums |
b9be6e4067df966df51c9bf4227cc428a0e64f0b1e4dec8afd641327940d8b2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|
Release files / un_bound_histogram-0.1.0-py3-none-any.whl
| Download URL | un_bound_histogram-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f16cd42987d320ef19ca102098bd61e7f738ed7354759fb019bf5dbc6a0cc0b
|
|
BLAKE2b-256 checksum How to use checksums |
8745e8da213e792c80cd62fb2c96986475ac3890cbdbf7a189dcd9be2471f735
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|
Security for un-bound-histogram 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.