Source code for synthesizer.exceptions

"""The definitions for Synthesizer specific errors."""


[docs] class MissingArgument(Exception): """Generic exception class for when an argument is missing.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Missing argument"
[docs] class IncorrectUnits(Exception): """Generic exception class for when incorrect units are provided.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Inconsistent units"
[docs] class MissingUnits(Exception): """Generic exception class for when expected units aren't provided.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Units are missing"
[docs] class InconsistentParameter(Exception): """Generic exception class for inconsistent parameters.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Inconsistent parameter choice"
[docs] class InconsistentArguments(Exception): """Generic exception class for inconsistent combinations of arguments.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Inconsistent parameter choice"
[docs] class UnimplementedFunctionality(Exception): """Generic exception class for functionality not yet implemented.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Unimplemented functionality!"
[docs] class UnknownImageType(Exception): """Generic exception class for functionality not yet implemented.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Unknown image type!"
[docs] class InconsistentAddition(Exception): """Generic exception class for when adding two objects is impossible.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Unable to add"
[docs] class InconsistentMultiplication(Exception): """Generic exception class for impossible multiplications.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Unable to multiply"
[docs] class InconsistentCoordinates(Exception): """Generic exception class for when coordinates are inconsistent.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Coordinates are inconsistent"
[docs] class SVOFilterNotFound(Exception): """Exception class for when an SVO filter code isn't in the database.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Filter not found!"
[docs] class SVOTransmissionHasUnits(Exception): """Exception class for when an SVO filter returns units. This should not be the case for a transmission curve. For example, where the effective area is provided instead of a transmission curve, which is a case we currently don't support. """ def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Filter provides units, but transmission is dimensionless!"
[docs] class InconsistentWavelengths(Exception): """Exception class for when wavelengths are inconsistent.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Coordinates are inconsistent"
[docs] class MissingSpectraType(Exception): """Exception class for when a spectra type is missing.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Spectra type not in grid!"
[docs] class MissingLines(Exception): """Exception class for when a line is missing from a spectrum.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Line not in grid!"
[docs] class MissingPhotometryType(Exception): """Exception class for when a photometry type is missing.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Photometry type not found!"
[docs] class MissingImage(Exception): """Exception class for when an image has not yet been made.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "Image not yet created!"
[docs] class MissingModelSettings(Exception): """Exception class for when a model is missing settings.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ return "Model is missing settings!"
[docs] class MissingIFU(Exception): """Exception class for when an IFU has not yet been made.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "IFU not yet created!"
[docs] class WavelengthOutOfRange(Exception): """Exception class for when a wavelength is out of range.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) else: return "The provided wavelength is out of the filter range!"
[docs] class SVOInaccessible(Exception): """Generic exception class for when SVO is inaccessible.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "SVO database is down!"
[docs] class UnrecognisedOption(Exception): """Exception class string arguments not being a recognised option.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Unrecognised option."
[docs] class MissingAttribute(Exception): """Exception class for when a required attribute is missing.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Missing attribute"
[docs] class GridError(Exception): """Exception class Grid related issues.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Theres an issues with the grid."
[docs] class UnmetDependency(Exception): """Exception for missing dependencies. A generic exception class for anything to do with not having specific packages not mentioned in the requirements. This is usually when there are added dependency due to including extraneous capabilities. """ def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "There are unmet package dependencies."
[docs] class DownloadError(Exception): """Exception for failed downloads. A generic exception class for anything to do with not having specific packages not mentioned in the requirements. This is usually when there are added dependency due to including extraneous capabilities. """ def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "There was an error downloading the data."
[docs] class PipelineNotReady(Exception): """Exception class for when a required pipeline step hasn't been run.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Pipeline isn't ready to run current operation."
[docs] class BadResult(Exception): """Exception class for when a result is not as expected.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Result is not as expected."
[docs] class MissingMaskAttribute(Exception): """Exception class for when the masking attribute is missing.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Mask is missing an attribute."
[docs] class MissingInstrumentFile(Exception): """Exception class for when the instrument file hasn't been downloaded.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Instrument file is missing."
[docs] class InconsistentUnits(Exception): """Exception class for when units are inconsistent.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Units are inconsistent."
[docs] class MissingGridProperty(Exception): """Exception class for when a required grid property is missing.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Grid is missing a required property."
[docs] class MissingModel(Exception): """Exception class for when a model is missing.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "Model is missing"
[docs] class ParameterFunctionError(Exception): """Exception class for errors in parameter functions.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "There was an error in the parameter function."
[docs] class CannotHashThat(Exception): """Exception class for when an object cannot be hashed.""" def __init__(self, *args): """Initialise the exception with an optional message. Args: *args: Optional message to include in the exception. """ if args: self.message = args[0] else: self.message = None def __str__(self): """Return the string representation of the exception. Returns: str: The string representation of the exception. """ if self.message: return "{0} ".format(self.message) return "The object cannot be hashed."