From 67b550d7e0b62d20b0f411997fefb6ed75a3ca66 Mon Sep 17 00:00:00 2001 From: andreab1997 Date: Fri, 16 Sep 2022 11:04:51 +0200 Subject: [PATCH 1/4] First implementation --- n3fit/src/evolven3fit/evolve.py | 11 ++++++++++- validphys2/src/validphys/core.py | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/n3fit/src/evolven3fit/evolve.py b/n3fit/src/evolven3fit/evolve.py index 05111ae7dc..6fb5dfaf4b 100644 --- a/n3fit/src/evolven3fit/evolve.py +++ b/n3fit/src/evolven3fit/evolve.py @@ -9,6 +9,7 @@ from ekomark import apply from eko import basis_rotation as br from eko import output +from validphys.loader import Loader from . import utils, eko_utils @@ -88,7 +89,15 @@ def evolve_fit( log.info(f"Loading eko from : {eko_path}") eko_op = output.Output.load_tar(eko_path) else: - eko_op = eko_utils.construct_eko_for_fit(theory, op, log, dump_eko) + import ipdb; ipdb.set_trace() + try: + log.info(f"Loading eko from theory {theoryID}") + theory_eko_path = Loader().check_theoryID(theoryID).get_eko() + eko_op = output.Output.load_tar(theory_eko_path) + except TypeError: + log.info(f"eko not found in theory {theoryID}: maybe it is not a pineappl theory?") + eko_op = eko_utils.construct_eko_for_fit(theory, op, log, dump_eko) + pass eko_op.xgrid_reshape(targetgrid=x_grid, inputgrid=x_grid) info = gen_info.create_info_file(theory, op, 1, info_update={}) info["NumMembers"] = "REPLACE_NREP" diff --git a/validphys2/src/validphys/core.py b/validphys2/src/validphys/core.py index 694135e3ae..55ac81d4cd 100644 --- a/validphys2/src/validphys/core.py +++ b/validphys2/src/validphys/core.py @@ -801,6 +801,11 @@ def get_description(self): dbpath = self.path.parent/'theory.db' return fetch_theory(dbpath, self.id) + def get_eko(self): + if self.is_pineappl(): + return self.path/'eko.tar' + raise TypeError(f"the requested eko does not exists because the theory {self.id} is not a pineappl theory") + __slots__ = ('id', 'path') def __repr__(self): From 4a4fc408d38cb866d0d43f1665f764868f4b57bf Mon Sep 17 00:00:00 2001 From: andreab1997 Date: Fri, 16 Sep 2022 11:12:57 +0200 Subject: [PATCH 2/4] Remove pdb --- n3fit/src/evolven3fit/evolve.py | 1 - 1 file changed, 1 deletion(-) diff --git a/n3fit/src/evolven3fit/evolve.py b/n3fit/src/evolven3fit/evolve.py index 6fb5dfaf4b..0b607f9fc1 100644 --- a/n3fit/src/evolven3fit/evolve.py +++ b/n3fit/src/evolven3fit/evolve.py @@ -89,7 +89,6 @@ def evolve_fit( log.info(f"Loading eko from : {eko_path}") eko_op = output.Output.load_tar(eko_path) else: - import ipdb; ipdb.set_trace() try: log.info(f"Loading eko from theory {theoryID}") theory_eko_path = Loader().check_theoryID(theoryID).get_eko() From bff4be763c940f5c8debf7bb6c6bf10ed78e9a55 Mon Sep 17 00:00:00 2001 From: Andrea Barontini Date: Fri, 16 Sep 2022 11:13:41 +0200 Subject: [PATCH 3/4] Update n3fit/src/evolven3fit/evolve.py Co-authored-by: Juan M. Cruz-Martinez --- n3fit/src/evolven3fit/evolve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/n3fit/src/evolven3fit/evolve.py b/n3fit/src/evolven3fit/evolve.py index 0b607f9fc1..e897151423 100644 --- a/n3fit/src/evolven3fit/evolve.py +++ b/n3fit/src/evolven3fit/evolve.py @@ -94,7 +94,7 @@ def evolve_fit( theory_eko_path = Loader().check_theoryID(theoryID).get_eko() eko_op = output.Output.load_tar(theory_eko_path) except TypeError: - log.info(f"eko not found in theory {theoryID}: maybe it is not a pineappl theory?") + log.info(f"eko not found in theory {theoryID}, we will construct it") eko_op = eko_utils.construct_eko_for_fit(theory, op, log, dump_eko) pass eko_op.xgrid_reshape(targetgrid=x_grid, inputgrid=x_grid) From fd0e203c1e2c90ab1be5e30e4d0862dcc461a2fc Mon Sep 17 00:00:00 2001 From: andreab1997 Date: Fri, 16 Sep 2022 11:23:28 +0200 Subject: [PATCH 4/4] Remove function get_eko in core --- n3fit/src/evolven3fit/evolve.py | 4 ++-- validphys2/src/validphys/core.py | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/n3fit/src/evolven3fit/evolve.py b/n3fit/src/evolven3fit/evolve.py index e897151423..518235df53 100644 --- a/n3fit/src/evolven3fit/evolve.py +++ b/n3fit/src/evolven3fit/evolve.py @@ -91,9 +91,9 @@ def evolve_fit( else: try: log.info(f"Loading eko from theory {theoryID}") - theory_eko_path = Loader().check_theoryID(theoryID).get_eko() + theory_eko_path = (Loader().check_theoryID(theoryID).path)/'eko.tar' eko_op = output.Output.load_tar(theory_eko_path) - except TypeError: + except: log.info(f"eko not found in theory {theoryID}, we will construct it") eko_op = eko_utils.construct_eko_for_fit(theory, op, log, dump_eko) pass diff --git a/validphys2/src/validphys/core.py b/validphys2/src/validphys/core.py index 55ac81d4cd..694135e3ae 100644 --- a/validphys2/src/validphys/core.py +++ b/validphys2/src/validphys/core.py @@ -801,11 +801,6 @@ def get_description(self): dbpath = self.path.parent/'theory.db' return fetch_theory(dbpath, self.id) - def get_eko(self): - if self.is_pineappl(): - return self.path/'eko.tar' - raise TypeError(f"the requested eko does not exists because the theory {self.id} is not a pineappl theory") - __slots__ = ('id', 'path') def __repr__(self):