Skip to content

Commit

Permalink
[fix] autostig period for idx 0 behaved incorrectly
Browse files Browse the repository at this point in the history
For idx 0 even if the autostig period was set to 0 it would still run the extended pre-calibrations. Additionally it should not run for idx 0, only for subsequent indices.
Re-initialize AcquisitionConfig() instead of using conf.get_acqui_conf() for autostigmation and for the overlap, so the GUI does not have to be restarted when changing the value. This increases flexibility during testing.
  • Loading branch information
tepals committed Feb 27, 2024
1 parent d5bd3ea commit dd53b67
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 9 additions & 4 deletions src/odemis/gui/cont/acquisition/fastem_acq.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import os
from builtins import str
from concurrent.futures._base import CancelledError
from datetime import datetime
from functools import partial

import wx
Expand All @@ -43,8 +42,9 @@
from odemis.acq.align.fastem import Calibrations
from odemis.acq.fastem import estimate_acquisition_time
from odemis.acq.stream import FastEMOverviewStream
from odemis.gui import FG_COLOUR_BUTTON, conf
from odemis.gui import FG_COLOUR_BUTTON
from odemis.gui.conf.data import get_hw_config
from odemis.gui.conf.file import AcquisitionConfig
from odemis.gui.conf.util import process_setting_metadata
from odemis.gui.util import (call_in_wx_main, get_picture_folder,
wxlimit_invocation)
Expand Down Expand Up @@ -518,12 +518,17 @@ def on_acquisition(self, evt):

# Read the period with which to run autostigmation, if the value is 5 it should run for
# ROAs with index 0, 5, 10, etc., if the value is 0 it should never run autostigmation
acqui_conf = conf.get_acqui_conf()
acqui_conf = AcquisitionConfig()
autostig_period = math.inf if acqui_conf.autostig_period == 0 else acqui_conf.autostig_period

for p in self._tab_data_model.projects.value:
for idx, roa in enumerate(p.roas.value):
pre_calib = pre_calib_plus if idx % autostig_period == 0 else pre_calibrations
if idx == 0 or idx % autostig_period != 0:
pre_calib = pre_calibrations
logging.debug(f"idx {idx}, autostig period {autostig_period}")
else:
pre_calib = pre_calib_plus
logging.debug(f"else: idx {idx}, autostig period {autostig_period}")
f = fastem.acquire(roa, p.name.value, self._main_data_model.ebeam,
self._main_data_model.multibeam, self._main_data_model.descanner,
self._main_data_model.mppc, self._main_data_model.stage,
Expand Down
9 changes: 5 additions & 4 deletions src/odemis/gui/cont/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
FASTEM system.
"""

from functools import partial
import logging
from functools import partial

import wx

from odemis.acq.fastem import CALIBRATION_2, CALIBRATION_3, FastEMROA
import odemis.acq.stream as acqstream
import odemis.gui.model as guimodel
from odemis.gui import conf, FG_COLOUR_RADIO_INACTIVE, FG_COLOUR_BUTTON
from odemis.acq.fastem import CALIBRATION_2, CALIBRATION_3, FastEMROA
from odemis.gui import FG_COLOUR_RADIO_INACTIVE, FG_COLOUR_BUTTON
from odemis.gui.comp.fastem import FastEMProjectPanel, FastEMROAPanel, FastEMCalibrationPanel
from odemis.gui.conf.file import AcquisitionConfig
from odemis.gui.util import call_in_wx_main
from odemis.util.filename import make_unique_name

Expand Down Expand Up @@ -281,7 +282,7 @@ def __init__(self, name, roc_2, roc_3, colour, tab_data, project_panel, viewport
self._viewport = viewport

# Read the overlap from the acquisition configuration
acqui_conf = conf.get_acqui_conf()
acqui_conf = AcquisitionConfig()

self.model = FastEMROA(name, acqstream.UNDEFINED_ROI, roc_2, roc_3,
self._tab_data.main.asm, self._tab_data.main.multibeam,
Expand Down

0 comments on commit dd53b67

Please sign in to comment.