fix: take the aareDB transmission as the fraction aarecommon >= 0.7 declares
CI / lint (push) Successful in 1m11s
Docs build and publish / docker (push) Successful in 4s
CI / test (3.12) (push) Canceled after 1m22s
CI / test (3.13) (push) Canceled after 1m3s
CI / test (3.14) (push) Canceled after 1m0s
CI / test-with-beamline-plugins (pxii_bec) (push) Canceled after 55s
CI / test-with-beamline-plugins (pxi_bec) (push) Canceled after 56s
CI / test-with-beamline-plugins (pxiii_bec) (push) Canceled after 31s
CI / test-with-coverage (push) Canceled after 23s
CI / coverage-analysis (push) Canceled after 0s
Build and Publish / release (push) Successful in 17s

CI resolves aarecommon 0.7.3, where DataCollectionParameters.transmission
is a 0-to-1 fraction that rejects anything above 1.0 (the percent sheets
are converted inside AareDB >= 0.83, which main already requires). The
divide-by-100 from the earlier 'percentage' fix therefore failed the
model test on CI and would have turned 20% into 0.2% at the beamline.
Pass the fraction through and pin aarecommon>=0.7.3 so the older int
percentage model can no longer be installed; relock.

Also satisfy the diff typecheck gate: basedpyright only counts instance
variables assigned in __init__, so the Database/User toggle widgets are
created there and _build_source_toggle only lays them out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit was merged in pull request #200.
This commit is contained in:
duan_jandClaude Fable 5.1 authored and duan_j committed 2026-09-08 11:56:57 +02:00
1 parent f20bd065f5
commit f1cf55adb9
4 files changed
+23 -21

No files matched your search

+10 -10
View File
@@ -86,15 +86,13 @@ class SampleParameters:
params = None if sample is None else sample.aaredb_params
if params is None:
return cls()
# aareDB holds transmission as a percentage (DataCollectionParameters
# .transmission is an int, 0 to 100); everything here works in the
# 0-to-1 fraction the scan requests are built from.
transmission = _spreadsheet_float(params, "transmission")
if transmission is not None:
transmission = transmission / 100.0
# DataCollectionParameters.transmission is the 0-to-1 fraction the
# scan requests use (aarecommon >= 0.7 rejects anything above 1.0 by
# design; the percent spreadsheets humans write are converted inside
# AareDB). No scaling here: dividing again would turn 20% into 0.2%.
return cls(
resolution_a=_spreadsheet_float(params, "targetresolution"),
transmission=transmission,
transmission=_spreadsheet_float(params, "transmission"),
total_angle_deg=_spreadsheet_float(params, "totalangle"),
image_angle_deg=_spreadsheet_float(params, "oscillation"),
exp_time_s=_spreadsheet_float(params, "exposure"),
@@ -158,6 +156,11 @@ class ScanSettingsPanel(QWidget):
outer = QVBoxLayout(self)
outer.setContentsMargins(0, 0, 0, 0)
outer.setSpacing(0)
# Created here, not in _build_source_toggle: basedpyright only counts
# instance variables assigned in __init__ as initialized.
self._database_radio = QRadioButton("Database values", self)
self._user_radio = QRadioButton("User values", self)
self._source_group = QButtonGroup(self)
outer.addWidget(self._build_source_toggle())
grid_host = QWidget(self)
@@ -242,10 +245,7 @@ class ScanSettingsPanel(QWidget):
container = QWidget(self)
row = QHBoxLayout(container)
row.setContentsMargins(0, 0, 0, 0)
self._database_radio = QRadioButton("Database values", container)
self._user_radio = QRadioButton("User values", container)
self._database_radio.setChecked(True)
self._source_group = QButtonGroup(container)
self._source_group.addButton(self._database_radio)
self._source_group.addButton(self._user_radio)
# One connection is enough: toggled fires on both directions.