feat: X10SA energy range 10-20 keV, compact sample list headers #213

Merged
duan_j merged 3 commits from update-10s-energy-range into main 2026-09-10 17:06:43 +02:00
3 changed files with 20 additions and 16 deletions
+12 -12
View File
@@ -46,17 +46,17 @@ def get_entry(sample: SampleShortInfo, column: int):
# Data-collection params straight from the AareDB spreadsheet (filled by
# spreadsheetupdater). Nullable: samples without params show blank.
elif column == 11:
return sample.aaredb_params.oscillation if sample.aaredb_params else None
return sample.comment
elif column == 12:
return sample.aaredb_params.exposure if sample.aaredb_params else None
return sample.aaredb_params.oscillation if sample.aaredb_params else None
elif column == 13:
return sample.aaredb_params.totalangle if sample.aaredb_params else None
return sample.aaredb_params.exposure if sample.aaredb_params else None
elif column == 14:
return sample.aaredb_params.totalangle if sample.aaredb_params else None
elif column == 15:
# Model holds a 0-1 fraction; users think in spreadsheet percent.
t = sample.aaredb_params.transmission if sample.aaredb_params else None
return None if t is None else round(t * 100, 1)
elif column == 15:
return sample.comment
return None if t is None else t
return ""
@@ -80,17 +80,17 @@ class UserSampleSpreadsheet(QAbstractTableModel):
"Location",
"Priority",
"User",
"Mount count",
"Raster count",
"", # Mount count
"", # Raster count
# Workflow order: a sample is screened before rotation data is
# collected, so Screening sits left of Rotation.
"Screening count",
"Rotation count",
"", # Screening count
"", # Rotation count
"Comment",
"Oscillation (°)",
"Exposure (s)",
"Total range (°)",
"Transmission (%)",
"Comment",
"Transmission",
]
self.current_sample = current_sample
self.current_puck = current_puck
+5 -2
View File
@@ -1,3 +1,5 @@
from aarecommon.config.beamline import mx_beamline
from aarecommon.models.beamline import MXBeamline
from aarecommon.models.models import DAQStatusModel
from PySide6.QtCore import Signal, Slot
from PySide6.QtWidgets import QDoubleSpinBox, QGridLayout, QLabel, QPushButton, QWidget
@@ -9,8 +11,9 @@ from aare.gui.widgets.title_label import TitleLabel
# TODO: placeholder range (was an arbitrary 1-30; nothing downstream validates —
# daq.change_energy forwards straight to bec) — confirm the real monochromator
# limits with the Beamline Scientist. Shared by both Set Energy rows.
ENERGY_MIN_KEV = 4.0
ENERGY_MAX_KEV = 20.0
# X10SA mono reaches 6-30 keV; others keep the placeholder until confirmed.
# in the 6124 planner it says 10 to 20 keV at PXII
ENERGY_MIN_KEV, ENERGY_MAX_KEV = (10.0, 20.0) if mx_beamline() == MXBeamline.X10SA else (4.0, 20.0)
# "arrived" window for the moving->neutral transition; per-hardware knob like
# MotorMoveGroup's tol (the mono never lands exactly on the setpoint)
ENERGY_AT_TARGET_TOL_KEV = 0.001
+3 -2
View File
@@ -289,14 +289,15 @@ def test_spreadsheet_param_columns(status_model):
hdr.index("Oscillation (°)"),
hdr.index("Exposure (s)"),
hdr.index("Total range (°)"),
hdr.index("Transmission (%)"),
hdr.index("Transmission"),
)
model.get_id(_row_of(model, 1)).aaredb_params = DataCollectionParameters(
oscillation=0.1, exposure=0.01, totalangle=360, transmission=0.125
)
row = _row_of(model, 1)
d = lambda c: model.data(model.index(row, c), Qt.ItemDataRole.DisplayRole)
assert (d(osc), d(exp), d(tot), d(trans)) == (0.1, 0.01, 360, 12.5)
# Transmission shown as stored, no percent conversion.
assert (d(osc), d(exp), d(tot), d(trans)) == (0.1, 0.01, 360, 0.125)
# No params -> blank, and sorting a mostly-None column must not raise;
# the real value sorts first.
assert model.data(model.index(_row_of(model, 2), osc), Qt.ItemDataRole.DisplayRole) is None