Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for optimization sequence in scanning toolchain #155

Merged
merged 128 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
9e2aa27
moved optimizer_plot_dimensions to ScanningOptimizeLogic
TobiasSpohn Sep 5, 2024
cf7f172
added optional ConfigOptions to default.cfg
TobiasSpohn Sep 5, 2024
27986ce
fixed subset check
TobiasSpohn Sep 5, 2024
49f5966
changes to default plot option and using already assigned variable
TobiasSpohn Sep 5, 2024
9b4f3b9
fixed scan sequence selection on activation
TobiasSpohn Sep 5, 2024
30b7425
renaming ConfigOption
TobiasSpohn Sep 5, 2024
937d2ed
fix of private variable access
TobiasSpohn Sep 5, 2024
484697e
ConfigOption now uses constructor to fix bug in Creation of ConfigOpt…
TobiasSpohn Sep 5, 2024
2527dcf
add signal that notifies if dimension is changed
TobiasSpohn Sep 5, 2024
64ce7ba
added exception if optimizer sequence is greater than available axes
TobiasSpohn Sep 5, 2024
a4f6d81
Merge branch 'main' into 1d_scanner_optimize
TobiasSpohn Sep 5, 2024
d0158f5
typo
TobiasSpohn Sep 5, 2024
c9a2744
changelog.md
TobiasSpohn Sep 5, 2024
617ebba
moving to decorator syntax
TobiasSpohn Sep 5, 2024
a26a509
Merge branch 'main' into 1d_scanner_optimize
TobiasSpohn Sep 6, 2024
abee321
improved error message
timoML Sep 9, 2024
46ca90c
mention new name of ConfigOption
TobiasSpohn Sep 9, 2024
d41c3f2
remove hardcoded axes names in 1d scans
timoML Sep 9, 2024
6e91623
Merge branch '1d_scanner_optimize' of https://github.com/Ulm-IQO/qudi…
TobiasSpohn Sep 9, 2024
6ca66df
added n_dim image generation
TobiasSpohn Sep 10, 2024
3b6de4c
first working dummy with n dim image generation
TobiasSpohn Sep 10, 2024
3bcf927
small spot generation improvements
TobiasSpohn Sep 10, 2024
131a7e3
added more sane defaults for the new image generation and removed som…
TobiasSpohn Sep 10, 2024
24e73d3
removed debugging
TobiasSpohn Sep 10, 2024
3eff1a4
bugfix in volume checking
TobiasSpohn Sep 10, 2024
9a34b69
better defaults
TobiasSpohn Sep 10, 2024
c69f76e
handle bug when no spot is created
TobiasSpohn Sep 10, 2024
910327e
better defaults and better debugging
TobiasSpohn Sep 10, 2024
a0dc329
fixed default.cfg
TobiasSpohn Sep 10, 2024
e018f04
bugfix
TobiasSpohn Sep 10, 2024
04b200d
added optionals to config
TobiasSpohn Sep 10, 2024
20cbd9f
ValueError fix
TobiasSpohn Sep 10, 2024
6c335a1
added gui update on logic sequence dimensions change
TobiasSpohn Sep 10, 2024
cade24c
cleanup debug
TobiasSpohn Sep 10, 2024
3f4f296
fixed default.cfg
TobiasSpohn Sep 10, 2024
d55559b
bugfix
TobiasSpohn Sep 10, 2024
bcbc3cd
added optionals to config
TobiasSpohn Sep 10, 2024
6b8a5e3
ValueError fix
TobiasSpohn Sep 10, 2024
fbaa536
added gui update on logic sequence dimensions change
TobiasSpohn Sep 10, 2024
c6ed27c
cleanup debug
TobiasSpohn Sep 10, 2024
37cf489
fixed RuntimError when reloading GUI
TobiasSpohn Sep 11, 2024
be3768d
removed unnecessary imports
TobiasSpohn Sep 11, 2024
e7d29c4
optimizer dockwidget is added in same place
TobiasSpohn Sep 11, 2024
693209f
disconnect sequence dimension changed signal
TobiasSpohn Sep 11, 2024
a086e4d
correctly handle if no widget is present yet
TobiasSpohn Sep 11, 2024
2014d34
make tabify and resize available as methods
TobiasSpohn Sep 11, 2024
4e81750
removed debug message
TobiasSpohn Sep 11, 2024
e8aff07
removed debug
TobiasSpohn Sep 11, 2024
42761e7
added optionals to default.cfg
TobiasSpohn Sep 11, 2024
934b04a
more sensible counts
TobiasSpohn Sep 11, 2024
37e4a52
fixed position dependent fluorescence
TobiasSpohn Sep 11, 2024
1026662
correct config
TobiasSpohn Sep 11, 2024
fca155a
refactored n_dim_gaussian
TobiasSpohn Sep 11, 2024
7af6028
removed 2D gaussian
TobiasSpohn Sep 11, 2024
de51bd6
tweaking noise and spot size
TobiasSpohn Sep 11, 2024
2cf26e5
calculate allowed optimizer sequence dimensions
TobiasSpohn Sep 11, 2024
faf4c33
gui changing of optimizer scan dimensions
TobiasSpohn Sep 11, 2024
2fe7d38
GUI live updates scan sequence and dimension
TobiasSpohn Sep 11, 2024
71f3725
scanning_optimize_logic default config
TobiasSpohn Sep 11, 2024
27f1279
scannergui default config
TobiasSpohn Sep 11, 2024
72957e4
better defaults
TobiasSpohn Sep 12, 2024
d3c963e
added max spot density check
TobiasSpohn Sep 12, 2024
f08d9a9
Merge branch '1d_scanner_optimize' of https://github.com/Ulm-IQO/qudi…
timoML Sep 12, 2024
14a200e
make python 3.8 compatible
timoML Sep 12, 2024
a667133
vectorize loop for spot generation
timoML Sep 12, 2024
6c34c90
vectorized image generation
timoML Sep 12, 2024
fdd5191
support tilt correction again
timoML Sep 12, 2024
1942ccc
Merge branch '1d_scanner_optimize' of https://github.com/Ulm-IQO/qudi…
TobiasSpohn Sep 12, 2024
819dbd6
fix broken generation without visible spot
timoML Sep 12, 2024
a389345
fix scan break condition
TobiasSpohn Sep 12, 2024
e51fb05
config typo
TobiasSpohn Sep 12, 2024
3e577a8
fixed deadlocking of scanning_probe_logic when performing optimization
TobiasSpohn Sep 12, 2024
ad18234
remove startup_modules
TobiasSpohn Oct 4, 2024
e3e711f
formatting
TobiasSpohn Oct 4, 2024
0f65dd8
changed spot in volume detection to detection around every scan point
TobiasSpohn Oct 4, 2024
5e04ab3
fixed memory overflow when calculating tilt corrected image
TobiasSpohn Oct 5, 2024
822e3be
chunk size and max calculations breakpoint now configurable
TobiasSpohn Oct 5, 2024
f705d50
correctly implement tilt correction
TobiasSpohn Oct 6, 2024
c54c5fa
removed debugging
TobiasSpohn Oct 6, 2024
e32c090
renamed position_vectors -> scan_vectors
TobiasSpohn Oct 6, 2024
f810e0e
removed unused method
TobiasSpohn Oct 6, 2024
b24ce3e
removed unnecessary comments
TobiasSpohn Oct 7, 2024
aa008fe
fixed max_calculations as configoption
TobiasSpohn Oct 7, 2024
dcf90f5
refactor grid_wise processing
TobiasSpohn Oct 7, 2024
4d65ab6
removed comments
TobiasSpohn Oct 7, 2024
6af642c
removed unneeded kwargs
TobiasSpohn Oct 7, 2024
771271e
removed comments
TobiasSpohn Oct 7, 2024
fab36ba
way faster calculation whether spots close in scan plane
timoML Oct 7, 2024
89e3e44
Merge branch '1d_scanner_optimize' of https://github.com/Ulm-IQO/qudi…
timoML Oct 7, 2024
985b422
fix bugs in svd distance calc
timoML Oct 7, 2024
7d4aa76
no chunking for finding emitters in detection volume
timoML Oct 8, 2024
ac75898
optimized debug message, implemented TODO
TobiasSpohn Oct 8, 2024
3ebc9c3
removed unused method
TobiasSpohn Oct 8, 2024
9448497
removed unnecessary import
TobiasSpohn Oct 10, 2024
dbfe9a6
added max_spot_number constraint
TobiasSpohn Oct 10, 2024
d7b75f4
formatting
TobiasSpohn Oct 11, 2024
475b929
code cleanup
timoML Oct 11, 2024
89e8bae
added proper ScalarConstraint for max_spot_number
TobiasSpohn Oct 11, 2024
966f087
small fix
timoML Oct 11, 2024
10567b1
Merge branch '1d_scanner_optimize' of https://github.com/Ulm-IQO/qudi…
TobiasSpohn Oct 11, 2024
b363cab
correct index to axis name mapping for arbitrary axis naming
TobiasSpohn Oct 11, 2024
b740aae
update documentation
timoML Oct 22, 2024
2dc6cd6
Merge branch '1d_scanner_optimize' of https://github.com/Ulm-IQO/qudi…
timoML Oct 22, 2024
8fc8a1b
added ruff config in pyproject.toml
TobiasSpohn Oct 25, 2024
2700db2
Merge branch 'embracing_ruff' into 1d_scanner_optimize
TobiasSpohn Oct 25, 2024
3f6a8b5
ruff formatting of dummy
TobiasSpohn Oct 25, 2024
fdef371
ruff formatting of optimizer_settings_dialog
TobiasSpohn Oct 25, 2024
35000a4
ruff formatting of scannergui
TobiasSpohn Oct 25, 2024
60943c2
ruff formatting of optimize_logic
TobiasSpohn Oct 25, 2024
9f42ec6
ruff formatting of scanning_probe_logic
TobiasSpohn Oct 25, 2024
36103cc
numpydoc docstrings
Nov 18, 2024
1cc0a36
add debug messages
timoML Nov 18, 2024
cf7bb1b
Merge remote-tracking branch 'origin/1d_scanner_optimize' into 1d_sca…
timoML Nov 18, 2024
d75b1b5
fix duplicated function header
timoML Nov 18, 2024
6559e4e
Adding mutex tracking for debug
timoML Nov 19, 2024
8abef80
added lock stack
Nov 20, 2024
df180e1
more debug messages
Nov 25, 2024
42e22f7
Revert "added lock stack"
Nov 25, 2024
906fc62
Revert "Adding mutex tracking for debug"
Nov 25, 2024
5e73540
Revert "Merge branch 'embracing_ruff' into 1d_scanner_optimize"
Nov 25, 2024
168f2a0
Merge branch 'main' into 1d_scanner_optimize
Nov 25, 2024
fad587f
Revert "more debug messages"
Nov 25, 2024
6e554de
revert "add debug messages"
Nov 25, 2024
353a82e
added BlockingQueuedConnection again
Nov 25, 2024
855630d
rename of function
TobiasSpohn Dec 16, 2024
44adcf1
Merge branch 'main' into 1d_scanner_optimize
TobiasSpohn Dec 16, 2024
dfb94ef
changed function name
TobiasSpohn Dec 16, 2024
1c3f833
fixed the name change
TobiasSpohn Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
implementing this interface.
- Add back scan data and back scan settings getter and setter methods
to `qudi.interface.scanning_probe_interface`.
- Moved ConfigOption ScannerGui.optimizer_plot_dimensions to qudi.logic.scanning_optimize_logic and optimizer sequence creation is solely handled by logic
TobiasSpohn marked this conversation as resolved.
Show resolved Hide resolved

### Bugfixes
- Fix failure of saving plots in `QDPlotLogic` when fiting is used.
Expand All @@ -19,6 +20,7 @@
- Fixed `QDPlotterGui` example config
- Fixed psu-dependent bugs for laser_quantum_laser
- Laser logic does not automatically start query loop, gui will still start it on startup
- Optimization sequences other than [2D, 1D] are now working

### New Features
- New `qudi.interface.scanning_probe_interface.ScanSettings` dataclass added.
Expand All @@ -30,7 +32,7 @@
Implementation of configurable backward scans.
- Add widgets to configure back scan resolution and frequency from scanning GUI.
- Add config option to save backward scan data to scanning data logic.
- Get current sweeps and runtime of fastcomtec fastcounter MCS6 when pulling the data trace.
- Get current sweeps and runtime of fastcomtec fastcounter MCS6 when pulling the data trace.
- Re-introduced tilt correction (from old core) to the scanning probe toolchain.
- Improved support for Stanford Research Systems signal generators
- Expanded documentation of the microwave interface
Expand All @@ -51,10 +53,10 @@ into the scanning probe toolchain, you will be required to adapt to the new inte


### Breaking Changes
- Major rework of `qudi.interface.data_instream_interface.DataInStreamInterface`. Time series
toolchain and NI x-series hardware module have been adapted but custom modules relying on this
interface will break.
Configuration for time series toolchain needs changes as well. See `default.cfg` or module
- Major rework of `qudi.interface.data_instream_interface.DataInStreamInterface`. Time series
toolchain and NI x-series hardware module have been adapted but custom modules relying on this
interface will break.
Configuration for time series toolchain needs changes as well. See `default.cfg` or module
docstrings.

### Bugfixes
Expand All @@ -64,11 +66,11 @@ docstrings.
- Fix wrong asset name, non-invokable settings for AWG Tek 70k in sequence mode.
- Fix disfunctional `mw_source_smbv`
- Fix Keysight AWG sample rate only set-able with too coarse 10 MHz precision
- Fix various Poimanager crashes
- Fix various Poimanager crashes

### New Features
- Added remote streamer support to `TimeSeriesReaderLogic`.
- New `qudi.interface.data_instream_interface.SampleTiming` Enum added to `DataInStreamInterface`
- New `qudi.interface.data_instream_interface.SampleTiming` Enum added to `DataInStreamInterface`
constraints to allow non-uniform sampling mode.
- Pulsed and odmr now add fit parameters to saved meta data.
- New hardware module added that implements the HighFinesse wavemeter as a data instream device, replacing the old (non-functional) wavemeter toolchain.
Expand All @@ -79,11 +81,11 @@ constraints to allow non-uniform sampling mode.
- Bumped `qudi-core` package minimum version requirement to v1.5.0
- Got rid of deprecated `qudi.core.interface` module usage
- Support for Python 3.10
- This version 0.5.1 fixes a requirement issue found while pushing release 0.5.0 to test-pypi
- This version 0.5.1 fixes a requirement issue found while pushing release 0.5.0 to test-pypi

## Version 0.4.0
### Breaking Changes
- `QDPlotLogic` has changed its public method signatures
- `QDPlotLogic` has changed its public method signatures
- `OkFpgaPulser` now has a mandatory config option pointing towards a directory with the bitfiles necessary.

### Bugfixes
Expand All @@ -93,14 +95,14 @@ constraints to allow non-uniform sampling mode.
### New Features
- First stable version of new scanning toolchain (aka omniscan):
- New `blocking` argument for scanner moves executed via `ScanningProbeInterface`
- Multiple bugfixes for the new scanning toolchain with NICard.
- Multiple bugfixes for the new scanning toolchain with NICard.
- The NiScanningProbeInterfuse now polls data in chunks and independent of logic calls, as it should be.
- More meta data of scans in saved data
- Support for Zaber (linear) motorized stages (in `qudi.hardware.motor.zaber_motion`)
- Overhaul of QDPlot toolchain (GUI and logic) to improve stability and consistency as well as
- Overhaul of QDPlot toolchain (GUI and logic) to improve stability and consistency as well as
adding minor GUI features.
- Added mixin `qudi.interface.mixins.process_control_switch.ProcessControlSwitchMixin` to provide
optional default implementation satisfying the `SwitchInterface` for process control hardware
- Added mixin `qudi.interface.mixins.process_control_switch.ProcessControlSwitchMixin` to provide
optional default implementation satisfying the `SwitchInterface` for process control hardware
modules implementing any of the interfaces contained in `qudi.interface.process_control_interface`
- Overhaul of PID toolchain: added units support, normalization option, gui reset feature,
dependency option for `process_control_dummy` to simulate PID control
Expand Down
3 changes: 3 additions & 0 deletions src/qudi/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ gui:
options:
image_axes_padding: 0.02
default_position_unit_prefix: null # optional, use unit prefix characters, e.g. 'u' or 'n'
min_crosshair_size_fraction: 0.02 # minimum crosshair size as fraction of the displayed scan range
connect:
scanning_logic: scanning_probe_logic
data_logic: scanning_data_logic
Expand Down Expand Up @@ -134,6 +135,8 @@ logic:
module.Class: 'scanning_optimize_logic.ScanningOptimizeLogic'
connect:
scan_logic: scanning_probe_logic
options:
optimizer_sequence_dimensions: [2, 1] # Optional

poi_manager_logic:
module.Class: 'poi_manager_logic.PoiManagerLogic'
Expand Down
24 changes: 3 additions & 21 deletions src/qudi/gui/scanning/scannergui.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class ScannerGui(GuiBase):
options:
image_axes_padding: 0.02
default_position_unit_prefix: null # optional, use unit prefix characters, e.g. 'u' or 'n'
optimizer_plot_dimensions: [2, 1] # optimization sequence dim. order, here for 2D, 1D, e.g. XY, Z
min_crosshair_size_fraction: 0.02 # minimum crosshair size as fraction of the displayed scan range
connect:
scanning_logic: scanning_probe_logic
Expand All @@ -119,12 +118,6 @@ class ScannerGui(GuiBase):

# config options for gui
_default_position_unit_prefix = ConfigOption(name='default_position_unit_prefix', default=None)
# for all optimizer sub widgets, (2= xy, 1=z)
_optimizer_plot_dims: List[int] = ConfigOption(
name='optimizer_plot_dimensions',
default=[2, 1],
checker=lambda x: set(x) == {1, 2}, # only 1D and 2D optimizations are supported
)
# minimum crosshair size as fraction of the displayed scan range
_min_crosshair_size_fraction = ConfigOption(name='min_crosshair_size_fraction', default=1/50, missing='nothing')

Expand Down Expand Up @@ -340,21 +333,10 @@ def _init_optimizer_settings(self):
""" Configuration and initialisation of the optimizer settings dialog.
"""
scan_logic: ScanningProbeLogic = self._scanning_logic()
axes_obj = tuple(scan_logic.scanner_axes.values())
axes_names = [ax.name for ax in axes_obj]

# figure out sensible optimization sequences for user selection
possible_optimizations_per_plot = [itertools.combinations(axes_names, n) for n in self._optimizer_plot_dims]
optimization_sequences = list(itertools.product(*possible_optimizations_per_plot))
sequences_no_axis_twice = []
for sequence in optimization_sequences:
occurring_axes = [axis for step in sequence for axis in step]
if len(occurring_axes) <= len(set(occurring_axes)):
sequences_no_axis_twice.append(sequence)

optimize_logic : ScanningOptimizeLogic = self._optimize_logic()
self._osd = OptimizerSettingsDialog(scan_logic.scanner_axes.values(),
scan_logic.scanner_channels.values(),
sequences_no_axis_twice,
optimize_logic.allowed_scan_sequences,
scan_logic.scanner_constraints.back_scan_capability)

# Connect MainWindow actions
Expand Down Expand Up @@ -421,7 +403,7 @@ def _init_static_dockwidgets(self):
)

self.optimizer_dockwidget = OptimizerDockWidget(axes=self._scanning_logic().scanner_axes,
plot_dims=self._optimizer_plot_dims,
plot_dims=self._optimize_logic().optimizer_sequence_dimensions,
sequence=self._optimize_logic().scan_sequence)
self.optimizer_dockwidget.setAllowedAreas(QtCore.Qt.TopDockWidgetArea)
self._mw.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.optimizer_dockwidget)
Expand Down
68 changes: 58 additions & 10 deletions src/qudi/logic/scanning_optimize_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
from qudi.core.connector import Connector
from qudi.core.statusvariable import StatusVar
from qudi.util.fit_models.gaussian import Gaussian2D, Gaussian
from qudi.core.configoption import ConfigOption
import itertools




class ScanningOptimizeLogic(LogicBase):
Expand All @@ -46,12 +50,22 @@ class ScanningOptimizeLogic(LogicBase):
module.Class: 'scanning_optimize_logic.ScanningOptimizeLogic'
connect:
scan_logic: scanning_probe_logic
options:
optimizer_sequence_dimensions: [2, 1] # optimization sequence dim. order,
# here for first 2D optimization and then 1D optimization, e.g. XY, Z

"""

# declare connectors
_scan_logic = Connector(name='scan_logic', interface='ScanningProbeLogic')

# declare ConfigOptions
# for all optimizer sub widgets, (2= xy, 1=z)
_optimizer_sequence_dimensions: List[int] = ConfigOption(
name='optimizer_sequence_dimensions',
default=[2, 1],
)

# status variables
# not configuring the back scan parameters is represented by empty dictionaries
_scan_sequence: List[Tuple[str, ...]] = StatusVar(name='scan_sequence', default=None)
Expand All @@ -65,6 +79,7 @@ class ScanningOptimizeLogic(LogicBase):
# signals
sigOptimizeStateChanged = QtCore.Signal(bool, dict, object)
sigOptimizeSettingsChanged = QtCore.Signal(dict)
sigOptimizeSequenceDimensionsChanged = QtCore.Signal()

_sigNextSequenceStep = QtCore.Signal()

Expand Down Expand Up @@ -96,16 +111,8 @@ def on_activate(self):
self._set_default_scan_settings()

self._avail_axes = tuple(axes.values())
if self._scan_sequence is None:
if len(self._avail_axes) >= 3:
self._scan_sequence = [(self._avail_axes[0].name, self._avail_axes[1].name),
(self._avail_axes[2].name,)]
elif len(self._avail_axes) == 2:
self._scan_sequence = [(self._avail_axes[0].name, self._avail_axes[1].name)]
elif len(self._avail_axes) == 1:
self._scan_sequence = [(self._avail_axes[0].name,)]
else:
self._scan_sequence = list()
self._set_scan_sequence()

if self._data_channel is None:
self._data_channel = tuple(channels.values())[0].name

Expand All @@ -118,6 +125,7 @@ def on_activate(self):
self._scan_logic().sigScanStateChanged.connect(
self._scan_state_changed, QtCore.Qt.QueuedConnection
)
self.sigOptimizeSequenceDimensionsChanged.connect(self._set_scan_sequence, QtCore.Qt.QueuedConnection)

def on_deactivate(self):
""" Reverse steps of activation
Expand Down Expand Up @@ -171,6 +179,33 @@ def scan_sequence(self, sequence: List[Tuple[str, ...]]):
else:
self._scan_sequence = sequence

@property
def allowed_scan_sequences(self) -> list:
axes_names = [ax.name for ax in self._avail_axes]

# figure out sensible optimization sequences for user selection
possible_optimizations_per_plot = [itertools.combinations(axes_names, n) for n in self._optimizer_sequence_dimensions]
optimization_sequences = list(itertools.product(*possible_optimizations_per_plot))
sequences_no_axis_twice = []
if sum(self._optimizer_sequence_dimensions) > len(axes_names):
raise ValueError(f"Requested optimization sequence ({sum(self._optimizer_sequence_dimensions)}) is greater than available scanner axes ({len(axes_names)}). This is currently not supported. Decrease optimizer_sequence_dimensions.")

for sequence in optimization_sequences:
occurring_axes = [axis for step in sequence for axis in step]
if len(occurring_axes) <= len(set(occurring_axes)):
sequences_no_axis_twice.append(sequence)

return sequences_no_axis_twice

@property
def optimizer_sequence_dimensions(self) -> list:
return self._optimizer_sequence_dimensions

@optimizer_sequence_dimensions.setter
def optimizer_sequence_dimensions(self, dimensions: list) -> None:
self._optimizer_sequence_dimensions = sequence_dimension_constructor(dimensions)
self.sigOptimizeSequenceDimensionsChanged.emit()

@property
def optimizer_running(self):
return self.module_state() != 'idle'
Expand Down Expand Up @@ -389,3 +424,16 @@ def _set_default_scan_settings(self):
self._scan_frequency = {ax.name: max(ax.frequency.minimum, ax.frequency.maximum / 100) for ax in axes.values()}
self._back_scan_resolution = {}
self._back_scan_frequency = {}

def _set_scan_sequence(self):
timoML marked this conversation as resolved.
Show resolved Hide resolved
possible_scan_sequences = self.allowed_scan_sequences
if self._scan_sequence is None or self._scan_sequence not in possible_scan_sequences:
self.log.info(f"No valid scan sequence existing, setting scan sequence to {possible_scan_sequences[0]}.")
self._scan_sequence = possible_scan_sequences[0]

@_optimizer_sequence_dimensions.constructor
def sequence_dimension_constructor(self, dimensions: list) -> list:
if set(dimensions) <= {1, 2}:
return dimensions
raise ValueError(f"Dimensions must be in {set([1,2])}, received {dimensions=}.")