spey.get_backend#
- spey.get_backend(name: str) Callable[[Any], StatisticalModel] [source]#
Statistical model backend retreiver. Available backend names can be found via
AvailableBackends()
function.- Parameters:
name (
Text
) – backend identifier. This backend refers to different packages that prescribes likelihood function.- Raises:
PluginError – If the backend is not available or the available backend requires different version of
spey
.AssertionError – If the backend does not have necessary metadata.
- Returns:
A callable function that takes backend specific arguments and two additional keyword arguments
analysis
(which is a unique identifier of analysis name asstr
) andxsection
(which is cross section value with a.u.). Details about the function can be found instatistical_model_wrapper()
. This wrapper returns aStatisticalModel
object.- Return type:
Callable[[Any, ...], StatisticalModel]
Example:
1>>> import spey; import numpy as np 2>>> stat_wrapper = spey.get_backend("default_pdf.uncorrelated_background") 3 4>>> data = np.array([1]) 5>>> signal = np.array([0.5]) 6>>> background = np.array([2.]) 7>>> background_unc = np.array([1.1]) 8 9>>> stat_model = stat_wrapper( 10... signal_yields=signal, 11... background_yields=background, 12... data=data, 13... covariance_matrix=background_unc, 14... analysis="simple_sl", 15... xsection=0.123 16... ) 17>>> stat_model.exclusion_confidence_level()
Note
The documentation of the
stat_wrapper
defined above includes the docstring of the backend as well. Hence typingstat_wrapper?
in terminal will result with complete documentation for thestatistical_model_wrapper()
and the backend it self which is in this particular exampleSimplifiedLikelihoodInterface
.