Fast histogramming in python built on pybind11
Project description
pygram11
Simple and fast histogramming in python via pybind11 and (optionally) OpenMP
pygram11
provides fast functions for generating histograms (and
their sums-of-weights squared). The API is very simple, check out the
documentation (you'll also find some benchmarks there) and my blog
post.
Installing
pygram11 requires only NumPy and pybind11 (and therefore a C++
compiler with C++11 support). Note: pybind11
must be installed
explicitly before pygram11
(because setup.py
uses pybind11
to
determine include directories).
From PyPI
$ pip install pybind11 ## or `conda install pybind11`
$ pip install pygram11
From Source
$ git clone https://github.com/drdavis/pygram11.git
$ pip install pybind11
$ cd pygram11
$ pip install .
In Action
A fixed bin width histogram of weighted data in one dimension, accelerated with OpenMP:
>>> x = np.random.randn(10000)
>>> w = np.random.uniform(0.8, 1.2, 10000)
>>> h, sw2 = pygram11.histogram(x, bins=40, range=(-4, 4), weights=w, omp=True)
>>> stat_err = np.sqrt(sw2)
A variable bin width histogram in two dimensions:
>>> x = np.random.randn(10000)
>>> y = np.random.randn(10000)
>>> xbins = [-2.0, -1.0, -0.5, 1.5, 2.0]
>>> ybins = [-3.0, -1.5, -0.1, 0.8, 2.0]
>>> h = pygram11.histogram2d(x, y, bins=[xbins, ybins])
If there is something you'd like to see in pygram11, please open an issue or pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pygram11-0.1.4.tar.gz
.
File metadata
- Download URL: pygram11-0.1.4.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc63394e819faceb9b9d186c239f8f32482b625fc0c49f4473e69f23e33e057e |
|
MD5 | e4fc9a8fc3ebf0c981b32279566493e1 |
|
BLAKE2b-256 | 7dd8e79eabc39f5bc3431d9523deab984e81bf1ef4b46ce62af9ae1678414720 |