Skip to content

Commit

Permalink
Fix sv imports
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Sep 16, 2024
1 parent 124641f commit 8bcee93
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 27 deletions.
5 changes: 3 additions & 2 deletions extras/n3lo_bench/splitting_function_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from eko.couplings import CouplingEvolutionMethod, Couplings, CouplingsInfo
from eko.mellin import Path
from eko.quantities.heavy_quarks import QuarkMassScheme
from eko.scale_variations.exponentiated import gamma_variation
from ekore.anomalous_dimensions.unpolarized.space_like import gamma_ns, gamma_singlet

map_singlet_entries = {"gg": (1, 1), "gq": (1, 0), "qg": (0, 1), "qq": (0, 0)}
Expand Down Expand Up @@ -49,13 +50,13 @@ def integrand(u, x, order, entry, nf, ns_mode, n3lo_variation, L):
if is_singlet:
gamma = gamma_singlet((order + 1, 0), path.n, nf, n3lo_variation)
if L != 0:
gamma = sv.exponentiated.gamma_variation(gamma, (order + 1, 0), nf, L)
gamma = gamma_variation(gamma, (order + 1, 0), nf, L)
idx1, idx2 = map_singlet_entries[entry]
gamma = gamma[order, idx1, idx2]
else:
gamma = gamma_ns((order + 1, 0), ns_mode, path.n, nf, n3lo_variation)
if L != 0:
gamma = sv.exponentiated.gamma_variation(gamma, (order + 1, 0), nf, L)
gamma = gamma_variation(gamma, (order + 1, 0), nf, L)
gamma = gamma[order]

# recombine everything
Expand Down
22 changes: 12 additions & 10 deletions src/eko/evolution_operator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from ..kernels import valence_qed as qed_v
from ..matchings import Segment, lepton_number
from ..member import OpMember
from ..scale_variations import expanded as sv_expanded
from ..scale_variations import exponentiated as sv_exponentiated

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -396,7 +398,7 @@ def quad_ker_qcd(
)
# scale var exponentiated is directly applied on gamma
if sv_mode == sv.Modes.exponentiated:
gamma_singlet = sv.exponentiated.gamma_variation(
gamma_singlet = sv_exponentiated.gamma_variation(
gamma_singlet, order, nf, L
)
ker = s.dispatcher(
Expand All @@ -412,7 +414,7 @@ def quad_ker_qcd(
# scale var expanded is applied on the kernel
if sv_mode == sv.Modes.expanded and not is_threshold:
ker = np.ascontiguousarray(
sv.expanded.singlet_variation(gamma_singlet, as1, order, nf, L, dim=2)
sv_expanded.singlet_variation(gamma_singlet, as1, order, nf, L, dim=2)
) @ np.ascontiguousarray(ker)
ker = select_singlet_element(ker, mode0, mode1)
else:
Expand All @@ -429,7 +431,7 @@ def quad_ker_qcd(
order, mode0, ker_base.n, nf, n3lo_ad_variation, use_fhmruvv
)
if sv_mode == sv.Modes.exponentiated:
gamma_ns = sv.exponentiated.gamma_variation(gamma_ns, order, nf, L)
gamma_ns = sv_exponentiated.gamma_variation(gamma_ns, order, nf, L)
ker = ns.dispatcher(
order,
method,
Expand All @@ -440,7 +442,7 @@ def quad_ker_qcd(
ev_op_iterations,
)
if sv_mode == sv.Modes.expanded and not is_threshold:
ker = sv.expanded.non_singlet_variation(gamma_ns, as1, order, nf, L) * ker
ker = sv_expanded.non_singlet_variation(gamma_ns, as1, order, nf, L) * ker
return ker


Expand Down Expand Up @@ -520,7 +522,7 @@ def quad_ker_qed(
)
# scale var exponentiated is directly applied on gamma
if sv_mode == sv.Modes.exponentiated:
gamma_s = sv.exponentiated.gamma_variation_qed(
gamma_s = sv_exponentiated.gamma_variation_qed(
gamma_s, order, nf, lepton_number(mu2_to), L, alphaem_running
)
ker = qed_s.dispatcher(
Expand All @@ -539,7 +541,7 @@ def quad_ker_qed(
# However the distance between the two is very small and affects only the running aem
if sv_mode == sv.Modes.expanded and not is_threshold:
ker = np.ascontiguousarray(
sv.expanded.singlet_variation_qed(
sv_expanded.singlet_variation_qed(
gamma_s, as_list[-1], a_half[-1][1], alphaem_running, order, nf, L
)
) @ np.ascontiguousarray(ker)
Expand All @@ -550,7 +552,7 @@ def quad_ker_qed(
)
# scale var exponentiated is directly applied on gamma
if sv_mode == sv.Modes.exponentiated:
gamma_v = sv.exponentiated.gamma_variation_qed(
gamma_v = sv_exponentiated.gamma_variation_qed(
gamma_v, order, nf, lepton_number(mu2_to), L, alphaem_running
)
ker = qed_v.dispatcher(
Expand All @@ -566,7 +568,7 @@ def quad_ker_qed(
# scale var expanded is applied on the kernel
if sv_mode == sv.Modes.expanded and not is_threshold:
ker = np.ascontiguousarray(
sv.expanded.valence_variation_qed(
sv_expanded.valence_variation_qed(
gamma_v, as_list[-1], a_half[-1][1], alphaem_running, order, nf, L
)
) @ np.ascontiguousarray(ker)
Expand All @@ -577,7 +579,7 @@ def quad_ker_qed(
)
# scale var exponentiated is directly applied on gamma
if sv_mode == sv.Modes.exponentiated:
gamma_ns = sv.exponentiated.gamma_variation_qed(
gamma_ns = sv_exponentiated.gamma_variation_qed(
gamma_ns, order, nf, lepton_number(mu2_to), L, alphaem_running
)
ker = qed_ns.dispatcher(
Expand All @@ -594,7 +596,7 @@ def quad_ker_qed(
)
if sv_mode == sv.Modes.expanded and not is_threshold:
ker = (
sv.expanded.non_singlet_variation_qed(
sv_expanded.non_singlet_variation_qed(
gamma_ns, as_list[-1], a_half[-1][1], alphaem_running, order, nf, L
)
* ker
Expand Down
20 changes: 10 additions & 10 deletions src/eko/evolution_operator/__init__.py.patch
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ index fe07ade9..0f58c9e5 100644
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
- gamma_singlet = sv.exponentiated.gamma_variation(
- gamma_singlet = sv_exponentiated.gamma_variation(
- gamma_singlet, order, nf, L
- )
- ker = s.dispatcher(
Expand All @@ -345,7 +345,7 @@ index fe07ade9..0f58c9e5 100644
- # scale var expanded is applied on the kernel
- if sv_mode == sv.Modes.expanded and not is_threshold:
- ker = np.ascontiguousarray(
- sv.expanded.singlet_variation(gamma_singlet, as1, order, nf, L, dim=2)
- sv_expanded.singlet_variation(gamma_singlet, as1, order, nf, L, dim=2)
- ) @ np.ascontiguousarray(ker)
- ker = select_singlet_element(ker, mode0, mode1)
- else:
Expand All @@ -362,7 +362,7 @@ index fe07ade9..0f58c9e5 100644
- order, mode0, ker_base.n, nf, n3lo_ad_variation, use_fhmruvv
- )
- if sv_mode == sv.Modes.exponentiated:
- gamma_ns = sv.exponentiated.gamma_variation(gamma_ns, order, nf, L)
- gamma_ns = sv_exponentiated.gamma_variation(gamma_ns, order, nf, L)
- ker = ns.dispatcher(
- order,
- method,
Expand All @@ -373,7 +373,7 @@ index fe07ade9..0f58c9e5 100644
- ev_op_iterations,
- )
- if sv_mode == sv.Modes.expanded and not is_threshold:
- ker = sv.expanded.non_singlet_variation(gamma_ns, as1, order, nf, L) * ker
- ker = sv_expanded.non_singlet_variation(gamma_ns, as1, order, nf, L) * ker
- return ker
-
-
Expand Down Expand Up @@ -453,7 +453,7 @@ index fe07ade9..0f58c9e5 100644
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
- gamma_s = sv.exponentiated.gamma_variation_qed(
- gamma_s = sv_exponentiated.gamma_variation_qed(
- gamma_s, order, nf, lepton_number(mu2_to), L, alphaem_running
- )
- ker = qed_s.dispatcher(
Expand All @@ -472,7 +472,7 @@ index fe07ade9..0f58c9e5 100644
- # However the distance between the two is very small and affects only the running aem
- if sv_mode == sv.Modes.expanded and not is_threshold:
- ker = np.ascontiguousarray(
- sv.expanded.singlet_variation_qed(
- sv_expanded.singlet_variation_qed(
- gamma_s, as_list[-1], a_half[-1][1], alphaem_running, order, nf, L
- )
- ) @ np.ascontiguousarray(ker)
Expand All @@ -483,7 +483,7 @@ index fe07ade9..0f58c9e5 100644
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
- gamma_v = sv.exponentiated.gamma_variation_qed(
- gamma_v = sv_exponentiated.gamma_variation_qed(
- gamma_v, order, nf, lepton_number(mu2_to), L, alphaem_running
- )
- ker = qed_v.dispatcher(
Expand All @@ -499,7 +499,7 @@ index fe07ade9..0f58c9e5 100644
- # scale var expanded is applied on the kernel
- if sv_mode == sv.Modes.expanded and not is_threshold:
- ker = np.ascontiguousarray(
- sv.expanded.valence_variation_qed(
- sv_expanded.valence_variation_qed(
- gamma_v, as_list[-1], a_half[-1][1], alphaem_running, order, nf, L
- )
- ) @ np.ascontiguousarray(ker)
Expand All @@ -510,7 +510,7 @@ index fe07ade9..0f58c9e5 100644
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
- gamma_ns = sv.exponentiated.gamma_variation_qed(
- gamma_ns = sv_exponentiated.gamma_variation_qed(
- gamma_ns, order, nf, lepton_number(mu2_to), L, alphaem_running
- )
- ker = qed_ns.dispatcher(
Expand All @@ -527,7 +527,7 @@ index fe07ade9..0f58c9e5 100644
- )
- if sv_mode == sv.Modes.expanded and not is_threshold:
- ker = (
- sv.expanded.non_singlet_variation_qed(
- sv_expanded.non_singlet_variation_qed(
- gamma_ns, as_list[-1], a_half[-1][1], alphaem_running, order, nf, L
- )
- * ker
Expand Down
3 changes: 2 additions & 1 deletion src/eko/evolution_operator/operator_matrix_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .. import scale_variations as sv
from ..io.types import InversionMethod
from ..matchings import Segment
from ..scale_variations.exponentiated import gamma_variation
from . import Operator, QuadKerBase

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -188,7 +189,7 @@ def quad_ker(

# correct for scale variations
if sv_mode == sv.Modes.exponentiated:
A = sv.exponentiated.gamma_variation(A, order, nf, Lsv)
A = gamma_variation(A, order, nf, Lsv)

# build the expansion in alpha_s depending on the strategy
ker = build_ome(A, order, a_s, backward_method)
Expand Down
10 changes: 6 additions & 4 deletions src/eko/evolution_operator/quad_ker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from .. import scale_variations as sv
from ..kernels import non_singlet as ns
from ..kernels import singlet as s
from ..scale_variations import expanded as sv_expanded
from ..scale_variations import exponentiated as sv_exponentiated

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -110,7 +112,7 @@ def cb_quad_ker_qcd(
im_gamma_singlet = nb.carray(im_gamma_raw, (order_qcd, 2, 2))
gamma_singlet = re_gamma_singlet + im_gamma_singlet * 1j
if sv_mode == sv.Modes.exponentiated:
gamma_singlet = sv.exponentiated.gamma_variation(
gamma_singlet = sv_exponentiated.gamma_variation(
gamma_singlet, order, nf, L
)
# construct eko
Expand All @@ -127,7 +129,7 @@ def cb_quad_ker_qcd(
# scale var expanded is applied on the kernel
if sv_mode == sv.Modes.expanded and not is_threshold:
ker = np.ascontiguousarray(
sv.expanded.singlet_variation(gamma_singlet, as1, order, nf, L, dim=2)
sv_expanded.singlet_variation(gamma_singlet, as1, order, nf, L, dim=2)
) @ np.ascontiguousarray(ker)
ker = select_singlet_element(ker, mode0, mode1)
else:
Expand All @@ -136,7 +138,7 @@ def cb_quad_ker_qcd(
im_gamma_ns = nb.carray(im_gamma_raw, order_qcd)
gamma_ns = re_gamma_ns + im_gamma_ns * 1j
if sv_mode == sv.Modes.exponentiated:
gamma_ns = sv.exponentiated.gamma_variation(gamma_ns, order, nf, L)
gamma_ns = sv_exponentiated.gamma_variation(gamma_ns, order, nf, L)
# construct eko
ker = ns.dispatcher(
order,
Expand All @@ -148,7 +150,7 @@ def cb_quad_ker_qcd(
ev_op_iterations,
)
if sv_mode == sv.Modes.expanded and not is_threshold:
ker = sv.expanded.non_singlet_variation(gamma_ns, as1, order, nf, L) * ker
ker = sv_expanded.non_singlet_variation(gamma_ns, as1, order, nf, L) * ker
# recombine everything
res = ker * pj * jac
return np.real(res)
Expand Down

0 comments on commit 8bcee93

Please sign in to comment.