Giter Club home page Giter Club logo

cabinetry's Introduction

cabinetry logo

CI status Documentation Status Codecov PyPI version Conda version Python version Code style: black

DOI Scikit-HEP

cabinetry is a Python library for building and steering binned template fits. It is written with applications in High Energy Physics in mind. cabinetry interfaces many other powerful libraries to make it easy for an analyzer to run their statistical inference pipeline.

Statistical models in HistFactory format can be built by cabinetry from instructions in a declarative configuration. cabinetry makes heavy use of pyhf for statistical inference, and provides additional utilities to help study and disseminate fit results. This includes commonly used visualizations. Due to its modular approach, analyzers are free to use all of cabinetry's functionality or only some pieces. cabinetry can be used for inference and visualization with any pyhf-compatible model, whether it was built with cabinetry or not.

Installation

cabinetry can be installed with pip:

python -m pip install cabinetry

This will only install the minimum requirements for the core part of cabinetry. The following will install additional optional dependencies needed for ROOT file reading:

python -m pip install cabinetry[contrib]

Hello world

To run the following example, first generate the input files via the script utils/create_ntuples.py.

import cabinetry

config = cabinetry.configuration.load("config_example.yml")

# create template histograms
cabinetry.templates.build(config)

# perform histogram post-processing
cabinetry.templates.postprocess(config)

# build a workspace
ws = cabinetry.workspace.build(config)

# run a fit
model, data = cabinetry.model_utils.model_and_data(ws)
fit_results = cabinetry.fit.fit(model, data)

# visualize the post-fit model prediction and data
prediction_postfit = cabinetry.model_utils.prediction(model, fit_results=fit_results)
cabinetry.visualize.data_mc(prediction_postfit, data, config=config)

The above is an abbreviated version of an example included in example.py, which shows how to use cabinetry. It requires additional dependencies obtained with pip install cabinetry[contrib].

Documentation

Find more information in the documentation and tutorial material in the cabinetry-tutorials repository. cabinetry is also described in a paper submitted to vCHEP 2021: 10.5281/zenodo.4627037.

Acknowledgements

NSF-1836650

This work was supported by the U.S. National Science Foundation (NSF) cooperative agreement OAC-1836650 (IRIS-HEP).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.