Skip to content

Commit

Permalink
Clean filter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
achiefa authored Dec 16, 2024
1 parent fdbc50e commit a7a997d
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions nnpdf_data/nnpdf_data/commondata/CMS_Z0J_8TEV/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,7 @@

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)
CMS_Z0J_8TEV.generate_data(variant='default', save_to_yaml=True)
CMS_Z0J_8TEV.generate_data(variant='sys_10', save_to_yaml=True)

0 comments on commit a7a997d

Please sign in to comment.