Skip to main content

Fast histogramming in python built on pybind11

Project description

# pygram11

[![builds.sr.ht status](https://builds.sr.ht/~ddavis/pygram11.svg)](https://builds.sr.ht/~ddavis/pygram11?) [![Documentation Status](https://readthedocs.org/projects/pygram11/badge/?version=stable)](https://pygram11.readthedocs.io/en/stable/?badge=stable) ![](https://img.shields.io/pypi/pyversions/pygram11.svg?colorB=blue&style=flat) [![PyPI version](https://img.shields.io/pypi/v/pygram11.svg?colorB=486b87&style=flat)](https://pypi-hypernode.com/project/pygram11/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

Simple and fast histogramming in python via [pybind11](https://github.com/pybind/pybind11) and (optionally) [OpenMP](https://www.openmp.org/)

pygram11 provides fast functions for generating histograms (and their sums-of-weights squared). Fixed and variable width binned histograms are supported. The API is very simple, check out the documentation.

## Installing

pygram11 requires only NumPy and pybind11 (and therefore a C++ compiler with C++11 support).

### From PyPI

`none $ pip install pygram11 `

### From Source

`none $ git clone https://github.com/drdavis/pygram11.git $ cd pygram11 $ pip install . `

## In Action

A fixed bin width histogram of weighted data in one dimension, accelerated with OpenMP:

`python >>> 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:

`python >>> 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]) `

Project details


Release history Release notifications | RSS feed

This version

0.1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygram11-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

File details

Details for the file pygram11-0.1.1.tar.gz.

File metadata

  • Download URL: pygram11-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 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

Hashes for pygram11-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9b2ec62e282f25477eedc7147261800bfc50d2eec2f1624eae109017a01ffe9e
MD5 770e604c5c2f30153f36d6cfbc0042a2
BLAKE2b-256 de29bd811fbefcf44d31975773bc786447a4c986ffa596678ef9b33d2c78ea77

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page