Giter Club home page Giter Club logo

pyhf_inference_tools's Introduction

Inference tools

Python 2.7 Python 3.8 MIT license GitHub tag Code style: black

This repository gathers a bunch of scripts and tools to convert the HF output from an analysis into pyhf workspaces (BkgOnly.json and patchset.json), perform statistical inference and plot the results. It also allows to create simplified versions of the likelihood using simplify. It further allows to cross-check the results of the simplified likelihood by comparing them with the full results from the analysis. Needs both python 2.7 and python 3 because of ROOT, HistFitter and pyhf.

Signal patch

Creating a signal patch is as easy as running

python3 make_signalpatch.py --bkg-only <BkgOnly.json> --output-file <output-file>

Simplified signal patch

A simplified signal patch only contains nominal signal yields and no uncertainties. You can construct such a signal patch file from any full signal patch file using

python3 make_simplified_signalpatch.py --group <group> --output-file <output-file>

Fitting all workspaces

Fitting all workspaces can be done using

python3 run_cls.py --group <group>

Alternatively, once can also use run_patchset.py to run over an existing set of BkgOnly.json and patchset.json files built e.g. using make_signalpatch.py from above.

Running fit over entire patchset

Running a fit over the entire patchset using a provided likelihood can be done using:

python3 run_patchset.py --group <group>

This defaults to using the full likelihood. You can also specify --simplified in order to run using the simplified likelihood.

Creating harvest

The results of the fits need to be harvested and converted into the right format for the HistFitter plotting tools to be able to use them. This can be done by running

python3 harvest.py --group <group>

Creating TGraphs from harvest

For this step, you'll need a more or less recent ROOT version as well as python2.7 (sorry). No need to setup Histfitter, as all necessary classes are included in this repository. Create the usual HF-style TGraph using

python harvestToContours.py -i <input_harvest> -o <output_tgraph> -x <x> -y <y> -l <forbidden_function>

Plotting TGraph

Plotting the resulting graphs can be done with

python plot_contours.py --group <group> --xmin <xmin> --xmax <xmax> --ymin <ymin> --ymax <ymax> [--draw-CLs]

pyhf_inference_tools's People

Contributors

eschanet avatar

Watchers

 avatar  avatar

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.