From d2b254120986d2cdab454ed865d2d7162b8c5507 Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Mon, 16 Oct 2023 15:23:06 +0200 Subject: [PATCH 1/5] switch on polarization in opcards --- src/pineko/evolve.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 86adac06..ceb49877 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -1,5 +1,6 @@ """Tools related to evolution/eko.""" import copy +import json import logging import os import pathlib @@ -95,6 +96,8 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard): tcard: dict theory card for the run, since some information in EKO is now required in operator card, but before was in the theory card + is_polarized: bool + if True compute th Returns ------- @@ -142,6 +145,13 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard): operators_card["eko_version"] = metadata.version("eko") pineko_version = metadata.version("pineko") + # switch on polarization, only in DIS + if "runcard" in pineappl_grid.key_values(): + grid_runcard = pineappl_grid.key_values()["runcard"] + # here a grid contains a single obrevable + observable = list(json.loads(grid_runcard)["observables"])[0] + operators_card["configs"]["polarized"] = "g" in observable.split("_")[0] + # Some safety checks if ( operators_card["configs"]["evolution_method"] == "truncated" From afdfa9e18e9a9e8ef4efffedbd65ea684b802ed9 Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Mon, 16 Oct 2023 15:27:16 +0200 Subject: [PATCH 2/5] minor fix --- src/pineko/evolve.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index ceb49877..bb7b5860 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -96,8 +96,6 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard): tcard: dict theory card for the run, since some information in EKO is now required in operator card, but before was in the theory card - is_polarized: bool - if True compute th Returns ------- From 58a19f96e30920e5bf8196ec4188e2bbe46bd1a2 Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Mon, 16 Oct 2023 15:43:43 +0200 Subject: [PATCH 3/5] select only yadism grids to trigger polarization --- src/pineko/evolve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index bb7b5860..60d600ea 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -144,7 +144,7 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard): pineko_version = metadata.version("pineko") # switch on polarization, only in DIS - if "runcard" in pineappl_grid.key_values(): + if "yadism_version" in pineappl_grid.key_values(): grid_runcard = pineappl_grid.key_values()["runcard"] # here a grid contains a single obrevable observable = list(json.loads(grid_runcard)["observables"])[0] From 2a0d9a8fec6c2fe51e6ec9416c4d183ee37f95dc Mon Sep 17 00:00:00 2001 From: Giacomo Magni <39065935+giacomomagni@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:46:28 +0200 Subject: [PATCH 4/5] Update src/pineko/evolve.py Co-authored-by: Tanjona Rabemananjara --- src/pineko/evolve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 60d600ea..4b2b44c0 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -148,7 +148,7 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard): grid_runcard = pineappl_grid.key_values()["runcard"] # here a grid contains a single obrevable observable = list(json.loads(grid_runcard)["observables"])[0] - operators_card["configs"]["polarized"] = "g" in observable.split("_")[0] + operators_card["configs"]["polarized"] = observable.startswith("g") # Some safety checks if ( From ca5eca6b91ce1b3efa09ae49bbea8b3afd43aa56 Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Tue, 17 Oct 2023 10:04:56 +0200 Subject: [PATCH 5/5] improve polarization switch --- src/pineko/evolve.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 4b2b44c0..7086cc5e 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -1,6 +1,5 @@ """Tools related to evolution/eko.""" import copy -import json import logging import os import pathlib @@ -143,12 +142,10 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard): operators_card["eko_version"] = metadata.version("eko") pineko_version = metadata.version("pineko") - # switch on polarization, only in DIS - if "yadism_version" in pineappl_grid.key_values(): - grid_runcard = pineappl_grid.key_values()["runcard"] - # here a grid contains a single obrevable - observable = list(json.loads(grid_runcard)["observables"])[0] - operators_card["configs"]["polarized"] = observable.startswith("g") + # switch on polarization ? + kv = pineappl_grid.key_values() + if "polarized" in kv: + operators_card["configs"]["polarized"] = kv["polarized"] == "True" # Some safety checks if (