From 5e97bcde7f727b15bb8b507c409162b9c35fa339 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Mon, 21 Feb 2022 09:42:24 +0100 Subject: [PATCH] startdetector (non blocking) is allowed at modular level --- RELEASE.txt | 6 ++--- python/src/detector.cpp | 4 +++- slsDetectorSoftware/include/sls/Detector.h | 2 +- slsDetectorSoftware/src/CmdProxy.h | 2 +- slsDetectorSoftware/src/Detector.cpp | 26 ++++++++++++---------- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/RELEASE.txt b/RELEASE.txt index e5c58dee8..84b3f2e9e 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -1,7 +1,7 @@ -SLS Detector Package Minor Release 6.1.0 released on 25.11.2021 +SLS Detector Package Minor Release 7.0.0 released on 25.11.2021 =============================================================== -This document describes the differences between v6.1.0 and v6.0.0. +This document describes the differences between v7.0.0 and v6.x.x @@ -39,7 +39,7 @@ This document describes the differences between v6.1.0 and v6.0.0. - current frame index points to listened frame index (not processed index) - when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster) - file write disabled by default - +- start non blocking acquisition at modular level 2. Resolved Issues diff --git a/python/src/detector.cpp b/python/src/detector.cpp index 9f1d6937c..f7a48f9fd 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -470,7 +470,9 @@ void init_det(py::module &m) { (void (Detector::*)()) & Detector::clearAcquiringFlag) .def("startReceiver", (void (Detector::*)()) & Detector::startReceiver) .def("stopReceiver", (void (Detector::*)()) & Detector::stopReceiver) - .def("startDetector", (void (Detector::*)()) & Detector::startDetector) + .def("startDetector", + (void (Detector::*)(sls::Positions)) & Detector::startDetector, + py::arg() = Positions{}) .def("startDetectorReadout", (void (Detector::*)()) & Detector::startDetectorReadout) .def("stopDetector", diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 91f420716..4123d0284 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -567,7 +567,7 @@ class Detector { /** Non blocking: start detector acquisition. Status changes to RUNNING or * WAITING and automatically returns to idle at the end of acquisition. [Mythen3] Master starts acquisition first */ - void startDetector(); + void startDetector(Positions pos = {}); /** [Mythen3] Non blocking: start detector readout of counters in chip. * Status changes to TRANSMITTING and automatically returns to idle at the diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index ac1afb4ad..b9c813f47 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1516,7 +1516,7 @@ class CmdProxy { "\n\tStops receiver listener for detector data packets and closes " "current data file (if file write enabled)."); - EXECUTE_SET_COMMAND_NOID( + EXECUTE_SET_COMMAND( start, startDetector, "\n\tStarts detector acquisition. Status changes to RUNNING or WAITING " "and automatically returns to idle at the end of acquisition. If the " diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 801193e78..f31349ad4 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -756,22 +756,24 @@ void Detector::startReceiver() { pimpl->Parallel(&Module::startReceiver, {}); } void Detector::stopReceiver() { pimpl->Parallel(&Module::stopReceiver, {}); } -void Detector::startDetector() { - auto detector_type = getDetectorType().squash(); +void Detector::startDetector(Positions pos) { + auto detector_type = getDetectorType(pos).squash(); if (detector_type == defs::MYTHEN3 && size() > 1) { - auto is_master = getMaster(); - int masterPosition = 0; - std::vector slaves; - for (int i = 0; i < size(); ++i) { - if (is_master[i]) + std::vector slaves(pos); + auto is_master = getMaster(pos); + int masterPosition = -1; + for (unsigned int i = 0; i < is_master.size(); ++i) { + if (is_master[i]) { masterPosition = i; - else - slaves.push_back(i); + slaves.erase(pos.begin() + i); + } + } + pimpl->Parallel(&Module::startAcquisition, pos); + if (masterPosition != -1) { + pimpl->Parallel(&Module::startAcquisition, {masterPosition}); } - pimpl->Parallel(&Module::startAcquisition, slaves); - pimpl->Parallel(&Module::startAcquisition, {masterPosition}); } else { - pimpl->Parallel(&Module::startAcquisition, {}); + pimpl->Parallel(&Module::startAcquisition, pos); } }