-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can no longer set several model config attributes #1984
Comments
This affects also Adding the following two setters restores the functionality diff --git a/src/pyhf/pdf.py b/src/pyhf/pdf.py
index db59fa1c..969b26db 100644
--- a/src/pyhf/pdf.py
+++ b/src/pyhf/pdf.py
@@ -245,6 +245,13 @@ def poi_name(self):
"""
return self._poi_name
+ @poi_name.setter
+ def poi_name(self, value):
+ """
+ Set the name of the POI parameter in the model.
+ """
+ self._poi_name = value
+
@property
def poi_index(self):
"""
@@ -252,6 +259,13 @@ def poi_index(self):
"""
return self._poi_index
+ @poi_index.setter
+ def poi_index(self, value):
+ """
+ Set the index of the POI parameter in the model.
+ """
+ self._poi_index = value
+
@property
def auxdata(self):
""" |
model.config.poi_index
When this is fixed there should additionally be a test that is added to ensure that these can be set by the user. |
This is not a bug. The API for setting the We never encouraged anyone to override these other properties you mentioned either. The whole point is to try and make |
Making this explicit by using import pyhf
spec = {
"channels": [
{
"name": "SR",
"samples": [
{
"data": [50],
"modifiers": [
{"data": None, "name": "mu", "type": "normfactor"},
],
"name": "Signal",
},
],
}
],
"measurements": [
{
"config": {
"parameters": [],
"poi": "",
},
"name": "meas",
}
],
"observations": [{"data": [50], "name": "SR"}],
"version": "1.0.0",
}
ws = pyhf.Workspace(spec)
model = ws.model()
data = ws.data(model)
print(model.config.poi_name is None) # True
print(model.config.poi_index is None) # True
model.config.set_poi("mu") # temporarily set for e.g. hypotest
pyhf.infer.hypotest(1.0, data, model)
# neither of the following works, expects string for a parameter that is in the model
# model.config.set_poi(None)
# model.config.set_poi("") |
Summary
The changes in #1972 cause
model.config.poi_index
to not be writable anymore.cabinetry
sets this value directly to support runningpyhf.infer.hypotest
with a configurable POI (without the need to re-build the model).OS / Environment
n/a
Steps to Reproduce
File Upload (optional)
No response
Expected Results
assignment succeeds
Actual Results
pyhf Version
pyhf, version 0.7.0rc4.dev2
Code of Conduct
The text was updated successfully, but these errors were encountered: