Skip to content

Commit

Permalink
Merge pull request #2086 from tepals/fastem-test-fixes
Browse files Browse the repository at this point in the history
Fastem test cases: raise an error when trying to run the test cases w…
  • Loading branch information
pieleric authored Apr 1, 2022
2 parents b5fb31e + 979f44b commit 3202d58
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion install/linux/usr/share/odemis/sim/fastem-sim-asm.odm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,12 @@ FASTEM-sim: {
"Beam Shift Controller": {
class: tfsbc.BeamShiftController,
role: ebeam-shift,
dependencies: {"scanner": "MultiBeam Scanner XT"},
init: {
port: "/dev/fake",
serialnum: FT43FD2D,
},
affects: ["EBeam Scanner", "MultiBeam Scanner"],
affects: ["MultiBeam Scanner XT", "MultiBeam Scanner"],
}

"Focus Tracker": {
Expand Down
6 changes: 5 additions & 1 deletion install/linux/usr/share/odemis/sim/fastem-sim.odm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,15 @@ FASTEM-sim: {
"Beam Shift Controller": {
class: tfsbc.BeamShiftController,
role: ebeam-shift,
# The Multibeam Scanner XT can be set as a dependency to automatically retrieve
# the calibration data from the scanner, however this is not possible here,
# because the SimSem does not contain calibration data.
# dependencies: {"scanner": "MultiBeam Scanner XT"},
init: {
port: "/dev/fake",
serialnum: FT43FD2D,
},
affects: ["EBeam Scanner", "MultiBeam Scanner"],
affects: ["MultiBeam Scanner XT", "MultiBeam Scanner"],
}

"Focus Tracker": {
Expand Down
4 changes: 3 additions & 1 deletion src/odemis/acq/align/test/fastem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from odemis import model
from odemis.acq.align import fastem
from odemis.acq.align.fastem import Calibrations
from odemis.util import test
from odemis.util import driver, test

# * TEST_NOHW = 1: use simulator (asm/sam and xt adapter simulators need to be running)
# technolution_asm_simulator/simulator2/run_the_simulator.py
Expand All @@ -55,6 +55,8 @@ class TestFastEMCalibration(unittest.TestCase):
def setUpClass(cls):
if TEST_NOHW:
test.start_backend(FASTEM_CONFIG)
elif driver.get_backend_status() != driver.BACKEND_RUNNING:
raise IOError("Backend controlling a real hardware should be started before running this test case")

# get the hardware components
cls.scanner = model.getComponent(role='e-beam')
Expand Down
13 changes: 9 additions & 4 deletions src/odemis/acq/test/fastem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from fastem_calibrations import configure_hw
from odemis import model
from odemis.acq import fastem, stream
from odemis.util import test, img, is_point_in_rect
from odemis.util import driver, img, is_point_in_rect, test

# * TEST_NOHW = 1: connected to the simulator or not connected to anything
# * TEST_NOHW = 0: connected to the real hardware, the backend should be running
Expand All @@ -59,6 +59,8 @@ class TestFASTEMOverviewAcquisition(unittest.TestCase):
def setUpClass(cls):
if TEST_NOHW:
test.start_backend(FASTEM_CONFIG)
elif driver.get_backend_status() != driver.BACKEND_RUNNING:
raise IOError("Backend controlling a real hardware should be started before running this test case")

cls.ebeam = model.getComponent(role="e-beam")
cls.efocuser = model.getComponent(role="ebeam-focus")
Expand Down Expand Up @@ -134,6 +136,8 @@ class TestFastEMROA(unittest.TestCase):
def setUpClass(cls):
if TEST_NOHW:
test.start_backend(FASTEM_CONFIG_ASM)
elif driver.get_backend_status() != driver.BACKEND_RUNNING:
raise IOError("Backend controlling a real hardware should be started before running this test case")

# get the hardware components
cls.asm = model.getComponent(role="asm")
Expand Down Expand Up @@ -300,6 +304,8 @@ class TestFastEMAcquisition(unittest.TestCase):
def setUpClass(cls):
if TEST_NOHW:
test.start_backend(FASTEM_CONFIG_ASM)
elif driver.get_backend_status() != driver.BACKEND_RUNNING:
raise IOError("Backend controlling a real hardware should be started before running this test case")

# get the hardware components
cls.scanner = model.getComponent(role='e-beam')
Expand Down Expand Up @@ -527,6 +533,8 @@ class TestFastEMAcquisitionTask(unittest.TestCase):
def setUpClass(cls):
if TEST_NOHW:
test.start_backend(FASTEM_CONFIG_ASM)
elif driver.get_backend_status() != driver.BACKEND_RUNNING:
raise IOError("Backend controlling a real hardware should be started before running this test case")

# Get the hardware components from the simulators or hardware
cls.scanner = model.getComponent(role='e-beam')
Expand All @@ -540,9 +548,6 @@ def setUpClass(cls):
cls.beamshift = model.getComponent(role="ebeam-shift")
cls.lens = model.getComponent(role="lens")

# Normally the beamshift MD_CALIB is set when running the calibrations.
# Set it here explicitly because we do not run the calibrations in these test cases.
cls.beamshift.updateMetadata({model.MD_CALIB: cls.scanner.beamShiftTransformationMatrix.value})
cls.beamshift.shift.value = (0, 0)
cls.stage.reference({"x", "y"}).result()

Expand Down

0 comments on commit 3202d58

Please sign in to comment.