From 08b1fed17953ac80f132716e8bfc16578b4a78dc Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Tue, 14 Mar 2023 17:10:49 +0100 Subject: [PATCH] Invert ekomark-ekobox dependency --- doc/source/overview/tutorials/pdf.ipynb | 6 +++--- doc/source/theory/DGLAP.rst | 2 +- extras/matching/check-matching.py | 2 +- pyproject.toml | 11 ++++++++--- src/ekobox/__init__.py | 3 +-- src/{ekomark => ekobox}/apply.py | 0 src/ekobox/evol_pdf.py | 3 +-- src/ekobox/genpdf/__init__.py | 4 +++- src/ekomark/benchmark/runner.py | 6 ++---- tests/{ekomark => ekobox}/test_apply.py | 2 +- 10 files changed, 21 insertions(+), 18 deletions(-) rename src/{ekomark => ekobox}/apply.py (100%) rename tests/{ekomark => ekobox}/test_apply.py (98%) diff --git a/doc/source/overview/tutorials/pdf.ipynb b/doc/source/overview/tutorials/pdf.ipynb index c2325d474..e7cddf4a5 100644 --- a/doc/source/overview/tutorials/pdf.ipynb +++ b/doc/source/overview/tutorials/pdf.ipynb @@ -13,7 +13,7 @@ "id": "3e0dcd0f", "metadata": {}, "source": [ - "## Method 1: Using eko and ekomark.apply_pdf\n", + "## Method 1: Using apply_pdf\n", "\n", "In this first part we will compute the eko and subsequently apply the initial PDF \"manually\" calling a dedicated function. " ] @@ -69,7 +69,7 @@ "metadata": {}, "outputs": [], "source": [ - "from ekomark.apply import apply_pdf\n", + "from ekobox.apply import apply_pdf\n", "with eko.EKO.open(\"./myeko.tar\") as evolution_operator:\n", " evolved_pdfs = apply_pdf(evolution_operator, pdf)" ] @@ -149,7 +149,7 @@ "id": "e925d2c9", "metadata": {}, "source": [ - "## Method 2: Using ekobox\n", + "## Method 2: Using evolve_pdfs\n", "\n", "In this second part we illustrate how to get (and install) directly a LHAPDF set evolved with eko. " ] diff --git a/doc/source/theory/DGLAP.rst b/doc/source/theory/DGLAP.rst index 91f7f9e11..245dd43cd 100644 --- a/doc/source/theory/DGLAP.rst +++ b/doc/source/theory/DGLAP.rst @@ -524,7 +524,7 @@ any longer and hence, they have to be rejoined with their evolution basis elemen part in the ordinary collinear evolution. Mixed |QCD| :math:`\otimes` |QED| evolution ------------------------------------------ +------------------------------------------- For the moment in this case only the `exact` evolution is implemented. diff --git a/extras/matching/check-matching.py b/extras/matching/check-matching.py index 349f902bc..2b866ffcd 100644 --- a/extras/matching/check-matching.py +++ b/extras/matching/check-matching.py @@ -13,7 +13,7 @@ import eko from eko.interpolation import lambertgrid -from ekomark.apply import apply_pdf +from ekobox.apply import apply_pdf t = { "ID": 0, diff --git a/pyproject.toml b/pyproject.toml index cdf9bae73..a385d9f79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,8 +21,13 @@ classifiers = [ "Topic :: Scientific/Engineering :: Physics", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", ] -repository = "https://github.com/N3PDF/eko" -include = ["src/ekomark/benchmark/external/LHA.yaml", "doc/source/img/Logo.png"] +repository = "https://github.com/NNPDF/eko" +include = [ + "doc/source/img/Logo.png", + "src/ekobox/genpdf/templatePDF.info", + "src/ekobox/genpdf/Toy.info", + "src/ekomark/benchmark/external/LHA.yaml", +] packages = [ { include = "eko", from = "src" }, { include = "ekomark", from = "src" }, @@ -82,7 +87,7 @@ devtools = "^0.10.0" [tool.poetry.extras] docs = ["sphinx", "sphinx-rtd-theme", "sphinxcontrib-bibtex", "nbsphinx"] mark = ["banana-hep", "sqlalchemy", "pandas", "matplotlib"] -box = ["banana-hep", "sqlalchemy", "pandas", "matplotlib", "rich"] +box = ["rich"] [tool.poetry-dynamic-versioning] enable = true diff --git a/src/ekobox/__init__.py b/src/ekobox/__init__.py index 80ec1ebb7..8a6886c64 100644 --- a/src/ekobox/__init__.py +++ b/src/ekobox/__init__.py @@ -1,4 +1,3 @@ """EKO user interface package.""" -from ekomark import apply -from . import cards, evol_pdf, info_file +from . import apply, cards, evol_pdf, info_file diff --git a/src/ekomark/apply.py b/src/ekobox/apply.py similarity index 100% rename from src/ekomark/apply.py rename to src/ekobox/apply.py diff --git a/src/ekobox/evol_pdf.py b/src/ekobox/evol_pdf.py index 5063b8adc..6e03b92d8 100644 --- a/src/ekobox/evol_pdf.py +++ b/src/ekobox/evol_pdf.py @@ -6,9 +6,8 @@ import eko from eko import basis_rotation as br from eko.io import EKO -from ekomark import apply -from . import genpdf, info_file +from . import apply, genpdf, info_file DEFAULT_NAME = "eko.tar" diff --git a/src/ekobox/genpdf/__init__.py b/src/ekobox/genpdf/__init__.py index 30185d69b..aa468951e 100644 --- a/src/ekobox/genpdf/__init__.py +++ b/src/ekobox/genpdf/__init__.py @@ -5,7 +5,6 @@ import shutil import numpy as np -from banana import toy from eko import basis_rotation as br @@ -55,6 +54,9 @@ def take_data(parent_pdf_set=None, members=False, xgrid=None, Q2grid=None): } if isinstance(parent_pdf_set, str): if parent_pdf_set in ["toy_pol", "toy"]: + # delay import to ease nnpdf integration + from banana import toy # pylint: disable=import-outside-toplevel + info = copy.deepcopy(load.Toy_info) if "pol" in parent_pdf_set: toylh = toy.mkPDF("ToyLH_polarized", 0) diff --git a/src/ekomark/benchmark/runner.py b/src/ekomark/benchmark/runner.py index f09bc608d..da2570719 100644 --- a/src/ekomark/benchmark/runner.py +++ b/src/ekomark/benchmark/runner.py @@ -14,8 +14,9 @@ from eko import EKO from eko import basis_rotation as br from eko.io import manipulate +from ekobox import apply -from .. import apply, pdfname +from .. import pdfname from ..data import db, operators @@ -104,7 +105,6 @@ def run_me(self, theory, ocard, _pdf): print(f"Using cached eko data: {os.path.relpath(path,os.getcwd())}") if self.plot_operator: - from ekomark.plots import ( # pylint:disable=import-error,import-outside-toplevel save_operators_to_pdf, ) @@ -245,7 +245,6 @@ def log(self, theory, _, pdf, me, ext): qed=qed, ) for q2 in q2s: - log_tab = dfdict.DFdict() ref_pdfs = ext["values"][q2] res = pdf_grid[q2] @@ -253,7 +252,6 @@ def log(self, theory, _, pdf, me, ext): my_pdf_errs = res["errors"] for key in my_pdfs: - if key in self.skip_pdfs(theory): continue diff --git a/tests/ekomark/test_apply.py b/tests/ekobox/test_apply.py similarity index 98% rename from tests/ekomark/test_apply.py rename to tests/ekobox/test_apply.py index da3048bf1..8f5ab48ef 100644 --- a/tests/ekomark/test_apply.py +++ b/tests/ekobox/test_apply.py @@ -1,6 +1,6 @@ import numpy as np -from ekomark import apply +from ekobox import apply from tests.conftest import EKOFactory