Skip to content

Add a new plot_fancy_dataspecs and chi2 distributions with scale variations #1830

Merged
scarlehoff merged 3 commits into
masterfrom
data_th_comparison_sv
Nov 24, 2023
Merged

Add a new plot_fancy_dataspecs and chi2 distributions with scale variations #1830
scarlehoff merged 3 commits into
masterfrom
data_th_comparison_sv

Conversation

@scarlehoff
Copy link
Copy Markdown
Member

With this one can get reports such as https://vp.nnpdf.science/8W7S2JStS3ySBXmea0PEJg==

This is not ready for review (but if anyone wants to have a look feel free).

A brief explanation of the changes:

In the theorycovariance module (/cc @andreab1997), I've broken down the function covs_pt_prescrip so that I can access the internal logic. I've done this in order to manually compute the theory covariance for single datasets without worrying about the processes. This might not be actually necessary but I wanted to ensure that I was not getting unwanted contributions.

I've added a few plotting functions to dataplots.py.

  • plot_chi2dist_sv: this one might not be necessary, it should be possible with the proper change to config.py to get a covariance matrix computed on the fly as part of the chi2. I know how to do it only for covmats that are loaded from a fit, but it should be possible. For this I needed to add results_with_theory_covmat to results.py which would also be unnecessary once I fix the previous point. But before playing with the code I wanted to have something functional since PDF4LHC is coming close.

  • plot_fancy_sv_dataspecs: theory-data comparison where the errors in the theory are actually the PDF uncertainties and the scale variations added in quadrature, where the scale variations are the diagonal of the theory covariance matrix. This required adding to results.py a new class ThUncertaintiesResult and a results_with_scale_variations. As far as I can see this part will be necessary because within validphys the theory covariance matrix is always added to the experimental covmat while in this case we want to use both contributions separately.

(all other changes in dataplots.py are due to black)

btw, there are a few functions scattered around the code that claim to do some of these things, however either they no longer work or they use functions that have not been touched in a long time (and that nobody doing MHOU is using anymore) so I've preferred to ignore them. They will be removed in due time.

@scarlehoff scarlehoff force-pushed the data_th_comparison_sv branch from af345e8 to ba21977 Compare November 1, 2023 11:32
@scarlehoff scarlehoff changed the base branch from master to generic_hessian_pdf_covmat November 1, 2023 11:33
@comane comane force-pushed the generic_hessian_pdf_covmat branch from ec34958 to 1733a1e Compare November 11, 2023 19:01
Base automatically changed from generic_hessian_pdf_covmat to master November 13, 2023 08:30
@scarlehoff scarlehoff force-pushed the data_th_comparison_sv branch 2 times, most recently from 3fea7dc to 856675c Compare November 14, 2023 18:55
@scarlehoff scarlehoff changed the base branch from master to raise_and_exception_with_plot_fancy_and_pdferr November 14, 2023 18:56
@scarlehoff scarlehoff marked this pull request as ready for review November 14, 2023 18:56
@scarlehoff
Copy link
Copy Markdown
Member Author

scarlehoff commented Nov 14, 2023

This is ready for review. Given #1844, trying to do the theory covmat in the same way as the pdferr risks creating a lot of secondary problems.

And, unlike pdf erros, the scale variations are actively being used. Therefore I think for the time being I prefer to leave the plot_fancy and abs_chi2 plot functions untouched and just have some _scale variations extra.

I've also gone ahead and added an Exception to make_scale_var_covmat

(edit: the many force-push are to make it closer to master so that I can more easily use this for the PDF4LHC plots together with the new commondata reader)

Base automatically changed from raise_and_exception_with_plot_fancy_and_pdferr to master November 14, 2023 20:35
@scarlehoff scarlehoff force-pushed the data_th_comparison_sv branch 2 times, most recently from 3afed78 to e5e0aee Compare November 15, 2023 10:30
Copy link
Copy Markdown
Member

@RoyStegeman RoyStegeman left a comment

Choose a reason for hiding this comment

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

I still want to have a bit of a closer look later, but it all seems reasonable enough

Comment thread validphys2/src/validphys/theorycovariance/construction.py Outdated
Comment thread validphys2/examples/data_theory_comparison_w_sv.yaml Outdated
Comment thread validphys2/src/validphys/results.py
Comment thread validphys2/src/validphys/theorycovariance/construction.py Outdated
@scarlehoff scarlehoff mentioned this pull request Nov 17, 2023
33 tasks
@scarlehoff scarlehoff force-pushed the data_th_comparison_sv branch from cd082f1 to 76f5462 Compare November 17, 2023 16:18
@scarlehoff
Copy link
Copy Markdown
Member Author

Since the code has been tagged now, can we merge this?

@RoyStegeman
Copy link
Copy Markdown
Member

Yes fine for me

@scarlehoff scarlehoff merged commit c3a0f59 into master Nov 24, 2023
@scarlehoff scarlehoff deleted the data_th_comparison_sv branch November 24, 2023 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants