diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index fef09501b..ebbce9606 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -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' diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 2d5a2dbaa..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 @@ -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/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() 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 };