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

Nckw add example teststat plots #845

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

nucleosynthesis
Copy link
Contributor

Add example plots of test-stat distributions in part explaining limit calculation

@nucleosynthesis nucleosynthesis added the documentation Updates for the documentation label Jun 30, 2023

!!! info
If you used the TEV or LEP style test statistic (using the commands as described above), then you should include the option `--doublesided`, which will also take care of defining the correct integrals for $p_{\mu}$ and $p_{b}$.
If you used the TEV or LEP style test statistic (using the commands as described above), then you should include the option `--doublesided`, which will also take care of defining the correct integrals for $p_{\mu}$ and $p_{b}$. Click on the examples below to see what a typical output of this plotting tool will look like when using the LHC test statistic, or TEV test statistic.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily for this PR, but I wonder if it is worth making this behaviour default, based on the test stat that is being used, rather than requiring the user to do it manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I would leave this option open is that we did have a workflow that was specifically for spin Hypotheses and iirc it was not quite the same as using the TeV test stat but was double sided. Honestly, if you don't use the option when you should, you'll see pretty quickly from the resulting figure that you should have used it. In any case, this script doesn't know about the test stat but I think what you're saying is you we could pass the test-stat in as an option and have the plot figure it out?

@@ -42,6 +43,13 @@
type="str",
help="poi values, comma separated (type all to make a plot for every value found in the file)",
)
parser.add_option(
"",
"--sub_label",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there is an existing convention for some of this combine scripts already. But (at least with recent versions) of option/argument parser, using --some-command-line-option name will automatically produce the variable using underscores rather than -, i.e. some_command_line_option in this case. Which I think is just a little more user friendly, as it is a more often used convention.

(Same comment below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong feelings here so can go with hyphens instead

Modify options to use hyphens instead of underscore in
`plotTestStatCLs.py`

Added a warning to user if it looks like `--doublesided` option should be used
and hasn't been used.
@nucleosynthesis
Copy link
Contributor Author

@kcormi - latest commit is an attempt to address your comments. Let me know what you think

Copy link
Collaborator

@kcormi kcormi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nick! looks good to me.

@nucleosynthesis nucleosynthesis merged commit 72ac5c2 into main Jul 6, 2023
@nucleosynthesis
Copy link
Contributor Author

Looks like I spoke too soon, the figures seem to appear inside the show/hide box in the preview on GitHub but don't seem to work on the docs page - any ideas?

https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/docs/part3/commonstatsmethods.md?plain=1#L607-L615

@adewit
Copy link
Collaborator

adewit commented Jul 6, 2023

Did you try a relative path (and maybe even the include syntax used elsewhere?), e.g.

![](images/exampleLHC.jpg)

I have a vague recollection that relative/absolute paths caused some problems at least with page links, so maybe worth a try?

@kcormi
Copy link
Collaborator

kcormi commented Jul 6, 2023

It could be an issue with using the absolute path, I had issues with the paths being treated slightly differently in a local test and in a deployment previously.

When I inspect other images on that page in the browser, they are given by relative paths "../images/<img_name>.png", whereas, these ones are using the absolute path with "/docs" as the root.

@nucleosynthesis
Copy link
Contributor Author

nucleosynthesis commented Jul 6, 2023

Yeah for a standard image, the relative path is correct but this doesn't seem to work inside a <details> block (where it seems we have to use the html <img ... > thing). I tried a few different versions and none of them seemed to work so what I have now (which does work at least) is the full raw path to the image. Unfortunately, it seems hard to test since the preview in GitHub doesn't show the behaviour of the html that gets built.

@kcormi
Copy link
Collaborator

kcormi commented Jul 6, 2023

I set up a similar github.io page on my own github account for testing some of the other documentation updates. I can try using that one to make some tests and see what works.

@kcormi
Copy link
Collaborator

kcormi commented Jul 6, 2023

Also, if its related to the <details> block, I wonder if it is handled properly with some of the updates that will come in as part of #839. There I added the pymdownx.blocks.details markdown extension, to make use of the

/// details | header name

contents
///

block style. I wonder if markdown then handles the image stuff properly. I can also check when I run a few tests shortly.

@nucleosynthesis
Copy link
Contributor Author

nucleosynthesis commented Jul 6, 2023 via email

@kcormi
Copy link
Collaborator

kcormi commented Jul 6, 2023

It seems to work using the details block extension:

https://kcormi.github.io/HiggsAnalysis-CombinedLimit/part3/commonstatsmethods/#complex-models

code is here:
https://github.com/kcormi/HiggsAnalysis-CombinedLimit/blob/docs_test_deploy/docs/part3/commonstatsmethods.md?plain=1#L607

It seems also possible to do it without the extension, but I also had to set the width explicitly in the img html block, otherwise it displayed very poorly. The code:
kcormi@899a2af#diff-e1cf5d8257ea3082032f066028c25c4e5134426b497d6f3f40042e955177759dR607

Also, for testing purposes, the behaviour I got using a local mkdocs build and just checking it in my browser seemed to reproduce the same results as the actual deployed page. I guess this makes sense that it is slightly different behaviour than what the github preview gives, both using markdown, but I guess with slightly different details.

Instructions on setting up a local environment for testing the documentation is in the contributing guide:
https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/contributing.md#technical-details-of-the-documentation

@kcormi
Copy link
Collaborator

kcormi commented Jul 6, 2023

Actually, the local mkdocs build also works with absolute paths, even though it doesn't on deployment. So that is one issue the local test won't catch. Hopefully its the only one, I'll add a note about that in the contributing guide.

@nucleosynthesis
Copy link
Contributor Author

nucleosynthesis commented Jul 6, 2023 via email

@nucleosynthesis nucleosynthesis deleted the nckw_add_example_teststat_plots branch February 15, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Updates for the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants