Add an lhapdf_compatibility module for LHAPDF#1799
Conversation
cbb0a02 to
de884d9
Compare
d466052 to
73bb344
Compare
73bb344 to
21f7865
Compare
|
This now could actually be merged (after #1861 of course since it relies in the pyproject.toml installation) |
|
Thanks, I'll have a look later but for now - do you want to keep |
|
It's great, thanks @scarlehoff! I believe we might want to keep an optional dependency on LHAPDF as long as it will be used (so almost forever, from present perspective), to test the grids produced. In particular: |
Yes.
Yes, for now the dependency on LHAPDF is mandatory from conda (and so when using the official distribution of In order to use this PR you need to install the code like |
21f7865 to
116e288
Compare
116e288 to
0d2601d
Compare
0361733 to
3b7d9a1
Compare
0d2601d to
2074c75
Compare
77f3dec to
52d3a6f
Compare
2074c75 to
9c43f90
Compare
52d3a6f to
a0f850e
Compare
9c43f90 to
a0582c9
Compare
f51fba6 to
be2535e
Compare
a0582c9 to
7db041b
Compare
|
@RoyStegeman did you have a chance to look at this? |
595e3a9 to
8cb04b3
Compare
b87f2ee to
df3faa9
Compare
df3faa9 to
ff1cf95
Compare
|
Greetings from your nice fit 🤖 !
Check the report carefully, and please buy me a ☕ , or better, a GPU 😉! |
Co-authored-by: Roy Stegeman <roystegeman@live.nl>
RoyStegeman
left a comment
There was a problem hiding this comment.
Everything looks okay. I'll have to take a bit of a leap of faith that pdfflow behaves the same as lhapdf and implements all the relevant functions, but the passing of the tests is a good sign.
And since lhapdf is still the recommended backend to interact with PDFs it's not our responsibility if this breaks things (right??)
Yes. The idea is to be able to develop without having to have an lhpdf installation. This is particularly relevant when testing different version of python, you then need to install lhapdf on each of them even if you are just checking that e.g. validphys is creating the thcovmat in the right order. |
|
What about postfit (and some other minor scripts that still use classic lhapdf)? |
Co-authored-by: Roy Stegeman <roystegeman@live.nl>
postfit (and reweighting and some other) will need lhapdf.
The tests are always using the official lhapdf installation. |
Haha I realized my mistake |
|
🎉 |
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, thelhapdfimports are contained in anlhapdf_compatibilitymodule which, iflhapdfis installed will simply provide it normally and transparently so nothing changes.if
lhapdfis not installed, it uses a combination of lhadpf_management and pdfflow to do whatever is needed fromlhapdf.wrt to those two libraries,
lhapdf_managementis 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.pdfflowinstead 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).