madminer.plotting module¶
-
madminer.plotting.
plot_2d_morphing_basis
(morpher, xlabel='$\theta_0$', ylabel='$\theta_1$', xrange=(-1.0, 1.0), yrange=(-1.0, 1.0), crange=(1.0, 100.0), resolution=100)[source]¶ Visualizes a morphing basis and morphing errors for problems with a two-dimensional parameter space.
Parameters: - morpher : PhysicsMorpher
PhysicsMorpher instance with defined basis.
- xlabel : str, optional
Label for the x axis. Default value: r’$ heta_0$’.
- ylabel : str, optional
Label for the y axis. Default value: r’$ heta_1$’.
- xrange : tuple of float, optional
Range (min, max) for the x axis. Default value: (-1., 1.).
- yrange : tuple of float, optional
Range (min, max) for the y axis. Default value: (-1., 1.).
- crange : tuple of float, optional
Range (min, max) for the color map. Default value: (1., 100.).
- resolution : int, optional
Number of points per axis for the rendering of the squared morphing weights. Default value: 100.
Returns: - figure : Figure
Plot as Matplotlib Figure instance.
-
madminer.plotting.
plot_distribution_of_information
(xbins, xsecs, fisher_information_matrices, fisher_information_matrices_aux=None, xlabel=None, xmin=None, xmax=None, log_xsec=False, norm_xsec=True, epsilon=1e-09)[source]¶ Plots the distribution of the cross section together with the distribution of the Fisher information.
Parameters: - xbins : list of float
Bin boundaries.
- xsecs : list of float
Cross sections (in pb) per bin.
- fisher_information_matrices : list of ndarray
Fisher information matrices for each bin.
- fisher_information_matrices_aux : list of ndarray or None, optional
Additional Fisher information matrices for each bin (will be plotted with a dashed line).
- xlabel : str or None, optional
Label for the x axis.
- xmin : float or None, optional
Minimum value for the x axis.
- xmax : float or None, optional
Maximum value for the x axis.
- log_xsec : bool, optional
Whether to plot the cross section on a logarithmic y axis.
- norm_xsec : bool, optional
Whether the cross sections are normalized to 1.
- epsilon : float, optional
Numerical factor.
Returns: - figure : Figure
Plot as Matplotlib Figure instance.
-
madminer.plotting.
plot_distributions
(filename, observables=None, parameter_points=None, uncertainties='nuisance', nuisance_parameters=None, draw_nuisance_toys=None, normalize=False, log=False, observable_labels=None, n_bins=50, line_labels=None, colors=None, linestyles=None, linewidths=1.5, toy_linewidths=0.5, alpha=0.15, toy_alpha=0.75, n_events=None, n_toys=100, n_cols=3, quantiles_for_range=(0.025, 0.975), sample_only_from_closest_benchmark=False)[source]¶ Plots one-dimensional histograms of observables in a MadMiner file for a given set of benchmarks.
Parameters: - filename : str
Filename of a MadMiner HDF5 file.
- observables : list of str or None, optional
Which observables to plot, given by a list of their names. If None, all observables in the file are plotted. Default value: None.
- parameter_points : list of (str or ndarray) or None, optional
Which parameter points to use for histogramming the data. Given by a list, each element can either be the name of a benchmark in the MadMiner file, or an ndarray specifying any parameter point in a morphing setup. If None, all physics (non-nuisance) benchmarks defined in the MadMiner file are plotted. Default value: None.
- uncertainties : {“nuisance”, “none”}, optional
Defines how uncertainty bands are drawn. With “nuisance”, the variation in cross section from all nuisance parameters is added in quadrature. With “none”, no error bands are drawn.
- nuisance_parameters : None or list of int, optional
If uncertainties is “nuisance”, this can restrict which nuisance parameters are used to draw the uncertainty bands. Each entry of this list is the index of one nuisance parameter (same order as in the MadMiner file).
- draw_nuisance_toys : None or int, optional
If not None and uncertainties is “nuisance”, sets the number of nuisance toy distributions that are drawn (in addition to the error bands).
- normalize : bool, optional
Whether the distribution is normalized to the total cross section. Default value: False.
- log : bool, optional
Whether to draw the y axes on a logarithmic scale. Defaul value: False.
- observable_labels : None or list of (str or None), optional
x-axis labels naming the observables. If None, the observable names from the MadMiner file are used. Default value: None.
- n_bins : int, optional
Number of histogram bins. Default value: 50.
- line_labels : None or list of (str or None), optional
Labels for the different parameter points. If None and if parameter_points is None, the benchmark names from the MadMiner file are used. Default value: None.
- colors : None or str or list of str, optional
Matplotlib line (and error band) colors for the distributions. If None, uses default colors. Default value: None.
- linestyles : None or str or list of str, optional
Matplotlib line styles for the distributions. If None, uses default linestyles. Default value: None.
- linewidths : float or list of float, optional
Line widths for the contours. Default value: 1.5.
- toy_linewidths : float or list of float or None, optional
Line widths for the toy replicas, if uncertainties is “nuisance” and draw_nuisance_toys is not None. If None, linewidths is used. Default value: 1.
- alpha : float, optional
alpha value for the uncertainty bands. Default value: 0.25.
- toy_alpha : float, optional
alpha value for the toy replicas, if uncertainties is “nuisance” and draw_nuisance_toys is not None. Default value: 0.75.
- n_events : None or int, optional
If not None, sets the number of events from the MadMiner file that will be analyzed and plotted. Default value: None.
- n_toys : int, optional
Number of toy nuisance parameter vectors used to estimate the systematic uncertainties. Default value: 100.
- n_cols : int, optional
Number of columns of subfigures in the plot. Default value: 3.
- quantiles_for_range : tuple of two float, optional
Tuple (min_quantile, max_quantile) that defines how the observable range is determined for each panel. Default: (0.025, 0.075).
Returns: - figure : Figure
Plot as Matplotlib Figure instance.
-
madminer.plotting.
plot_fisher_information_contours_2d
(fisher_information_matrices, fisher_information_covariances=None, reference_thetas=None, contour_distance=1.0, xlabel='$\theta_0$', ylabel='$\theta_1$', xrange=(-1.0, 1.0), yrange=(-1.0, 1.0), labels=None, inline_labels=None, resolution=500, colors=None, linestyles=None, linewidths=1.5, alphas=1.0, alphas_uncertainties=0.25)[source]¶ Visualizes 2x2 Fisher information matrices as contours of constant Fisher distance from a reference point theta0.
The local (tangent-space) approximation is used: distances d(theta) are given by d(theta)^2 = (theta - theta0)_i I_ij (theta - theta0)_j, summing over i and j.
Parameters: - fisher_information_matrices : list of ndarray
Fisher information matrices, each with shape (2,2).
- fisher_information_covariances : None or list of (ndarray or None), optional
Covariance matrices for the Fisher information matrices. Has to have the same length as fisher_information_matrices, and each entry has to be None (no uncertainty) or a tensor with shape (2,2,2,2). Default value: None.
- reference_thetas : None or list of (ndarray or None), optional
Reference points from which the distances are calculated. If None, the origin (0,0) is used. Default value: None.
- contour_distance : float, optional.
Distance threshold at which the contours are drawn. Default value: 1.
- xlabel : str, optional
Label for the x axis. Default value: r’$ heta_0$’.
- ylabel : str, optional
Label for the y axis. Default value: r’$ heta_1$’.
- xrange : tuple of float, optional
Range (min, max) for the x axis. Default value: (-1., 1.).
- yrange : tuple of float, optional
Range (min, max) for the y axis. Default value: (-1., 1.).
- labels : None or list of (str or None), optional
Legend labels for the contours. Default value: None.
- inline_labels : None or list of (str or None), optional
Inline labels for the contours. Default value: None.
- resolution : int
Number of points per axis for the calculation of the distances. Default value: 500.
- colors : None or str or list of str, optional
Matplotlib line (and error band) colors for the contours. If None, uses default colors. Default value: None.
- linestyles : None or str or list of str, optional
Matploitlib line styles for the contours. If None, uses default linestyles. Default value: None.
- linewidths : float or list of float, optional
Line widths for the contours. Default value: 1.5.
- alphas : float or list of float, optional
Opacities for the contours. Default value: 1.
- alphas_uncertainties : float or list of float, optional
Opacities for the error bands. Default value: 0.25.
Returns: - figure : Figure
Plot as Matplotlib Figure instance.
-
madminer.plotting.
plot_fisherinfo_barplot
(fisher_information_matrices, labels, determinant_indices=None, eigenvalue_colors=None, bar_colors=None)[source]¶ Parameters: - fisher_information_matrices : list of ndarray
Fisher information matrices
- labels : list of str
Labels for the x axis
- determinant_indices : list of int or None, optional
If not None, the determinants will be based only on the indices given here. Default value: None.
- eigenvalue_colors : None or list of str
Colors for the eigenvalue decomposition. If None, default colors are used. Default value: None.
- bar_colors : None or list of str
Colors for the determinant bars. If None, default colors are used. Default value: None.
Returns: - figure : Figure
Plot as Matplotlib Figure instance.
-
madminer.plotting.
plot_nd_morphing_basis_scatter
(morpher, crange=(1.0, 100.0), n_test_thetas=1000)[source]¶ Visualizes a morphing basis and morphing errors with scatter plots between each pair of operators.
Parameters: - morpher : PhysicsMorpher
PhysicsMorpher instance with defined basis.
- crange : tuple of float, optional
Range (min, max) for the color map. Default value: (1. 100.).
- n_test_thetas : int, optional
Number of random points evaluated. Default value: 1000.
Returns: - figure : Figure
Plot as Matplotlib Figure instance.
-
madminer.plotting.
plot_nd_morphing_basis_slices
(morpher, crange=(1.0, 100.0), resolution=50)[source]¶ Visualizes a morphing basis and morphing errors with two-dimensional slices through parameter space.
Parameters: - morpher : PhysicsMorpher
PhysicsMorpher instance with defined basis.
- crange : tuple of float, optional
Range (min, max) for the color map.
- resolution : int, optional
Number of points per panel and axis for the rendering of the squared morphing weights. Default value: 50.
Returns: - figure : Figure
Plot as Matplotlib Figure instance.
-
madminer.plotting.
plot_uncertainty
(filename, theta, observable, obs_label, obs_range, n_bins=50, nuisance_parameters=None, n_events=None, n_toys=100, linecolor='black', bandcolor1='#CC002E', bandcolor2='orange', ratio_range=(0.8, 1.2))[source]¶ Plots absolute and relative uncertainty bands in a histogram of one observable in a MadMiner file.
Parameters: - filename : str
Filename of a MadMiner HDF5 file.
- theta : ndarray, optional
Which parameter points to use for histogramming the data.
- observable : str
Which observable to plot, given by its name in the MadMiner file.
- obs_label : str
x-axis label naming the observable.
- obs_range : tuple of two float
Range to be plotted for the observable.
- n_bins : int
Number of bins. Default value: 50.
- nuisance_parameters : None or list of int, optional
This can restrict which nuisance parameters are used to draw the uncertainty bands. Each entry of this list is the index of one nuisance parameter (same order as in the MadMiner file).
- n_events : None or int, optional
If not None, sets the number of events from the MadMiner file that will be analyzed and plotted. Default value: None.
- n_toys : int, optional
Number of toy nuisance parameter vectors used to estimate the systematic uncertainties. Default value: 100.
- linecolor : str, optional
Line color for central prediction. Default value: “black”.
- bandcolor1 : str, optional
Error band color for 1 sigma uncertainty. Default value: “#CC002E”.
- bandcolor2 : str, optional
Error band color for 2 sigma uncertainty. Default value: “orange”.
- ratio_range : tuple of two floar
y-axis range for the plots of the ratio to the central prediction. Default value: (0.8, 1.2).
Returns: - figure : Figure
Plot as Matplotlib Figure instance.