feat(models): fluorescence ingest contract shared with AareDB
CI / lint (pull_request) Successful in 23s
CI / test (3.12) (pull_request) Successful in 22s
CI / test (3.13) (pull_request) Successful in 23s
CI / test (3.11) (pull_request) Successful in 54s
CI / lint (push) Canceled after 11s
CI / test (3.11) (push) Canceled after 0s
CI / test (3.12) (push) Canceled after 0s
CI / test (3.13) (push) Canceled after 0s
Build and Publish / release (push) Successful in 12s

FluorescenceScanIngestModel wraps the existing
FluorescenceSpectrumOutputModel with the sample it belongs to — the
payload for AareDB's POST /dispatcher/protected_router/fluorescence/
ingest. FluorescenceScanIngestResponseModel returns the stored scan id
plus the elements AareDB identified from the peaks, so the beamline GUI
can display what was detected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3xoBJBmqJJPLg475iK6cE
This commit was merged in pull request #19.
This commit is contained in:
GotthardG
2026-08-17 15:36:53 +02:00
co-authored by Claude Fable 5
parent fb617efa5f
commit 064a1d5cab
+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