Giter VIP home page Giter VIP logo

parton's Introduction

Build Status Coverage Status

parton – a Python package for parton distributions and parton luminosities

parton is a Python package providing parton distribution functions and parton luminosities. It uses the PDF data files provided by the LHAPDF project. Its API is partially compatible to LHAPDF's Python API, even though only a subset of its features are implemented.

parton is written in pure Python, i.e. it runs on Linux, Mac OS, and Windows.

Installation

To install the package without administrator privileges, run

python3 -m pip install parton --user

Command-line interface

parton provides a command-line interface that mimicks (and is partially compatible to) LHAPDF's lhapdf command. In particular, it can be used to install PDF grid files. It is accessed by running the package as a script,

python3 -m parton

For instance, to install a specific PDF set, run

python3 -m parton update
python3 -m parton install 'CT10/0'

If you already have a directory with PDF sets (e.g. from LHAPDF), that can be used as well.

Python usage

The API for numerically evaluating PDFs is modeled after LHAPDF's Python API:

from parton import mkPDF
pdf = mkPDF('CT10', 0)
# up quark PDF at x=0.1, Q=1000 GeV
pdf.xfxQ(2, 0.1, 1000)

If the PDF sets are in a non-default location (on Linux, the default location is ~/.local/share/parton/), this directory can be changed through mkPDF's pdfdir argument.

Parton luminosities are accessed similarly through the PLumi class, but the factorization scale has to be fixed on instantiation,

from parton import PLumi
# pdf has been defined above
plumi = PLumi(pdf, Q2=1000)
# u-ubar parton luminosity at shat/s=0.1
plumi.L(2, -2, 0.1)

License

parton is released under the MIT license.

Contributors

parton was originally written by David M. Straub (@DavidMStraub)

Other contributors:

  • Peter Stangl (@peterstangl)

Citation info

parton cannot be cited at present. Please do not forget to also acknowledge the LHAPDF project.

parton's People

Contributors

davidmstraub avatar peterstangl avatar nsmith- avatar alekssmolkovic avatar

Stargazers

Hadi Hashamipour avatar Tanjona Rabemananjara avatar Jan Lukas Späh avatar Junghyeon Park avatar  avatar Yacine Haddad avatar Lina Alasfar avatar

Watchers

James Cloos avatar  avatar  avatar Christopher Willis avatar  avatar

parton's Issues

Update on install

It might be a good idea to call update() when calling the install CLI function. This could be done automatically each time (to update the index before downloading). An alternative would be to do it the first time install is called. The latter could be done by catching an error in line 53 of cli.py which can occur if the user did not call update before calling install for the first time and therefore the pdfsets.index file does not exist.

The above would remove the need to run python3 -m parton update before installing a pdf set for the first time (or possibly ever).

Alternatively, an error could be caught in line 50 of io.py, which is raised if pdfsets.index does not exist, to remind the user that update should be called first.

mkPDF Error: load() missing 1 required positional argument: ‘Loader’

I'm trying to use the mkPDF function with PDF sets I already have downloaded. I believe I'm properly using the pdfdir argument, since it's able to find the .info file I'm trying to load. However there is an error with the load function (shown in the attached photo) that seems to be internal to the parton package.

The error is “ load() missing 1 required positional argument: ‘Loader’ “

Is this an internal issue or am I doing something else wrong?

Thanks,
Steven

IMG_0543

Missing factor in parton luminosity?

To get parton luminosity ratios matching https://www.hep.ph.ic.ac.uk/~wstirlin/plots/plots.html, I had to multiply a factor of 1/s into the output of PLumi.L().

For example, this plot (with the 1/s factor included) matches lhclumi7813_2013_v1.pdf:

Correct plot:

parton_lumi_ratio_13000_8000_MSTW2008nlo68cl

whereas without the 1/s factor, the result does not agree:

Wrong plot:

parton_lumi_ratio_13000_8000_MSTW2008nlo68cl_wrong

Perhap this is a misunderstanding of the exact quantity that PLumi.L() returns; it would be good to clarify the definition and units in the README.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.