Data classes#

class spey_pyhf.data.Base[source]#

Base class for pyhf data input

abstractmethod config(allow_negative_signal: bool = True, poi_upper_bound: float | None = None) ModelConfig[source]#

Model configuration.

Parameters:
  • allow_negative_signal (bool, default True) – If True \(\hat\mu\) value will be allowed to be negative.

  • poi_upper_bound (float, default 40.0) – upper bound for parameter of interest, \(\mu\).

Returns:

Model configuration. Information regarding the position of POI in parameter list, suggested input and bounds.

Return type:

ModelConfig

abstract property isAlive: bool#

Returns True if at least one bin has non-zero signal yield.

class spey_pyhf.data.FullStatisticalModelData(signal_patch: List[Dict], background_only_model: Dict | str)[source]#

Bases: Base

Data container for the full statistical model.

Parameters:
  • signal_patch (List[Dict]) – Patch data for signal model. please see this link for details on the structure of the input.

  • background_only_model (Dict or Text) – This input expects background only data that describes the full statistical model for the background. It also accepts str input which indicates the full path to the background only JSON file.

background_only_model: Dict | str#
property channel_properties: Iterator[Tuple[int, str, int]]#

Returns an iterator for channel index, name and number of bins

property channels: Iterator[str]#

Return channel names

config(allow_negative_signal: bool = True, poi_upper_bound: float | None = None) ModelConfig[source]#

Model configuration.

Parameters:
  • allow_negative_signal (bool, default True) – If True \(\hat\mu\) value will be allowed to be negative.

  • poi_upper_bound (float, default 40.0) – upper bound for parameter of interest, \(\mu\).

Returns:

Model configuration. Information regarding the position of POI in parameter list, suggested input and bounds.

Return type:

ModelConfig

property isAlive: bool#

Returns True if at least one bin has non-zero signal yield.

signal_patch: List[Dict]#
class spey_pyhf.data.SimpleModelData(signal_yields: List[float], background_yields: List[float], data: List[float], absolute_uncertainties: List[float])[source]#

Bases: Base

Dataclass for simple statistical model

Parameters:
  • signal_yields (List[float]) – signal yields

  • background_yields (List[float]) – background yields

  • data (List[float]) – observations

  • absolute_uncertainties (List[float]) – absolute uncertainties on the background

absolute_uncertainties: List[float]#
background_yields: List[float]#
config(allow_negative_signal: bool = True, poi_upper_bound: float | None = None) ModelConfig[source]#

Model configuration.

Parameters:
  • allow_negative_signal (bool, default True) – If True \(\hat\mu\) value will be allowed to be negative.

  • poi_upper_bound (float, default 40.0) – upper bound for parameter of interest, \(\mu\).

Returns:

Model configuration. Information regarding the position of POI in parameter list, suggested input and bounds.

Return type:

ModelConfig

data: List[float]#
property isAlive: bool#

Returns True if at least one bin has non-zero signal yield.

signal_yields: List[float]#