From eb735991760bf5ab32221ae8aa4174180f110eba Mon Sep 17 00:00:00 2001 From: andreab1997 Date: Wed, 11 Oct 2023 14:45:29 +0200 Subject: [PATCH] Add explicit check for empty ekos --- src/pineko/theory.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pineko/theory.py b/src/pineko/theory.py index 0bfd6161..6b7545cd 100644 --- a/src/pineko/theory.py +++ b/src/pineko/theory.py @@ -20,6 +20,10 @@ logger = logging.getLogger(__name__) +class EmptyEkoError(Exception): + """Raised if the loaded eko is empty.""" + + def check_scvar_evolve(grid, max_as, max_al, kind: check.Scale): """Check scale variations and central orders consistency.""" available, max_as_effective = check.contains_sv(grid, max_as, max_al, kind) @@ -404,6 +408,9 @@ 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.read(eko_filename) as operators: + # Skip the computation of the fktable if the eko is empty + if len(operators.mu2grid) == 0: + raise EmptyEkoError eko_tmp_path = operators.paths.root.parent / "eko-tmp.tar" operators.deepcopy(eko_tmp_path) with eko.EKO.edit(eko_tmp_path) as operators: