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

AmbiguousColumnError

Several columns could satisfy one accessor, and they are not the same measurement.

CalamariError

Base class for every error calamari raises deliberately.

CatalogSelectionError

A catalog selection did not describe the rows it claimed to.

CurveInputError

A requested curve is unavailable or its sweep cannot be prepared for smoothing.

DetectionInputError

A detection request or sweep violates the detection input contract.

FileParseError

A recognised instrument export has malformed required structure.

FitConstraintError

A requested fixed fit value is incompatible with its parameter limits.

FitInputError

Fit observations or supplied uncertainties violate the input contract.

FitParameterError

A fit setting names a parameter absent from the selected model.

InputKeyError

An unavailable input key/column; also CalamariError and KeyError.

InputTypeError

An unsupported input type/keyword; also CalamariError and TypeError.

InputValueError

An invalid input value; also a CalamariError and ValueError.

MeasurementFamilyError

A question about a file's measurement families could not be answered.

ModelRegistrationError

A requested model registration conflicts with an existing name.

PlotInputError

A plotting selection, unit request or presentation setting is invalid.

PlotTypeError

A plotting operation received an unsupported object or keyword.

QualityInputError

An outlier policy or supplied quality report is invalid for its measurement.

RepeatGroupError

A proposed group of repeat measurements is not one setpoint.

RepeatWeightError

A repeat group mixes zero and non-zero standard errors.

SampleValidationError

A sample normalisation quantity is invalid or required but missing.

SmoothingSensitivityError

A sensitivity recipe cannot be assessed; correct the named setting.

SweepInputError

Sweep segmentation or branch selection received invalid inputs.

UnknownFigureFormatError

A figure was asked to save in a format matplotlib's canvas cannot write.

UnknownFormatError

load(..., fmt=...) named a format that is not registered.

UnknownModelError

A fit requested a model name absent from the registry.

UnknownStyleError

A journal style was requested that calamari.style does not know.

UnknownUnitError

A data column was found, but its unit suffix is not recognised.

UnsupportedFileError

A file was read successfully but no registered loader recognised it.