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

Inconsistent return types of model.config.suggested_bounds() when using parameter config #2462

Open
1 task done
alexander-held opened this issue Mar 24, 2024 · 0 comments
Assignees
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

alexander-held commented Mar 24, 2024

Summary

model.config.suggested_bounds() usually is a list of tuples, but the list elements become lists themselves when using a custom parameter configuration. That doesn't break any functionality I am aware of and the return is not typed to declare to be a list of tuples, but I assume the inconsistency is not intended.

The current behavior makes typing just slightly more convoluted. I caught this via dynamic type checking, a typeguard bug fix now flags this in cabinetry.

OS / Environment

n/a

Steps to Reproduce

import pyhf

spec = {
    "channels": [
        {
            "name": "SR",
            "samples": [
                {
                    "data": [50],
                    "modifiers": [
                        {"data": None, "name": "mu", "type": "normfactor"},
                        {"data": [5], "name": "staterror_SR", "type": "staterror"},
                    ],
                    "name": "Signal",
                }
            ],
        }
    ],
    "measurements": [
        {
            "config": {
                "parameters": [{"name": "mu", "bounds": [[0, 10]]}],
                "poi": "mu",
            },
            "name": "example",
        }
    ],
    "observations": [{"data": [50], "name": "Signal Region"}],
    "version": "1.0.0",
}

ws = pyhf.Workspace(spec)
model = ws.model()
print(model.config.suggested_bounds())

results in

[[0, 10], (1e-10, 10.0)]

while removing the parameter config produces [(0, 10), (1e-10, 10.0)].

File Upload (optional)

n/a

Expected Results

see above

Actual Results

see above

pyhf Version

current main, 39db83b

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 Mar 24, 2024
@matthewfeickert matthewfeickert added the user request Request coming form a pyhf user label Mar 24, 2024
@matthewfeickert matthewfeickert self-assigned this Mar 24, 2024
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
Development

No branches or pull requests

2 participants