Source code for pyhf.exceptions

import sys


[docs]class InvalidMeasurement(Exception): """ InvalidMeasurement is raised when a specified measurement is invalid given the specification. """
[docs]class InvalidNameReuse(Exception): pass
[docs]class InvalidSpecification(Exception): """ InvalidSpecification is raised when a specification does not validate against the given schema. """ def __init__(self, ValidationError): self.exc_info = sys.exc_info() self.parent = ValidationError self.path = '' for item in ValidationError.path: if isinstance(item, int): self.path += '[{}]'.format(item) else: self.path += '.{}'.format(item) self.path = self.path.lstrip('.') self.instance = ValidationError.instance message = '{0}.\n\tPath: {1}\n\tInstance: {2}'.format( ValidationError.message, self.path, self.instance ) # Call the base class constructor with the parameters it needs super(InvalidSpecification, self).__init__(message)
[docs]class InvalidWorkspaceOperation(Exception): """InvalidWorkspaceOperation is raised when an operation on a workspace fails."""
[docs]class InvalidModel(Exception): """ InvalidModel is raised when a given model does not have the right configuration, even though it validates correctly against the schema. This can occur, for example, when the provided parameter of interest to fit against does not get declared in the specification provided. """
[docs]class InvalidModifier(Exception): """ InvalidModifier is raised when an invalid modifier is requested. This includes: - creating a custom modifier with the wrong structure - initializing a modifier that does not exist, or has not been loaded """
[docs]class InvalidInterpCode(Exception): """ InvalidInterpCode is raised when an invalid/unimplemented interpolation code is requested. """
[docs]class ImportBackendError(Exception): """ MissingLibraries is raised when something is imported by sustained an import error due to missing additional, non-default libraries. """
class InvalidBackend(Exception): """ InvalidBackend is raised when trying to set a backend that does not exist. """
[docs]class InvalidOptimizer(Exception): """ InvalidOptimizer is raised when trying to set an optimizer that does not exist. """
[docs]class InvalidPdfParameters(Exception): """ InvalidPdfParameters is raised when trying to evaluate a pdf with invalid parameters. """
[docs]class InvalidPdfData(Exception): """ InvalidPdfData is raised when trying to evaluate a pdf with invalid data. """