From 9b4d5085dfadd7300df9de48a98499b9e0532604 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 21:58:25 +0000 Subject: [PATCH 01/12] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hadialqattan/pycln: v2.1.6 → v2.2.0](https://github.com/hadialqattan/pycln/compare/v2.1.6...v2.2.0) - [github.com/asottile/pyupgrade: v3.9.0 → v3.10.1](https://github.com/asottile/pyupgrade/compare/v3.9.0...v3.10.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc5e6ccb..ff26e001 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: check-case-conflict - id: check-ast - repo: https://github.com/hadialqattan/pycln - rev: v2.1.6 + rev: v2.2.0 hooks: - id: pycln args: [--config=pyproject.toml] @@ -34,7 +34,7 @@ repos: - id: isort args: ["--profile", "black"] - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.10.1 hooks: - id: pyupgrade - repo: https://github.com/pycqa/pydocstyle From 41cd98cc26143fd1813efa0e75b592836d01eb39 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 21:38:18 +0000 Subject: [PATCH 02/12] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hadialqattan/pycln: v2.2.0 → v2.2.1](https://github.com/hadialqattan/pycln/compare/v2.2.0...v2.2.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff26e001..acd0cf27 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: check-case-conflict - id: check-ast - repo: https://github.com/hadialqattan/pycln - rev: v2.2.0 + rev: v2.2.1 hooks: - id: pycln args: [--config=pyproject.toml] From 5a7bba49a411125de9a200c6722be6a8cbaeb661 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 21:39:56 +0000 Subject: [PATCH 03/12] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hadialqattan/pycln: v2.2.1 → v2.2.2](https://github.com/hadialqattan/pycln/compare/v2.2.1...v2.2.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index acd0cf27..0ca3c74d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: check-case-conflict - id: check-ast - repo: https://github.com/hadialqattan/pycln - rev: v2.2.1 + rev: v2.2.2 hooks: - id: pycln args: [--config=pyproject.toml] From ea642bb2dc4335653d2f606bad5cf12c5fdd0082 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 21:55:35 +0000 Subject: [PATCH 04/12] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0) - [github.com/pre-commit/pre-commit: v3.3.3 → v3.4.0](https://github.com/pre-commit/pre-commit/compare/v3.3.3...v3.4.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0ca3c74d..e2017e70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: hooks: - id: black - repo: https://github.com/asottile/blacken-docs - rev: 1.15.0 + rev: 1.16.0 hooks: - id: blacken-docs - repo: https://github.com/pycqa/isort @@ -45,6 +45,6 @@ repos: additional_dependencies: - toml - repo: https://github.com/pre-commit/pre-commit - rev: v3.3.3 + rev: v3.4.0 hooks: - id: validate_manifest From aa2cc2a8767db0ea5a3da9d00ce8d524d36f4b26 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 22:19:40 +0000 Subject: [PATCH 05/12] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e2017e70..64a4d92b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: - id: pycln args: [--config=pyproject.toml] - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black - repo: https://github.com/asottile/blacken-docs From 1960c7ca15e5a76fac65a77d45575fd6d4fef59f Mon Sep 17 00:00:00 2001 From: andreab1997 Date: Mon, 18 Sep 2023 11:46:54 +0200 Subject: [PATCH 06/12] Rotate the eko back to save disk space --- src/pineko/evolve.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 86adac06..5b1790d6 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -246,6 +246,10 @@ def evolve_grid( order_mask=order_mask, xi=(xir, xif), ) + # Rotate again the eko to save disk space + eko.io.manipulate.xgrid_reshape( + operators, targetgrid=opcard.xgrid + ) rich.print(f"Optimizing for {assumptions}") fktable.optimize(assumptions) fktable.set_key_value("eko_version", operators.metadata.version) From a168da7b03b01d54241f38833b245ce6d3b2cf9e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 22:02:24 +0000 Subject: [PATCH 07/12] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 64a4d92b..1e028659 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: isort args: ["--profile", "black"] - repo: https://github.com/asottile/pyupgrade - rev: v3.10.1 + rev: v3.11.0 hooks: - id: pyupgrade - repo: https://github.com/pycqa/pydocstyle From 5016b86b5c552cde1d1790cc6b75f8a5cd283ff4 Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Tue, 19 Sep 2023 09:36:04 +0200 Subject: [PATCH 08/12] copy original operator instead of reinterpolate --- src/pineko/evolve.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 5b1790d6..2658d838 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -202,6 +202,7 @@ def evolve_grid( # rotate the targetgrid if "integrability_version" in grid.key_values(): x_grid = np.append(x_grid, 1.0) + orignal_operators = copy.deepcopy(operators) eko.io.manipulate.xgrid_reshape( operators, targetgrid=eko.interpolation.XGrid(x_grid) ) @@ -246,10 +247,8 @@ def evolve_grid( order_mask=order_mask, xi=(xir, xif), ) - # Rotate again the eko to save disk space - eko.io.manipulate.xgrid_reshape( - operators, targetgrid=opcard.xgrid - ) + # Save only the original operator to save disk space + operators = orignal_operators rich.print(f"Optimizing for {assumptions}") fktable.optimize(assumptions) fktable.set_key_value("eko_version", operators.metadata.version) From d5719420efb97d7d6ec324d567fb6a367f207a3c Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Tue, 19 Sep 2023 12:13:21 +0200 Subject: [PATCH 09/12] another try --- src/pineko/evolve.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 2658d838..ccd85778 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -202,16 +202,16 @@ def evolve_grid( # rotate the targetgrid if "integrability_version" in grid.key_values(): x_grid = np.append(x_grid, 1.0) - orignal_operators = copy.deepcopy(operators) + new_operators = copy.deepcopy(operators) eko.io.manipulate.xgrid_reshape( - operators, targetgrid=eko.interpolation.XGrid(x_grid) + new_operators, targetgrid=eko.interpolation.XGrid(x_grid) ) - check.check_grid_and_eko_compatible(grid, operators, xif, max_as, max_al) + check.check_grid_and_eko_compatible(grid, new_operators, xif, max_as, max_al) # rotate to evolution (if doable and necessary) - if np.allclose(operators.bases.inputpids, br.flavor_basis_pids): - eko.io.manipulate.to_evol(operators) + if np.allclose(new_operators.bases.inputpids, br.flavor_basis_pids): + eko.io.manipulate.to_evol(new_operators) # Here we are checking if the EKO contains the rotation matrix (flavor to evol) - elif not np.allclose(operators.bases.inputpids, br.rotate_flavor_to_evolution): + elif not np.allclose(new_operators.bases.inputpids, br.rotate_flavor_to_evolution): raise ValueError("The EKO is neither in flavor nor in evolution basis.") # PineAPPL wants alpha_s = 4*pi*a_s # remember that we already accounted for xif in the opcard generation @@ -240,7 +240,7 @@ def evolve_grid( ] # We need to use ekompatibility in order to pass a dictionary to pineappl fktable = grid.evolve( - ekompatibility.pineappl_layout(operators), + ekompatibility.pineappl_layout(new_operators), xir * xir * mur2_grid, alphas_values, "evol", @@ -248,7 +248,7 @@ def evolve_grid( xi=(xir, xif), ) # Save only the original operator to save disk space - operators = orignal_operators + del new_operators rich.print(f"Optimizing for {assumptions}") fktable.optimize(assumptions) fktable.set_key_value("eko_version", operators.metadata.version) From 9f67dc97ef4c5c86ec78afaf624ccf9248c935d2 Mon Sep 17 00:00:00 2001 From: Andrea Barontini Date: Tue, 19 Sep 2023 16:17:57 +0200 Subject: [PATCH 10/12] Deepcopy the operators --- src/pineko/evolve.py | 15 ++++++--------- src/pineko/theory.py | 8 +++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index ccd85778..86adac06 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -202,16 +202,15 @@ def evolve_grid( # rotate the targetgrid if "integrability_version" in grid.key_values(): x_grid = np.append(x_grid, 1.0) - new_operators = copy.deepcopy(operators) eko.io.manipulate.xgrid_reshape( - new_operators, targetgrid=eko.interpolation.XGrid(x_grid) + operators, targetgrid=eko.interpolation.XGrid(x_grid) ) - check.check_grid_and_eko_compatible(grid, new_operators, xif, max_as, max_al) + check.check_grid_and_eko_compatible(grid, operators, xif, max_as, max_al) # rotate to evolution (if doable and necessary) - if np.allclose(new_operators.bases.inputpids, br.flavor_basis_pids): - eko.io.manipulate.to_evol(new_operators) + if np.allclose(operators.bases.inputpids, br.flavor_basis_pids): + eko.io.manipulate.to_evol(operators) # Here we are checking if the EKO contains the rotation matrix (flavor to evol) - elif not np.allclose(new_operators.bases.inputpids, br.rotate_flavor_to_evolution): + elif not np.allclose(operators.bases.inputpids, br.rotate_flavor_to_evolution): raise ValueError("The EKO is neither in flavor nor in evolution basis.") # PineAPPL wants alpha_s = 4*pi*a_s # remember that we already accounted for xif in the opcard generation @@ -240,15 +239,13 @@ def evolve_grid( ] # We need to use ekompatibility in order to pass a dictionary to pineappl fktable = grid.evolve( - ekompatibility.pineappl_layout(new_operators), + ekompatibility.pineappl_layout(operators), xir * xir * mur2_grid, alphas_values, "evol", order_mask=order_mask, xi=(xir, xif), ) - # Save only the original operator to save disk space - del new_operators rich.print(f"Optimizing for {assumptions}") fktable.optimize(assumptions) fktable.set_key_value("eko_version", operators.metadata.version) diff --git a/src/pineko/theory.py b/src/pineko/theory.py index acfb9f5b..a9ffdc5c 100644 --- a/src/pineko/theory.py +++ b/src/pineko/theory.py @@ -395,8 +395,11 @@ def fk(self, name, grid_path, tcard, pdf): if sv_method is None: if not np.isclose(xif, 1.0): check_scvar_evolve(grid, max_as, max_al, check.Scale.FACT) - # loading ekos + # loading ekos to produce a tmp copy with eko.EKO.edit(eko_filename) as operators: + eko_tmp_path = operators.paths.root.parent / "eko-tmp" + operators.deepcopy(eko_tmp_path) + with eko.EKO.edit(eko_tmp_path) as operators: # Obtain the assumptions hash assumptions = theory_card.construct_assumptions(tcard) # do it! @@ -430,6 +433,9 @@ def fk(self, name, grid_path, tcard, pdf): assumptions=assumptions, comparison_pdf=pdf, ) + # Remove tmp ekos + eko_tmp_path.unlink() + logger.info( "Finished computation of %s - took %f s", name, From d7ef1b8187b0031193c272f664b693bd59d6bf9f Mon Sep 17 00:00:00 2001 From: Andrea Barontini Date: Wed, 20 Sep 2023 12:05:56 +0200 Subject: [PATCH 11/12] Update src/pineko/theory.py Co-authored-by: Felix Hekhorn --- src/pineko/theory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pineko/theory.py b/src/pineko/theory.py index a9ffdc5c..c274ce5e 100644 --- a/src/pineko/theory.py +++ b/src/pineko/theory.py @@ -397,7 +397,7 @@ def fk(self, name, grid_path, tcard, pdf): check_scvar_evolve(grid, max_as, max_al, check.Scale.FACT) # loading ekos to produce a tmp copy with eko.EKO.edit(eko_filename) as operators: - eko_tmp_path = operators.paths.root.parent / "eko-tmp" + eko_tmp_path = operators.paths.root.parent / "eko-tmp.tar" operators.deepcopy(eko_tmp_path) with eko.EKO.edit(eko_tmp_path) as operators: # Obtain the assumptions hash From 8b2a63455585c8873980b958da7c1f3853d46cf2 Mon Sep 17 00:00:00 2001 From: andreab1997 Date: Wed, 20 Sep 2023 12:08:29 +0200 Subject: [PATCH 12/12] Use EKO.read instead of EKO.edit --- src/pineko/theory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pineko/theory.py b/src/pineko/theory.py index c274ce5e..899d8f66 100644 --- a/src/pineko/theory.py +++ b/src/pineko/theory.py @@ -396,7 +396,7 @@ def fk(self, name, grid_path, tcard, pdf): if not np.isclose(xif, 1.0): check_scvar_evolve(grid, max_as, max_al, check.Scale.FACT) # loading ekos to produce a tmp copy - with eko.EKO.edit(eko_filename) as operators: + with eko.EKO.read(eko_filename) as operators: eko_tmp_path = operators.paths.root.parent / "eko-tmp.tar" operators.deepcopy(eko_tmp_path) with eko.EKO.edit(eko_tmp_path) as operators: