Skip to content

Commit

Permalink
covolute -> convolve
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Jul 24, 2024
1 parent ab29ae3 commit 54eb45f
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion docs/source/implementation/kernels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Kernels
=======

The coefficient functions consist of the partonic cross-sections, that have to
be convoluted with the PDFs in order to obtain the hadronic structure functions,
be convolved with the PDFs in order to obtain the hadronic structure functions,
according to the factorization theorem:

.. math::
Expand Down
6 changes: 3 additions & 3 deletions docs/source/implementation/scale-variations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ scale variation formula <theory/scale-variations:Factorization>`.

What is done in ``yadism`` is to implement everything to depend only on the
*original* coefficients :math:`\textbf{c}_a^{(i)}`, and not to depend recursively
on the convoluted ones :math:`\textbf{c}_a^{(i,j)}`, in order to limit the number
on the convolved ones :math:`\textbf{c}_a^{(i,j)}`, in order to limit the number
of extra numerical convolutions to a single one.

In this case we are avoiding the disadvantages of the previous section, only
partially paying for giving up on of the advantages: these convolutions would
involve only splitting functions, and never the coefficient functions'
expressions, and for this same reason they are also considerably easier.

Applying convoluted kernels
Applying convolved kernels
---------------------------

Since the convolutions are done numerically it is needed to integrate ahead of
Expand Down Expand Up @@ -148,7 +148,7 @@ in the theory section.

Without the scale variations the interpolation is done completely on the |PDF|,
as described in :doc:`interpolation`, and the interpolation polynomials would
then be used to convolute numerically the coefficient functions:
then be used to convolve numerically the coefficient functions:

.. math::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/implementation/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Essentially the flow of an execution is the following:
:class:`~yadism.coefficient_functions.Combiner` for the relevant
:class:`~yadism.coefficient_functions.kernels.Kernel`
7. all the :class:`~yadism.coefficient_functions.kernels.Kernel` are numerically
convoluted with the |PDF| interpolation polynomials
convolved with the |PDF| interpolation polynomials
8. all the results are collected in an :class:`~yadism.output.Output` object and
returned to the user
9. (**user** initiated) the :class:`~yadism.output.Output` object might be
Expand Down
4 changes: 2 additions & 2 deletions docs/source/overview/tutorials/compare_data.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/source/overview/tutorials/getting_started.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/source/theory/coeff-funcs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ for variable flavor scheme like FONLL.
Distributions
-------------

To obtain a physical observable one has to convolute the coefficient functions with the |PDF|
To obtain a physical observable one has to convolve the coefficient functions with the |PDF|

.. math ::
\sigma = \sum_j f_j \otimes c_j = \sum_j \int\limits_x^1 \frac {dz}{z} f_j(x/z) c_j(z)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/theory/scale-variations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Where :math:`a` (:math:`= 1,2,3,L`) is the kind of structure functions considere
Than the explicit coefficient functions can be computed from |DGLAP| and
:math:`\alpha_s` running (see :cite:`nnlo-sv-singlet,nnlo-sv-nonsinglet`),
resulting in process and kind independent elements (the actual anomalous
dimension of the two runnings) convoluted with lower order coefficient
dimension of the two runnings) convolved with lower order coefficient
functions:

.. math::
Expand Down
2 changes: 1 addition & 1 deletion extras/notes/apfel/APFEL_functions/DIS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@

## Unknown

CacheStructureFunctionsAPFEL.f, ComputeChargesDIS.f, ComputeDISOperators.f, ComputeStructureFunctionsAPFEL.f, ConvoluteEvolutionWithDISOperators.f, ConvolutePDFsWithDISOperators.f, EnableDampingFONLL.f, EnableDynamicalScaleVariations.f, EnableIntrinsicCharm.f, EnableSFNLOQEDCorrections.f, EnableTargetMassCorrections.f, ExcludeScaleVariation.f, ExternalDISOperator.f, F2bottom.f, F2charm.f, F2light.f, F2top.f, F2total.f, F3bottom.f, F3charm.f, F3light.f, F3top.f, F3total.f, FKObservables.f, FKSimulator.f, FLbottom.f, FLcharm.f, FLlight.f, FLtop.f, FLtotal.f, GetCKM.f, GetFKObservable.f, GetGFermi.f, GetProtonMass.f, GetSIATotalCrossSection.f, GetSin2ThetaW.f, GetWMass.f, GetZMass.f, hqcoef.f, IncludeIntrinsicCharm.f, IncludeNLOQEDCorrections.f, IncludeScaleVariation.f, initIntegralsDIS.f, initIntegralsDISRes.f, initIntegralsSIA.f, integrandsDIS.f, integrandsIC.f, integrandsSIA.f, JoinDISOperators.f, LHAPDFgridStructureFunctions.f, MassiveCoefficientFunctions.f, MassiveZeroCoefficientFunctions.f, RSLintegralsDIS.f, RSLintegralsSIA.f, SelectCharge.f, SetFKObservable.f, StructureFunctionxQ.f, ZeroMassCoefficientFunctions.f
CacheStructureFunctionsAPFEL.f, ComputeChargesDIS.f, ComputeDISOperators.f, ComputeStructureFunctionsAPFEL.f, ConvolveEvolutionWithDISOperators.f, ConvolvePDFsWithDISOperators.f, EnableDampingFONLL.f, EnableDynamicalScaleVariations.f, EnableIntrinsicCharm.f, EnableSFNLOQEDCorrections.f, EnableTargetMassCorrections.f, ExcludeScaleVariation.f, ExternalDISOperator.f, F2bottom.f, F2charm.f, F2light.f, F2top.f, F2total.f, F3bottom.f, F3charm.f, F3light.f, F3top.f, F3total.f, FKObservables.f, FKSimulator.f, FLbottom.f, FLcharm.f, FLlight.f, FLtop.f, FLtotal.f, GetCKM.f, GetFKObservable.f, GetGFermi.f, GetProtonMass.f, GetSIATotalCrossSection.f, GetSin2ThetaW.f, GetWMass.f, GetZMass.f, hqcoef.f, IncludeIntrinsicCharm.f, IncludeNLOQEDCorrections.f, IncludeScaleVariation.f, initIntegralsDIS.f, initIntegralsDISRes.f, initIntegralsSIA.f, integrandsDIS.f, integrandsIC.f, integrandsSIA.f, JoinDISOperators.f, LHAPDFgridStructureFunctions.f, MassiveCoefficientFunctions.f, MassiveZeroCoefficientFunctions.f, RSLintegralsDIS.f, RSLintegralsSIA.f, SelectCharge.f, SetFKObservable.f, StructureFunctionxQ.f, ZeroMassCoefficientFunctions.f
2 changes: 1 addition & 1 deletion extras/notes/apfel/TMC.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ As in the docs pdf (`dis.pdf`) aux variables are defined (`xi`, `rho` that is
called `rhop` in the code) directly in `F2light.f`

## Integration
Source: `ConvolutePDFwithDISOperators.f` for `I2`
Source: `ConvolvePDFwithDISOperators.f` for `I2`
Source: `ComputeDISOperators.f` for `OpI2`

The integration is already provided, since it is precomputed on a grid. The
Expand Down
12 changes: 6 additions & 6 deletions src/yadism/esf/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def quad_ker_sing(z, x, is_log, areas, sing, pdf_at_x, sing_args):

def convolution(rsl, x, pdf_func):
r"""
Convolute a :py:class:`yadism.coefficient_functions.partonic_channel.RSL`
Convolve a :py:class:`yadism.coefficient_functions.partonic_channel.RSL`
instance with a function ``pdf_func``.
The definition of the convolution performed is:
Expand All @@ -77,7 +77,7 @@ def convolution(rsl, x, pdf_func):
x : scalar
the kinematics point at which the convoution is evaluated
pdf_func : callable
the function to be convoluted with ``rsl`` (usually a PDF, or a PDF
the function to be convolved with ``rsl`` (usually a PDF, or a PDF
interpolator)
Returns
Expand Down Expand Up @@ -168,9 +168,9 @@ def convolution(rsl, x, pdf_func):
return res, err


def convolute_operator(fnc, interpolator):
def convolve_operator(fnc, interpolator):
"""
Convolute function over all basis functions over all grid points.
Convolve function over all basis functions over all grid points.
Parameters
----------
Expand Down Expand Up @@ -203,9 +203,9 @@ def convolute_operator(fnc, interpolator):
return op_res, op_err


def convolute_vector(cf, interpolator, convolution_point):
def convolve_vector(cf, interpolator, convolution_point):
"""
Convolute function over all basis functions.
Convolve function over all basis functions.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions src/yadism/esf/esf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, kinematics: dict, obs_name, configs):
raise ValueError("Kinematics 'Q2' must be in the range (0,∞)")
# check domain
if x < min(configs.interpolator.xgrid.raw):
raise ValueError(f"x outside xgrid - cannot convolute starting from x={x}")
raise ValueError(f"x outside xgrid - cannot convolve starting from x={x}")

self.x = x
self.Q2 = kinematics["Q2"]
Expand Down Expand Up @@ -140,7 +140,7 @@ def compute_local(self):
continue
# compute convolution point
convolution_point = cfe.coeff.convolution_point()
val, err = conv.convolute_vector(
val, err = conv.convolve_vector(
rsl, self.info.configs.managers["interpolator"], convolution_point
)
# add the factor x from the LHS
Expand Down
4 changes: 2 additions & 2 deletions src/yadism/esf/scale_variations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from scipy.special import binom

from ..coefficient_functions import splitting_functions as split
from .conv import convolute_operator
from .conv import convolve_operator

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -80,7 +80,7 @@ def compute_raw(self, nf):
continue
start_time = time.perf_counter()
# TODO add error propagation
res, _err = convolute_operator(fnc(nf), self.interpolator)
res, _err = convolve_operator(fnc(nf), self.interpolator)
self.operators[(l, nf)] = res
logger.info(
"computing %s - took: %f s", l, time.perf_counter() - start_time
Expand Down
32 changes: 16 additions & 16 deletions src/yadism/esf/tmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ def get_result(self):

return out

def _convolute_FX(self, kind, ker):
def _convolve_FX(self, kind, ker):
r"""
Implement generic structure to convolute any function `ker` with `F2`.
Implement generic structure to convolve any function `ker` with `F2`.
This method is provided for internal use, in order to factorize the
machinery for TMC integrals.
Expand All @@ -202,7 +202,7 @@ def _convolute_FX(self, kind, ker):
\left[ a + \sum_{i} ((F_X \otimes k) \otimes w_i)
\right] f_i \\
& = \left[ a + \sum_{i,j} \underbrace{{F_X}_j ((w_j \otimes
k)}_{\texttt{_convolute_FX}} \otimes w_i) \right] f_i
k)}_{\texttt{_convolve_FX}} \otimes w_i) \right] f_i
\end{align*}
where :math:`\tilde{F}_X` is the target mass corrected structure
Expand All @@ -215,13 +215,13 @@ def _convolute_FX(self, kind, ker):
kind : str
observable kind
ker : callable
the kernel function to be convoluted with structure functions
the kernel function to be convolved with structure functions
"""
# check domain
if self.xi < min(self.sf.runner.configs.interpolator.xgrid.raw):
raise ValueError(
f"xi outside xgrid - cannot convolute starting from xi={self.xi}"
f"xi outside xgrid - cannot convolve starting from xi={self.xi}"
)
# iterate grid
res = ESFResult(self.xi, self.Q2, None)
Expand All @@ -245,7 +245,7 @@ def _convolute_FX(self, kind, ker):

def _h2(self):
r"""
Compute raw integral over `F2`, making use of :py:meth:`_convolute_FX`.
Compute raw integral over `F2`, making use of :py:meth:`_convolve_FX`.
.. math::
:nowrap:
Expand All @@ -264,13 +264,13 @@ def _h2(self):
"""
# convolution is given by dz/z f(xi/z) * g(z) z=xi..1
# so to achieve a total 1/z^2 we need to convolute with z/xi
# so to achieve a total 1/z^2 we need to convolve with z/xi
# as we get a 1/z by the measure and an evaluation of 1/xi*xi/z
return self._convolute_FX("F2", h2_ker)
return self._convolve_FX("F2", h2_ker)

def _g2(self):
r"""
Compute nested integral over `F2`, making use of :py:meth:`_convolute_FX`.
Compute nested integral over `F2`, making use of :py:meth:`_convolve_FX`.
.. math::
:nowrap:
Expand All @@ -290,9 +290,9 @@ def _g2(self):
"""
# convolution is given by dz/z f(xi/z) * g(z) z=xi..1
# so to achieve a total (z-xi)/z^2 we need to convolute with 1-z
# so to achieve a total (z-xi)/z^2 we need to convolve with 1-z
# as we get a 1/z by the measure and an evaluation of 1-xi/z
return self._convolute_FX("F2", g2_ker)
return self._convolve_FX("F2", g2_ker)

def _k1(self):
r"""
Expand All @@ -311,7 +311,7 @@ def _k1(self):
def _k2(self):
r"""
Compute the raw integral that enters the computation of `g`
making use of :py:meth:`_convolute_FX`.
making use of :py:meth:`_convolve_FX`.
.. math::
:nowrap:
Expand All @@ -330,7 +330,7 @@ def _k2(self):
ESF output for the integral
"""
return self._convolute_FX("g1", k2_ker)
return self._convolve_FX("g1", k2_ker)


class ESFTMC_F2(EvaluatedStructureFunctionTMC):
Expand Down Expand Up @@ -498,7 +498,7 @@ def _get_result_APFEL(self):

def _h3(self):
r"""
Compute raw integral over `F3`, making use of :py:meth:`_convolute_FX`.
Compute raw integral over `F3`, making use of :py:meth:`_convolve_FX`.
.. math::
:nowrap:
Expand All @@ -516,8 +516,8 @@ def _h3(self):
"""
# convolution is given by dz/z f(xi/z) * g(z) z=xi..1
# so to achieve a total 1/z we need to convolute with 1
return self._convolute_FX("F3", h3_ker)
# so to achieve a total 1/z we need to convolve with 1
return self._convolve_FX("F3", h3_ker)

def _get_result_exact(self):
# collect F3
Expand Down
4 changes: 2 additions & 2 deletions tests/yadism/cf/test_asy.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_intrinsic_nlo():
iobj = icls(esf, nf, m1sq=m2hq)
order = lambda pc, o=o: pc.__getattribute__(o)()
a = (
conv.convolute_vector(order(iobj), interp, z)[0]
conv.convolve_vector(order(iobj), interp, z)[0]
if order(iobj)
else 0.0
)
Expand All @@ -145,7 +145,7 @@ def test_intrinsic_nlo():
for iasycls in iasyclss:
iasyobj = iasycls(esf, nf, m2hq=m2hq)
if order(iasyobj):
b += conv.convolute_vector(
b += conv.convolve_vector(
order(iasyobj), interp, z
)[0]
np.testing.assert_allclose(
Expand Down
6 changes: 3 additions & 3 deletions tests/yadism/cf/test_splitting_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def benchmark_conv(self):
# def test_pqg0pgq0(self):
# nf = 3
# i = interpolation.InterpolatorDispatcher(interpolation.make_grid(30,20),4,mode_N=False)
# o_pqg = conv.convolute_operator(sf.lo.pqg(nf), i)
# o_pgq = conv.convolute_operator(sf.nlo.pgq0(nf),i)
# o_pqg0pgq0 = conv.convolute_operator(sf.nlo.pqg0pgg0(nf),i)
# o_pqg = conv.convolve_operator(sf.lo.pqg(nf), i)
# o_pgq = conv.convolve_operator(sf.nlo.pgq0(nf),i)
# o_pqg0pgq0 = conv.convolve_operator(sf.nlo.pqg0pgg0(nf),i)
# np.testing.assert_allclose(o_pqg0pgq0[0], o_pqg[0] @ o_pgq[0])
16 changes: 8 additions & 8 deletions tests/yadism/test_tmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_mode(self):
obj = MockTMC(objSF, {"x": 0.99, "Q2": 1})
obj.get_result()

def test_convolute_F2_empty(self):
def test_convolve_F2_empty(self):
xg = np.array([0.2, 0.6, 1.0])

class MockSF1(MockSF):
Expand All @@ -88,17 +88,17 @@ def is0(res):
objSF = MockSF1(1, xg)
obj = MockTMC(objSF, {"x": 0.99, "Q2": 1})
# test 0 function
res = obj._convolute_FX( # pylint: disable=protected-access
res = obj._convolve_FX( # pylint: disable=protected-access
"F2", lambda _x, _args: 0
)
is0(res)
# test constant function
res = obj._convolute_FX( # pylint: disable=protected-access
res = obj._convolve_FX( # pylint: disable=protected-access
"F2", lambda _x, _args: 1
)
is0(res)
# test random function
res = obj._convolute_FX("F2", np.exp) # pylint: disable=protected-access
res = obj._convolve_FX("F2", np.exp) # pylint: disable=protected-access
is0(res)
# test h2
res = obj._h2() # pylint: disable=protected-access
Expand All @@ -107,7 +107,7 @@ def is0(res):
res = obj._g2() # pylint: disable=protected-access
is0(res)

def test_convolute_F2_delta(self):
def test_convolve_F2_delta(self):
xg = np.array([0.2, 0.6, 1.0])

class MockSF2(MockSF):
Expand All @@ -124,9 +124,9 @@ def get_esf(self, _name, kinematics):
# build objects
objSF = MockSF2(1, xg)
obj = MockTMC(objSF, {"x": 0.99, "Q2": 1})
# convolute with constant function
# convolve with constant function
# res_const = int_xi^1 du/u 1 F2(u)
res_const = obj._convolute_FX( # pylint: disable=protected-access
res_const = obj._convolve_FX( # pylint: disable=protected-access
"F2", lambda x, args: 1
)
assert isinstance(res_const, ESFResult)
Expand Down Expand Up @@ -164,7 +164,7 @@ def isdelta(pdf): # assert F2 = pdf
integral_with_pdf = np.matmul(res_h2.orders[lo][0][0], pdf_lin)
assert pytest.approx(integral_with_pdf, 1 / 1000.0) == c * (-np.log(obj.xi))

def test_convolute_F2_xi_of_domain(self):
def test_convolve_F2_xi_of_domain(self):
xg = np.array([0.2, 0.6, 1.0])

class MockSF3(MockSF):
Expand Down

0 comments on commit 54eb45f

Please sign in to comment.