Skip to content

Commit

Permalink
changed a few ROI values and roles in the config file according to re…
Browse files Browse the repository at this point in the history
…view comments

changed back the timeout value in util/testing.py
  • Loading branch information
sneepstefan committed Jan 19, 2024
1 parent 32edbc8 commit 160e9fa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
4 changes: 2 additions & 2 deletions install/linux/usr/share/odemis/sim/sparc2-4spec-sim.odm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ SPARC2-4Spec: {
# In reality, this is a Zyla, but you need libandor3-dev to simulate an AndorCam3
"AR Camera": {
class: andorcam2.AndorCam2,
role: ccd,
role: ccd0,
power_supplier: "Power Control Unit",
init: {
device: "fake",
Expand All @@ -362,7 +362,7 @@ SPARC2-4Spec: {

"Int Spectrometer 0": {
class: spectrometer.CompositedSpectrometer,
role: spectrometer,
role: spectrometer0,
dependencies: {detector: "AR Camera", spectrograph: "Integrated Spectrograph"},
init: {
transp: [1, 2], # only applied to the spectrometer data (not raw CCD)
Expand Down
33 changes: 19 additions & 14 deletions src/odemis/acq/test/stream_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2232,8 +2232,8 @@ def setUpClass(cls):

# Find CCD & SEM components
cls.microscope = model.getMicroscope()
cls.ccd = model.getComponent(role="sp-ccd1")
cls.spec = model.getComponent(role="spectrometer")
cls.ccd = model.getComponent(role="ccd0")
cls.spec = model.getComponent(role="spectrometer0")
cls.ebeam = model.getComponent(role="e-beam")
cls.sed = model.getComponent(role="se-detector")
cls.scan_stage = model.getComponent(role="scan-stage")
Expand Down Expand Up @@ -2270,13 +2270,18 @@ def test_scan_stage_wrapper(self):
# Keep ROI minimal to keep the acquisition time as low as possible with a low repetition
# roi ~ 20um x 20um
# rep 5, 5
specs_sstage.roi.value = (0.492, 0.492, 0.508, 0.508)
specs_sstage.repetition.value = (5, 5)
# rectangular shape
specs_sstage.roi.value = (0.492, 0.49, 0.508, 0.51)
specs_sstage.repetition.value = (4, 6)

# ROI phys = (2.0600156250000022e-5, 2.0600156250000022e-5) = 20.6 um x 20.6 um
# determine the ROI's physical centre position, number of pixels and pixel size
exp_cpos, exp_pxsize, exp_pxnum = roi_to_phys(specs_sstage)
# pos should be between -10.3e-6 and 10.3e-6 both x and y
roi_rng = (-(exp_pxsize[0] * exp_pxnum[0]) / 2, (exp_pxsize[1] * exp_pxnum[1]) / 2)
# determine the range of the ROI by calculating the physical size
rng_topleft = (exp_cpos[0] - ((exp_pxsize[0] * exp_pxnum[0]) / 2),
exp_cpos[1] - ((exp_pxsize[1] * exp_pxnum[1]) / 2))
rng_bottomright = (exp_cpos[0] + ((exp_pxsize[0] * exp_pxnum[0]) / 2),
exp_cpos[1] + ((exp_pxsize[1] * exp_pxnum[1]) / 2))
roi_rng = (rng_topleft, rng_bottomright)

self.stage_positions = []
self.ebeam_positions = []
Expand Down Expand Up @@ -2320,10 +2325,10 @@ def test_scan_stage_wrapper(self):

# check if the centre pixel positions in stage_positions fall within the range of the selected ROI
for pos in self.stage_positions:
self.assertGreater(pos["x"], roi_rng[0])
self.assertLess(pos["x"], roi_rng[1])
self.assertGreater(pos["y"], roi_rng[0])
self.assertLess(pos["y"], roi_rng[1])
self.assertGreater(pos["x"], roi_rng[0][0])
self.assertLess(pos["x"], roi_rng[1][0])
self.assertGreater(pos["y"], roi_rng[0][1])
self.assertLess(pos["y"], roi_rng[1][1])

def test_scan_stage_wrapper_noccd(self):
"""
Expand Down Expand Up @@ -2371,9 +2376,9 @@ def test_roi_out_of_stage_limits(self):
f = self.sem_stage.moveAbs({"x": xrng_stage[0], "y": yrng_stage[0]})
f.result()

# now go to the top left corner and create a ROI with out of range dimensions
specs_sstage.roi.value = (0, 0, 0.02, 0.02)
specs_sstage.repetition.value = (5, 5)
# now go to the top left corner and create a rectangular shaped ROI with out of range dimensions
specs_sstage.roi.value = (0, 0, 0.02, 0.025)
specs_sstage.repetition.value = (4, 6)

# Run the acquisition
f = sps.acquire()
Expand Down
2 changes: 1 addition & 1 deletion src/odemis/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def run_backend(config):

time.sleep(3) # give some time to the backend to start a little bit

timeout = 40 # s timeout
timeout = 30 # s timeout
end = time.time() + timeout
while time.time() < end:
status = driver.get_backend_status()
Expand Down

0 comments on commit 160e9fa

Please sign in to comment.