Skip to content

repeated staterror across channels #2565

Open
@andrewfowlie

Description

@andrewfowlie

Summary

I expected that staterror modifiers with the same name, across different channels, would be treated as correlated. Instead, the second staterror modifier parameters get appended to the first lot.

This isn't what I expected to happen. Not sure if it is a bug or not.

OS / Environment

NAME="Fedora Linux"
VERSION="40 (Forty)"
ID=fedora
VERSION_ID=40
VERSION_CODENAME=""
PLATFORM_ID="platform:f40"
PRETTY_NAME="Fedora Linux 40 (Forty)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:40"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f40/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=40
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=40
SUPPORT_END=2025-05-13

Steps to Reproduce

bug.json

{
    "channels": [
        { "name": "firstchannel",
          "samples": [
            { "name": "signal",
              "data": [5.0, 10.0],
              "modifiers": [
                { "name": "k_staterror", "type": "staterror", "data": [0.1, 0.2] },
                { "name": "lumi", "type": "lumi", "data": null }
              ]
            }
          ]
        },
        { "name": "secondchannel",
          "samples": [
            { "name": "signal",
              "data": [5.0, 10.0],
              "modifiers": [
                { "name": "k_staterror", "type": "staterror", "data": [0.1, 0.2] },
                { "name": "lumi", "type": "lumi", "data": null }
              ]
            }
          ]
        }
    ],
    "observations": [
        { "name": "firstchannel", "data": [50.0, 60.0] }, { "name": "secondchannel", "data": [50.0, 60.0] }
    ],
    "measurements": [
        { "name": "Measurement", "config":
          {"poi": "lumi", "parameters": [ 
            { "name": "lumi", "auxdata": [1.0], "sigmas": [0.017], "inits": [1.0] }
          ]
          }
        }
    ],
    "version": "1.0.0"
}

Reproducer

import pyhf
import json

with open("bug.json") as f:
    spec = json.load(f)
    
ws = pyhf.Workspace(spec)
model = ws.model()

print(model.config.par_names)

Output:

['lumi', 'k_staterror[0]', 'k_staterror[1]', 'k_staterror[2]', 'k_staterror[3]']

File Upload (optional)

No response

Expected Results

I expected to have 2 k_staterror parameters (one for each bin) that were correlated across the two channels

['lumi', 'k_staterror[0]', 'k_staterror[1]']

Actual Results

['lumi', 'k_staterror[0]', 'k_staterror[1]', 'k_staterror[2]', 'k_staterror[3]']

The second k_staterror gets appended to the first, giving 4 k_staterror parameters in total.



### pyhf Version

```console
pyhf, version 0.7.6

Code of Conduct

  • I agree to follow the Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageNeeds a maintainer to categorize and assign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions