feat(models): fluorescence ingest contract shared with AareDB #19

Merged
perl_d merged 1 commits from feat/fluorescence-ingest-contract into main 2026-08-18 11:00:00 +02:00
+28
View File
@@ -239,6 +239,34 @@ class FluorescenceSpectrumOutputModel(BaseModel):
average_dead_time: Annotated[float, Field(ge=0, le=1)]
class FluorescenceElementModel(BaseModel):
"""One emission line AareDB identified in a stored fluorescence spectrum."""
symbol: str
line: str # "Ka" or "La"
energy_ev: float # tabulated line energy
peak_energy_ev: float # where the matching peak actually sits
counts: float # peak height
confidence: float # 1.0 alpha+beta matched, 0.5 alpha only
class FluorescenceScanIngestModel(BaseModel):
"""AareDB fluorescence ingest payload: the measured spectrum plus the
sample it belongs to (POST /dispatcher/protected_router/fluorescence/ingest)."""
sample_id: int
scan: FluorescenceSpectrumOutputModel
comment: str | None = None
class FluorescenceScanIngestResponseModel(BaseModel):
"""AareDB's ingest response — the beamline GUI shows the detected elements."""
id: int
sample_event_id: int
elements: list[FluorescenceElementModel] = []
class MLBoxType(Enum):
LOOP_ALL = 0
PIN = 1