diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe617e9bb..45e777ee5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,31 +18,31 @@ repos: hooks: - id: pycln args: [--config=pyproject.toml] - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.8.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.4 hooks: - - id: black - - repo: https://github.com/asottile/blacken-docs - rev: 1.18.0 - hooks: - - id: blacken-docs + # Run the linter. + - id: ruff + args: [ --fix ] - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: - id: isort args: ["--profile", "black"] - - repo: https://github.com/asottile/pyupgrade - rev: v3.17.0 + - repo: https://github.com/PyCQA/docformatter + rev: v1.7.5 hooks: - - id: pyupgrade - - repo: https://github.com/pycqa/pydocstyle - rev: 6.3.0 + - id: docformatter + additional_dependencies: [tomli] + args: [--in-place, --config, ./pyproject.toml] + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.8.0 hooks: - - id: pydocstyle - files: ^src/ - args: ["--add-ignore=D107,D105"] - additional_dependencies: - - toml + - id: black + - repo: https://github.com/asottile/blacken-docs + rev: 1.18.0 + hooks: + - id: blacken-docs - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.11.2 hooks: diff --git a/benchmarks/CT14_bench.py b/benchmarks/CT14_bench.py index f736b2d1a..e9f45f129 100644 --- a/benchmarks/CT14_bench.py +++ b/benchmarks/CT14_bench.py @@ -1,5 +1,4 @@ -""" -Benchmark CT14 pdf family +"""Benchmark CT14 pdf family. - as far as I understand, the llo family uses LO splitting functions with LO alphas evolution, whereas the lo family uses LO splitting functions with NLO alphas evolution @@ -25,7 +24,7 @@ class BenchmarkCT14(Runner): - """Benchmark CT14 pdfs""" + """Benchmark CT14 pdfs.""" external = "LHAPDF" diff --git a/benchmarks/CT18_bench.py b/benchmarks/CT18_bench.py index 7398e794d..458c51508 100644 --- a/benchmarks/CT18_bench.py +++ b/benchmarks/CT18_bench.py @@ -1,7 +1,4 @@ -""" -Benchmark CT18 pdf family - -""" +"""Benchmark CT18 pdf family.""" from banana import register @@ -23,7 +20,7 @@ class BenchmarkCT18(Runner): - """Benchmark CT18 pdfs""" + """Benchmark CT18 pdfs.""" external = "LHAPDF" diff --git a/benchmarks/DSSV_bench.py b/benchmarks/DSSV_bench.py index 4654f67d7..8315215e1 100644 --- a/benchmarks/DSSV_bench.py +++ b/benchmarks/DSSV_bench.py @@ -1,7 +1,7 @@ """Benchmark DSSV pdf family. -Note that the PDF set is private, but can be obtained from the -authors upon request. +Note that the PDF set is private, but can be obtained from the authors +upon request. """ from banana import register diff --git a/benchmarks/FF_LHAPDF_bench.py b/benchmarks/FF_LHAPDF_bench.py index 9bcdb2e2b..cd256962d 100644 --- a/benchmarks/FF_LHAPDF_bench.py +++ b/benchmarks/FF_LHAPDF_bench.py @@ -1,4 +1,4 @@ -"""Benchmark FFs from LHAPDF""" +"""Benchmark FFs from LHAPDF.""" from banana import register diff --git a/benchmarks/HERA20_bench.py b/benchmarks/HERA20_bench.py index 1ae06daf4..9159f864f 100644 --- a/benchmarks/HERA20_bench.py +++ b/benchmarks/HERA20_bench.py @@ -1,7 +1,4 @@ -""" -Benchmark HERAPDF2.0 pdf family - -""" +"""Benchmark HERAPDF2.0 pdf family.""" from banana import register @@ -27,7 +24,7 @@ class BenchmarkHERA20(Runner): - """Benchmark HERA20 pdfs""" + """Benchmark HERA20 pdfs.""" external = "LHAPDF" diff --git a/benchmarks/NNPDF_bench.py b/benchmarks/NNPDF_bench.py index 444b452cd..ae14b5e8b 100644 --- a/benchmarks/NNPDF_bench.py +++ b/benchmarks/NNPDF_bench.py @@ -1,6 +1,4 @@ -""" -Benchmark NNPDF pdf family -""" +"""Benchmark NNPDF pdf family.""" from banana import register @@ -11,9 +9,7 @@ class BenchmarkNNPDF(Runner): - """ - Globally set the external program to LHAPDF - """ + """Globally set the external program to LHAPDF.""" external = "LHAPDF" @@ -49,7 +45,7 @@ def skip_pdfs(self, _theory): class BenchmarkNNPDF31(BenchmarkNNPDF): - """Benchmark NNPDF3.1""" + """Benchmark NNPDF3.1.""" def benchmark_nlo(self, Q0=1.65, mugrid=(10,)): theory_card = { @@ -64,7 +60,7 @@ def benchmark_nlo(self, Q0=1.65, mugrid=(10,)): class BenchmarkNNPDF31_luxqed(BenchmarkNNPDF): - """Benchmark NNPDF3.1_luxqed""" + """Benchmark NNPDF3.1_luxqed.""" def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)): theory_card = { @@ -91,7 +87,7 @@ def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)): class BenchmarkNNPDF40(BenchmarkNNPDF): - """Benchmark NNPDF4.0""" + """Benchmark NNPDF4.0.""" def benchmark_nlo(self, Q0=1.65, mugrid=(10,)): theory_card = { @@ -119,7 +115,7 @@ def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)): class BenchmarkNNPDFpol11(BenchmarkNNPDF): - """Benchmark NNPDFpol11""" + """Benchmark NNPDFpol11.""" def benchmark(self, Q0=1.65, mugrid=(10,)): theory_card = { diff --git a/benchmarks/apfel_bench.py b/benchmarks/apfel_bench.py index d40c65894..b9194d68c 100644 --- a/benchmarks/apfel_bench.py +++ b/benchmarks/apfel_bench.py @@ -1,6 +1,4 @@ -""" - Benchmark EKO to Apfel -""" +"""Benchmark EKO to Apfel.""" import numpy as np from banana import register @@ -21,9 +19,7 @@ def tolist(input_dict): class ApfelBenchmark(Runner): - """ - Globally set the external program to Apfel - """ + """Globally set the external program to Apfel.""" external = "apfel" @@ -37,7 +33,7 @@ def skip_pdfs(_theory): class BenchmarkVFNS(ApfelBenchmark): - """Benchmark VFNS""" + """Benchmark VFNS.""" vfns_theory = { "FNS": "ZM-VFNS", @@ -59,7 +55,7 @@ class BenchmarkVFNS(ApfelBenchmark): vfns_theory = tolist(vfns_theory) def benchmark_plain(self, pto): - """Plain configuration""" + """Plain configuration.""" th = self.vfns_theory.copy() th.update({"PTO": [pto]}) @@ -68,7 +64,7 @@ def benchmark_plain(self, pto): ) def benchmark_sv(self, pto, svmode): - """Scale Variation""" + """Scale Variation.""" th = self.vfns_theory.copy() th.update( @@ -86,7 +82,7 @@ def benchmark_sv(self, pto, svmode): ) def benchmark_kthr(self, pto): - """Threshold scale different from heavy quark mass""" + """Threshold scale different from heavy quark mass.""" th = self.vfns_theory.copy() th.update( @@ -101,10 +97,10 @@ def benchmark_kthr(self, pto): ) def benchmark_msbar(self, pto): - """ - MSbar heavy quark mass scheme - when passing kthr != 1 both apfel and eko use ``kThr * msbar``, - as thr scale, where ``msbar`` is the usual ms_bar solution. + """MSbar heavy quark mass scheme when passing kthr != 1 both apfel and + eko use ``kThr * msbar``, as thr scale, where ``msbar`` is the usual + ms_bar solution. + However apfel and eko manage the alpha_s thr differently: apfel uses the given mass parameters as thr multiplied by the kthr, while in eko only the already computed thr matters, so the @@ -132,7 +128,7 @@ def benchmark_msbar(self, pto): class BenchmarkFFNS(ApfelBenchmark): - """Benckmark FFNS""" + """Benckmark FFNS.""" ffns_theory = { "FNS": "FFNS", @@ -150,7 +146,7 @@ class BenchmarkFFNS(ApfelBenchmark): ffns_theory = tolist(ffns_theory) def benchmark_plain(self, pto): - """Plain configuration""" + """Plain configuration.""" th = self.ffns_theory.copy() th.update({"PTO": [pto]}) @@ -159,7 +155,7 @@ def benchmark_plain(self, pto): ) def benchmark_plain_pol(self, pto): - """Plain configuration""" + """Plain configuration.""" th = self.ffns_theory.copy() th.update({"PTO": [pto]}) @@ -169,7 +165,7 @@ def benchmark_plain_pol(self, pto): self.run(cartesian_product(th), operators.build(op), ["ToyLH"]) def benchmark_sv(self, pto, svmode): - """Scale Variation""" + """Scale Variation.""" ts = [] th = self.ffns_theory.copy() @@ -198,7 +194,7 @@ def benchmark_sv(self, pto, svmode): class BenchmarkFFNS_qed(ApfelBenchmark): - """Benckmark FFNS""" + """Benckmark FFNS.""" ffns_theory = { "Qref": 91.1870, @@ -223,7 +219,7 @@ class BenchmarkFFNS_qed(ApfelBenchmark): ffns_theory = tolist(ffns_theory) def benchmark_plain(self, pto, qed): - """Plain configuration""" + """Plain configuration.""" th = self.ffns_theory.copy() th.update({"PTO": [pto], "QED": [qed]}) @@ -240,7 +236,7 @@ def benchmark_plain(self, pto, qed): ) def benchmark_sv(self, pto, qed, svmode): - """Scale Variation""" + """Scale Variation.""" ts = [] th = self.ffns_theory.copy() @@ -277,7 +273,7 @@ def benchmark_sv(self, pto, qed, svmode): class BenchmarkVFNS_qed(ApfelBenchmark): - """Benckmark FFNS""" + """Benckmark FFNS.""" vfns_theory = { "Qref": 91.1870, @@ -301,7 +297,7 @@ class BenchmarkVFNS_qed(ApfelBenchmark): vfns_theory = tolist(vfns_theory) def benchmark_plain(self, pto, qed): - """Plain configuration""" + """Plain configuration.""" th = self.vfns_theory.copy() th.update({"PTO": [pto], "QED": [qed]}) diff --git a/benchmarks/eko/benchmark_alphaem.py b/benchmarks/eko/benchmark_alphaem.py index 9cc05536c..3a4274855 100644 --- a/benchmarks/eko/benchmark_alphaem.py +++ b/benchmarks/eko/benchmark_alphaem.py @@ -1,6 +1,8 @@ """This module benchmarks alpha_em against alphaQED23 and validphys. -alphaQED23 can be obtained from http://www-com.physik.hu-berlin.de/~fjeger/software.html . +alphaQED23 can be obtained from +http://www-com.physik.hu-berlin.de/~fjeger/software.html +. """ import numpy as np @@ -14,7 +16,7 @@ @pytest.mark.isolated class BenchmarkCouplings: def test_alphaQED_high(self): - """testing aginst alphaQED23 for high Q values""" + """Testing aginst alphaQED23 for high Q values.""" alphaQED23 = np.array( [ 0.0075683, @@ -90,7 +92,7 @@ def test_alphaQED_low(self): np.testing.assert_allclose(alphaQED23, alpha_eko, rtol=3.2e-3) def test_validphys(self): - """testing aginst validphys""" + """Testing aginst validphys.""" alpha_vp = np.array( [ 0.007408255774054356, diff --git a/benchmarks/eko/benchmark_msbar_evolution.py b/benchmarks/eko/benchmark_msbar_evolution.py index 49dc0e952..fba0d3c2f 100644 --- a/benchmarks/eko/benchmark_msbar_evolution.py +++ b/benchmarks/eko/benchmark_msbar_evolution.py @@ -231,10 +231,10 @@ def benchmark_APFEL_msbar_solution( ) def benchmark_msbar_solution_kthr(self, theory_card: TheoryCard): - """ - With this test you can see that in EKO - the solution value of mb is not affected by "kbThr", - since mb is searched with an Nf=5 larger range. + """With this test you can see that in EKO the solution value of mb is + not affected by "kbThr", since mb is searched with an Nf=5 larger + range. + While in Apfel this doesn't happen. """ update_theory(theory_card) diff --git a/benchmarks/eko/benchmark_strong_coupling.py b/benchmarks/eko/benchmark_strong_coupling.py index d60bd28b0..9298b1cf3 100644 --- a/benchmarks/eko/benchmark_strong_coupling.py +++ b/benchmarks/eko/benchmark_strong_coupling.py @@ -46,9 +46,8 @@ def ref_couplings(ref_values, ref_scale: float, ref_nf: FlavorsNumber) -> Coupli @pytest.mark.isolated class BenchmarkCouplings: def test_a_s(self): - """Tests the value of alpha_s (for now only at LO) - for a given set of parameters - """ + """Tests the value of alpha_s (for now only at LO) for a given set of + parameters.""" # source: JCM known_val = 0.0091807954 ref_mu2 = 90 @@ -574,12 +573,12 @@ def benchmark_APFEL_vfns_msbar(self): np.testing.assert_allclose(apfel_vals, np.array(my_vals)) def _get_Lambda2_LO(self, as_ref, scale_ref, nf): - """Transformation to Lambda_QCD""" + """Transformation to Lambda_QCD.""" beta0 = beta_qcd((2, 0), nf) return scale_ref * np.exp(-1.0 / (as_ref * beta0)) def benchmark_lhapdf_ffns_lo(self): - """test FFNS LO towards LHAPDF""" + """Test FFNS LO towards LHAPDF.""" Q2s = [1, 1e1, 1e2, 1e3, 1e4] coupling_ref = np.array([0.118, 0.007496]) scale_ref = 91.0 @@ -626,7 +625,7 @@ def benchmark_lhapdf_ffns_lo(self): np.testing.assert_allclose(lhapdf_vals, np.array(my_vals), rtol=5e-4) def benchmark_apfel_exact(self): - """test exact towards APFEL""" + """Test exact towards APFEL.""" Q2s = [1e1, 1e2, 1e3, 1e4] coupling_ref = np.array([0.118, 0.007496]) scale_ref = 90 @@ -694,7 +693,7 @@ def benchmark_apfel_exact(self): np.testing.assert_allclose(apfel_vals, np.array(my_vals), rtol=2e-4) def benchmark_lhapdf_exact(self): - """test exact towards LHAPDF""" + """Test exact towards LHAPDF.""" Q2s = [1e1, 1e2, 1e3, 1e4] coupling_ref = np.array([0.118, 0.007496]) scale_ref = 90 @@ -765,7 +764,7 @@ def benchmark_lhapdf_exact(self): np.testing.assert_allclose(lhapdf_vals, np.array(my_vals), rtol=2e-4) def benchmark_lhapdf_zmvfns_lo(self): - """test ZM-VFNS LO towards LHAPDF""" + """Test ZM-VFNS LO towards LHAPDF.""" Q2s = [1, 1e1, 1e2, 1e3, 1e4] coupling_ref = np.array([0.118, 0.007496]) scale_ref = 900 diff --git a/benchmarks/ekore/benchmark_pegasus_ad_us_as2.py b/benchmarks/ekore/benchmark_pegasus_ad_us_as2.py index ebc53e3ae..85e6f0c9b 100644 --- a/benchmarks/ekore/benchmark_pegasus_ad_us_as2.py +++ b/benchmarks/ekore/benchmark_pegasus_ad_us_as2.py @@ -1,7 +1,8 @@ """Benchmark the unpolarized NLO anomalous dimensions against PEGASUS. -Recall that we obtained our representation not from PEGASUS, but derived it -ourselves (see comment there).""" +Recall that we obtained our representation not from PEGASUS, but derived +it ourselves (see comment there). +""" import numpy as np import pytest diff --git a/benchmarks/ekore/benchmark_pegasus_mellin.py b/benchmarks/ekore/benchmark_pegasus_mellin.py index addefe421..960461398 100644 --- a/benchmarks/ekore/benchmark_pegasus_mellin.py +++ b/benchmarks/ekore/benchmark_pegasus_mellin.py @@ -3,9 +3,8 @@ import numpy as np import pytest -import ekore.anomalous_dimensions.unpolarized.space_like.as2 as ad_as2 import ekore.harmonics as h -from eko.constants import CA, CF, TR, zeta2, zeta3 +from eko.constants import zeta2 @pytest.mark.isolated diff --git a/benchmarks/ekore/benchmark_pegasus_ome_ps_as2.py b/benchmarks/ekore/benchmark_pegasus_ome_ps_as2.py index 700520854..0da716947 100644 --- a/benchmarks/ekore/benchmark_pegasus_ome_ps_as2.py +++ b/benchmarks/ekore/benchmark_pegasus_ome_ps_as2.py @@ -1,4 +1,4 @@ -"""Benchmark the polarized NNLO OME against PEGASUS""" +"""Benchmark the polarized NNLO OME against PEGASUS.""" import numpy as np import pytest @@ -28,18 +28,18 @@ def check_pegasus_ome_ps_as2_s(N, NF): NM = N - 1.0 N1 = N + 1.0 N2 = N + 2.0 - NI = 1.0 / N - NMI = 1.0 / NM + # NI = 1.0 / N + # NMI = 1.0 / NM N1I = 1.0 / N1 - N2I = 1.0 / N2 + # N2I = 1.0 / N2 # - S1M = S1 - NI - S2M = S2 - NI * NI - S3M = S3 - NI**3 + # S1M = S1 - NI + # S2M = S2 - NI * NI + # S3M = S3 - NI**3 S11 = S1 + N1I - S21 = S2 + N1I * N1I - S31 = S3 + N1I**3 - S22 = S21 + N2I * N2I + # S21 = S2 + N1I * N1I + # S31 = S3 + N1I**3 + # S22 = S21 + N2I * N2I ACG3 = h.g_functions.mellin_g3(N1, S11) # # CALL BET(N1,V1) diff --git a/benchmarks/lha_paper_bench.py b/benchmarks/lha_paper_bench.py index bdc48ce59..165006e66 100644 --- a/benchmarks/lha_paper_bench.py +++ b/benchmarks/lha_paper_bench.py @@ -1,6 +1,5 @@ -""" -Benchmark to :cite:`Giele:2002hx` (LO + NLO) and :cite:`Dittmar:2005ed` (NNLO). -""" +"""Benchmark to :cite:`Giele:2002hx` (LO + NLO) and :cite:`Dittmar:2005ed` +(NNLO).""" import os @@ -27,7 +26,7 @@ "QED": 0, "Qedref": 0.0, } -"""Global theory settings""" +"""Global theory settings.""" default_skip_pdfs = [22, -6, 6, "ph", "V35", "V24", "V15", "V8", "T35"] # ffns_skip_pdfs = vfns_skip_pdfs.copy() @@ -136,7 +135,7 @@ def runner(self) -> LHA: raise NotImplementedError("runner method has to be overwritten!") def transformed_runner(self): - """Prepare runner for benchmark setup""" + """Prepare runner for benchmark setup.""" r = self.runner() r.log_to_stdout = os.environ.get("EKO_LOG_STDOUT", False) return r diff --git a/benchmarks/pegasus_bench.py b/benchmarks/pegasus_bench.py index a32d7702c..d7daba22f 100644 --- a/benchmarks/pegasus_bench.py +++ b/benchmarks/pegasus_bench.py @@ -1,6 +1,4 @@ -""" -Benchmark to Pegasus :cite:`Vogt:2004ns` -""" +"""Benchmark to Pegasus :cite:`Vogt:2004ns`""" import numpy as np from banana import register @@ -21,11 +19,10 @@ def tolist(input_dict): class PegasusBenchmark(Runner): - """ - Globally set the external program to Pegasus. + """Globally set the external program to Pegasus. - `imodev = 1` exactly corresponds to `perturbative-exact`. - However, the difference between `perturbative-exact` and `iterate-exact` is + `imodev = 1` exactly corresponds to `perturbative-exact`. However, + the difference between `perturbative-exact` and `iterate-exact` is subleading (~ 1e-4 relative difference). """ @@ -41,7 +38,7 @@ def skip_pdfs(_theory): class BenchmarkVFNS(PegasusBenchmark): - """Benckmark VFNS""" + """Benckmark VFNS.""" zm_theory = { "FNS": "ZM-VFNS", @@ -66,7 +63,7 @@ class BenchmarkVFNS(PegasusBenchmark): vfns_theory = tolist(zm_theory) def benchmark_plain(self, pto): - """Plain configuration""" + """Plain configuration.""" th = self.vfns_theory.copy() th.update( @@ -79,7 +76,7 @@ def benchmark_plain(self, pto): ) def benchmark_sv(self, pto, svmode): - """Scale Variation""" + """Scale Variation.""" th = self.vfns_theory.copy() th.update( @@ -95,7 +92,7 @@ def benchmark_sv(self, pto, svmode): class BenchmarkFFNS(PegasusBenchmark): - """Benckmark FFNS""" + """Benckmark FFNS.""" ffns_theory = { "FNS": "FFNS", @@ -117,7 +114,7 @@ class BenchmarkFFNS(PegasusBenchmark): ffns_theory = tolist(ffns_theory) def benchmark_plain(self, pto): - """Plain configuration""" + """Plain configuration.""" th = self.ffns_theory.copy() th.update( @@ -130,7 +127,7 @@ def benchmark_plain(self, pto): ) def benchmark_plain_pol(self, pto): - """Plain polarized configuration""" + """Plain polarized configuration.""" th = self.ffns_theory.copy() th.update({"PTO": [pto]}) @@ -139,7 +136,7 @@ def benchmark_plain_pol(self, pto): self.run(cartesian_product(th), operators.build(op), ["ToyLH_polarized"]) def benchmark_sv(self, pto, svmode): - """Scale Variation""" + """Scale Variation.""" th = self.ffns_theory.copy() th.update( diff --git a/doc/generate_code_todos.py b/doc/generate_code_todos.py index 6c58abcc3..d3a35b144 100644 --- a/doc/generate_code_todos.py +++ b/doc/generate_code_todos.py @@ -4,8 +4,7 @@ def get_all_files(path): - """ - Find all .py files in `path` + """Find all .py files in `path` Parameters ---------- @@ -22,8 +21,7 @@ def get_all_files(path): def search_file(path): - """ - Search all todo tags in the file + """Search all todo tags in the file. Parameters ---------- @@ -38,8 +36,8 @@ def search_file(path): todos = [] o = path.read_text().splitlines() j = 1 - for l in o: - m = re.search(r"\s*#\s+TODO\s+(.+)$", l) # TODO grep sourdings? + for lines in o: + m = re.search(r"\s*#\s+TODO\s+(.+)$", lines) # TODO grep sourdings? # i.e. if multiple lines? if m is not None: todos.append((j, m.group(1))) @@ -48,8 +46,7 @@ def search_file(path): def write_output(fn, file_list): - """ - Writes the list to a file + """Writes the list to a file. Parameters ---------- diff --git a/doc/source/conf.py b/doc/source/conf.py index 1f03599ac..31ff1c168 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,11 +15,8 @@ # # -import inspect import pathlib -import numba as nb - import eko here = pathlib.Path(__file__).absolute().parent @@ -298,24 +295,6 @@ } -# I don't know where and when, but at some point sphinx stopped to detect the documentation -# hidden below numba. This issue is discussed here https://github.com/sphinx-doc/sphinx/issues/3783 -# pointing to this conf.py: -# https://github.com/duetosymmetry/qnm/blob/d286cad616a4abe5ff3b4e05adbfb4b0e305583e/docs/conf.py#L71-L93 -# However, it doesn't do the trick truly, but the idea is take from there ... -# see also -# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#docstring-preprocessing -def process_numba_docstring( - app, what, name, obj, options, lines -): # pylint: disable=unused-argument - """Recover the docstring under numba, as the numba.njit decorator doesn't repeat the __doc__""" - if not isinstance(obj, nb.core.registry.CPUDispatcher): - return - original = obj.py_func - orig_sig = inspect.signature(original) - lines = orig_sig.__doc__ - - # https://github.com/readthedocs/readthedocs.org/issues/1139#issuecomment-312626491 def run_apidoc(_): import sys # pylint: disable=import-outside-toplevel @@ -336,7 +315,6 @@ def run_apidoc(_): def setup(app): - """Configure Sphinx""" + """Configure Sphinx.""" app.setup_extension("sphinx.ext.autodoc") - app.connect("autodoc-process-docstring", process_numba_docstring) app.connect("builder-inited", run_apidoc) diff --git a/doc/source/overview/tutorials/alpha_s.ipynb b/doc/source/overview/tutorials/alpha_s.ipynb index f9cc5a240..a87682407 100644 --- a/doc/source/overview/tutorials/alpha_s.ipynb +++ b/doc/source/overview/tutorials/alpha_s.ipynb @@ -36,7 +36,7 @@ "import numpy as np\n", "from eko.couplings import Couplings\n", "from eko.quantities.couplings import CouplingsInfo, CouplingEvolutionMethod\n", - "from eko.quantities.heavy_quarks import MatchingScales, QuarkMassScheme\n", + "from eko.quantities.heavy_quarks import QuarkMassScheme\n", "\n", "# set the (alpha_s, alpha_em) reference values\n", "couplings_ref = CouplingsInfo(alphas=0.118, alphaem=0.007496252, ref=(91.0, 5))\n", diff --git a/extras/harmonics_w5/src/harmonics_w5/__init__.py b/extras/harmonics_w5/src/harmonics_w5/__init__.py index 1accc9cd9..4ce5b316b 100644 --- a/extras/harmonics_w5/src/harmonics_w5/__init__.py +++ b/extras/harmonics_w5/src/harmonics_w5/__init__.py @@ -35,7 +35,6 @@ def S41(N, S1, S2, S3): -------- eko.harmonic.f_functions.F9 : :math:`\mathcal{M}[(\text{Li}_4(x)/(x-1))_{+}](N)` - """ return -f.F9(N, S1) + S1 * zeta4 - S2 * zeta3 + S3 * zeta2 @@ -64,7 +63,6 @@ def S311(N, S1, S2): -------- eko.harmonic.f_functions.F11 : :math:`\mathcal{M}[(\text{S}_{2,2}(x)/(x-1))_{+}](N)` - """ return f.F11(N, S1, S2) + zeta3 * S2 - zeta4 / 4 * S1 @@ -97,7 +95,6 @@ def S221(N, S1, S2, S21): :math:`\mathcal{M}[(\text{S}_{2,2}(x)/(x-1))_{+}](N)` eko.harmonic.f_functions.F13 : :math:`\mathcal{M}[(\text{Li}_{2}^2(x)/(x-1))_{+}](N)` - """ return ( -2 * f.F11(N, S1, S2) @@ -135,7 +132,6 @@ def Sm221(N, S1, Sm1, S21, Sm21): -------- eko.harmonic.f_functions.F14F12 : :math:`\mathcal{M}[(2 \text{S}_{2,2}(x) - 1/2 \text{Li}_{2}^2(x))/(x+1)](N)` - """ return ( (-1) ** (N + 1) * (f.F14F12(N, S1, S21)) @@ -184,7 +180,6 @@ def S21m2(N, S1, S2, Sm1, Sm2, Sm3, S21, Sm21, S2m1): :math:`\mathcal{M}[ (\text{ln}(x) \text{S}_{1,2}(−x) − \text{Li}_2^2(−x)/2)/(x+1) ](N)` - """ return ( (-1) ** (N) * f.F16(N, S1, Sm1, Sm2, Sm3, Sm21) @@ -221,7 +216,6 @@ def S2111(N, S1, S2, S3): -------- eko.harmonic.f_functions.F17 : :math:`\mathcal{M}[(\text{S}_{1,3}(x)/(x-1))_{+}](N)` - """ return -f.F17(N, S1, S2, S3) + zeta4 * S1 @@ -254,7 +248,6 @@ def Sm2111(N, S1, S2, S3, Sm1): -------- eko.harmonic.f_functions.F18 : :math:`\mathcal{M}[\text{S}_{1,3}(x)/(x+1)](N)` - """ return ( (-1) ** (N + 1) * f.F18(N, S1, S2, S3) @@ -294,7 +287,6 @@ def S23(N, S1, S2, S3): \text{ln}(x)[\text{S}_{1,2}(1-x) - \zeta_3] +3 [\text{S}_{1,3}(1-x) - \zeta_4] /(x-1))_{+}](N)` - """ return f.F19(N, S1, S2, S3) + 3 * zeta4 * S1 @@ -332,7 +324,6 @@ def Sm23(N, Sm1, Sm2, Sm3, is_singlet=None): \text{ln}(x)[\text{S}_{1,2}(1-x) - \zeta_3] +3 [\text{S}_{1,3}(1-x) - \zeta_4] /(x+1)](N)` - """ eta = symmetry_factor(N, is_singlet) return ( @@ -377,7 +368,6 @@ def S2m3(N, S2, Sm1, Sm2, Sm3): -2 \text{ln}(x) \text{Li}_3(-x) +3 \text{Li}_4(-x) )/(x-1)](N)` - """ return ( (-1) ** (N + 1) * f.F21(N, Sm1, Sm2, Sm3) diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/__init__.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/__init__.py index e2e3ab533..00fc5ed46 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/__init__.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/__init__.py @@ -1,4 +1,5 @@ -r"""This subpackage contains some Mellin transformations for 5th order harmonics sum. +r"""This subpackage contains some Mellin transformations for 5th order harmonics +sum. Notation refers to: diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f11.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f11.py index 419735262..c04126d24 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f11.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f11.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F11. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f13.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f13.py index 7c6e51f4c..cf68f288c 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f13.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f13.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F13. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f14_f12.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f14_f12.py index c2f825f16..8bc460346 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f14_f12.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f14_f12.py @@ -10,7 +10,8 @@ @nb.njit(cache=True) def F14F12(n, S1, S21): - """Linear combination of :math:`M[( 2 S_{2,2}(x)- Li_2(x)^2/2)/(1+x)](N)`""" + """Linear combination of :math:`M[( 2 S_{2,2}(x)- + Li_2(x)^2/2)/(1+x)](N)`""" return ( -0.5626569734260486 + 0.49999902059348167 diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f16.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f16.py index a034b4001..13a98e7f2 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f16.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f16.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F16. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f17.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f17.py index 25ec7dfd8..3b61305c8 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f17.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f17.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F17. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f18.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f18.py index ba98553cb..b348a1bdd 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f18.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f18.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F18. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f19.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f19.py index 47ebeede5..4814a499d 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f19.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f19.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F19. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f20.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f20.py index 7914aa212..2d7ad4734 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f20.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f20.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F20. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f21.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f21.py index 2b9620cbf..eff3a9e3f 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f21.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f21.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F21. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/harmonics_w5/src/harmonics_w5/f_functions/f9.py b/extras/harmonics_w5/src/harmonics_w5/f_functions/f9.py index 3c016d0cb..18159eb26 100644 --- a/extras/harmonics_w5/src/harmonics_w5/f_functions/f9.py +++ b/extras/harmonics_w5/src/harmonics_w5/f_functions/f9.py @@ -1,8 +1,8 @@ # pylint: skip-file """This module contains implemtation of F9. -When using it, please cite :cite:`Blumlein:2009ta`. -Mellin transform is defined with the convention x^(N). +When using it, please cite :cite:`Blumlein:2009ta`. Mellin transform is +defined with the convention x^(N). """ import numba as nb import numpy as np diff --git a/extras/n3lo_bench/plot_splitting.py b/extras/n3lo_bench/plot_splitting.py index 8ccd04e03..715c02b86 100644 --- a/extras/n3lo_bench/plot_splitting.py +++ b/extras/n3lo_bench/plot_splitting.py @@ -85,7 +85,7 @@ def plot_ad_expansion(entry, nf=4, plot_xspace=False, logscale=False): def plot_ad(entry, q2=None, nf=4, plot_xspace=False, plot_ratio=False, logscale=False): - """Plot the splitting function at fixed order""" + """Plot the splitting function at fixed order.""" fig = plt.figure(figsize=(7, 5)) gs = fig.add_gridspec(5, 1) ax = plt.subplot(gs[:, 0]) diff --git a/pyproject.toml b/pyproject.toml index 0f343b160..ee28a896d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -185,3 +185,35 @@ max-args = 10 [tool.pydocstyle] convention = "numpy" + +[tool.ruff] +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", + "extras/" +] diff --git a/src/eko/__init__.py b/src/eko/__init__.py index 6503a8225..7636c7845 100644 --- a/src/eko/__init__.py +++ b/src/eko/__init__.py @@ -5,3 +5,9 @@ from .runner import solve __version__ = version.__version__ + +__all__ = [ + "io", + "EKO", + "solve", +] diff --git a/src/eko/basis_rotation.py b/src/eko/basis_rotation.py index e31a7beb6..ffcd99a67 100644 --- a/src/eko/basis_rotation.py +++ b/src/eko/basis_rotation.py @@ -1,10 +1,10 @@ -"""Contains the definitions of the :doc:`Flavor Basis and Evolution Basis `.""" +"""Contains the definitions of the :doc:`Flavor Basis and Evolution Basis +`.""" import numpy as np flavor_basis_pids = tuple([22] + list(range(-6, -1 + 1)) + [21] + list(range(1, 6 + 1))) -r""" -Sorted elements in Flavor Basis as |pid|. +r"""Sorted elements in Flavor Basis as |pid|. Definition: `here `_ @@ -49,8 +49,7 @@ "T24", "T35", ) -r""" -Sorted elements in Evolution Basis as :obj:`str`. +r"""Sorted elements in Evolution Basis as :obj:`str`. Definition: :ref:`here `. @@ -73,8 +72,7 @@ "Tu8", "Vu8", ) -r""" -Sorted elements in Unified Evolution Basis as :obj:`str`. +r"""Sorted elements in Unified Evolution Basis as :obj:`str`. Definition: :ref:`here `. @@ -96,8 +94,7 @@ + [108 + 2, 208 + 2] + [108 + 1, 208 + 1] ) -r""" -|pid| representation of :data:`unified_evol_basis`. +r"""|pid| representation of :data:`unified_evol_basis`. The notation used for the non singlet compunents is the following: pid_ns(u) = pid_ns + 1, pid_ns(d) = pid_ns + 2. @@ -157,9 +154,7 @@ ) anomalous_dimensions_basis = full_labels -r""" -Sorted elements in Anomalous Dimensions Basis as :obj:`str`. -""" +r"""Sorted elements in Anomalous Dimensions Basis as :obj:`str`.""" matching_hplus_pid = 90 matching_hminus_pid = 91 @@ -182,9 +177,8 @@ [0, -5, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, -5], ] ) -""" -Basis rotation matrix between :doc:`Flavor Basis and Evolution Basis `. -""" +"""Basis rotation matrix between :doc:`Flavor Basis and Evolution Basis +`.""" # Tranformation from physical basis to QCDxQED evolution basis rotate_flavor_to_unified_evolution = np.array( @@ -205,9 +199,8 @@ [0, 2, 0, -1, 0, -1, 0, 0, 0, 1, 0, 1, 0, -2], ] ) -""" -Basis rotation matrix between :doc:`Flavor Basis and Unified Evolution Basis `. -""" +"""Basis rotation matrix between :doc:`Flavor Basis and Unified Evolution Basis +`.""" map_ad_to_evolution = { @@ -231,9 +224,7 @@ "V35.V35", ], } -""" -Map anomalous dimension sectors' names to their members -""" +"""Map anomalous dimension sectors' names to their members.""" map_ad_to_unified_evolution = { (21, 21): ["g.g"], @@ -276,8 +267,8 @@ def ad_projector(ad_lab, nf, qed): - """ - Build a projector (as a numpy array) for the given anomalous dimension sector. + """Build a projector (as a numpy array) for the given anomalous dimension + sector. Parameters ---------- @@ -322,8 +313,7 @@ def ad_projector(ad_lab, nf, qed): def select_light_flavors_uni_ev(ad_lab, nf): - """ - Select light flavors for a given ad_lab. + """Select light flavors for a given ad_lab. Parameters ---------- @@ -356,8 +346,8 @@ def select_light_flavors_uni_ev(ad_lab, nf): def ad_projectors(nf, qed): - """ - Build projectors tensor (as a numpy array), collecting all the individual sector projectors. + """Build projectors tensor (as a numpy array), collecting all the + individual sector projectors. Parameters ---------- @@ -379,8 +369,7 @@ def ad_projectors(nf, qed): def intrinsic_unified_evol_labels(nf): - """ - Collect all labels in the intrinsic unified evolution basis. + """Collect all labels in the intrinsic unified evolution basis. Parameters ---------- diff --git a/src/eko/beta.py b/src/eko/beta.py index 5f8f88193..df81c5849 100644 --- a/src/eko/beta.py +++ b/src/eko/beta.py @@ -1,5 +1,4 @@ -r""" -Compute the QCD beta function coefficients. +r"""Compute the QCD beta function coefficients. See :doc:`pQCD ingredients `. """ @@ -25,7 +24,6 @@ def beta_qcd_as2(nf): ------- beta_qcd_as2 : float first coefficient of the QCD beta function :math:`\\beta_qcd_as2^{n_f}` - """ beta_qcd_as2 = 11.0 / 3.0 * constants.CA - 4.0 / 3.0 * constants.TR * nf return beta_qcd_as2 @@ -48,7 +46,6 @@ def beta_qed_aem2(nf, nl): ------- beta_qed_aem2 : float first coefficient of the QED beta function :math:`\\beta_qed_aem2^{n_f}` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -73,7 +70,6 @@ def beta_qcd_as3(nf): ------- beta_qcd_as3 : float second coefficient of the QCD beta function :math:`\\beta_qcd_as3^{n_f}` - """ TF = constants.TR * nf b_ca2 = 34.0 / 3.0 * constants.CA * constants.CA @@ -100,7 +96,6 @@ def beta_qed_aem3(nf, nl): ------- beta_qed_aem3 : float second coefficient of the QED beta function :math:`\\beta_qed_aem3^{n_f}` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -125,7 +120,6 @@ def beta_qcd_as2aem1(nf): ------- beta_as2aem1 : float first QED correction of the QCD beta function :math:`\\beta_as2aem1^{n_f}` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -148,7 +142,6 @@ def beta_qed_aem2as1(nf): ------- beta_aem2as1 : float first QCD correction of the QED beta function :math:`\\beta_aem2as1^{n_f}` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -173,7 +166,6 @@ def beta_qcd_as4(nf): ------- beta_qcd_as4 : float third coefficient of the QCD beta function :math:`\\beta_qcd_as4^{n_f}` - """ TF = constants.TR * nf beta_qcd_as4 = ( @@ -202,7 +194,6 @@ def beta_qcd_as5(nf): ------- beta_qcd_as5 : float fourth coefficient of the QCD beta function :math:`\\beta_qcd_as5^{n_f}` - """ beta_qcd_as5 = ( 149753.0 / 6.0 @@ -229,7 +220,6 @@ def beta_qcd(k, nf): ------- beta_qcd : float beta_qcd_k(nf) - """ beta_ = 0 if k == (2, 0): @@ -264,7 +254,6 @@ def beta_qed(k, nf, nl): ------- beta_qed : float beta_qed_k(nf) - """ beta_ = 0 if k == (0, 2): @@ -293,7 +282,6 @@ def b_qcd(k, nf): ------- b_qcd : float b_qcd_k(nf) - """ return beta_qcd(k, nf) / beta_qcd((2, 0), nf) @@ -315,6 +303,5 @@ def b_qed(k, nf, nl): ------- b_qed : float b_qed_k(nf) - """ return beta_qed(k, nf, nl) / beta_qed((0, 2), nf, nl) diff --git a/src/eko/constants.py b/src/eko/constants.py index 55dff40a2..6b87017cf 100644 --- a/src/eko/constants.py +++ b/src/eko/constants.py @@ -64,7 +64,6 @@ def update_colors(nc): ---------- nc : int Number of colors - """ global NC, CA, CF # pylint: disable=global-statement @@ -85,7 +84,6 @@ def uplike_flavors(nf): Returns ------- nu : int - """ if nf > 6: raise NotImplementedError("Selected nf is not implemented") @@ -95,8 +93,7 @@ def uplike_flavors(nf): @nb.njit(cache=True) def charge_combinations(nf): - """ - Compute the combination of charges. + """Compute the combination of charges. Parameters ---------- @@ -108,7 +105,6 @@ def charge_combinations(nf): e2avg : float vue2m : float vde2m : float - """ nu = uplike_flavors(nf) nd = nf - nu diff --git a/src/eko/couplings.py b/src/eko/couplings.py index 502695b32..c627f1d41 100644 --- a/src/eko/couplings.py +++ b/src/eko/couplings.py @@ -1,11 +1,10 @@ r"""Manage running (and fixed) couplings. -Manage QCD coupling :math:`\alpha_s` and QED coupling :math:`\alpha`. -We provide an interface to access them simultaneously and provide several +Manage QCD coupling :math:`\alpha_s` and QED coupling :math:`\alpha`. We +provide an interface to access them simultaneously and provide several strategies to solve the associated |RGE|. See :doc:`pQCD ingredients `. - """ import logging @@ -281,7 +280,8 @@ def expanded_qed(ref, order, beta0, b_vec, lmu): def couplings_expanded_alphaem_running( order, couplings_ref, nf, nl, scale_from, scale_to, decoupled_running ): - r"""Compute coupled expanded expression of the couplings for running alphaem. + r"""Compute coupled expanded expression of the couplings for running + alphaem. Implement Eqs. (17-18) from :cite:`Surguladze:1996hx` @@ -320,12 +320,12 @@ def couplings_expanded_alphaem_running( if not decoupled_running: if order[1] >= 1: res_as += ( - -couplings_ref[0] ** 2 + -(couplings_ref[0] ** 2) * b_qcd((2, 1), nf) * np.log(1 + beta0_qcd * couplings_ref[1] * lmu) ) res_aem += ( - -couplings_ref[1] ** 2 + -(couplings_ref[1] ** 2) * b_qed((1, 2), nf, nl) * np.log(1 + beta0_qed * couplings_ref[0] * lmu) ) @@ -389,7 +389,8 @@ def couplings_expanded_fixed_alphaem(order, couplings_ref, nf, scale_from, scale class Couplings: - r"""Compute the strong and electromagnetic coupling constants :math:`a_s, a_{em}`. + r"""Compute the strong and electromagnetic coupling constants :math:`a_s, + a_{em}`. Note that @@ -730,7 +731,8 @@ def a( scale_to, nf_to=None, ): - r"""Compute couplings :math:`a_i(\mu_R^2) = \frac{\alpha_i(\mu_R^2)}{4\pi}`. + r"""Compute couplings :math:`a_i(\mu_R^2) = + \frac{\alpha_i(\mu_R^2)}{4\pi}`. Parameters ---------- @@ -804,7 +806,6 @@ def a_s(self, scale_to, nf_to=None): ------- a_s : float couplings :math:`a_s(\mu_R^2) = \frac{\alpha_s(\mu_R^2)}{4\pi}` - """ return self.a(scale_to, nf_to)[0] diff --git a/src/eko/evolution_operator/__init__.py b/src/eko/evolution_operator/__init__.py index fe07ade9e..0fa4e4529 100644 --- a/src/eko/evolution_operator/__init__.py +++ b/src/eko/evolution_operator/__init__.py @@ -52,9 +52,9 @@ def select_singlet_element(ker, mode0, mode1): complex singlet integration kernel element """ - k = 0 if mode0 == 100 else 1 - l = 0 if mode1 == 100 else 1 - return ker[k, l] + j = 0 if mode0 == 100 else 1 + k = 0 if mode1 == 100 else 1 + return ker[j, k] @nb.njit(cache=True) @@ -95,8 +95,7 @@ def select_QEDsinglet_element(ker, mode0, mode1): @nb.njit(cache=True) def select_QEDvalence_element(ker, mode0, mode1): - """ - Select element of the QEDvalence matrix. + """Select element of the QEDvalence matrix. Parameters ---------- @@ -715,14 +714,13 @@ def a_em(self): return (self.a[0][1], self.a[1][1]) def compute_aem_list(self): - """ - Return the list of the couplings for the different values of :math:`a_s`. + """Return the list of the couplings for the different values of + :math:`a_s`. This functions is needed in order to compute the values of :math:`a_s` and :math:`a_em` in the middle point of the :math:`mu^2` interval, and the values of :math:`a_s` at the borders of every intervals. This is needed in the running_alphaem solution. - """ ev_op_iterations = self.config["ev_op_iterations"] if self.order[1] == 0: @@ -808,7 +806,6 @@ def quad_ker(self, label, logx, areas): ------- functools.partial partially initialized integration kernel - """ return functools.partial( quad_ker, @@ -878,8 +875,8 @@ def run_op_integration( k, logx = log_grid start_time = time.perf_counter() # iterate basis functions - for l, bf in enumerate(self.int_disp): - if k == l and l == self.grid_size - 1: + for j, bf in enumerate(self.int_disp): + if k == j and j == self.grid_size - 1: continue temp_dict = {} # iterate sectors @@ -983,11 +980,11 @@ def integrate( res = pool.map(*args) # collect results - for k, row in enumerate(res): - for l, entry in enumerate(row): + for j, row in enumerate(res): + for k, entry in enumerate(row): for label, (val, err) in entry.items(): - self.op_members[label].value[k][l] = val - self.op_members[label].error[k][l] = err + self.op_members[label].value[j][k] = val + self.op_members[label].error[j][k] = err # closing comment logger.info( diff --git a/src/eko/evolution_operator/flavors.py b/src/eko/evolution_operator/flavors.py index 087294744..bbc2132df 100644 --- a/src/eko/evolution_operator/flavors.py +++ b/src/eko/evolution_operator/flavors.py @@ -1,4 +1,5 @@ -r"""The write-up of the matching conditions is given in :doc:`Matching Conditions `.""" +r"""The write-up of the matching conditions is given in :doc:`Matching +Conditions `.""" import numpy as np @@ -7,7 +8,8 @@ def pids_from_intrinsic_evol(label, nf, normalize): - r"""Obtain the list of pids with their corresponding weight, that are contributing to ``evol``. + r"""Obtain the list of pids with their corresponding weight, that are + contributing to ``evol``. The normalization of the weights is only needed for the output rotation: @@ -53,7 +55,8 @@ def pids_from_intrinsic_evol(label, nf, normalize): def get_range(evol_labels, qed): - """Determine the number of light and heavy flavors participating in the input and output. + """Determine the number of light and heavy flavors participating in the + input and output. Here, we assume that the T distributions (e.g. T15) appears *always* before the corresponding V distribution (e.g. V15). @@ -117,20 +120,21 @@ def rotate_pm_to_flavor(label): # no it has to be a quark with + or - appended if label[0] not in br.quark_names or label[1] not in ["+", "-"]: raise ValueError(f"Invalid pm label: {label}") - l = np.zeros(len(br.flavor_basis_pids)) + w = np.zeros(len(br.flavor_basis_pids)) idx = br.flavor_basis_names.index(label[0]) pid = br.flavor_basis_pids[idx] - l[idx] = 1 + w[idx] = 1 # + is +, - is - if label[1] == "+": - l[br.flavor_basis_pids.index(-pid)] = 1 + w[br.flavor_basis_pids.index(-pid)] = 1 else: - l[br.flavor_basis_pids.index(-pid)] = -1 - return l + w[br.flavor_basis_pids.index(-pid)] = -1 + return w def rotate_matching(nf, qed, inverse=False): - """Rotation between matching basis (with e.g. S,g,...V8 and c+,c-) and new true evolution basis (with S,g,...V8,T15,V15). + """Rotation between matching basis (with e.g. S,g,...V8 and c+,c-) and new + true evolution basis (with S,g,...V8,T15,V15). Parameters ---------- @@ -147,32 +151,32 @@ def rotate_matching(nf, qed, inverse=False): mapping in dot notation between the bases """ # the gluon and the photon do not care about new quarks - l = {"g.g": 1.0, "ph.ph": 1.0} + m = {"g.g": 1.0, "ph.ph": 1.0} # already active distributions q = br.quark_names[nf - 1] if not qed: for k in range(2, nf): # nf is the upper, so excluded n = k**2 - 1 - l[f"V{n}.V{n}"] = 1.0 - l[f"T{n}.T{n}"] = 1.0 + m[f"V{n}.V{n}"] = 1.0 + m[f"T{n}.T{n}"] = 1.0 # the new contributions n = nf**2 - 1 # nf is pointing upwards for tot, oth, qpm in (("S", f"T{n}", f"{q}+"), ("V", f"V{n}", f"{q}-")): if inverse: - l[f"{tot}.{tot}"] = (nf - 1.0) / nf - l[f"{tot}.{oth}"] = 1.0 / nf - l[f"{qpm}.{tot}"] = 1.0 / nf - l[f"{qpm}.{oth}"] = -1.0 / nf + m[f"{tot}.{tot}"] = (nf - 1.0) / nf + m[f"{tot}.{oth}"] = 1.0 / nf + m[f"{qpm}.{tot}"] = 1.0 / nf + m[f"{qpm}.{oth}"] = -1.0 / nf else: - l[f"{tot}.{tot}"] = 1.0 - l[f"{tot}.{qpm}"] = 1.0 - l[f"{oth}.{tot}"] = 1.0 - l[f"{oth}.{qpm}"] = -(nf - 1.0) + m[f"{tot}.{tot}"] = 1.0 + m[f"{tot}.{qpm}"] = 1.0 + m[f"{oth}.{tot}"] = 1.0 + m[f"{oth}.{qpm}"] = -(nf - 1.0) else: names = {3: "d3", 4: "u3", 5: "d8", 6: "u8"} for k in range(3, nf): - l[f"V{names[k]}.V{names[k]}"] = 1.0 - l[f"T{names[k]}.T{names[k]}"] = 1.0 + m[f"V{names[k]}.V{names[k]}"] = 1.0 + m[f"T{names[k]}.T{names[k]}"] = 1.0 for tot, totdelta, oth, qpm in ( ("S", "Sdelta", f"T{names[nf]}", f"{q}+"), ("V", "Vdelta", f"V{names[nf]}", f"{q}-"), @@ -180,34 +184,35 @@ def rotate_matching(nf, qed, inverse=False): a, b, c, d, e, f = qed_rotation_parameters(nf) if inverse: den = -b * d + a * e - c * e + b * f - l[f"{tot}.{tot}"] = -(c * e - b * f) / den - l[f"{tot}.{totdelta}"] = e / den - l[f"{tot}.{oth}"] = -b / den - l[f"{totdelta}.{tot}"] = (c * d - a * f) / den - l[f"{totdelta}.{totdelta}"] = (f - d) / den - l[f"{totdelta}.{oth}"] = (a - c) / den - l[f"{qpm}.{tot}"] = (-b * d + a * e) / den - l[f"{qpm}.{totdelta}"] = -e / den - l[f"{qpm}.{oth}"] = b / den + m[f"{tot}.{tot}"] = -(c * e - b * f) / den + m[f"{tot}.{totdelta}"] = e / den + m[f"{tot}.{oth}"] = -b / den + m[f"{totdelta}.{tot}"] = (c * d - a * f) / den + m[f"{totdelta}.{totdelta}"] = (f - d) / den + m[f"{totdelta}.{oth}"] = (a - c) / den + m[f"{qpm}.{tot}"] = (-b * d + a * e) / den + m[f"{qpm}.{totdelta}"] = -e / den + m[f"{qpm}.{oth}"] = b / den else: - l[f"{tot}.{tot}"] = 1.0 - l[f"{tot}.{qpm}"] = 1.0 - l[f"{totdelta}.{tot}"] = a - l[f"{totdelta}.{totdelta}"] = b - l[f"{totdelta}.{qpm}"] = c - l[f"{oth}.{tot}"] = d - l[f"{oth}.{totdelta}"] = e - l[f"{oth}.{qpm}"] = f + m[f"{tot}.{tot}"] = 1.0 + m[f"{tot}.{qpm}"] = 1.0 + m[f"{totdelta}.{tot}"] = a + m[f"{totdelta}.{totdelta}"] = b + m[f"{totdelta}.{qpm}"] = c + m[f"{oth}.{tot}"] = d + m[f"{oth}.{totdelta}"] = e + m[f"{oth}.{qpm}"] = f # also higher quarks do not care for k in range(nf + 1, 6 + 1): q = br.quark_names[k - 1] for sgn in "+-": - l[f"{q}{sgn}.{q}{sgn}"] = 1.0 - return l + m[f"{q}{sgn}.{q}{sgn}"] = 1.0 + return m def rotate_matching_inverse(nf, qed): - """Inverse rotation between matching basis (with e.g. S,g,...V8 and c+,c-) and new true evolution basis (with S,g,...V8,T15,V15). + """Inverse rotation between matching basis (with e.g. S,g,...V8 and c+,c-) + and new true evolution basis (with S,g,...V8,T15,V15). Parameters ---------- @@ -263,7 +268,8 @@ def qed_rotation_parameters(nf): def pids_from_intrinsic_unified_evol(label, nf, normalize): - r"""Obtain the list of pids with their corresponding weight, that are contributing to intrinsic unified evolution. + r"""Obtain the list of pids with their corresponding weight, that are + contributing to intrinsic unified evolution. Parameters ---------- diff --git a/src/eko/evolution_operator/grid.py b/src/eko/evolution_operator/grid.py index 969750389..9279e1f66 100644 --- a/src/eko/evolution_operator/grid.py +++ b/src/eko/evolution_operator/grid.py @@ -1,8 +1,8 @@ """Define operators container and computing workflow. -The first is the driver class of eko as it is the one that collects all the -previously instantiated information and does the actual computation of the Q2s. - +The first is the driver class of eko as it is the one that collects all +the previously instantiated information and does the actual computation +of the Q2s. """ import logging @@ -51,7 +51,6 @@ class OperatorGrid(sv.ScaleVariationModeMixin): config: dict q2_grid: np.ndarray managers: dict - """ def __init__( @@ -113,16 +112,15 @@ def __init__( def get_threshold_operators(self, path: List[Segment]) -> List[Operator]: """Generate the threshold operators. - This method is called everytime the OperatorGrid is asked for a grid on Q^2 - with a list of the relevant areas. - If new threshold operators need to be computed, they will be - cached in an internal dictionary. + This method is called everytime the OperatorGrid is asked for a + grid on Q^2 with a list of the relevant areas. If new threshold + operators need to be computed, they will be cached in an + internal dictionary. - The internal dictionary is self._threshold_operators and its structure is: - (q2_from, q2_to) -> eko.operators.Operator + The internal dictionary is self._threshold_operators and its + structure is: (q2_from, q2_to) -> eko.operators.Operator It computes and stores the necessary macthing operators. - """ # The base area is always that of the reference q thr_ops = [] @@ -161,8 +159,8 @@ def compute(self) -> Dict[EPoint, dict]: def generate(self, q2: EPoint) -> OpDict: r"""Compute a single EKO. - eko :math:`\mathbf E(Q^2 \leftarrow Q_0^2)` in flavor basis as numpy array. - + eko :math:`\mathbf E(Q^2 \leftarrow Q_0^2)` in flavor basis as + numpy array. """ # The lists of areas as produced by the thresholds path = self.managers.atlas.path(q2) diff --git a/src/eko/evolution_operator/matching_condition.py b/src/eko/evolution_operator/matching_condition.py index e84ef4d2e..74b288649 100644 --- a/src/eko/evolution_operator/matching_condition.py +++ b/src/eko/evolution_operator/matching_condition.py @@ -5,8 +5,7 @@ class MatchingCondition(member.OperatorBase): - """ - Matching conditions for |PDF| at threshold. + """Matching conditions for |PDF| at threshold. The continuation of the (formally) heavy non-singlet distributions with either the full singlet :math:`S` or the full valence :math:`V` @@ -22,8 +21,7 @@ def split_ad_to_evol_map( q2_thr, qed=False, ): - """ - Create the instance from the |OME|. + """Create the instance from the |OME|. Parameters ---------- diff --git a/src/eko/evolution_operator/operator_matrix_element.py b/src/eko/evolution_operator/operator_matrix_element.py index 022f80730..eeb09a246 100644 --- a/src/eko/evolution_operator/operator_matrix_element.py +++ b/src/eko/evolution_operator/operator_matrix_element.py @@ -1,4 +1,5 @@ -"""The |OME| for the non-trivial matching conditions in the |VFNS| evolution.""" +"""The |OME| for the non-trivial matching conditions in the |VFNS| +evolution.""" import copy import enum @@ -41,7 +42,6 @@ def matching_method(s: InversionMethod) -> MatchingMethods: ------- i : int representation - """ if s is not None: return MatchingMethods["BACKWARD_" + s.value.upper()] @@ -50,7 +50,8 @@ def matching_method(s: InversionMethod) -> MatchingMethods: @nb.njit(cache=True) def build_ome(A, matching_order, a_s, backward_method): - r"""Construct the matching expansion in :math:`a_s` with the appropriate method. + r"""Construct the matching expansion in :math:`a_s` with the appropriate + method. Parameters ---------- @@ -67,7 +68,6 @@ def build_ome(A, matching_order, a_s, backward_method): ------- ome : numpy.ndarray matching operator matrix - """ # to get the inverse one can use this FORM snippet # Symbol a; @@ -157,7 +157,6 @@ def quad_ker( ------- ker : float evaluated integration kernel - """ ker_base = QuadKerBase(u, is_log, logx, mode0) integrand = ker_base.integrand(areas) @@ -202,8 +201,7 @@ def quad_ker( class OperatorMatrixElement(Operator): - r""" - Internal representation of a single |OME|. + r"""Internal representation of a single |OME|. The actual matrices are computed upon calling :meth:`compute`. diff --git a/src/eko/evolution_operator/physical.py b/src/eko/evolution_operator/physical.py index f8a3545d8..e4f21a973 100644 --- a/src/eko/evolution_operator/physical.py +++ b/src/eko/evolution_operator/physical.py @@ -5,8 +5,7 @@ class PhysicalOperator(member.OperatorBase): - """ - Join several fixed flavor scheme operators together. + """Join several fixed flavor scheme operators together. - provides the connection between the 7-dimensional anomalous dimension basis and the 15-dimensional evolution basis @@ -24,8 +23,8 @@ class PhysicalOperator(member.OperatorBase): @classmethod def ad_to_evol_map(cls, op_members, nf, q2_final, qed=False): - """ - Obtain map between the 3-dimensional anomalous dimension basis and the 4-dimensional evolution basis. + """Obtain map between the 3-dimensional anomalous dimension basis and + the 4-dimensional evolution basis. .. todo:: in VFNS sometimes IC is irrelevant if nf>=4 diff --git a/src/eko/evolution_operator/quad_ker.py b/src/eko/evolution_operator/quad_ker.py index 798cebe6b..3426f353e 100644 --- a/src/eko/evolution_operator/quad_ker.py +++ b/src/eko/evolution_operator/quad_ker.py @@ -4,15 +4,11 @@ import numba as nb import numpy as np -from scipy import LowLevelCallable, integrate -from .. import basis_rotation as br from .. import interpolation from .. import scale_variations as sv from ..kernels import non_singlet as ns from ..kernels import singlet as s -from ..matchings import Segment -from ..member import OpMember logger = logging.getLogger(__name__) @@ -35,9 +31,9 @@ def select_singlet_element(ker, mode0, mode1): complex singlet integration kernel element """ - k = 0 if mode0 == 100 else 1 - l = 0 if mode1 == 100 else 1 - return ker[k, l] + j = 0 if mode0 == 100 else 1 + k = 0 if mode1 == 100 else 1 + return ker[j, k] @nb.cfunc( diff --git a/src/eko/gamma.py b/src/eko/gamma.py index 668219a75..078f1759f 100644 --- a/src/eko/gamma.py +++ b/src/eko/gamma.py @@ -18,7 +18,6 @@ def gamma_qcd_as1(): ------- gamma_0 : float first coefficient of the |QCD| gamma function :math:`\gamma_{m,0}^{n_f}` - """ return 4.0 @@ -38,7 +37,6 @@ def gamma_qcd_as2(nf): ------- gamma_1 : float second coefficient of the |QCD| gamma function :math:`\gamma_{m,1}^{n_f}` - """ return 202.0 / 3.0 - 20.0 / 9.0 * nf @@ -58,7 +56,6 @@ def gamma_qcd_as3(nf): ------- gamma_2 : float third coefficient of the |QCD| gamma function :math:`\gamma_{m,2}^{n_f}` - """ return 1249.0 - (2216.0 / 27.0 + 160.0 / 3.0 * zeta3) * nf - 140.0 / 81.0 * nf**2 @@ -78,7 +75,6 @@ def gamma_qcd_as4(nf): ------- gamma_3 : float fourth coefficient of the |QCD| gamma function :math:`\gamma_{m,3}^{n_f}` - """ return ( 4603055.0 / 162.0 @@ -111,7 +107,6 @@ def gamma(order, nf): ------- gamma : float |QCD| gamma function coefficient - """ _gamma = 0.0 diff --git a/src/eko/interpolation.py b/src/eko/interpolation.py index ef03c7fa0..2948f028d 100644 --- a/src/eko/interpolation.py +++ b/src/eko/interpolation.py @@ -32,7 +32,6 @@ class Area: kmin and kmax xgrid: numpy.ndarray Grid in x-space from which the interpolators are constructed - """ def __init__(self, lower_index, poly_number, block, xgrid): @@ -97,7 +96,6 @@ def log_evaluate_Nx(N, logx, area_list): ------- res : float kernel * inversion factor - """ res = 0.0 for a in area_list: @@ -156,7 +154,6 @@ def evaluate_Nx(N, logx, area_list): ------- res : float basis function * inversion factor - """ res = 0.0 for a in area_list: @@ -197,7 +194,6 @@ def evaluate_grid(N, is_log, logx, area_list): ------- pj : float basis function * inversion factor - """ if is_log: pj = log_evaluate_Nx(N, logx, area_list) @@ -260,7 +256,6 @@ def log_evaluate_x(x, area_list): ------- res : float basis function(x) - """ x = np.log(x) return evaluate_x(x, area_list) @@ -287,7 +282,6 @@ class BasisFunction: use logarithmic interpolation? mode_N: bool if true compiles the function on N, otherwise compiles on x - """ def __init__( @@ -332,7 +326,6 @@ def is_below_x(self, x): ------- is_below_x : bool xmax of highest area <= x? - """ # Log if needed if self._mode_log: @@ -349,7 +342,6 @@ def areas_to_const(self): ------- numpy.ndarray area config - """ # This is necessary as numba will ask for everything # to be immutable @@ -377,7 +369,6 @@ def evaluate_x(self, x): ------- res : float p(x) - """ if self.mode_N: old_call = self.callable @@ -398,7 +389,6 @@ def compile_n(self): The polynomials contain naturally factors of :math:`\exp(N * j * \ln(x_{min/max}))` which can be joined with the Mellin inversion factor. - """ if self._mode_log: self.callable = log_evaluate_Nx @@ -418,9 +408,8 @@ def __call__(self, *args, **kwargs): class XGrid: """Grid of points in :math:`x`-space. - This object represents a suitable grid of momentum fractions to be used to - evaluate the PDF over. - + This object represents a suitable grid of momentum fractions to be + used to evaluate the PDF over. """ def __init__(self, xgrid: Union[Sequence, npt.NDArray], log: bool = True): @@ -477,7 +466,6 @@ def fromcard(cls, value: list, log: bool): """Create object from theory card config. The config can invoke other grid generation methods. - """ if len(value) == 0: raise ValueError("Empty xgrid!") @@ -511,7 +499,6 @@ class InterpolatorDispatcher: Whether it is a log or linear interpolator mode_N: bool if true compiles the function on N, otherwise compiles x - """ def __init__( @@ -602,7 +589,6 @@ def get_interpolation(self, targetgrid: Union[npt.NDArray, Sequence]): interpolation matrix $R_{ij}$, where $i$ is the index over `targetgrid`, and $j$ is the index on the internal basis (the one stored in the :class:`InterpolatorDispatcher` instance) - """ # trivial? if len(targetgrid) == len(self.xgrid) and np.allclose( @@ -632,7 +618,6 @@ def to_dict(self): ------- ret : dict full grid configuration - """ ret = { "xgrid": self.xgrid.dump(), @@ -669,7 +654,6 @@ def make_grid( ------- xgrid : numpy.ndarray generated grid - """ # low if n_mid == 0: @@ -689,7 +673,8 @@ def make_grid( def lambertgrid(n_pts, x_min=1e-7, x_max=1.0): - r"""Create a smoothly spaced grid that is linear near 1 and logarithmic near 0. + r"""Create a smoothly spaced grid that is linear near 1 and logarithmic near + 0. It is generated by the relation: diff --git a/src/eko/io/__init__.py b/src/eko/io/__init__.py index 692150f7a..84cd8e9fd 100644 --- a/src/eko/io/__init__.py +++ b/src/eko/io/__init__.py @@ -1,4 +1,5 @@ """Input/output interfaces, including (de)serialization.""" -from . import manipulate from .struct import EKO, Operator + +__all__ = ["EKO", "Operator"] diff --git a/src/eko/io/access.py b/src/eko/io/access.py index 5a4d631c0..b05238d51 100644 --- a/src/eko/io/access.py +++ b/src/eko/io/access.py @@ -10,11 +10,10 @@ class ReadOnlyOperator(RuntimeError, exceptions.OutputError): """It is not possible to write on a read-only operator. - In particular, the behavior would be deceitful, since writing is possible - in-memory and even on the temporary folder. - But eventually, no writing will happen on a persistent archive, so any - modification is lost after exiting the program. - + In particular, the behavior would be deceitful, since writing is + possible in-memory and even on the temporary folder. But eventually, + no writing will happen on a persistent archive, so any modification + is lost after exiting the program. """ @@ -35,7 +34,6 @@ class ClosedOperator(RuntimeError, exceptions.OutputError): Still, the level of protection will be mild, since a thoruough protection would clutter a lot the code, requiring a lot of maintenance. "We are adult here". - """ @@ -55,7 +53,6 @@ def read(self): """Check reading permission. Reading access is always granted on open operator. - """ return self.open @@ -71,7 +68,6 @@ def assert_open(self): ------ exceptions.ClosedOperator if operator is closed - """ if not self.open: raise ClosedOperator @@ -85,7 +81,6 @@ def assert_writeable(self, msg: Optional[str] = None): see :meth:`assert_open` exceptions.ReadOnlyOperator if operators has been declared read-only - """ if msg is None: msg = "" diff --git a/src/eko/io/dictlike.py b/src/eko/io/dictlike.py index da60066b3..887c5ae30 100644 --- a/src/eko/io/dictlike.py +++ b/src/eko/io/dictlike.py @@ -1,8 +1,7 @@ """Abstraction for serializations. -A few known types are directly registered here, in order to be transparently -codified in more native structures. - +A few known types are directly registered here, in order to be +transparently codified in more native structures. """ import copy @@ -28,7 +27,6 @@ class DictLike: Some collections and scalar objects are normalized to native Python structures, in order to simplify the on-disk representation. - """ @classmethod @@ -44,7 +42,6 @@ def _from_dict(cls, dictionary): ------- DictLike instance with `dictionary` content loaded as attributes - """ dictionary = copy.deepcopy(dictionary) @@ -86,7 +83,6 @@ def from_dict(cls, dictionary): The default implementation is just :meth:`DictLike._from_dict`, but it can be safely overwritten (usually transforming the input before a call to :meth:`DictLike._from_dict` itself). - """ return cls._from_dict(dictionary) @@ -104,7 +100,6 @@ def _raw(self): ------- dict dictionary representation - """ dictionary = {} @@ -120,7 +115,6 @@ def raw(self): The default implementation is just :meth:`DictLike._raw`, but it can be safely overwritten (usually starting from :meth:`DictLike._raw` itself). - """ return self._raw() @@ -182,7 +176,6 @@ def load_enum(type_, value): ------ ValueError if `value` is not the name nor the value of any enum variant - """ try: return type_[value] diff --git a/src/eko/io/inventory.py b/src/eko/io/inventory.py index 9b25ad75d..ecd4d049d 100644 --- a/src/eko/io/inventory.py +++ b/src/eko/io/inventory.py @@ -50,7 +50,6 @@ class Inventory(Generic[H]): """Assets manager. In particular, manage autosave, autoload, and memory caching. - """ path: Path @@ -86,9 +85,8 @@ def lookup(self, stem: str, header: bool = False) -> Path: def __getitem__(self, header: H) -> Optional[Operator]: r"""Retrieve operator for given header. - If the operator is not already in memory, it will be automatically - loaded. - + If the operator is not already in memory, it will be + automatically loaded. """ self.access.assert_open() @@ -120,7 +118,6 @@ def __setitem__(self, header: H, operator: Optional[Operator]): """Set operator for given header. Header and operator are automatically dumped on disk. - """ self.access.assert_writeable() @@ -164,7 +161,6 @@ def __delitem__(self, header: H): This is only useful if the operator has been mutated in place, that in general should be avoided, since the operator should only be the result of a full computation or a library manipulation. - """ self.cache[header] = None @@ -175,7 +171,6 @@ def __iter__(self): respect to the real content on disk. To iterate the full content of the disk, just call right before :meth:`sync`. - """ yield from self.cache @@ -191,7 +186,6 @@ def sync(self): Despite the name, the operation is non-destructive, so, even if cache has been abused, nothing will be deleted nor unloaded. - """ for path in self.path.iterdir(): if path.suffix != HEADER_EXT: diff --git a/src/eko/io/items.py b/src/eko/io/items.py index 8d6d6eb2d..8da36789b 100644 --- a/src/eko/io/items.py +++ b/src/eko/io/items.py @@ -24,9 +24,8 @@ class Header: class Evolution(Header): """Information to compute an evolution operator. - It describes the evolution with a fixed number of light flavors between two - scales. - + It describes the evolution with a fixed number of light flavors + between two scales. """ origin: SquaredScale @@ -63,12 +62,12 @@ class Evolution(Header): where each lane corresponds to |DGLAP| evolution with the relative number of running flavors, and the vertical bridges are the perturbative matchings between two different "adjacent" schemes. - """ @classmethod def from_atlas(cls, segment: matchings.Segment, cliff: bool = False): - """Create instance from analogous :class:`eko.matchings.Atlas` object.""" + """Create instance from analogous :class:`eko.matchings.Atlas` + object.""" return cls(**asdict(segment), cliff=cliff) @property @@ -82,7 +81,6 @@ class Matching(Header): """Information to compute a matching operator. Describe the matching between two different flavor number schemes. - """ scale: SquaredScale @@ -91,7 +89,8 @@ class Matching(Header): @classmethod def from_atlas(cls, matching: matchings.Matching): - """Create instance from analogous :class:`eko.matchings.Atlas` object.""" + """Create instance from analogous :class:`eko.matchings.Atlas` + object.""" return cls(**asdict(matching)) @property @@ -132,15 +131,13 @@ class Operator: ---- IO works with streams in memory, in order to avoid intermediate write on disk (keep read from and write to tar file only). - """ operator: npt.NDArray """Content of the evolution operator.""" error: Optional[npt.NDArray] = None """Errors on individual operator elements (mainly used for integration - error, but it can host any kind of error). - """ + error, but it can host any kind of error).""" def save(self, stream: BinaryIO) -> bool: """Save content of operator to bytes. @@ -151,7 +148,6 @@ def save(self, stream: BinaryIO) -> bool: The returned value tells whether the operator saved contained or not the error (this control even the format, ``npz`` with errors, ``npy`` otherwise). - """ aux = io.BytesIO() if self.error is None: @@ -176,7 +172,6 @@ def load(cls, stream: BinaryIO): An input `stream` is used to load the operator from, in order to support the operation both on disk and in memory. - """ extracted_stream = io.BytesIO(lz4.frame.decompress(stream.read())) content = np.load(extracted_stream) diff --git a/src/eko/io/legacy.py b/src/eko/io/legacy.py index 41dc8af85..fdd7fbe9c 100644 --- a/src/eko/io/legacy.py +++ b/src/eko/io/legacy.py @@ -44,7 +44,6 @@ def load_tar(source: pathlib.Path, dest: pathlib.Path, errors: bool = False): dest tar name errors : whether to load also errors (default ``False``) - """ with tempfile.TemporaryDirectory() as tmpdirr: tmpdir = pathlib.Path(tmpdirr) @@ -90,7 +89,6 @@ class PseudoTheory(DictLike): Used to provide a theory for the :class:`~eko.io.struct.EKO` builder, even when the theory information is not available. - """ heavy: HeavyInfo @@ -118,7 +116,6 @@ class PseudoOperator(DictLike): Used to provide a theory for the :class:`~eko.io.struct.EKO` builder, even when the operator information is not fully available. - """ init: EPoint diff --git a/src/eko/io/manipulate.py b/src/eko/io/manipulate.py index 362c8d77d..cbcb43a02 100644 --- a/src/eko/io/manipulate.py +++ b/src/eko/io/manipulate.py @@ -31,7 +31,6 @@ def rotation( However, the check and the computation are delegated respectively to the callables `check` and `compute`. - """ if new is None: return None @@ -56,7 +55,6 @@ def xgrid_compute_rotation( By default, the roation is computed for a target xgrid. Whether the function should be used for an input xgrid, the `swap` argument should be set to `True`, in order to compute it in the other direction (i.e. the transposed). - """ if swap: new, old = old, new @@ -138,7 +136,8 @@ def flavor_reshape( targetpids: Optional[npt.NDArray] = None, inputpids: Optional[npt.NDArray] = None, ) -> Operator: - """Change the operator to have in the output targetpids and/or in the input inputpids. + """Change the operator to have in the output targetpids and/or in the input + inputpids. Parameters ---------- @@ -148,7 +147,6 @@ def flavor_reshape( target rotation specified in the flavor basis inputpids : input rotation specified in the flavor basis - """ # calling with no arguments is an error if targetpids is None and inputpids is None: @@ -219,7 +217,6 @@ def to_evol(elem: Operator, source: bool = True, target: bool = False) -> Operat rotate on the input tensor target : rotate on the output tensor - """ # rotate inputpids = br.rotate_flavor_to_evolution if source else None @@ -238,7 +235,6 @@ def to_uni_evol(elem: Operator, source: bool = True, target: bool = False) -> Op rotate on the input tensor target : rotate on the output tensor - """ # rotate inputpids = br.rotate_flavor_to_unified_evolution if source else None diff --git a/src/eko/io/metadata.py b/src/eko/io/metadata.py index c95bbfcb5..779a3ece6 100644 --- a/src/eko/io/metadata.py +++ b/src/eko/io/metadata.py @@ -30,13 +30,12 @@ class Metadata(DictLike): Unfortunately, for nested structures it is not possible to detect a change in their attributes, so a call to :meth:`update` has to be performed manually. - """ origin: EPoint """Inital scale.""" xgrid: XGrid - """Interpolation grid""" + """Interpolation grid.""" # tagging information _path: Optional[pathlib.Path] = None """Path to the open dir.""" @@ -58,7 +57,6 @@ def load(cls, path: os.PathLike): ------- bool loaded metadata - """ path = pathlib.Path(path) content = cls.from_dict( @@ -83,7 +81,6 @@ def path(self): ------ RuntimeError if path has not been initialized before - """ if self._path is None: raise RuntimeError( @@ -98,5 +95,6 @@ def path(self, value: pathlib.Path): @property def raw(self): - """Override default :meth:`DictLike.raw` representation to exclude path.""" + """Override default :meth:`DictLike.raw` representation to exclude + path.""" return self.public_raw diff --git a/src/eko/io/paths.py b/src/eko/io/paths.py index f4d5fc51f..7914491f8 100644 --- a/src/eko/io/paths.py +++ b/src/eko/io/paths.py @@ -25,7 +25,6 @@ class InternalPaths: relative to this root. In case only the relative paths are required, just create this structure with :attr:`root` equal to emtpty string or ``"."``. - """ root: pathlib.Path @@ -62,7 +61,6 @@ def operators(self): This is the one containing the actual EKO components, after computation has been performed. - """ return self.root / OPERATORSDIR diff --git a/src/eko/io/raw.py b/src/eko/io/raw.py index a71d3d745..a420d457a 100644 --- a/src/eko/io/raw.py +++ b/src/eko/io/raw.py @@ -1,9 +1,9 @@ """Utilities to manipulate unstructured IO. -The content is treated independently on the particular data content, but as -generic uknown data in an abstract file format, e.g. a tar archive or YAML data -file, as opposed to structured YAML representing a specific runcard. - +The content is treated independently on the particular data content, but +as generic uknown data in an abstract file format, e.g. a tar archive or +YAML data file, as opposed to structured YAML representing a specific +runcard. """ import os @@ -24,7 +24,6 @@ def is_within_directory(directory: os.PathLike, target: os.PathLike) -> bool: the directory where the target is supposed to be contained target: the target file to check - """ abs_dir = Path(directory).absolute() abs_target = Path(target).absolute() @@ -53,7 +52,6 @@ def safe_extractall( the tar archive object to be extracted path: the path to extract to, if not specified the current directory is used - """ if path is None: path = Path.cwd() diff --git a/src/eko/io/runcards.py b/src/eko/io/runcards.py index e9fac3893..750c4c172 100644 --- a/src/eko/io/runcards.py +++ b/src/eko/io/runcards.py @@ -47,9 +47,10 @@ class TheoryCard(DictLike): xif: float """Ratio between factorization scale and process scale.""" n3lo_ad_variation: N3LOAdVariation - """|N3LO| anomalous dimension variation: ``(gg, gq, qg, qq, nsp, nsm, nsv)``.""" + """|N3LO| anomalous dimension variation: ``(gg, gq, qg, qq, nsp, nsm, + nsv)``.""" use_fhmruvv: Optional[bool] = False - """If True use the |FHMRUVV| |N3LO| anomalous dimensions""" + """If True use the |FHMRUVV| |N3LO| anomalous dimensions.""" matching_order: Optional[Order] = None """Matching conditions perturbative order tuple, ``(QCD, QED)``.""" @@ -189,7 +190,6 @@ def new_theory(self): else: em_running = False ms = self.heavies("m%s", old) - ks = self.heavies("k%sThr", old) new["couplings"] = dict( alphas=old["alphas"], alphaem=alphaem, diff --git a/src/eko/io/struct.py b/src/eko/io/struct.py index 9ee1b73f9..a4a346d4c 100644 --- a/src/eko/io/struct.py +++ b/src/eko/io/struct.py @@ -81,7 +81,6 @@ class EKO: The computation can be stopped at any time, without the loss of any of the intermediate results. - """ recipes: Inventory[Evolution] @@ -205,7 +204,6 @@ def operator(self, ep: EPoint): To be used as a contextmanager: the operator is automatically loaded as usual, but on the closing of the context manager it is dropped from memory. - """ try: yield self[ep] @@ -232,7 +230,6 @@ def items(self): tuple couples of ``(q2, operator)``, loaded immediately before, unloaded immediately after - """ for target in self.operators: # recast to evolution point @@ -246,11 +243,11 @@ def items(self): del self[ep] def __contains__(self, ep: EPoint) -> bool: - """Check whether the operator related to the evolution point is present. + """Check whether the operator related to the evolution point is + present. 'Present' means, in this case, they are available in the :class:`EKO`. But it is telling nothing about being loaded in memory or not. - """ return Target.from_ep(ep) in self.operators @@ -267,7 +264,6 @@ def approx( ------ ValueError if multiple values are found in the neighbourhood - """ eps = np.array([ep_ for ep_ in self if ep_[1] == ep[1]]) mu2s = np.array([mu2 for mu2, _ in eps]) @@ -311,7 +307,6 @@ def deepcopy(self, path: Path): ------- EKO the copy created - """ # deepcopy is tuned to copy an open operator into a closed one, since # operators are always created closed (to avoid delegating the user to @@ -344,7 +339,6 @@ def load(cls, path: Path): :attr:`EKO.access.path` to `None`. If you want to properly load from an archive, use the :meth:`read` constructor. - """ access = AccessConfigs(None, readonly=True, open=True) @@ -371,9 +365,6 @@ def read( If the `extract` attribute is `True` the EKO is loaded from its archived format. Otherwise, the `path` is interpreted as the location of an already extracted folder. - - - """ if extract: dir_ = Path(tempfile.mkdtemp(prefix=TEMP_PREFIX)) if dest is None else dest @@ -404,7 +395,6 @@ def edit(cls, *args, **kwargs): """Read from and write on existing EKO. Alias of `EKO.read(..., readonly=False)`, see :meth:`read`. - """ return cls.read(*args, readonly=False, **kwargs) @@ -425,7 +415,6 @@ def dump(self, archive: Optional[Path] = None): ------ ValueError when trying to dump on default archive in read-only mode - """ if archive is None: self.access.assert_writeable( @@ -439,9 +428,8 @@ def dump(self, archive: Optional[Path] = None): def close(self): """Close the current object, cleaning up. - If not in read-only mode, dump to permanent storage. - Remove the temporary directory used. - + If not in read-only mode, dump to permanent storage. Remove the + temporary directory used. """ if not self.access.readonly: # clean given path, to overwrite it - default 'w'rite behavior @@ -468,7 +456,6 @@ def raw(self) -> dict: dict nested dictionary, storing all the values in the structure, but the operators themselves - """ return dict(mu2grid=self.mu2grid, metadata=self.metadata.raw) @@ -514,7 +501,6 @@ def build(self) -> EKO: ------ RuntimeError if not enough information is available (at least one card missing) - """ missing = [] for card in ["theory", "operator"]: diff --git a/src/eko/io/types.py b/src/eko/io/types.py index 20ac52db5..05c4fa7c1 100644 --- a/src/eko/io/types.py +++ b/src/eko/io/types.py @@ -47,17 +47,15 @@ class ReferenceRunning(list, Generic[T]): - it is constructed with a ``Running.typed(T, Scale)`` signature - it should always be used through the property accessors, rather then using the list itself - """ @classmethod def typed(cls, value: T, scale: Scale): """Define constructor from individual values. - This is the preferred constructor for references, since respects the - intended types of the values. - It is not the default one only to simplify (de)serialization. - + This is the preferred constructor for references, since respects + the intended types of the values. It is not the default one only + to simplify (de)serialization. """ return cls([value, scale]) diff --git a/src/eko/kernels/__init__.py b/src/eko/kernels/__init__.py index 594fbf1fa..cc64e65f9 100644 --- a/src/eko/kernels/__init__.py +++ b/src/eko/kernels/__init__.py @@ -30,6 +30,5 @@ def ev_method(s: EvolutionMethod) -> EvoMethods: ------- i : int representation - """ return EvoMethods[s.value.upper().replace("-", "_")] diff --git a/src/eko/kernels/as4_evolution_integrals.py b/src/eko/kernels/as4_evolution_integrals.py index e33b14511..3be1f8ecf 100644 --- a/src/eko/kernels/as4_evolution_integrals.py +++ b/src/eko/kernels/as4_evolution_integrals.py @@ -21,7 +21,6 @@ def roots(b_list): ------- list list of complex roots - """ b1, b2, b3 = b_list d1 = -(b2**2) + 3 * b1 * b3 @@ -59,7 +58,6 @@ def derivative(r, b_list): ------- float : evaluated derivative - """ b1, b2, b3 = b_list return b1 + 2 * b2 * r + 3 * b3 * r**2 @@ -92,7 +90,6 @@ def j33_exact(a1, a0, beta0, b_list, roots): ------- float evaluated integral - """ integral = 0 for r in roots: @@ -127,7 +124,6 @@ def j23_exact(a1, a0, beta0, b_list, roots): ------- float evaluated integral - """ integral = 0 for r in roots: @@ -162,7 +158,6 @@ def j13_exact(a1, a0, beta0, b_list, roots): ------- float evaluated integral - """ integral = 0 for r in roots: @@ -197,7 +192,6 @@ def j03_exact(j12, j13, j23, j33, b_list): ------- float evaluated integral - """ b1, b2, b3 = b_list return j12 - b1 * j13 - b2 * j23 - b3 * j33 @@ -225,7 +219,6 @@ def j33_expanded(a1, a0, beta0): ------- float evaluated integral - """ return 1 / (3 * beta0) * (a1**3 - a0**3) @@ -254,7 +247,6 @@ def j23_expanded(a1, a0, beta0, b_list): ------- float evaluated integral - """ b1 = b_list[0] return 1 / beta0 * (1 / 2 * (a1**2 - a0**2) - b1 / 3 * (a1**3 - a0**3)) @@ -284,7 +276,6 @@ def j13_expanded(a1, a0, beta0, b_list): ------- float evaluated integral - """ b1, b2, _ = b_list return (1 / beta0) * ( @@ -322,6 +313,5 @@ def j03_expanded(j12, j13, j23, j33, b_list): See Also -------- j03_exact - """ return j03_exact(j12, j13, j23, j33, b_list) diff --git a/src/eko/kernels/evolution_integrals.py b/src/eko/kernels/evolution_integrals.py index 144a54d64..7a48ef738 100644 --- a/src/eko/kernels/evolution_integrals.py +++ b/src/eko/kernels/evolution_integrals.py @@ -15,8 +15,7 @@ @nb.njit(cache=True) def j12(a1, a0, beta0): - r""" - :math:`j^{(1,2)}` exact evolution integral. + r""":math:`j^{(1,2)}` exact evolution integral. .. math:: j^{(1,2)}(a_s,a_s^0) = \int\limits_{a_s^0}^{a_s} \frac{da_s'}{\beta_0 a_s'} @@ -41,8 +40,7 @@ def j12(a1, a0, beta0): @nb.njit(cache=True) def j23_exact(a1, a0, beta0, b_vec): - r""" - :math:`j^{(2,3)}` exact evolution integral. + r""":math:`j^{(2,3)}` exact evolution integral. .. math:: j^{(1,1)}(a_s,a_s^0) = \int\limits_{a_s^0}^{a_s}\!da_s'\, @@ -71,8 +69,7 @@ def j23_exact(a1, a0, beta0, b_vec): @nb.njit(cache=True) def j23_expanded(a1, a0, beta0): - r""" - :math:`j^{(2,3)}` expanded evolution integral. + r""":math:`j^{(2,3)}` expanded evolution integral. .. math:: j^{(2,3)}_{exp}(a_s,a_s^0) = \frac 1 {\beta_0}(a_s - a_s^0) @@ -96,8 +93,7 @@ def j23_expanded(a1, a0, beta0): @nb.njit(cache=True) def j13_exact(a1, a0, beta0, b_vec): - r""" - :math:`j^{(1,3)}` exact evolution integral. + r""":math:`j^{(1,3)}` exact evolution integral. .. math:: j^{(1,3)}(a_s,a_s^0) = \int\limits_{a_s^0}^{a_s}\!da_s'\, @@ -126,8 +122,7 @@ def j13_exact(a1, a0, beta0, b_vec): @nb.njit(cache=True) def j13_expanded(a1, a0, beta0, b_vec): - r""" - :math:`j^{(1,3)}` expanded evolution integral. + r""":math:`j^{(1,3)}` expanded evolution integral. .. math:: j^{(1,3)}_{exp}(a_s,a_s^0) = j^{(0,0)}(a_s,a_s^0) - b_1 j^{(2,3)}_{exp}(a_s,a_s^0) @@ -154,8 +149,7 @@ def j13_expanded(a1, a0, beta0, b_vec): @nb.njit(cache=True) def j34_exact(a1, a0, beta0, b_vec): - r""" - :math:`j^{(3,4)}` exact evolution integral. + r""":math:`j^{(3,4)}` exact evolution integral. .. math:: j^{(3,4)}(a_s,a_s^0) &= @@ -200,8 +194,7 @@ def j34_exact(a1, a0, beta0, b_vec): @nb.njit(cache=True) def j24_exact(a1, a0, beta0, b_vec): - r""" - :math:`j^{(2,4)}` exact evolution integral. + r""":math:`j^{(2,4)}` exact evolution integral. .. math:: j^{(1,2)}(a_s,a_s^0) &= \int\limits_{a_s^0}^{a_s}\!da_s'\,\frac{a_s'^2}{\beta_0 a_s'^2 + \beta_1 a_s'^3 + \beta_2 a_s'^4}\\ @@ -239,8 +232,7 @@ def j24_exact(a1, a0, beta0, b_vec): @nb.njit(cache=True) def j14_exact(a1, a0, beta0, b_vec): - r""" - :math:`j^{(1,4)}` exact evolution integral. + r""":math:`j^{(1,4)}` exact evolution integral. .. math:: j^{(0,2)}(a_s,a_s^0) &= \int\limits_{a_s^0}^{a_s}\!da_s'\, @@ -276,8 +268,7 @@ def j14_exact(a1, a0, beta0, b_vec): @nb.njit(cache=True) def j34_expanded(a1, a0, beta0): - r""" - :math:`j^{(3,4)}` expanded evolution integral. + r""":math:`j^{(3,4)}` expanded evolution integral. .. math:: j^{(2,2)}_{exp}(a_s,a_s^0) = \frac{1}{2 \beta_0} \left( a_s^2 - (a_s^0)^{2} \right) @@ -301,8 +292,7 @@ def j34_expanded(a1, a0, beta0): @nb.njit(cache=True) def j24_expanded(a1, a0, beta0, b_vec): - r""" - :math:`j^{(2,4)}` expanded evolution integral. + r""":math:`j^{(2,4)}` expanded evolution integral. .. math:: j^{(2,4)}_{exp}(a_s,a_s^0) = \frac{1}{\beta_0}\left[ a_s - a_s^0 - @@ -330,8 +320,7 @@ def j24_expanded(a1, a0, beta0, b_vec): @nb.njit(cache=True) def j14_expanded(a1, a0, beta0, b_vec): - r""" - :math:`j^{(1,4)}` expanded evolution integral. + r""":math:`j^{(1,4)}` expanded evolution integral. .. math:: j^{(1,4)}_{exp}(a_s,a_s^0) = j^{(0,0)}(a_s,a_s^0) - b_1 j^{(2,4)}_{exp}(a_s,a_s^0) diff --git a/src/eko/kernels/non_singlet.py b/src/eko/kernels/non_singlet.py index 15b913438..f40ec7d40 100644 --- a/src/eko/kernels/non_singlet.py +++ b/src/eko/kernels/non_singlet.py @@ -26,7 +26,6 @@ def U_vec(gamma_ns, beta, order): ------- np.ndarray U vector - """ U = np.zeros(order[0], dtype=np.complex_) beta0 = beta[0] @@ -204,7 +203,6 @@ def n3lo_expanded(gamma_ns, a1, a0, beta): ------- complex |N3LO| non-singlet expanded EKO - """ beta0 = beta[0] b_list = [betas / beta0 for betas in beta[1:]] @@ -239,7 +237,6 @@ def n3lo_exact(gamma_ns, a1, a0, beta): ------- complex |N3LO| non-singlet exact EKO - """ beta0 = beta[0] b_list = [betas / beta0 for betas in beta[1:]] @@ -279,7 +276,6 @@ def eko_ordered_truncated(gamma_ns, a1, a0, beta, order, ev_op_iterations): ------- complex non-singlet ordered truncated EKO - """ a_steps = np.geomspace(a0, a1, 1 + ev_op_iterations) U = U_vec(gamma_ns, beta, order) @@ -319,7 +315,6 @@ def eko_truncated(gamma_ns, a1, a0, beta, order, ev_op_iterations): ------- complex non-singlet truncated EKO - """ a_steps = np.geomspace(a0, a1, 1 + ev_op_iterations) U = U_vec(gamma_ns, beta, order) @@ -373,7 +368,6 @@ def dispatcher( ------- complex non-singlet EKO - """ betalist = [beta.beta_qcd((2 + i, 0), nf) for i in range(order[0])] # use always exact in LO diff --git a/src/eko/kernels/non_singlet_qed.py b/src/eko/kernels/non_singlet_qed.py index d81d5076b..b8c42aad2 100644 --- a/src/eko/kernels/non_singlet_qed.py +++ b/src/eko/kernels/non_singlet_qed.py @@ -46,7 +46,6 @@ def apply_qed(gamma_pure_qed, mu2_from, mu2_to): ------- exp : float pure QED evolution kernel - """ return np.exp(gamma_pure_qed * np.log(mu2_from / mu2_to)) diff --git a/src/eko/kernels/singlet.py b/src/eko/kernels/singlet.py index e637af046..96f02a972 100644 --- a/src/eko/kernels/singlet.py +++ b/src/eko/kernels/singlet.py @@ -470,7 +470,8 @@ def sum_u(uvec, a): def eko_perturbative( gamma_singlet, a1, a0, beta, order, ev_op_iterations, ev_op_max_order, is_exact ): - """Singlet |NLO|,|NNLO| or |N3LO| perturbative EKO, depending on which r is passed. + """Singlet |NLO|,|NNLO| or |N3LO| perturbative EKO, depending on which r is + passed. Parameters ---------- diff --git a/src/eko/kernels/valence_qed.py b/src/eko/kernels/valence_qed.py index 186c70219..8b83e1917 100644 --- a/src/eko/kernels/valence_qed.py +++ b/src/eko/kernels/valence_qed.py @@ -17,8 +17,7 @@ def dispatcher( ev_op_iterations, _ev_op_max_order, ): - """ - Determine used kernel and call it. + """Determine used kernel and call it. Parameters ---------- diff --git a/src/eko/matchings.py b/src/eko/matchings.py index 270581c23..0efdaa6fd 100644 --- a/src/eko/matchings.py +++ b/src/eko/matchings.py @@ -45,7 +45,6 @@ class Matching: The meaning of the flavor index `hq` is the PID of the corresponding heavy quark. - """ scale: SquaredScale @@ -59,9 +58,8 @@ class Matching: class Atlas: r"""Holds information about the matching scales. - These scales are the :math:`Q^2` has to pass in order to get there from a - given :math:`Q^2_{ref}`. - + These scales are the :math:`Q^2` has to pass in order to get there + from a given :math:`Q^2_{ref}`. """ def __init__(self, matching_scales: MatchingScales, origin: EPoint): @@ -91,7 +89,6 @@ def ffns(cls, nf: int, mu2: SquaredScale): from below. The origin is set with that number of flavors. - """ matching_scales = MatchingScales([0] * (nf - 3) + [np.inf] * (6 - nf)) origin = (mu2, nf) @@ -137,7 +134,6 @@ def path(self, target: EPoint) -> Path: Since the only task required to determine a path is interleaving the correct matching scales, this is done by slicing the walls. - """ mu20, nf0 = self.origin mu2f, nff = self.normalize(target) @@ -158,7 +154,6 @@ def matched_path(self, target: EPoint) -> MatchedPath: In practice, just a wrapper around :meth:`path` adding the intermediate matchings. - """ path = self.path(target) inverse = is_downward_path(path) @@ -187,7 +182,6 @@ def nf_default(mu2: SquaredScale, atlas: Atlas) -> FlavorsNumber: So, the flow is defined starting with 3 flavors below the charm matching, and increasing by one every time a matching scale is passed while increasing the scale. - """ ref_idx = np.digitize(mu2, atlas.walls) return int(2 + ref_idx) @@ -202,7 +196,6 @@ def is_downward_path(path: Path) -> bool: :class:`Segment`, note this can be different from each :attr:`Segment.is_downward` - in :math:`\mu^2`, when just one single :class:`Segment` is given - """ if len(path) == 1: return path[0].is_downward @@ -229,6 +222,5 @@ def lepton_number(q2): ------- int : Number of leptons - """ return 3 if q2 > MTAU**2 else 2 diff --git a/src/eko/mellin.py b/src/eko/mellin.py index 4302dae01..4aa15d5e1 100644 --- a/src/eko/mellin.py +++ b/src/eko/mellin.py @@ -15,7 +15,6 @@ the non-singlet integrals and by :math:`r = \frac{2}{5} \frac{16}{1 - \ln(x)}, o = 1` for the singlet sector. Note that the non-singlet kernels evolve poles only up to :math:`N=0` whereas the singlet kernels have poles up to :math:`N=1`. - """ import numba as nb @@ -44,7 +43,6 @@ def Talbot_path(t, r, o): ------- path : complex Talbot path - """ theta = np.pi * (2.0 * t - 1.0) re = 0.0 @@ -77,7 +75,6 @@ def Talbot_jac(t, r, _o): ------- jac : complex derivative of Talbot path - """ theta = np.pi * (2.0 * t - 1.0) re = 0.0 @@ -92,7 +89,8 @@ def Talbot_jac(t, r, _o): @nb.njit(cache=True) def line_path(t, m, c): - r"""Compute textbook path, i.e. a straight line parallel to the imaginary axis. + r"""Compute textbook path, i.e. a straight line parallel to the imaginary + axis. .. math:: p_{\text{line}}(t) = c + m \cdot (2t - 1) @@ -110,7 +108,6 @@ def line_path(t, m, c): ------- path : complex Textbook path - """ return complex(c, m * (2 * t - 1)) @@ -135,7 +132,6 @@ def line_jac(_t, m, _c): ------- jac : complex derivative of Textbook path - """ return complex(0, m * 2) @@ -162,7 +158,6 @@ def edge_path(t, m, c, phi): ------- path : complex Edged path - """ if t < 0.5: # turning point: path is not differentiable in this point return c + (0.5 - t) * m * np.exp(complex(0, -phi)) @@ -191,7 +186,6 @@ def edge_jac(t, m, _c, phi): ------- path : complex Derivative of edged path - """ if t < 0.5: # turning point: jacobian is not continuous here return -m * np.exp(complex(0, -phi)) @@ -217,7 +211,6 @@ class Path: Mellin inversion point axis_offset: bool add offset on the real axis - """ def __init__(self, t, logx, axis_offset): diff --git a/src/eko/member.py b/src/eko/member.py index f6aa44d36..0cdf68d4c 100644 --- a/src/eko/member.py +++ b/src/eko/member.py @@ -11,8 +11,7 @@ class OpMember: - """ - A single operator for a specific element in evolution basis. + """A single operator for a specific element in evolution basis. This class provide some basic mathematical operations such as products. It can also be applied to a pdf vector via :meth:`apply_pdf`. @@ -25,7 +24,6 @@ class OpMember: operator matrix error : np.array operator error matrix - """ def __init__(self, value, error): @@ -49,7 +47,6 @@ def id_like(cls, other): ------- cls : 1 all spaces - """ len_xgrid = other.value.shape[0] return cls(np.eye(len_xgrid), np.zeros((len_xgrid, len_xgrid))) @@ -113,7 +110,6 @@ class MemberName: ---------- name : str operator name - """ def __init__(self, name): @@ -160,7 +156,6 @@ class OperatorBase: mapping of :class:`MemberName` onto :class:`OpMember` q2_final : float final scale - """ def __init__(self, op_members, q2_final): @@ -182,7 +177,6 @@ def promote_names(cls, op_members, q2_final): mapping of :data:`str` onto :class:`OpMember` q2_final : float final scale - """ # map key to MemberName opms = {} @@ -202,7 +196,6 @@ def __matmul__(self, other): ------- p : PhysicalOperator self @ other - """ if not isinstance(other, OperatorBase): raise ValueError("Can only multiply with another OperatorBase") @@ -227,7 +220,6 @@ def operation(self, other): ------- callable : operation to perform (np.matmul or np.multiply) - """ if isinstance(self, ScalarOperator) or isinstance(other, ScalarOperator): return operator.mul @@ -250,7 +242,6 @@ def operator_multiply(left, right, operation): ------- dict new operator members dictionary - """ # prepare paths new_oms = {} @@ -275,7 +266,6 @@ def to_flavor_basis_tensor(self, qed: bool): fraction operator space. If `qed` is passed, the unified intrinsic basis is used. - """ nf_in, nf_out = flavors.get_range(self.op_members.keys(), qed) len_pids = len(br.flavor_basis_pids) diff --git a/src/eko/msbar_masses.py b/src/eko/msbar_masses.py index 63e1b72d1..4dc28fd1f 100644 --- a/src/eko/msbar_masses.py +++ b/src/eko/msbar_masses.py @@ -37,7 +37,6 @@ def ker_exact(a0, a1, order, nf): .. math:: k_{exact} = e^{-\int_{a_s(\mu_{h,0}^2)}^{a_s(\mu^2)}\gamma_m(a_s)/ \beta(a_s)da_s} - """ b_vec = [beta_qcd((2, 0), nf)] g_vec = [gamma(1, nf)] @@ -101,7 +100,6 @@ def ker_expanded(a0, a1, order, nf): & + \frac{a_s^3}{6} [ -2 b_3 c_0 - b_1^3 c_0 (1 + c_0) (2 + c_0) - 2 b_2 c_1 \\ & - 3 b_2 c_0 c_1 + b_1^2 (2 + 3 c_0 (2 + c_0)) c_1 + c_1^3 + 3 c_1 c_2 \\ & + b_1 (b_2 c_0 (4 + 3 c_0) - 3 (1 + c_0) c_1^2 - (2 + 3 c_0) c_2) + 2 c_3 ] - """ b0 = beta_qcd((2, 0), nf) c0 = gamma(1, nf) / b0 @@ -165,7 +163,6 @@ def ker_dispatcher(q2_to, q2m_ref, strong_coupling, xif2, nf): ------- ker : Expanded or exact |MSbar| kernel - """ a0 = strong_coupling.a(q2m_ref * xif2, nf)[0] a1 = strong_coupling.a(q2_to * xif2, nf)[0] @@ -194,7 +191,6 @@ def compute_matching_coeffs_up(nf: int): ------- dict downward matching coefficient matrix - """ matching_coeffs_up = np.zeros((4, 4)) matching_coeffs_up[2, 0] = -89.0 / 27.0 @@ -224,7 +220,6 @@ def compute_matching_coeffs_down(nf: int): ------- dict downward matching coefficient matrix - """ c_up = compute_matching_coeffs_up(nf) return invert_matching_coeffs(c_up) @@ -254,7 +249,6 @@ def solve(m2_ref, q2m_ref, strong_coupling, nf_ref, xif2): ------- m2 : float :math:`m_{\overline{MS}}(\mu_2)^2` - """ def rge(m2, q2m_ref, strong_coupling, xif2, nf_ref): @@ -305,7 +299,6 @@ def evolve( ------- m2 : float :math:`m_{\overline{MS}}(\mu_2)^2` - """ matching_scales = np.array(strong_coupling.atlas.walls)[1:-1] * np.array( thresholds_ratios @@ -375,7 +368,6 @@ def compute( ------- masses : list list of |MSbar| masses squared - """ # TODO: sketch in the docs how the MSbar computation works with a figure. mu2_ref = couplings.ref[0] ** 2 diff --git a/src/eko/quantities/__init__.py b/src/eko/quantities/__init__.py index 3193b125b..8630e63bb 100644 --- a/src/eko/quantities/__init__.py +++ b/src/eko/quantities/__init__.py @@ -1,8 +1,8 @@ """Physical and internal objects. -This subpackage contains the definitions of many objects, with the purpose of -using them as type hints, but not only (at least for some of them). +This subpackage contains the definitions of many objects, with the +purpose of using them as type hints, but not only (at least for some of +them). Few related functions are also defined here. - """ diff --git a/src/eko/quantities/couplings.py b/src/eko/quantities/couplings.py index cbeb40a62..08127fdf5 100644 --- a/src/eko/quantities/couplings.py +++ b/src/eko/quantities/couplings.py @@ -5,7 +5,7 @@ from ..io.dictlike import DictLike from ..io.types import EvolutionPoint as EPoint -from ..io.types import LinearScale, ReferenceRunning, Scalar +from ..io.types import ReferenceRunning, Scalar Coupling = Scalar CouplingRef = ReferenceRunning[Coupling] @@ -15,8 +15,8 @@ class CouplingsInfo(DictLike): """Reference values for coupling constants. - Also includes further information, defining the run of the couplings. - + Also includes further information, defining the run of the + couplings. """ alphas: Coupling diff --git a/src/eko/quantities/heavy_quarks.py b/src/eko/quantities/heavy_quarks.py index 7328f0f12..3ab0c768f 100644 --- a/src/eko/quantities/heavy_quarks.py +++ b/src/eko/quantities/heavy_quarks.py @@ -7,7 +7,7 @@ import numpy as np from ..io.dictlike import DictLike -from ..io.types import FlavorsNumber, LinearScale, ReferenceRunning, SquaredScale +from ..io.types import LinearScale, ReferenceRunning, SquaredScale FLAVORS = "cbt" @@ -82,7 +82,6 @@ class HeavyInfo(DictLike): ---- All scales and ratios in this structure are linear, so you can consider them as quantities in :math:`GeV` or ratios of them. - """ masses: HeavyQuarkMasses @@ -90,7 +89,7 @@ class HeavyInfo(DictLike): masses_scheme: QuarkMassScheme """Scheme used to specify heavy quark masses.""" matching_ratios: MatchingRatios - """Matching scale of heavy quark masses""" + """Matching scale of heavy quark masses.""" @property def squared_ratios(self) -> List[float]: diff --git a/src/eko/runner/__init__.py b/src/eko/runner/__init__.py index 1c331d17b..14351b7f6 100644 --- a/src/eko/runner/__init__.py +++ b/src/eko/runner/__init__.py @@ -34,7 +34,6 @@ def solve( Note ---- For further information about EKO inputs and output see :doc:`/code/IO` - """ # TODO: drop this legacy.Runner(theory_card, operators_card, path).compute() diff --git a/src/eko/runner/legacy.py b/src/eko/runner/legacy.py index 44f91670b..56a9242f8 100644 --- a/src/eko/runner/legacy.py +++ b/src/eko/runner/legacy.py @@ -23,7 +23,6 @@ class Runner: ---------- setup : dict input configurations - """ banner = commons.BANNER @@ -44,7 +43,6 @@ def __init__( operator specific options path : path where to store the computed operator - """ new_theory, new_operator = update_runcards(theory_card, operators_card) @@ -95,7 +93,6 @@ def compute(self): 1. evolution is performed, computing the evolution operator in an internal flavor and x-space basis 2. bases manipulations specified in the runcard are applied - """ with EKO.edit(self.path) as eko: # add all operators diff --git a/src/eko/runner/managed.py b/src/eko/runner/managed.py index c50012ffd..54101d990 100644 --- a/src/eko/runner/managed.py +++ b/src/eko/runner/managed.py @@ -1,14 +1,14 @@ """Fully managed runner. -This is an automated runner, mainly suggested for small EKOs computations. +This is an automated runner, mainly suggested for small EKOs +computations. -The primitives used here to compute the various pieces are part of the public -interface, and should be directly used to manage a more complex run for a -considebaly large operator. - -Thus, parallelization and multi-node execution is possible using EKO primitives, -but not automatically performed. +The primitives used here to compute the various pieces are part of the +public interface, and should be directly used to manage a more complex +run for a considebaly large operator. +Thus, parallelization and multi-node execution is possible using EKO +primitives, but not automatically performed. """ from pathlib import Path diff --git a/src/eko/runner/operators.py b/src/eko/runner/operators.py index a315f6964..0c75c32d1 100644 --- a/src/eko/runner/operators.py +++ b/src/eko/runner/operators.py @@ -41,9 +41,8 @@ def retrieve(ep: EvolutionPoint, eko: EKO) -> List[Operator]: def _dot4(op1: npt.NDArray, op2: npt.NDArray) -> npt.NDArray: """Dot product between rank 4 objects. - The product is performed considering them as matrices indexed by pairs, so - linearizing the indices in pairs. - + The product is performed considering them as matrices indexed by + pairs, so linearizing the indices in pairs. """ return np.einsum("aibj,bjck->aick", op1, op2) @@ -79,7 +78,6 @@ def _dotop(op1: Operator, op2: Operator) -> Operator: \max_{\sgn_{da_i}, \sgn{db_i}} (a_i + da_i)(b_i + db_i) - a_i b_i = \max_{\sgn_{da_i}, \sgn{db_i}} da_i \cdot b_i + a_i \cdot db_i + \mathcal{O}(d^2) = |da_i| \cdot |b_i| + |a_i| \cdot |db_i| + \mathcal{O}(d^2) - """ val = _dot4(op1.operator, op2.operator) @@ -105,6 +103,5 @@ def join(elements: List[Operator]) -> Operator: .. todo:: consider if reversing the path... - """ return reduce(_dotop, reversed(elements)) diff --git a/src/eko/runner/parts.py b/src/eko/runner/parts.py index 75c4d8db8..4e9d1660a 100644 --- a/src/eko/runner/parts.py +++ b/src/eko/runner/parts.py @@ -92,7 +92,6 @@ def _matching_configs(eko: EKO) -> dict: Legacy interface, make use of a dedicated object. """ - tcard = eko.theory_card ocard = eko.operator_card return dict( **_evolve_configs(eko), diff --git a/src/eko/scale_variations/__init__.py b/src/eko/scale_variations/__init__.py index 8d3f01556..0380ecd04 100644 --- a/src/eko/scale_variations/__init__.py +++ b/src/eko/scale_variations/__init__.py @@ -1,14 +1,13 @@ """Define possible scale variations schemes. -A Mathematica snippet to check the formulas is available in the -extras folder. +A Mathematica snippet to check the formulas is available in the extras +folder. """ import enum from typing import Any, Dict from ..io.types import ScaleVariationsMethod -from . import expanded, exponentiated class Modes(enum.IntEnum): @@ -31,7 +30,6 @@ def sv_mode(s: ScaleVariationsMethod) -> Modes: ------- i : int representation - """ if s is not None: return Modes[s.value] diff --git a/src/eko/scale_variations/expanded.py b/src/eko/scale_variations/expanded.py index 2192833bd..60d70a1a4 100644 --- a/src/eko/scale_variations/expanded.py +++ b/src/eko/scale_variations/expanded.py @@ -1,8 +1,9 @@ r"""Scale variation operator for the expanded scheme (``ModSV=expanded``). -The expressions can be obtained using Eqs. (3.33) and (3.38) of :cite:`AbdulKhalek:2019ihb`. -Be aware that corresponding the signs of the ingredients there are a number of differences. -However, the ultimate sign can be obtained by comparing to the exponentiated scheme in the +The expressions can be obtained using Eqs. (3.33) and (3.38) of +:cite:`AbdulKhalek:2019ihb`. Be aware that corresponding the signs of +the ingredients there are a number of differences. However, the ultimate +sign can be obtained by comparing to the exponentiated scheme in the trunctated solution. """ diff --git a/src/eko/version.py b/src/eko/version.py index f1e5fdcb8..595a15f9c 100644 --- a/src/eko/version.py +++ b/src/eko/version.py @@ -1,7 +1,6 @@ """Define versions. Both package and data versions are stored here. - """ __version__ = "0.0.0" diff --git a/src/ekobox/__init__.py b/src/ekobox/__init__.py index 8a6886c64..147a727c9 100644 --- a/src/ekobox/__init__.py +++ b/src/ekobox/__init__.py @@ -1,3 +1,5 @@ """EKO user interface package.""" from . import apply, cards, evol_pdf, info_file + +__all__ = ["apply", "cards", "evol_pdf", "info_file"] diff --git a/src/ekobox/apply.py b/src/ekobox/apply.py index bf9f2083d..8d92f9a7b 100644 --- a/src/ekobox/apply.py +++ b/src/ekobox/apply.py @@ -17,8 +17,7 @@ def apply_pdf( targetgrid=None, rotate_to_evolution_basis=False, ): - """ - Apply all available operators to the input PDFs. + """Apply all available operators to the input PDFs. Parameters ---------- @@ -68,8 +67,7 @@ class PdfResult: def apply_pdf_flavor( eko: EKO, lhapdf_like, targetgrid=None, flavor_rotation=None, labels=None ): - """ - Apply all available operators to the input PDFs. + """Apply all available operators to the input PDFs. Parameters ---------- diff --git a/src/ekobox/cards.py b/src/ekobox/cards.py index 86233c0df..295993634 100644 --- a/src/ekobox/cards.py +++ b/src/ekobox/cards.py @@ -84,7 +84,6 @@ def dump(card: RawCard, path: os.PathLike): card to dump path : str destination of the dumped card - """ with open(path, "w", encoding="utf-8") as fd: yaml.safe_dump(card, fd) @@ -102,7 +101,6 @@ def load(path) -> RawCard: ------- dict loaded card - """ with open(path, encoding="utf-8") as fd: card = yaml.safe_load(fd) diff --git a/src/ekobox/cli/__init__.py b/src/ekobox/cli/__init__.py index 8d0e22df7..353c8967c 100644 --- a/src/ekobox/cli/__init__.py +++ b/src/ekobox/cli/__init__.py @@ -1,4 +1,6 @@ """EKO CLI definition.""" -from . import convert, inspect, log, run, runcards +from . import convert, inspect, run, runcards from .base import command + +__all__ = ["convert", "inspect", "run", "runcards", "command"] diff --git a/src/ekobox/cli/convert.py b/src/ekobox/cli/convert.py index f8411bf91..260a96a91 100644 --- a/src/ekobox/cli/convert.py +++ b/src/ekobox/cli/convert.py @@ -16,8 +16,9 @@ def subcommand(old: pathlib.Path, new: Optional[pathlib.Path]): """Convert old EKO files to new format. - The OLD file path is used also for the new one, appending "-new" to its - stem, unless it is explicitly specified with the dedicated option. + The OLD file path is used also for the new one, appending "-new" to + its stem, unless it is explicitly specified with the dedicated + option. """ if new is None: new = old.parent / old.with_stem(old.stem + "-new") diff --git a/src/ekobox/cli/library.py b/src/ekobox/cli/library.py index 04cc980d7..378fa8ba0 100644 --- a/src/ekobox/cli/library.py +++ b/src/ekobox/cli/library.py @@ -21,7 +21,6 @@ def destination(dest: pathlib.Path): ------- click.option generated option - """ return click.option( "-d", diff --git a/src/ekobox/cli/run.py b/src/ekobox/cli/run.py index 44cfe216e..e85a4c76f 100644 --- a/src/ekobox/cli/run.py +++ b/src/ekobox/cli/run.py @@ -35,7 +35,6 @@ def subcommand(paths: Sequence[pathlib.Path]): - theory card: "theory.yaml" - operator card: "operator.yaml" - output: "eko.tar". - """ if len(paths) == 1: theory = paths[0] / THEORY diff --git a/src/ekobox/cli/runcards.py b/src/ekobox/cli/runcards.py index 99db353bd..a2d8fd3e7 100644 --- a/src/ekobox/cli/runcards.py +++ b/src/ekobox/cli/runcards.py @@ -12,7 +12,7 @@ _logger = logging.getLogger(__name__) DESTINATION = pathlib.Path.cwd().absolute() / "runcards" -"""Default destination for generated files""" +"""Default destination for generated files.""" option_dest = lib.destination(DESTINATION) @@ -29,7 +29,6 @@ def sub_example(destination: pathlib.Path): Pay attention that they are in no way intended as defaults, but just examples to quickstart. - """ destination.mkdir(parents=True, exist_ok=True) theory = cards.example.theory() diff --git a/src/ekobox/evol_pdf.py b/src/ekobox/evol_pdf.py index 9da6dda65..15e837736 100644 --- a/src/ekobox/evol_pdf.py +++ b/src/ekobox/evol_pdf.py @@ -25,7 +25,8 @@ def evolve_pdfs( name="Evolved_PDF", info_update=None, ): - """Evolves one or several initial_PDFs and dump the evolved PDFs in lhapdf format. + """Evolves one or several initial_PDFs and dump the evolved PDFs in lhapdf + format. Parameters ---------- @@ -121,7 +122,6 @@ def collect_blocks(evolved_PDF: dict, q2block_per_nf: dict, xgrid: list): block coordinates xgrid : x grid - """ all_blocks = [] diff --git a/src/ekobox/genpdf/__init__.py b/src/ekobox/genpdf/__init__.py index d6c427989..d30b410c2 100644 --- a/src/ekobox/genpdf/__init__.py +++ b/src/ekobox/genpdf/__init__.py @@ -4,7 +4,7 @@ import logging import pathlib import shutil -from typing import Callable, List, Optional, Union +from typing import Callable, List, Optional import numpy as np @@ -22,8 +22,7 @@ def take_data( xgrid: Optional[List[float]] = None, evolgrid: Optional[List[EPoint]] = None, ): - """ - Auxiliary function for `generate_pdf`. + """Auxiliary function for `generate_pdf`. It provides the info, the heads of the member files and the blocks to be generated to `generate_pdf`. @@ -106,8 +105,7 @@ def generate_pdf( xgrid: Optional[List[float]] = None, evolgrid: Optional[List[EPoint]] = None, ): - """ - Generate a new PDF from a parent PDF with a set of flavors. + """Generate a new PDF from a parent PDF with a set of flavors. If `parent_pdf_set` is the name of an available PDF set, it will be used as parent. In order to use the toy PDF @@ -158,7 +156,6 @@ def generate_pdf( >>> anti_qed_singlet[br.flavor_basis_pids.index(2)] = 1 >>> anti_qed_singlet[br.flavor_basis_pids.index(-2)] = 1 >>> genpdf.generate_pdf("anti_qed_singlet", [anti_qed_singlet]) - """ pathlib.Path(name).mkdir(exist_ok=True) # Checking label basis @@ -207,7 +204,6 @@ def install_pdf(name): ---------- name : str source pdf name - """ import lhapdf # pylint: disable=import-error, import-outside-toplevel diff --git a/src/ekobox/genpdf/cli.py b/src/ekobox/genpdf/cli.py index f61632829..e2c6d2e8f 100644 --- a/src/ekobox/genpdf/cli.py +++ b/src/ekobox/genpdf/cli.py @@ -10,7 +10,6 @@ def cli(): """Generate and install fake PDFs. See online documentation for a detailed explanation and examples. - """ diff --git a/src/ekobox/genpdf/export.py b/src/ekobox/genpdf/export.py index f3ca8d31d..7fbdc3a33 100644 --- a/src/ekobox/genpdf/export.py +++ b/src/ekobox/genpdf/export.py @@ -22,7 +22,6 @@ def list_to_str(ls, fmt="%.6e"): ------- str : final string - """ return " ".join([fmt % x for x in ls]) @@ -39,7 +38,6 @@ def array_to_str(ar): ------- str : final string - """ table = "" for line in ar: @@ -60,7 +58,6 @@ def dump_blocks(name, member, blocks, pdf_type=None): pdf blocks of data inherit : str str to be copied in the head of member files - """ path_name = pathlib.Path(name) target = path_name / f"{path_name.stem}_{member:04d}.dat" @@ -95,7 +92,6 @@ def dump_info(name, info): target name or path info : dict info dictionary - """ path_name = pathlib.Path(name) target = path_name / f"{path_name.stem}.info" @@ -123,7 +119,6 @@ def dump_set(name, info, member_blocks, pdf_type_list=None): blocks for all members pdf_type : list(str) list of strings to be copied in the head of member files - """ dump_info(name, info) for mem, blocks in enumerate(member_blocks): diff --git a/src/ekobox/genpdf/flavors.py b/src/ekobox/genpdf/flavors.py index 6b7d90ebe..d9ee5e6a7 100644 --- a/src/ekobox/genpdf/flavors.py +++ b/src/ekobox/genpdf/flavors.py @@ -19,7 +19,6 @@ def pid_to_flavor(pids): ------- numpy.ndarray list of reprentations for each PID - """ ps = [] zeros = np.zeros(len(br.flavor_basis_pids)) @@ -43,7 +42,6 @@ def evol_to_flavor(labels): ------- numpy.ndarray list of reprentations for each distribution - """ ps = [] for label in labels: @@ -66,7 +64,6 @@ def project(blocks, reprs): ------- list(dict) : filtered blocks - """ new_blocks = copy.deepcopy(blocks) for block in new_blocks: @@ -101,7 +98,6 @@ def is_evolution_labels(labels): ------- bool : is evolution basis - """ for label in labels: if not isinstance(label, str): @@ -123,7 +119,6 @@ def is_pid_labels(labels): ------- bool : is flavor basis - """ try: labels = np.array(labels, dtype=np.int_) diff --git a/src/ekobox/genpdf/load.py b/src/ekobox/genpdf/load.py index 988038998..e46b0f0e7 100644 --- a/src/ekobox/genpdf/load.py +++ b/src/ekobox/genpdf/load.py @@ -25,7 +25,6 @@ def load_info_from_file(pdfset_name): ------- dict info dictionary - """ import lhapdf # pylint: disable=import-error, import-outside-toplevel @@ -51,7 +50,6 @@ def load_blocks_from_file(pdfset_name, member): head of member file list(dict) : pdf blocks of data - """ import lhapdf # pylint: disable=import-error, import-outside-toplevel diff --git a/src/ekobox/mock.py b/src/ekobox/mock.py index 06ba8fae9..ee4b010f8 100644 --- a/src/ekobox/mock.py +++ b/src/ekobox/mock.py @@ -19,7 +19,6 @@ def eko_identity(shape): ------- np.array rank 5 array, representing an identity operator of the requested shape - """ i, k = np.ogrid[: shape[1], : shape[2]] eko_identity = np.zeros(shape[1:], int) diff --git a/src/ekobox/utils.py b/src/ekobox/utils.py index 5a00314e7..b5b78498f 100644 --- a/src/ekobox/utils.py +++ b/src/ekobox/utils.py @@ -33,7 +33,6 @@ def ekos_product( path : if not provided, the operation is done in-place, otherwie a new operator is written at the given path - """ # TODO: add a control on the theory (but before we need to implement # another kind of output which includes the theory and operator runcards) diff --git a/src/ekomark/benchmark/external/LHA_utils.py b/src/ekomark/benchmark/external/LHA_utils.py index f58d44d3e..867a0e2b7 100644 --- a/src/ekomark/benchmark/external/LHA_utils.py +++ b/src/ekomark/benchmark/external/LHA_utils.py @@ -1,4 +1,5 @@ -"""Implementation of :cite:`Giele:2002hx` and :cite:`Dittmar:2005ed` (NNLO and polarized).""" +"""Implementation of :cite:`Giele:2002hx` and :cite:`Dittmar:2005ed` (NNLO and +polarized).""" import pathlib @@ -71,7 +72,6 @@ def rotate_data(raw, is_ffns_nnlo=False, rotate_to_evolution_basis=False): ------- dict rotated data - """ inp = [] label_list = raw_label_list @@ -96,8 +96,8 @@ def rotate_data(raw, is_ffns_nnlo=False, rotate_to_evolution_basis=False): # s_v = c_v count twice to_evolution[3, 4] = -2 to_evolution[3, -4] = 2 - for l in label_list: - inp.append(raw[l]) + for lab in label_list: + inp.append(raw[lab]) inp = np.array(inp) flav_pdfs = np.dot(to_flavor, inp) @@ -124,7 +124,6 @@ def compute_LHA_data(theory, operators, rotate_to_evolution_basis=False): ------- dict output containing: target_xgrid, values - """ polarized = operators["polarized"] mu2grid = np.power(operators["mugrid"], 2.0) @@ -201,7 +200,6 @@ def save_initial_scale_plots_to_pdf(path, is_pol): output path is_pol : bool polarized pdf data - """ # load data if not is_pol: diff --git a/src/ekomark/benchmark/external/apfel_utils.py b/src/ekomark/benchmark/external/apfel_utils.py index 6659b3e58..06ec57fc9 100644 --- a/src/ekomark/benchmark/external/apfel_utils.py +++ b/src/ekomark/benchmark/external/apfel_utils.py @@ -11,8 +11,7 @@ def compute_apfel_data( theory, operators, pdf, skip_pdfs, rotate_to_evolution_basis=False ): - """ - Run APFEL to compute operators. + """Run APFEL to compute operators. Parameters ---------- diff --git a/src/ekomark/benchmark/external/lhapdf_utils.py b/src/ekomark/benchmark/external/lhapdf_utils.py index 40a591070..478cdb48d 100644 --- a/src/ekomark/benchmark/external/lhapdf_utils.py +++ b/src/ekomark/benchmark/external/lhapdf_utils.py @@ -8,8 +8,7 @@ def compute_LHAPDF_data( theory, operators, pdf, skip_pdfs, rotate_to_evolution_basis=False ): - """ - Run LHAPDF to compute operators. + """Run LHAPDF to compute operators. Parameters ---------- @@ -26,7 +25,6 @@ def compute_LHAPDF_data( ------- ref : dict output containing: target_xgrid, values - """ target_xgrid = operators["interpolation_xgrid"] diff --git a/src/ekomark/benchmark/external/pegasus_utils.py b/src/ekomark/benchmark/external/pegasus_utils.py index 373a3d334..860e608ff 100644 --- a/src/ekomark/benchmark/external/pegasus_utils.py +++ b/src/ekomark/benchmark/external/pegasus_utils.py @@ -6,8 +6,7 @@ def compute_pegasus_data(theory, operators, skip_pdfs, rotate_to_evolution_basis=False): - """ - Run Pegasus to compute operators. + """Run Pegasus to compute operators. Parameters ---------- diff --git a/src/ekomark/benchmark/runner.py b/src/ekomark/benchmark/runner.py index 2b003e1b3..4b8e94c4d 100644 --- a/src/ekomark/benchmark/runner.py +++ b/src/ekomark/benchmark/runner.py @@ -34,8 +34,7 @@ def __init__(self): @staticmethod def load_ocards(session, ocard_updates): - """ - Load operator cards. + """Load operator cards. Parameters ---------- @@ -57,8 +56,7 @@ def skip_pdfs(_theory): return [] def run_me(self, theory, ocard, _pdf): - """ - Run eko. + """Run eko. Parameters ---------- @@ -132,8 +130,7 @@ def run_me(self, theory, ocard, _pdf): return path def run_external(self, theory, ocard, pdf): - """ - Run external library. + """Run external library. Parameters ---------- @@ -196,8 +193,7 @@ def run_external(self, theory, ocard, pdf): ) def log(self, theory, _, pdf, me, ext): - """ - Return a proper log table. + """Return a proper log table. Parameters ---------- @@ -207,7 +203,6 @@ def log(self, theory, _, pdf, me, ext): pdf me : eko.output.Output eko output object containing all informations - """ # return a proper log table log_tabs = {} diff --git a/src/ekomark/data/__init__.py b/src/ekomark/data/__init__.py index 89fb6377b..dbb4f927a 100644 --- a/src/ekomark/data/__init__.py +++ b/src/ekomark/data/__init__.py @@ -18,7 +18,6 @@ def update_runcards( cards = update(theory, operator) assert update(*cards) == cards - """ if isinstance(theory, TheoryCard) or isinstance(operator, OperatorCard): # if one is not a dict, both have to be new cards diff --git a/src/ekomark/data/operators.py b/src/ekomark/data/operators.py index 03ad4d349..b067d0ec5 100644 --- a/src/ekomark/data/operators.py +++ b/src/ekomark/data/operators.py @@ -56,8 +56,7 @@ def build(update=None): - """ - Generate all operator card updates. + """Generate all operator card updates. Parameters ---------- @@ -81,8 +80,7 @@ def build(update=None): # db interface def load(session, updates): - """ - Load operator records from the DB. + """Load operator records from the DB. Parameters ---------- diff --git a/src/ekomark/navigator/__init__.py b/src/ekomark/navigator/__init__.py index de2b75f25..1f2a34ad5 100644 --- a/src/ekomark/navigator/__init__.py +++ b/src/ekomark/navigator/__init__.py @@ -1,4 +1,4 @@ -"""ekomark specialization of the navigator.""" +"""Ekomark specialization of the navigator.""" import argparse import pathlib diff --git a/src/ekomark/navigator/navigator.py b/src/ekomark/navigator/navigator.py index 27bcc61ef..de9244aa7 100644 --- a/src/ekomark/navigator/navigator.py +++ b/src/ekomark/navigator/navigator.py @@ -29,7 +29,6 @@ class NavigatorApp(bnav.navigator.NavigatorApp): banana configuration mode : str mode identifier - """ myname = "eko" @@ -44,7 +43,6 @@ def fill_theories(self, theo, obj): database record obj : dict to be updated pandas record - """ for f in [ "PTO", @@ -69,7 +67,6 @@ def fill_operators(self, op, obj): database record obj : dict to be updated pandas record - """ xgrid = op["interpolation_xgrid"] obj["xgrid"] = ( @@ -94,7 +91,6 @@ def fill_cache(self, cac, obj): database record obj : dict to be updated pandas record - """ vals = cac["result"]["values"] q2s = list(vals.keys()) @@ -118,7 +114,6 @@ def fill_logs(self, lg, obj): database record obj : dict to be updated pandas record - """ q2s = lg["log"].q2s crash = lg.get("_crash", None) @@ -139,7 +134,6 @@ def check_log(self, doc_hash, perc_thr=1, abs_thr=1e-6): ---------- doc_hash : hash log hash - """ dfds = self.log_as_dfd(doc_hash) log = self.get(bnav.l, doc_hash) @@ -160,7 +154,6 @@ def plot_pdfs(self, doc_hash): ---------- doc_hash : hash log hash - """ log = self.get(bnav.l, doc_hash) dfd = log["log"] @@ -206,7 +199,6 @@ def display_pdfs(self, doc_hash): ---------- doc_hash : hash log hash - """ log = self.get(bnav.l, doc_hash) directory = ( @@ -241,7 +233,6 @@ def is_valid_physical_object(name): ------- bool : is actual name? - """ return name in br.evol_basis or name in br.flavor_basis_names @@ -257,7 +248,6 @@ def compare_external(self, dfd1, dfd2): if hash the doc_hash of the cache to be loaded dfd2 : dict or hash if hash the doc_hash of the cache to be loaded - """ # load json documents id1, cache1 = self.load_dfd(dfd1, self.cache_as_dfd) diff --git a/src/ekomark/plots.py b/src/ekomark/plots.py index 5e2bee420..a80cd8530 100644 --- a/src/ekomark/plots.py +++ b/src/ekomark/plots.py @@ -31,7 +31,6 @@ def input_figure(theory, ops, pdf_name=None): ------- firstPage : matplotlib.pyplot.Figure figure - """ firstPage = plt.figure(figsize=(25, 20)) # theory @@ -90,7 +89,6 @@ def plot_dist(x, y, yerr, yref, title=None, oMx_min=1e-2, oMx_max=0.5): ------- fig : matplotlib.pyplot.figure created figure - """ np.seterr(divide="ignore", invalid="ignore") fig = plt.figure(figsize=(15, 5)) @@ -161,7 +159,6 @@ def plot_operator(var_name, op, op_err, log_operator=True, abs_operator=True): ------- fig : matplotlib.pyplot.figure created figure - """ # get # op = ret["operators"][var_name] diff --git a/src/ekore/anomalous_dimensions/__init__.py b/src/ekore/anomalous_dimensions/__init__.py index 9ad2d576a..3af746d18 100644 --- a/src/ekore/anomalous_dimensions/__init__.py +++ b/src/ekore/anomalous_dimensions/__init__.py @@ -21,7 +21,8 @@ @nb.njit(cache=True) def exp_matrix_2D(gamma_S): - r"""Compute the exponential and the eigensystem of the singlet anomalous dimension matrix. + r"""Compute the exponential and the eigensystem of the singlet anomalous + dimension matrix. Parameters ---------- @@ -44,7 +45,6 @@ def exp_matrix_2D(gamma_S): e_m : numpy.ndarray projector for the negative eigenvalue of the singlet anomalous dimension matrix :math:`\gamma_{S}(N)` - """ # compute eigenvalues det = np.sqrt( @@ -78,7 +78,6 @@ def exp_matrix(gamma): array of the eigenvalues of the matrix lambda e : numpy.ndarray projectors on the eigenspaces of the matrix gamma :math:`\gamma(N)` - """ dim = gamma.shape[0] e = np.zeros((dim, dim, dim), np.complex_) diff --git a/src/ekore/anomalous_dimensions/polarized/space_like/__init__.py b/src/ekore/anomalous_dimensions/polarized/space_like/__init__.py index 68c9dc9f6..7b0ec6794 100644 --- a/src/ekore/anomalous_dimensions/polarized/space_like/__init__.py +++ b/src/ekore/anomalous_dimensions/polarized/space_like/__init__.py @@ -34,7 +34,6 @@ def gamma_ns(order, mode, n, nf): ------- numpy.ndarray non-singlet anomalous dimensions - """ cache = c.reset() gamma_ns = np.zeros(order[0], np.complex_) @@ -80,7 +79,6 @@ def gamma_singlet(order, n, nf): ------- numpy.ndarray singlet anomalous dimensions matrices - """ cache = c.reset() gamma_s = np.zeros((order[0], 2, 2), np.complex_) diff --git a/src/ekore/anomalous_dimensions/polarized/space_like/as1.py b/src/ekore/anomalous_dimensions/polarized/space_like/as1.py index 2887fd0aa..4fa7bea93 100644 --- a/src/ekore/anomalous_dimensions/polarized/space_like/as1.py +++ b/src/ekore/anomalous_dimensions/polarized/space_like/as1.py @@ -26,7 +26,6 @@ def gamma_qg(N, nf): ------- complex |LO| polarized quark-gluon anomalous dimension :math:`\gamma_{qg}^{(0)}(N)` - """ gamma = -(N - 1) / N / (N + 1) result = 2.0 * constants.TR * 2.0 * nf * gamma @@ -48,7 +47,6 @@ def gamma_gq(N): ------- complex |LO| gluon-quark anomalous dimension :math:`\gamma_{gq}^{(0)}(N)` - """ gamma = -(N + 2) / N / (N + 1) result = 2.0 * constants.CF * gamma @@ -74,7 +72,6 @@ def gamma_gg(N, cache, nf): ------- complex |LO| gluon-gluon anomalous dimension :math:`\gamma_{gg}^{(0)}(N)` - """ S1 = c.get(c.S1, cache, N) gamma = -S1 + 2 / N / (N + 1) @@ -105,7 +102,6 @@ def gamma_singlet(N, cache, nf): ------- numpy.ndarray |LO| singlet anomalous dimension matrix :math:`\gamma_{S}^{(0)}(N)` - """ gamma_qq = gamma_ns(N, cache) gamma_S_0 = np.array( diff --git a/src/ekore/anomalous_dimensions/polarized/space_like/as2.py b/src/ekore/anomalous_dimensions/polarized/space_like/as2.py index b031f26b2..235539f9a 100644 --- a/src/ekore/anomalous_dimensions/polarized/space_like/as2.py +++ b/src/ekore/anomalous_dimensions/polarized/space_like/as2.py @@ -9,12 +9,13 @@ # Non Singlet sector is swapped from ...unpolarized.space_like.as2 import gamma_nsm as gamma_nsp -from ...unpolarized.space_like.as2 import gamma_nsp as gamma_nsm +from ...unpolarized.space_like.as2 import gamma_nsp as gamma_nsm # noqa @nb.njit(cache=True) def gamma_ps(n, nf): - r"""Compute the |NLO| polarized pure-singlet quark-quark anomalous dimension :cite:`Gluck:1995yr` (eq A.3). + r"""Compute the |NLO| polarized pure-singlet quark-quark anomalous dimension + :cite:`Gluck:1995yr` (eq A.3). Parameters ---------- @@ -27,7 +28,6 @@ def gamma_ps(n, nf): ------- complex |NLO| pure-singlet quark-quark anomalous dimension :math:`\\gamma_{ps}^{(1)}(n)` - """ gqqps1_nfcf = (2 * (n + 2) * (1 + 2 * n + n**3)) / ((1 + n) ** 3 * n**3) result = 4.0 * TR * nf * CF * gqqps1_nfcf @@ -36,7 +36,8 @@ def gamma_ps(n, nf): @nb.njit(cache=True) def gamma_qg(n, nf, cache): - r"""Compute the |NLO| polarized quark-gluon singlet anomalous dimension :cite:`Gluck:1995yr` (eq A.4). + r"""Compute the |NLO| polarized quark-gluon singlet anomalous dimension + :cite:`Gluck:1995yr` (eq A.4). Parameters ---------- @@ -51,7 +52,6 @@ def gamma_qg(n, nf, cache): ------- complex |NLO| quark-gluon singlet anomalous dimension :math:`\\gamma_{qg}^{(1)}(n)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -74,7 +74,8 @@ def gamma_qg(n, nf, cache): @nb.njit(cache=True) def gamma_gq(n, nf, cache): - r"""Compute the |NLO| polarized gluon-quark singlet anomalous dimension :cite:`Gluck:1995yr` (eq A.5). + r"""Compute the |NLO| polarized gluon-quark singlet anomalous dimension + :cite:`Gluck:1995yr` (eq A.5). Parameters ---------- @@ -89,7 +90,6 @@ def gamma_gq(n, nf, cache): ------- complex |NLO| gluon-quark singlet anomalous dimension :math:`\\gamma_{gq}^{(1)}(n)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -116,7 +116,8 @@ def gamma_gq(n, nf, cache): @nb.njit(cache=True) def gamma_gg(n, nf, cache): - r"""Compute the |NLO| polarized gluon-gluon singlet anomalous dimension :cite:`Gluck:1995yr` (eq A.6). + r"""Compute the |NLO| polarized gluon-gluon singlet anomalous dimension + :cite:`Gluck:1995yr` (eq A.6). Parameters ---------- @@ -131,7 +132,6 @@ def gamma_gg(n, nf, cache): ------- complex |NLO| gluon-quark singlet anomalous dimension :math:`\\gamma_{gq}^{(1)}(n)` - """ S1 = c.get(c.S1, cache, n) Sp1m = c.get(c.S1mh, cache, n) @@ -186,7 +186,6 @@ def gamma_singlet(n, nf, cache): ------- numpy.ndarray |NLO| singlet anomalous dimension matrix :math:`\gamma_{S}^{(1)}(N)` - """ gamma_qq = gamma_nsp(n, nf, cache) + gamma_ps(n, nf) gamma_S_0 = np.array( diff --git a/src/ekore/anomalous_dimensions/polarized/space_like/as3.py b/src/ekore/anomalous_dimensions/polarized/space_like/as3.py index 76432acbf..fd7098b53 100644 --- a/src/ekore/anomalous_dimensions/polarized/space_like/as3.py +++ b/src/ekore/anomalous_dimensions/polarized/space_like/as3.py @@ -14,7 +14,8 @@ @nb.njit(cache=True) def gamma_gg(N, nf, cache): - r"""Compute the parametrized |NNLO| gluon-gluon polarized anomalous dimension. + r"""Compute the parametrized |NNLO| gluon-gluon polarized anomalous + dimension. Implement Eq. (4.12) of :cite:`Moch:2014sna`. @@ -31,7 +32,6 @@ def gamma_gg(N, nf, cache): ------- complex |NNLO| gluon-gluon anomalous dimension :math:`\\gamma_{gg}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -91,7 +91,8 @@ def gamma_gg(N, nf, cache): @nb.njit(cache=True) def gamma_qg(N, nf, cache): - r"""Compute the parametrized |NNLO| quark-gluon polarized anomalous dimension. + r"""Compute the parametrized |NNLO| quark-gluon polarized anomalous + dimension. Implement Eq. (4.10) of :cite:`Moch:2014sna`. @@ -108,7 +109,6 @@ def gamma_qg(N, nf, cache): ------- complex |NNLO| quark-gluon anomalous dimension :math:`\\gamma_{qg}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -157,7 +157,8 @@ def gamma_qg(N, nf, cache): @nb.njit(cache=True) def gamma_gq(N, nf, cache): - r"""Compute the parametrized |NNLO| gluon-quark polarized anomalous dimension. + r"""Compute the parametrized |NNLO| gluon-quark polarized anomalous + dimension. Implement Eq. (4.11) of :cite:`Moch:2014sna`. @@ -174,7 +175,6 @@ def gamma_gq(N, nf, cache): ------- complex |NNLO| gluon-quark anomalous dimension :math:`\\gamma_{gq}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -236,7 +236,8 @@ def gamma_gq(N, nf, cache): @nb.njit(cache=True) def gamma_ps(N, nf, cache): - r"""Compute the parametrized |NNLO| pure-singlet quark-quark polarized anomalous dimension. + r"""Compute the parametrized |NNLO| pure-singlet quark-quark polarized + anomalous dimension. Implement Eq. (4.9) of :cite:`Moch:2014sna`. @@ -253,7 +254,6 @@ def gamma_ps(N, nf, cache): ------- complex |NNLO| pure-singlet quark-quark anomalous dimension :math:`\\gamma_{ps}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -347,7 +347,6 @@ def gamma_nss(N, nf, cache): complex |NNLO| valence non-singlet anomalous dimension :math:`\\gamma_{ns,s}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, N) S3 = c.get(c.S3, cache, N) @@ -404,7 +403,6 @@ def gamma_nsv(N, nf, cache): complex |NNLO| valence non-singlet anomalous dimension :math:`\\gamma_{ns,v}^{(2)}(N)` - """ return gamma_nsm(N, nf, cache) + gamma_nss(N, nf, cache) @@ -432,7 +430,6 @@ def gamma_singlet(N, nf, cache): ------- numpy.ndarray |NNLO| singlet anomalous dimension matrix :math:`\gamma_{S}^{(2)}(N)` - """ gamma_qq = gamma_nsp(N, nf, cache) + gamma_ps(N, nf, cache) gamma_S_0 = np.array( diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/__init__.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/__init__.py index 6a350f1ee..cf569d9f7 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/__init__.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/__init__.py @@ -47,7 +47,6 @@ def gamma_ns(order, mode, n, nf, n3lo_ad_variation, use_fhmruvv=False): ------- numpy.ndarray non-singlet anomalous dimensions - """ cache = c.reset() # now combine @@ -121,7 +120,6 @@ def gamma_singlet(order, n, nf, n3lo_ad_variation, use_fhmruvv=False): ------- numpy.ndarray singlet anomalous dimensions matrices - """ cache = c.reset() gamma_s = np.zeros((order[0], 2, 2), np.complex_) @@ -140,8 +138,7 @@ def gamma_singlet(order, n, nf, n3lo_ad_variation, use_fhmruvv=False): @nb.njit(cache=True) def gamma_ns_qed(order, mode, n, nf, n3lo_ad_variation, use_fhmruvv=False): - r""" - Compute the grid of the QED non-singlet anomalous dimensions. + r"""Compute the grid of the QED non-singlet anomalous dimensions. Parameters ---------- @@ -204,8 +201,8 @@ def gamma_ns_qed(order, mode, n, nf, n3lo_ad_variation, use_fhmruvv=False): @nb.njit(cache=True) def choose_ns_ad_aem1(mode, n, cache): - r""" - Select the non-singlet anomalous dimension at O(aem1) with the correct charge factor. + r"""Select the non-singlet anomalous dimension at O(aem1) with the correct + charge factor. Parameters ---------- @@ -220,7 +217,6 @@ def choose_ns_ad_aem1(mode, n, cache): ------- numpy.ndarray non-singlet anomalous dimensions - """ if mode in [10102, 10202]: return constants.eu2 * aem1.gamma_ns(n, cache) @@ -231,8 +227,8 @@ def choose_ns_ad_aem1(mode, n, cache): @nb.njit(cache=True) def choose_ns_ad_as1aem1(mode, n, cache): - r""" - Select the non-singlet anomalous dimension at O(as1aem1) with the correct charge factor. + r"""Select the non-singlet anomalous dimension at O(as1aem1) with the + correct charge factor. Parameters ---------- @@ -247,7 +243,6 @@ def choose_ns_ad_as1aem1(mode, n, cache): ------- numpy.ndarray non-singlet anomalous dimensions - """ if mode == 10102: return constants.eu2 * as1aem1.gamma_nsp(n, cache) @@ -262,8 +257,8 @@ def choose_ns_ad_as1aem1(mode, n, cache): @nb.njit(cache=True) def choose_ns_ad_aem2(mode, n, nf, cache): - r""" - Select the non-singlet anomalous dimension at O(aem2) with the correct charge factor. + r"""Select the non-singlet anomalous dimension at O(aem2) with the correct + charge factor. Parameters ---------- @@ -280,7 +275,6 @@ def choose_ns_ad_aem2(mode, n, nf, cache): ------- numpy.ndarray non-singlet anomalous dimensions - """ if mode == 10102: return constants.eu2 * aem2.gamma_nspu(n, nf, cache) @@ -295,8 +289,7 @@ def choose_ns_ad_aem2(mode, n, nf, cache): @nb.njit(cache=True) def gamma_singlet_qed(order, n, nf, n3lo_ad_variation, use_fhmruvv=False): - r""" - Compute the grid of the QED singlet anomalous dimensions matrices. + r"""Compute the grid of the QED singlet anomalous dimensions matrices. Parameters ---------- @@ -315,7 +308,6 @@ def gamma_singlet_qed(order, n, nf, n3lo_ad_variation, use_fhmruvv=False): ------- numpy.ndarray singlet anomalous dimensions matrices - """ cache = c.reset() gamma_s = np.zeros((order[0] + 1, order[1] + 1, 4, 4), np.complex_) @@ -340,8 +332,7 @@ def gamma_singlet_qed(order, n, nf, n3lo_ad_variation, use_fhmruvv=False): @nb.njit(cache=True) def gamma_valence_qed(order, n, nf, n3lo_ad_variation, use_fhmruvv=False): - r""" - Compute the grid of the QED valence anomalous dimensions matrices. + r"""Compute the grid of the QED valence anomalous dimensions matrices. Parameters ---------- @@ -361,7 +352,6 @@ def gamma_valence_qed(order, n, nf, n3lo_ad_variation, use_fhmruvv=False): ------- numpy.ndarray valence anomalous dimensions matrices - """ cache = c.reset() gamma_v = np.zeros((order[0] + 1, order[1] + 1, 2, 2), np.complex_) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/aem1.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/aem1.py index 9163d722c..0359d03e9 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/aem1.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/aem1.py @@ -23,7 +23,6 @@ def gamma_phq(N): ------- complex Leading-order photon-quark anomalous dimension :math:`\\gamma_{\\gamma q}^{(0,1)}(N)` - """ return as1.gamma_gq(N) / constants.CF @@ -47,7 +46,6 @@ def gamma_qph(N, nf): ------- complex Leading-order quark-photon anomalous dimension :math:`\\gamma_{q \\gamma}^{(0,1)}(N)` - """ return as1.gamma_qg(N, nf) / constants.TR * constants.NC @@ -67,7 +65,6 @@ def gamma_phph(nf): ------- complex Leading-order phton-photon anomalous dimension :math:`\\gamma_{\\gamma \\gamma}^{(0,1)}(N)` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -91,7 +88,6 @@ def gamma_ns(N, cache): ------- complex Leading-order non-singlet QED anomalous dimension :math:`\\gamma_{ns}^{(0,1)}(N)` - """ return as1.gamma_ns(N, cache) / constants.CF @@ -121,7 +117,6 @@ def gamma_singlet(N, nf, cache): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(0)}(N)` - """ e2avg, vue2m, vde2m, e2delta = constants.charge_combinations(nf) gamma_ph_q = gamma_phq(N) @@ -177,7 +172,6 @@ def gamma_valence(N, nf, cache): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(0)}(N)` - """ e2avg, vue2m, vde2m, e2delta = constants.charge_combinations(nf) gamma_V_01 = np.array( diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/aem2.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/aem2.py index 9c3d3ca7e..db0f01c38 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/aem2.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/aem2.py @@ -11,7 +11,8 @@ @nb.njit(cache=True) def gamma_phph(N, nf): - r"""Compute the :math:`O(a_{em}^2)` photon-photon singlet anomalous dimension. + r"""Compute the :math:`O(a_{em}^2)` photon-photon singlet anomalous + dimension. Implements Eq. (68) of :cite:`deFlorian:2016gvk`. @@ -27,7 +28,6 @@ def gamma_phph(N, nf): complex :math:`O(a_{em}^2)` photon-photon singlet anomalous dimension :math:`\\gamma_{\\gamma \\gamma}^{(0,2)}(N)` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -40,7 +40,8 @@ def gamma_phph(N, nf): @nb.njit(cache=True) def gamma_uph(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` quark-photon anomalous dimension for up quarks. + r"""Compute the :math:`O(a_{em}^2)` quark-photon anomalous dimension for up + quarks. Implements Eq. (55) of :cite:`deFlorian:2016gvk` for q=u. @@ -57,14 +58,14 @@ def gamma_uph(N, nf, cache): ------- complex :math:`O(a_{em}^2)` quark-photon anomalous dimension :math:`\\gamma_{u \\gamma}^{(0,2)}(N)` - """ return constants.eu2 * as1aem1.gamma_qph(N, nf, cache) / constants.CF @nb.njit(cache=True) def gamma_dph(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` quark-photon anomalous dimension for down quarks. + r"""Compute the :math:`O(a_{em}^2)` quark-photon anomalous dimension for + down quarks. Implements Eq. (55) of :cite:`deFlorian:2016gvk` for q=d. @@ -81,14 +82,14 @@ def gamma_dph(N, nf, cache): ------- complex :math:`O(a_{em}^2)` quark-photon anomalous dimension :math:`\\gamma_{d \\gamma}^{(0,2)}(N)` - """ return constants.ed2 * as1aem1.gamma_qph(N, nf, cache) / constants.CF @nb.njit(cache=True) def gamma_phu(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` photon-quark anomalous dimension for up quarks. + r"""Compute the :math:`O(a_{em}^2)` photon-quark anomalous dimension for up + quarks. Implements Eq. (56) of :cite:`deFlorian:2016gvk` for q=u. @@ -105,7 +106,6 @@ def gamma_phu(N, nf, cache): ------- complex :math:`O(a_{em}^2)` photon-quark anomalous dimension :math:`\\gamma_{\\gamma u}^{(0,2)}(N)` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -121,7 +121,8 @@ def gamma_phu(N, nf, cache): @nb.njit(cache=True) def gamma_phd(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` photon-quark anomalous dimension for down quarks. + r"""Compute the :math:`O(a_{em}^2)` photon-quark anomalous dimension for + down quarks. Implements Eq. (56) of :cite:`deFlorian:2016gvk` for q=d. @@ -138,7 +139,6 @@ def gamma_phd(N, nf, cache): ------- complex :math:`O(a_{em}^2)` photon-quark anomalous dimension :math:`\\gamma_{\\gamma d}^{(0,2)}(N)` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -154,7 +154,8 @@ def gamma_phd(N, nf, cache): @nb.njit(cache=True) def gamma_nspu(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` singlet-like non-singlet anomalous dimension for up quarks. + r"""Compute the :math:`O(a_{em}^2)` singlet-like non-singlet anomalous + dimension for up quarks. Implements sum of Eqs. (57-58) of :cite:`deFlorian:2016gvk` for q=u. @@ -172,7 +173,6 @@ def gamma_nspu(N, nf, cache): complex :math:`O(a_{em}^2)` singlet-like non-singlet anomalous dimension :math:`\\gamma_{ns,+,u}^{(0,2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -191,7 +191,8 @@ def gamma_nspu(N, nf, cache): @nb.njit(cache=True) def gamma_nspd(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` singlet-like non-singlet anomalous dimension for down quarks. + r"""Compute the :math:`O(a_{em}^2)` singlet-like non-singlet anomalous + dimension for down quarks. Implements sum of Eqs. (57-58) of :cite:`deFlorian:2016gvk` for q=d. @@ -209,7 +210,6 @@ def gamma_nspd(N, nf, cache): complex :math:`O(a_{em}^2)` singlet-like non-singlet anomalous dimension :math:`\\gamma_{ns,+,d}^{(0,2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -228,7 +228,8 @@ def gamma_nspd(N, nf, cache): @nb.njit(cache=True) def gamma_nsmu(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` valence-like non-singlet anomalous dimension for up quarks. + r"""Compute the :math:`O(a_{em}^2)` valence-like non-singlet anomalous + dimension for up quarks. Implements difference between Eqs. (57-58) of :cite:`deFlorian:2016gvk` for q=u. @@ -246,7 +247,6 @@ def gamma_nsmu(N, nf, cache): complex :math:`O(a_{em}^2)` valence-like non-singlet anomalous dimension :math:`\\gamma_{ns,-,u}^{(0,2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -265,7 +265,8 @@ def gamma_nsmu(N, nf, cache): @nb.njit(cache=True) def gamma_nsmd(N, nf, cache): - r"""Compute the :math:`O(a_{em}^2)` valence-like non-singlet anomalous dimension for down quarks. + r"""Compute the :math:`O(a_{em}^2)` valence-like non-singlet anomalous + dimension for down quarks. Implements difference between Eqs. (57-58) of :cite:`deFlorian:2016gvk` for q=d. @@ -283,7 +284,6 @@ def gamma_nsmd(N, nf, cache): complex :math:`O(a_{em}^2)` valence-like non-singlet anomalous dimension :math:`\\gamma_{ns,-,d}^{(0,2)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -302,7 +302,8 @@ def gamma_nsmd(N, nf, cache): @nb.njit(cache=True) def gamma_ps(N, nf): - r"""Compute the :math:`O(a_{em}^2)` pure-singlet quark-quark anomalous dimension. + r"""Compute the :math:`O(a_{em}^2)` pure-singlet quark-quark anomalous + dimension. Implements Eq. (59) of :cite:`deFlorian:2016gvk`. @@ -318,7 +319,6 @@ def gamma_ps(N, nf): complex :math:`O(a_{em}^2)` pure-singlet quark-quark anomalous dimension :math:`\\gamma_{ps}^{(0,2)}(N)` - """ result = ( -4.0 @@ -346,7 +346,6 @@ def gamma_singlet(N, nf, cache): ------- numpy.ndarray :math:`O(a_{em}^2)` singlet anomalous dimension :math:`\\gamma_{S}^{(0,2)}` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -420,7 +419,6 @@ def gamma_valence(N, nf, cache): ------- numpy.ndarray :math:`O(a_{em}^2)` valence anomalous dimension :math:`\\gamma_{V}^{(0,2)}` - """ nu = constants.uplike_flavors(nf) nd = nf - nu diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as1.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as1.py index b4c1d73ac..8daefbd70 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as1.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as1.py @@ -126,7 +126,6 @@ def gamma_singlet(N, cache, nf): ------- gamma_S_0 : numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(0)}(N)` - """ gamma_qq = gamma_ns(N, cache) gamma_S_0 = np.array( @@ -138,7 +137,8 @@ def gamma_singlet(N, cache, nf): @nb.njit(cache=True) def gamma_singlet_qed(N, cache, nf): - r"""Compute the leading-order singlet anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order singlet anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_S^{(1,0)} = \\left(\begin{array}{cccc} @@ -161,7 +161,6 @@ def gamma_singlet_qed(N, cache, nf): ------- gamma_S : numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(1,0)}(N)` - """ gamma_qq = gamma_ns(N, cache) gamma_S = np.array( @@ -178,7 +177,8 @@ def gamma_singlet_qed(N, cache, nf): @nb.njit(cache=True) def gamma_valence_qed(N, cache): - r"""Compute the leading-order valence anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order valence anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_V^{(1,0)} = \\left(\begin{array}{cc} @@ -197,7 +197,6 @@ def gamma_valence_qed(N, cache): ------- gamma_V : numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{V}^{(1,0)}(N)` - """ gamma_V = np.array( [ diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as1aem1.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as1aem1.py index 58e9fcd97..e3deaa722 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as1aem1.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as1aem1.py @@ -27,7 +27,6 @@ def gamma_phq(N, cache): ------- complex :math:`O(a_s^1a_{em}^1)` photon-quark anomalous dimension :math:`\\gamma_{\\gamma q}^{(1,1)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -74,7 +73,6 @@ def gamma_qph(N, nf, cache): ------- complex :math:`O(a_s^1a_{em}^1)` quark-photon anomalous dimension :math:`\\gamma_{q \\gamma}^{(1,1)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -118,7 +116,6 @@ def gamma_gph(N): ------- complex :math:`O(a_s^1a_{em}^1)` gluon-photon anomalous dimension :math:`\\gamma_{g \\gamma}^{(1,1)}(N)` - """ return ( constants.CF @@ -149,14 +146,14 @@ def gamma_phg(N): ------- complex :math:`O(a_s^1a_{em}^1)` photon-gluon anomalous dimension :math:`\\gamma_{\\gamma g}^{(1,1)}(N)` - """ return constants.TR / constants.CF / constants.CA * constants.NC * gamma_gph(N) @nb.njit(cache=True) def gamma_qg(N, nf, cache): - r"""Compute the :math:`O(a_s^1a_{em}^1)` quark-gluon singlet anomalous dimension. + r"""Compute the :math:`O(a_s^1a_{em}^1)` quark-gluon singlet anomalous + dimension. Implements Eq. (29) of :cite:`deFlorian:2015ujt`. @@ -175,7 +172,6 @@ def gamma_qg(N, nf, cache): complex :math:`O(a_s^1a_{em}^1)` quark-gluon singlet anomalous dimension :math:`\\gamma_{qg}^{(1,1)}(N)` - """ return ( constants.TR @@ -188,7 +184,8 @@ def gamma_qg(N, nf, cache): @nb.njit(cache=True) def gamma_gq(N, cache): - r"""Compute the :math:`O(a_s^1a_{em}^1)` gluon-quark singlet anomalous dimension. + r"""Compute the :math:`O(a_s^1a_{em}^1)` gluon-quark singlet anomalous + dimension. Implements Eq. (35) of :cite:`deFlorian:2015ujt`. @@ -204,14 +201,14 @@ def gamma_gq(N, cache): complex :math:`O(a_s^1a_{em}^1)` gluon-quark singlet anomalous dimension :math:`\\gamma_{gq}^{(1,1)}(N)` - """ return gamma_phq(N, cache) @nb.njit(cache=True) def gamma_phph(nf): - r"""Compute the :math:`O(a_s^1a_{em}^1)` photon-photon singlet anomalous dimension. + r"""Compute the :math:`O(a_s^1a_{em}^1)` photon-photon singlet anomalous + dimension. Implements Eq. (28) of :cite:`deFlorian:2015ujt`. @@ -225,7 +222,6 @@ def gamma_phph(nf): gamma_gg : complex :math:`O(a_s^1a_{em}^1)` photon-photon singlet anomalous dimension :math:`\\gamma_{\\gamma \\gamma}^{(1,1)}(N)` - """ nu = constants.uplike_flavors(nf) nd = nf - nu @@ -234,7 +230,8 @@ def gamma_phph(nf): @nb.njit(cache=True) def gamma_gg(): - r"""Compute the :math:`O(a_s^1a_{em}^1)` gluon-gluon singlet anomalous dimension. + r"""Compute the :math:`O(a_s^1a_{em}^1)` gluon-gluon singlet anomalous + dimension. Implements Eq. (31) of :cite:`deFlorian:2015ujt`. @@ -243,14 +240,14 @@ def gamma_gg(): complex :math:`O(a_s^1a_{em}^1)` gluon-gluon singlet anomalous dimension :math:`\\gamma_{gg}^{(1,1)}(N)` - """ return 4.0 * constants.TR * constants.NC @nb.njit(cache=True) def gamma_nsp(N, cache): - r"""Compute the :math:`O(a_s^1a_{em}^1)` singlet-like non-singlet anomalous dimension. + r"""Compute the :math:`O(a_s^1a_{em}^1)` singlet-like non-singlet anomalous + dimension. Implements sum of Eqs. (33-34) of :cite:`deFlorian:2015ujt`. @@ -266,7 +263,6 @@ def gamma_nsp(N, cache): gamma_nsp : complex :math:`O(a_s^1a_{em}^1)` singlet-like non-singlet anomalous dimension :math:`\\gamma_{ns,+}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -317,7 +313,8 @@ def gamma_nsp(N, cache): @nb.njit(cache=True) def gamma_nsm(N, cache): - r"""Compute the :math:`O(a_s^1a_{em}^1)` valence-like non-singlet anomalous dimension. + r"""Compute the :math:`O(a_s^1a_{em}^1)` valence-like non-singlet anomalous + dimension. Implements difference between Eqs. (33-34) of :cite:`deFlorian:2015ujt`. @@ -333,7 +330,6 @@ def gamma_nsm(N, cache): complex :math:`O(a_s^1a_{em}^1)` singlet-like non-singlet anomalous dimension :math:`\\gamma_{ns,-}^{(1,1)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -395,7 +391,6 @@ def gamma_singlet(N, nf, cache): ------- numpy.ndarray :math:`O(a_s^1a_{em}^1)` singlet anomalous dimension :math:`\\gamma_{S}^{(1,1)}(N,nf,cache)` - """ e2avg, vue2m, vde2m, e2delta = constants.charge_combinations(nf) e2_tot = nf * e2avg @@ -453,7 +448,6 @@ def gamma_valence(N, nf, cache): ------- numpy.ndarray :math:`O(a_s^1a_{em}^1)` valence anomalous dimension :math:`\\gamma_{V}^{(1,1)}(N,nf,cache)` - """ e2avg, vue2m, vde2m, e2delta = constants.charge_combinations(nf) gamma_V_11 = np.array( diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as2.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as2.py index 28f8533f4..6f60851e4 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as2.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as2.py @@ -34,7 +34,6 @@ def gamma_nsm(n, nf, cache): complex |NLO| valence-like non-singlet anomalous dimension :math:`\\gamma_{ns,-}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -79,7 +78,6 @@ def gamma_nsp(n, nf, cache): complex |NLO| singlet-like non-singlet anomalous dimension :math:`\\gamma_{ns,+}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -118,7 +116,6 @@ def gamma_ps(n, nf): complex |NLO| pure-singlet quark-quark anomalous dimension :math:`\\gamma_{ps}^{(1)}(N)` - """ # fmt: off gqqps1_nfcf = (-4*(2 + n*(5 + n))*(4 + n*(4 + n*(7 + 5*n))))/((-1 + n)*np.power(n,3)*np.power(1 + n,3)*np.power(2 + n,2)) # pylint: disable=line-too-long @@ -147,7 +144,6 @@ def gamma_qg(n, nf, cache): complex |NLO| quark-gluon singlet anomalous dimension :math:`\\gamma_{qg}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -182,7 +178,6 @@ def gamma_gq(n, nf, cache): complex |NLO| gluon-quark singlet anomalous dimension :math:`\\gamma_{gq}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -220,7 +215,6 @@ def gamma_gg(n, nf, cache): complex |NLO| gluon-gluon singlet anomalous dimension :math:`\\gamma_{gg}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, n) Sp1p = c.get(c.S1h, cache, n) @@ -261,7 +255,6 @@ def gamma_singlet(n, nf, cache): ------- numpy.ndarray |NLO| singlet anomalous dimension matrix :math:`\\gamma_{S}^{(1)}(N)` - """ gamma_qq = gamma_nsp(n, nf, cache) + gamma_ps(n, nf) gamma_S_0 = np.array( @@ -276,7 +269,8 @@ def gamma_singlet(n, nf, cache): @nb.njit(cache=True) def gamma_singlet_qed(N, nf, cache): - r"""Compute the leading-order singlet anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order singlet anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_S^{(2,0)} = \\left(\begin{array}{cccc} @@ -299,7 +293,6 @@ def gamma_singlet_qed(N, nf, cache): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(2,0)}(N)` - """ gamma_ns_p = gamma_nsp(N, nf, cache) gamma_qq = gamma_ns_p + gamma_ps(N, nf) @@ -317,7 +310,8 @@ def gamma_singlet_qed(N, nf, cache): @nb.njit(cache=True) def gamma_valence_qed(N, nf, cache): - r"""Compute the leading-order valence anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order valence anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_V^{(2,0)} = \\left(\begin{array}{cc} @@ -338,7 +332,6 @@ def gamma_valence_qed(N, nf, cache): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{V}^{(2,0)}(N)` - """ gamma_V = np.array( [ diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as3.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as3.py index 98705f491..b88c52516 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as3.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as3.py @@ -1,9 +1,9 @@ -""" -Compute the |NNLO| Altarelli-Parisi splitting kernels. +"""Compute the |NNLO| Altarelli-Parisi splitting kernels. The expression have been obtained from :cite:`Moch:2004pa,Vogt:2004ns`. -Note that the QCD colour factors have been hard-wired in the parametrizations. +Note that the QCD colour factors have been hard-wired in the +parametrizations. """ import numba as nb @@ -34,7 +34,6 @@ def gamma_nsm(n, nf, cache): complex |NNLO| valence-like non-singlet anomalous dimension :math:`\\gamma_{ns,-}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -241,7 +240,6 @@ def gamma_ps(n, nf, cache): complex |NNLO| pure-singlet quark-quark anomalous dimension :math:`\\gamma_{ps}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -313,7 +311,6 @@ def gamma_qg(n, nf, cache): complex |NNLO| quark-gluon singlet anomalous dimension :math:`\\gamma_{qg}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -387,7 +384,6 @@ def gamma_gq(n, nf, cache): complex |NNLO| gluon-quark singlet anomalous dimension :math:`\\gamma_{gq}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -477,7 +473,6 @@ def gamma_gg(n, nf, cache): complex |NNLO| gluon-gluon singlet anomalous dimension :math:`\\gamma_{gg}^{(2)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -570,7 +565,6 @@ def gamma_singlet(N, nf, cache): numpy.ndarray |NNLO| singlet anomalous dimension matrix :math:`\\gamma_{S}^{(2)}(N)` - """ gamma_qq = gamma_nsp(N, nf, cache) + gamma_ps(N, nf, cache) gamma_S_0 = np.array( @@ -585,7 +579,8 @@ def gamma_singlet(N, nf, cache): @nb.njit(cache=True) def gamma_singlet_qed(N, nf, cache): - r"""Compute the leading-order singlet anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order singlet anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_S^{(3,0)} = \\left(\begin{array}{cccc} @@ -608,7 +603,6 @@ def gamma_singlet_qed(N, nf, cache): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(3,0)}(N)` - """ gamma_np_p = gamma_nsp(N, nf, cache) gamma_qq = gamma_np_p + gamma_ps(N, nf, cache) @@ -626,7 +620,8 @@ def gamma_singlet_qed(N, nf, cache): @nb.njit(cache=True) def gamma_valence_qed(N, nf, cache): - r"""Compute the leading-order valence anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order valence anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_V^{(3,0)} = \\left(\begin{array}{cc} @@ -647,7 +642,6 @@ def gamma_valence_qed(N, nf, cache): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{V}^{(3,0)}(N)` - """ gamma_V = np.array( [ diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/__init__.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/__init__.py index 5e46cbb15..5c92aa845 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/__init__.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/__init__.py @@ -1,13 +1,12 @@ """The |N3LO| Altarelli-Parisi splitting kernels. -For further documentation see :doc:`N3LO anomalous dimensions <../../../theory/N3LO_ad>` - +For further documentation see :doc:`N3LO anomalous dimensions +<../../../theory/N3LO_ad>` """ import numba as nb import numpy as np -from . import fhmruvv from .ggg import gamma_gg from .ggq import gamma_gq from .gnsm import gamma_nsm @@ -43,7 +42,6 @@ def gamma_singlet(N, nf, cache, variation): numpy.ndarray |N3LO| singlet anomalous dimension matrix :math:`\gamma_{S}^{(3)}(N)` - """ gamma_qq = gamma_nsp(N, nf, cache) + gamma_ps(N, nf, cache, variation[3]) gamma_S_0 = np.array( @@ -61,7 +59,8 @@ def gamma_singlet(N, nf, cache, variation): @nb.njit(cache=True) def gamma_singlet_qed(N, nf, cache, variation): - r"""Compute the leading-order singlet anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order singlet anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_S^{(3,0)} = \\left(\begin{array}{cccc} @@ -84,7 +83,6 @@ def gamma_singlet_qed(N, nf, cache, variation): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(3,0)}(N)` - """ gamma_np_p = gamma_nsp(N, nf, cache) gamma_qq = gamma_np_p + gamma_ps(N, nf, cache, variation[3]) @@ -107,7 +105,8 @@ def gamma_singlet_qed(N, nf, cache, variation): @nb.njit(cache=True) def gamma_valence_qed(N, nf, cache): - r"""Compute the leading-order valence anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order valence anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_V^{(3,0)} = \\left(\begin{array}{cc} @@ -128,7 +127,6 @@ def gamma_valence_qed(N, nf, cache): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{V}^{(3,0)}(N)` - """ gamma_V = np.array( [ diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/__init__.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/__init__.py index ec8949119..8b966cc1c 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/__init__.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/__init__.py @@ -1,6 +1,7 @@ """The |FHMRUVV| |N3LO| Altarelli-Parisi splitting kernels approximations. -Authors follow Pegasus convention and so there is an additional global minus sign with respect to our conventions. +Authors follow Pegasus convention and so there is an additional global +minus sign with respect to our conventions. """ import numba as nb @@ -41,7 +42,6 @@ def gamma_singlet(N, nf, cache, variation): numpy.ndarray |N3LO| singlet anomalous dimension matrix :math:`\gamma_{S}^{(3)}(N)` - """ gamma_qq = gamma_nsp(N, nf, cache, variation[3]) + gamma_ps( N, nf, cache, variation[3] @@ -61,7 +61,8 @@ def gamma_singlet(N, nf, cache, variation): @nb.njit(cache=True) def gamma_singlet_qed(N, nf, cache, variation): - r"""Compute the leading-order singlet anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order singlet anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_S^{(3,0)} = \\left(\begin{array}{cccc} @@ -86,7 +87,6 @@ def gamma_singlet_qed(N, nf, cache, variation): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{S}^{(3,0)}(N)` - """ gamma_np_p = gamma_nsp(N, nf, cache, variation[3]) gamma_qq = gamma_np_p + gamma_ps(N, nf, cache, variation[3]) @@ -109,7 +109,8 @@ def gamma_singlet_qed(N, nf, cache, variation): @nb.njit(cache=True) def gamma_valence_qed(N, nf, cache, variation): - r"""Compute the leading-order valence anomalous dimension matrix for the unified evolution basis. + r"""Compute the leading-order valence anomalous dimension matrix for the + unified evolution basis. .. math:: \\gamma_V^{(3,0)} = \\left(\begin{array}{cc} @@ -132,7 +133,6 @@ def gamma_valence_qed(N, nf, cache, variation): ------- numpy.ndarray Leading-order singlet anomalous dimension matrix :math:`\\gamma_{V}^{(3,0)}(N)` - """ gamma_V = np.array( [ diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggg.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggg.py index 640448e6a..230e94f11 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggg.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggg.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{gg}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{gg}^{(3)}`.""" import numba as nb @@ -28,7 +29,6 @@ def gamma_gg(n, nf, cache, variation): complex |N3LO| gluon-gluon singlet anomalous dimension :math:`\gamma_{gg}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggq.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggq.py index f34aea10a..1d603a1ee 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggq.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/ggq.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{gq}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{gq}^{(3)}`.""" import numba as nb @@ -41,7 +42,6 @@ def gamma_gq(n, nf, cache, variation): complex |N3LO| gluon-quark singlet anomalous dimension :math:`\gamma_{gq}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsm.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsm.py index 30280b015..9ddfed0b8 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsm.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsm.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ns,-}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ns,-}^{(3)}`.""" import numba as nb @@ -39,7 +40,6 @@ def gamma_nsm(n, nf, cache, variation): complex |N3LO| valence-like non-singlet anomalous dimension :math:`\gamma_{ns,-}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsp.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsp.py index 6da3354f9..8888b56f1 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsp.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsp.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ns,+}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ns,+}^{(3)}`.""" import numba as nb @@ -39,7 +40,6 @@ def gamma_nsp(n, nf, cache, variation): complex |N3LO| singlet-like non-singlet anomalous dimension :math:`\gamma_{ns,+}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsv.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsv.py index b871dedad..d88811d93 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsv.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gnsv.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ns,v}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ns,v}^{(3)}`.""" import numba as nb @@ -35,7 +36,6 @@ def gamma_nss(n, nf, cache, variation): ------- complex |N3LO| sea non-singlet anomalous dimension :math:`\gamma_{ns,s}^{(3)}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -119,6 +119,5 @@ def gamma_nsv(n, nf, cache, variation): complex |N3LO| valence non-singlet anomalous dimension :math:`\gamma_{ns,v}^{(3)}(N)` - """ return gamma_nsm(n, nf, cache, variation) + gamma_nss(n, nf, cache, variation) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gps.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gps.py index 13ca9d32b..f1dfe4668 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gps.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gps.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ps}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ps}^{(3)}`.""" import numba as nb @@ -36,7 +37,6 @@ def gamma_ps(n, nf, cache, variation): complex |N3LO| pure singlet quark-quark anomalous dimension :math:`\gamma_{ps}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gqg.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gqg.py index 5d7a7b4fa..39d8107b7 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gqg.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/fhmruvv/gqg.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{qg}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{qg}^{(3)}`.""" import numba as nb import numpy as np @@ -29,7 +30,6 @@ def gamma_qg(n, nf, cache, variation): complex |N3LO| quark-gluon singlet anomalous dimension :math:`\gamma_{qg}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggg.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggg.py index 6e8c5e65a..e50dd7df4 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggg.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggg.py @@ -1,6 +1,7 @@ # pylint: skip-file # fmt: off -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{gg}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{gg}^{(3)}`.""" import numba as nb import numpy as np @@ -10,7 +11,8 @@ @nb.njit(cache=True) def gamma_gg_nf3(n, cache): - r"""Return the part proportional to :math:`nf^3` of :math:`\gamma_{gg}^{(3)}`. + r"""Return the part proportional to :math:`nf^3` of + :math:`\gamma_{gg}^{(3)}`. The expression is copied exact from :eqref:`3.14` of :cite:`Davies:2016jie`. @@ -25,7 +27,6 @@ def gamma_gg_nf3(n, cache): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gg}^{(3)}|_{nf^3}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -142,7 +143,8 @@ def gamma_gg_nf3(n, cache): @nb.njit(cache=True) def gamma_gg_nf1(n, cache, variation): - r"""Return the part proportional to :math:`nf^1` of :math:`\gamma_{gg}^{(3)}`. + r"""Return the part proportional to :math:`nf^1` of + :math:`\gamma_{gg}^{(3)}`. Parameters ---------- @@ -157,7 +159,6 @@ def gamma_gg_nf1(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gg}^{(3)}|_{nf^1}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -209,7 +210,8 @@ def gamma_gg_nf1(n, cache, variation): @nb.njit(cache=True) def gamma_gg_nf2(n, cache, variation): - r"""Return the part proportional to :math:`nf^2` of :math:`\gamma_{gg}^{(3)}`. + r"""Return the part proportional to :math:`nf^2` of + :math:`\gamma_{gg}^{(3)}`. Parameters ---------- @@ -224,7 +226,6 @@ def gamma_gg_nf2(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gg}^{(3)}|_{nf^2}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -275,7 +276,8 @@ def gamma_gg_nf2(n, cache, variation): @nb.njit(cache=True) def gamma_gg_nf0(n, cache, variation): - r"""Return the part proportional to :math:`nf^0` of :math:`\gamma_{gg}^{(3)}`. + r"""Return the part proportional to :math:`nf^0` of + :math:`\gamma_{gg}^{(3)}`. Parameters ---------- @@ -290,7 +292,6 @@ def gamma_gg_nf0(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gg}^{(3)}|_{nf^0}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -359,7 +360,6 @@ def gamma_gg(n, nf, cache, variation): complex |N3LO| gluon-gluon singlet anomalous dimension :math:`\gamma_{gg}^{(3)}(N)` - """ return ( gamma_gg_nf0(n, cache, variation) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggq.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggq.py index 2fa0f725d..df4ed7e49 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggq.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/ggq.py @@ -1,6 +1,7 @@ # pylint: skip-file # fmt: off -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{gq}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{gq}^{(3)}`.""" import numba as nb import numpy as np @@ -25,7 +26,8 @@ @nb.njit(cache=True) def gamma_gq_nf3(n, cache): - r"""Return the part proportional to :math:`nf^3` of :math:`\gamma_{gq}^{(3)}`. + r"""Return the part proportional to :math:`nf^3` of + :math:`\gamma_{gq}^{(3)}`. The expression is copied exact from :eqref:`3.13` of :cite:`Davies:2016jie`. @@ -40,7 +42,6 @@ def gamma_gq_nf3(n, cache): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gq}^{(3)}|_{nf^3}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -71,7 +72,8 @@ def gamma_gq_nf3(n, cache): @nb.njit(cache=True) def gamma_gq_nf0(n, cache, variation): - r"""Return the part proportional to :math:`nf^0` of :math:`\gamma_{gq}^{(3)}`. + r"""Return the part proportional to :math:`nf^0` of + :math:`\gamma_{gq}^{(3)}`. Parameters ---------- @@ -86,7 +88,6 @@ def gamma_gq_nf0(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gq}^{(3)}|_{nf^0}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -131,7 +132,8 @@ def gamma_gq_nf0(n, cache, variation): @nb.njit(cache=True) def gamma_gq_nf1(n, cache, variation): - r"""Return the part proportional to :math:`nf^1` of :math:`\gamma_{gq}^{(3)}`. + r"""Return the part proportional to :math:`nf^1` of + :math:`\gamma_{gq}^{(3)}`. Parameters ---------- @@ -146,7 +148,6 @@ def gamma_gq_nf1(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gq}^{(3)}|_{nf^1}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -192,7 +193,8 @@ def gamma_gq_nf1(n, cache, variation): @nb.njit(cache=True) def gamma_gq_nf2(n, cache, variation): - r"""Return the part proportional to :math:`nf^2` of :math:`\gamma_{gq}^{(3)}`. + r"""Return the part proportional to :math:`nf^2` of + :math:`\gamma_{gq}^{(3)}`. This therm is parametrized using the analytic result from :cite:`Falcioni:2023tzp` with an higher number of moments (30). @@ -210,7 +212,6 @@ def gamma_gq_nf2(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{gq}^{(3)}|_{nf^2}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -280,7 +281,6 @@ def gamma_gq(n, nf, cache, variation): complex |N3LO| gluon-quark singlet anomalous dimension :math:`\gamma_{gq}^{(3)}(N)` - """ return ( gamma_gq_nf0(n, cache, variation) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsm.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsm.py index 4bd7fa472..21a198375 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsm.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsm.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ns,-}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ns,-}^{(3)}`.""" import numba as nb @@ -26,7 +27,6 @@ def gamma_ns_nf3(n, cache): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{ns}^{(3)}|_{nf^3}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -54,7 +54,8 @@ def gamma_ns_nf3(n, cache): @nb.njit(cache=True) def gamma_nsm_nf2(n, cache): - r"""Return the parametrized valence-like non-singlet part proportional to :math:`nf^2`. + r"""Return the parametrized valence-like non-singlet part proportional to + :math:`nf^2`. From :cite:`Moch:2017uml` ancillary files. @@ -70,7 +71,6 @@ def gamma_nsm_nf2(n, cache): complex |N3LO| valence-like non-singlet anomalous dimension :math:`\gamma_{ns,-}^{(3)}|_{nf^2}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -101,7 +101,8 @@ def gamma_nsm_nf2(n, cache): @nb.njit(cache=True) def gamma_nsm_nf1(n, cache): - r"""Return the parametrized valence-like non-singlet part proportional to :math:`nf^1`. + r"""Return the parametrized valence-like non-singlet part proportional to + :math:`nf^1`. Parameters ---------- @@ -115,7 +116,6 @@ def gamma_nsm_nf1(n, cache): complex |N3LO| valence-like non-singlet anomalous dimension :math:`\gamma_{ns,-}^{(3)}|_{nf^1}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -145,7 +145,8 @@ def gamma_nsm_nf1(n, cache): @nb.njit(cache=True) def gamma_nsm_nf0(n, cache): - r"""Return the parametrized valence-like non-singlet part proportional to :math:`nf^0`. + r"""Return the parametrized valence-like non-singlet part proportional to + :math:`nf^0`. Parameters ---------- @@ -159,7 +160,6 @@ def gamma_nsm_nf0(n, cache): complex |N3LO| valence-like non-singlet anomalous dimension :math:`\gamma_{ns,-}^{(3)}|_{nf^0}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -206,7 +206,6 @@ def gamma_nsm(n, nf, cache): complex |N3LO| valence-like non-singlet anomalous dimension :math:`\gamma_{ns,-}^{(3)}(N)` - """ return ( gamma_nsm_nf0(n, cache) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsp.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsp.py index e6364f9d4..99447f97d 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsp.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsp.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ns,+}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ns,+}^{(3)}`.""" import numba as nb @@ -9,7 +10,8 @@ @nb.njit(cache=True) def gamma_nsp_nf2(n, cache): - r"""Return the parametrized singlet-like non-singlet part proportional to :math:`nf^2`. + r"""Return the parametrized singlet-like non-singlet part proportional to + :math:`nf^2`. From :cite:`Moch:2017uml` ancillary files. @@ -24,7 +26,6 @@ def gamma_nsp_nf2(n, cache): ------- complex |N3LO| singlet-like non-singlet anomalous dimension :math:`\gamma_{ns,+}^{(3)}|_{nf^2}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -55,7 +56,8 @@ def gamma_nsp_nf2(n, cache): @nb.njit(cache=True) def gamma_nsp_nf1(n, cache): - r"""Return the parametrized singlet-like non-singlet part proportional to :math:`nf^1`. + r"""Return the parametrized singlet-like non-singlet part proportional to + :math:`nf^1`. Parameters ---------- @@ -68,7 +70,6 @@ def gamma_nsp_nf1(n, cache): ------- complex |N3LO| singlet-like non-singlet anomalous dimension :math:`\gamma_{ns,+}^{(3)}|_{nf^1}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -98,7 +99,8 @@ def gamma_nsp_nf1(n, cache): @nb.njit(cache=True) def gamma_nsp_nf0(n, cache): - r"""Return the parametrized singlet-like non-singlet part proportional to :math:`nf^0`. + r"""Return the parametrized singlet-like non-singlet part proportional to + :math:`nf^0`. Parameters ---------- @@ -111,7 +113,6 @@ def gamma_nsp_nf0(n, cache): ------- complex |N3LO| singlet-like non-singlet anomalous dimension :math:`\gamma_{ns,+}^{(3)}|_{nf^0}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -158,7 +159,6 @@ def gamma_nsp(n, nf, cache): complex |N3LO| singlet-like non-singlet anomalous dimension :math:`\gamma_{ns,+}^{(3)}(N)` - """ return ( gamma_nsp_nf0(n, cache) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsv.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsv.py index b8dc60ec2..38e89290d 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsv.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gnsv.py @@ -1,4 +1,5 @@ -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ns,v}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ns,v}^{(3)}`.""" import numba as nb @@ -23,7 +24,6 @@ def gamma_nss_nf2(n, cache): ------- complex |N3LO| sea non-singlet anomalous dimension :math:`\gamma_{ns,s}^{(3)}|_{nf^2}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -189,7 +189,6 @@ def gamma_nss_nf1(n, cache): ------- complex |N3LO| sea non-singlet anomalous dimension :math:`\gamma_{ns,s}^{(3)}|_{nf^1}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -245,7 +244,6 @@ def gamma_nsv(n, nf, cache): complex |N3LO| valence non-singlet anomalous dimension :math:`\gamma_{ns,v}^{(3)}(N)` - """ return ( gamma_nsm(n, nf, cache) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gps.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gps.py index e5c03ac2b..e21306160 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gps.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gps.py @@ -1,6 +1,7 @@ # pylint: skip-file # fmt: off -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{ps}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{ps}^{(3)}`.""" import numba as nb import numpy as np @@ -19,7 +20,8 @@ @nb.njit(cache=True) def gamma_ps_nf3(n, cache): - r"""Return the part proportional to :math:`nf^3` of :math:`\gamma_{ps}^{(3)}`. + r"""Return the part proportional to :math:`nf^3` of + :math:`\gamma_{ps}^{(3)}`. The expression is copied exact from :eqref:`3.10` of :cite:`Davies:2016jie`. @@ -34,7 +36,6 @@ def gamma_ps_nf3(n, cache): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{ps}^{(3)}|_{nf^3}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -92,7 +93,8 @@ def gamma_ps_nf3(n, cache): @nb.njit(cache=True) def gamma_ps_nf1(n, cache, variation): - r"""Return the part proportional to :math:`nf^1` of :math:`\gamma_{ps}^{(3)}`. + r"""Return the part proportional to :math:`nf^1` of + :math:`\gamma_{ps}^{(3)}`. Parameters ---------- @@ -107,7 +109,6 @@ def gamma_ps_nf1(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{ps}^{(3)}|_{nf^1}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -133,7 +134,8 @@ def gamma_ps_nf1(n, cache, variation): @nb.njit(cache=True) def gamma_ps_nf2(n, cache): - r"""Return the part proportional to :math:`nf^2` of :math:`\gamma_{ps}^{(3)}`. + r"""Return the part proportional to :math:`nf^2` of + :math:`\gamma_{ps}^{(3)}`. This therm is parametrized using the analytic result from :cite:`Gehrmann:2023cqm` with an higher number of moments (30). @@ -150,7 +152,6 @@ def gamma_ps_nf2(n, cache): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{ps}^{(3)}|_{nf^2}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -216,7 +217,6 @@ def gamma_ps(n, nf, cache, variation): complex |N3LO| pure singlet quark-quark anomalous dimension :math:`\gamma_{ps}^{(3)}(N)` - """ return ( +nf * gamma_ps_nf1(n, cache, variation) diff --git a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gqg.py b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gqg.py index 79efb9f05..42362097e 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gqg.py +++ b/src/ekore/anomalous_dimensions/unpolarized/space_like/as4/gqg.py @@ -1,6 +1,7 @@ # pylint: skip-file # fmt: off -r"""The unpolarized, space-like anomalous dimension :math:`\gamma_{qg}^{(3)}`.""" +r"""The unpolarized, space-like anomalous dimension +:math:`\gamma_{qg}^{(3)}`.""" import numba as nb import numpy as np @@ -21,7 +22,8 @@ @nb.njit(cache=True) def gamma_qg_nf3(n, cache): - r"""Return the part proportional to :math:`nf^3` of :math:`\gamma_{qg}^{(3)}`. + r"""Return the part proportional to :math:`nf^3` of + :math:`\gamma_{qg}^{(3)}`. The expression is copied exact from :eqref:`3.12` of :cite:`Davies:2016jie`. @@ -36,7 +38,6 @@ def gamma_qg_nf3(n, cache): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{qg}^{(3)}|_{nf^3}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -350,7 +351,8 @@ def gamma_qg_nf3(n, cache): @nb.njit(cache=True) def gamma_qg_nf1(n, cache, variation): - r"""Return the part proportional to :math:`nf^1` of :math:`\gamma_{qg}^{(3)}`. + r"""Return the part proportional to :math:`nf^1` of + :math:`\gamma_{qg}^{(3)}`. Parameters ---------- @@ -365,7 +367,6 @@ def gamma_qg_nf1(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{qg}^{(3)}|_{nf^1}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -410,7 +411,8 @@ def gamma_qg_nf1(n, cache, variation): @nb.njit(cache=True) def gamma_qg_nf2(n, cache, variation): - r"""Return the part proportional to :math:`nf^2` of :math:`\gamma_{qg}^{(3)}`. + r"""Return the part proportional to :math:`nf^2` of + :math:`\gamma_{qg}^{(3)}`. Parameters ---------- @@ -425,7 +427,6 @@ def gamma_qg_nf2(n, cache, variation): ------- complex |N3LO| non-singlet anomalous dimension :math:`\gamma_{qg}^{(3)}|_{nf^2}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -487,7 +488,6 @@ def gamma_qg(n, nf, cache, variation): complex |N3LO| quark-gluon singlet anomalous dimension :math:`\gamma_{qg}^{(3)}(N)` - """ return ( +nf * gamma_qg_nf1(n, cache, variation) diff --git a/src/ekore/anomalous_dimensions/unpolarized/time_like/__init__.py b/src/ekore/anomalous_dimensions/unpolarized/time_like/__init__.py index e7a4ecd69..339595ec1 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/time_like/__init__.py +++ b/src/ekore/anomalous_dimensions/unpolarized/time_like/__init__.py @@ -26,7 +26,6 @@ def gamma_ns(order, mode, n, nf): ------- numpy.ndarray non-singlet anomalous dimensions - """ cache = c.reset() gamma_ns = np.zeros(order[0], np.complex_) @@ -67,7 +66,6 @@ def gamma_singlet(order, n, nf): ------- numpy.ndarray singlet anomalous dimensions matrices - """ cache = c.reset() gamma_s = np.zeros((order[0], 2, 2), np.complex_) diff --git a/src/ekore/anomalous_dimensions/unpolarized/time_like/as1.py b/src/ekore/anomalous_dimensions/unpolarized/time_like/as1.py index f6e545d63..126e57fdb 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/time_like/as1.py +++ b/src/ekore/anomalous_dimensions/unpolarized/time_like/as1.py @@ -26,7 +26,6 @@ def gamma_qq(N, cache): complex LO quark-quark anomalous dimension :math:`\gamma_{qq}^{(0)}(N)` - """ S1 = c.get(c.S1, cache, N) result = constants.CF * (-3.0 + (4.0 * S1) - 2.0 / (N * (N + 1.0))) @@ -50,7 +49,6 @@ def gamma_qg(N): complex LO quark-gluon anomalous dimension :math:`\gamma_{qg}^{(0)}(N)` - """ result = -(N**2 + N + 2.0) / (N * (N + 1.0) * (N + 2.0)) return result @@ -75,7 +73,6 @@ def gamma_gq(N, nf): complex LO quark-gluon anomalous dimension :math:`\gamma_{gq}^{(0)}(N)` - """ result = -4.0 * nf * constants.CF * (N**2 + N + 2.0) / (N * (N - 1.0) * (N + 1.0)) return result @@ -101,7 +98,6 @@ def gamma_gg(N, nf, cache): complex LO quark-quark anomalous dimension :math:`\gamma_{gg}^{(0)}(N)` - """ S1 = c.get(c.S1, cache, N) result = (2.0 * nf - 11.0 * constants.CA) / 3.0 + 4.0 * constants.CA * ( @@ -128,7 +124,6 @@ def gamma_ns(N, cache): complex LO quark-quark anomalous dimension :math:`\gamma_{ns}^{(0)}(N)` - """ return gamma_qq(N, cache) diff --git a/src/ekore/anomalous_dimensions/unpolarized/time_like/as2.py b/src/ekore/anomalous_dimensions/unpolarized/time_like/as2.py index a2b7cdfec..bd0a54627 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/time_like/as2.py +++ b/src/ekore/anomalous_dimensions/unpolarized/time_like/as2.py @@ -30,7 +30,6 @@ def gamma_nsp(N, nf, cache): complex NLO non-singlet positive anomalous dimension :math:`\gamma_{ns}^{(1)+}(N)` - """ NS = N * N NT = NS * N @@ -111,7 +110,6 @@ def gamma_nsm(N, nf, cache): complex NLO non-singlet negative anomalous dimension :math:`\gamma_{ns}^{(1)-}(N)` - """ NS = N * N NT = NS * N @@ -189,7 +187,6 @@ def gamma_qqs(N, nf): complex NLO quark-quark singlet anomalous dimension :math:`\gamma_{qq}^{(1)s}(N)` - """ qqS1 = ( constants.CF @@ -235,7 +232,6 @@ def gamma_qg(N, nf, cache): complex NLO quark-gluon anomalous dimension :math:`\gamma_{qg}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -371,7 +367,6 @@ def gamma_gq(N, nf, cache): complex NLO gluon-quark anomalous dimension :math:`\gamma_{gq}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -468,7 +463,6 @@ def gamma_gg(N, nf, cache): complex NLO gluon-gluon anomalous dimension :math:`\gamma_{gg}^{(1)}(N)` - """ S1 = c.get(c.S1, cache, N) S2 = c.get(c.S2, cache, N) @@ -635,7 +629,6 @@ def gamma_singlet(N, nf, cache): numpy.ndarray NLO singlet anomalous dimension matrix :math:`\gamma_{s}^{(1)}` - """ gamma_qq = gamma_nsp(N, nf, cache) + gamma_qqs(N, nf) diff --git a/src/ekore/anomalous_dimensions/unpolarized/time_like/as3.py b/src/ekore/anomalous_dimensions/unpolarized/time_like/as3.py index 0d05c215e..611fe2f7a 100644 --- a/src/ekore/anomalous_dimensions/unpolarized/time_like/as3.py +++ b/src/ekore/anomalous_dimensions/unpolarized/time_like/as3.py @@ -30,7 +30,6 @@ def gamma_nsp(N, nf, cache): complex NNLO non-singlet positive anomalous dimension :math:`\gamma_{ns,+}^{(2)}(N)` - """ NI = 1 / N NI2 = NI * NI @@ -136,7 +135,6 @@ def gamma_nsm(N, nf, cache): complex NNLO non-singlet negative anomalous dimension :math:`\gamma_{ns,-}^{(2)}(N)` - """ NI = 1 / N NI2 = NI * NI @@ -247,7 +245,6 @@ def gamma_nsv(N, nf, cache): complex NNLO non-singlet valence anomalous dimension :math:`\gamma_{ns,v}^{(2)}(N)` - """ NI = 1 / N NI2 = NI * NI @@ -322,7 +319,6 @@ def gamma_qq(N, nf, cache): complex NNLO quark-quark anomalous dimension :math:`\gamma_{qq}^{(2)}(N)` - """ NI = 1 / N NI2 = NI * NI @@ -434,7 +430,6 @@ def gamma_qg(N, nf, cache): complex NNLO quark-gluon anomalous dimension :math:`\gamma_{qg}^{(2)}(N)` - """ NI = 1 / N NI2 = NI * NI @@ -570,7 +565,6 @@ def gamma_gq(N, nf, cache): complex NNLO gluon-quark anomalous dimension :math:`\gamma_{gq}^{(2)}(N)` - """ NI = 1 / N NI2 = NI * NI @@ -677,7 +671,6 @@ def gamma_gg(N, nf, cache): complex NNLO gluon-gluon anomalous dimension :math:`\gamma_{gg}^{(2)}(N)` - """ NI = 1 / N NI2 = NI * NI @@ -803,7 +796,6 @@ def gamma_singlet(N, nf, cache): numpy.ndarray NNLO singlet anomalous dimension matrix :math:`\gamma_{s}^{(2)}` - """ result = np.array( [ diff --git a/src/ekore/harmonics/__init__.py b/src/ekore/harmonics/__init__.py index a6a69f5f0..bf0a0d11e 100644 --- a/src/ekore/harmonics/__init__.py +++ b/src/ekore/harmonics/__init__.py @@ -1,6 +1,7 @@ """Module containing the harmonics sums implementation. -Definitions are coming from :cite:`MuselliPhD,Bl_mlein_2000,Blumlein:2009ta`. +Definitions are coming from +:cite:`MuselliPhD,Bl_mlein_2000,Blumlein:2009ta`. """ from . import cache, g_functions, polygamma @@ -9,3 +10,28 @@ from .w3 import S3, S21, S2m1, Sm2m1, Sm3, Sm21 from .w4 import S4, S31, S211, Sm4, Sm22, Sm31, Sm211 from .w5 import S5, Sm5 + +__all__ = [ + "cache", + "g_functions", + "polygamma", + "S1", + "Sm1", + "S2", + "Sm2", + "S3", + "S21", + "S2m1", + "Sm2m1", + "Sm3", + "Sm21", + "S4", + "S31", + "S211", + "Sm4", + "Sm22", + "Sm31", + "Sm211", + "S5", + "Sm5", +] diff --git a/src/ekore/harmonics/cache.py b/src/ekore/harmonics/cache.py index d1892ea1b..0251f4846 100644 --- a/src/ekore/harmonics/cache.py +++ b/src/ekore/harmonics/cache.py @@ -106,7 +106,6 @@ def get( ------- complex : requested harmonic sum evaluated at n - """ # Maybe improve error if key < 0 or key >= len(cache): diff --git a/src/ekore/harmonics/g_functions.py b/src/ekore/harmonics/g_functions.py index 875238547..04b6ef575 100644 --- a/src/ekore/harmonics/g_functions.py +++ b/src/ekore/harmonics/g_functions.py @@ -88,7 +88,6 @@ def mellin_g3(N, S1): ---- We use the name from :cite:`MuselliPhD`, but not his implementation - rather we use the Pegasus :cite:`Vogt:2004ns` implementation. - """ cs = [1.0000e0, -0.9992e0, 0.9851e0, -0.9005e0, 0.6621e0, -0.3174e0, 0.0699e0] g3 = 0 @@ -115,7 +114,6 @@ def mellin_g4(N): ------- mellin_g4 : complex Mellin transform :math:`\mathcal{M}[\text{Li}_2(-x)/(1+x)](N)` - """ g4 = -1 / 2 * zeta2 * log2 for k, ak in enumerate(a1): @@ -172,7 +170,6 @@ def mellin_g6(N, S1): ------- mellin_g6 : complex Mellin transform :math:`\mathcal{M}[\text{Li}_3(x)/(1+x)](N)` - """ g6 = zeta3 * log2 for k, ak in enumerate(a1): @@ -203,7 +200,6 @@ def mellin_g8(N, S1, S2): ------- mellin_g8 : complex Mellin transform :math:`\mathcal{M}[S_{1,2}(x)/(1+x)](N)` - """ g8 = zeta3 * log2 for k, ak in enumerate(a1): @@ -252,7 +248,8 @@ def mellin_g18(N, S1, S2): @nb.njit(cache=True) def mellin_g19(N, S1): - r"""Compute the Mellin transform of :math:`-(\text{Li}_2(-x) + \zeta_2/2)/(1-x)`. + r"""Compute the Mellin transform of :math:`-(\text{Li}_2(-x) + + \zeta_2/2)/(1-x)`. Implementation and definition in :eqref:`B.5.40` of :cite:`MuselliPhD` or in :eqref:`125` of :cite:`Bl_mlein_2000`, but none of them is fully correct. @@ -268,7 +265,6 @@ def mellin_g19(N, S1): ------- mellin_g19 : complex Mellin transform :math:`\mathcal{M}[-(\text{Li}_2(-x) + \zeta_2/2)/(1-x)](N)` - """ g19 = 1 / 2 * zeta2 * S1 for k, ak in enumerate(a1): @@ -351,7 +347,6 @@ def mellin_g22(N, S1, S2, S3): ------- mellin_g22 : complex Mellin transform :math:`\mathcal{M}[-(\text{Li}_2(x) ln(x))/(1-x)](N)` - """ g22 = 0.0 for k, ck in enumerate(c1): diff --git a/src/ekore/harmonics/log_functions.py b/src/ekore/harmonics/log_functions.py index eccba40bf..82f246a7b 100644 --- a/src/ekore/harmonics/log_functions.py +++ b/src/ekore/harmonics/log_functions.py @@ -4,7 +4,6 @@ - :math:`(1-x)\ln^k(1-x), \quad k = 1,2,3` - :math:`\ln^k(1-x), \quad k = 1,3,4,5` - """ import numba as nb @@ -46,7 +45,6 @@ def lm12m1(n, S1, S2): ------- complex :math:`\mathcal{M}[(1-x)\ln^2(1-x)](N)` - """ return ( -2 / (1 + n) ** 3 @@ -77,7 +75,6 @@ def lm13m1(n, S1, S2, S3): ------- complex :math:`\mathcal{M}[(1-x)\ln^3(1-x)](N)` - """ return ( 3 * n * (1 + n) ** 2 * S1**2 @@ -109,7 +106,6 @@ def lm14m1(n, S1, S2, S3, S4): ------- complex :math:`\mathcal{M}[(1-x)\ln^4(1-x)](N)` - """ return ( -24 * n @@ -157,7 +153,6 @@ def lm15m1(n, S1, S2, S3, S4, S5): ------- complex :math:`\mathcal{M}[(1-x)\ln^5(1-x)](N)` - """ return (1 / (n * (1 + n) ** 6)) * ( 5 * n * (1 + n) ** 4 * S1**4 @@ -198,7 +193,6 @@ def lm11(n, S1): ------- complex :math:`\mathcal{M}[\ln(1-x)](N)` - """ return -S1 / n @@ -220,7 +214,6 @@ def lm12(n, S1, S2): ------- complex :math:`\mathcal{M}[\ln^2(1-x)](N)` - """ return (S1**2 + S2) / n @@ -244,7 +237,6 @@ def lm13(n, S1, S2, S3): ------- complex :math:`\mathcal{M}[\ln^3(1-x)](N)` - """ return -((S1**3 + 3 * S1 * S2 + 2 * S3) / n) @@ -270,7 +262,6 @@ def lm14(n, S1, S2, S3, S4): ------- complex :math:`\mathcal{M}[\ln^4(1-x)](N)` - """ return (S1**4 + 6 * S1**2 * S2 + 3 * S2**2 + 8 * S1 * S3 + 6 * S4) / n @@ -298,7 +289,6 @@ def lm15(n, S1, S2, S3, S4, S5): ------- complex :math:`\mathcal{M}[\ln^5(1-x)](N)` - """ return ( -( @@ -327,7 +317,6 @@ def lm11m2(n, S1): ------- complex :math:`\mathcal{M}[(1-x)^2\ln(1-x)](N)` - """ return (5 + 3 * n - (2 * (1 + n) * (2 + n) * S1) / n) / ( (1 + n) ** 2 * (2 + n) ** 2 @@ -351,7 +340,6 @@ def lm12m2(n, S1, S2): ------- complex :math:`\mathcal{M}[(1-x)^2\ln^2(1-x)](N)` - """ return ( 2 @@ -383,7 +371,6 @@ def lm13m2(n, S1, S2, S3): ------- complex :math:`\mathcal{M}[(1-x)^2\ln^3(1-x)](N)` - """ return ( -6 * n * (-17 - 21 * n - 2 * n**2 + 6 * n**3 + 2 * n**4) @@ -419,7 +406,6 @@ def lm14m2(n, S1, S2, S3, S4): ------- complex :math:`\mathcal{M}[(1-x)^2\ln^4(1-x)](N)` - """ return ( 2 diff --git a/src/ekore/harmonics/polygamma.py b/src/ekore/harmonics/polygamma.py index a2c7e442f..c8a9a07bc 100644 --- a/src/ekore/harmonics/polygamma.py +++ b/src/ekore/harmonics/polygamma.py @@ -3,12 +3,14 @@ The functions are described in :doc:`Mellin space `. """ +# ruff: noqa + import numba as nb import numpy as np @nb.njit(cache=True) -def cern_polygamma(Z, K): # pylint: disable=all +def cern_polygamma(Z, K): r"""Compute the polygamma functions :math:`\psi_k(z)`. Reimplementation of ``WPSIPG`` (C317) in `CERNlib `_ @@ -28,7 +30,6 @@ def cern_polygamma(Z, K): # pylint: disable=all ------- H : complex k-th polygamma function :math:`\psi_k(z)` - """ # fmt: off DELTA = 5e-13 @@ -146,7 +147,6 @@ def recursive_harmonic_sum(base_value, n, iterations, weight): ------- sni : complex :math:`S_{w}(N+k)` - """ fact = 0.0 for i in range(1, iterations + 1): @@ -173,7 +173,6 @@ def symmetry_factor(N, is_singlet=None): 1 for singlet like quantities, -1 for non-singlet like quantities, :math:`(-1)^N` elsewise - """ if is_singlet is None: return (-1) ** N diff --git a/src/ekore/harmonics/w1.py b/src/ekore/harmonics/w1.py index 78eecce69..773515c84 100644 --- a/src/ekore/harmonics/w1.py +++ b/src/ekore/harmonics/w1.py @@ -29,7 +29,6 @@ def S1(N): See Also -------- ekore.harmonics.polygamma.cern_polygamma : :math:`\psi_k(N)` - """ return cern_polygamma(N + 1.0, 0) + np.euler_gamma @@ -63,7 +62,6 @@ def Sm1(N, hS1, hS1mh, hS1h, is_singlet=None): See Also -------- eko.anomalous_dimension.w1.S1 : :math:`S_1(N)` - """ if is_singlet is None: return (1 - (-1) ** N) / 2 * hS1mh + ((-1) ** N + 1) / 2 * hS1h - hS1 diff --git a/src/ekore/harmonics/w2.py b/src/ekore/harmonics/w2.py index e4ba3b2c3..8fc85d731 100644 --- a/src/ekore/harmonics/w2.py +++ b/src/ekore/harmonics/w2.py @@ -30,7 +30,6 @@ def S2(N): See Also -------- ekore.harmonics.polygamma.cern_polygamma : :math:`\psi_k(N)` - """ return -cern_polygamma(N + 1.0, 1) + zeta2 @@ -65,7 +64,6 @@ def Sm2(N, hS2, hS2mh, hS2h, is_singlet=None): See Also -------- eko.anomalous_dimension.w2.S2 : :math:`S_2(N)` - """ if is_singlet is None: return 1 / 2 * ((1 - (-1) ** N) / 2 * hS2mh + ((-1) ** N + 1) / 2 * hS2h) - hS2 diff --git a/src/ekore/harmonics/w3.py b/src/ekore/harmonics/w3.py index 7bed3beee..ab3158efb 100644 --- a/src/ekore/harmonics/w3.py +++ b/src/ekore/harmonics/w3.py @@ -31,7 +31,6 @@ def S3(N): See Also -------- ekore.harmonics.polygamma.cern_polygamma : :math:`\psi_k(N)` - """ return 0.5 * cern_polygamma(N + 1.0, 2) + zeta3 @@ -65,7 +64,6 @@ def Sm3(N, hS3, hS3mh, hS3h, is_singlet=None): See Also -------- ekore.harmonics.w3.S3 : :math:`S_3(N)` - """ if is_singlet is None: return ( @@ -96,7 +94,6 @@ def S21(N, S1, S2): ------- S21 : complex Harmonic sum :math:`S_{2,1}(N)` - """ return -gf.mellin_g18(N, S1, S2) + 2 * zeta3 @@ -124,7 +121,6 @@ def Sm21(N, S1, Sm1, is_singlet=None): ------- Sm21 : complex Harmonic sum :math:`S_{-2,1}(N)` - """ # Note mellin g3 was integrated following x^(N-1) convention. eta = symmetry_factor(N, is_singlet) @@ -161,7 +157,6 @@ def S2m1(N, S2, Sm1, Sm2, is_singlet=None): ------- S2m1 : complex Harmonic sum :math:`S_{2,-1}(N)` - """ eta = symmetry_factor(N, is_singlet) return ( @@ -195,6 +190,5 @@ def Sm2m1(N, S1, S2, Sm2): ------- Sm2m1 : complex Harmonic sum :math:`S_{-2,-1}(N)` - """ return -gf.mellin_g19(N, S1) + log2 * (S2 - Sm2) - 5 / 8 * zeta3 diff --git a/src/ekore/harmonics/w4.py b/src/ekore/harmonics/w4.py index 869e4c9bf..0dac5d6ba 100644 --- a/src/ekore/harmonics/w4.py +++ b/src/ekore/harmonics/w4.py @@ -31,7 +31,6 @@ def S4(N): See Also -------- ekore.harmonics.polygamma.cern_polygamma : :math:`\psi_k(N)` - """ return zeta4 - 1.0 / 6.0 * cern_polygamma(N + 1.0, 3) @@ -65,7 +64,6 @@ def Sm4(N, hS4, hS4mh, hS4h, is_singlet=None): See Also -------- eko.anomalous_dimension.w4.S4 : :math:`S_4(N)` - """ if is_singlet is None: return ( @@ -105,7 +103,6 @@ def Sm31(N, S1, Sm1, Sm2, is_singlet=None): See Also -------- ekore.harmonics.g_functions.mellin_g6 : :math:`g_6(N)` - """ eta = symmetry_factor(N, is_singlet) return ( @@ -151,7 +148,6 @@ def Sm22(N, S1, S2, Sm2, Sm31, is_singlet=None): See Also -------- ekore.harmonics.g_functions.mellin_g5 : :math:`g_5(N)` - """ eta = symmetry_factor(N, is_singlet) return ( @@ -188,7 +184,6 @@ def Sm211(N, S1, S2, Sm1, is_singlet=None): See Also -------- ekore.harmonics.g_functions.mellin_g8 : :math:`g_8(N)` - """ eta = symmetry_factor(N, is_singlet) return ( @@ -228,7 +223,6 @@ def S211(N, S1, S2, S3): See Also -------- ekore.harmonics.g_functions.mellin_g21 : :math:`g_21(N)` - """ return -gf.mellin_g21(N, S1, S2, S3) + 6 / 5 * zeta2**2 @@ -261,7 +255,6 @@ def S31(N, S1, S2, S3, S4): See Also -------- ekore.harmonics.g_functions.mellin_g22 : :math:`g_22(N)` - """ return ( 1 / 2 * gf.mellin_g22(N, S1, S2, S3) diff --git a/src/ekore/harmonics/w5.py b/src/ekore/harmonics/w5.py index 169de46e8..28ba0eceb 100644 --- a/src/ekore/harmonics/w5.py +++ b/src/ekore/harmonics/w5.py @@ -30,7 +30,6 @@ def S5(N): See Also -------- ekore.harmonics.polygamma.cern_polygamma : :math:`\psi_k(N)` - """ return zeta5 + 1.0 / 24.0 * cern_polygamma(N + 1.0, 4) @@ -64,7 +63,6 @@ def Sm5(N, hS5, hS5mh, hS5h, is_singlet=None): See Also -------- eko.harmonic.w5.S5 : :math:`S_5(N)` - """ if is_singlet is None: return ( diff --git a/src/ekore/operator_matrix_elements/polarized/space_like/__init__.py b/src/ekore/operator_matrix_elements/polarized/space_like/__init__.py index 414e37f39..1c2a5da2f 100644 --- a/src/ekore/operator_matrix_elements/polarized/space_like/__init__.py +++ b/src/ekore/operator_matrix_elements/polarized/space_like/__init__.py @@ -26,7 +26,6 @@ def A_singlet(matching_order, n, nf, L): ------- numpy.ndarray singlet |OME| - """ A_s = np.zeros((matching_order[0], 3, 3), np.complex_) if matching_order[0] >= 1: @@ -58,7 +57,6 @@ def A_non_singlet(matching_order, n, L): ------- numpy.ndarray non-singlet |OME| - """ A_ns = np.zeros((matching_order[0], 2, 2), np.complex_) cache = c.reset() diff --git a/src/ekore/operator_matrix_elements/polarized/space_like/as1.py b/src/ekore/operator_matrix_elements/polarized/space_like/as1.py index 29d74b138..f7210e6e2 100644 --- a/src/ekore/operator_matrix_elements/polarized/space_like/as1.py +++ b/src/ekore/operator_matrix_elements/polarized/space_like/as1.py @@ -1,4 +1,5 @@ -r"""The |NLO| |OME| in the polarized case for the matching conditions in the |VFNS|. +r"""The |NLO| |OME| in the polarized case for the matching conditions in the +|VFNS|. Heavy quark contribution for intrinsic evolution are not considered for the polarized case. The matching conditions for the |VFNS| at :math:`\mu_F^2 \neq m_H^2` are provided in :cite:`Bierenbaum:2022biv`. @@ -33,7 +34,6 @@ def A_hg(n, L): ------- complex |NLO| heavy-gluon |OME| :math:`A_{Hg}^{S,(1)}` - """ gamma0_qghat = 2 * gamma0_qg(n, nf=1) return (1 / 2) * gamma0_qghat * (-L) @@ -54,7 +54,6 @@ def A_gg(L): ------- complex |NLO| gluon-gluon |OME| :math:`A_{gg,H}^{S,(1)}` - """ return A_gg_unpol(L) @@ -81,7 +80,6 @@ def A_singlet(n, L): ------- numpy.ndarray |NLO| singlet |OME| :math:`A^{S,(1)}` - """ A_S = np.array( [ diff --git a/src/ekore/operator_matrix_elements/polarized/space_like/as2.py b/src/ekore/operator_matrix_elements/polarized/space_like/as2.py index eab9b1b00..f6b0ad079 100644 --- a/src/ekore/operator_matrix_elements/polarized/space_like/as2.py +++ b/src/ekore/operator_matrix_elements/polarized/space_like/as2.py @@ -1,8 +1,11 @@ -r"""Contains the |NNLO| |OME| in the polarized case for the matching conditions in the |VFNS|. - -The equations are given in :cite:`Bierenbaum:2022biv`. -As in the |NLO| |OME|, in the paper, an additional factor 2 can be found in front of the anomalous dimensions and factor (-1) for odd powers of L. -The anomalous dimensions and beta function with the addition 'hat' are defined as in the |NLO| case. +r"""Contains the |NNLO| |OME| in the polarized case for the matching conditions +in the |VFNS|. + +The equations are given in :cite:`Bierenbaum:2022biv`. As in the |NLO| +|OME|, in the paper, an additional factor 2 can be found in front of the +anomalous dimensions and factor (-1) for odd powers of L. The anomalous +dimensions and beta function with the addition 'hat' are defined as in +the |NLO| case. """ import numba as nb @@ -17,7 +20,8 @@ from ....harmonics import cache as c beta_0hat = -4 / 3 * TR -"""This is the lowest order beta function with the addition 'hat' defined as above.""" +"""This is the lowest order beta function with the addition 'hat' defined as +above.""" @nb.njit(cache=True) @@ -39,7 +43,6 @@ def A_qq_ns(n, cache, L): ------- complex |NNLO| light-light non-singlet |OME| :math:`A_{qq,H}^{NS,(2)}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -105,7 +108,6 @@ def A_hq_ps(n, cache, L, nf): ------- complex |NNLO| heavy-light pure-singlet |OME| :math:`A_{Hq}^{PS,(2)}` - """ S2 = c.get(c.S2, cache, n) @@ -154,7 +156,6 @@ def A_hg(n, cache, L): ------- complex |NNLO| heavy-gluon |OME| :math:`A_{Hg}^{S,(2)}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -279,7 +280,6 @@ def A_gq(n, cache, L): ------- complex |NNLO| gluon-quark |OME| :math:`A_{gq,H}^{S,(2)}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -330,7 +330,6 @@ def A_gg(n, cache, L): ------- complex |NNLO| gluon-gluon |OME| :math:`A_{gg,H}^{S,(2)}` - """ S1 = c.get(c.S1, cache, n) ggg1_canf = ( @@ -398,7 +397,6 @@ def A_singlet(n, cache, L, nf): ------- numpy.ndarray |NNLO| singlet |OME| :math:`A^{S,(2)}(N)` - """ return np.array( [ @@ -433,6 +431,5 @@ def A_ns(n, cache, L): ------- numpy.ndarray |NNLO| non-singlet |OME| :math:`A^{NS,(2)}` - """ return np.array([[A_qq_ns(n, cache, L), 0.0], [0 + 0j, 0 + 0j]], np.complex_) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/__init__.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/__init__.py index f1dd3d345..50d48f3b8 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/__init__.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/__init__.py @@ -28,7 +28,6 @@ def A_singlet(matching_order, n, nf, L, is_msbar): ------- numpy.ndarray singlet |OME| - """ cache = c.reset() A_s = np.zeros((matching_order[0], 3, 3), np.complex_) @@ -60,7 +59,6 @@ def A_non_singlet(matching_order, n, nf, L): ------- numpy.ndarray non-singlet |OME| - """ cache = c.reset() A_ns = np.zeros((matching_order[0], 2, 2), np.complex_) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as1.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as1.py index d776f23f1..db2f641f3 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as1.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as1.py @@ -34,7 +34,6 @@ def A_hh(n, cache, L): ------- complex |NLO| heavy-heavy |OME| :math:`A_{HH}^{(1)}` - """ S1m = c.get(c.S1, cache, n) - 1 / n # harmonics.S1(n - 1) S2m = c.get(c.S2, cache, n) - 1 / n**2 # harmonics.S2(n - 1) @@ -63,7 +62,6 @@ def A_gh(n, L): ------- complex |NLO| gluon-heavy |OME| :math:`A_{gH}^{(1)}` - """ agh_l1 = (2 + n + n**2) / (n * (n**2 - 1)) agh_l0 = (-4 + 2 * n + n**2 * (15 + n * (3 + n - n**2))) / (n * (n**2 - 1)) ** 2 @@ -87,7 +85,6 @@ def A_hg(n, L): ------- complex |NLO| heavy-gluon |OME| :math:`A_{Hg}^{S,(1)}` - """ den = 1.0 / (n * (n + 1) * (2 + n)) num = 2 * (2 + n + n**2) @@ -109,7 +106,6 @@ def A_gg(L): ------- complex |NLO| gluon-gluon |OME| :math:`A_{gg,H}^{S,(1)}` - """ return -2.0 / 3.0 * L @@ -138,7 +134,6 @@ def A_singlet(n, cache, L): ------- numpy.ndarray |NLO| singlet |OME| :math:`A^{S,(1)}` - """ A_S = np.array( [ @@ -174,6 +169,5 @@ def A_ns(n, cache, L): ------- numpy.ndarray |NLO| non-singlet |OME| :math:`A^{S,(1)}` - """ return np.array([[0 + 0j, 0 + 0j], [0 + 0j, A_hh(n, cache, L)]], np.complex_) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as2.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as2.py index 801837016..8925a371d 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as2.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as2.py @@ -39,7 +39,6 @@ def A_qq_ns(n, cache, L): ------- complex |NNLO| light-light non-singlet |OME| :math:`A_{qq,H}^{NS,(2)}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -90,7 +89,6 @@ def A_hq_ps(n, cache, L): ------- complex |NNLO| heavy-light pure-singlet |OME| :math:`A_{Hq}^{PS,(2)}` - """ S2 = c.get(c.S2, cache, n) @@ -155,7 +153,6 @@ def A_hg(n, cache, L): ------- complex |NNLO| heavy-gluon |OME| :math:`A_{Hg}^{S,(2)}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -278,7 +275,6 @@ def A_gq(n, cache, L): ------- complex |NNLO| gluon-quark |OME| :math:`A_{gq,H}^{S,(2)}` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -329,7 +325,6 @@ def A_gg(n, cache, L): ------- complex |NNLO| gluon-gluon |OME| :math:`A_{gg,H}^{S,(2)}` - """ S1 = c.get(c.S1, cache, n) S1m = S1 - 1 / n # harmonic_S1(n - 1) @@ -424,7 +419,6 @@ def A_singlet(n, cache, L, is_msbar=False): ------- numpy.ndarray |NNLO| singlet |OME| :math:`A^{S,(2)}(N)` - """ A_hq_2 = A_hq_ps(n, cache, L) A_qq_2 = A_qq_ns(n, cache, L) @@ -463,6 +457,5 @@ def A_ns(n, cache, L): ------- numpy.ndarray |NNLO| non-singlet |OME| :math:`A^{NS,(2)}` - """ return np.array([[A_qq_ns(n, cache, L), 0.0], [0 + 0j, 0 + 0j]], np.complex_) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/__init__.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/__init__.py index b71d8a37e..11eef01d5 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/__init__.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/__init__.py @@ -63,7 +63,6 @@ Freitas, A. von Manteuffel, C. Schneider, K. Schönwald. The non-first-order-factorizable contributions to the three-loop single-mass operator matrix elements $A_{Qg}^{(3)}$ and $\Delta A_{Qg}^{(3)}$. - """ import numba as nb @@ -107,7 +106,6 @@ def A_singlet(n, cache, nf, L): ------- A_S : numpy.ndarray |N3LO| singlet |OME| :math:`A^{S,(3)}(N)` - """ A_hq_3 = A_Hq(n, cache, nf, L) A_hg_3 = A_Hg(n, cache, nf, L) @@ -158,6 +156,5 @@ def A_ns(n, cache, nf, L): ------- A_NS : numpy.ndarray |N3LO| non-singlet |OME| :math:`A^{NS,(3)}` - """ return np.array([[A_qqNS(n, cache, nf, L, -1), 0.0], [0 + 0j, 0 + 0j]], np.complex_) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg.py index 317345fc6..2a4934c94 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg.py @@ -32,7 +32,6 @@ def A_Hg(n, cache, nf, L): ------- complex :math:`A_{Hg}^{S,(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg_param.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg_param.py index 1d6dde4dd..ac34fe18c 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg_param.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHg_param.py @@ -1,8 +1,8 @@ -"""The approximated part of renormalization constant :math:`a_{Hg}^{(3)}(N)`.""" +"""The approximated part of renormalization constant +:math:`a_{Hg}^{(3)}(N)`.""" # pylint: skip-file import numba as nb -import numpy as np from .....harmonics import cache as c from .....harmonics.log_functions import lm11, lm11m1, lm12, lm13, lm14, lm15 @@ -38,7 +38,6 @@ def a_Hg3(n, cache, nf): ------- complex :math:`a_{Hg}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHq.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHq.py index ccba54fdd..e46f42b01 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHq.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aHq.py @@ -38,7 +38,6 @@ def A_Hq(n, cache, nf, L): # pylint: disable=too-many-locals ------- complex :math:`A_{Hq}^{S,(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agg.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agg.py index d740f7810..9197192d4 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agg.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agg.py @@ -52,7 +52,6 @@ def a_gg3(n, cache, nf): ------- complex :math:`a_{gg}^{(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) @@ -309,7 +308,6 @@ def A_gg(n, cache, nf, L): ------- complex :math:`A_{gg}^{S,(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agq.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agq.py index 3296925c0..83a4471cd 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agq.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/agq.py @@ -30,7 +30,6 @@ def A_gq(n, cache, nf, L): # pylint: disable=too-many-locals ------- complex :math:`A_{gq}^{S,(3)}(N)` - """ S1 = c.get(c.S1, cache, n) Sm1 = c.get(c.Sm1, cache, n, is_singlet=True) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqg.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqg.py index 725c0ec84..b82149f33 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqg.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqg.py @@ -30,7 +30,6 @@ def A_qg(n, cache, nf, L): ------- complex :math:`A_{qg}^{S,(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqNS.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqNS.py index 55e8b37fe..5c54a7050 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqNS.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqNS.py @@ -40,7 +40,6 @@ def A_qqNS(n, cache, nf, L, eta): ------- complex :math:`A_{qq}^{NS,(3)}(N)` - """ is_singlet = eta == 1 S1 = c.get(c.S1, cache, n) diff --git a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqPS.py b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqPS.py index 50e6ccabd..5b5eda758 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqPS.py +++ b/src/ekore/operator_matrix_elements/unpolarized/space_like/as3/aqqPS.py @@ -30,7 +30,6 @@ def A_qqPS(n, cache, nf, L): ------- complex :math:`A_{qq}^{PS,(3)}(N)` - """ S1 = c.get(c.S1, cache, n) S2 = c.get(c.S2, cache, n) diff --git a/src/ekore/operator_matrix_elements/unpolarized/time_like/__init__.py b/src/ekore/operator_matrix_elements/unpolarized/time_like/__init__.py index 5598c12bf..a779b75d9 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/time_like/__init__.py +++ b/src/ekore/operator_matrix_elements/unpolarized/time_like/__init__.py @@ -19,7 +19,6 @@ def A_non_singlet(matching_order, _N, _L): ------- numpy.ndarray non-singlet |OME| - """ A_ns = np.zeros((matching_order[0], 2, 2), np.complex_) A_ns[0] = as1.A_ns() @@ -43,7 +42,6 @@ def A_singlet(matching_order, N, L): ------- numpy.ndarray singlet |OME| - """ A_s = np.zeros((matching_order[0], 3, 3), np.complex_) A_s[0] = as1.A_singlet(N, L) diff --git a/src/ekore/operator_matrix_elements/unpolarized/time_like/as1.py b/src/ekore/operator_matrix_elements/unpolarized/time_like/as1.py index 664e5e7ec..b1448ab57 100644 --- a/src/ekore/operator_matrix_elements/unpolarized/time_like/as1.py +++ b/src/ekore/operator_matrix_elements/unpolarized/time_like/as1.py @@ -24,7 +24,6 @@ def A_hg(N, L): A_hg : complex |NLO| heavy-gluon |OME| :math:`A_{hg}^{S,(1)}` - """ result = ( 2 @@ -57,7 +56,6 @@ def A_gg(L): ------- A_gg : complex |NLO| gluon-gluon |OME| :math:`A_{gg,H}^{S,(1)}` - """ return -2.0 / 3.0 * L @@ -78,7 +76,6 @@ def A_singlet(N, L): numpy.ndarray |NLO| singlet |OME| :math:`A^{S,(1)}` - """ result = np.array( [[A_gg(L), 0 + 0j, 0], [0 + 0j, 0, 0], [A_hg(N, L), 0, 0]], np.complex_ @@ -95,7 +92,6 @@ def A_ns(): A_ns : numpy.ndarray |NLO| non-singlet |OME| :math:`A^{S,(1)}` - """ result = np.array([[0, 0], [0, 0]], np.complex_) return result diff --git a/tests/conftest.py b/tests/conftest.py index 2e54dc171..f273c3c2e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -114,7 +114,6 @@ def get(self, update: Optional[dict] = None): dictionary:: factory.get({}) - """ if self.cache is None or update is not None: self.cache = self._create() diff --git a/tests/eko/evolution_operator/test_grid.py b/tests/eko/evolution_operator/test_grid.py index 01754578a..66812c2fd 100644 --- a/tests/eko/evolution_operator/test_grid.py +++ b/tests/eko/evolution_operator/test_grid.py @@ -1,8 +1,8 @@ """Checks that the operator grid works as intended. -These test can be slow as they require the computation of several values of Q -But they should be fast as the grid is very small. -It does *not* test whether the result is correct, it can just test that it is sane +These test can be slow as they require the computation of several values +of Q But they should be fast as the grid is very small. It does *not* +test whether the result is correct, it can just test that it is sane """ import enum @@ -50,7 +50,7 @@ def test_compute_mu2grid(theory_ffns, operator_card, tmp_path): def test_grid_computation_VFNS(theory_card, operator_card, tmp_path): - """Checks that the grid can be computed""" + """Checks that the grid can be computed.""" mugrid = [(3, 4), (5, 5), (5, 4)] operator_card.mugrid = mugrid opgrid = legacy.Runner( diff --git a/tests/eko/evolution_operator/test_ome.py b/tests/eko/evolution_operator/test_ome.py index e807a587b..b02d3cd06 100644 --- a/tests/eko/evolution_operator/test_ome.py +++ b/tests/eko/evolution_operator/test_ome.py @@ -358,11 +358,11 @@ def test_labels(self, theory_ffns, operator_card, tmp_path: pathlib.Path): (200, 200), (br.matching_hminus_pid, br.matching_hminus_pid), ] - for l in test_labels: + for lab in test_labels: if skip_ns: - assert l not in labels + assert lab not in labels else: - assert l in labels + assert lab in labels test_labels = [ (21, 21), (21, 100), @@ -374,11 +374,11 @@ def test_labels(self, theory_ffns, operator_card, tmp_path: pathlib.Path): (br.matching_hplus_pid, 100), (br.matching_hplus_pid, br.matching_hplus_pid), ] - for l in test_labels: + for lab in test_labels: if skip_singlet: - assert l not in labels + assert lab not in labels else: - assert l in labels + assert lab in labels def test_compute_n3lo(self, theory_ffns, operator_card, tmp_path): theory_card: TheoryCard = theory_ffns(5) diff --git a/tests/eko/evolution_operator/test_physical.py b/tests/eko/evolution_operator/test_physical.py index 0ba41d91f..643d60bb2 100644 --- a/tests/eko/evolution_operator/test_physical.py +++ b/tests/eko/evolution_operator/test_physical.py @@ -216,8 +216,8 @@ def mk_op_members(shape=(2, 2), qed=False): m = np.random.rand(len(full_labels), *shape) e = np.random.rand(len(full_labels), *shape) om = {} - for j, l in enumerate(full_labels): - om[l] = member.OpMember(m[j], e[j]) + for j, lab in enumerate(full_labels): + om[lab] = member.OpMember(m[j], e[j]) return om diff --git a/tests/eko/io/test_dictlike.py b/tests/eko/io/test_dictlike.py index 908aad364..8971082ab 100644 --- a/tests/eko/io/test_dictlike.py +++ b/tests/eko/io/test_dictlike.py @@ -25,7 +25,7 @@ class MyNestedDictLike(dictlike.DictLike): @dataclass class MyDictLike(dictlike.DictLike): - l: npt.NDArray + nda: npt.NDArray f: float x: interpolation.XGrid t: tuple @@ -37,7 +37,7 @@ class MyDictLike(dictlike.DictLike): def test_serialization(): d = MyDictLike.from_dict( dict( - l=np.arange(5.0), + nda=np.arange(5.0), f=np.arange(5.0)[-1], x=[0.1, 1.0], t=(1.0, 2.0), @@ -54,8 +54,8 @@ def test_serialization(): yaml.safe_dump(d.raw, stream) stream.seek(0) ddd = yaml.safe_load(stream) - assert "l" in ddd - np.testing.assert_allclose(ddd["l"], np.arange(5.0)) + assert "nda" in ddd + np.testing.assert_allclose(ddd["nda"], np.arange(5.0)) @dataclass @@ -73,7 +73,6 @@ def test_unsupported(): It is not possible to deserialize actually abstract type hints, not corresponding to any instantiatable class. - """ with pytest.raises(TypeError): UnsupportedDictLike.from_dict(dict(sf=[3.14])) diff --git a/tests/eko/io/test_items.py b/tests/eko/io/test_items.py index 762b10e11..6d32aa12f 100644 --- a/tests/eko/io/test_items.py +++ b/tests/eko/io/test_items.py @@ -1,6 +1,5 @@ import io -import lz4.frame import numpy as np import pytest diff --git a/tests/eko/io/test_manipulate.py b/tests/eko/io/test_manipulate.py index 56ceafc0f..3da526eac 100644 --- a/tests/eko/io/test_manipulate.py +++ b/tests/eko/io/test_manipulate.py @@ -2,16 +2,14 @@ import pytest import eko -from eko import EKO from eko import basis_rotation as br from eko import interpolation -from eko.io import manipulate, runcards +from eko.io import manipulate from ekobox.mock import eko_identity -from tests.conftest import EKOFactory def chk_keys(a, b): - """Check all keys are preserved""" + """Check all keys are preserved.""" assert sorted(a.keys()) == sorted(b.keys()) for key, value in a.items(): if isinstance(value, dict): diff --git a/tests/eko/io/test_metadata.py b/tests/eko/io/test_metadata.py index fcfa8dd09..cdc3308c9 100644 --- a/tests/eko/io/test_metadata.py +++ b/tests/eko/io/test_metadata.py @@ -1,7 +1,6 @@ import logging import pytest -import yaml from eko.io import metadata, paths diff --git a/tests/eko/io/test_runcards.py b/tests/eko/io/test_runcards.py index 4fe9a8e4b..64c407ef0 100644 --- a/tests/eko/io/test_runcards.py +++ b/tests/eko/io/test_runcards.py @@ -1,6 +1,5 @@ from io import StringIO -import numpy as np import pytest import yaml @@ -22,9 +21,9 @@ def test_flavored_mu2grid(): deser = yaml.safe_load(stream) assert len(flavored) == len(deser) # after deserialization one is now list instead of tuple - for t, l in zip(flavored, deser): - assert len(t) == len(l) - assert t == tuple(l) + for tu, li in zip(flavored, deser): + assert len(tu) == len(li) + assert tu == tuple(li) def check_dumpable(no): @@ -32,7 +31,7 @@ def check_dumpable(no): so = StringIO() yaml.dump(no.raw, so) so.seek(0) - noo = yaml.safe_load(so) + _noo = yaml.safe_load(so) def test_legacy_fallback(): diff --git a/tests/eko/kernels/test_as4_ei.py b/tests/eko/kernels/test_as4_ei.py index acfec184e..bf6961788 100644 --- a/tests/eko/kernels/test_as4_ei.py +++ b/tests/eko/kernels/test_as4_ei.py @@ -45,7 +45,7 @@ def poly(x): def test_der_n3lo_exa(): - """exact N3LO derivative""" + """Exact N3LO derivative.""" nf = 3 a0 = 0.3 a1 = 0.1 @@ -91,7 +91,7 @@ def test_der_n3lo_exa(): def test_der_n3lo_exp(): - """expanded N3LO derivative""" + """Expanded N3LO derivative.""" nf = 3 a0 = 0.3 a1 = 0.1 diff --git a/tests/eko/kernels/test_ei.py b/tests/eko/kernels/test_ei.py index 5c89bc6e0..eddbe6838 100644 --- a/tests/eko/kernels/test_ei.py +++ b/tests/eko/kernels/test_ei.py @@ -51,7 +51,7 @@ def test_zero_qed(): def test_der_lo(): - """LO derivative""" + """LO derivative.""" nf = 3 beta0 = beta.beta_qcd((2, 0), nf) a0 = 5 @@ -65,7 +65,7 @@ def test_der_lo(): def test_der_nlo_exp(): - """expanded NLO derivative""" + """Expanded NLO derivative.""" nf = 3 beta0 = beta.beta_qcd((2, 0), nf) b_vec = [beta.beta_qcd((2 + i, 0), nf) / beta0 for i in range(0, 2 + 1)] @@ -91,7 +91,7 @@ def test_der_nlo_exp(): def test_der_nlo_exa(): - """exact NLO derivative""" + """Exact NLO derivative.""" nf = 3 beta0 = beta.beta_qcd((2, 0), nf) b_vec = [beta.beta_qcd((2 + i, 0), nf) / beta0 for i in range(0, 2 + 1)] @@ -115,7 +115,7 @@ def test_der_nlo_exa(): def test_der_nnlo_exp(): - """expanded NNLO derivative""" + """Expanded NNLO derivative.""" nf = 3 beta0 = beta.beta_qcd((2, 0), nf) b_vec = [beta.beta_qcd((2 + i, 0), nf) / beta0 for i in range(0, 2 + 1)] @@ -138,7 +138,7 @@ def test_der_nnlo_exp(): ) / delta_a toll = ( ( - -beta.b_qcd((3, 0), nf) ** 3 + -(beta.b_qcd((3, 0), nf) ** 3) + 2 * beta.b_qcd((4, 0), nf) * beta.b_qcd((3, 0), nf) ) / beta.beta_qcd((2, 0), nf) @@ -179,7 +179,7 @@ def test_der_nnlo_exp(): def test_der_nnlo_exa(): - """exact NNLO derivative""" + """Exact NNLO derivative.""" nf = 3 beta0 = beta.beta_qcd((2, 0), nf) b_vec = [beta.beta_qcd((2 + i, 0), nf) / beta0 for i in range(0, 2 + 1)] diff --git a/tests/eko/kernels/test_s.py b/tests/eko/kernels/test_s.py index ff4fdfc0d..a0c1aca11 100644 --- a/tests/eko/kernels/test_s.py +++ b/tests/eko/kernels/test_s.py @@ -175,7 +175,7 @@ def test_zero_n3lo_decompose(monkeypatch): def test_similarity(): - """all methods should be similar""" + """All methods should be similar.""" nf = 3 a0 = 0.1 delta_a = 1e-3 diff --git a/tests/eko/runner/test_legacy.py b/tests/eko/runner/test_legacy.py index 1828285c3..aed8df0ac 100644 --- a/tests/eko/runner/test_legacy.py +++ b/tests/eko/runner/test_legacy.py @@ -1,7 +1,6 @@ import copy import enum -import numpy as np import pytest import eko @@ -13,7 +12,7 @@ def test_raw(theory_card, operator_card, tmp_path): - """we don't check the content here, but only the shape""" + """We don't check the content here, but only the shape.""" path = tmp_path / "eko.tar" tc = theory_card oc = operator_card @@ -24,7 +23,7 @@ def test_raw(theory_card, operator_card, tmp_path): def test_mass_scheme(theory_card, operator_card, tmp_path): - """we don't check the content here, but only the shape""" + """We don't check the content here, but only the shape.""" # wrong mass scheme class FakeEM(enum.Enum): diff --git a/tests/eko/runner/test_managed.py b/tests/eko/runner/test_managed.py index e75fc8676..1e85aaac6 100644 --- a/tests/eko/runner/test_managed.py +++ b/tests/eko/runner/test_managed.py @@ -1,7 +1,5 @@ import copy -import numpy as np - from eko import EKO from eko.io.runcards import TheoryCard from eko.runner.managed import solve @@ -10,7 +8,7 @@ def test_raw(theory_card, operator_card, tmp_path): - """we don't check the content here, but only the shape""" + """We don't check the content here, but only the shape.""" path = tmp_path / "eko.tar" tc = theory_card oc = operator_card diff --git a/tests/eko/scale_variations/test_expanded.py b/tests/eko/scale_variations/test_expanded.py index 309a87597..13dd76a4c 100644 --- a/tests/eko/scale_variations/test_expanded.py +++ b/tests/eko/scale_variations/test_expanded.py @@ -40,7 +40,7 @@ def test_modes(): def test_ns_sv_dispacher(): - """Test to identity""" + """Test to identity.""" order = (4, 0) gamma_ns = np.random.rand(order[0]) L = 0 @@ -52,7 +52,7 @@ def test_ns_sv_dispacher(): def test_ns_sv_dispacher_qed(): - """Test to identity""" + """Test to identity.""" order = (4, 2) gamma_ns = np.random.rand(order[0], order[1]) L = 0 @@ -69,7 +69,7 @@ def test_ns_sv_dispacher_qed(): def test_singlet_sv_dispacher(): - """Test to identity""" + """Test to identity.""" order = (4, 0) gamma_singlet = np.random.rand(order[0], 2, 2) L = 0 @@ -81,7 +81,7 @@ def test_singlet_sv_dispacher(): def test_singlet_sv_dispacher_qed(): - """Test to identity""" + """Test to identity.""" order = (4, 2) gamma_singlet = np.random.rand(order[0], order[1], 4, 4) L = 0 @@ -98,7 +98,7 @@ def test_singlet_sv_dispacher_qed(): def test_valence_sv_dispacher_qed(): - """Test to identity""" + """Test to identity.""" order = (4, 2) gamma_valence = np.random.rand(order[0], order[1], 2, 2) L = 0 diff --git a/tests/eko/test_beta.py b/tests/eko/test_beta.py index 8fcdd6931..3f009ca07 100644 --- a/tests/eko/test_beta.py +++ b/tests/eko/test_beta.py @@ -1,7 +1,5 @@ -""" - This module tests the implemented beta functions and the value - of alpha_s for different orders. -""" +"""This module tests the implemented beta functions and the value of alpha_s +for different orders.""" import numpy as np import pytest @@ -11,22 +9,22 @@ def _flav_test(function): - """Check that the given beta function `function` is valid - for any number of flavors up to 5""" + """Check that the given beta function `function` is valid for any number of + flavors up to 5.""" for nf in range(5): result = function(nf) assert result > 0.0 def test_beta_as2(): - """Test first beta function coefficient""" + """Test first beta function coefficient.""" _flav_test(beta.beta_qcd_as2) # from hep-ph/9706430 np.testing.assert_approx_equal(beta.beta_qcd_as2(5), 4 * 23 / 12) def test_beta_aem2(): - """Test first beta function coefficient""" + """Test first beta function coefficient.""" # from hep-ph/9803211 for nf in range(3, 6 + 1): for nl in range(2, 3 + 1): @@ -39,14 +37,14 @@ def test_beta_aem2(): def test_beta_as3(): - """Test second beta function coefficient""" + """Test second beta function coefficient.""" _flav_test(beta.beta_qcd_as3) # from hep-ph/9706430 np.testing.assert_approx_equal(beta.beta_qcd_as3(5), 4**2 * 29 / 12) def test_beta_aem3(): - """Test second beta function coefficient""" + """Test second beta function coefficient.""" # from hep-ph/9803211 for nf in range(3, 6 + 1): for nl in range(2, 3 + 1): @@ -59,14 +57,14 @@ def test_beta_aem3(): def test_beta_as4(): - """Test third beta function coefficient""" + """Test third beta function coefficient.""" _flav_test(beta.beta_qcd_as4) # from hep-ph/9706430 np.testing.assert_approx_equal(beta.beta_qcd_as4(5), 4**3 * 9769 / 3456) def test_beta_as5(): - """Test fourth beta function coefficient""" + """Test fourth beta function coefficient.""" _flav_test(beta.beta_qcd_as5) # from hep-ph/9706430 np.testing.assert_allclose( @@ -75,7 +73,7 @@ def test_beta_as5(): def test_beta(): - """beta-wrapper""" + """beta-wrapper.""" for nf in range(3, 6 + 1): for nl in range(2, 3 + 1): np.testing.assert_allclose(beta.beta_qcd((2, 0), nf), beta.beta_qcd_as2(nf)) @@ -99,19 +97,19 @@ def test_beta(): def test_b(): - """b-wrapper""" + """b-wrapper.""" np.testing.assert_allclose(beta.b_qcd((2, 0), 3), 1.0) np.testing.assert_allclose(beta.b_qed((0, 2), 3, 3), 1.0) def test_zero(): - """test that beta_qed is zero for nf=nl=0""" + """Test that beta_qed is zero for nf=nl=0.""" for ord in range(2, 3 + 1): np.testing.assert_allclose(beta.beta_qed((0, ord), 0, 0), 0) def test_linearity(): - """test linearity of QED beta function when nf=0""" + """Test linearity of QED beta function when nf=0.""" for ord in range(2, 3 + 1): for nl in [0, 2]: np.testing.assert_allclose( diff --git a/tests/eko/test_couplings.py b/tests/eko/test_couplings.py index 9b68d308b..37c9454e3 100644 --- a/tests/eko/test_couplings.py +++ b/tests/eko/test_couplings.py @@ -1,7 +1,5 @@ -""" - This module tests the implemented beta functions and the value - of alpha_s for different orders. -""" +"""This module tests the implemented beta functions and the value of alpha_s +for different orders.""" import copy import enum diff --git a/tests/eko/test_gamma.py b/tests/eko/test_gamma.py index dfa8f069f..87b6d5287 100644 --- a/tests/eko/test_gamma.py +++ b/tests/eko/test_gamma.py @@ -1,6 +1,4 @@ -""" - This module tests the implemented gamma functions -""" +"""This module tests the implemented gamma functions.""" import numpy as np import pytest @@ -9,7 +7,7 @@ def test_gamma(): - """gamma-wrapper""" + """gamma-wrapper.""" nf = 3 np.testing.assert_allclose(gamma.gamma(1, nf), gamma.gamma_qcd_as1()) np.testing.assert_allclose(gamma.gamma(2, nf), gamma.gamma_qcd_as2(nf)) diff --git a/tests/eko/test_interpolation.py b/tests/eko/test_interpolation.py index 52deec9de..b3d032415 100644 --- a/tests/eko/test_interpolation.py +++ b/tests/eko/test_interpolation.py @@ -10,7 +10,7 @@ def check_is_interpolator(interpolator): - """Check whether the functions are indeed interpolators""" + """Check whether the functions are indeed interpolators.""" values = [0.1, 0.2, 0.4, 0.6, 0.8] # has to be in the range of the interpolation, but for the numerical integration of the # logartithmic interpolation to work it has to be setup in a rather larger area @@ -45,7 +45,7 @@ def check_is_interpolator(interpolator): def check_correspondence_interpolators(inter_x, inter_N): """Check the correspondece between x and N space of the interpolators - inter_x and inter_N""" + inter_x and inter_N.""" ngrid = [complex(1.0), complex(1.0 + 1j), complex(2.5 - 2j)] logxinv = np.log(0.9e-2) # < 1e-2, to trick skipping for fun_x, fun_N in zip(inter_x, inter_N): @@ -56,8 +56,7 @@ def check_correspondence_interpolators(inter_x, inter_N): def mellin_transform(f, N): - """ - Mellin transformation + """Mellin transformation. Parameters ---------- @@ -153,7 +152,7 @@ def test_evaluate_x(self): assert_almost_equal(bx.evaluate_x(x), bN.evaluate_x(x)) def test_math(self): - """Test math properties of interpolator""" + """Test math properties of interpolator.""" poly_deg = 4 for log in [True, False]: xgrid = interpolation.XGrid(np.linspace(0.09, 1, 10), log=log) diff --git a/tests/eko/test_matchings.py b/tests/eko/test_matchings.py index 12934789d..2cebe92bb 100644 --- a/tests/eko/test_matchings.py +++ b/tests/eko/test_matchings.py @@ -1,4 +1,4 @@ -"""Tests for the threshold class""" +"""Tests for the threshold class.""" from dataclasses import astuple diff --git a/tests/eko/test_mellin.py b/tests/eko/test_mellin.py index 0b50f039b..bcd6f09bf 100644 --- a/tests/eko/test_mellin.py +++ b/tests/eko/test_mellin.py @@ -1,4 +1,4 @@ -"""Test Mellin module""" +"""Test Mellin module.""" import numpy as np from numpy.testing import assert_allclose, assert_almost_equal @@ -7,7 +7,7 @@ def check_path_derivation(path, jacobian, extra_args): - """Check the derivatives of the path""" + """Check the derivatives of the path.""" epss = [1e-2, 1e-3, 1e-4, 1e-5] for t0 in [0.2, 0.4, 0.6, 0.8]: # avoid 0.5 due to Talbot+edge @@ -24,7 +24,7 @@ def check_path_derivation(path, jacobian, extra_args): def check_path_symmetry(path, jac, extra_args): - """Check symmetry arount 1/2""" + """Check symmetry arount 1/2.""" for t in [0.1, 0.2, 0.3]: plow = path(0.5 - t, *extra_args) phigh = path(0.5 + t, *extra_args) diff --git a/tests/eko/test_msbar_masses.py b/tests/eko/test_msbar_masses.py index 25718e962..84de2b13c 100644 --- a/tests/eko/test_msbar_masses.py +++ b/tests/eko/test_msbar_masses.py @@ -5,7 +5,6 @@ from eko import msbar_masses from eko.couplings import Couplings -from eko.io import types from eko.io.runcards import TheoryCard from eko.quantities.couplings import CouplingEvolutionMethod from eko.quantities.heavy_quarks import HeavyQuarkMasses, QuarkMassRef, QuarkMassScheme diff --git a/tests/eko/test_quantities.py b/tests/eko/test_quantities.py index d3c412a25..67a2cc467 100644 --- a/tests/eko/test_quantities.py +++ b/tests/eko/test_quantities.py @@ -9,26 +9,26 @@ def test_HeavyQuarks(): with pytest.raises(ValueError): hq.MatchingRatios([1, 2, 3, 4]) - l = hq.MatchingRatios([0.5, 2.0, 3.0]) - assert len(l) == 3 - assert l.c == 0.5 - assert l.b == 2.0 - assert l.t == 3.0 - l.c = 0.7 - assert len(l) == 3 - assert l.c == 0.7 - assert l.b == 2.0 - assert l.t == 3.0 - l.b = 2.7 - assert len(l) == 3 - assert l.c == 0.7 - assert l.b == 2.7 - assert l.t == 3.0 - l.t = 3.7 - assert len(l) == 3 - assert l.c == 0.7 - assert l.b == 2.7 - assert l.t == 3.7 + r = hq.MatchingRatios([0.5, 2.0, 3.0]) + assert len(r) == 3 + assert r.c == 0.5 + assert r.b == 2.0 + assert r.t == 3.0 + r.c = 0.7 + assert len(r) == 3 + assert r.c == 0.7 + assert r.b == 2.0 + assert r.t == 3.0 + r.b = 2.7 + assert len(r) == 3 + assert r.c == 0.7 + assert r.b == 2.7 + assert r.t == 3.0 + r.t = 3.7 + assert len(r) == 3 + assert r.c == 0.7 + assert r.b == 2.7 + assert r.t == 3.7 def test_HeavyInfo(): diff --git a/tests/ekore/anomalous_dimensions/unpolarized/space_like/test_as4.py b/tests/ekore/anomalous_dimensions/unpolarized/space_like/test_as4.py index 7eccd27c0..676cfe5e4 100644 --- a/tests/ekore/anomalous_dimensions/unpolarized/space_like/test_as4.py +++ b/tests/ekore/anomalous_dimensions/unpolarized/space_like/test_as4.py @@ -217,8 +217,7 @@ def test_diff_pm_nf2(): # Note that discrepancy for low moments is higher due to # oscillating behavior which is not captured by our parametrization def deltaB3(n, sx_cache): - """ - Implementation of Eq. 3.4 of :cite:`Davies:2016jie`. + """Implementation of Eq. 3.4 of :cite:`Davies:2016jie`. Parameters ---------- diff --git a/tests/ekore/harmonics/__init__.py b/tests/ekore/harmonics/__init__.py index 49695f099..74bbc50ae 100644 --- a/tests/ekore/harmonics/__init__.py +++ b/tests/ekore/harmonics/__init__.py @@ -38,7 +38,6 @@ def sx(n, max_weight=5): ------- np.ndarray list of harmonics sums (:math:`S_{1,..,w}`) - """ sx = np.zeros(max_weight, dtype=np.complex_) if max_weight >= 1: @@ -71,7 +70,6 @@ def smx(n, sx, is_singlet): ------- np.ndarray list of harmonics sums (:math:`S_{-1,..,-w}`) - """ max_weight = sx.size smx = np.zeros(max_weight, dtype=np.complex_)