Skip to content

Commit

Permalink
Merge pull request #1569 from NNPDF/convolutiondoc
Browse files Browse the repository at this point in the history
Simplify docs of convolution module
  • Loading branch information
Zaharid committed May 12, 2022
2 parents c78a1ac + aa77350 commit 47827f2
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions validphys2/src/validphys/convolution.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
""" This module implements tools for computing convolutions. It reimplements
the relevant C++ functionality in pure Python (using numpy and pandas).
""" This module implements tools for computing convolutions between PDFs and
theory grids, which yield observables.
The high level :py:func:`predictions` function can be used to extact theory
predictions for experimentally measured quantities, in a way that is directly
comparable with the C++ code::
predictions for experimentally measured quantities::
import numpy as np
from validphys.api import API
Expand All @@ -14,23 +13,18 @@
'fit': '181023-001-sc',
'use_cuts': 'internal',
'theoryid': 162,
'pdf': 'NNPDF31_nlo_as_0118',
'experiments': {'from_': 'fit'}
'pdf': 'NNPDF40_nnlo_lowprecision',
'dataset_inputs': {'from_': 'fit'}
}
tb = API.experiment_result_table(**inp)
all_datasets = [ds for e in API.experiments(**inp) for ds in e.datasets]
all_datasets = API.data(**inp).datasets
pdf = API.pdf(**inp)
all_preds = [predictions(ds, pdf) for ds in all_datasets]
for ds, pred in zip(all_datasets, all_preds):
cpp = tb.loc[(slice(None),ds.name), :]
assert np.allclose(pred.values, cpp.values[:, 2:], atol=1e-7, rtol=1e-4)
Expand All @@ -41,8 +35,6 @@
allowing to account for information on COMPOUND predictions and cuts. A lower
level interface which operates with :py:class:`validphys.coredata.FKTableData`
objects is also available.
Note that currently no effort has been made to optimize these operations.
"""
import operator
import functools
Expand Down

0 comments on commit 47827f2

Please sign in to comment.