Skip to content

Commit d7eb505

Browse files
committed
write hash
1 parent e54d83b commit d7eb505

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

n3fit/src/n3fit/checks.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -568,17 +568,24 @@ def check_eko_exists(theoryid):
568568

569569

570570
@make_argcheck
571-
def fktable_hasher(data):
571+
def fktable_hasher(data, output_path):
572572
"""Writes a hash of the fk-table to a log file.
573-
This hash can be used to ensure whether two
574-
(supposedely identical) fk-tables of the same
573+
This hash can be used to ensure whether two
574+
(supposedly identical) fk-tables of the same
575575
theory and dataset are numerically identical.
576576
"""
577-
keys = {}
578-
for dataset in data.datasets:
579-
fkspecs = dataset.fkspecs
580-
for fk in fkspecs:
581-
fkpath = fk.fkpath[0]
582-
fkhash = hashlib.md5(fkpath.read_bytes()).hexdigest()
583-
# have to figure out how to write a file to the fitname dir where the other md5 also lives
584-
log.info("FK-table hash written to md5fk")
577+
md5fk_path = output_path / "md5fk"
578+
with open(md5fk_path, "w") as f:
579+
for dataset in data.datasets:
580+
fkspecs = dataset.fkspecs
581+
for fk in fkspecs:
582+
for fkpaths, table_names in zip(
583+
fk.fkpath,
584+
fk.metadata.FK_tables,
585+
):
586+
for fkpath, table_name in zip(fkpaths, table_names):
587+
fkhash = hashlib.md5(
588+
fkpath.read_bytes()
589+
).hexdigest()
590+
f.write(f"{table_name} {fkhash}\n")
591+
log.info(f"FK-table hash written to {md5fk_path}")

nnprofile_example.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# ~/.config/NNPDF/nnprofile.yaml
66
# To change the configuration of the NNPDF code framework
77

8-
nnpdf_share: ~/.local/share/NNPDF/theories
8+
nnpdf_share: ~/.local/share/NNPDF
99

1010
results_path: results
1111
ekos_path: ekos

0 commit comments

Comments
 (0)