Skip to main content

Python implementation of the BumpHunter algorithm used by HEP community.

Project description

pyBumpHunter

Binder Test PyPI

This is a python version of the BumpHunter algorithm, see arXiv:1101.0390, G. Choudalakis, designed to find localized excess (or deficit) of events in a 1D or 2D distribution.

The main BumpHunter function will scan a data distribution using variable-width window sizes and calculate the p-value of data with respect to a given background distribution in each window. The minimum p-value obtained from all windows is the local p-value. To cope with the "look-elsewhere effect" a global p-value is calculated by performing background-only pseudo-experiments.

The BumpHunter algorithm can also perform signal injection tests where more and more signal is injected in toy data until a given signal significance (global) is reached (signal injection not available in 2D yet).

Content

  • pyBumpHunter : The pyBumpHunter package
  • example : Folder containing a set of example scripts and notebooks
  • example/results : Folder containing the outputs of example scripts
  • test : Folder containing the testing scripts (based on pytest)
  • data/data.root : Toy data used in the examples and tests
  • data/gen_data.C : Code used to generate the toy data with ROOT

Dependencies

Requires python >= 3.6 py

BumpHunter depends on the following python libraries :

  • numpy
  • scipy
  • matplotlib

pyBumpHunter wiki

Examples

The examples provided in example.py and test.ipynb require the uproot package in order to read the data from a ROOT software file.

The data provided in the example consists of three histograms: a steeply falling 'background' distribution in a [0,20] x-axis range, a 'signal' gaussian shape centered on a value of 5.5, and a 'data' distribution sampled from background and signal distributions, with a signal fraction of 0.15%. The data file is produced by running gen_data.C in ROOT.

In order to run the example script, simply type python3 example.py in a terminal.

You can also open the example notebook with jupyter or binder.

  • Bump hunting:

  • Tomography scan:

  • Test statistics and global p-value:

See the wiki for a detailed overview of all the features offered by pyBumpHunter.

To do list

  • Run BH on 2D histograms

Authors and contributors

Louis Vaslin (main developper), Julien Donini

Thanks to Samuel Calvet for his help in cross-checking and validating pyBumpHunter against the (internal) C++ version of BumpHunter developped by the ATLAS collaboration.

Project details


Download files

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

Source Distribution

pyBumpHunter-0.4.2.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

pyBumpHunter-0.4.2-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file pyBumpHunter-0.4.2.tar.gz.

File metadata

  • Download URL: pyBumpHunter-0.4.2.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pyBumpHunter-0.4.2.tar.gz
Algorithm Hash digest
SHA256 34b805f316066144d1a66809c945a07e8a18456622a61ae76bb797521ca1d89f
MD5 b71dd1faf2bf085fd12c24662e1da5af
BLAKE2b-256 f4e679e8d92d5fa6ec96604fd7ec6a92052ba89ffd5547249544853c7ba38f60

See more details on using hashes here.

File details

Details for the file pyBumpHunter-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: pyBumpHunter-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pyBumpHunter-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 faf2aca051f617395965310c9fe027eb2c0a01be65ebcf39c138329939d3e911
MD5 fdac305cdb27b82eda2748920522b069
BLAKE2b-256 b3b812baf46afa16b9dfc43c0a6d4643957b8cf8b9779a5a3464e74e254046fb

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