Skip to content

Commit c06d8df

Browse files
Add a test for mkPDF_lhapdf_file in Python
1 parent d4b9ef5 commit c06d8df

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

neopdf_pyapi/tests/test_pdfs.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import pytest
22
import numpy as np
3+
import os
4+
from pathlib import Path
35

46
from itertools import product
57
from neopdf.pdf import ForcePositive
@@ -146,6 +148,27 @@ def test_mkpdf_lhaid_member_offset(self, neo_pdfs):
146148
)
147149

148150

151+
class TestLoadFromFile:
152+
def test_mkpdf_lhapdf_by_file(self):
153+
from neopdf.pdf import PDF
154+
155+
neopdf_data_path = os.environ.get("NEOPDF_DATA_PATH")
156+
if not neopdf_data_path:
157+
pytest.skip("NEOPDF_DATA_PATH environment variable not set.")
158+
159+
path = Path(neopdf_data_path).joinpath(
160+
"NNPDF40_nnlo_as_01180/NNPDF40_nnlo_as_01180_0000.dat"
161+
)
162+
163+
if not path.exists():
164+
pytest.skip(f"Data file not found at {path}")
165+
166+
pdf = PDF.mkPDF_lhapdf_file(str(path))
167+
168+
xf = pdf.xfxQ2(21, 1e-9, 1.65 * 1.65)
169+
np.testing.assert_allclose(xf, 0.14844111, rtol=1e-8)
170+
171+
149172
class TestForcePositive:
150173
def test_force_positive(self, neo_pdf):
151174
neopdf = neo_pdf("nNNPDF30_nlo_as_0118_A56_Z26")

0 commit comments

Comments
 (0)