# API¶

## Top-Level¶

 default_backend NumPy backend for pyhf default_optimizer tensorlib NumPy backend for pyhf optimizer Get the current backend and the associated optimizer set_backend(*args, **kwargs)

## Making Probability Distribution Functions (PDFs)¶

 Workspace An object that is built from a JSON spec that follows workspace.json. Model _ModelConfig

## Backends¶

The computational backends that pyhf provides interfacing for the vector-based calculations.

 mxnet_backend.mxnet_backend MXNet backend for pyhf numpy_backend.numpy_backend NumPy backend for pyhf pytorch_backend.pytorch_backend PyTorch backend for pyhf tensorflow_backend.tensorflow_backend TensorFlow backend for pyhf

## Interpolators¶

 code0 The piecewise-linear interpolation strategy. code1 The piecewise-exponential interpolation strategy. code2 The quadratic interpolation and linear extrapolation strategy. code4 The polynomial interpolation and exponential extrapolation strategy. code4p The piecewise-linear interpolation strategy, with polynomial at $$\left|a\right| < 1$$

## Exceptions¶

Various exceptions, apart from standard python exceptions, that are raised from using the pyhf API.

 InvalidInterpCode InvalidInterpCode is raised when an invalid/unimplemented interpolation code is requested. InvalidModifier InvalidModifier is raised when an invalid modifier is requested.

## Utilities¶

 generate_asimov_data(asimov_mu, data, pdf, …) loglambdav(pars, data, pdf) pvals_from_teststat(sqrtqmu_v, sqrtqmuA_v[, …]) The $$p$$-values for signal strength $$\mu$$ and Asimov strength $$\mu'$$ as defined in Equations (59) and (57) of arXiv:1007.1727_ pvals_from_teststat_expected(sqrtqmuA_v[, …]) Computes the expected $$p$$-values CLsb, CLb and CLs for data corresponding to a given percentile of the alternate hypothesis. qmu(mu, data, pdf, init_pars, par_bounds) The test statistic, $$q_{\mu}$$, for establishing an upper limit on the strength parameter, $$\mu$$, as defiend in Equation (14) in arXiv:1007.1727_ . hypotest(poi_test, data, pdf[, init_pars, …]) Computes $$p$$-values and test statistics for a single value of the parameter of interest