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

repeated modifiers #2558

Open
1 task done
andrewfowlie opened this issue Nov 14, 2024 · 2 comments
Open
1 task done

repeated modifiers #2558

andrewfowlie opened this issue Nov 14, 2024 · 2 comments
Labels
bug Something isn't working needs-triage Needs a maintainer to categorize and assign user request Request coming form a pyhf user

Comments

@andrewfowlie
Copy link

Summary

Consider this model. It applies two normfactors, one called mu and one called mu2, so the signal channel is scaled signal *= mu * mu2.

{
    "channels": [
        { "name": "singlechannel",
          "samples": [
            { "name": "signal",
              "data": [5.0, 10.0],
              "modifiers": [ { "name": "mu", "type": "normfactor", "data": null}, { "name": "mu2", "type": "normfactor", "data": null} ]
            }
          ]
        }
    ],
    "observations": [
        { "name": "singlechannel", "data": [50.0, 60.0] }
    ],
    "measurements": [
        { "name": "Measurement", "config": {"poi": "mu", "parameters": [{ "name":"mu", "fixed": false}]} }
    ],
    "version": "1.0.0"
}

Now consider correlating them by giving them the same name,

{
    "channels": [
        { "name": "singlechannel",
          "samples": [
            { "name": "signal",
              "data": [5.0, 10.0],
              "modifiers": [ { "name": "mu", "type": "normfactor", "data": null}, { "name": "mu", "type": "normfactor", "data": null} ]
            }
          ]
        }
    ],
    "observations": [
        { "name": "singlechannel", "data": [50.0, 60.0] }
    ],
    "measurements": [
        { "name": "Measurement", "config": {"poi": "mu", "parameters": [{ "name":"mu", "fixed": false}]} }
    ],
    "version": "1.0.0"
}

In this case, we just get signal *= mu, I expected signal *= mu * mu .
I guess that inside some dictionary somewhere, the second mu just overwrites the first one.

OS / Environment

PRETTY_NAME="Ubuntu 23.10"
NAME="Ubuntu"
VERSION_ID="23.10"
VERSION="23.10 (Mantic Minotaur)"
VERSION_CODENAME=mantic
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=mantic
LOGO=ubuntu-logo

Steps to Reproduce

{
    "channels": [
        { "name": "singlechannel",
          "samples": [
            { "name": "signal",
              "data": [5.0, 10.0],
              "modifiers": [ { "name": "mu", "type": "normfactor", "data": null}, { "name": "mu", "type": "normfactor", "data": null} ]
            }
          ]
        }
    ],
    "observations": [
        { "name": "singlechannel", "data": [50.0, 60.0] }
    ],
    "measurements": [
        { "name": "Measurement", "config": {"poi": "mu", "parameters": [{ "name":"mu", "fixed": false}]} }
    ],
    "version": "1.0.0"
}

File Upload (optional)

No response

Expected Results

In this case, we just get signal *= mu, I expected signal *= mu * mu , or alternatively warning/exception that the model was not correctly specified & and that the second mu would be ignored.

Actual Results

The mu gets applied just once.

pyhf Version

pyhf, version 0.7.6

Code of Conduct

  • I agree to follow the Code of Conduct
@andrewfowlie andrewfowlie added bug Something isn't working needs-triage Needs a maintainer to categorize and assign labels Nov 14, 2024
@matthewfeickert matthewfeickert added the user request Request coming form a pyhf user label Nov 14, 2024
@kratsg
Copy link
Contributor

kratsg commented Nov 14, 2024

Not a bug I don't think. This is expected behavior since I believe even ROOT's HistFactory does the same thing (one would need to confirm what the expected behavior should be there). The reason it only treats it as a single µ is because modifiers are identifier by the {TYPE}/{NAME} so in this case, we have normfactor/mu for both so only one gets used, and the other is ignored/overwritten.

However, pyhf should catch this as part of the validation checks its doing and complain about it, presumably.

@andrewfowlie
Copy link
Author

Thanks for your prompt response! Yes, I thought something like that might be going on.

However,` pyhf should catch this as part of the validation checks its doing and complain about it, presumably.

If ignoring the second one is the intended interpretation, then yes, that would be great.

This is a smaller reproducible example of behaviour I stumbled across and it had me stumped for a while. I was debugging a different issue, and for simplicity I gave my modifiers all the same name and tried to independently check the result.

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

3 participants