From 225f59bdfb70e3dee5acb0169aea3a61c77056f7 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Mon, 11 May 2026 16:38:21 +0200 Subject: [PATCH 01/10] removed the unzooming at the start of every acquisition so that right click zoom should stay (#1451) --- slsDetectorGui/src/qDrawPlot.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index e967862a3..86d43dc66 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -620,11 +620,6 @@ void qDrawPlot::StartAcquisition() { "qDrawPlot::StartAcquisition"); } - // refixing all the zooming - { - std::lock_guard lock(mPlots); - xyRangeChanged = true; - } QtConcurrent::run(this, &qDrawPlot::AcquireThread); From bc864496528ad8d63e80fb4ce7bcf36b7c75125f Mon Sep 17 00:00:00 2001 From: AliceMazzoleni99 Date: Tue, 12 May 2026 09:25:35 +0200 Subject: [PATCH 02/10] Dev/doc/add ctb to doc (#1455) * added numpy for patterngenerator * treat warnings as errors * fix warnings during docu build * added power and ctb to documentation --- .github/workflows/build_documentation.yml | 2 +- docs/CMakeLists.txt | 7 +++++-- docs/conf.py.in | 2 ++ docs/src/Testing.rst | 3 +++ docs/src/dependencies.rst | 6 +++--- docs/src/gendoc.cpp | 5 ++++- docs/src/index.rst | 2 ++ docs/src/pyctb.rst | 15 ++++++++++++++ docs/src/pypower.rst | 12 ++++++++++++ python/slsdet/ctb.py | 24 +++++++++++++++++++++++ python/slsdet/detector.py | 23 ++++++++++++---------- slsDetectorSoftware/src/CallerSpecial.cpp | 5 +++-- 12 files changed, 87 insertions(+), 19 deletions(-) create mode 100644 docs/src/pyctb.rst create mode 100644 docs/src/pypower.rst diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index a7fd764c4..be3dc4a62 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -64,7 +64,7 @@ jobs: cache: 'pip' - name: Install Python Packages - run: pip install sphinx sphinx_rtd_theme breathe pyyaml jinja2 + run: pip install sphinx sphinx_rtd_theme breathe pyyaml jinja2 numpy - name: Build Documentation diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 129ed8e69..25e313d7c 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -36,6 +36,7 @@ set(SPHINX_SOURCE_FILES src/consuming.rst src/dependencies.rst src/detector.rst + src/pyctb.rst src/index.rst src/installation.rst src/pydetector.rst @@ -72,6 +73,8 @@ set(SPHINX_SOURCE_FILES src/softwarearchitecture.rst src/configcommands.rst src/Versioning.rst + src/Testing.rst + src/pypower.rst ) foreach(filename ${SPHINX_SOURCE_FILES}) @@ -105,7 +108,7 @@ add_custom_target(docs gendoc COMMAND python gen_server_doc.py COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - COMMAND ${SPHINX_EXECUTABLE} -a -b html + COMMAND ${SPHINX_EXECUTABLE} -W -a -b html -Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml -c "${SPHINX_BUILD}" ${SPHINX_BUILD}/src @@ -113,7 +116,7 @@ add_custom_target(docs COMMENT "Generating documentation with Sphinx") add_custom_target(rst - COMMAND ${SPHINX_EXECUTABLE} -a -b html + COMMAND ${SPHINX_EXECUTABLE} -W -a -b html -Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml -c "${SPHINX_BUILD}" ${SPHINX_BUILD}/src diff --git a/docs/conf.py.in b/docs/conf.py.in index 374fc84e0..827d2528c 100644 --- a/docs/conf.py.in +++ b/docs/conf.py.in @@ -48,6 +48,8 @@ templates_path = ['_templates'] # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +suppress_warnings = ["duplicate_declaration.cpp",] + # -- Options for HTML output ------------------------------------------------- diff --git a/docs/src/Testing.rst b/docs/src/Testing.rst index ad67326d8..99dd202da 100644 --- a/docs/src/Testing.rst +++ b/docs/src/Testing.rst @@ -67,12 +67,14 @@ This runs all tests marked with the tag ``[.detectorintegration]`` for all detec If you want to run them for a specific virtual detector or a specific test use the following command: .. code-block:: console + cd build python bin/test_simulators.py --servers jungfrau --test "[dacs]" You can exclude specific tests by adding the option ``~[]``. Again, we assume that this marker is added to the tests that you want to exclude. .. code-block:: console + cd build python bin/test_simulators.py --servers eiger jungfrau moench --test "[detectorintegration]~[disable_check_data_file]" @@ -98,6 +100,7 @@ If a test requires a detector mark them with the pytest marker ``@pytest.mark.de To run only tests requiring virtual detectors use the following command: .. code-block:: console + #in build python -m pytest -m detectorintegration ../python/tests/ diff --git a/docs/src/dependencies.rst b/docs/src/dependencies.rst index a64d7a219..3e0e7b364 100644 --- a/docs/src/dependencies.rst +++ b/docs/src/dependencies.rst @@ -53,9 +53,9 @@ To build the python module the following dependencies are needed: Refer :ref:`pybind11 notes. ` -------------------------------- +------------------------------------ Dependencies to build documentation -------------------------------- +------------------------------------ To build this documentation that you are reading now the following dependencies are needed: @@ -76,7 +76,7 @@ To build the GUI the following dependencies are needed: Qwt is bundled in libs. One does not need to pre-install it on the system. ------------------------------------------------------- +----------------------------------------------------- Dependencies to build Moench and Jungfrau executables ----------------------------------------------------- diff --git a/docs/src/gendoc.cpp b/docs/src/gendoc.cpp index 2854f6d22..156d04c9b 100644 --- a/docs/src/gendoc.cpp +++ b/docs/src/gendoc.cpp @@ -45,13 +45,16 @@ int main() { for (const auto &cmd : commands) { std::ostringstream os; - std::cout << cmd << '\n'; caller.call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os); auto tmp = os.str().erase(0, cmd.size()); auto usage = tmp.substr(0, tmp.find_first_of('\n')); tmp.erase(0, usage.size()); auto help = replace_all(tmp, "\n\t", "\n\t\t| "); + + if (help.back() != '\n') { + help.push_back('\n'); + } fs << '\t' << cmd << usage << help << "\n"; } diff --git a/docs/src/index.rst b/docs/src/index.rst index 035167215..498543384 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -48,7 +48,9 @@ slsDetectorPackage pygettingstarted pydetector + pyctb pyenums + pypower pyexamples pyPatternGenerator pattern diff --git a/docs/src/pyctb.rst b/docs/src/pyctb.rst new file mode 100644 index 000000000..a942d253f --- /dev/null +++ b/docs/src/pyctb.rst @@ -0,0 +1,15 @@ +Ctb +===================================================== + +.. py:currentmodule:: slsdet + +.. autoclass:: Ctb + :members: + :undoc-members: + :show-inheritance: + :inherited-members: + + + + + diff --git a/docs/src/pypower.rst b/docs/src/pypower.rst new file mode 100644 index 000000000..095edf637 --- /dev/null +++ b/docs/src/pypower.rst @@ -0,0 +1,12 @@ +Power Supply +=============== + +Helper class to control power supplies on the Chip Test Board (CTB, Xilinx CTB). + +.. py:currentmodule:: slsdet + +.. autoclass:: Power + :members: + :undoc-members: + :show-inheritance: + :inherited-members: \ No newline at end of file diff --git a/python/slsdet/ctb.py b/python/slsdet/ctb.py index eff315da3..1b601356c 100644 --- a/python/slsdet/ctb.py +++ b/python/slsdet/ctb.py @@ -27,10 +27,34 @@ class Ctb(Detector): @property def powers(self): + """ + [Chiptestboard][Xilinx CTB] Power names and values of all power supplies. + + Example + ----------- + >>> # print all powers with DAC and info if enabled + >>> d.powers + >>> # set DAC or enables for power supply VA + >>> d.powers.VA = 1200 + >>> # enable or disable power subbly VA + >>> d.powers.VA.enable() + >>> d.powers.VA.disable() + >>> # get dac value of power supply VA + >>> d.powers.VA.dac + >>> # check if power supply VA is enabled + >>> d.powers.VA.enabled + >>> # print both enabled and dac value of power supply VA + >>> d.powers.VA + """ return self._powers @property def powerlist(self): + """ + List of power supply names on the Chip Test Board. + + :setter: List of custom power supply names to set. + """ return self.getPowerNames() @powerlist.setter diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 56e29800f..47ad9220d 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -833,10 +833,10 @@ class Detector(CppDetectorApi): Note ---- Sets up the following for every module:\n - \t\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n - \t\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n - \t\t[Eiger] txdelay_frame to (2 *num_modules * n_delay) \n - \t\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay)\n\n + \t\t[Eiger] txdelay_left to (2 \* mod_index \* n_delay), \n + \t\t[Eiger] txdelay_right to ((2 \* mod_index + 1) \* n_delay) and \n + \t\t[Eiger] txdelay_frame to (2 \* num_modules \* n_delay) \n + \t\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules \* n_delay)\n\n Please refer txdelay_left, txdelay_right and txdelay_frame for details. """ return self.getTransmissionDelay() @@ -1313,10 +1313,10 @@ class Detector(CppDetectorApi): @property def zmqhwm(self): """ - Client's zmq receive high water mark. Default is the zmq library's default (1000), can also be set here using -1. - This is a high number and can be set to 2 for gui purposes. + Client's zmq receive high water mark. Default is the zmq library's default (1000), can also be set here using -1. + This is a high number and can be set to 2 for gui purposes. One must also set the receiver's send high water mark to similar value. Final effect is sum of them. - Setting it via command line is useful only before zmq enabled (before opening gui). + Setting it via command line is useful only before zmq enabled (before opening gui). """ return self.getClientZmqHwm() @@ -2312,13 +2312,16 @@ class Detector(CppDetectorApi): @property @element def threshold(self): - """[Eiger][Mythen3] Threshold in eV + """ + [Eiger][Mythen3] Threshold in eV Note ---- - To change settings as well or set threshold without trimbits, use setThresholdEnergy. + To change settings as well or set threshold without trimbits, + use setThresholdEnergy. - :setter: It loads trim files from settingspath.\n [Mythen3] An energy of -1 will pick up values from detector. + :setter: It loads trim files from settingspath.\n + [Mythen3] An energy of -1 will pick up values from detector. """ if self.type == detectorType.MYTHEN3: diff --git a/slsDetectorSoftware/src/CallerSpecial.cpp b/slsDetectorSoftware/src/CallerSpecial.cpp index 50cd1e72d..dc2ae8c6c 100644 --- a/slsDetectorSoftware/src/CallerSpecial.cpp +++ b/slsDetectorSoftware/src/CallerSpecial.cpp @@ -1586,7 +1586,7 @@ std::string Caller::define_bit(int action) { std::string Caller::definelist_reg(int action) { std::ostringstream os; if (action == defs::HELP_ACTION) { - os << "List of user-defined register definitions in shared memory." + os << "\n\t List of user-defined register definitions in shared memory." << '\n'; } else if (action == defs::PUT_ACTION) { throw RuntimeError("cannot put"); @@ -1605,7 +1605,8 @@ std::string Caller::definelist_reg(int action) { std::string Caller::definelist_bit(int action) { std::ostringstream os; if (action == defs::HELP_ACTION) { - os << "List of user-defined bit definitions in shared memory." << '\n'; + os << "\n\t List of user-defined bit definitions in shared memory." + << '\n'; } else if (action == defs::PUT_ACTION) { throw RuntimeError("cannot put"); } else if (action == defs::GET_ACTION) { From 60442983746509d1ffa26db5e18074e57e92523f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 12 May 2026 11:23:20 +0200 Subject: [PATCH 03/10] Build virtual servers on macOS (#1450) * macOS import guards to have servers compile * SPI mock since we don't do any actual transfer using the virtual server * /proc/self/exe alternative for macOS --- .../matterhornServer/src/MatterhornApp.cpp | 10 ++++++- .../slsDetectorServer/src/ASIC_Driver.c | 2 ++ .../slsDetectorServer/src/common.c | 27 +++++++++++++++++++ .../src/programViaBlackfin.c | 4 +++ .../src/slsDetectorServer_funcs.c | 24 +++++++++++++++++ 5 files changed, 66 insertions(+), 1 deletion(-) diff --git a/slsDetectorServers/matterhornServer/src/MatterhornApp.cpp b/slsDetectorServers/matterhornServer/src/MatterhornApp.cpp index a60b328a7..8c37df196 100644 --- a/slsDetectorServers/matterhornServer/src/MatterhornApp.cpp +++ b/slsDetectorServers/matterhornServer/src/MatterhornApp.cpp @@ -11,7 +11,15 @@ #include // gettid added in glibc 2.30 -#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 30 +#if defined(__APPLE__) +#include +#include +static inline uint64_t gettid() { + uint64_t tid = 0; + pthread_threadid_np(nullptr, &tid); + return tid; +} +#elif __GLIBC__ == 2 && __GLIBC_MINOR__ < 30 #include #define gettid() syscall(SYS_gettid) #endif diff --git a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c index 562396b16..adc01112d 100644 --- a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c +++ b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c @@ -11,8 +11,10 @@ #include #include +#ifndef __APPLE__ #include #include +#endif #include #include #include diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index 2bfc79bb7..cd7adab63 100644 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -11,6 +11,12 @@ #include // stat #include // uname #include // readlink +#ifdef __APPLE__ +#include // PATH_MAX +#include // _NSGetExecutablePath +#include // uint32_t +#include // realpath +#endif extern int executeCommand(char *command, char *result, enum TLogLevel level); @@ -58,12 +64,33 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) { // get path of current binary char path[bufSize]; memset(path, 0, bufSize); +#ifdef __APPLE__ + // macOS has no /proc; use _NSGetExecutablePath and canonicalize with + // realpath (the path returned may contain ".." or symlinks). + char raw[PATH_MAX]; + uint32_t rawSize = sizeof(raw); + if (_NSGetExecutablePath(raw, &rawSize) != 0) { + LOG(logWARNING, + ("Could not get current binary path for %s (buffer too small)\n", + fname)); + return FAIL; + } + char resolved[PATH_MAX]; + const char *src = realpath(raw, resolved) != NULL ? resolved : raw; + if (strlen(src) >= bufSize) { + LOG(logWARNING, + ("Current binary path too long for buffer (%s)\n", fname)); + return FAIL; + } + strcpy(path, src); +#else ssize_t len = readlink("/proc/self/exe", path, bufSize - 1); if (len < 0) { LOG(logWARNING, ("Could not readlink current binary for %s\n", fname)); return FAIL; } path[len] = '\0'; +#endif // get dir path and attach file name char *dir = dirname(path); diff --git a/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c b/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c index e5a281875..0f1c12d95 100644 --- a/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c @@ -8,7 +8,9 @@ #include #include +#ifndef __APPLE__ #include +#endif #include // usleep /* global variables */ @@ -309,6 +311,7 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd, } // check available memory to copy program +#ifndef __APPLE__ { struct sysinfo info; sysinfo(&info); @@ -322,6 +325,7 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd, return FAIL; } } +#endif // open file to copy program *fd = fopen(TEMP_PROG_FILE_NAME, "w"); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index f4d9d930f..0359bb467 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -20,10 +20,24 @@ #include #include #include +#ifndef __APPLE__ #include +#endif #include +#ifdef __APPLE__ +// spidev is Linux-only; provide a minimal stub so virtual builds compile. +// The real ioctl(SPI_IOC_MESSAGE(...)) calls are guarded by detector +// macros (XILINX_CHIPTESTBOARDD) that are never set on macOS. +struct spi_ioc_transfer { + unsigned long tx_buf; + unsigned long rx_buf; + unsigned int len; + unsigned char cs_change; +}; +#else #include +#endif // defined in the detector specific Makefile #ifdef EIGERD @@ -127,6 +141,10 @@ int sendError(int file_des) { } void setMemoryAllocationErrorMessage() { +#ifdef __APPLE__ + sprintf(mess, "Memory allocation error (%s). Please reboot", + getFunctionNameFromEnum((enum detFuncs)fnum)); +#else struct sysinfo info; sysinfo(&info); sprintf( @@ -134,6 +152,7 @@ void setMemoryAllocationErrorMessage() { "Memory allocation error (%s). Available space: %d MB. Please reboot", getFunctionNameFromEnum((enum detFuncs)fnum), (int)(info.freeram / (1024 * 1024))); +#endif #ifdef EIGERD strcat(mess, ".\n"); #else @@ -9784,12 +9803,17 @@ void receive_program_default(int file_des, enum PROGRAM_INDEX index, if (ret == OK) { src = malloc(filesize); if (src == NULL) { +#ifdef __APPLE__ + sprintf(mess, "Could not %s. Memory allocation failure.\n", + functionType); +#else struct sysinfo info; sysinfo(&info); sprintf(mess, "Could not %s. Memory allocation failure. Free " "space: %d MB\n", functionType, (int)(info.freeram / (1024 * 1024))); +#endif LOG(logERROR, (mess)); ret = FAIL; } From d94c0d0e72606e3ea4ebf91eb41720b41b3be607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 12 May 2026 12:01:09 +0200 Subject: [PATCH 04/10] removed unused function readDataFile/writeDataFile (#1456) * removed unused function readDataFile/writeDataFile * release notes --- RELEASE.md | 2 + slsSupportLib/include/sls/file_utils.h | 27 ----------- slsSupportLib/src/file_utils.cpp | 66 -------------------------- 3 files changed, 2 insertions(+), 93 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 927793b37..0f1ad4af4 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -41,6 +41,8 @@ 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()) +removed unused function readDataFile/writeDataFile from file_utils.h + 2 On-board Detector Server Compatibility ========================================== diff --git a/slsSupportLib/include/sls/file_utils.h b/slsSupportLib/include/sls/file_utils.h index 010fc640c..81aa3d19b 100644 --- a/slsSupportLib/include/sls/file_utils.h +++ b/slsSupportLib/include/sls/file_utils.h @@ -11,37 +11,10 @@ namespace sls { -/** - * @param data array of data values - * @param nch number of channels - * @param offset start channel value - */ -int readDataFile(std::ifstream &infile, short int *data, int nch, - int offset = 0); - -/** - * @param data array of data value - * @param nch number of channels - */ -int readDataFile(std::string fname, short int *data, int nch); std::vector readBinaryFile(const std::string &fname, const std::string &errorPrefix); -/** - * @param nch number of channels - * @param data array of data values - * @param offset start channel number - */ -int writeDataFile(std::ofstream &outfile, int nch, short int *data, - int offset = 0); - -/** - * @param nch number of channels - * @param data array of data values - */ -int writeDataFile(std::string fname, int nch, short int *data); - // mkdir -p path implemented by recursive calls void mkdir_p(const std::string &path, std::string dir = ""); diff --git a/slsSupportLib/src/file_utils.cpp b/slsSupportLib/src/file_utils.cpp index 6751d489d..bc375ba9d 100644 --- a/slsSupportLib/src/file_utils.cpp +++ b/slsSupportLib/src/file_utils.cpp @@ -22,48 +22,6 @@ namespace sls { -int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) { - int ichan, iline = 0; - short int idata; - int interrupt = 0; - std::string str; - while (infile.good() and interrupt == 0) { - getline(infile, str); - std::istringstream ssstr(str); - ssstr >> ichan >> idata; - if (ssstr.fail() || ssstr.bad()) { - interrupt = 1; - break; - } - if (iline < nch) { - if (ichan >= offset) { - data[iline] = idata; - iline++; - } - } else { - interrupt = 1; - break; - } - return iline; - }; - return iline; -} - -int readDataFile(std::string fname, short int *data, int nch) { - std::ifstream infile; - int iline = 0; - std::string str; - infile.open(fname.c_str(), std::ios_base::in); - if (infile.is_open()) { - iline = readDataFile(infile, data, nch, 0); - infile.close(); - } else { - LOG(logERROR) << "Could not read file " << fname; - return -1; - } - return iline; -} - std::vector readBinaryFile(const std::string &fname, const std::string &errorPrefix) { // check if it exists @@ -96,30 +54,6 @@ std::vector readBinaryFile(const std::string &fname, return buffer; } -int writeDataFile(std::ofstream &outfile, int nch, short int *data, - int offset) { - if (data == nullptr) - return slsDetectorDefs::FAIL; - for (int ichan = 0; ichan < nch; ichan++) - outfile << ichan + offset << " " << *(data + ichan) << std::endl; - return slsDetectorDefs::OK; -} - -int writeDataFile(std::string fname, int nch, short int *data) { - std::ofstream outfile; - if (data == nullptr) - return slsDetectorDefs::FAIL; - outfile.open(fname.c_str(), std::ios_base::out); - if (outfile.is_open()) { - writeDataFile(outfile, nch, data, 0); - outfile.close(); - return slsDetectorDefs::OK; - } else { - LOG(logERROR) << "Could not open file " << fname << "for writing"; - return slsDetectorDefs::FAIL; - } -} - void mkdir_p(const std::string &path, std::string dir) { if (path.length() == 0) return; From 83cd91b93c98604480eae88d3a08e82a8f3a804c Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 12 May 2026 18:08:52 +0200 Subject: [PATCH 05/10] updated release notes for past PRs to dev (v11.0.0.rc) (#1457) --- RELEASE.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/RELEASE.md b/RELEASE.md index 0f1ad4af4..7213b631d 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -41,6 +41,25 @@ 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()) + +can build virtual servers on mac OS + +documentation for all branches and developer now online and build and pushed automatically + +gui: mouse zooms not reset at start of acquisition + +m3: fixed patwaittime in intervals, which is hardly used. patwaittime in clocks stays the same and working. + +m3: getPatternFileName typo fixed + +libfmt added to dependency + +python dacs=> using deprecated np.int. dacs return float (default dtype of numpy) +=> changed to np.int32 (meant for v10.0.1) + +support for building rpms + + removed unused function readDataFile/writeDataFile from file_utils.h 2 On-board Detector Server Compatibility From f09dfde157786bfeff4b16387f31024f5522aed1 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 21 May 2026 10:21:24 +0200 Subject: [PATCH 06/10] docstring --- slsDetectorSoftware/src/CallerSpecial.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/slsDetectorSoftware/src/CallerSpecial.cpp b/slsDetectorSoftware/src/CallerSpecial.cpp index dc2ae8c6c..ac75fab4c 100644 --- a/slsDetectorSoftware/src/CallerSpecial.cpp +++ b/slsDetectorSoftware/src/CallerSpecial.cpp @@ -1000,7 +1000,8 @@ std::string Caller::counters(int action) { std::ostringstream os; if (action == defs::HELP_ACTION) { os << "[i0] [i1] [i2]... \n\t[Mythen3] List of counters indices " - "enabled. Each element in list can be 0 - 2 and must be non " + "enabled, support both comma and/or space separation. Each " + "element in list can be 0 - 2 and must be non " "repetitive. Enabling counters sets vth dacs to remembered " "values and disabling sets them to disabled values." << '\n'; @@ -1198,7 +1199,8 @@ std::string Caller::rx_dbitlist(int action) { if (action == defs::HELP_ACTION) { os << "[all] or [none] or [i0] [i1] [i2]... \n\t[Ctb] List of digital " "signal bits enabled and rearranged according to the signals " - "(all samples of each signal is put together). If 'all' is used " + "(all samples of each signal is put together). Support both " + "comma and/or space separation. If 'all' is used " "instead of a list, all digital bits (64) enabled. Each element " "in list can be 0 - 63 and must be non repetitive. The option " "'none' will still spit out all data as is from the detector, " From 1e725bac992c004d5b602d21b0735ada87186650 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 21 May 2026 10:24:10 +0200 Subject: [PATCH 07/10] Revert "docstring" This reverts commit f09dfde157786bfeff4b16387f31024f5522aed1. --- slsDetectorSoftware/src/CallerSpecial.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/slsDetectorSoftware/src/CallerSpecial.cpp b/slsDetectorSoftware/src/CallerSpecial.cpp index ac75fab4c..dc2ae8c6c 100644 --- a/slsDetectorSoftware/src/CallerSpecial.cpp +++ b/slsDetectorSoftware/src/CallerSpecial.cpp @@ -1000,8 +1000,7 @@ std::string Caller::counters(int action) { std::ostringstream os; if (action == defs::HELP_ACTION) { os << "[i0] [i1] [i2]... \n\t[Mythen3] List of counters indices " - "enabled, support both comma and/or space separation. Each " - "element in list can be 0 - 2 and must be non " + "enabled. Each element in list can be 0 - 2 and must be non " "repetitive. Enabling counters sets vth dacs to remembered " "values and disabling sets them to disabled values." << '\n'; @@ -1199,8 +1198,7 @@ std::string Caller::rx_dbitlist(int action) { if (action == defs::HELP_ACTION) { os << "[all] or [none] or [i0] [i1] [i2]... \n\t[Ctb] List of digital " "signal bits enabled and rearranged according to the signals " - "(all samples of each signal is put together). Support both " - "comma and/or space separation. If 'all' is used " + "(all samples of each signal is put together). If 'all' is used " "instead of a list, all digital bits (64) enabled. Each element " "in list can be 0 - 63 and must be non repetitive. The option " "'none' will still spit out all data as is from the detector, " From 7db29d55a7579d136a9cb3a93ca3dc953be14635 Mon Sep 17 00:00:00 2001 From: Leonid Lunin Date: Thu, 21 May 2026 15:56:23 +0200 Subject: [PATCH 08/10] CI: Use conda-build instead conda build (#1464) * repalce conda build with conda-build, bump actions versions * updated github actions versions to run on node 24 --------- Co-authored-by: Alice --- .github/workflows/build_documentation.yml | 6 +++--- .github/workflows/build_wheel.yml | 10 +++++----- .github/workflows/cmake.yaml | 4 ++-- .github/workflows/conda_deploy_library.yaml | 8 ++++---- .github/workflows/conda_deploy_slsdet.yaml | 8 ++++---- .github/workflows/conda_library.yaml | 8 ++++---- .github/workflows/conda_python.yaml | 8 ++++---- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index be3dc4a62..ebbce9606 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -35,7 +35,7 @@ jobs: shell: "bash -l {0}" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 # Fetch all history for proper git operations token: ${{ secrets.GITHUB_TOKEN }} # Use the default token @@ -58,7 +58,7 @@ jobs: version: 1.0 - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: 3.12 cache: 'pip' @@ -84,7 +84,7 @@ jobs: --date "$(date +'%d.%m.%Y')" - name: Checkout gh-pages - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: gh-pages path: gh-pages diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 05e4dc66c..9e1d2df20 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -20,12 +20,12 @@ jobs: os: [ubuntu-latest,] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Build wheels run: pipx run cibuildwheel==3.2.1 - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl @@ -34,12 +34,12 @@ jobs: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Build sdist run: pipx run build --sdist - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: cibw-sdist path: dist/*.tar.gz @@ -54,7 +54,7 @@ jobs: # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v7 with: # unpacks all CIBW artifacts into dist/ pattern: cibw-* diff --git a/.github/workflows/cmake.yaml b/.github/workflows/cmake.yaml index 773700f1c..1c4d7b0f6 100644 --- a/.github/workflows/cmake.yaml +++ b/.github/workflows/cmake.yaml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-latest name: Configure and build using cmake steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: python-version: 3.12 cache: 'pip' diff --git a/.github/workflows/conda_deploy_library.yaml b/.github/workflows/conda_deploy_library.yaml index 6b5fb996e..68d046aff 100644 --- a/.github/workflows/conda_deploy_library.yaml +++ b/.github/workflows/conda_deploy_library.yaml @@ -21,10 +21,10 @@ jobs: shell: "bash -l {0}" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Get conda - uses: conda-incubator/setup-miniconda@v3.0.4 + uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} channels: conda-forge @@ -38,10 +38,10 @@ jobs: - name: Build env: CONDA_TOKEN: ${{ secrets.CONDA_TOKEN }} - run: conda build conda-recipes/main-library --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output + run: conda-build conda-recipes/main-library --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output - name: Upload all Conda to github as artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: conda-packages path: build_output/** # Uploads all packages \ No newline at end of file diff --git a/.github/workflows/conda_deploy_slsdet.yaml b/.github/workflows/conda_deploy_slsdet.yaml index d25bffa74..4207132bf 100644 --- a/.github/workflows/conda_deploy_slsdet.yaml +++ b/.github/workflows/conda_deploy_slsdet.yaml @@ -21,10 +21,10 @@ jobs: shell: "bash -l {0}" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Get conda - uses: conda-incubator/setup-miniconda@v3.0.4 + uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} channels: conda-forge @@ -38,10 +38,10 @@ jobs: - name: Build env: CONDA_TOKEN: ${{ secrets.CONDA_TOKEN }} - run: conda build conda-recipes/python-client --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output + run: conda-build conda-recipes/python-client --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output - name: Upload all Conda packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: conda-packages path: build_output/** # Uploads all packages \ No newline at end of file diff --git a/.github/workflows/conda_library.yaml b/.github/workflows/conda_library.yaml index 23f94d467..1086021c7 100644 --- a/.github/workflows/conda_library.yaml +++ b/.github/workflows/conda_library.yaml @@ -18,10 +18,10 @@ jobs: shell: "bash -l {0}" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Get conda - uses: conda-incubator/setup-miniconda@v3.0.4 + uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} channels: conda-forge @@ -33,10 +33,10 @@ jobs: run: conda config --set anaconda_upload no - name: Build - run: conda build conda-recipes/main-library --output-folder build_output + run: conda-build conda-recipes/main-library --output-folder build_output - name: Upload all Conda packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: conda-packages path: build_output/** # Uploads all packages \ No newline at end of file diff --git a/.github/workflows/conda_python.yaml b/.github/workflows/conda_python.yaml index 4b12cb3ff..86c8b3907 100644 --- a/.github/workflows/conda_python.yaml +++ b/.github/workflows/conda_python.yaml @@ -18,10 +18,10 @@ jobs: shell: "bash -l {0}" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Get conda - uses: conda-incubator/setup-miniconda@v3.0.4 + uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} channels: conda-forge @@ -33,10 +33,10 @@ jobs: run: conda config --set anaconda_upload no - name: Build - run: conda build conda-recipes/python-client --output-folder build_output + run: conda-build conda-recipes/python-client --output-folder build_output - name: Upload all Conda packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: conda-packages path: build_output/** # Uploads all packages \ No newline at end of file From 53d966d23b98de5986e05c63b1764a09ed6bd0a2 Mon Sep 17 00:00:00 2001 From: AliceMazzoleni99 Date: Wed, 27 May 2026 09:58:30 +0200 Subject: [PATCH 09/10] Fix/fmt install (#1468) * fmt_install for local libs code * fix: small python warning about escaped character \* in docstring * copy with -r in copy_lib.sh due to cmake directory --- CMakeLists.txt | 13 +------------ conda-recipes/main-library/copy_lib.sh | 2 +- python/slsdet/detector.py | 17 +++++++++++------ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb5d5df0f..8830eb86e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,22 +209,11 @@ else() URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/fmt/fmt-12.1.0.tar.gz # Compute hash: md5sum fmt-12.1.0.tar.gz URL_HASH MD5=92eb6f492e4838e5f024ce5207beafc7) + set(FMT_INSTALL ON CACHE BOOL "") FetchContent_MakeAvailable(fmt) set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON) endif() -# Export fmt -if(SLS_MASTER_PROJECT) - install(TARGETS fmt - EXPORT ${TARGETS_EXPORT_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ) -endif() - - option(SLS_USE_HDF5 "HDF5 File format" OFF) option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" OFF) option(SLS_USE_TEXTCLIENT "Text Client" ON) diff --git a/conda-recipes/main-library/copy_lib.sh b/conda-recipes/main-library/copy_lib.sh index 88beafdfe..8ca79f9ee 100755 --- a/conda-recipes/main-library/copy_lib.sh +++ b/conda-recipes/main-library/copy_lib.sh @@ -6,7 +6,7 @@ mkdir -p $PREFIX/bin mkdir -p $PREFIX/include/sls #Shared and static libraries -cp build/install/lib/* $PREFIX/lib/ +cp -r build/install/lib/* $PREFIX/lib/ #Binaries cp build/install/bin/sls_detector_acquire $PREFIX/bin/. diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 47ad9220d..a984fedd5 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -827,16 +827,21 @@ class Detector(CppDetectorApi): @property @element def txdelay(self): - """ + r""" [Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided. Note ---- - Sets up the following for every module:\n - \t\t[Eiger] txdelay_left to (2 \* mod_index \* n_delay), \n - \t\t[Eiger] txdelay_right to ((2 \* mod_index + 1) \* n_delay) and \n - \t\t[Eiger] txdelay_frame to (2 \* num_modules \* n_delay) \n - \t\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules \* n_delay)\n\n + Sets up the following for every module: + + [Eiger] txdelay_left to (2 \* mod_index \* n_delay), + + [Eiger] txdelay_right to ((2 \* mod_index + 1) \* n_delay) and + + [Eiger] txdelay_frame to (2 \* num_modules \* n_delay) + + [Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules \* n_delay) + Please refer txdelay_left, txdelay_right and txdelay_frame for details. """ return self.getTransmissionDelay() From 4c02ce65ccc221ae6a36112c11abfc1364eaf7f7 Mon Sep 17 00:00:00 2001 From: AliceMazzoleni99 Date: Wed, 27 May 2026 10:36:16 +0200 Subject: [PATCH 10/10] generated python enums, moved ReturnCode to slsDetectorDefs class (#1467) --- python/src/enums.cpp | 12 ++++++++++++ .../slsDetectorServer_cpp/include/DetectorServer.h | 2 ++ .../slsDetectorServer_cpp/include/TCPInterface.h | 11 ++++++----- .../slsDetectorServer_cpp/src/TCPInterface.cpp | 14 ++++++++------ slsSupportLib/include/sls/sls_detector_defs.h | 6 +----- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/python/src/enums.cpp b/python/src/enums.cpp index f00b8105a..d391fe0f2 100644 --- a/python/src/enums.cpp +++ b/python/src/enums.cpp @@ -27,6 +27,12 @@ void init_enums(py::module &m) { .value("GOTTHARD2", slsDetectorDefs::detectorType::GOTTHARD2) .value("XILINX_CHIPTESTBOARD", slsDetectorDefs::detectorType::XILINX_CHIPTESTBOARD) + .value("MATTERHORN", slsDetectorDefs::detectorType::MATTERHORN) + .export_values(); + + py::enum_(Defs, "ReturnCode") + .value("OK", slsDetectorDefs::ReturnCode::OK) + .value("FAIL", slsDetectorDefs::ReturnCode::FAIL) .export_values(); py::enum_(Defs, "boolFormat") @@ -50,6 +56,12 @@ void init_enums(py::module &m) { .value("Y", slsDetectorDefs::dimension::Y) .export_values(); + py::enum_(Defs, "FrequencyUnit") + .value("Hz", slsDetectorDefs::FrequencyUnit::Hz) + .value("kHz", slsDetectorDefs::FrequencyUnit::kHz) + .value("MHz", slsDetectorDefs::FrequencyUnit::MHz) + .export_values(); + py::enum_(Defs, "frameDiscardPolicy") .value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD) .value("DISCARD_EMPTY_FRAMES", diff --git a/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h b/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h index 7f1a6eb89..6773f17ba 100644 --- a/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h +++ b/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h @@ -25,6 +25,8 @@ struct UDPInfo { uint32_t dstip{}; }; +using ReturnCode = slsDetectorDefs::ReturnCode; + template class DetectorServer { public: diff --git a/slsDetectorServers/slsDetectorServer_cpp/include/TCPInterface.h b/slsDetectorServers/slsDetectorServer_cpp/include/TCPInterface.h index 9538a3e42..6d3ea2c29 100644 --- a/slsDetectorServers/slsDetectorServer_cpp/include/TCPInterface.h +++ b/slsDetectorServers/slsDetectorServer_cpp/include/TCPInterface.h @@ -19,8 +19,8 @@ class TCPInterface { public: ~TCPInterface(); - TCPInterface(std::function - &processFunction_, + TCPInterface(std::function &processFunction_, const uint16_t portNumber = DEFAULT_TCP_CNTRL_PORTNO); /// @brief creates tcp thread @@ -40,11 +40,12 @@ class TCPInterface { * @param function_id The ID of the function recived by the server and to * be executed */ - ReturnCode processReceivedData(const detFuncs function_id, - ServerInterface &socket); + slsDetectorDefs::ReturnCode processReceivedData(const detFuncs function_id, + ServerInterface &socket); /// @brief map of function IDs and corresponding functions - std::function + std::function processFunction; /// @brief TCP/IP port number for the detector server diff --git a/slsDetectorServers/slsDetectorServer_cpp/src/TCPInterface.cpp b/slsDetectorServers/slsDetectorServer_cpp/src/TCPInterface.cpp index 9d2d7911e..ea54d2f5a 100644 --- a/slsDetectorServers/slsDetectorServer_cpp/src/TCPInterface.cpp +++ b/slsDetectorServers/slsDetectorServer_cpp/src/TCPInterface.cpp @@ -8,8 +8,8 @@ namespace sls { TCPInterface::TCPInterface( - std::function - &processFunction_, + std::function &processFunction_, const uint16_t portNumber_) : processFunction(processFunction_), portNumber(portNumber_), server(portNumber_) { @@ -53,7 +53,7 @@ void TCPInterface::startTCPServerClientConnection() { auto returncode = processReceivedData( static_cast(function_id), socket); - if (returncode == FAIL) { + if (returncode == slsDetectorDefs::ReturnCode::FAIL) { throw RuntimeError(fmt::format( "Error processing command with fnum: {}", getFunctionNameFromEnum((enum detFuncs)function_id))); @@ -76,14 +76,16 @@ void TCPInterface::startTCPServerClientConnection() { LOG(logINFOBLUE) << "Exiting TCP Server"; } -ReturnCode TCPInterface::processReceivedData(const detFuncs function_id, - ServerInterface &socket) { +slsDetectorDefs::ReturnCode +TCPInterface::processReceivedData(const detFuncs function_id, + ServerInterface &socket) { LOG(logDEBUG1) << "calling function fnum: " << function_id << " (" << getFunctionNameFromEnum((enum detFuncs)function_id) << ")"; - ReturnCode returncode = processFunction(function_id, socket); + slsDetectorDefs::ReturnCode returncode = + processFunction(function_id, socket); LOG(logDEBUG1) << "Function " << getFunctionNameFromEnum((enum detFuncs)function_id) diff --git a/slsSupportLib/include/sls/sls_detector_defs.h b/slsSupportLib/include/sls/sls_detector_defs.h index 283eb2f5e..9e996f891 100644 --- a/slsSupportLib/include/sls/sls_detector_defs.h +++ b/slsSupportLib/include/sls/sls_detector_defs.h @@ -89,9 +89,6 @@ // NOLINTEND(cppcoreguidelines-macro-usage) #ifdef __cplusplus -// TODO: why are all these defs inside a class? - why not static -enum ReturnCode { OK = 0, FAIL = 1 }; - class slsDetectorDefs { public: #endif @@ -111,8 +108,7 @@ class slsDetectorDefs { // slsDetectorDefs instead of grouped in a class }; - /** return values */ - enum { OK, FAIL }; + enum ReturnCode { OK, FAIL }; enum boolFormat { TrueFalse, OnOff, OneZero };