Frequently Asked Questions about pyhf
and its use.
If you have a question about the use of pyhf
not covered in the documentation, please ask a question on the GitHub Discussions.
If you believe you have found a bug in pyhf
, please report it in the GitHub Issues.
If you're interested in getting updates from the pyhf
dev team and release announcements you can join the pyhf-announcements
mailing list_.
Yes. Use the --backend
option for pyhf cls
to specify a tensor backend. The default backend is NumPy. For more information see pyhf cls --help
.
No. Like the rest of the Python community, as of January 2020 the latest releases of pyhf
no longer support Python 2. The last release of pyhf
that was compatible with Python 2.7 is v0.3.4, which can be installed with
python -m pip install pyhf~=0.3
It is recommended that pyhf
is used as a standalone step in any analysis, and its environment need not be the same as the rest of the analysis. As Python 2 is not supported it is suggested that you setup a Python 3 runtime on whatever machine you're using. If you're using a cluster, talk with your system administrators to get their help in doing so. If you are unable to get a Python 3 runtime, versioned Docker images of pyhf
are distributed through Docker Hub.
Once you have Python 3 installed, see the installation
page to get started.
I validated my workspace by comparing pyhf
and HistFactory
, and while the expected CLs matches, the observed CLs is different. Why is this?
Make sure you're using the right test statistic (q or q̃) in both situations. In HistFactory
, the asymptotics calculator, for example, will do something more involved for the observed CLs if you choose a different test statistic.
pyhf
is validated against HistFactory
. HistFitter
makes some particular implementation choices that pyhf
doesn't reproduce. Instead of trying to compare pyhf
and HistFitter
you should try to validate them both against HistFactory
.
As you may have guessed from this page, pyhf
is typeset in all lowercase. This is largely historical, as the core developers had just always typed it that way and it seemed a bit too short of a library name to write as PyHF
. When typesetting in LaTeX the developers recommend introducing the command
\newcommand{\pyhf}{\texttt{pyhf}}
If the journal you are publishing in requires you to use textsc
for software names it is okay to instead use
\newcommand{\pyhf}{\textsc{pyhf}}
As of the late 2010's Python is widely considered the lingua franca of machine learning libraries, and is sufficiently high-level and expressive for physicists of various computational skill backgrounds to use. Using Python as the language for development allows for the distribution of the software --- as both source files and binary distributions --- through the Python Package Index (PyPI) and Conda-forge, which significantly lowers the barrier for use as compared to C++
. Additionally, a 2017 DIANA/HEP study faq-feickert-diana-fellowship-report
demonstrated the graph structure and automatic differentiation abilities of machine learning frameworks allowed them to be quite effective tools for statistical fits. As the frameworks considered in this study (TensorFlow, PyTorch, MXNet) all provided low-level Python APIs to the libraries this made Python an obvious choice for a common high-level control language. Given all these considerations, Python was chosen as the development language.
In 2017 Lukas Heinrich was discussing with colleauge Holger Schulz how it would be convienent to share and produce statistical results from LHC experiements if they were able to be created with tools that didn't require the large C++
dependencies and tooling expertise as pyhf
_.
Matthew joined him on the project to begin development and by April 2018 Giordon Stark had learned about the project and began making contributions, quickly becoming the third core developer. The first physics paper to use pyhf
followed closely in October 2018 faq-Heinrich:2018nip
, making Lukas and Holger's original conversations a reality. pyhf
was founded on the ideas of open contributions and community software and continues in that mission today as a Scikit-HEP project, with an open invitation for community contributions and new developers.
import torch
orimport pyhf
causes aSegmentation fault (core dumped)
This is may be the result of a conflict with the NVIDIA drivers that you have installed on your machine. Try uninstalling and completely removing all of them from your machine
# On Ubuntu/Debian sudo apt-get purge nvidia*
and then installing the latest versions.
bib/docs.bib bib/use_citations.bib
24 January, 2018↩