diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 10dc101d8..a169edc88 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -6,8 +6,8 @@ on: - master - "feature/*" - "release/*" - - "benchmarks/*" - - "tests/*" + - "benchmark/*" + - "test/*" pull_request: # TODO: https://github.community/t5/GitHub-Actions/Triggering-workflow-on-merge/td-p/40930 types: @@ -15,9 +15,6 @@ on: branches: - master -env: - UPLOAD_NON_MASTER: false - jobs: # build is the build: @@ -35,14 +32,6 @@ jobs: steps: # checkout the repo on the github runner - uses: actions/checkout@v2 - with: - token: ${{ secrets.ALE_DIS_PAT }} - submodules: "true" - # fetch all tags & stuffs - # in order to make GIT_DESCRIBE_* available (from git describe --tags) - # --> needed only for the conda-recipe - - name: Fetch tags - run: git fetch --unshallow --no-recurse-submodules # use an external action to setup miniconda # - also setup a conda virtual environment named 'yadism' # @@ -63,23 +52,6 @@ jobs: conda config --add channels https://packages.nnpdf.science/conda conda install -y lhapdf conda install -y apfel - # install eko - # - @ the correct commit (no official suitable tag currently available) - # - providing the C dependencies - - name: Install eko - shell: bash -l {0} - run: | - conda activate yadism - # - cd eko - # git fetch --unshallow - # git checkout 8b4f1c44664ed699d455c52c80f2bd1f9c0c642d - cd .. - # install Gnu Scientific Library (GSL) - # sudo works passwordless on github-workflow - sudo apt-get install libgsl-dev - # install eko (trailing '/' needed!) - pip install eko/ # install the actual python package 'yadism' - name: Install yadism shell: bash -l {0} @@ -109,12 +81,6 @@ jobs: conda activate yadism # run tests pytest -m quick_check benchmarks - #pytest - - name: Archive code coverage results - uses: actions/upload-artifact@v1 - with: - name: htmlcov - path: htmlcov - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/.github/workflows/pub_docs.yml b/.github/workflows/pub_docs.yml index e60454188..2c0b0d61c 100644 --- a/.github/workflows/pub_docs.yml +++ b/.github/workflows/pub_docs.yml @@ -9,7 +9,7 @@ jobs: deploy-ghpages: runs-on: ubuntu-latest strategy: - max-parallel: 2 +# max-parallel: 2 matrix: python-version: [3.7] fail-fast: false @@ -29,11 +29,6 @@ jobs: run: | # install pip python -m pip install --upgrade pip - # install eko - sudo apt-get install libgsl-dev # eko dependency - cd eko - pip install . - cd .. # install yadism pip install . - name: Build 🔨 diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 3ec70fbbb..bfd6e6e42 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -1,60 +1,30 @@ name: yadism-regression on: - - push - -env: - UPLOAD_NON_MASTER: false + push: + branches-ignore: + - "*docs*" jobs: # build is the build: runs-on: ubuntu-latest strategy: - max-parallel: 2 +# max-parallel: 2 matrix: - python-version: [3.8] - include: - - python-version: 3.8 + python-version: [3.7, 3.8] + fail-fast: false steps: # checkout the repo on the github runner - uses: actions/checkout@v2 - # checkout submodules - - name: Checkout submodules - uses: actions/checkout@v2 - with: - repository: N3PDF/eko - token: ${{ secrets.ALE_DIS_PAT }} - path: eko - name: Set up Python ${{ matrix.python-version }} 🐍 uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - # fetch all tags & stuffs - # in order to make GIT_DESCRIBE_* available (from git describe --tags) - # --> needed only for the conda-recipe - - name: Fetch tags - run: git fetch --unshallow --no-recurse-submodules - # install eko - # - @ the correct commit (no official suitable tag currently available) - # - providing the C dependencies - - name: Install eko - run: | - # - cd eko - # git fetch --unshallow - # git checkout 8b4f1c44664ed699d455c52c80f2bd1f9c0c642d - cd .. - # install Gnu Scientific Library (GSL) - # sudo works passwordless on github-workflow - sudo apt-get install libgsl-dev - # install eko (trailing '/' needed!) - pip install eko/ # install the actual python package 'yadism' - name: Install yadism run: | - # pip install . - name: Prepare Test environment run: | @@ -68,12 +38,6 @@ jobs: run: | # run tests pytest -m regression - #pytest - - name: Archive code coverage results - uses: actions/upload-artifact@v1 - with: - name: htmlcov - path: htmlcov - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index a326ca540..5737c1f8a 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -5,86 +5,29 @@ on: branches-ignore: - "*docs*" -defaults: - run: - shell: bash -l {0} - -env: - UPLOAD_NON_MASTER: false - jobs: # build is the build: runs-on: ubuntu-latest strategy: - max-parallel: 2 +# max-parallel: 2 matrix: - python-version: [3.8] - include: - - python-version: 3.8 - conda-py: 38 - env: - CONDA_PY: ${{ matrix.conda-py }} # strange way to manage env vars inclusion - + python-version: [3.7, 3.8] + fail-fast: false + steps: - # checkout the repo on the github runner - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} 🐍 + uses: actions/setup-python@v1 with: - token: ${{ secrets.ALE_DIS_PAT }} - submodules: "true" - # fetch all tags & stuffs - # in order to make GIT_DESCRIBE_* available (from git describe --tags) - # --> needed only for the conda-recipe - - name: Fetch tags - run: git fetch --unshallow --no-recurse-submodules - # use an external action to setup miniconda - # - also setup a conda virtual environment named 'yadism' - # - # (in order to use the conda venv at each step you need to login with - # 'bash -l {0}' in the 'shell' field, and to activate the environment) - - uses: goanpeca/setup-miniconda@v1 - with: - auto-update-conda: true - miniconda-version: "latest" - activate-environment: yadism python-version: ${{ matrix.python-version }} - # install lhapdf and apfel from the nnpdf conda repo - - name: Install lhapdf and apfel with conda - run: | - conda activate yadism - # - conda config --add channels https://packages.nnpdf.science/conda - conda install -y lhapdf - conda install -y apfel - # install eko - # - @ the correct commit (no official suitable tag currently available) - # - providing the C dependencies - - name: Install eko - run: | - conda activate yadism - # - cd eko - # git fetch --unshallow - # git checkout 8b4f1c44664ed699d455c52c80f2bd1f9c0c642d - cd .. - # install Gnu Scientific Library (GSL) - # sudo works passwordless on github-workflow - sudo apt-get install libgsl-dev - # install eko (trailing '/' needed!) - pip install eko/ # install the actual python package 'yadism' - name: Install yadism run: | - conda activate yadism - # + python -m pip install --upgrade pip pip install . - name: Prepare Test environment run: | - conda activate yadism - # download required data: - # - install needed lhapdf PDFSets - #lhapdf update - #lhapdf get CT14llo_NF3 # install packages needed for testing pip install -r test_requirements.txt # generate input db @@ -96,11 +39,8 @@ jobs: # - only for 'dis', 'eko' is a dependency (supposed to be delivered # already checked) - name: Lint with pylint - shell: bash -l {0} run: | - conda activate yadism - # - conda install -y pylint toml + pip install pylint # Search for actual errors pylint src/*/*.py -E # For warnings instead return always zero @@ -108,15 +48,8 @@ jobs: # run the test with 'pytest' - name: Test yadism run: | - conda activate yadism # run tests pytest -m quick_check tests - #pytest - - name: Archive code coverage results - uses: actions/upload-artifact@v1 - with: - name: htmlcov - path: htmlcov - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 7527c1a33..000000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "eko"] - path = eko - url = git@github.com:N3PDF/eko.git - branch = master diff --git a/.pylintrc b/.pylintrc index 65c203db2..7938df680 100644 --- a/.pylintrc +++ b/.pylintrc @@ -423,7 +423,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis. It # supports qualified module names, as well as Unix pattern matching. -ignored-modules=matplotlib.cm,eko +ignored-modules=matplotlib.cm,eko,QCDNUM # Show a hint with possible names when a member name was not found. The aspect # of finding the hint is based on edit distance. diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore index e69de29bb..cc456831a 100644 --- a/benchmarks/.gitignore +++ b/benchmarks/.gitignore @@ -0,0 +1 @@ +*.wgt diff --git a/benchmarks/QCDNUM/QCDNUM.pyf b/benchmarks/QCDNUM/QCDNUM.pyf new file mode 100644 index 000000000..91799eef2 --- /dev/null +++ b/benchmarks/QCDNUM/QCDNUM.pyf @@ -0,0 +1,160 @@ +! -*- f90 -*- +! Note: the context of this file is case sensitive. + +python module extpdf__user__routines + interface + function func(ipdf,x,q,first)! in :QCDNUM:qcdnum/usr/usrevol.f:extpdf + integer intent(in) :: ipdf + double precision intent(in) :: x,q + logical intent(in) :: first + double precision intent(out) :: func + end function func + end interface +end python module extpdf__user__routines + +python module QCDNUM ! in + interface ! in :QCDNUM + subroutine qcinit(lun,fname) ! in :QCDNUM:qcdnum/usr/usrini.f + integer intent(in) :: lun + character*(*) intent(in) :: fname + end subroutine qcinit + subroutine setval(chopt,dval) ! in :QCDNUM:qcdnum/usr/usrini.f + character*(*) intent(in) :: chopt + double precision intent(in) :: dval + end subroutine setval + subroutine getval(chopt,dval) ! in :QCDNUM:qcdnum/usr/usrini.f + character*(*) intent(in) :: chopt + double precision intent(out) :: dval + end subroutine getval + subroutine setord(iord) ! in :QCDNUM:qcdnum/usr/usrparams.f + integer intent(in) :: iord + end subroutine setord + subroutine getord(iord) ! in :QCDNUM:qcdnum/usr/usrparams.f + integer intent(out) :: iord + end subroutine getord + subroutine setalf(as,r2) ! in :QCDNUM:qcdnum/usr/usrparams.f + double precision intent(in) :: as + double precision intent(in) :: r2 + end subroutine setalf + subroutine getalf(as,r2) ! in :QCDNUM:qcdnum/usr/usrparams.f + double precision intent(out) :: as + double precision intent(out) :: r2 + end subroutine getalf + function iqfrmq(q) ! in :QCDNUM:qcdnum/usr/usrgrd.f + double precision intent(in) :: q + integer intent(out) :: iqfrmq + end function iqfrmq + subroutine setcbt(nfix,iqc,iqb,iqt) ! in :QCDNUM:qcdnum/usr/usrparams.f + integer intent(in) :: nfix + integer intent(in) :: iqc + integer intent(in) :: iqb + integer intent(in) :: iqt + end subroutine setcbt + subroutine zswitch(jset) ! in :QCDNUM:zmstf/src/zmstfs.f + integer intent(in) :: jset + end subroutine zswitch + subroutine gxmake(xmi,iwx,n,nxin,nxout,iosp) ! in :QCDNUM:qcdnum/usr/usrgrd.f + double precision dimension(n),intent(in) :: xmi + integer dimension(n),intent(in) :: iwx + integer optional,intent(hide),depend(xmi) :: n=len(xmi) + integer intent(in) :: nxin + integer intent(out) :: nxout + integer intent(in) :: iosp + end subroutine gxmake + subroutine gqmake(qq,ww,n,nqin,nqout) ! in :QCDNUM:qcdnum/usr/usrgrd.f + double precision dimension(n),intent(in) :: qq + double precision dimension(n),intent(in) :: ww + integer intent(hide),depend(qq,ww) :: n=len(qq) + integer intent(in) :: nqin + integer intent(out) :: nqout + end subroutine gqmake + subroutine extpdf(func,jset,n,offset,epsi) ! in :QCDNUM:qcdnum/usr/usrevol.f + use extpdf__user__routines + external func + integer intent(in) :: jset + integer intent(in) :: n + double precision intent(in) :: offset + double precision intent(out) :: epsi + end subroutine extpdf + function sumfxq(jset,def,isel,xx,qq,jchk) ! in :QCDNUM:qcdnum/usr/usrpdf.f + integer intent(in) :: jset + double precision dimension(13),intent(in) :: def + integer intent(in) :: isel + double precision intent(in) :: xx + double precision intent(in) :: qq + integer intent(in) :: jchk + double precision intent(out) :: sumfxq + end function sumfxq + subroutine zmstfun(istf,qvec,x,q,f,n,ichk) ! in :QCDNUM:zmstf/src/zmstfs.f + integer intent(in) :: istf + double precision dimension(13),intent(in) :: qvec + double precision dimension(n),intent(in) :: x + double precision dimension(n),intent(in),depend(n) :: q + double precision dimension(n),intent(out),depend(n) :: f + integer optional,intent(hide),depend(x) :: n=len(x) + integer intent(in) :: ichk + end subroutine zmstfun + function nxtlun(lmin) ! in :QCDNUM:qcdnum/usr/usrini.f + integer intent(in) :: lmin + integer intent(out) :: nxtlun + end function nxtlun + subroutine wtfile(itype,file) ! in :QCDNUM:qcdnum/usr/usrwgt.f + integer intent(in) :: itype + character*(*) intent(in) :: file + end subroutine wtfile + subroutine zmfillw(nwords) ! in :QCDNUM:zmstf/src/zmweits.f + integer intent(out) :: nwords + end subroutine zmfillw + subroutine zmdumpw(lun,file) ! in :QCDNUM:zmstf/src/zmweits.f + integer intent(in) :: lun + character*(*) intent(in) :: file + end subroutine zmdumpw + subroutine zmwords(ntot,nused) ! in :QCDNUM:zmstf/src/zmstfs.f + integer intent(out) :: ntot + integer intent(out) :: nused + end subroutine zmwords + subroutine zmreadw(lun,file,nwords,ierr) ! in :QCDNUM:zmstf/src/zmweits.f + integer intent(in) :: lun + character*(*) intent(int) :: file + integer intent(out) :: nwords + integer intent(out) :: ierr + end subroutine zmreadw + subroutine hqwords(ntot,nused) ! in :QCDNUM:hqstf/src/hqstfs.f + integer intent(out) :: ntot + integer intent(out) :: nused + end subroutine hqwords + subroutine hswitch(jset) ! in :QCDNUM:hqstf/src/hqstfs.f + integer intent(in) :: jset + end subroutine hswitch + subroutine hqstfun(istf,kcbt,def,x,q,f,n,ichk) ! in :QCDNUM:hqstf/src/hqstfs.f + integer intent(in) :: istf + integer intent(in) :: kcbt + double precision dimension(13),intent(in) :: def + double precision dimension(n),intent(in) :: x + double precision dimension(n),intent(in),depend(n) :: q + double precision dimension(n),intent(out),depend(n) :: f + integer optional,intent(hide),depend(x) :: n=len(x) + integer intent(in) :: ichk + end subroutine hqstfun + subroutine hqfillw(istf,qmas,aq2,bq2,nwords) ! in :QCDNUM:hqstf/src/hqweits.f + integer intent(in) :: istf + double precision dimension(3),intent(in) :: qmas + double precision intent(in) :: aq2 + double precision intent(in) :: bq2 + integer intent(out) :: nwords + end subroutine hqfillw + subroutine hqdumpw(lun,file) ! in :QCDNUM:hqstf/src/hqweits.f + integer intent(in) :: lun + character*(*) intent(in) :: file + end subroutine hqdumpw + subroutine hqreadw(lun,file,nwords,ierr) ! in :QCDNUM:hqstf/src/hqweits.f + integer intent(in) :: lun + character*(*) intent(in) :: file + integer intent(out) :: nwords + integer intent(out) :: ierr + end subroutine hqreadw + end interface +end python module QCDNUM + +! This file was auto-generated with f2py (version:2). +! See http://cens.ioc.ee/projects/f2py2e/ diff --git a/benchmarks/QCDNUM/QCDNUM.template.pyf b/benchmarks/QCDNUM/QCDNUM.template.pyf new file mode 100644 index 000000000..4c8aeb952 --- /dev/null +++ b/benchmarks/QCDNUM/QCDNUM.template.pyf @@ -0,0 +1,114 @@ +! -*- f90 -*- +! Note: the context of this file is case sensitive. + +python module QCDNUM ! in + interface ! in :QCDNUM + subroutine qcinit(lun,fname) ! in :QCDNUM:qcdnum/usr/usrini.f + integer :: lun + character*(*) :: fname + end subroutine qcinit + function nxtlun(lmin) ! in :QCDNUM:qcdnum/usr/usrini.f + integer :: lmin + integer :: nxtlun + end function nxtlun + subroutine setval(chopt,dval) ! in :QCDNUM:qcdnum/usr/usrini.f + character*(*) :: chopt + double precision :: dval + end subroutine setval + subroutine getval(chopt,dval) ! in :QCDNUM:qcdnum/usr/usrini.f + character*(*) :: chopt + double precision :: dval + end subroutine getval + subroutine setord(iord) ! in :QCDNUM:qcdnum/usr/usrparams.f + integer :: iord + end subroutine setord + subroutine getord(iord) ! in :QCDNUM:qcdnum/usr/usrparams.f + integer :: iord + end subroutine getord + subroutine setalf(as,r2) ! in :QCDNUM:qcdnum/usr/usrparams.f + double precision :: as + double precision :: r2 + end subroutine setalf + subroutine getalf(as,r2) ! in :QCDNUM:qcdnum/usr/usrparams.f + double precision :: as + double precision :: r2 + end subroutine getalf + subroutine setcbt(nfix,iqc,iqb,iqt) ! in :QCDNUM:qcdnum/usr/usrparams.f + integer :: nfix + integer :: iqc + integer :: iqb + integer :: iqt + end subroutine setcbt + function sumfxq(jset,def,isel,xx,qq,jchk) ! in :QCDNUM:qcdnum/usr/usrpdf.f90 + integer :: jset + double precision dimension(13) :: def + integer :: isel + double precision :: xx + double precision :: qq + integer :: jchk + double precision :: sumfxq + end function sumfxq + subroutine extpdf(func,jset,n,offset,epsi) ! in :QCDNUM:qcdnum/usr/usrevol.f + external func + integer :: jset + integer :: n + double precision :: offset + double precision :: epsi + end subroutine extpdf + subroutine gxmake(xmi,iwx,n,nxin,nxout,iosp) ! in :QCDNUM:qcdnum/usr/usrgrd.f + double precision dimension(*) :: xmi + integer dimension(*) :: iwx + integer :: n + integer :: nxin + integer :: nxout + integer :: iosp + end subroutine gxmake + subroutine gqmake(qq,ww,n,nqin,nqout) ! in :QCDNUM:qcdnum/usr/usrgrd.f + double precision dimension(*) :: qq + double precision dimension(*) :: ww + integer :: n + integer :: nqin + integer :: nqout + end subroutine gqmake + function iqfrmq(q) ! in :QCDNUM:qcdnum/usr/usrgrd.f + double precision :: q + integer :: iqfrmq + end function iqfrmq + subroutine wtfile(itype,file) ! in :QCDNUM:qcdnum/usr/usrwgt.f + integer :: itype + character*(*) :: file + end subroutine wtfile + subroutine zmwords(ntot,nused) ! in :QCDNUM:zmstf/src/zmstfs.f + integer :: ntot + integer :: nused + end subroutine zmwords + subroutine zswitch(jset) ! in :QCDNUM:zmstf/src/zmstfs.f + integer :: jset + end subroutine zswitch + subroutine zmstfun(istf,qvec,x,q,f,n,ichk) ! in :QCDNUM:zmstf/src/zmstfs.f + integer :: istf + double precision dimension(13) :: qvec + double precision dimension(*) :: x + double precision dimension(*) :: q + double precision dimension(*) :: f + integer :: n + integer :: ichk + end subroutine zmstfun + subroutine zmfillw(nwords) ! in :QCDNUM:zmstf/src/zmweits.f + integer :: nwords + end subroutine zmfillw + subroutine zmdumpw(lun,file) ! in :QCDNUM:zmstf/src/zmweits.f + integer :: lun + character*(*) :: file + end subroutine zmdumpw + subroutine zmreadw(lun,file,nwords,ierr) ! in :QCDNUM:zmstf/src/zmweits.f + integer :: lun + character*(*) :: file + integer :: nwords + integer :: ierr + end subroutine zmreadw + end interface +end python module QCDNUM + +! This file was auto-generated with f2py (version:2). +! See http://cens.ioc.ee/projects/f2py2e/ diff --git a/benchmarks/QCDNUM/f2py.sh b/benchmarks/QCDNUM/f2py.sh new file mode 100755 index 000000000..b35874861 --- /dev/null +++ b/benchmarks/QCDNUM/f2py.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +MODE=2 +FILES='qcdnum/usr/usrini.f qcdnum/usr/usrparams.f qcdnum/usr/usrpdf.f90 qcdnum/usr/usrevol.f qcdnum/usr/usrgrd.f qcdnum/usr/usrwgt.f zmstf/src/zmstfs.f zmstf/src/zmweits.f hqstf/src/hqstfs.f hqstf/src/hqweits.f' + + +if [ "$MODE" -eq "1" ]; + then + f2py3 --overwrite-signature -m QCDNUM -h QCDNUM.template.pyf $FILES \ + only: qcinit setval getval setord getord setalf getalf iqfrmq setcbt extpdf sumfxq gxmake gqmake wtfile nxtlun zmwords zmreadw zmfillw zmdumpw zswitch zmstfun hqwords hqreadw hqfillw hqdumpw hswitch hqstfun : ; +fi; + +if [ "$MODE" -eq "2" ]; + then + f2py3 -m QCDNUM -c QCDNUM.pyf $FILES\ + `qcdnum-config --cppflags` `qcdnum-config --ldflags` -I./qcdnum/inc/ -I./zmstf/inc/ -I./hqstf/inc/ ; +fi; diff --git a/benchmarks/QCDNUM/qcdnum.py b/benchmarks/QCDNUM/qcdnum.py new file mode 100644 index 000000000..96c880c4c --- /dev/null +++ b/benchmarks/QCDNUM/qcdnum.py @@ -0,0 +1,135 @@ +#!/usr/bin/python3 +import os + +import numpy as np + +import QCDNUM +import lhapdf +import toyLH + +# init +QCDNUM.qcinit(6, " ") + +# set params +QCDNUM.setord(2) # 1 = LO, ... +# QCDNUM.setalf(0.35, 2) # alpha(mu_0^2), mu_0^2 +QCDNUM.setalf(0.118, 91.2 ** 2) + +# make x and Q grids +xxtab = [ + 1.0e-5, + 2.0e-5, + 5.0e-5, + 1.0e-4, + 2.0e-4, + 5.0e-4, + 1.0e-3, + 2.0e-3, + 5.0e-3, + 1.0e-2, + 2.0e-2, + 5.0e-2, + 1.0e-1, + 1.5e-1, + 2.0e-1, + 3.0e-1, + 4.0e-1, + 5.5e-1, + 7.0e-1, + 9.0e-1, +] +xmi = xxtab[0] +xma = xxtab[-1] + +qqtab = [ + 2.0e0, + 2.7e0, + 3.6e0, + 5.0e0, + 7.0e0, + 1.0e1, + 1.4e1, + 2.0e1, + 3.0e1, + 5.0e1, + 7.0e1, + 1.0e2, + 2.0e2, + 5.0e2, + 1.0e3, + 3.0e3, + 1.0e4, + 4.0e4, + 2.0e5, + 1.0e6, +] +qmi = qqtab[0] +qma = qqtab[-1] + +iosp = 2 +n_x = 100 +n_q = 60 +nxout = QCDNUM.gxmake( + [xmi], [1], n_x, iosp +) # grid walls, grid weights, points, interpolation type +qarr = [qmi, qma] +warr = [1, 1] +nqout = QCDNUM.gqmake(qarr, warr, n_q) + +# setup FNS +mc2 = 2.0 ** 2 +iqc = QCDNUM.iqfrmq(mc2) +mb2 = 5.0 ** 2 +iqb = QCDNUM.iqfrmq(mb2) +mt2 = 173.0 ** 2 +iqt = QCDNUM.iqfrmq(mt2) +nfix = 0 +QCDNUM.setcbt(nfix, iqc, iqb, iqt) + +# Try to read the weight file and create one if that fails +# print(QCDNUM.getval("epsi"),QCDNUM.getval("epsg"),QCDNUM.getval("elim")) +# print(QCDNUM.getval("qmin"),QCDNUM.getval("qmax")) +wname = "unpolarised-py.wgt" +QCDNUM.wtfile(1, wname) + +# nztot,nzuse = QCDNUM.zmwords() +# print("nztot, nzuse = ", nztot, nzuse) + +# Try to read the weight file and create one if that fails +lunw = QCDNUM.nxtlun(10) +zmname = "zmstf-py.wgt" +nwords, ierr = QCDNUM.zmreadw(lunw, zmname) +if ierr != 0: + nwords = QCDNUM.zmfillw() + QCDNUM.zmdumpw(lunw, zmname) + +# setup external PDF +iset = 1 +QCDNUM.zswitch(iset) + + +class PdfCallable: + # pdf = lhapdf.mkPDF("CT14llo_NF3",0) + pdf = toyLH.mkPDF("", 0) + + def __call__(self, ipdf, x, qmu2, first): + if -6 <= ipdf <= 6: + a = self.pdf.xfxQ2(ipdf, x, qmu2) + return a + return 0.0 + + +pdf_epsi = QCDNUM.extpdf( + PdfCallable(), iset, 0, 0.1 +) # func, pdf set number, nr. extra pdfs, thershold offset + +# ask for some ESF +weights = ( + np.array([4.0, 1.0, 4.0, 1.0, 4.0, 1.0, 0.0, 1.0, 4.0, 1.0, 4.0, 1.0, 4.0]) / 9 +) +xs = [0.000317, 0.001007, 0.003195] +q2s = [90.0] * 3 +f2_list = QCDNUM.zmstfun(2, weights, xs, q2s, 1) +for x, q2, f2 in zip(xs, q2s, f2_list): + pr = QCDNUM.sumfxq(iset, weights, 1, x, q2, 1) + print(x, q2, "f2=", f2, "pr=", pr) diff --git a/benchmarks/aux/apfel_utils.py b/benchmarks/aux/apfel_utils.py index e0568a593..d37e7f39f 100644 --- a/benchmarks/aux/apfel_utils.py +++ b/benchmarks/aux/apfel_utils.py @@ -2,15 +2,6 @@ import platform import numpy as np -import tinydb - - -def str_datetime(dt): - return str(dt) - - -def unstr_datetime(s): - return datetime.strptime(s, "%Y-%m-%d %H:%M:%S.%f") def load_apfel(theory, observables, pdf="ToyLH"): @@ -41,10 +32,16 @@ def load_apfel(theory, observables, pdf="ToyLH"): apfel.SetPerturbativeOrder(theory.get("PTO")) if theory.get("ModEv") == "EXA": + apfel.SetPDFEvolution("exactalpha") + apfel.SetAlphaEvolution("exact") + elif theory.get("ModEv") == "EXP": apfel.SetPDFEvolution("expandalpha") apfel.SetAlphaEvolution("expanded") + elif theory.get("ModEv") == "TRN": + apfel.SetPDFEvolution("truncated") + apfel.SetAlphaEvolution("expanded") else: - raise RuntimeError(" ERROR: Unrecognised MODEV:", theory.get("ModEv")) + raise RuntimeError("ERROR: Unrecognised MODEV:", theory.get("ModEv")) # Coupling apfel.SetAlphaQCDRef(theory.get("alphas"), theory.get("Qref")) @@ -79,7 +76,7 @@ def load_apfel(theory, observables, pdf="ToyLH"): apfel.EnableDampingFONLL(theory.get("DAMP")) if theory.get("FNS") == "FFNS": apfel.SetFFNS(theory.get("NfFF")) - apfel.SetMassScheme("FFNS%d"%theory.get("NfFF")) + apfel.SetMassScheme("FFNS%d" % theory.get("NfFF")) else: apfel.SetVFNS() @@ -151,104 +148,64 @@ def load_apfel(theory, observables, pdf="ToyLH"): return apfel -def get_apfel_data(theory, observables, pdf_name, apfel_cache): +def compute_apfel_data(theory, observables, pdf): """ - Run APFEL to compute observables or simply use cached values. + Run APFEL to compute observables. Parameters ---------- - theory_path : - path for the theory runcard - observables_path : - path for the observables runcard - """ - - # search for document in the cache - cache_query = tinydb.Query() - c_query = ( - cache_query._theory_doc_id == theory.doc_id - ) # pylint:disable=protected-access - c_query &= ( - cache_query._observables_doc_id == observables.doc_id - ) # pylint:disable=protected-access - c_query &= cache_query._pdf == pdf_name # pylint:disable=protected-access - query_res = apfel_cache.search(c_query) - - apf_tab = None - # check if cache existing - if len(query_res) == 1: - apf_tab = query_res[0] - elif len(query_res) > 1: - raise ValueError("Cache query matched more than once.") - # check is updated - if apf_tab is not None: - theory_changed = unstr_datetime( - theory["_modify_time"] - ) # pylint:disable=protected-access - obs_changed = unstr_datetime( - observables["_modify_time"] - ) # pylint:disable=protected-access - tab_changed = unstr_datetime( - apf_tab["_creation_time"] - ) # pylint:disable=protected-access - if (theory_changed - tab_changed).total_seconds() > 0 or ( - obs_changed - tab_changed - ).total_seconds() > 0: - # delete old one - apfel_cache.remove(doc_ids=[apf_tab.doc_id]) - apf_tab = None - # cached or recompute - if apf_tab is not None: - return apf_tab - else: - # setup APFEL - apfel = load_apfel(theory, observables, pdf_name) - - # mapping observables names to APFEL methods - apfel_methods = { - "F2light": apfel.F2light, - "FLlight": apfel.FLlight, - "F2charm": apfel.F2charm, - "F2bottom": apfel.F2bottom, - "F2top": apfel.F2top, - "FLcharm": apfel.FLcharm, - "FLbottom": apfel.FLbottom, - "FLtop": apfel.FLtop, - "F2total": apfel.F2total, - "FLtotal": apfel.FLtotal, - } - - # compute observables with APFEL - apf_tab = {} - for FX, apfel_FX in apfel_methods.items(): - if FX not in observables: - # if not in the runcard just skip - continue - - # iterate over input kinematics - apf_tab[FX] = [] - for kinematics in observables.get(FX, []): - Q2 = kinematics["Q2"] - x = kinematics["x"] - - # disable APFEL evolution: we are interested in the pure DIS part - # - # setting initial scale to muF (sqrt(Q2)*xiF) APFEL is going to: - # - take the PDF at the scale of muF (exactly as we are doing) - # - evolve from muF to muF because the final scale is the second - # argument times xiF (internally), so actually it's not evolving - apfel.ComputeStructureFunctionsAPFEL( - np.sqrt(Q2) * theory["XIF"], np.sqrt(Q2) - ) - value = apfel_FX(x) - - apf_tab[FX].append(dict(x=x, Q2=Q2, value=value)) - - # store the cache - apf_tab["_theory_doc_id"] = theory.doc_id - apf_tab["_observables_doc_id"] = observables.doc_id - apf_tab["_pdf"] = pdf_name - apf_tab["_creation_time"] = str_datetime(datetime.now()) - apfel_cache.insert(apf_tab) + theory : dict + theory runcard + observables : dict + observables runcard + pdf : Any + PDF object (LHAPDF like) + Returns + ------- + apf_tab : dict + AFPEL numbers + """ + # setup APFEL + apfel = load_apfel(theory, observables, pdf.set().name) + + # mapping observables names to APFEL methods + apfel_methods = { + "F2light": apfel.F2light, + "FLlight": apfel.FLlight, + "F2charm": apfel.F2charm, + "F2bottom": apfel.F2bottom, + "F2top": apfel.F2top, + "FLcharm": apfel.FLcharm, + "FLbottom": apfel.FLbottom, + "FLtop": apfel.FLtop, + "F2total": apfel.F2total, + "FLtotal": apfel.FLtotal, + } + + # compute observables with APFEL + apf_tab = {} + for FX, apfel_FX in apfel_methods.items(): + if FX not in observables: + # if not in the runcard just skip + continue + + # iterate over input kinematics + apf_tab[FX] = [] + for kinematics in observables.get(FX, []): + Q2 = kinematics["Q2"] + x = kinematics["x"] + + # disable APFEL evolution: we are interested in the pure DIS part + # + # setting initial scale to muF (sqrt(Q2)*xiF) APFEL is going to: + # - take the PDF at the scale of muF (exactly as we are doing) + # - evolve from muF to muF because the final scale is the second + # argument times xiF (internally), so actually it's not evolving + apfel.ComputeStructureFunctionsAPFEL( + np.sqrt(Q2) * theory["XIF"], np.sqrt(Q2) + ) + value = apfel_FX(x) + + apf_tab[FX].append(dict(x=x, Q2=Q2, value=value)) return apf_tab diff --git a/benchmarks/aux/external_utils.py b/benchmarks/aux/external_utils.py new file mode 100644 index 000000000..cf8f98de8 --- /dev/null +++ b/benchmarks/aux/external_utils.py @@ -0,0 +1,84 @@ +from datetime import datetime + +import tinydb + + +def str_datetime(dt): + return str(dt) + + +def unstr_datetime(s): + return datetime.strptime(s, "%Y-%m-%d %H:%M:%S.%f") + + +def get_external_data(theory, observables, pdf, cache_table, cb_compute_data): + """ + Run external source to compute observables or simply use cached values. + + Parameters + ---------- + theory : dict + theory runcard + observables : dict + observables runcard + pdf : Any + PDF object (LHAPDF like) + cache_table : tinyDB.Table + caching table + cb_compute_data : callable + callback to compute the actual data (if caching isn't succesfull) + + Returns + ------- + tab : dict + external numbers + """ + pdf_name = pdf.set().name + # search for document in the cache + cache_query = tinydb.Query() + c_query = ( + cache_query._theory_doc_id == theory.doc_id # pylint:disable=protected-access + ) # pylint:disable=protected-access + c_query &= ( + cache_query._observables_doc_id == observables.doc_id + ) # pylint:disable=protected-access + c_query &= cache_query._pdf == pdf_name # pylint:disable=protected-access + query_res = cache_table.search(c_query) + + tab = None + # check if cache existing + if len(query_res) == 1: + tab = query_res[0] + elif len(query_res) > 1: + raise ValueError("Cache query matched more than once.") + # check is updated + if tab is not None: + theory_changed = unstr_datetime( + theory["_modify_time"] + ) # pylint:disable=protected-access + obs_changed = unstr_datetime( + observables["_modify_time"] + ) # pylint:disable=protected-access + tab_changed = unstr_datetime( + tab["_creation_time"] + ) # pylint:disable=protected-access + if (theory_changed - tab_changed).total_seconds() > 0 or ( + obs_changed - tab_changed + ).total_seconds() > 0: + # delete old one + cache_table.remove(doc_ids=[tab.doc_id]) + tab = None + # cached or recompute + if tab is not None: + return tab + else: + tab = cb_compute_data(theory, observables, pdf) + + # store the cache + tab["_theory_doc_id"] = theory.doc_id + tab["_observables_doc_id"] = observables.doc_id + tab["_pdf"] = pdf_name + tab["_creation_time"] = str_datetime(datetime.now()) + cache_table.insert(tab) + + return tab diff --git a/benchmarks/aux/generatePDF.py b/benchmarks/aux/generatePDF.py index 9953e4b67..5254c3f89 100644 --- a/benchmarks/aux/generatePDF.py +++ b/benchmarks/aux/generatePDF.py @@ -85,6 +85,7 @@ def uonly(): description = "'up quark only PDFset, for debug purpose'" dump_info(name, description, pids) + def conly(): name = "conly" (here / "PDFs" / name).mkdir(exist_ok=True) @@ -93,7 +94,9 @@ def conly(): xgrid = np.unique(np.concatenate([np.logspace(-9, 0, 100)])) Q2grid = np.logspace(0.3, 5, 20) pids = [-4, -3, -2, -1, 1, 2, 3, 4, 21] - antic = antis = antiu = antid = d = u = s = g = [0.0 for x in xgrid for Q2 in Q2grid] + antic = antis = antiu = antid = d = u = s = g = [ + 0.0 for x in xgrid for Q2 in Q2grid + ] c = [(1.0 - x) * x for x in xgrid for Q2 in Q2grid] pdf_table = np.array([antic, antis, antiu, antid, d, u, s, c, g]).T # pdf_table = np.vstack([np.array(pdf_table_Q2).T for i in range(len(Q2grid))]) @@ -144,6 +147,7 @@ def gonly(): description = "'gluon only PDFset, for debug purpose'" dump_info(name, description, pids) + def toy_gonly(): name = "toy_gonly" (here / "PDFs" / name).mkdir(exist_ok=True) @@ -166,6 +170,7 @@ def toy_gonly(): description = "'gluon only PDFset from toyLH, for debug purpose'" dump_info(name, description, pids) + def donly(): name = "donly" (here / "PDFs" / name).mkdir(exist_ok=True) @@ -203,6 +208,6 @@ def check(pdfset, pid): if __name__ == "__main__": # uonly_dense() toy_gonly() - #check("uonly", 2) - #check("uonly-dense", 2) - #check("gonly", 21) + # check("uonly", 2) + # check("uonly-dense", 2) + # check("gonly", 21) diff --git a/benchmarks/aux/qcdnum_utils.py b/benchmarks/aux/qcdnum_utils.py new file mode 100644 index 000000000..d35639e6f --- /dev/null +++ b/benchmarks/aux/qcdnum_utils.py @@ -0,0 +1,198 @@ +import pathlib +import numpy as np + + +def compute_qcdnum_data( + theory, observables, pdf +): # pylint: disable=too-many-statements,too-many-branches,too-many-locals + """ + Run QCDNUM to compute observables. + + Parameters + ---------- + theory : dict + theory runcard + observables : dict + observables runcard + pdf : Any + PDF object (LHAPDF like) + + Returns + ------- + num_tab : dict + QCDNUM numbers + """ + import QCDNUM # pylint:disable=import-outside-toplevel + + # remove QCDNUM cache files + wname = "unpolarised-py.wgt" + zmname = f"zmstf-py-{theory.doc_id}.wgt" + hqname = f"hqstf-py-{theory.doc_id}.wgt" + for f in [wname, zmname, hqname]: + pathlib.Path(f).unlink(missing_ok=True) + + # init + QCDNUM.qcinit(6, " ") + + # set params + QCDNUM.setalf(theory["alphas"], theory["Qref"] ** 2) + + # make x and Q grids + xmin = 0.1 + q2min = 10 + q2max = 20 + for obs in observables: + if obs[0] != "F": + continue + for kin in observables[obs]: + xmin = min(xmin, kin["x"]) + q2min = min(q2min, kin["Q2"]) + q2max = max(q2max, kin["Q2"]) + xarr = [xmin, np.power(xmin, 2.0 / 3.0)] + xwarr = [1, 1] + if xmin < 0.1: + xarr += [0.1, 0.5] + xwarr += [1, 1] + iosp = 3 + n_x = 289 + n_q = 60 + af = 1 / theory["XIF"] ** 2 + QCDNUM.gxmake( + xarr, xwarr, n_x, iosp + ) # grid walls, grid weights, points, interpolation type + qarr = [q2min / af, q2max / af] + qwarr = [1, 1] + QCDNUM.gqmake(qarr, qwarr, n_q) + + # setup FNS + mc = theory["mc"] + mb = theory["mb"] + mt = theory["mt"] + iqc = QCDNUM.iqfrmq(mc ** 2) + iqb = QCDNUM.iqfrmq(mb ** 2) + iqt = QCDNUM.iqfrmq(mt ** 2) + if theory["FNS"] == "FFNS": + nfix = theory["NfFF"] + else: + nfix = 0 + QCDNUM.setcbt(nfix, iqc, iqb, iqt) + + # Try to read the weight file and create one if that fails + QCDNUM.wtfile(1, wname) + + iset = 1 + + # Try to read the ZM-weight file and create one if that fails + zmlunw = QCDNUM.nxtlun(10) + _nwords, ierr = QCDNUM.zmreadw(zmlunw, zmname) + if ierr != 0: + QCDNUM.zmfillw() + QCDNUM.zmdumpw(zmlunw, zmname) + # set fact. scale + bf = 0.0 + QCDNUM.zmdefq2(af, bf) + QCDNUM.zswitch(iset) + + # Try to read the HQ-weight file and create one if that fails + hqlunw = QCDNUM.nxtlun(10) + _nwords, ierr = QCDNUM.hqreadw(hqlunw, hqname) + if ierr != 0: + QCDNUM.hqfillw(3, [mc, mb, mt], af, bf) + QCDNUM.hqdumpw(hqlunw, hqname) + + # set ren scale + arf = theory["XIR"] ** 2 / theory["XIF"] ** 2 + brf = 0 + QCDNUM.setabr(arf, brf) + QCDNUM.hswitch(iset) + + # setup external PDF + class PdfCallable: + def __init__(self, pdf): + self.pdf = pdf + + def __call__(self, ipdf, x, qmu2, first): + if -6 <= ipdf <= 6: + a = self.pdf.xfxQ2(ipdf, x, qmu2) + return a + return 0.0 + + # func, pdf set number, nr. extra pdfs, thershold offset + QCDNUM.extpdf(PdfCallable(pdf), iset, 0, 0) + + weights = ( + np.array([4.0, 1.0, 4.0, 1.0, 4.0, 1.0, 0.0, 1.0, 4.0, 1.0, 4.0, 1.0, 4.0]) / 9 + ) + + num_tab = {} + for obs in observables: + if obs[0] != "F": + continue + # select key by kind + kind = obs[:2] + kind_key = None + if kind == "F2": + kind_key = 2 + elif kind == "FL": + kind_key = 1 + else: + raise NotImplementedError(f"kind {kind} is not implemented!") + + # collect kins + xs = [] + q2s = [] + for kin in observables[obs]: + xs.append(kin["x"]) + q2s.append(kin["Q2"]) + # select fnc by flavor + flavor = obs[2:] + if flavor == "light": + QCDNUM.setord(1 + theory["PTO"]) # 1 = LO, ... + weights = ( + np.array( + [ + 4.0 * 0, + 1.0 * 0, + 4.0 * 0, + 1.0, + 4.0, + 1.0, + 0.0, + 1.0, + 4.0, + 1.0, + 4.0 * 0, + 1.0 * 0, + 4.0 * 0, + ] + ) + / 9 + ) + # fs = [] + # for x, Q2 in zip(xs,q2s): + # fs.append(QCDNUM.zmstfun(kind_key, weights, [x], [Q2], 1 )) + fs = QCDNUM.zmstfun(kind_key, weights, xs, q2s, 1) + else: + # for HQ pto is not absolute but rather relative, + # i.e., 1 loop DIS here meas "LO"[QCDNUM] + if theory["PTO"] == 0: + fs = [0.0] * len(xs) + else: + QCDNUM.setord(theory["PTO"]) # 1 = LO, ... + if flavor == "charm": + fs = QCDNUM.hqstfun(kind_key, 1, weights, xs, q2s, 1) + elif flavor == "bottom": + fs = QCDNUM.hqstfun(kind_key, -2, weights, xs, q2s, 1) + elif flavor == "top": + fs = QCDNUM.hqstfun(kind_key, -3, weights, xs, q2s, 1) + # reshuffle output + f_out = [] + for x, q2, f in zip(xs, q2s, fs): + f_out.append(dict(x=x, Q2=q2, value=f)) + num_tab[obs] = f_out + + # remove QCDNUM cache files + for f in [wname, zmname, hqname]: + pathlib.Path(f).unlink(missing_ok=True) + + return num_tab diff --git a/benchmarks/aux/toyLH.py b/benchmarks/aux/toyLH.py index 3b246419d..bfa8fe413 100644 --- a/benchmarks/aux/toyLH.py +++ b/benchmarks/aux/toyLH.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- -# -# toyLHPDFs from APFEL: -# -------------------- -# This routine returns the toyLH PDFs at the intitial scale -# which is supposed to be Q = sqrt(2) GeV. +""" +toyLHPDFs from APFEL: +-------------------- +This routine returns the toyLH PDFs at the intitial scale +which is supposed to be Q = sqrt(2) GeV. +""" def toyLHPDFs(id, x): @@ -49,6 +50,10 @@ def toyLHPDFs(id, x): return xpdf[id] +class toyPDFSet: + name = "ToyLH" + + class toyPDF: """Imitates lhapdf.PDF.""" @@ -97,6 +102,18 @@ def xfxQ(self, id, x, Q): return toyLHPDFs(id, x) + def alphasQ(self, q): + "Return alpha_s at q" + return 0.35 + + def alphasQ2(self, q2): + "Return alpha_s at q2" + return 0.35 + + def set(self): + "Return the corresponding PDFSet" + return toyPDFSet() + def mkPDF(setname, member): """Factory functions for making single PDF members. diff --git a/benchmarks/benchmark_against_apfel.py b/benchmarks/benchmark_against_apfel.py index 5a837ceb8..88698aad1 100644 --- a/benchmarks/benchmark_against_apfel.py +++ b/benchmarks/benchmark_against_apfel.py @@ -23,10 +23,10 @@ def test_LO(self): t_query &= p.theory_query.TMC == 0 o_query = p.obs_query.F2light.exists() - o_query |= p.obs_query.F2total.exists() + # o_query |= p.obs_query.F2total.exists() - p.run_queries_apfel(t_query, o_query, ["ToyLH"]) - #p.run_queries_apfel(t_query, o_query, ["toy_gonly"]) + p.run_queries_external(t_query, o_query, ["ToyLH"]) + # p.run_queries_external(t_query, o_query, ["toy_gonly"]) def test_NLO(self): """ @@ -40,10 +40,10 @@ def test_NLO(self): t_query &= p.theory_query.FNS == "FFNS" t_query &= p.theory_query.TMC == 0 - o_query = p.obs_query.prDIS.exists() + o_query = p.obs_query.F2light.exists() - p.run_queries_apfel(t_query, o_query, ["ToyLH"]) - #p.run_queries_apfel(t_query, o_query, ["toy_gonly"]) + p.run_queries_external(t_query, o_query, ["ToyLH"]) + # p.run_queries_external(t_query, o_query, ["toy_gonly"]) @pytest.mark.commit_check @@ -57,7 +57,7 @@ def test_LO(self): o_query = p.obs_query.F2light.exists() - p.run_queries_apfel(t_query, o_query, ["CT14llo_NF3"]) + p.run_queries_external(t_query, o_query, ["CT14llo_NF3"]) def test_NLO(self): p = DBInterface("input.json") @@ -68,7 +68,7 @@ def test_NLO(self): o_query = p.obs_query.prDIS.exists() - p.run_queries_apfel(t_query, o_query, ["CT14llo_NF3"]) + p.run_queries_external(t_query, o_query, ["CT14llo_NF3"]) @pytest.mark.commit_check @@ -84,8 +84,8 @@ def test_LO(self): o_query = p.obs_query.F2light.exists() - p.run_queries_apfel(t_query, o_query, ["ToyLH"]) - # p.run_queries_apfel(t_query, o_query, ["uonly-dense"]) + p.run_queries_external(t_query, o_query, ["ToyLH"]) + # p.run_queries_external(t_query, o_query, ["uonly-dense"]) def test_NLO(self): p = DBInterface("input.json") @@ -99,7 +99,8 @@ def test_NLO(self): o_query = p.obs_query.prDIS.exists() - p.run_queries_apfel(t_query, o_query, ["ToyLH"]) + p.run_queries_external(t_query, o_query, ["ToyLH"]) + class TestFNS: def test_LO(self): @@ -116,8 +117,8 @@ def test_LO(self): o_query = p.obs_query.F2light.exists() - #p.run_queries_apfel(t_query, o_query, ["CT14llo_NF6"]) - p.run_queries_apfel(t_query, o_query, ["uonly"]) + # p.run_queries_external(t_query, o_query, ["CT14llo_NF6"]) + p.run_queries_external(t_query, o_query, ["uonly"]) def test_NLO(self): """ @@ -129,13 +130,14 @@ def test_NLO(self): t_query &= p.theory_query.XIF == 1.0 t_query &= p.theory_query.TMC == 0 t_query &= p.theory_query.NfFF == 4 - #t_query &= p.theory_query.FNS == "FFNS" + # t_query &= p.theory_query.FNS == "FFNS" t_query &= p.theory_query.FNS == "FONLL-A" o_query = p.obs_query.F2charm.exists() - #p.run_queries_apfel(t_query, o_query, ["gonly"]) - p.run_queries_apfel(t_query, o_query, ["CT14llo_NF6"]) + # p.run_queries_external(t_query, o_query, ["gonly"]) + p.run_queries_external(t_query, o_query, ["CT14llo_NF6"]) + class TestTMCFNS: def test_LO(self): @@ -150,8 +152,8 @@ def test_LO(self): o_query = p.obs_query.prDIS.exists() - p.run_queries_apfel(t_query, o_query, ["CT14llo_NF6"]) - #p.run_queries_apfel(t_query, o_query, ["gonly"]) + p.run_queries_external(t_query, o_query, ["CT14llo_NF6"]) + # p.run_queries_external(t_query, o_query, ["gonly"]) def test_NLO(self): """ @@ -165,8 +167,9 @@ def test_NLO(self): o_query = p.obs_query.prDIS.exists() - #p.run_queries_apfel(t_query, o_query, ["gonly"]) - p.run_queries_apfel(t_query, o_query, ["CT14llo_NF6"]) + # p.run_queries_external(t_query, o_query, ["gonly"]) + p.run_queries_external(t_query, o_query, ["CT14llo_NF6"]) + @pytest.mark.full class TestFull: @@ -176,7 +179,7 @@ def test_LO(self): o_query = p.obs_query.prDIS.exists() - p.run_queries_apfel(t_query, o_query, ["ToyLH", "CT14llo_NF3"]) + p.run_queries_external(t_query, o_query, ["ToyLH", "CT14llo_NF3"]) def test_NLO(self): p = DBInterface("input.json") @@ -184,27 +187,26 @@ def test_NLO(self): o_query = p.obs_query.prDIS.exists() - p.run_queries_apfel(t_query, o_query, ["ToyLH", "CT14llo_NF3"]) - + p.run_queries_external(t_query, o_query, ["ToyLH", "CT14llo_NF3"]) if __name__ == "__main__": - #plain = TestPlain() - #plain.test_LO() - #plain.test_NLO() + plain = TestPlain() + plain.test_LO() + plain.test_NLO() # sv = TestScaleVariations() # sv.test_LO() # sv.test_NLO() - #tmc = TestTMC() - #tmc.test_LO() + # tmc = TestTMC() + # tmc.test_LO() # tmc.test_NLO() fns = TestFNS() - #fns.test_LO() - fns.test_NLO() + # fns.test_LO() + # fns.test_NLO() - #tmc_fns = TestTMCFNS() - #tmc_fns.test_LO() - #tmc_fns.test_NLO + # tmc_fns = TestTMCFNS() + # tmc_fns.test_LO() + # tmc_fns.test_NLO diff --git a/benchmarks/benchmark_against_qcdnum.py b/benchmarks/benchmark_against_qcdnum.py new file mode 100644 index 000000000..53bf0db38 --- /dev/null +++ b/benchmarks/benchmark_against_qcdnum.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- +# +# Compare the results with APFEL's + +import pytest +from db_interface import DBInterface, QueryFieldsEqual + + +@pytest.mark.quick_check +class TestPlain: + def test_LO(self): + """ + Test the full LO order against QCDNUM + """ + p = DBInterface("input.json") + t_query = p.theory_query.PTO == 0 + t_query &= p.theory_query.XIR == 1.0 + t_query &= p.theory_query.XIF == 1.0 + t_query &= p.theory_query.NfFF == 3 + t_query &= p.theory_query.FNS == "FFNS" + t_query &= p.theory_query.TMC == 0 + + o_query = p.obs_query.F2light.exists() + + p.run_queries_external(t_query, o_query, ["ToyLH"], "QCDNUM") + + def test_NLO(self): + """ + Test the full NLO order against QCDNUM + """ + p = DBInterface("input.json") + t_query = p.theory_query.PTO == 1 + t_query &= p.theory_query.XIR == 1.0 + t_query &= p.theory_query.XIF == 1.0 + t_query &= p.theory_query.NfFF == 3 + t_query &= p.theory_query.FNS == "FFNS" + t_query &= p.theory_query.TMC == 0 + + o_query = p.obs_query.F2light.exists() + + p.run_queries_external(t_query, o_query, ["ToyLH"], "QCDNUM") + + +class TestScaleVar: + def test_LO(self): + """ + Test the full LO order against QCDNUM + """ + p = DBInterface("input.json") + t_query = p.theory_query.PTO == 0 + t_query &= QueryFieldsEqual("XIR", "XIF") + t_query &= p.theory_query.NfFF == 3 + t_query &= p.theory_query.FNS == "FFNS" + t_query &= p.theory_query.TMC == 0 + + o_query = p.obs_query.F2light.exists() + + p.run_queries_external(t_query, o_query, ["ToyLH"], "QCDNUM") + + def test_NLO(self): + """ + Test the full NLO order against QCDNUM + """ + p = DBInterface("input.json") + t_query = p.theory_query.PTO == 1 + t_query &= QueryFieldsEqual("XIR", "XIF") + t_query &= p.theory_query.NfFF == 3 + t_query &= p.theory_query.FNS == "FFNS" + t_query &= p.theory_query.TMC == 0 + + o_query = p.obs_query.F2light.exists() + + p.run_queries_external(t_query, o_query, ["ToyLH"], "QCDNUM") + + +class TestFNS: + def test_LO(self): + """ + Test the full LO order against QCDNUM + """ + p = DBInterface("input.json") + t_query = p.theory_query.PTO == 0 + t_query &= p.theory_query.XIR == 1.0 + t_query &= p.theory_query.XIF == 1.0 + t_query &= ~(p.theory_query.FNS == "FONLL-A") + t_query &= p.theory_query.TMC == 0 + + o_query = p.obs_query.F2light.exists() + + p.run_queries_external(t_query, o_query, ["ToyLH"], "QCDNUM") + + def run_NLO_FFNS(self): + """ + Test the full NLO order against QCDNUM + """ + p = DBInterface("input.json") + t_query = p.theory_query.PTO == 1 + t_query &= p.theory_query.XIR == 1.0 + t_query &= p.theory_query.XIF == 1.0 + t_query &= p.theory_query.FNS == "FFNS" + t_query &= p.theory_query.TMC == 0 + + o_query = ~p.obs_query.F2total.exists() + o_query &= ~p.obs_query.FLtotal.exists() + + p.run_queries_external(t_query, o_query, ["ToyLH"], "QCDNUM") + + def run_NLO_ZM_VFNS(self): + """ + Test the full NLO order against QCDNUM + """ + p = DBInterface("input.json") + t_query = p.theory_query.PTO == 1 + t_query &= p.theory_query.XIR == 1.0 + t_query &= p.theory_query.XIF == 1.0 + t_query &= p.theory_query.NfFF == 3 + t_query &= p.theory_query.FNS == "ZM-VFNS" + t_query &= p.theory_query.TMC == 0 + + o_query = p.obs_query.F2light.exists() + o_query |= p.obs_query.FLlight.exists() + + p.run_queries_external(t_query, o_query, ["ToyLH"], "QCDNUM") + + def test_NLO(self): + self.run_NLO_FFNS() + self.run_NLO_ZM_VFNS() + + +if __name__ == "__main__": + plain = TestPlain() + # plain.test_LO() + # plain.test_NLO() + + sv = TestScaleVar() + # sv.test_LO() + # sv.test_NLO() + + fns = TestFNS() + # fns.test_LO() + fns.test_NLO() diff --git a/benchmarks/data/observables.py b/benchmarks/data/observables.py index 43dc1a74b..3a7689cc3 100644 --- a/benchmarks/data/observables.py +++ b/benchmarks/data/observables.py @@ -9,7 +9,7 @@ here = pathlib.Path(__file__).parent.absolute() sys.path.append(str(here / ".." / "aux")) -from apfel_utils import ( # pylint:disable=import-error,wrong-import-position +from external_utils import ( # pylint:disable=import-error,wrong-import-position str_datetime, ) @@ -34,7 +34,7 @@ # keep in mind, that in TMC xi < x # np.linspace(0.1, 1.0, 20), xgrid = np.unique( - np.concatenate([np.logspace(-4, np.log10(0.15), 20), np.linspace(0.15, 1.0, 12)]) + np.concatenate([np.geomspace(1e-4, 0.1, 20), np.linspace(0.1, 1.0, 12)]) ) # with open("apfel_xg.yaml") as o: # xgrid = yaml.safe_load(o) @@ -49,12 +49,12 @@ kinematics = [] # fixed Q2 kinematics.extend([dict(x=x, Q2=90.0) for x in xgrid[3::3].tolist()]) -#kinematics.extend([dict(x=x, Q2=90.0) for x in xgrid[-3:].tolist()]) -#kinematics.extend([dict(x=x, Q2=90.0) for x in np.logspace(-3, -1, 3).tolist()]) -#kinematics.extend([dict(x=x, Q2=90.0) for x in np.linspace(0.15, 0.9, 3).tolist()]) +# kinematics.extend([dict(x=x, Q2=90.0) for x in xgrid[-3:].tolist()]) +# kinematics.extend([dict(x=x, Q2=90.0) for x in np.logspace(-3, -1, 3).tolist()]) +# kinematics.extend([dict(x=x, Q2=90.0) for x in np.linspace(0.15, 0.9, 3).tolist()]) # fixed x -kinematics.extend([dict(x=0.01, Q2=Q2) for Q2 in np.geomspace(2, 300, 10).tolist()]) -#kinematics.extend([dict(x=0.01, Q2=Q2) for Q2 in np.linspace(2,20,18).tolist()]) +kinematics.extend([dict(x=0.001, Q2=Q2) for Q2 in np.geomspace(2, 1e3, 18).tolist()]) +# kinematics.extend([dict(x=0.01, Q2=Q2) for Q2 in np.linspace(2,20,18).tolist()]) # iterate over observables (one dict for each) for sf in observables: diff --git a/benchmarks/data/regression-observables.py b/benchmarks/data/regression-observables.py index 9173384d5..24566f76e 100644 --- a/benchmarks/data/regression-observables.py +++ b/benchmarks/data/regression-observables.py @@ -9,11 +9,11 @@ ask = input("Do you want to refill the regression observables? [y/n]") if ask != "y": print("Nothing done.") - exit() + sys.exit() here = pathlib.Path(__file__).parent.absolute() sys.path.append(str(here / ".." / "aux")) -from apfel_utils import ( # pylint:disable=import-error,wrong-import-position +from external_utils import ( # pylint:disable=import-error,wrong-import-position str_datetime, ) diff --git a/benchmarks/data/theory.py b/benchmarks/data/theory.py index 964f734d5..3679992f6 100644 --- a/benchmarks/data/theory.py +++ b/benchmarks/data/theory.py @@ -9,7 +9,7 @@ # import numpy as np here = pathlib.Path(__file__).parent.absolute() sys.path.append(str(here / ".." / "aux")) -from apfel_utils import ( # pylint:disable=import-error,wrong-import-position +from external_utils import ( # pylint:disable=import-error,wrong-import-position str_datetime, ) diff --git a/benchmarks/db_interface.py b/benchmarks/db_interface.py index a0bb3d59b..819524415 100644 --- a/benchmarks/db_interface.py +++ b/benchmarks/db_interface.py @@ -13,9 +13,26 @@ here = pathlib.Path(__file__).parent.absolute() sys.path.append(str(here / "aux")) import toyLH # pylint:disable=import-error,wrong-import-position -from apfel_utils import ( - str_datetime, -) # pylint:disable=import-error,wrong-import-position +import external_utils # pylint:disable=import-error,wrong-import-position + + +class QueryFieldsEqual(tinydb.queries.QueryInstance): + """ + Tests that two fields of the document are equal to each other + + Parameters + ---------- + field_a : str + first field + field_b : str + second field + """ + + def __init__(self, field_a, field_b): + def test(doc): + return field_a in doc and field_b in doc and doc[field_a] == doc[field_b] + + super().__init__(test, ("==", (field_a,), (field_b,))) class DBInterface: @@ -44,68 +61,56 @@ def run_queries_regression(self, theory_query, obs_query): # run against regression data self.run_regression(theory, obs) - def run_queries_apfel(self, theory_query, obs_query, pdfs): + def run_queries_external(self, theory_query, obs_query, pdfs, external="APFEL"): theories, observables = self._load_input(theory_query, obs_query) for theory, obs in itertools.product(theories, observables): - # run against APFEL - self.run_apfel(theory, obs, pdfs) - - def run_apfel(self, theory, observables, pdfs): - """ - Run APFEL comparison on the given runcards. - - Steps: - - instantiate and call yadism's Runner - - using ``yadism.Runner`` - - retrieve APFEL data to compare with - - using ``get_apfel_data`` - - check and collect comparison results - - using ``assert`` - - using ``print_comparison_table`` - - Parameters - ---------- - theory_f : - file path for the theory runcard - observables_f : - file path for the observables runcard - """ - from apfel_utils import ( - get_apfel_data, - ) # pylint:disable=import-error,import-outside-toplevel - - # ====================== - # get observables values - # ====================== - runner = Runner(theory, observables) - for pdf_name in pdfs: - - # setup PDFset - if pdf_name == "ToyLH": - pdf = toyLH.mkPDF("ToyLH", 0) - else: - import lhapdf # pylint:disable=import-outside-toplevel - - pdf = lhapdf.mkPDF(pdf_name, 0) - # run codes - yad_tab = runner.apply(pdf) - apf_tab = get_apfel_data( - theory, observables, pdf_name, self._db.table("apfel_cache") - ) - - # collect and check results - log_tab = self._get_output_comparison( - theory, observables, yad_tab, apf_tab, self._process_APFEL_log - ) - - # ============= - # print and log - # ============= - log_tab["_pdf"] = pdf_name - # print immediately - self._print_res(log_tab) - # store the log - self._log(log_tab) + # create our own object + runner = Runner(theory, obs) + for pdf_name in pdfs: + # setup PDFset + if pdf_name == "ToyLH": + pdf = toyLH.mkPDF("ToyLH", 0) + else: + import lhapdf # pylint:disable=import-outside-toplevel + + pdf = lhapdf.mkPDF(pdf_name, 0) + # get our data + yad_tab = runner.apply(pdf) + # get external data + if external == "APFEL": + import apfel_utils # pylint:disable=import-error,import-outside-toplevel + + ext_tab = external_utils.get_external_data( + theory, + obs, + pdf, + self._db.table("apfel_cache"), + apfel_utils.compute_apfel_data, + ) + elif external == "QCDNUM": + import qcdnum_utils # pylint:disable=import-error,import-outside-toplevel + + ext_tab = external_utils.get_external_data( + theory, + obs, + pdf, + self._db.table("qcdnum_cache"), + qcdnum_utils.compute_qcdnum_data, + ) + + # collect and check results + log_tab = self._get_output_comparison( + theory, obs, yad_tab, ext_tab, self._process_external_log, external + ) + + # ============= + # print and log + # ============= + log_tab["_pdf"] = pdf_name + # print immediately + self._print_res(log_tab) + # store the log + self._log(log_tab) def run_generate_regression(self, theory_query, obs_query): ask = input("Regenerate regression data? [y/n]") @@ -121,7 +126,7 @@ def generate_regression(self, theory, obs): runner = Runner(theory, obs) out = runner.get_output() # add metadata to log record - out["_creation_time"] = str_datetime(datetime.datetime.now()) + out["_creation_time"] = external_utils.str_datetime(datetime.datetime.now()) out["_theory_doc_id"] = theory.doc_id out["_observables_doc_id"] = obs.doc_id # check existence @@ -165,9 +170,9 @@ def run_regression(self, theory, obs): self._log(log_tab) @staticmethod - def _process_APFEL_log(yad, apf): + def _process_external_log(yad, apf, external): kin = dict() - kin["APFEL"] = ref = apf["value"] + kin[external] = ref = apf["value"] kin["yadism"] = fx = yad["result"] kin["yadism_error"] = yad["error"] # compare for log @@ -197,7 +202,7 @@ def _process_regression_log(yad, reg): return kin def _get_output_comparison( - self, theory, observables, yad_tab, other_tab, process_log + self, theory, observables, yad_tab, other_tab, process_log, external=None ): log_tab = {} # loop kinematics @@ -215,12 +220,12 @@ def _get_output_comparison( kin["x"] = yad["x"] kin["Q2"] = yad["Q2"] # extract values - kin.update(process_log(yad, oth)) + kin.update(process_log(yad, oth, external)) kinematics.append(kin) log_tab[sf] = kinematics # add metadata to log record - log_tab["_creation_time"] = str_datetime(datetime.datetime.now()) + log_tab["_creation_time"] = external_utils.str_datetime(datetime.datetime.now()) log_tab["_theory_doc_id"] = theory.doc_id log_tab["_observables_doc_id"] = observables.doc_id return log_tab diff --git a/benchmarks/navigator b/benchmarks/navigator index 0d9164615..93b17bbd0 100755 --- a/benchmarks/navigator +++ b/benchmarks/navigator @@ -2,5 +2,5 @@ ipython --InteractiveShellApp.exec_lines="['from navigator import *', 'from yadism import *', 'print(\"\",\"Welcome to yadism benchmark skript!\",\"call yelp() or h() for a brief overview.\",sep=\"\\\n\")', -'check_apfel()' -]" --pylab \ No newline at end of file +'check_external()' +]" --pylab diff --git a/benchmarks/navigator-dev.ipynb b/benchmarks/navigator-dev.ipynb new file mode 100644 index 000000000..5f370326d --- /dev/null +++ b/benchmarks/navigator-dev.ipynb @@ -0,0 +1,1144 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To install a kernel with the proper environment run in `yadism` top level dir:\n", + "```shell\n", + "ipython kernel install --user --name=\n", + "```\n", + "to remove the installed kernel:\n", + "```shell\n", + "jupyter kernelspec uninstall \n", + "```\n", + "with `` equal to the previous ``" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "EXTERNAL mode activated\n" + ] + } + ], + "source": [ + "from yadism import *\n", + "from navigator import *\n", + "\n", + "check_external()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
doc_idstructure_functionstheoryobservablescreationpdf
01F2light at 30 points1712 weeks agoCT14llo_NF6
12F2light at 30 points1812 weeks agoToyLH
23F2light at 30 points1812 weeks agoToyLH
34F2charm at 30 points1822 weeks agoToyLH
45F2bottom at 30 points1832 weeks agoToyLH
56F2top at 30 points1842 weeks agoToyLH
67FLlight at 30 points1852 weeks agoToyLH
78FLcharm at 30 points1862 weeks agoToyLH
89FLbottom at 30 points1872 weeks agoToyLH
910FLtop at 30 points1882 weeks agoToyLH
1011F2light at 30 points5312 weeks agoToyLH
1112F2charm at 30 points5322 weeks agoToyLH
1213F2bottom at 30 points5332 weeks agoToyLH
1314F2top at 30 points5342 weeks agoToyLH
1415FLlight at 30 points5352 weeks agoToyLH
1516FLcharm at 30 points5362 weeks agoToyLH
1617FLbottom at 30 points5372 weeks agoToyLH
1718F2light at 30 points5312 weeks agoCT14llo_NF6
1819F2light at 30 points5312 weeks agoCT14llo_NF6
1920F2light at 30 points5312 weeks agoCT14llo_NF6
2021F2charm at 30 points5322 weeks agoCT14llo_NF6
2122F2bottom at 30 points5332 weeks agoCT14llo_NF6
2223F2top at 30 points5342 weeks agoCT14llo_NF6
2324FLlight at 30 points5352 weeks agoCT14llo_NF6
2425FLcharm at 30 points5362 weeks agoCT14llo_NF6
2526FLbottom at 30 points5372 weeks agoCT14llo_NF6
2627FLtop at 30 points5382 weeks agoCT14llo_NF6
2728F2light at 30 points5312 weeks agoCT14llo_NF6
2829F2charm at 30 points5322 weeks agoCT14llo_NF6
2930F2bottom at 30 points5332 weeks agoCT14llo_NF6
3031F2top at 30 points5342 weeks agoCT14llo_NF6
3132FLlight at 30 points5352 weeks agoCT14llo_NF6
3233FLcharm at 30 points5362 weeks agoCT14llo_NF6
3334FLbottom at 30 points5372 weeks agoCT14llo_NF6
3435FLtop at 30 points5382 weeks agoCT14llo_NF6
3536F2light at 20 points145118 hours agoToyLH
3637F2light at 20 points145118 hours agoToyLH
3738F2light at 20 points145118 hours agoToyLH
3839F2light at 20 points469118 hours agoToyLH
\n", + "
" + ], + "text/plain": [ + " doc_id structure_functions theory observables creation \\\n", + "0 1 F2light at 30 points 17 1 2 weeks ago \n", + "1 2 F2light at 30 points 18 1 2 weeks ago \n", + "2 3 F2light at 30 points 18 1 2 weeks ago \n", + "3 4 F2charm at 30 points 18 2 2 weeks ago \n", + "4 5 F2bottom at 30 points 18 3 2 weeks ago \n", + "5 6 F2top at 30 points 18 4 2 weeks ago \n", + "6 7 FLlight at 30 points 18 5 2 weeks ago \n", + "7 8 FLcharm at 30 points 18 6 2 weeks ago \n", + "8 9 FLbottom at 30 points 18 7 2 weeks ago \n", + "9 10 FLtop at 30 points 18 8 2 weeks ago \n", + "10 11 F2light at 30 points 53 1 2 weeks ago \n", + "11 12 F2charm at 30 points 53 2 2 weeks ago \n", + "12 13 F2bottom at 30 points 53 3 2 weeks ago \n", + "13 14 F2top at 30 points 53 4 2 weeks ago \n", + "14 15 FLlight at 30 points 53 5 2 weeks ago \n", + "15 16 FLcharm at 30 points 53 6 2 weeks ago \n", + "16 17 FLbottom at 30 points 53 7 2 weeks ago \n", + "17 18 F2light at 30 points 53 1 2 weeks ago \n", + "18 19 F2light at 30 points 53 1 2 weeks ago \n", + "19 20 F2light at 30 points 53 1 2 weeks ago \n", + "20 21 F2charm at 30 points 53 2 2 weeks ago \n", + "21 22 F2bottom at 30 points 53 3 2 weeks ago \n", + "22 23 F2top at 30 points 53 4 2 weeks ago \n", + "23 24 FLlight at 30 points 53 5 2 weeks ago \n", + "24 25 FLcharm at 30 points 53 6 2 weeks ago \n", + "25 26 FLbottom at 30 points 53 7 2 weeks ago \n", + "26 27 FLtop at 30 points 53 8 2 weeks ago \n", + "27 28 F2light at 30 points 53 1 2 weeks ago \n", + "28 29 F2charm at 30 points 53 2 2 weeks ago \n", + "29 30 F2bottom at 30 points 53 3 2 weeks ago \n", + "30 31 F2top at 30 points 53 4 2 weeks ago \n", + "31 32 FLlight at 30 points 53 5 2 weeks ago \n", + "32 33 FLcharm at 30 points 53 6 2 weeks ago \n", + "33 34 FLbottom at 30 points 53 7 2 weeks ago \n", + "34 35 FLtop at 30 points 53 8 2 weeks ago \n", + "35 36 F2light at 20 points 145 1 18 hours ago \n", + "36 37 F2light at 20 points 145 1 18 hours ago \n", + "37 38 F2light at 20 points 145 1 18 hours ago \n", + "38 39 F2light at 20 points 469 1 18 hours ago \n", + "\n", + " pdf \n", + "0 CT14llo_NF6 \n", + "1 ToyLH \n", + "2 ToyLH \n", + "3 ToyLH \n", + "4 ToyLH \n", + "5 ToyLH \n", + "6 ToyLH \n", + "7 ToyLH \n", + "8 ToyLH \n", + "9 ToyLH \n", + "10 ToyLH \n", + "11 ToyLH \n", + "12 ToyLH \n", + "13 ToyLH \n", + "14 ToyLH \n", + "15 ToyLH \n", + "16 ToyLH \n", + "17 CT14llo_NF6 \n", + "18 CT14llo_NF6 \n", + "19 CT14llo_NF6 \n", + "20 CT14llo_NF6 \n", + "21 CT14llo_NF6 \n", + "22 CT14llo_NF6 \n", + "23 CT14llo_NF6 \n", + "24 CT14llo_NF6 \n", + "25 CT14llo_NF6 \n", + "26 CT14llo_NF6 \n", + "27 CT14llo_NF6 \n", + "28 CT14llo_NF6 \n", + "29 CT14llo_NF6 \n", + "30 CT14llo_NF6 \n", + "31 CT14llo_NF6 \n", + "32 CT14llo_NF6 \n", + "33 CT14llo_NF6 \n", + "34 CT14llo_NF6 \n", + "35 ToyLH \n", + "36 ToyLH \n", + "37 ToyLH \n", + "38 ToyLH " + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "a = dfl(38)[0]\n", + "b = dfl(39)[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [], + "source": [ + "def join(id1, id2):\n", + " tabs = []\n", + " tabs1 = []\n", + " exts = []\n", + " suffixes=(f\" ({id1})\", f\" ({id2})\")\n", + " \n", + " for i, doc_id in enumerate([id1,id2]):\n", + " tabs += [dfl(doc_id)[0]]\n", + " tabs1 += [tabs[i].drop(['yadism', 'yadism_error', 'rel_err[%]'], axis=1)]\n", + " exts += [tabs1[i].columns.drop(['x', 'Q2'])[0] + suffixes[i]]\n", + " \n", + " def rel_err(row):\n", + " ref = row[exts[0]]\n", + " cmp = row[exts[1]]\n", + " if ref != 0:\n", + " return (cmp/ref - 1)*100\n", + " else:\n", + " return np.nan\n", + " \n", + " tab_joint = tabs1[0].merge(tabs1[1], on=['x', 'Q2'], how=\"outer\", suffixes=suffixes)\n", + " tab_joint['ext_rel_err [%]'] = tab_joint.apply(rel_err, axis=1)\n", + " \n", + " if all(np.isclose(tabs[0]['yadism'], tabs[1]['yadism'])):\n", + " tab_joint['yadism'] = tabs[0]['yadism']\n", + " tab_joint['yadism_error'] = tabs[0]['yadism_error']\n", + " else:\n", + " pass\n", + " \n", + " \n", + " return tab_joint" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
xQ2APFEL (38)APFEL (39)ext_rel_err [%]
00.00031790.0000000.5239870.5360242.297218
10.00100790.0000000.4714070.4811042.057011
20.00319590.0000000.4307160.4368251.418396
30.01013890.0000000.4080610.407644-0.102252
40.03216990.0000000.4137670.401412-2.985886
50.10207790.0000000.4415400.415481-5.901846
60.30454590.0000000.3483400.341180-2.055411
70.53636490.0000000.1484280.1632409.979059
80.76818290.0000000.0237100.03168333.627325
91.00000090.0000000.0000000.000000NaN
100.0010002.0000000.4716880.4919664.299122
110.0010003.4899400.4716880.4891833.709092
120.0010006.0898390.4716880.4870723.261464
130.00100010.6265860.4716880.4854152.910254
140.00100018.5430710.4716880.4840802.627325
150.00100032.3570990.4716880.4829822.394534
160.00100056.4621620.4716880.4820632.199639
170.00100098.5247680.4716880.4812822.034075
180.001000171.9227450.4716880.4806111.891699
190.001000300.0000000.4716880.4800271.767946
\n", + "
" + ], + "text/plain": [ + " x Q2 APFEL (38) APFEL (39) ext_rel_err [%]\n", + "0 0.000317 90.000000 0.523987 0.536024 2.297218\n", + "1 0.001007 90.000000 0.471407 0.481104 2.057011\n", + "2 0.003195 90.000000 0.430716 0.436825 1.418396\n", + "3 0.010138 90.000000 0.408061 0.407644 -0.102252\n", + "4 0.032169 90.000000 0.413767 0.401412 -2.985886\n", + "5 0.102077 90.000000 0.441540 0.415481 -5.901846\n", + "6 0.304545 90.000000 0.348340 0.341180 -2.055411\n", + "7 0.536364 90.000000 0.148428 0.163240 9.979059\n", + "8 0.768182 90.000000 0.023710 0.031683 33.627325\n", + "9 1.000000 90.000000 0.000000 0.000000 NaN\n", + "10 0.001000 2.000000 0.471688 0.491966 4.299122\n", + "11 0.001000 3.489940 0.471688 0.489183 3.709092\n", + "12 0.001000 6.089839 0.471688 0.487072 3.261464\n", + "13 0.001000 10.626586 0.471688 0.485415 2.910254\n", + "14 0.001000 18.543071 0.471688 0.484080 2.627325\n", + "15 0.001000 32.357099 0.471688 0.482982 2.394534\n", + "16 0.001000 56.462162 0.471688 0.482063 2.199639\n", + "17 0.001000 98.524768 0.471688 0.481282 2.034075\n", + "18 0.001000 171.922745 0.471688 0.480611 1.891699\n", + "19 0.001000 300.000000 0.471688 0.480027 1.767946" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "join(38, 39)" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'APFEL'" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tab_a = dfl(38)[0]\n", + "tab_a1 = tab_a.drop(['yadism', 'yadism_error', 'rel_err[%]'], axis=1)\n", + "ext_a = tab_a1.columns\n", + "\n", + "ext_a.drop(['x', 'Q2'])[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
xQ2APFELyadismyadism_errorrel_err[%]ciao
00.00031790.0000000.5239870.5239870.0-0.00000490.000317
10.00100790.0000000.4714070.4714070.0-0.00000490.001007
20.00319590.0000000.4307160.4307160.0-0.00000490.003195
30.01013890.0000000.4080610.4080610.0-0.00000290.010138
40.03216990.0000000.4137670.4137670.00.00000390.032169
50.10207790.0000000.4415400.4415400.0-0.00000490.102077
60.30454590.0000000.3483400.3483400.0-0.00000490.304545
70.53636490.0000000.1484280.1484280.00.00000290.536364
80.76818290.0000000.0237100.0237100.00.00015390.768182
91.00000090.0000000.0000000.0000000.0NaN91.000000
100.0010002.0000000.4716880.4716840.0-0.0008082.001000
110.0010003.4899400.4716880.4716840.0-0.0008083.490940
120.0010006.0898390.4716880.4716840.0-0.0008096.090839
130.00100010.6265860.4716880.4716840.0-0.00080910.627586
140.00100018.5430710.4716880.4716840.0-0.00081118.544071
150.00100032.3570990.4716880.4716840.0-0.00081132.358099
160.00100056.4621620.4716880.4716840.0-0.00081156.463162
170.00100098.5247680.4716880.4716840.0-0.00081198.525768
180.001000171.9227450.4716880.4716840.0-0.000811171.923745
190.001000300.0000000.4716880.4716840.0-0.000811300.001000
\n", + "
" + ], + "text/plain": [ + " x Q2 APFEL yadism yadism_error rel_err[%] \\\n", + "0 0.000317 90.000000 0.523987 0.523987 0.0 -0.000004 \n", + "1 0.001007 90.000000 0.471407 0.471407 0.0 -0.000004 \n", + "2 0.003195 90.000000 0.430716 0.430716 0.0 -0.000004 \n", + "3 0.010138 90.000000 0.408061 0.408061 0.0 -0.000002 \n", + "4 0.032169 90.000000 0.413767 0.413767 0.0 0.000003 \n", + "5 0.102077 90.000000 0.441540 0.441540 0.0 -0.000004 \n", + "6 0.304545 90.000000 0.348340 0.348340 0.0 -0.000004 \n", + "7 0.536364 90.000000 0.148428 0.148428 0.0 0.000002 \n", + "8 0.768182 90.000000 0.023710 0.023710 0.0 0.000153 \n", + "9 1.000000 90.000000 0.000000 0.000000 0.0 NaN \n", + "10 0.001000 2.000000 0.471688 0.471684 0.0 -0.000808 \n", + "11 0.001000 3.489940 0.471688 0.471684 0.0 -0.000808 \n", + "12 0.001000 6.089839 0.471688 0.471684 0.0 -0.000809 \n", + "13 0.001000 10.626586 0.471688 0.471684 0.0 -0.000809 \n", + "14 0.001000 18.543071 0.471688 0.471684 0.0 -0.000811 \n", + "15 0.001000 32.357099 0.471688 0.471684 0.0 -0.000811 \n", + "16 0.001000 56.462162 0.471688 0.471684 0.0 -0.000811 \n", + "17 0.001000 98.524768 0.471688 0.471684 0.0 -0.000811 \n", + "18 0.001000 171.922745 0.471688 0.471684 0.0 -0.000811 \n", + "19 0.001000 300.000000 0.471688 0.471684 0.0 -0.000811 \n", + "\n", + " ciao \n", + "0 90.000317 \n", + "1 90.001007 \n", + "2 90.003195 \n", + "3 90.010138 \n", + "4 90.032169 \n", + "5 90.102077 \n", + "6 90.304545 \n", + "7 90.536364 \n", + "8 90.768182 \n", + "9 91.000000 \n", + "10 2.001000 \n", + "11 3.490940 \n", + "12 6.090839 \n", + "13 10.627586 \n", + "14 18.544071 \n", + "15 32.358099 \n", + "16 56.463162 \n", + "17 98.525768 \n", + "18 171.923745 \n", + "19 300.001000 " + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tab_a['ciao'] = tab_a.apply(lambda x: x['x'] + x['Q2'], axis=1)\n", + "tab_a" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "env", + "language": "python", + "name": "env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/benchmarks/navigator.py b/benchmarks/navigator.py index afdabf630..93cff2758 100755 --- a/benchmarks/navigator.py +++ b/benchmarks/navigator.py @@ -10,22 +10,22 @@ here = pathlib.Path(__file__).parent.absolute() sys.path.append(str(here / "aux")) -from apfel_utils import ( +from external_utils import ( # pylint:disable=import-error,wrong-import-position unstr_datetime, -) # pylint:disable=import-error,wrong-import-position +) # database access here = pathlib.Path(__file__).parent.absolute() -db_APFEL = TinyDB(here / "data" / "input.json") +db_external = TinyDB(here / "data" / "input.json") db_regression = TinyDB(here / "data" / "regression.json") idb = None -def check_apfel(): +def check_external(): global idb - print("APFEL mode activated") - idb = db_APFEL + print("EXTERNAL mode activated") + idb = db_external def check_regression(): @@ -449,7 +449,7 @@ def g(table, doc_id=None): def subtract_tables(id1, id2): """ - Subtract yadism and APFEL result in the second table from the first one, + Subtract results in the second table from the first one, properly propagate the integration error and recompute the relative error on the subtracted results. @@ -490,32 +490,40 @@ def subtract_tables(id1, id2): # load observable tables table1 = pd.DataFrame(log1[obs]) table2 = pd.DataFrame(log2[obs]) + table_out = table2.copy() # check for compatible kinematics if any([any(table1[y] != table2[y]) for y in ["x", "Q2"]]): raise ValueError("Cannot compare tables with different (x, Q2)") # subtract and propagate - table2["APFEL"] -= table1["APFEL"] - table2["yadism"] -= table1["yadism"] - table2["yadism_error"] += table1["yadism_error"] + known_col_set = set(["x", "Q2", "yadism", "yadism_error", "rel_err[%]"]) + t1_ext = list(set(table1.keys()) - known_col_set)[0] + t2_ext = list(set(table2.keys()) - known_col_set)[0] + if t1_ext == t2_ext: + tout_ext = t1_ext + else: + tout_ext = f"{t2_ext}-{t1_ext}" + table_out.rename(columns={t2_ext: tout_ext}, inplace=True) + table_out[tout_ext] = table2[t2_ext] - table1[t1_ext] + # subtract our values + table_out["yadism"] -= table1["yadism"] + table_out["yadism_error"] += table1["yadism_error"] # compute relative error def rel_err(row): - if row["APFEL"] == 0.0: + if row[tout_ext] == 0.0: if row["yadism"] == 0.0: return 0.0 return np.nan else: - return (row["yadism"] / row["APFEL"] - 1.0) * 100 + return (row["yadism"] / row[tout_ext] - 1.0) * 100 - table2["rel_err[%]"] = table2.apply(rel_err, axis=1) + table_out["rel_err[%]"] = table_out.apply(rel_err, axis=1) # dump results' table - # with open(output_f, "w") as f: - # table2.to_csv(f) diffout.print(obs, "-" * len(obs), sep="\n") - diffout.register(table2) + diffout.register(table_out) return diffout @@ -523,6 +531,39 @@ def rel_err(row): diff = subtract_tables +def join(id1, id2): + tabs = [] + tabs1 = [] + exts = [] + suffixes = (f" ({id1})", f" ({id2})") + + for i, doc_id in enumerate([id1, id2]): + tabs += [dfl(doc_id)[0]] + tabs1 += [tabs[i].drop(["yadism", "yadism_error", "rel_err[%]"], axis=1)] + exts += [ + tabs1[i].columns.drop(["x", "Q2"])[0] + ] # + suffixes[i]] # TODO the suffixes are not working as expected + + def rel_err(row): + ref = row[exts[0]] + cmp = row[exts[1]] + if ref != 0: + return (cmp / ref - 1) * 100 + else: + return np.nan + + tab_joint = tabs1[0].merge(tabs1[1], on=["x", "Q2"], how="outer", suffixes=suffixes) + tab_joint["ext_rel_err [%]"] = tab_joint.apply(rel_err, axis=1) + + if all(np.isclose(tabs[0]["yadism"], tabs[1]["yadism"])): + tab_joint["yadism"] = tabs[0]["yadism"] + tab_joint["yadism_error"] = tabs[0]["yadism_error"] + else: + pass + + return tab_joint + + def compare_dicts(d1, d2, exclude_underscored=False): """ Check which entries of the two dictionaries are different, and output diff --git a/eko b/eko deleted file mode 160000 index b3b6c1de0..000000000 --- a/eko +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b3b6c1de01d8eae839e67ec87493fae4ba304dfe diff --git a/setup.py b/setup.py index 2906d47ee..2175434c1 100644 --- a/setup.py +++ b/setup.py @@ -20,20 +20,9 @@ "Topic :: Scientific/Engineering :: Physics", ], install_requires=[ - # resort true install dependencies and test/benchmark ones "eko", "numpy", "scipy", - "pandas", - "numba", - # "pyyaml", - # "tinydb~=4.1", - # "human-dates2", - # "sphinx", - # "sphinx_rtd_theme", - # "recommonmark", - # "sphinxcontrib-bibtex", ], python_requires=">=3.7", - # entry_points={"console_scripts": ["run-dis=yadism.runner:run_dis"],}, ) diff --git a/src/yadism/runner.py b/src/yadism/runner.py index 8b928ec8b..b5577f333 100644 --- a/src/yadism/runner.py +++ b/src/yadism/runner.py @@ -16,8 +16,6 @@ from typing import Any import time -import numpy as np - from eko.interpolation import InterpolatorDispatcher from eko.constants import Constants from eko import thresholds @@ -70,7 +68,7 @@ def __init__(self, theory: dict, observables: dict): self.constants = Constants() self.threshold = thresholds.ThresholdsConfig.from_dict(theory) self.strong_coupling = strong_coupling.StrongCoupling.from_dict( - theory, self.constants, self.threshold + theory, self.threshold, self.constants ) # Non-eko theory diff --git a/test_requirements.txt b/test_requirements.txt index c6c549f8b..e7cfadb6e 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -6,3 +6,4 @@ tinydb~=4.1 human_dates2 ipython matplotlib +pandas