From 5ae01b4ea844e60298c944b979045dc3f1635ed3 Mon Sep 17 00:00:00 2001 From: juacrumar Date: Thu, 30 Nov 2023 16:07:20 +0100 Subject: [PATCH] dont extrapolate in q --- .github/workflows/test_many_pdfs.yml | 2 +- benchmarks_and_tests/test_many_pdfs.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_many_pdfs.yml b/.github/workflows/test_many_pdfs.yml index aded41c..b3af76a 100644 --- a/.github/workflows/test_many_pdfs.yml +++ b/.github/workflows/test_many_pdfs.yml @@ -2,7 +2,7 @@ name: Check interpolation for many PDFs on: [push] jobs: - pdftest: + test_of_pdfs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/benchmarks_and_tests/test_many_pdfs.py b/benchmarks_and_tests/test_many_pdfs.py index a5030ca..a8f6c6b 100644 --- a/benchmarks_and_tests/test_many_pdfs.py +++ b/benchmarks_and_tests/test_many_pdfs.py @@ -32,8 +32,9 @@ def _compare_w_lhapdf(pdf, npoints=1000, tolerance=1e-6): # Get n points for x between 0 and 1 xx = np.random.rand(npoints) - # And n points for q between 1 and 1e5 GeV - qq = (1.0 + np.random.rand(npoints) * np.sqrt(pdfflow_pdf.q2max)) ** 2 + # And n points for q between the min and the maximum seen by pdfflow + qdelta = pdfflow_pdf.q2max - pdfflow_pdf.q2min + qq = pdfflow_pdf.q2min + np.random.rand(npoints) * qdelta # Make sure the order is the same as in pdfflow flavors = pdf.info["Flavors"] @@ -42,7 +43,7 @@ def _compare_w_lhapdf(pdf, npoints=1000, tolerance=1e-6): lres = np.array(lhapdf_results) pres = pdfflow_pdf.py_xfxQ2_allpid(xx, qq).numpy() - np.testing.assert_allclose(pres, lres, rtol=tolerance) + np.testing.assert_allclose(pres, lres, rtol=tolerance, atol=tolerance) if __name__ == "__main__":