Skip to content

Commit 0001fcc

Browse files
authored
Merge pull request #2272 from NNPDF/factorise_internal_mct_loader
New Multi-Closure test analysis module
2 parents d876f04 + 035d799 commit 0001fcc

32 files changed

Lines changed: 1137 additions & 3191 deletions

validphys2/examples/pca_bias_variance_report.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ template_text: |
4040
------------------------------------------------------
4141
4242
## Table of bias and variance
43-
{@table_bias_variance_datasets@}
44-
43+
{@table_bias_datasets@}
4544
4645
## Bootstrapped table for full dataset
47-
{@bootstrapped_table_bias_variance_data@}
46+
{@bootstrapped_table_bias_data@}
4847
4948
## L2 condition number
5049
{@plot_l2_condition_number@}

validphys2/src/validphys/closuretest/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
from validphys.closuretest.closure_results import *
99
from validphys.closuretest.multiclosure import *
1010
from validphys.closuretest.multiclosure_output import *
11+
from validphys.closuretest.multiclosure_bootstrap import *
1112
from validphys.closuretest.multiclosure_pdf import *
1213
from validphys.closuretest.multiclosure_pdf_output import *
1314
from validphys.closuretest.multiclosure_preprocessing import *
1415
from validphys.closuretest.multiclosure_pseudodata import *
15-
from validphys.closuretest.inconsistent_closuretest.multiclosure_inconsistent_output import *
16+
from validphys.closuretest.multiclosure_inconsistent_output import *
1617
# TODO:
1718
# select the functions to be exposed from the previous modules
1819
# and make sure they are flagged smh as closure_test providers
Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
"""
22
closuretest/plots.py
33
4-
Plots of statistical estimators for closure tests
4+
Plots of statistical estimators for single closure test.
5+
See multiclosure module for more estimators and plots.
56
"""
7+
68
from reportengine.figure import figure
79
from validphys import plotutils
810

911

10-
@figure
11-
def plot_biases(biases_table):
12-
"""
13-
Plot the bias of each experiment for all fits with bars. For information on
14-
how biases is calculated see `bias_experiment`
15-
"""
16-
fig, ax = plotutils.barplot(
17-
biases_table.values.T,
18-
collabels=biases_table.index.values,
19-
datalabels=biases_table.columns.droplevel(1).values,
20-
)
21-
ax.set_title("Biases per experiment for each fit")
22-
ax.legend()
23-
return fig
24-
25-
2612
@figure
2713
def plot_delta_chi2(delta_chi2_bootstrap, fits):
2814
"""Plots distributions of delta chi2 for each fit in `fits`.
@@ -45,32 +31,6 @@ def errorbar_figure_from_table(df):
4531
"""Given a table with even columns as central values as odd columns as errors
4632
plot an errorbar plot"""
4733
fig, ax = plotutils.plot_horizontal_errorbars(
48-
df.values[:, ::2].T,
49-
df.values[:, 1::2].T,
50-
df.index.values,
51-
df.columns.unique(0),
52-
xlim=0,
34+
df.values[:, ::2].T, df.values[:, 1::2].T, df.index.values, df.columns.unique(0), xlim=0
5335
)
5436
return fig, ax
55-
56-
57-
@figure
58-
def plot_fits_bootstrap_variance(fits_bootstrap_variance_table):
59-
"""Plot variance as error bars, with mean and central value calculated
60-
from bootstrap sample
61-
"""
62-
fig, ax = errorbar_figure_from_table(fits_bootstrap_variance_table)
63-
ax.set_title("Variance by experiment for closure fits")
64-
return fig
65-
66-
67-
@figure
68-
def plot_fits_bootstrap_bias(fits_bootstrap_bias_table):
69-
"""Plot the bias for each experiment for all `fits` as a point with an error bar,
70-
where the error bar is given by bootstrapping the bias across replicas
71-
72-
The number of bootstrap samples can be controlled by the parameter `bootstrap_samples`
73-
"""
74-
fig, ax = errorbar_figure_from_table(fits_bootstrap_bias_table)
75-
ax.set_title("Bias by experiment for closure fits")
76-
return fig

0 commit comments

Comments
 (0)