11"""
22closuretest/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+
68from reportengine .figure import figure
79from 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
2713def 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