From e519633e163fdf1b5b3f4f14b2adf01c76344b75 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 22 Jan 2026 14:55:03 +0100 Subject: [PATCH] added patternstart to python (#1368) * added patternstart to python * release notesg --- RELEASE.txt | 2 ++ python/slsdet/detector.py | 4 ++++ python/tests/test_CtbAPI.py | 20 +++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/RELEASE.txt b/RELEASE.txt index b88501983..6444ad4ac 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -39,6 +39,8 @@ Experimental support for building the detector client (including python bindings Detector.pattern (python) accepts also a pattern object, not only a pattern file +added patternstart to python (ctb, xilinx_ctb , mythen3), only the detector class api was exposed (startPattern()) + 2 On-board Detector Server Compatibility ========================================== diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 930271cb7..ad6e23a3b 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -3785,6 +3785,10 @@ class Detector(CppDetectorApi): """ return self.getPatterFileName() + def patternstart(self): + """[Ctb][Mythen3][Xilinx Ctb] Starts pattern. """ + self.startPattern() + @property @element def patioctrl(self): diff --git a/python/tests/test_CtbAPI.py b/python/tests/test_CtbAPI.py index b82c5a4c7..13730f345 100644 --- a/python/tests/test_CtbAPI.py +++ b/python/tests/test_CtbAPI.py @@ -27,7 +27,7 @@ from slsdet import Detector, detectorType @pytest.fixture( scope="session", - params=['ctb', 'xilinx_ctb', 'mythen3'] + params=['ctb', 'xilinx_ctb', 'mythen3', 'jungfrau'] ) def simulator(request): """Fixture to start the detector server once and clean up at the end.""" @@ -382,4 +382,22 @@ def test_definelist_bit(simulator, request): d.define_bit(name="test_bit", addr=0x300, bit_position=1) assert "Bit Definitions only for CTB" in str(exc_info.value) + Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed") + + +@pytest.mark.withdetectorsimulators +def test_patternstart(simulator, request): + """ Test using patternstart for ctb, xilinx_ctb and mythen3.""" + det_name = simulator + # setup + d = Detector() + d.hostname = f"localhost:{SERVER_START_PORTNO}" + + if det_name in ['ctb', 'xilinx_ctb', 'mythen3']: + d.patternstart() + else: + with pytest.raises(Exception) as exc_info: + d.patternstart() + assert "not implemented" in str(exc_info.value) + Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed") \ No newline at end of file