feat: migrate to v4 scans

This commit is contained in:
2026-07-29 14:48:35 +02:00
parent df92754024
commit cd13e7ed9e
18 changed files with 1456 additions and 1539 deletions
@@ -3,15 +3,15 @@ _expected_fermat_position_count()/_fermat_min_positions() (lamni.py/
flomni.py), which predict a scan's point count before it ever reaches the
scan server, by calling the exact same algorithm the real scan classes use
(FlomniFermatScan.get_flomni_fermat_spiral_pos()/
LamNIFermatScan.get_lamni_fermat_spiral_pos(), both now pure @staticmethods
-- see csaxs_bec/scans/flomni_fermat_scan.py and LamNIFermatScan.py).
LamniFermatScan.get_lamni_fermat_spiral_pos(), both now pure @staticmethods
-- see csaxs_bec/scans/flomni_fermat_scan.py and lamni_fermat_scan.py).
"""
import csaxs_bec.bec_ipython_client.plugins.LamNI.lamni as lamni_module
from csaxs_bec.bec_ipython_client.plugins.flomni.flomni import Flomni
from csaxs_bec.bec_ipython_client.plugins.LamNI.lamni import LamNI
from csaxs_bec.scans.flomni_fermat_scan import FlomniFermatScan
from csaxs_bec.scans.LamNIFermatScan import LamNIFermatScan
from csaxs_bec.scans.lamni_fermat_scan import LamniFermatScan
class FakeClient:
@@ -59,11 +59,11 @@ def make_lamni():
def test_flomni_min_positions_threshold_is_20():
assert FlomniFermatScan._MIN_POSITIONS == 20
assert FlomniFermatScan.MIN_POSITIONS == 20
def test_lamni_min_positions_threshold_is_20():
assert LamNIFermatScan._MIN_POSITIONS == 20
assert LamniFermatScan.MIN_POSITIONS == 20
def test_flomni_expected_position_count_below_threshold():
@@ -105,7 +105,7 @@ def test_lamni_expected_position_count_below_threshold():
assert count < lamni._fermat_min_positions()
# matches calling the real scan-class algorithm directly, center tile, angle 0
expected = LamNIFermatScan.get_lamni_fermat_spiral_pos(
expected = LamniFermatScan.get_lamni_fermat_spiral_pos(
-2.5,
2.5,
-2.5,
@@ -115,7 +115,8 @@ def test_lamni_expected_position_count_below_threshold():
stitch_x=0,
stitch_y=0,
stitch_overlap=0.2,
fov_size=[5.0, 5.0],
fovx=5.0,
fovy=5.0,
fov_circular=0.0,
)
assert count == len(expected)
@@ -30,7 +30,7 @@ from csaxs_bec.bec_widgets.widgets.tomo_params.tomo_params import (
_lamni_set_tomo_fov_offset,
_requested_to_stepsize,
)
from csaxs_bec.scans.LamNIFermatScan import LamNIFermatScan
from csaxs_bec.scans.lamni_fermat_scan import LamniFermatScan
STEPSIZES = [10.0, 7.0, 25.0, 12.5]
@@ -180,9 +180,9 @@ def test_compute_fermat_positions_lamni_matches_scan_class_below_threshold():
"lamni_stitch_y": 0,
}
count, min_positions = _compute_fermat_positions_lamni(params)
assert min_positions == LamNIFermatScan._MIN_POSITIONS
assert min_positions == LamniFermatScan.MIN_POSITIONS
assert count < min_positions
expected = LamNIFermatScan.get_lamni_fermat_spiral_pos(
expected = LamniFermatScan.get_lamni_fermat_spiral_pos(
-2.5,
2.5,
-2.5,
@@ -192,7 +192,8 @@ def test_compute_fermat_positions_lamni_matches_scan_class_below_threshold():
stitch_x=0,
stitch_y=0,
stitch_overlap=0.2,
fov_size=[5.0, 5.0],
fovx=5.0,
fovy=5.0,
fov_circular=0.0,
)
assert count == len(expected)
@@ -242,4 +243,4 @@ def test_compute_fermat_positions_lamni_zero_step_is_safe():
{"lamni_piezo_range_x": 5.0, "lamni_piezo_range_y": 5.0, "tomo_shellstep": 0.0}
)
assert count == 0
assert min_positions == LamNIFermatScan._MIN_POSITIONS
assert min_positions == LamniFermatScan.MIN_POSITIONS
@@ -53,7 +53,7 @@ def _flomni_reference(stepsize):
def test_compute_fermat_positions_flomni_matches_scan_class_below_threshold():
params = {"fovx": 5.0, "fovy": 5.0, "tomo_shellstep": 2.0}
count, min_positions = _compute_fermat_positions_flomni(params)
assert min_positions == FlomniFermatScan._MIN_POSITIONS
assert min_positions == FlomniFermatScan.MIN_POSITIONS
assert count < min_positions
expected = FlomniFermatScan.get_flomni_fermat_spiral_pos(-2.5, 2.5, -2.5, 2.5, step=2.0)
assert count == len(expected)
@@ -72,4 +72,4 @@ def test_compute_fermat_positions_flomni_zero_step_is_safe():
{"fovx": 5.0, "fovy": 5.0, "tomo_shellstep": 0.0}
)
assert count == 0
assert min_positions == FlomniFermatScan._MIN_POSITIONS
assert min_positions == FlomniFermatScan.MIN_POSITIONS