From cf5e384ae745f5f67cc73d6fff5b4f7e18b25a58 Mon Sep 17 00:00:00 2001 From: RoyStegeman Date: Wed, 26 Jun 2024 10:58:31 +0100 Subject: [PATCH 1/5] replace deprecated scipy.integrate.simps with simpson --- validphys2/src/validphys/arclength.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/validphys2/src/validphys/arclength.py b/validphys2/src/validphys/arclength.py index 88169ae77b..48258f52d3 100644 --- a/validphys2/src/validphys/arclength.py +++ b/validphys2/src/validphys/arclength.py @@ -3,6 +3,7 @@ Module for the computation and presentation of arclengths. """ + from collections import namedtuple from collections.abc import Sequence import numbers @@ -78,7 +79,7 @@ def arc_lengths( # PDFs evaluated on grid, use the entire thing, the Stats class will chose later xfgrid = xplotting_grid(pdf, Q, ixgrid, basis, flavours).grid_values.data * ixgrid[1] fdiff = np.diff(xfgrid) / eps # Compute forward differences - res += integrate.simps(np.sqrt(1 + np.square(fdiff)), ixgrid[1][1:]) + res += integrate.simpson(np.sqrt(1 + np.square(fdiff)), x=ixgrid[1][1:]) stats = pdf.stats_class(res) return ArcLengthGrid(pdf, basis, flavours, stats) @@ -150,7 +151,7 @@ def integrability_number( basis: (str, Basis) = "evolution", flavours: (list, tuple, type(None)) = None, ): - """Return \sum_i |x_i*f(x_i)|, x_i = {1e-9, 1e-8, 1e-7} + r"""Return \sum_i |x_i*f(x_i)|, x_i = {1e-9, 1e-8, 1e-7} for selected flavours """ checked = check_basis(basis, flavours) From 40ccac54ffa85d477943c49de6182abaad23d13d Mon Sep 17 00:00:00 2001 From: RoyStegeman Date: Mon, 24 Jun 2024 15:58:55 +0100 Subject: [PATCH 2/5] add POS_DIS process instead of POS_F2 --- .../NNPDF_POS_2P24GEV/metadata.yaml | 18 +++++++++--------- validphys2/src/validphys/process_options.py | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml index d9dffbdaa0..b135bc2715 100644 --- a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml +++ b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml @@ -56,7 +56,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS $c+\bar{c}$ structure function $F_2^c$' units: '' - process_type: POS_F2 + process_type: POS_DIS tables: [] npoints: [] ndata: 20 @@ -91,7 +91,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS $c$ structure function $F_2^{W^-,c}$' units: '' - process_type: POS_F2 + process_type: POS_DIS tables: [] npoints: [] ndata: 17 @@ -126,7 +126,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS $d+\bar{d}$ structure function $F_2^d$' units: '' - process_type: POS_F2 + process_type: POS_DIS tables: [] npoints: [] ndata: 20 @@ -161,7 +161,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS $s+\bar{s}$ structure function $F_2^s$' units: '' - process_type: POS_F2 + process_type: POS_DIS tables: [] npoints: [] ndata: 20 @@ -196,7 +196,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS light quark longitudinal structure function $F_L^l$' units: '' - process_type: POS_FLL + process_type: POS_DIS tables: [] npoints: [] ndata: 20 @@ -454,7 +454,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS $c+\bar{c}$ structure function $F_2^c$' units: '' - process_type: POS_F2 + process_type: POS_DIS tables: [] npoints: [] ndata: 17 @@ -489,7 +489,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: CC DIS $\bar{c}$ structure function $F_2^{W^+,c}$' units: '' - process_type: POS_F2 + process_type: POS_DIS tables: [] npoints: [] ndata: 17 @@ -524,7 +524,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS $u+\bar{u}$ structure function $F_2^u$' units: '' - process_type: POS_F2 + process_type: POS_DIS tables: [] npoints: [] ndata: 20 @@ -559,7 +559,7 @@ implemented_observables: description: Deep Inelastic Scattering label: 'positivity dataset: DIS light quark longitudinal structure function $F_L^l$' units: '' - process_type: POS_FLL + process_type: POS_DIS tables: [] npoints: [] ndata: 19 diff --git a/validphys2/src/validphys/process_options.py b/validphys2/src/validphys/process_options.py index 059ddcd28e..15460d1993 100644 --- a/validphys2/src/validphys/process_options.py +++ b/validphys2/src/validphys/process_options.py @@ -180,7 +180,7 @@ def _hqp_ptq_xq2map(kin_info): def _hqp_mqq_xq2map(kin_info): # Compute x, Q2 # - # Theory predictions computed with HT/4 ~ m_ttbar/4 + # Theory predictions computed with HT/4 ~ m_ttbar/4 Q = kin_info[_Vars.m_ttBar] / 4 return Q / kin_info[_Vars.sqrts], Q * Q @@ -310,7 +310,7 @@ def _dybosonpt_xq2map(kin_dict): POS_XPDF = _Process("POS_XPDF", "Positivity of MS bar PDFs", accepted_variables=(_Vars.x, _Vars.Q2)) -POS_F2 = _Process("POS_F2", "Positivity of F2 structure functions", accepted_variables=(_Vars.x, _Vars.Q2)) +POS_DIS = _Process("POS_DIS", "Positivity of F2 structure functions", accepted_variables=(_Vars.x, _Vars.Q2)) PROCESSES = { "DIS": DIS, @@ -331,7 +331,7 @@ def _dybosonpt_xq2map(kin_dict): "DY_W_ETA": dataclasses.replace(DY_2L, name="DY_W_ETA", description="DY W -> l nu (pseudo)rapidity"), "DY_NC_PT": dataclasses.replace(DY_PT, name="DY_NC_PT", description="DY Z (ll) + j"), "POS_XPDF": POS_XPDF, - "POS_F2": POS_F2, + "POS_DIS": POS_DIS, } From a2e31221e4d5586d5144b61965a30a9d8f1f4886 Mon Sep 17 00:00:00 2001 From: RoyStegeman Date: Mon, 24 Jun 2024 15:59:38 +0100 Subject: [PATCH 3/5] pre-commit --- validphys2/src/validphys/process_options.py | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/validphys2/src/validphys/process_options.py b/validphys2/src/validphys/process_options.py index 15460d1993..eed200002a 100644 --- a/validphys2/src/validphys/process_options.py +++ b/validphys2/src/validphys/process_options.py @@ -5,7 +5,7 @@ """ import dataclasses -from typing import Callable, Optional, Tuple, Union +from typing import Callable, Optional, Union import numpy as np from validobj.custom import Parser @@ -71,7 +71,7 @@ def __getitem__(self, key): class _Process: name: str description: str - accepted_variables: Tuple[str] + accepted_variables: tuple[str] xq2map_function: Optional[Callable] = None def __hash__(self): @@ -206,7 +206,6 @@ def _displusjet_xq2map(kin_info): return x, q2 - def _dyboson_xq2map(kin_info): """ Computes x and q2 mapping for pseudo rapidity observables @@ -259,7 +258,14 @@ def _dybosonpt_xq2map(kin_dict): HQP_YQ = _Process( "HQP_YQ", "(absolute) rapidity of top quark in top pair production", - accepted_variables=(_Vars.y_t, _Vars.y_ttBar, _Vars.m_t2, _Vars.sqrts, _Vars.m_ttBar, _Vars.pT_t), + accepted_variables=( + _Vars.y_t, + _Vars.y_ttBar, + _Vars.m_t2, + _Vars.sqrts, + _Vars.m_ttBar, + _Vars.pT_t, + ), xq2map_function=_hqp_yq_xq2map, ) @@ -310,7 +316,9 @@ def _dybosonpt_xq2map(kin_dict): POS_XPDF = _Process("POS_XPDF", "Positivity of MS bar PDFs", accepted_variables=(_Vars.x, _Vars.Q2)) -POS_DIS = _Process("POS_DIS", "Positivity of F2 structure functions", accepted_variables=(_Vars.x, _Vars.Q2)) +POS_DIS = _Process( + "POS_DIS", "Positivity of F2 structure functions", accepted_variables=(_Vars.x, _Vars.Q2) +) PROCESSES = { "DIS": DIS, @@ -328,7 +336,9 @@ def _dybosonpt_xq2map(kin_dict): "HERAJET": HERAJET, "HERADIJET": dataclasses.replace(HERAJET, name="HERADIJET", description="DIS + jj production"), "DY_Z_Y": dataclasses.replace(DY_2L, name="DY_Z_Y", description="DY Z -> ll (pseudo)rapidity"), - "DY_W_ETA": dataclasses.replace(DY_2L, name="DY_W_ETA", description="DY W -> l nu (pseudo)rapidity"), + "DY_W_ETA": dataclasses.replace( + DY_2L, name="DY_W_ETA", description="DY W -> l nu (pseudo)rapidity" + ), "DY_NC_PT": dataclasses.replace(DY_PT, name="DY_NC_PT", description="DY Z (ll) + j"), "POS_XPDF": POS_XPDF, "POS_DIS": POS_DIS, From 7b1cb494fe3665ece86628c966704f7f8eecd170 Mon Sep 17 00:00:00 2001 From: RoyStegeman Date: Wed, 26 Jun 2024 13:47:48 +0100 Subject: [PATCH 4/5] update k1,k2,k3 to x,Q2 in POS_DIS kinematics metadata --- .../NNPDF_POS_2P24GEV/metadata.yaml | 42 +++++++------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml index b135bc2715..ef5971153c 100644 --- a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml +++ b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/metadata.yaml @@ -207,22 +207,17 @@ implemented_observables: $F_L^l$' plot_x: k1 kinematic_coverage: - - k1 - - k2 - - k3 + - x + - Q2 kinematics: variables: - k1: - description: Variable k1 - label: k1 - units: '' - k2: - description: Variable k2 - label: k2 + x: + description: Bjorken x + label: x units: '' - k3: - description: Variable k3 - label: k3 + Q2: + description: Factorization scale + label: Q2 units: '' file: kinematics_FLL.yaml theory: @@ -570,22 +565,17 @@ implemented_observables: $F_L^l$' plot_x: k1 kinematic_coverage: - - k1 - - k2 - - k3 + - x + - Q2 kinematics: variables: - k1: - description: Variable k1 - label: k1 - units: '' - k2: - description: Variable k2 - label: k2 + x: + description: Bjorken x + label: x units: '' - k3: - description: Variable k3 - label: k3 + Q2: + description: Factorization scale + label: Q2 units: '' file: kinematics_FLL-19PTS.yaml theory: From 598bca0ca0157effd99ee1019b6d2943c0f435b2 Mon Sep 17 00:00:00 2001 From: RoyStegeman Date: Wed, 26 Jun 2024 14:23:06 +0100 Subject: [PATCH 5/5] replace k1,k2,k3 with x,Q2 in kinematics files for POS_FLL --- .../kinematics_FLL-19PTS.yaml | 152 +++++------------ .../NNPDF_POS_2P24GEV/kinematics_FLL.yaml | 160 +++++------------- 2 files changed, 78 insertions(+), 234 deletions(-) diff --git a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL-19PTS.yaml b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL-19PTS.yaml index 9f78a90ce2..fe53ed59c0 100644 --- a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL-19PTS.yaml +++ b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL-19PTS.yaml @@ -1,229 +1,153 @@ bins: -- k1: +- x: min: null mid: 1.940766723678e-06 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 7.533150951473e-06 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 2.924017738213e-05 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.0001134967265154 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.0004405413401349 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.001709975946677 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.006637328831201 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.02576301385941 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.1 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.18 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.26 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.34 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.42 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.5 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.58 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.66 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.74 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.82 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.9 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null diff --git a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL.yaml b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL.yaml index 26edc37705..24b058bef1 100644 --- a/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL.yaml +++ b/nnpdf_data/nnpdf_data/new_commondata/NNPDF_POS_2P24GEV/kinematics_FLL.yaml @@ -1,241 +1,161 @@ bins: -- k1: +- x: min: null mid: 5.0e-07 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 1.940766723678e-06 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 7.533150951473e-06 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 2.924017738213e-05 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.0001134967265154 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.0004405413401349 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.001709975946677 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.006637328831201 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.02576301385941 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.1 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.18 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.26 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.34 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.42 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.5 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.58 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.66 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.74 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.82 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null -- k1: +- x: min: null mid: 0.9 max: null - k2: + Q2: min: null mid: 5.0 max: null - k3: - min: null - mid: 0.0 - max: null