- Description:
A very simple ndarray-based histogram class.
Overview
Matplotlib histograms are geared around drawing, not data manipulation. Numpy direct support for histograms is extremely limited, and not very different from matpotlib. This is intended to turn into a set of very lightweight classes for shuffling data around. This is very much a work-in-progress.
The only required depenency is numpy, and the package is designed to work for python >= 2.6
Usage
A summary of usage, taken from the hists.py docstring follows:
- Importing:
>>> from simplehist import Hist
- Initialise with bin indices:
>>> a = Hist([0, 1, 2, 3]) >>> a.bincount 3 >>> a.bins (0, 1, 2, 3) >>> a.data array([ 0., 0., 0.])
- Optionally include data:
>>> a = Hist([0, 1, 2, 3], data=[1, 0.2, 3]) >>> a.data array([ 1. , 0.2, 3. ])
- Or just specify the blank data type:
>>> a = Hist([0, 1, 2, 3], dtype=int) >>> a.data array([0, 0, 0])
- You can do arithmetic operations in place or seperately:
>>> a = Hist([0, 1, 2, 3], data=[1, 0.2, 3]) >>> b = a + a >>> b -= a >>> a.data == b.data array([ True, True, True], dtype=bool)
- And you can fill bins from values:
>>> a = Hist([0,1,2,3]) >>> a.fill(1.4, weight=3) >>> a.data array([ 0., 3., 0.])
- Even out of range:
>>> a = Hist([0,1]) >>> a.fill(-10) >>> a.underflow 1.0
- If you use pyROOT, you can convert from 1D histograms:
>>> type(source) <class 'ROOT.TH1D'> >>> convert = fromTH1(source) >>> type(convert) <class 'simplehist.hists.Hist'>
And you can draw histograms, using any of the options that can be passed to matplotlib.pyplot.hist:
>>> hist_object.draw_hist(lw=2)
Metadata
Release files for SimpleHist 0.1
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 |
|---|---|---|---|---|
| SimpleHist-0.1.tar.gz | 9.8 kB | Without provenance | Details for SimpleHist-0.1.tar.gz |
Release files / SimpleHist-0.1.tar.gz
| Download URL | SimpleHist-0.1.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbe30497b95f91021406607c1a226a02f735e6a57f0aed22df150685007a7a92
|
|
BLAKE2b-256 checksum How to use checksums |
95e8f7c4ec82edbb7608c1e0181df59f98e1d731e55435ea05c01c723c953f12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for SimpleHist 0.1
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.