From 0f15081846c96428218df540c755fedda94a94b5 Mon Sep 17 00:00:00 2001 From: utkarshp1161 Date: Sun, 3 May 2026 13:25:14 -0700 Subject: [PATCH] fix: place_beam call in a for loop from client side fails - added - place_beam_list() --- asyncroscopy/Microscope.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/asyncroscopy/Microscope.py b/asyncroscopy/Microscope.py index 8690a0b..4d6a194 100644 --- a/asyncroscopy/Microscope.py +++ b/asyncroscopy/Microscope.py @@ -371,6 +371,23 @@ def place_beam(self, position) -> None: """ self._place_beam(position) + @command(dtype_in=DevVarFloatArray, dtype_out=None) + def place_beam_list(self, positions) -> None: + """ + Place beam at multiple positions sequentially. + Extension of place_beam command + Why not call place_beam in loop of client side -> It fails + """ + if len(positions) % 2 != 0: + raise ValueError("Input must contain pairs of (x, y) values.") + + for i in range(0, len(positions), 2): + x = float(positions[i]) + y = float(positions[i + 1]) + + self._place_beam([x, y]) + + @command() def blank_beam(self) -> None: """blank beam"""