Management library for LHAPDF
This is a pure-python (unofficial) LHAPDF management library ans scripts to download, list and load PDFs using the LHAPDF format.
It include a number of utilities to inspect the PDF metadata and the grids, but it is not meant to be a substitute of the LHAPDF library, only of the lhapdf script.
For more information about LHAPDF please see the official repository and webpage for LHAPDF and to see their citation policy.
Install
It can be installed from PyPI with a simple command
pip install lhapdf-management
Features
This library offers a script which aims to be a drop-in replacement of the lhapdf python script (not the library!)
In order not to clash with an existing installation of LHAPDF, the script name is lhapdf-management.
Update
Updates the local reference index
lhapdf-management update
If no installation of LHAPDF is found, the program will fail to do anything, as creating the LHAPDF directory is not the business of the management module.
In order to run lhapdf-management and make it believe that LHAPDF already exist a possibility is to populate the LHAPDF_DATA_PATH environment variable, i.e.,
LHAPDF_DATA_PATH=$(python -c 'from pathlib import Path ; from sys import prefix ; print(Path(prefix) / "share" / "LHAPDF")' ; lhapdf-management update
It is also possible to create the directory in the "best guess location" by doing lhapdf_management update --init
List
Lists all available PDFs
lhapdf-management list [PATTERNS ...] [--installed] [--codes]
Install
Installs a given PDF
lhapdf-management install <pdf_name> [--upgrade] [--keep]
Open a PDF
It can also be used to programatically get an object pointing to all the right parts of a PDF.
No interpolation will be provided by this script at this point and when/if it is ever provided
will be done by importing the normal python interface of LHAPDF (and so at that point LHAPDF
will need to be installed)
from lhapdf_management.pdfsets import PDF
from lhapdf_management.configuration import get_lhapdf_datapath
data_path = get_lhapdf_datapath()
pdf = PDF(data_path / "NNPDF31_nnlo_as_0118")
grids = pdf.get_member_grids(0)
Programatically use the interface
A very useful feature of this library is the possibility of using everything programatically. The three given interfaces (install, list and update) take as input the same arguments as the script interface.
from lhapdf_management import pdf_install, pdf_list, pdf_update
list_of_pdfs = pdf_list("--installed")
pdf_install("NNPDF31_nnlo_as_0118")
Download all PDFs matching pattern
There are some arguments that have been modified for simplicity as their behaviour can also be obtained by other means. For instance, in order to download all PDFs matching a certain pattern one can write the following short bash script:
for pdf in $(lhapdf-management list NNPDF31*)
do
lhapdf-management install ${pdf} --upgrade
done
Related projects
- A similar project providing rust bindings to LHAPDF is https://github.com/cschwan/managed-lhapdf
- The PDFFlow library https://github.com/N3PDF/pdfflow is a drop-in replacement of the (interpolation) capabilities of LHAPDF using TensorFlow to offer hardware acceleration. It uses
lhapdf-managementto download the PDF files. - The NeoPDF library https://github.com/Radonirinaunimi/neopdf provides a drop-in replacement for LHAPDF grid interpolation with extra features for polarized or nuclear PDFs.
Metadata
Release files for lhapdf-management 0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lhapdf_management-0.6.tar.gz | 32.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lhapdf_management-0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.0 kB
Release files / lhapdf_management-0.6.tar.gz
| Download URL | lhapdf_management-0.6.tar.gz |
|---|---|
| Size | 32.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c58982765c317c08515e8fca9b79bf8d005e86d6899c731c92e3f229c31a94b
|
|
BLAKE2b-256 checksum How to use checksums |
ea29a15c68ffce766832a6d7bd73cfa185b1730e5c7f8a81da08f5f7449b3ff5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / lhapdf_management-0.6-py3-none-any.whl
| Download URL | lhapdf_management-0.6-py3-none-any.whl |
|---|---|
| Size | 27.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
322882d35cac3c21bf8968f22083a4050bdaf4b7380fc2672f0e832407d939c5
|
|
BLAKE2b-256 checksum How to use checksums |
1431c33c44a1819fbcfa0c6d6c3a5e0e44040ddacb5a734b2a5713ad41f64e05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for lhapdf-management 0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.