Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implementation of CMS_Z0J_8TEV in the new format #2241

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion conda-recipe/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e

# Python tests for the installed validphys package
# Note that the default tolerance in the conda test is higher than the pip test
pytest --pyargs --mpl validphys --mpl-default-tolerance 22
pytest --pyargs --mpl validphys --mpl-default-tolerance 24

platformstr=`uname`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ data_central:
- 460.5
- 222.6
- 109.8
- 61.84
- 6.18400000e+01
- 30.19
- 13.55
- 1.35500000e+01
- 0.6181
- 9862.0
- 2863.0
Expand All @@ -18,16 +18,16 @@ data_central:
- 58.13
- 29.85
- 13.76
- 0.6122000000000001
- 6.12200000e-01
- 9205.0
- 2588.0
- 935.5
- 416.3
- 199.0
- 103.1
- 54.06
- 5.40600000e+01
- 28.45
- 13.64
- 1.36400000e+01
- 0.5521
- 6893.0
- 1933.0
Expand All @@ -37,10 +37,10 @@ data_central:
- 84.62
- 47.57
- 24.13
- 11.3
- 1.13000000e+01
- 0.4657
- 3709.0
- 1021.0
- 1.02100000e+03
- 381.6
- 176.6
- 90.49
Expand Down
40 changes: 40 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/CMS_Z0J_8TEV/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'''
Filter script for CMS_Z0J_8TEV
'''

import logging

from filter_utils import Extractor
import numpy as np
import yaml

logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s')


def check_dat_with_legacy(observable, rtol=1e-03):
"""
Same as `check_unc_with_legacy`, but for central data points.
"""
logging.info(
f"Comparing the new central data implementation with the legacy version for {observable} using rtol = {rtol}."
)

with open('./data_' + observable + '.yaml', 'r') as file:
new_data = yaml.safe_load(file)

with open('./data_legacy_' + observable + '.yaml', 'r') as file:
legacy_data = yaml.safe_load(file)

for i, (new_val, legacy_val) in enumerate(
zip(new_data['data_central'], legacy_data['data_central'])
):
try:
assert np.allclose(new_val, legacy_val, rtol=rtol)
except AssertionError as e:
logging.warning(f"Inconsistency, {new_val} != {legacy_val} in bin: {i+1}")


if __name__ == "__main__":
CMS_Z0J_8TEV = Extractor("./metadata.yaml", "PT-Y", mult_factor=1000)
_, _, _ = CMS_Z0J_8TEV.generate_data(variant='default', save_to_yaml=True)
_, _, _ = CMS_Z0J_8TEV.generate_data(variant='sys_10', save_to_yaml=True)
Loading
Loading