From 60a1aad6ff51f816db2a7fb4cb869d33e699f28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Fri, 9 Jan 2026 15:28:57 +0100 Subject: [PATCH 1/2] allow sls::Pattern in python d.pattern --- python/slsdet/detector.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 59787b703..eac79c87e 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: LGPL-3.0-or-other # Copyright (C) 2021 Contributors to the SLS Detector Package +import pathlib from ._slsdet import CppDetectorApi from ._slsdet import slsDetectorDefs from ._slsdet import IpAddr, MacAddr @@ -3766,9 +3767,13 @@ class Detector(CppDetectorApi): raise NotImplementedError("Pattern is set only") @pattern.setter - def pattern(self, fname): - fname = ut.make_string_path(fname) - ut.set_using_dict(self.setPattern, fname) + def pattern(self, name_or_pattern): + # If passed a file path, convert to string representation + # with the path expanded. Otherwise it's probably a sls::Pattern + # and we can pass it directly. + if isinstance(name_or_pattern, (pathlib.Path, str)): + name_or_pattern = ut.make_string_path(name_or_pattern) + ut.set_using_dict(self.setPattern, name_or_pattern) @property def patfname(self): From 06cd6c9eb703094b11891bfdb498516a74443a16 Mon Sep 17 00:00:00 2001 From: froejdh_e Date: Wed, 21 Jan 2026 16:52:12 +0100 Subject: [PATCH 2/2] docstring and release --- RELEASE.txt | 2 ++ python/slsdet/detector.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RELEASE.txt b/RELEASE.txt index dd2dbabec..b88501983 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -37,6 +37,8 @@ Experimental support for building the detector client (including python bindings ``rx_dbitlist`` keeps the order of the passed bit list +Detector.pattern (python) accepts also a pattern object, not only a pattern file + 2 On-board Detector Server Compatibility ========================================== diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 6281a7457..930271cb7 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -3758,7 +3758,7 @@ class Detector(CppDetectorApi): @property def pattern(self): - """[Mythen3][Ctb][Xilinx Ctb] Loads ASCII pattern file directly to server (instead of executing line by line). + """[Mythen3][Ctb][Xilinx Ctb] Load a pattern (from file or memory) to the server (instead of executing line by line). :getter: Not Implemented