From fadc9cedc5a00ad117dd8a845c60e89a78b95adf Mon Sep 17 00:00:00 2001 From: Radonirinaunimi Date: Thu, 18 Jul 2024 12:01:21 +0200 Subject: [PATCH 1/3] bump pineappl version --- pyproject.toml | 2 +- validphys2/examples/API_extension_Pineappl.ipynb | 2 +- validphys2/src/validphys/photon/structure_functions.py | 2 +- validphys2/src/validphys/pineparser.py | 2 +- .../src/validphys/tests/photon/test_structurefunctions.py | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 970d3d5b1b..cbb11330da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ vp-deltachi2 = "validphys.scripts.vp_deltachi2:main" # Generic dependencies (i.e., validphys) python = "^3.9" matplotlib = ">=3.3.0,<3.8" -pineappl = "^0.7.0" +pineappl = "^0.8.1" pandas = "*" numpy = "*" validobj = "*" diff --git a/validphys2/examples/API_extension_Pineappl.ipynb b/validphys2/examples/API_extension_Pineappl.ipynb index 813f6ca204..90d6afdc73 100644 --- a/validphys2/examples/API_extension_Pineappl.ipynb +++ b/validphys2/examples/API_extension_Pineappl.ipynb @@ -85,7 +85,7 @@ " bin_norm = self._grid.bin_normalizations().reshape(-1, 1)\n", " \n", " for i, member in enumerate(pdf.members):\n", - " tmp = self._grid.convolute_with_one(2212, member.xfxQ2, member.alphasQ2, xi=all_scales).reshape(-1, len(all_scales))\n", + " tmp = self._grid.convolve_with_one(2212, member.xfxQ2, member.alphasQ2, xi=all_scales).reshape(-1, len(all_scales))\n", "\n", " if self._apply_bin:\n", " tmp *= bin_norm\n", diff --git a/validphys2/src/validphys/photon/structure_functions.py b/validphys2/src/validphys/photon/structure_functions.py index 31cae6c083..73b45f4746 100644 --- a/validphys2/src/validphys/photon/structure_functions.py +++ b/validphys2/src/validphys/photon/structure_functions.py @@ -43,7 +43,7 @@ def __init__(self, path_to_fktable, pdfs): self.q2_max = max(q2) - predictions = self.fktable.convolute_with_one(2212, pdfs.xfxQ2) + predictions = self.fktable.convolve_with_one(2212, pdfs.xfxQ2) grid2D = predictions.reshape(len(x), len(q2)) self.interpolator = RectBivariateSpline(x, q2, grid2D) diff --git a/validphys2/src/validphys/pineparser.py b/validphys2/src/validphys/pineparser.py index b58dc947c6..1473731089 100644 --- a/validphys2/src/validphys/pineparser.py +++ b/validphys2/src/validphys/pineparser.py @@ -223,7 +223,7 @@ def pineappl_reader(fkspec): # Create the multi-index for the dataframe # for optimized pineappls different grids can potentially have different indices # so they need to be indexed separately and then concatenated only at the end - lumi_columns = _pinelumi_to_columns(p.lumi(), hadronic) + lumi_columns = _pinelumi_to_columns(p.channels(), hadronic) lf = len(lumi_columns) data_idx = np.arange(ndata, ndata + n) if hadronic: diff --git a/validphys2/src/validphys/tests/photon/test_structurefunctions.py b/validphys2/src/validphys/tests/photon/test_structurefunctions.py index 5ed71272a8..f3bba28d0d 100644 --- a/validphys2/src/validphys/tests/photon/test_structurefunctions.py +++ b/validphys2/src/validphys/tests/photon/test_structurefunctions.py @@ -35,7 +35,7 @@ def bin_left(self, i): else: return 0 - def convolute_with_one(self, pdgid, xfxQ2): + def convolve_with_one(self, pdgid, xfxQ2): return np.zeros((10, 10)) @@ -99,7 +99,7 @@ def test_interpolation_grid(): fktable = pineappl.fk_table.FkTable.read(path_to_fktable) x = np.unique(fktable.bin_left(1)) q2 = np.unique(fktable.bin_left(0)) - predictions = fktable.convolute_with_one(2212, pdfs.members[replica].xfxQ2) + predictions = fktable.convolve_with_one(2212, pdfs.members[replica].xfxQ2) grid2D = predictions.reshape(len(x), len(q2)) struct_func = sf.InterpStructureFunction(path_to_fktable, pdfs.members[replica]) From 7927d6062460d53a4188a622785edf203dfc31a7 Mon Sep 17 00:00:00 2001 From: Radonirinaunimi Date: Thu, 18 Jul 2024 17:39:05 +0200 Subject: [PATCH 2/3] make also sure that it is able to read newest FK tables --- validphys2/src/validphys/pineparser.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/validphys2/src/validphys/pineparser.py b/validphys2/src/validphys/pineparser.py index 1473731089..f61d9aa3ab 100644 --- a/validphys2/src/validphys/pineparser.py +++ b/validphys2/src/validphys/pineparser.py @@ -159,9 +159,16 @@ def pineappl_reader(fkspec): is_polarized = pine_rep.key_values().get("polarized") == "True" # Is it hadronic? (at the moment only hadronic and DIS are considered) - hadronic = pine_rep.key_values()["initial_state_1"] == pine_rep.key_values()["initial_state_2"] + try: + parton1 = pine_rep.key_values()["convolution_particle_1"] + parton2 = pine_rep.key_values()["convolution_particle_2"] + except KeyError: + parton1 = pine_rep.key_values()["initial_state_1"] + parton2 = pine_rep.key_values()["initial_state_2"] + hadronic = parton1 == parton2 + # Sanity check (in case at some point we start fitting things that are not protons) - if hadronic and pine_rep.key_values()["initial_state_1"] != "2212": + if hadronic and parton1 != "2212": raise ValueError( "pineappl_reader is not prepared to read a hadronic fktable with no protons!" ) From a1cb4513f622370b00ef1a6d4f58c5472956b30d Mon Sep 17 00:00:00 2001 From: Radonirinaunimi Date: Tue, 23 Jul 2024 14:42:17 +0200 Subject: [PATCH 3/3] use pineappl v0.8.2 --- conda-recipe/meta.yaml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 03cb440bca..9d1b6376e3 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -36,7 +36,7 @@ requirements: - requests - prompt_toolkit - validobj - - pineappl >=0.7.3 + - pineappl >=0.8.2 - eko >=0.14.2 - fiatlux - sphinx >=5.0.2,<6 # documentation. Needs pinning temporarily due to markdown diff --git a/pyproject.toml b/pyproject.toml index cbb11330da..cb3809b892 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ vp-deltachi2 = "validphys.scripts.vp_deltachi2:main" # Generic dependencies (i.e., validphys) python = "^3.9" matplotlib = ">=3.3.0,<3.8" -pineappl = "^0.8.1" +pineappl = "^0.8.2" pandas = "*" numpy = "*" validobj = "*"