Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pineko/cli/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions src/pineko/evolve.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tools related to evolution/eko."""

import copy
import hashlib
import json
import logging
import os
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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())}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
grid_files = {grid_path_obj.stem: {"hash": grid_hash, "path": str(grid_path_obj.resolve())}}
grid_files = {grid_path_obj.stem: {"hash": grid_hash, "theory_folder": grid_path_obj.parent.name}}

Out of privacy concerns, I would just store the path starting from the theory_slim folder.

My suggestion is, since you have the grid name as the key, save just the theory folder name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed on the privacy, but I think I would keep the resolve(), because I think this way we can resolve symbolic links, right? i.e. .resolve().parent (or similar)

fktable.set_metadata("grid_files", json.dumps(grid_files))

# compare before/after
comparison = None
if comparison_pdfs is not None:
Expand Down
1 change: 1 addition & 0 deletions src/pineko/theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading