"""SOFIA v7.1 — student model for cross-view geo-localization (CVGL).

Architecture:
    stem → stage1 (StripDCN-lite) → stage2 (StripMixConv)
         → stage3 (MambaVision MV5) → stage4 (MambaVision MV1)
         → 1×1 neck → asymmetric Sat/UAV heads

Key novel components:
- StripDCN-lite: Strip DW with adaptive offset on one axis
- MambaVision MV5: Mamba ∥ MHSA ∥ Strip 3-way parallel
- CircularHarmonicPool: formally SO(2)-invariant UAV head
- AltitudeFiLM: telemetry-aware conditioning

Presets (see config.py):
- SOFIA-M (~500 M params, 500 MB INT8) — default
- SOFIA-L (~1 B params, 1 GB INT8) — max scale
- SOFIA-Tiny (~5 M) — reference from original v7.1 spec

Quick start:
    from sofia_v71 import build_sofia
    model = build_sofia("M")
    out = model(sat=sat_tensor, uav=uav_tensor, altitude=alt_tensor)
    g_sat, g_uav = out["g_sat"], out["g_uav"]

See README.md and HYP_SOFIA_v7_UltraDeep_дизайн.md for full design rationale.
"""

from .config import (
    SOFIAConfig,
    sofia_l_config,
    sofia_m_config,
    sofia_tiny_config,
    DEFAULT_CONFIG,
)
from .model import (
    SOFIAv71,
    build_sofia,
    Backbone,
    Stem,
    UltraLiteNeck,
    SatHead,
    UAVHead,
    RingAuxHead,
)
from .layers import (
    GGeM,
    CircularHarmonicPool,
    AltitudeFiLM,
    TextFiLM,
    RoPE2D,
    SqueezeExcite,
    LayerNorm2d,
)
from .blocks import (
    StripDCNLiteBlock,
    StripMixConvBlock,
    SimpleMambaBlock,
    Mamba2Block,
    EfficientVMambaBlock,
    MambaVisionBlock,
    EVSSBridge,
    Downsample,
    build_mamba_block,
    is_mamba_ssm_available,
    is_mamba2_available,
)
from .quant import (
    # DCN-M2
    OffsetClampSTE,
    offset_clamp_ste,
    # k-scaled
    KScaledFakeQuant,
    KScaledMamba2Block,
    # model-wide helpers
    start_calibration,
    finalize_calibration,
    set_quant_enabled,
)

__version__ = "0.1.0"
__all__ = [
    # Config
    "SOFIAConfig",
    "sofia_m_config",
    "sofia_l_config",
    "sofia_tiny_config",
    "DEFAULT_CONFIG",
    # Top-level
    "SOFIAv71",
    "build_sofia",
    # Model parts
    "Backbone",
    "Stem",
    "UltraLiteNeck",
    "SatHead",
    "UAVHead",
    "RingAuxHead",
    # Layers
    "GGeM",
    "CircularHarmonicPool",
    "AltitudeFiLM",
    "TextFiLM",
    "RoPE2D",
    "SqueezeExcite",
    "LayerNorm2d",
    # Blocks
    "StripDCNLiteBlock",
    "StripMixConvBlock",
    "SimpleMambaBlock",
    "Mamba2Block",
    "EfficientVMambaBlock",
    "MambaVisionBlock",
    "EVSSBridge",
    "Downsample",
    "build_mamba_block",
    "is_mamba_ssm_available",
    "is_mamba2_available",
    # Quantization
    "OffsetClampSTE",
    "offset_clamp_ste",
    "KScaledFakeQuant",
    "KScaledMamba2Block",
    "start_calibration",
    "finalize_calibration",
    "set_quant_enabled",
]
