Source code for nav.nav_orchestrator.image_classifier_result

"""NavImageClassifierResult — output of the image-quality classifier.

Carried on every ``NavResult`` (success or failure) so downstream consumers
can see at a glance which class the input image fell into and which optional
flags were set.
"""

from dataclasses import dataclass, field
from typing import Literal

__all__ = ['NavImageClassifierResult']


ImageClass = Literal[
    'clean',
    'blank',
    'fully_overexposed',
    'mostly_missing_data',
    'corrupt',
]
"""Closed set of image classes the classifier may report.

``clean``, ``blank``, ``fully_overexposed``, and ``mostly_missing_data``
are emitted by ``NavImageClassifier``; ``corrupt`` is set by the caller
when image-file parsing raises.  Additional classes (e.g. partial-dropout,
alternating-lines, truncated-readout, ccd-bloom-dominant) are not yet
emitted; their detection paths are tracked separately.
"""

ImageFlag = Literal[
    'partial_dropout',
    'noisy',
]
"""Advisory flags that may appear on a classifier result.

``partial_dropout`` is raised when the missing-data fraction exceeds the
``partial_dropout_min_frac`` advisory threshold but stays below the
``mostly_missing_data`` cutoff.  ``noisy`` is raised when the MAD-based
noise sigma exceeds the per-instrument threshold.
"""