Add an `lhapdf_compatibility` module for LHAPDF
Created by: scarlehoff
This branch is now an update on top of #1861 that adds the possibility of running fits using pdfflow instead of lhapdf (during the fit lhapdf is used only for the t0 covmat and that should be covered fine by pdfflow).
Instead of directly importing lhapdf
, the lhapdf
imports are contained in an lhapdf_compatibility
module which, if lhapdf
is installed will simply provide it normally and transparently so nothing changes.
if lhapdf
is not installed, it uses a combination of lhadpf_management and pdfflow to do whatever is needed from lhapdf
.
wrt to those two libraries, lhapdf_management
is feature complete in that it does all the management part of LHAPDF (installing, updating, looking around the metadata of a PDF) but it does nothing with the PDF themselves.
pdfflow
instead is a port of the interpolation and extrapolation parts of LHAPDF but it is not really being maintained anymore. For what we need in the fit is enough and python-only (so we can run fits normally) but I would not swap LHAPDF for this library.
However, by concentrating all that is needed from LHAPDF in a single module it will be easier to swap LHAPDF for some other library that might appear in the future. We can also more easily extend LHAPDF. This will be relevant for instance for the nuclear PDFs.
The way I've included the changes has a nice perk (/cc @AleCandido) which is the fact that one should be able to extract data/fktables from validphys without pdfflow or lhapdf (meaning, tensorflow is not needed for that).