Skip to content
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

Attaching modifiers twice to a sample #2059

Open
1 task done
alexander-held opened this issue Nov 14, 2022 · 0 comments · May be fixed by #2396
Open
1 task done

Attaching modifiers twice to a sample #2059

alexander-held opened this issue Nov 14, 2022 · 0 comments · May be fixed by #2396
Labels
bug Something isn't working needs-triage Needs a maintainer to categorize and assign user request Request coming form a pyhf user

Comments

@alexander-held
Copy link
Member

Summary

When adding a modifier twice to a sample, only one instance is used. For normfactor modifiers this could in principle be something a user would want to do on purpose (as a simplified way to scale different samples by mu and sqrt(mu), see also #850). It might be useful to catch such specifications and warn users about the current behavior.

OS / Environment

n/a

Steps to Reproduce

import pyhf

spec = {
    "channels": [
        {
            "name": "SR",
            "samples": [
                {
                    "data": [25.0],
                    "modifiers": [
                        {"data": None, "name": "mu", "type": "normfactor"},
                    ],
                    "name": "Signal",
                },
            ],
        }
    ],
    "measurements": [
        {"config": {"parameters": [], "poi": "mu"}, "name": "minimal_example"}
    ],
    "observations": [{"data": [35.0], "name": "SR"}],
    "version": "1.0.0",
}


def fit(spec):
    ws = pyhf.Workspace(spec)
    model = ws.model()
    data = ws.data(model) + model.config.auxdata
    print(pyhf.infer.mle.fit(data, model))


# fit with one modifier
fit(spec)

# add a second POI
spec["channels"][0]["samples"][0]["modifiers"].append(
    {"data": None, "name": "mu", "type": "normfactor"}
)
fit(spec)

File Upload (optional)

No response

Expected Results

warning or correct application of two POIs on the sample

Actual Results

[1.40000145]
[1.40000145]
# second modifier is ignored

pyhf Version

pyhf, version 0.7.0

Code of Conduct

  • I agree to follow the Code of Conduct
@alexander-held alexander-held added bug Something isn't working needs-triage Needs a maintainer to categorize and assign labels Nov 14, 2022
@matthewfeickert matthewfeickert added the user request Request coming form a pyhf user label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Needs a maintainer to categorize and assign user request Request coming form a pyhf user
Projects
None yet
2 participants