Skip to content

Commit

Permalink
Add poi_name argument to simplemodels API
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Sep 16, 2023
1 parent 234da85 commit 951ad7a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/pyhf/simplemodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __dir__():


def correlated_background(
signal, bkg, bkg_up, bkg_down, batch_size=None, validate=True
signal, bkg, bkg_up, bkg_down, batch_size=None, validate=True, poi_name="mu"
):
r"""
Construct a simple single channel :class:`~pyhf.pdf.Model` with a
Expand All @@ -27,10 +27,14 @@ def correlated_background(
batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute.
validate (:obj:`bool`): If :obj:`True`, validate the model before returning.
Only set this to :obj:`False` if you have an experimental use case and know what you're doing.
poi_name (:obj:`str`): The :class:`~pyhf.pdf.Model` parameter of interest name.
Defaults to ``"mu"``.
Returns:
~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema.
.. versionchanged:: 0.8.0 Added ``poi_name`` argument.
Example:
>>> import pyhf
>>> pyhf.set_backend("numpy")
Expand Down Expand Up @@ -79,11 +83,11 @@ def correlated_background(
}
]
}
return Model(spec, batch_size=batch_size, validate=validate, poi_name="mu")
return Model(spec, batch_size=batch_size, validate=validate, poi_name=poi_name)


def uncorrelated_background(
signal, bkg, bkg_uncertainty, batch_size=None, validate=True
signal, bkg, bkg_uncertainty, batch_size=None, validate=True, poi_name="mu"
):
"""
Construct a simple single channel :class:`~pyhf.pdf.Model` with a
Expand Down Expand Up @@ -114,10 +118,13 @@ def uncorrelated_background(
batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute
validate (:obj:`bool`): If :obj:`True`, validate the model before returning.
Only set this to :obj:`False` if you have an experimental use case and know what you're doing.
poi_name (:obj:`str`): The :class:`~pyhf.pdf.Model` parameter of interest name.
Defaults to ``"mu"``.
Returns:
~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema
.. versionchanged:: 0.8.0 Added ``poi_name`` argument.
"""
spec = {
'channels': [
Expand Down Expand Up @@ -146,7 +153,7 @@ def uncorrelated_background(
}
]
}
return Model(spec, batch_size=batch_size, validate=validate, poi_name="mu")
return Model(spec, batch_size=batch_size, validate=validate, poi_name=poi_name)


# Deprecated APIs
Expand Down

0 comments on commit 951ad7a

Please sign in to comment.