diff --git a/src/pineko/cli/convolve.py b/src/pineko/cli/convolve.py index 83133f39..83f17e7f 100644 --- a/src/pineko/cli/convolve.py +++ b/src/pineko/cli/convolve.py @@ -108,6 +108,7 @@ def subcommand( assumptions=assumptions, comparison_pdfs=pdfs, min_as=min_as, + grid_path=pathlib.Path(grid_path), ) if len(operators) > 1: diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 9ae02ba2..227c8273 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -1,6 +1,7 @@ """Tools related to evolution/eko.""" import copy +import hashlib import json import logging import os @@ -303,6 +304,7 @@ def evolve_grid( assumptions="Nf6Ind", comparison_pdfs: Optional[list[str]] = None, min_as=None, + grid_path: Optional[os.PathLike] = None, ): """Convolute grid with EKO from file paths. @@ -332,6 +334,8 @@ def evolve_grid( if given, a comparison table (with / without evolution) will be printed min_as: None or int minimum power of strong coupling + grid_path : str or os.PathLike or None + path to the grid file, used to store grid hash metadata """ order_mask = pineappl.boc.Order.create_mask(grid.orders(), max_as, max_al, True) if min_as is not None and min_as > 1: @@ -433,6 +437,13 @@ def prepare(operator, convolution_types): fktable.set_metadata("pineko_version", version.__version__) fktable.set_metadata("theory_card", json.dumps(theory_meta)) + # Store grid hash and path information + if grid_path is not None: + grid_path_obj = pathlib.Path(grid_path) + grid_hash = hashlib.md5(grid_path_obj.read_bytes()).hexdigest() + grid_files = {grid_path_obj.stem: {"hash": grid_hash, "path": str(grid_path_obj.resolve())}} + fktable.set_metadata("grid_files", json.dumps(grid_files)) + # compare before/after comparison = None if comparison_pdfs is not None: diff --git a/src/pineko/theory.py b/src/pineko/theory.py index 4a8e3e36..00a6c115 100644 --- a/src/pineko/theory.py +++ b/src/pineko/theory.py @@ -565,6 +565,7 @@ def fk(self, name, grid_path, tcard, pdfs): theory_meta=tcard, assumptions=assumptions, comparison_pdfs=pdfs, + grid_path=grid_path, ) if n_ekos > 1: