pyhf.simplemodels.correlated_background

pyhf.simplemodels.correlated_background(signal, bkg, bkg_up, bkg_down, batch_size=None, validate=True)[source]

Construct a simple single channel Model with a histosys modifier representing a background with a fully correlated bin-by-bin uncertainty.

Parameters
  • signal (list) – The data in the signal sample.

  • bkg (list) – The data in the background sample.

  • bkg_up (list) – The background sample under an upward variation corresponding to \(\alpha=+1\).

  • bkg_down (list) – The background sample under a downward variation corresponding to \(\alpha=-1\).

  • batch_size (None or int) – Number of simultaneous (batched) Models to compute.

  • validate (bool) – If True, validate the model before returning. Only set this to False if you have an experimental use case and know what you’re doing.

Returns

The statistical model adhering to the model.json schema.

Return type

Model

Example

>>> import pyhf
>>> pyhf.set_backend("numpy")
>>> model = pyhf.simplemodels.correlated_background(
...     signal=[12.0, 11.0],
...     bkg=[50.0, 52.0],
...     bkg_up=[45.0, 57.0],
...     bkg_down=[55.0, 47.0],
... )
>>> model.schema
'model.json'
>>> model.config.channels
['single_channel']
>>> model.config.samples
['background', 'signal']
>>> model.config.parameters
['correlated_bkg_uncertainty', 'mu']
>>> model.expected_data(model.config.suggested_init())
array([62., 63.,  0.])