Skip to content

added process type to PLOTTING file

Emanuele Roberto Nocera requested to merge meta_proc into master

Created by: wilsonmr

Here we have added the process key to PLOTTING file along side the label as per the theory covariance paper

Vaguely related to #356 (closed) - giving the data some more metadata

will be used by the successor to #481

For completeness the script used:

import pathlib

from reportengine.compat import yaml

from validphys.loader import Loader
from validphys.theorycovariance.construction import process_lookup
l = Loader()

dss = l.available_datasets - {'PDFEVOLTEST'}

out_dir = pathlib.Path(
    "<path to nnpdf>/nnpdfcpp/data/commondata")

for ds in dss:
    cd = l.check_commondata(ds)
    # Open the PLOTTING file and check it contains `experiment` key
    with open(cd.plotfiles[-1], "r") as f:
        plot_dict = yaml.load(f, Loader=yaml.RoundTripLoader)
    if not plot_dict.get('experiment', False):
        print(plot_dict)
        raise KeyError

    # Try to lookup process type, if exists then append to PLOTTING file
    try:
        proc = process_lookup(ds)
        with open(out_dir/cd.plotfiles[-1].name, "a") as f:
            f.write(f"\nprocess: {proc}\n")
    except KeyError:
        print(f"not implemented {ds}")

Merge request reports

Loading