calamari.exceptions#
Exception types raised deliberately by calamari.
Every error calamari raises on purpose – as opposed to one propagated
from numpy, pandas, or the filesystem – derives from CalamariError.
That gives a caller one honest way to wrap an analysis step:
try:
m = calamari.load(path)
except calamari.CalamariError:
... # calamari rejected this file; a bare `except Exception` here
# would also have swallowed a typo in the caller's own code
Each concrete type additionally derives from the built-in exception a
caller would naturally reach for – UnsupportedFileError and
UnknownFormatError are both ValueError subclasses, the
standard-library pattern (json.JSONDecodeError, UnicodeDecodeError)
for “the input you handed me is not the kind of thing I parse”. Existing
except ValueError handlers therefore keep working, and the calamari-
specific type is available to anyone who wants to be precise.
Note what is deliberately not here: a missing, unreadable, or
permission-denied file raises the ordinary OSError subclass the
filesystem produced (FileNotFoundError, IsADirectoryError,
PermissionError). Those are not calamari’s judgement about the file’s
content – wrapping them would only hide which of the two very different
problems actually occurred (see calamari.io.load()).
Exceptions
Several columns could satisfy one accessor, and they are not the same measurement. |
|
Base class for every error calamari raises deliberately. |
|
A catalog selection did not describe the rows it claimed to. |
|
A requested curve is unavailable or its sweep cannot be prepared for smoothing. |
|
A detection request or sweep violates the detection input contract. |
|
A recognised instrument export has malformed required structure. |
|
A requested fixed fit value is incompatible with its parameter limits. |
|
Fit observations or supplied uncertainties violate the input contract. |
|
A fit setting names a parameter absent from the selected model. |
|
An unavailable input key/column; also |
|
An unsupported input type/keyword; also |
|
An invalid input value; also a |
|
A question about a file's measurement families could not be answered. |
|
A requested model registration conflicts with an existing name. |
|
A plotting selection, unit request or presentation setting is invalid. |
|
A plotting operation received an unsupported object or keyword. |
|
An outlier policy or supplied quality report is invalid for its measurement. |
|
A proposed group of repeat measurements is not one setpoint. |
|
A repeat group mixes zero and non-zero standard errors. |
|
A sample normalisation quantity is invalid or required but missing. |
|
A sensitivity recipe cannot be assessed; correct the named setting. |
|
Sweep segmentation or branch selection received invalid inputs. |
|
A figure was asked to save in a format matplotlib's canvas cannot write. |
|
|
|
A fit requested a model name absent from the registry. |
|
A journal style was requested that |
|
A data column was found, but its unit suffix is not recognised. |
|
A file was read successfully but no registered loader recognised it. |