Python API#
Top-Level#
NumPy backend for pyhf |
|
Optimizer that uses |
|
Get the current backend and the associated optimizer |
|
Set the backend and the associated optimizer |
|
Compatibility functions for translating between ROOT and pyhf |
|
See |
Probability Distribution Functions (PDFs)#
The Normal distribution with mean |
|
The Poisson distribution with rate parameter |
|
A probability density corresponding to the joint distribution of a batch of identically distributed random variables. |
|
A probability density corresponding to the joint distribution of multiple non-identical component distributions |
Making Models from PDFs#
The main pyhf model class. |
|
Configuration for the |
|
Factory class to create pdfs for the main measurement. |
|
Factory class to create pdfs for the constraint terms. |
|
A mixin that provides summary data of the provided channels. |
|
A JSON-serializable object that is built from an object that follows the |
|
A way to store a collection of patches ( |
|
A way to store a patch definition as part of a patchset ( |
|
Construct a simple single channel |
|
Construct a simple single channel |
Backends#
The computational backends that pyhf
provides interfacing for the vector-based calculations.
NumPy backend for pyhf |
|
PyTorch backend for pyhf |
|
TensorFlow backend for pyhf |
|
JAX backend for pyhf |
Optimizers#
Mixin Class to build optimizers. |
|
Optimizer that uses |
|
Optimizer that minimizes via |
Modifiers#
Interpolators#
The piecewise-linear interpolation strategy. |
|
The piecewise-exponential interpolation strategy. |
|
The quadratic interpolation and linear extrapolation strategy. |
|
The polynomial interpolation and exponential extrapolation strategy. |
|
The piecewise-linear interpolation strategy, with polynomial at \(\left|a\right| < 1\). |
Inference#
Test Statistics#
The test statistic, \(q_{0}\), for discovery of a positive signal as defined in Equation (12) in [1007.1727], for \(\mu=0\). |
|
The test statistic, \(q_{\mu}\), for establishing an upper limit on the strength parameter, \(\mu\), as defined in Equation (14) in [1007.1727] |
|
The "alternative" test statistic, \(\tilde{q}_{\mu}\), for establishing an upper limit on the strength parameter, \(\mu\), for models with bounded POI, as defined in Equation (16) in [1007.1727] |
|
The test statistic, \(t_{\mu}\), for establishing a two-sided interval on the strength parameter, \(\mu\), as defined in Equation (8) in [1007.1727] |
|
The test statistic, \(\tilde{t}_{\mu}\), for establishing a two-sided interval on the strength parameter, \(\mu\), for models with bounded POI, as defined in Equation (11) in [1007.1727] |
|
Get the test statistic function by name. |
Calculators#
Compute Asimov Dataset (expected yields at best-fit values) for a given POI value. |
|
Fitted model parameters of the fits in |
|
The distribution the test statistic in the asymptotic case. |
|
The empirical distribution of the test statistic. |
|
The Asymptotic Calculator. |
|
The Toy-based Calculator. |
|
Creates a calculator object of the specified calctype. |
Fits and Tests#
Two times the negative log-likelihood of the model parameters, \(\left(\mu, \boldsymbol{\theta}\right)\), given the observed data. |
|
Run a maximum likelihood fit. |
|
Run a maximum likelihood fit with the POI value fixed. |
|
Compute \(p\)-values and test statistics for a single value of the parameter of interest. |
|
Check whether all POI(s) are floating (i.e. not within the fixed set). |
Confidence Intervals#
Calculate an upper limit interval |
|
Calculate an upper limit interval |
|
Calculate an upper limit interval |
|
Schema#
A module-level wrapper around |
|
Get a schema by relative path from cache, or load it into the cache and return. |
|
Validate the provided instance, |
Exceptions#
Various exceptions, apart from standard python exceptions, that are raised from using the pyhf
API.
InvalidMeasurement is raised when a specified measurement is invalid given the specification. |
|
InvalidSpecification is raised when a specification does not validate against the given schema. |
|
InvalidPatchSet is raised when a given patchset object does not have the right configuration, even though it validates correctly against the schema. |
|
InvalidPatchLookup is raised when the patch lookup from a patchset object has failed |
|
PatchSetVerificationError is raised when the workspace digest does not match the patchset digests as part of the verification procedure |
|
InvalidWorkspaceOperation is raised when an operation on a workspace fails. |
|
InvalidModel is raised when a given model does not have the right configuration, even though it validates correctly against the schema. |
|
InvalidModifier is raised when an invalid modifier is requested. |
|
InvalidInterpCode is raised when an invalid/unimplemented interpolation code is requested. |
|
MissingLibraries is raised when something is imported by sustained an import error due to missing additional, non-default libraries. |
|
InvalidBackend is raised when trying to set a backend that does not exist. |
|
InvalidOptimizer is raised when trying to set an optimizer that does not exist. |
|
InvalidPdfParameters is raised when trying to evaluate a pdf with invalid parameters. |
|
InvalidPdfData is raised when trying to evaluate a pdf with invalid data. |
Utilities#
Get the digest for the provided object. |
|
Get the bibtex citation for pyhf |
Contrib#
Brazil Band Plots. |
|
Download the patchset archive from the remote URL and extract it in a directory at the path given. |