validphys.theorycovariance package

theorycovariance

Tools for constructing and studying theory covariance matrices.

This package contains tools for constructing covariance matrices and computing their chi2s in construction.py, tools for plotting covariance matrices and tabulating their properties in output.py, and tools for testing their properties in tests.py.

Submodules

validphys.theorycovariance.construction module

construction.py Tools for constructing theory covariance matrices and computing their chi2s.

class validphys.theorycovariance.construction.ProcessInfo(preds: dict, namelist: dict, sizes: dict, data_spec: dict)[source]

Bases: object

Dataclass containing the information needed to construct the theory covariance matrix.

data_spec: dict
namelist: dict
preds: dict
sizes: dict
validphys.theorycovariance.construction.combine_by_type(each_dataset_results_central_bytheory, groups_data_by_process)[source]

Groups the datasets by process and returns an instance of the ProcessInfo class

Parameters:

each_dataset_results_central_bytheory (list[list[(DataResult,ThPredictionsResult)]]) – Tuples of DataResult and ThPredictionsResult (where only the second is used for the construction of the theory covariance matrix), wrapped in a list such that there is a tuple per theoryid, wrapped in another list per dataset.

Returns:

Class with info needed to construct the theory covmat.

Return type:

ProcesInfo validphys.theorycovariance.construction.ProcessInfo

validphys.theorycovariance.construction.compute_covs_pt_prescrip(point_prescription, name1, deltas1, name2=None, deltas2=None)[source]

Utility to compute the covariance matrix by prescription given the shifts with respect to the central value for a pair of processes.

The processes are defined by the variables name1 and name2 with deltas1 and deltas2 the associated shifts wrt the central prediction.

This utility also allows for the computation of the theory covmat for a single process or dataset if names2=deltas2=None.

Parameters:
  • point_prescription (str) – defines the point prescription to be utilized

  • name1 (str) – Process name of the first set of shifts

  • deltas1 (list(np.ndarray)) – list of shifts for each of the non-central theories

  • name2 (str) – Process name of the second set of shifts

  • deltas2 (list(np.ndarray)) – list of shifts for each of the non-central theories

validphys.theorycovariance.construction.covmat_3fpt(deltas1, deltas2)[source]

Returns theory covariance sub-matrix for 3pt factorisation scale variation only, given two dataset names and collections of scale variation shifts

validphys.theorycovariance.construction.covmat_3pt(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for 3pt prescription, given two dataset names and collections of scale variation shifts

validphys.theorycovariance.construction.covmat_5barpt(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for 5barpt prescription, given two dataset names and collections of scale variation shifts

validphys.theorycovariance.construction.covmat_5pt(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for 5pt prescription, given two dataset names and collections of scale variation shifts

validphys.theorycovariance.construction.covmat_7pt(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for 7pt prescription (Gavin), given two dataset names and collections of scale variation shifts

validphys.theorycovariance.construction.covmat_9pt(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for 9pt prescription, given two dataset names and collections of scale variation shifts

validphys.theorycovariance.construction.covmat_n3lo_ad(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for each of the singlet splitting function variations.

Normalization is given by:

(n_pt - 1)

where:
  • n_pt = number of point presctiption

validphys.theorycovariance.construction.covmat_n3lo_fhmruvv(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for all the FHMRUVV splitting function variations.

validphys.theorycovariance.construction.covmat_n3lo_singlet(name1, name2, deltas1, deltas2)[source]

Returns theory covariance sub-matrix for all the singlet splitting function variations.

validphys.theorycovariance.construction.covmat_power_corrections(deltas1, deltas2)[source]

Returns the the theory covariance sub-matrix for power corrections. The two arguments deltas1 and deltas2 contain the shifts for the first and second experiment, respectively.

The shifts are given in this form:

deltas1 = [array1_of_shifts1,
           array1_of_shifts2, array1_of_shifts3, ...]
deltas2 = [array2_of_shifts1,
           array2_of_shifts2, array2_of_shifts3, ...]

The sub-matrix is computed as:

s = array1_of_shifts1 X array2_of_shifts1 + array1_of_shifts2 X
array2_of_shifts2 + ...

where X is the outer product. This is equivalent to a generalised 5 point prescription. Since corrections are linearised, plus and minus variations are not distinguished and all variations are treated as independent, hence the sum over all variations without any additional factors.

validphys.theorycovariance.construction.covs_pt_prescrip_mhou(combine_by_type, point_prescription)[source]

Produces the sub-matrices of the theory covariance matrix according to a point prescription which matches the number of input theories. If 5 theories are provided, a scheme ‘bar’ or ‘nobar’ must be chosen in the runcard in order to specify the prescription. Sub-matrices correspond to applying the scale variation prescription to each pair of processes in turn, using a different procedure for the case where the processes are the same relative to when they are different.

validphys.theorycovariance.construction.covs_pt_prescrip_pc(combine_by_type, point_prescription, pdf, pc_parameters, pc_included_procs, pc_excluded_datasets)[source]

Produces the sub-matrices of the theory covariance matrix for power corrections. Sub-matrices correspond to applying power corrected shifts to each pair of datasets.

validphys.theorycovariance.construction.data_input_matched_procs_index(data_input, procs_index)[source]

procs_index ordered according to data_input (runcard order), so that nnfit_theory_covmat is stored in the same order as loaded_theory_covmat.

validphys.theorycovariance.construction.experimentplustheory_corrmat_custom(procs_covmat, theory_covmat_custom)[source]

Calculates the correlation matrix for the experimental plus theory covariance matrices, correlations by prescription.

validphys.theorycovariance.construction.fromfile_covmat(covmatpath, groups_data_by_process, procs_index)[source]

Reads a general theory covariance matrix from file. Then

  1. Applies cuts to match experiment covariance matrix

  2. Expands dimensions to match experiment covariance matrix by filling additional entries with 0.

validphys.theorycovariance.construction.theory_corrmat_custom(theory_covmat_custom)[source]

Calculates the theory correlation matrix for scale variations with variations by process type

validphys.theorycovariance.construction.theory_covmat_custom(theory_covmats_fitting)[source]

Sum all the theory covmat listed in point_prescriptions.

validphys.theorycovariance.construction.theory_covmat_custom_fitting(theory_covmat_custom, data_input_matched_procs_index)[source]

theory_covmat_custom (summed over all point prescriptions) reindexed to data_input (runcard) order so it aligns with loaded_theory_covmat in n3fit.

validphys.theorycovariance.construction.theory_covmat_custom_per_prescription(covs_pt_prescrip, procs_index, combine_by_type)[source]

Takes the individual sub-covmats between each two processes and assembles them into a full covmat. Then reshuffles the order from ordering by process to ordering by experiment as listed in the runcard

validphys.theorycovariance.construction.theory_covmat_dataset(results, results_central_bytheoryids, point_prescription)[source]

Compute the theory covmat for a collection of theoryids for a single dataset.

In general this will come from some point prescription and it could be guessed from the input however, it takes as input all relevant variables for generality

validphys.theorycovariance.construction.theory_normcovmat_custom(theory_covmat_custom, procs_data_values)[source]

Calculates the theory covariance matrix for scale variations normalised to data, with variations according to the relevant prescription.

validphys.theorycovariance.construction.total_theory_covmat(theory_covmat_custom, user_covmat)[source]

Sum of scale variation and user covmat, where both are used.

validphys.theorycovariance.construction.total_theory_covmat_fitting(total_theory_covmat, data_input_matched_procs_index)[source]

total_theory_covmat reindexed to data_input (runcard) order so it aligns with loaded_theory_covmat in n3fit.

validphys.theorycovariance.construction.user_covmat(groups_data_by_process, procs_index, loaded_user_covmat_path, mult_factor_user_covmat)[source]

General theory covariance matrix provided by the user. Useful for testing the impact of externally produced covariance matrices. Matrices must be produced as a csv of pandas DataFrame, and uploaded to the validphys server. The server path is then provided via user_covmat_path in theorycovmatconfig in the runcard. For more information see documentation.

validphys.theorycovariance.construction.user_covmat_fitting(user_covmat, data_input_matched_procs_index)[source]

user_covmat reindexed to data_input (runcard) order so it aligns with loaded_theory_covmat in n3fit.

validphys.theorycovariance.higher_twist_functions module

Utilities for the computation of shifts in theoretical predictions due to power corrections. Contrary to scale variations, the multiplicative shifts due to power corrections are computed at runtime during vp-setupfit. Once the shifts are computed using the function compute_deltas_pc, the covmat can be constructed using the same functions implemented for scale variations (e.g. covs_pt_prescrip).

In the case of power corrections, shifts and covmat constructions are computed using a 5-point prescription extended to every parameter used to define the power correction.

This module extracts the dataset-to-power-correction-type routing into a reusable function get_pc_type. It also comprehends a bunch of factory functions such as mult_dis_pc. Each of these functions returns another function that computes the shifts taking as arguments the values of the parameters used to parametrise the power corrections. In other words, these factory functions hard-code the dependence on the kinematic and leave the dependence on the parameters free. In this way, the shifts can be computed using different combinations of parameters (i.e. different prescriptions) if needed.

validphys.theorycovariance.higher_twist_functions.compute_deltas_pc(dataset_sp: ~validphys.core.DataSetSpec, pdf: ~validphys.core.PDF, pc_dict: dict, pars_comb_func: callable = <function construct_pars_combs>, cfactors: bool = False) → dict[source]

Computes the shifts due to power corrections for a single dataset given the set of parameters that model the power corrections. The result is a dictionary containing as many arrays of shifts as the number of combinations of the parameters. For instance, the final dictionary may look like:

deltas1 = {comb1_label: array_of_shifts1,
           comb2_label: array_of_shifts2,
           comb3_label: array_of_shifts3,
           ...}

Note that, as of now, we don’t need to specify different prescriptions. Hence, the prescription adopted to construct the shifts is hard coded in the function construct_pars_combs, and the prescription used to compute the sub-matrix is hard-coded in covmat_power_corrections.

validphys.theorycovariance.higher_twist_functions.construct_pars_combs(parameters_dict: dict, pc_types_2d=None) → list[dict][source]

Construct the combination of parameters (the ones that parametrize the power corrections) used to compute the shifts.

Example

Given the following dictionary that specifies the power corrections:

pc_dict = {
  'H1': {'yshift': [1,2],   'nodes': [1, 2]},
  'H2': {'yshift': [3,4,5], 'nodes': [1, 2, 3]},
}

then this function constructs a list as follows:

pars_combs = [
 {'label': 'H1(0)', 'comb': {'H1': [1,0], 'H2': [0,0,0]}},
 {'label': 'H1(1)', 'comb': {'H1': [0,2], 'H2': [0,0,0]}},
 {'label': 'H2(0)', 'comb': {'H1': [0,0], 'H2': [3,0,0]}},
 {'label': 'H2(1)', 'comb': {'H1': [0,0], 'H2': [0,4,0]}},
 {'label': 'H2(2)', 'comb': {'H1': [0,0], 'H2': [0,0,5]}},
]
validphys.theorycovariance.higher_twist_functions.dijet3D_pc_func(ystar_shifts: ArrayLike, yb_shifts: ArrayLike, ystar_nodes: ArrayLike, yb_nodes: ArrayLike, m_jj: ArrayLike, ystar: ArrayLike, yb: ArrayLike) → ArrayLike[source]

Similar to jets_pc_func, but for dijet 3D data the correction is a function on the two-dimensional grid in (ystar, yb).

Parameters:
  • ystar_shifts (ArrayLike) – One-dimensional array containing the shifts for each bin in ystar.

  • yb_shifts (ArrayLike) – One-dimensional array containing the shifts for each bin in yb.

  • ystar_nodes (ArrayLike) – One-dimensional array containing the edges of the bins in ystar.

  • yb_nodes (ArrayLike) – One-dimensional array containing the edges of the bins in yb.

  • ystar (ArrayLike) – List of ystar points at which the power correction is evaluated.

  • yb (ArrayLike) – List of yb points at which the power correction is evaluated.

validphys.theorycovariance.higher_twist_functions.dijet_ymax_pc_func(ystar_shifts: ArrayLike, yb_shifts: ArrayLike, ystar_nodes: ArrayLike, yb_nodes: ArrayLike, m_jj: ArrayLike, ymax: ArrayLike) → ArrayLike[source]

Compute the two-dimensional power correction for the double-differential dijet distribution in y_max. The following convention is used: x = y*, y = y_b, and z = y_max.

The 2D power correction H(x, y) is integrated along the diagonal y = z - x using per-cell Simpson’s rule (exact for the quadratic integrand):

H(z) = (1/Delta_x_total) * sum_{cells (a,b)} (b-a)/6 * [F(a) + 4*F(mid) + F(b)]

where F(x) = F_alpha^x(t_x(x)) * F_beta^y(t_y(x)) is the product of the two local linear interpolants within the cell, and [a, b] is the overlap between the cell column and the diagonal line y = z - x.

Parameters:
  • ystar_shifts (ArrayLike) – Node values h_alpha^(y*) of the 2D power correction grid.

  • yb_shifts (ArrayLike) – Node values h_beta^(y_b) of the 2D power correction grid.

  • ystar_nodes (ArrayLike) – Grid nodes in y* (= x in the notes).

  • yb_nodes (ArrayLike) – Grid nodes in y_b (= y in the notes).

  • m_jj (ArrayLike) – Dijet invariant mass for each data point (used as the overall 1/m_jj factor).

  • ymax (ArrayLike) – y_max values (= z in the notes) at which H(z) is evaluated.

Returns:

Power correction H(z) / m_jj evaluated at each data point.

Return type:

np.ndarray

validphys.theorycovariance.higher_twist_functions.dijet_ystar_pc_func(ystar_shifts: ArrayLike, yb_shifts: ArrayLike, ystar_nodes: ArrayLike, yb_nodes: ArrayLike, m_jj: ArrayLike, ystar: ArrayLike) → ArrayLike[source]

Integrate the two-dimensional power correction function over the nodes in yb to obtain a one-dimensional function of ystar. It uses trapezoidal integration.

Parameters:
  • ystar_shifts (ArrayLike) – One-dimensional array containing the shifts for each bin in ystar.

  • yb_shifts (ArrayLike) – One-dimensional array containing the shifts for each bin in yb.

  • ystar_nodes (ArrayLike) – One-dimensional array containing the edges of the bins in ystar.

  • yb_nodes (ArrayLike) – One-dimensional array containing the edges of the bins in yb.

  • ystar (ArrayLike) – List of ystar points at which the power correction is evaluated.

validphys.theorycovariance.higher_twist_functions.dis_pc_func(delta_h: ArrayLike, nodes: ArrayLike, x: ArrayLike, Q2: ArrayLike) → ArrayLike[source]

This function builds the functional form of the power corrections for DIS-like processes. Power corrections are modelled using a linear function, which interpolates between the nodes of the parametrisation. The y-values for each node are given by the array delta_h. The power corrections will be computed for the pairs (xb, Q2), where xb is the Bjorken x. The power correction for DIS processes is divided by Q2.

Parameters:
  • delta_h (ArrayLike) – One-dimensional array containing the shifts for each bin.

  • nodes (ArrayLike) – One-dimensional array containing the edges of the bins in x-Bjorken.

  • x (ArrayLike) – List of x-Bjorken points at which the power correction function is evaluated.

  • Q2 (ArrayLike) – List of scales where the power correction function is evaluated.

Returns:

  • A one-dimensional array of power corrections for DIS-like processes where each point is

  • evaluated at the kinematic pair (x,Q2).

validphys.theorycovariance.higher_twist_functions.get_pc_type(exp_name: str, process_type: str, experiment: str | None = None, pc_dict: dict | None = None) → str | Tuple[str, str][source]

Determine which power correction type(s) apply to a given dataset.

This is the single source of truth for mapping dataset names and process types to power correction parameter keys.

Parameters:
  • exp_name (str) – Dataset name (e.g. 'BCDMS_NC_NOTFIXED_P_EM-F2').

  • process_type (str) – Process type string (e.g. 'DIS_NCE', 'JET', 'DIJET').

  • experiment (str, optional) – Experiment name, required for DIJET (e.g. 'ATLAS', 'CMS').

  • pc_dict (dict, optional) – Power correction parameter dictionary. When provided, enables fallback logic for DIJET (H2j_ATLAS -> H2j if the experiment-specific key is absent).

Returns:

The PC type key(s). For the ratio dataset (NMC_NC_NOTFIXED_EM-F2), returns ("f2p", "f2d"). For all other datasets, returns a single string key.

Return type:

str or tuple of (str, str)

Raises:
validphys.theorycovariance.higher_twist_functions.jets_pc_func(delta_h: ArrayLike, nodes: ArrayLike, pT: ArrayLike, rap: ArrayLike) → ArrayLike[source]

Same as dis_pc_func, but for jet data. Here, the kinematic pair consists of the rapidity rap and the transverse momentum pT.

Parameters:
  • delta_h (ArrayLike) – One-dimensional array containing the shifts for each bin.

  • nodes (ArrayLike) – One-dimensional array containing the edges of the bins in rapidity.

  • pT (ArrayLike) – List of pT points at which the power correction is evaluated.

  • rap (ArrayLike) – List of rapidity points at which the power correction is evaluated.

Returns:

  • A one-dimensional array of power corrections for jet processes where each point is

  • evaluated at the kinematic pair (y, pT).

validphys.theorycovariance.higher_twist_functions.linear_bin_function(a: ArrayLike, y_shift: ArrayLike, nodes: ArrayLike) → ndarray[source]

This function defines the linear bin function used to construct the prior. Specifically, the prior is constructed using a triangular function whose value at the peak of the node is linked to the right and left nodes using a straight line.

Parameters:
  • a (ArrayLike of float) – A one-dimensional array of points at which the function is evaluated.

  • y_shift (ArrayLike of float) – A one-dimensional array whose elements represent the y-value of each bin

  • nodes (ArrayLike of float) – A one-dimensional array containing the edges of the bins. The bins are constructed using pairs of consecutive points.

Returns:

  • A one-dimensional array containing the function values evaluated at the points

  • specified in a.

validphys.theorycovariance.higher_twist_functions.mult_dijet_pc(ystar_nodes, yb_nodes, m_jj, dataset_sp, pdf, ystar: ArrayLike = array([], dtype=float64), yb: ArrayLike = array([], dtype=float64), ymax: ArrayLike = array([], dtype=float64), distrb: str = '3D', cfactors: bool = False) → callable[source]
validphys.theorycovariance.higher_twist_functions.mult_dis_pc(nodes, x, q2, dataset_sp, pdf, cfactors: bool = False) → callable[source]

Returns the function that computes the shift to observables due to power corrections. Power corrections are treated as multiplicative shifts. Hence if O is the observable, the prediction is shifted as

O -> O * (1 + PC),

and the shift is defined as

Delta(O) = O * (1 + PC) - O = O * PC.

This function returns a function that computes the shift given the y-values of the nodes used to define the power corrections.

validphys.theorycovariance.higher_twist_functions.mult_dis_ratio_pc(p_nodes, d_nodes, x, q2, dataset_sp, pdf, cfactors: bool = False) → callable[source]

Returns the function that computes the shift for the ratio of structure functions F2_d / F2_p. For this observable, power corrections are defined such that

F2_d / F2_p -> F2_d * (1 + PC2_d) / F2_p * (1 + PC2_p) ,

and the shift is the defined as

Delta(F2 ratio) = F2_d / F2_p * (PC2_d - PC2_p) / (1 + PC2_d).

As for mult_dis_pc, this function returns a function that computes the shift for the ratio of structure functions F2_d / F2_p given a set of y-values.

Parameters:
  • p_nodes (list[float]) – The list of nodes in x-Bjorken used to define the parametrization of the power correction for the proton (see dis_pc_func).

  • d_nodes (list[float]) – The list of nodes in x-Bjorken used to define the parametrization of the power correction for the deuteron (see dis_pc_func).

  • x (list[float]) – Set of points in x-Bjorken where the power corrections will be evaluated.

  • q2 (list[float]) – Set of points in Q2 where the power corrections will be evaluated.

  • dataset_sp (DataSetSpec) – An instance of DataSetSpec used to extract information such as cuts and fk tables.

  • pdf (PDF) – An instance of the class PDF. This specifies the PDF to bo convoluted with the FK tables.

Returns:

  • The function the computes the shift for this observable. It depends on the

  • y-values for the parameterization of P2_d and P2_p.

validphys.theorycovariance.higher_twist_functions.mult_jet_pc(nodes, pT, rap, dataset_sp, pdf, cfactors: bool = False) → callable[source]

As mult_dis_pc, but for jet data. The power corrections are defined as

xsec -> xsec * ( 1 + PC ),

and the shift is defined as

Delta(xsec) = (xsec + xsec) - xsec = PC.

The power correction is a function of the rapidity.

validphys.theorycovariance.output module

output.py Basic tools for plotting theory covariance matrices and their properties.

validphys.theorycovariance.output.matrix_plot_labels(df)[source]

Returns the tick locations and labels, and the starting point values for each category, based on a dataframe to be plotted. The dataframe is assumed to be multiindexed by (process, dataset, points) or else (dataset, points). The tick location is in the centre of the dataset, and labelling is by the outermost index of the multiindex.

validphys.theorycovariance.output.plot_corrmat_heatmap(corrmat, title)[source]

Matrix plot of a correlation matrix

validphys.theorycovariance.output.plot_covmat_heatmap(covmat, title)[source]

Matrix plot of a covariance matrix.

validphys.theorycovariance.output.plot_diag_cov_comparison(theory_covmat_custom, procs_covmat, procs_data_values, theoryids, point_prescription)[source]

Plot of sqrt(cov_ii)/|data_i| for cov = exp, theory, exp+theory

validphys.theorycovariance.output.plot_diag_cov_comparison_by_experiment(theory_covmat_custom_dataspecs, experiments_covmat_no_table, procs_data_values_experiment, dataspecs)[source]

Plot of sqrt(cov_ii)/|data_i| for cov = exp, theory, exp+theory, by experiment

validphys.theorycovariance.output.plot_diag_cov_comparison_by_process(theory_covmat_custom_dataspecs, procs_covmat, procs_data_values, dataspecs)[source]

Plot of sqrt(cov_ii)/|data_i| for cov = exp, theory, exp+theory, by process

dataspecs here is used also to specify whether to plot or not the total uncertainty, defined as the experimental uncertainty plus the uncertainty coming from the theory covariance matrix for the relevant dataspec entry.

validphys.theorycovariance.output.plot_expcorrmat_heatmap(procs_corrmat)[source]

Matrix plot of the experiment correlation matrix

validphys.theorycovariance.output.plot_expplusthcorrmat_heatmap_custom(experimentplustheory_corrmat_custom, theoryids, point_prescription)[source]

Matrix plot of the exp + theory correlation matrix

validphys.theorycovariance.output.plot_normexpcovmat_heatmap(procs_normcovmat)[source]

Matrix plot of the experiment covariance matrix normalised to data.

validphys.theorycovariance.output.plot_normthcovmat_heatmap_custom(theory_normcovmat_custom, theoryids, point_prescription)[source]

Matrix plot for block diagonal theory covariance matrix by process type

validphys.theorycovariance.output.plot_thcorrmat_heatmap_custom(theory_corrmat_custom, theoryids, point_prescription)[source]

Matrix plot of the theory correlation matrix, correlations by process type

validphys.theorycovariance.tests module

tests.py Tools for testing theory covariance matrices and their properties.

class validphys.theorycovariance.tests.LabeledShifts(process, dataset_name, shifts)[source]

Bases: tuple

dataset_name

Alias for field number 1

process

Alias for field number 0

shifts

Alias for field number 2

validphys.theorycovariance.tests.alltheory_vector(dataset_alltheory)[source]

Returns a DataFrame with the theory vectors for matched dataspecs for the scale-varied theories, including the central

validphys.theorycovariance.tests.concatenated_shx_vector(shx_vector)[source]

Single DataFrame for all the datasets of the shift vectors.

validphys.theorycovariance.tests.dataset_alltheory(each_dataset_results_central_bytheory)[source]

Returns a LabeledShifts tuple corresponding to the theory vectors for all the scale varied theories, including the central.

validphys.theorycovariance.tests.deltamiss_plot(theory_shift_test, ordered_alltheory_vector, fnorm_shifts_ordered, tripleindex_thcovmat_complete, dataspecs)[source]

Produces a plot of the missing component of the shift vector, transformed back to the data space.

validphys.theorycovariance.tests.diagdf_theory_covmat(theory_covmat_custom)[source]

Return a Dataframe indexed with groups and dataset of the diagonal entry of the theory covmat.

validphys.theorycovariance.tests.doubleindex_set_byprocess(group_dataset_inputs_by_process)[source]

The (group, dataset) index ordered by process.

validphys.theorycovariance.tests.doubleindex_thcovmat(theory_covmat_custom)[source]

The unique set of (group, dataset) index of the theory covmat.

validphys.theorycovariance.tests.efficiency(theory_shift_test)[source]

Returns (efficiency = 1 - fmiss/f) with which the theory covariance matrix encapsulates the NNLO-NLO shift.

validphys.theorycovariance.tests.eigenvector_plot(evals_nonzero_basis, fnorm_shifts_ordered, tripleindex_thcovmat_complete, dataspecs)[source]

Produces a plot of the eigenvectors for the projected matrix, transformed back to the data space.

validphys.theorycovariance.tests.evals_nonzero_basis(ordered_alltheory_vector, theory_covmat_custom, point_prescription, orthonormalisation: (<class 'str'>, <class 'NoneType'>) = None)[source]
validphys.theorycovariance.tests.fnorm_shifts_byprocess(concatenated_shx_vector, doubleindex_set_byprocess)[source]

Shift vector ordered by process.

validphys.theorycovariance.tests.fnorm_shifts_ordered(concatenated_shx_vector, doubleindex_thcovmat)[source]

Shifts vectors ordered as the theory covmat.

validphys.theorycovariance.tests.ordered_alltheory_vector(alltheory_vector, doubleindex_thcovmat)[source]

Order the group and the dataset of all the theory vectors of the scale-varied predictions in the same way the theory covmat is ordered.

validphys.theorycovariance.tests.projected_condition_num(evals_nonzero_basis)[source]
validphys.theorycovariance.tests.projector_eigenvalue_ratio(theory_shift_test)[source]

Produces a plot of the ratio between the projectors and the square roots of the corresponding eigenvalues.

validphys.theorycovariance.tests.shift_diag_cov_comparison(sqrtdiags_thcovmat_byprocess, fnorm_shifts_byprocess, point_prescription, ticklocs_thcovmat, dataspecs)[source]

Plot of the comparison of a shift between two pertubative order and the diagonal entries of the theory covmat, both normalized to the first of the two perturbative orders.

validphys.theorycovariance.tests.shift_vector(matched_dataspecs_results, process, dataset_name)[source]

Returns a DataFrame of normalised shift vectors and normalization vector for matched dataspecs.

validphys.theorycovariance.tests.sqrtdiags_thcovmat_byprocess(doubleindex_set_byprocess, diagdf_theory_covmat, concatenated_shx_vector)[source]

Ratio of the sqrts of the diagonal entries of the theory covmat to the normalization entries of the shift vectors, ordered by process.

validphys.theorycovariance.tests.theory_covmat_eigenvalues(theory_shift_test)[source]

Returns a table of s = sqrt(eigenvalue), the projector and the ratio of the two, ordered by largest eigenvalue.

validphys.theorycovariance.tests.theory_shift_test(fnorm_shifts_ordered, evals_nonzero_basis)[source]

Compares the NNLO-NLO shift, f, with the eigenvectors and eigenvalues of the theory covariance matrix, and returns the component of the NNLO-NLO shift space which is missed by the covariance matrix space: fmiss, as well as the projections of the shift vector onto each of the eigenvectors: projectors.

validphys.theorycovariance.tests.theta(theory_shift_test)[source]

Returns the angle between the NNLO-NLO shift vector and the component of this which is captured by the theory covariance matrix

validphys.theorycovariance.tests.ticklocs_thcovmat(theory_covmat_custom)[source]
validphys.theorycovariance.tests.tripleindex_thcovmat_complete(theory_covmat_custom)[source]

The complete tripleindex of the theory covmat.

validphys.theorycovariance.tests.validation_theory_chi2(theory_shift_test)[source]

Returns the theory chi2 for comparing NNLO-NLO shift with theory covariance matrix.

validphys.theorycovariance.tests.vectors_3pt(splitdiffs)[source]

Returns the linearly independent vectors for 3pt prescription

validphys.theorycovariance.tests.vectors_5barpt(splitdiffs)[source]

Returns the linearly independent vectors for 5barpt prescription

validphys.theorycovariance.tests.vectors_5pt(splitdiffs)[source]

Returns the linearly independent vectors for 5pt prescription

validphys.theorycovariance.tests.vectors_7pt(splitdiffs)[source]

Returns the linearly independent vectors for 7pt prescription

validphys.theorycovariance.tests.vectors_9pt(splitdiffs)[source]

Returns the linearly independent vectors for 9pt prescription

validphys.theorycovariance.theorycovarianceutils module

theorycovarianceutils.py

Low level utilities for theorycovariance module

validphys.theorycovariance.theorycovarianceutils.check_correct_theory_combination(theoryids, point_prescription: (<class 'str'>, <class 'NoneType'>) = None)[source]

Checks that a valid theory combination corresponding to an existing prescription has been inputted

validphys.theorycovariance.theorycovarianceutils.check_correct_theory_combination_internal(theoryids, point_prescription: (<class 'str'>, <class 'NoneType'>) = None)[source]

Checks that a valid theory combination corresponding to an existing prescription has been inputted

validphys.theorycovariance.theorycovarianceutils.process_lookup(name)[source]

Returns the nnpdf31_process of the corresponding dataset.