From 4490a0f83af7224333f4fefcaf0cff10727bf757 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 | 5 +++++ python/slsdet/detector.py | 4 ++++ python/tests/test_det_api.py | 25 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/RELEASE.txt b/RELEASE.txt index 9fac762e9..ebc297053 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -271,7 +271,12 @@ Experimental support for building the detector client (including python bindings Detector.pattern (python) accepts also a pattern object, not only a pattern file +<<<<<<< HEAD >>>>>>> 06cd6c9eb (docstring and release) +======= +added patternstart to python (ctb, xilinx_ctb , mythen3), only the detector class api was exposed (startPattern()) + +>>>>>>> e519633e1 (added patternstart to python (#1368)) 2 On-board Detector Server Compatibility ========================================== diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 61f36a92c..98fcfbbac 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -3601,6 +3601,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_det_api.py b/python/tests/test_det_api.py index 6db456a34..99d282d22 100644 --- a/python/tests/test_det_api.py +++ b/python/tests/test_det_api.py @@ -13,6 +13,15 @@ from utils_for_test import ( from slsdet import Detector +@pytest.fixture( + scope="session", + params=['ctb', 'xilinx_ctb', 'mythen3', 'jungfrau'] +) +def simulator(request): + """Fixture to start the detector server once and clean up at the end.""" + det_name = request.param + num_mods = 1 + fp = sys.stdout @pytest.mark.detectorintegration def test_define_reg(session_simulator, request): @@ -342,6 +351,7 @@ def test_definelist_bit(session_simulator, request): Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed") +<<<<<<< HEAD:python/tests/test_det_api.py @pytest.mark.detectorintegration def test_parameters_file(session_simulator, request): """ Test using test_parameters_file.""" @@ -387,10 +397,25 @@ def test_patternstart(session_simulator, request): assert d is not None if det_type in ['ctb', 'xilinx_ctb', 'mythen3']: +======= +@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']: +>>>>>>> e519633e1 (added patternstart to python (#1368)):python/tests/test_CtbAPI.py d.patternstart() else: with pytest.raises(Exception) as exc_info: d.patternstart() assert "not implemented" in str(exc_info.value) +<<<<<<< HEAD:python/tests/test_det_api.py Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed") +======= + Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed") +>>>>>>> e519633e1 (added patternstart to python (#1368)):python/tests/test_CtbAPI.py