Skip to main content

Python implementation of the BumpHunter algorithm used by HEP community.

Project description

pyBumpHunter

Binder Test PyPI DOI

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.9.

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.5.0.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybumphunter-0.5.0-py3-none-any.whl (2.2 MB view details)

Uploaded Python 3

File details

Details for the file pybumphunter-0.5.0.tar.gz.

File metadata

  • Download URL: pybumphunter-0.5.0.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for pybumphunter-0.5.0.tar.gz
Algorithm Hash digest
SHA256 16cec3259ae61cffb553976f19712e88e01bfcdadbcf1cc58bc40d1222f55dcc
MD5 7560b50b5743dbd514d62dd772ef0cfc
BLAKE2b-256 627c4fe9ff3e0fc26c1de16a37d679532e294d26bb1eb56a8245809b936149d2

See more details on using hashes here.

File details

Details for the file pybumphunter-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pybumphunter-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for pybumphunter-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7db0f3ff9d4de90a8e77248427174d33914c8dbb0341247f5d66931dd6d12283
MD5 f26c29f2ce46d87d9a29c153cba3d72e
BLAKE2b-256 c5b3e06c24b64fd1f79c7413048a6faac421e07b9460e73a20a2603226445f46

See more details on using hashes here.

Supported by

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