Detector response to a high-energy physics process is often estimated by Monte Carlo simulation. For purposes of data analysis, the results of this simulation are typically stored in large multi-dimensional histograms, which can quickly become unwieldy in terms of size or numerically problematic due to unfilled bins or interpolation artifacts. Photospline is a library that uses the penalized spline technique to efficiently compute, store, and evaluate B-spline representations of such tables.
Photospline is packaged on conda-forge. Install with conda install -c conda-forge photospline
.
To build the core photospline libraries, you will need:
This will allow you to evaluate splines, but not much else. The fitting library further requires:
- SuiteSparse
- BLAS and LAPACK libraries (we recommend OpenBLAS on Linux; the built-in Accelerate.framework is fine on OS X)
To build and install in /usr/local, run cmake . -DCMAKE_INSTALL_PREFIX=/usr/local
, followed by make install
, in the source directory.
A tutorial on fitting spline surfaces with photospline is given in the sphinx
documentation. If you have
sphinx,
doxygen, and
breate (a sphinx-doxygen bridge),
you can build a pretty-looking HTML version, complete with API documentation,
with make html
. The output will appear in the build directory under
docs/index.html
.
Photospline exports its build configuration for use in downstream projects that are built with CMake. Setting up a C++ executable to build again photospline is as simple as putting
find_package(photospline REQUIRED)
add_executable(foo foo.cxx)
target_link_libraries(foo photospline)
in your CMakeLists.txt. C executables can be linked to cphotospline
instead,
e.g.
add_executable(cfoo foo.c)
target_link_libraries(cfoo cphotospline)
.
This causes the targets foo
and cfoo
to be built with the include paths,
compiler options, and link libraries specified when the photospline libraries
were built.
The export files are installed in CMAKE_INSTALL_PREFIX/share/photospline/cmake
, so find_package()
will be able to use them as long as the install prefix is in CMake's prefix path.
If the library was not installed in CMake's prefix path, you can specify another prefix to search with CMAKE_PREFIX_PATH
), e.g. cmake . -DCMAKE_PREFIX_PATH=/home/you/software
. You can also import the library from the build directory by specifying the search directory explicitly. e.g. cmake . -Dphotospline_DIR=/home/you/photospline-v2.0.0/build
.