pyhf icon indicating copy to clipboard operation
pyhf copied to clipboard

fix: Add q0 test statistic as valid option to CLI infer interface

Open TC01 opened this issue 5 months ago • 2 comments

Description

The CLI API (e.g. pyhf cls) allows the test statistic to be set, but it limits the options to q and qtilde. However, the discovery test statistic q0 is also a valid option here (as described in the documentation), but it can't currently be set on the command line. This commit is a simple fix; it adds q0 to the list of allowed arguments to pyhf cls --test-stat. With this change one can do something like this to quickly test a workspace on the command line:

cat workspace.json | | pyhf cls --test-stat q0 --test-poi 0

Since this is a one-line fix, I didn't open an issue first; hopefully that's okay!

Checklist Before Requesting Reviewer

  • [ ] Tests are passing
  • [x] "WIP" removed from the title of the pull request
  • [ ] Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • [ ] Summarize commit messages into a comprehensive review of the PR

TC01 avatar Jul 15 '25 09:07 TC01

Thanks for the PR :+1:. Please follow the contribution guide (https://github.com/scikit-hep/pyhf/blob/main/CONTRIBUTING.md) in the future.

I'm pretty sure this has been discussed in the past, but we can take a look at why this wasn't previously implemented next week and get back to you. If I'm wrong and this is missing then we can probably add this, given that you have a use case for it.

matthewfeickert avatar Jul 17 '25 07:07 matthewfeickert

We discussed this a bit in #1712. While the math is correct, I think it's not ideal to have this live under the cls CLI because this does not use $CL_s$ for discovery significance.

alexander-held avatar Aug 05 '25 10:08 alexander-held