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:
2026-09-08 11:56:57 +02:00
committed by duan_j
co-authored by Claude Fable 5.1
parent f20bd065f5
commit f1cf55adb9
4 changed files with 23 additions and 21 deletions
+3 -1
View File
@@ -7,7 +7,9 @@ requires-python = ">=3.11"
dependencies = [
"uv",
"gunicorn",
"aarecommon>=0.5.1",
# >=0.7: DataCollectionParameters.transmission is a 0-1 fraction, which
# the scan panels rely on (older releases held an int percentage).
"aarecommon>=0.7.3",
"pydantic>=2.11",
"numpy",
"jfjoch_client>=1.0.0rc165",
+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.
@@ -59,7 +59,7 @@ def test_sample_parameters_translate_the_spreadsheet_row():
pin=1,
aaredb_params=DataCollectionParameters(
targetresolution=1.5,
transmission=20, # aareDB stores a percentage
transmission=0.2, # 0-to-1 fraction; aareDB converts the percent sheets
totalangle=180,
oscillation=0.1,
exposure=0.02,
Generated
+9 -9
View File
@@ -11,7 +11,7 @@ overrides = [{ name = "opencv-python", marker = "sys_platform == 'nonexistent'"
[[package]]
name = "aarecommon"
version = "0.5.4"
version = "0.7.3"
source = { registry = "https://gitea.psi.ch/api/packages/mx/pypi/simple" }
dependencies = [
{ name = "jfjoch-client" },
@@ -24,14 +24,14 @@ dependencies = [
{ name = "scipy", version = "1.17.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
{ name = "scipy", version = "1.18.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
]
sdist = { url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aarecommon/0.5.4/aarecommon-0.5.4.tar.gz", hash = "sha256:3e4e2e5ee1dbe2690e6b6ee26598f2fd845f5f458bbe8b05282e24cf9fa27aca" }
sdist = { url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aarecommon/0.7.3/aarecommon-0.7.3.tar.gz", hash = "sha256:e85ddf9d3b740ca7536597b26cf839b159e96efc68845a6efb667a7dca5c4e0f" }
wheels = [
{ url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aarecommon/0.5.4/aarecommon-0.5.4-py3-none-any.whl", hash = "sha256:ad0efe9d593532331dd898edf0498a5ccb992d11cfb3b7db037385c399258600" },
{ url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aarecommon/0.7.3/aarecommon-0.7.3-py3-none-any.whl", hash = "sha256:22e8c87e2800cbe9223341b43b448f4d0a4f2c199e59c27d17eed2a4b2e11531" },
]
[[package]]
name = "aaredaq"
version = "0.21.3"
version = "0.22.1"
source = { editable = "." }
dependencies = [
{ name = "aarecommon" },
@@ -82,8 +82,8 @@ test = [
[package.metadata]
requires-dist = [
{ name = "aarecommon", specifier = ">=0.5.1" },
{ name = "aaredb", specifier = ">=0.2", index = "https://gitea.psi.ch/api/packages/mx/pypi/simple" },
{ name = "aarecommon", specifier = ">=0.7.3" },
{ name = "aaredb", specifier = ">=0.83.1", index = "https://gitea.psi.ch/api/packages/mx/pypi/simple" },
{ name = "aarelcinfer-client", specifier = "==0.1.1a8" },
{ name = "aarescan-client", specifier = "==1.0.0rc5" },
{ name = "basedpyright", marker = "extra == 'test'" },
@@ -124,7 +124,7 @@ provides-extras = ["test", "docs"]
[[package]]
name = "aaredb"
version = "0.6.0"
version = "0.83.1"
source = { registry = "https://gitea.psi.ch/api/packages/mx/pypi/simple" }
dependencies = [
{ name = "pydantic" },
@@ -132,9 +132,9 @@ dependencies = [
{ name = "typing-extensions" },
{ name = "urllib3" },
]
sdist = { url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aaredb/0.6.0/aaredb-0.6.0.tar.gz", hash = "sha256:c6e9a4d5c23b1efd0e558e30811685343b9ace20cb6dd433b3e43ae26b9af049" }
sdist = { url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aaredb/0.83.1/aaredb-0.83.1.tar.gz", hash = "sha256:9bbcf7cb9f165ae1217cb0392e48c820748976cadd3daf194b71a99c21de836e" }
wheels = [
{ url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aaredb/0.6.0/aaredb-0.6.0-py3-none-any.whl", hash = "sha256:78cd04e09a9ae16843ded6a60322baf35f43d0d926c787544402b7a85d2924e3" },
{ url = "https://gitea.psi.ch/api/packages/mx/pypi/files/aaredb/0.83.1/aaredb-0.83.1-py3-none-any.whl", hash = "sha256:cf7a2cd8171f7911b572b6367e5a8aabf9b10d731bddb724495273e8e17e2eb7" },
]
[[package]]