Skip to content

Errors and warnings

Every exception and warning ALHENA raises. Catch AlhenaError for all eight concrete errors, and filter on AlhenaWarning for every warning: the three below, and the demo's ClassCodeWarning.

ReferenceError shadows a builtin

from alhena import ReferenceError rebinds the builtin of the same spelling in that module. Where both can be raised, import the package and write alhena.ReferenceError.

alhena._errors.AlhenaError

Bases: Exception

Base class for every error raised by ALHENA.

alhena._errors.AlhenaValueError

Bases: AlhenaError, ValueError

An argument value is outside the range the call accepts.

Subclasses ValueError as well, so a caller may catch either.

alhena._errors.BundleError

Bases: AlhenaError

The encoder bundle is missing, incomplete or inconsistent with the backbone.

alhena._errors.BackboneNotFoundError

Bases: AlhenaError

The UNI2-h weights could not be located.

alhena._errors.ReferenceError

Bases: AlhenaError

A reference shard is missing, malformed or unusable for the requested axis.

alhena._errors.CellSpaceMismatchError

Bases: AlhenaError

The encoder and the reference were produced by different training runs.

Their cell projections are not aligned, though the vector widths agree.

alhena._errors.GeometryError

Bases: AlhenaError

Tile geometry cannot be reconciled with the geometry the model reads.

alhena._errors.MembershipError

Bases: AlhenaError

The nucleus-to-token membership table is malformed or inconsistent with the tiles.

alhena._errors.MissingExtraError

Bases: AlhenaError, ImportError

An optional dependency is not installed. The message names the extra that installs it.

Subclasses ImportError as well, so a caller may catch either.

alhena._errors.AlhenaWarning

Bases: UserWarning

Base class for warnings that change how a result should be read.

alhena._errors.GeometryWarning

Bases: AlhenaWarning

The geometry tiles present to the model changes how a result reads.

Raised for an undeclared or differing resolution, white pad, a center crop, nuclei spanning more tokens than at the distillation resolution, nuclei drawn as disks around their centroids, an identifier naming nuclei apart, and a label map an overlay draws as the map of tile 0.

alhena._errors.ReferenceCoverageWarning

Bases: AlhenaWarning

Some classes of the axis have no cell in the reference, or are thinly supported.

alhena._errors.EnvelopeWarning

Bases: AlhenaWarning

Retrieval is running outside the declared envelope of its hyperparameters.


Next: Constants