pyhf.infer.intervals.upper_limits.toms748_scan#

pyhf.infer.intervals.upper_limits.toms748_scan(data, model, bounds_low, bounds_up, level=0.05, atol=2e-12, rtol=0.0001, from_upper_limit_fn=False, **hypotest_kwargs)[source]#

Calculate an upper limit interval (0, poi_up) for a single Parameter of Interest (POI) using an automatic scan through POI-space, using the toms748() algorithm.

Example

>>> import numpy as np
>>> import pyhf
>>> pyhf.set_backend("numpy")
>>> model = pyhf.simplemodels.uncorrelated_background(
...     signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0]
... )
>>> observations = [51, 48]
>>> data = pyhf.tensorlib.astensor(observations + model.config.auxdata)
>>> obs_limit, exp_limits = pyhf.infer.intervals.upper_limits.toms748_scan(
...     data, model, 0., 5., rtol=0.01
... )
>>> obs_limit
array(1.01156939)
>>> exp_limits
[array(0.5600747), array(0.75702605), array(1.06234693), array(1.50116923), array(2.05078912)]
Parameters:
  • data (tensor) – The observed data.

  • model (Model) – The statistical model adhering to the schema model.json.

  • bounds_low (float) – Lower boundary of search interval.

  • bounds_up (float) – Upper boundary of search interval.

  • level (float) – The threshold value to evaluate the interpolated results at. Defaults to 0.05.

  • atol (float) – Absolute tolerance. The iteration will end when the result is within absolute or relative tolerance of the true limit.

  • rtol (float) – Relative tolerance. For optimal performance this argument should be set to the highest acceptable relative tolerance.

  • hypotest_kwargs (string) – Kwargs for the calls to hypotest to configure the fits.

Returns:

  • Tensor: The observed upper limit on the POI.

  • Tensor: The expected upper limits on the POI.

Return type:

Tuple of Tensors

Added in version 0.7.0.