From 56b7dd3ca9b81134568542f1703fec5af87a0e5f Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Tue, 5 Oct 2021 17:13:32 +0200 Subject: [PATCH 1/5] added currentsource to python --- python/CMakeLists.txt | 1 + python/slsdet/__init__.py | 3 +- python/slsdet/detector.py | 20 ++++++- python/src/current.cpp | 26 ++++++++ python/src/detector.cpp | 122 +++++++++++++++++++++++--------------- python/src/main.cpp | 2 + 6 files changed, 124 insertions(+), 50 deletions(-) create mode 100644 python/src/current.cpp diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 615aa2ba8..8337a811b 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -6,6 +6,7 @@ pybind11_add_module(_slsdet src/network.cpp src/pattern.cpp src/scan.cpp + src/current.cpp ) target_link_libraries(_slsdet PUBLIC diff --git a/python/slsdet/__init__.py b/python/slsdet/__init__.py index 0d98b6f6d..698224525 100755 --- a/python/slsdet/__init__.py +++ b/python/slsdet/__init__.py @@ -20,4 +20,5 @@ from .enums import * IpAddr = _slsdet.IpAddr MacAddr = _slsdet.MacAddr -scanParameters = _slsdet.scanParameters \ No newline at end of file +scanParameters = _slsdet.scanParameters +currentSrcParameters = _slsdet.currentSrcParameters \ No newline at end of file diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 12449391e..ec14bb826 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -1991,7 +1991,7 @@ class Detector(CppDetectorApi): return ut.reduce_time(self.getMeasuredSubFramePeriod()) """ - Jungfrau specific + ------------------<<>>------------------------- """ @property @@ -2212,6 +2212,24 @@ class Detector(CppDetectorApi): def gainmode(self, value): self.setGainMode(value) + @property + def currentsource(self): + """ + [Gotthard2] + currentsource [0|1] + Enable or disable current source. Default is disabled. + + [Jungfrau] + currentsource [0|1] [fix|nofix] [select source] [(only for chipv1.1)normal|low] + Disable or enable current source with some parameters. The select source is 0-63 for chipv1.0 and a 64 bit mask for chipv1.1. To disable, one needs only one argument '0'. + + """ + return element_if_equal(self.getCurrentSource()) + + @currentsource.setter + def currentsource(self, cs): + ut.set_using_dict(self.setCurrentSource, cs) + """ ---------------------------<<>>--------------------------- """ diff --git a/python/src/current.cpp b/python/src/current.cpp new file mode 100644 index 000000000..e6d0d62b7 --- /dev/null +++ b/python/src/current.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include + +// #include "sls/Pattern.h" +#include "sls/ToString.h" +#include "sls/sls_detector_defs.h" + +namespace py = pybind11; +void init_source(py::module &m) { + + using src = slsDetectorDefs::currentSrcParameters; + py::class_ currentSrcParameters(m, "currentSrcParameters"); + + currentSrcParameters.def(py::init()); + currentSrcParameters.def_readwrite("enable_", &src::enable_); + currentSrcParameters.def_readwrite("fix_", &src::fix_); + currentSrcParameters.def_readwrite("normal_", &src::normal_); + currentSrcParameters.def_readwrite("select_", &src::select_); + currentSrcParameters.def(pybind11::self == pybind11::self); + + currentSrcParameters.def("__repr__", + [](const src &a) { return sls::ToString(a); }); +} diff --git a/python/src/detector.cpp b/python/src/detector.cpp index f34c141fd..4236a5af9 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -160,6 +160,13 @@ void init_det(py::module &m) { (void (Detector::*)(const bool)) & Detector::setGapPixelsinCallback, py::arg()) + .def("getFlipRows", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFlipRows, + py::arg() = Positions{}) + .def("setFlipRows", + (void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows, + py::arg(), py::arg() = Positions{}) .def("isVirtualDetectorServer", (Result(Detector::*)(sls::Positions) const) & Detector::isVirtualDetectorServer, @@ -416,6 +423,39 @@ void init_det(py::module &m) { (void (Detector::*)(bool, sls::Positions)) & Detector::setParallelMode, py::arg(), py::arg() = Positions{}) + .def("getFilterResistor", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFilterResistor, + py::arg() = Positions{}) + .def("setFilterResistor", + (void (Detector::*)(int, sls::Positions)) & + Detector::setFilterResistor, + py::arg(), py::arg() = Positions{}) + .def("getCurrentSource", + (Result(Detector::*)(sls::Positions) + const) & + Detector::getCurrentSource, + py::arg() = Positions{}) + .def("setCurrentSource", + (void (Detector::*)(defs::currentSrcParameters, sls::Positions)) & + Detector::setCurrentSource, + py::arg(), py::arg() = Positions{}) + .def("getDBITPipeline", + (Result(Detector::*)(sls::Positions) const) & + Detector::getDBITPipeline, + py::arg() = Positions{}) + .def("setDBITPipeline", + (void (Detector::*)(int, sls::Positions)) & + Detector::setDBITPipeline, + py::arg(), py::arg() = Positions{}) + .def("getReadNRows", + (Result(Detector::*)(sls::Positions) const) & + Detector::getReadNRows, + py::arg() = Positions{}) + .def("setReadNRows", + (void (Detector::*)(const int, sls::Positions)) & + Detector::setReadNRows, + py::arg(), py::arg() = Positions{}) .def("acquire", (void (Detector::*)()) & Detector::acquire) .def("clearAcquiringFlag", (void (Detector::*)()) & Detector::clearAcquiringFlag) @@ -516,6 +556,31 @@ void init_det(py::module &m) { (void (Detector::*)(const sls::MacAddr, sls::Positions)) & Detector::setSourceUDPMAC2, py::arg(), py::arg() = Positions{}) + .def("getDestinationUDPList", + (Result(Detector::*)(const uint32_t, + sls::Positions) const) & + Detector::getDestinationUDPList, + py::arg(), py::arg() = Positions{}) + .def("setDestinationUDPList", + (void (Detector::*)(const sls::UdpDestination, const int)) & + Detector::setDestinationUDPList, + py::arg(), py::arg()) + .def("getNumberofUDPDestinations", + (Result(Detector::*)(sls::Positions) const) & + Detector::getNumberofUDPDestinations, + py::arg() = Positions{}) + .def("clearUDPDestinations", + (void (Detector::*)(sls::Positions)) & + Detector::clearUDPDestinations, + py::arg() = Positions{}) + .def("getFirstUDPDestination", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFirstUDPDestination, + py::arg() = Positions{}) + .def("setFirstUDPDestination", + (void (Detector::*)(const int, sls::Positions)) & + Detector::setFirstUDPDestination, + py::arg(), py::arg() = Positions{}) .def("getDestinationUDPIP", (Result(Detector::*)(sls::Positions) const) & Detector::getDestinationUDPIP, @@ -852,13 +917,6 @@ void init_det(py::module &m) { (void (Detector::*)(bool, sls::Positions)) & Detector::setOverFlowMode, py::arg(), py::arg() = Positions{}) - .def("getFlipRows", - (Result(Detector::*)(sls::Positions) const) & - Detector::getFlipRows, - py::arg() = Positions{}) - .def("setFlipRows", - (void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows, - py::arg(), py::arg() = Positions{}) .def("getRateCorrection", (Result(Detector::*)(sls::Positions) const) & Detector::getRateCorrection, @@ -871,14 +929,6 @@ void init_det(py::module &m) { (void (Detector::*)(sls::ns, sls::Positions)) & Detector::setRateCorrection, py::arg(), py::arg() = Positions{}) - .def("getReadNRows", - (Result(Detector::*)(sls::Positions) const) & - Detector::getReadNRows, - py::arg() = Positions{}) - .def("setReadNRows", - (void (Detector::*)(const int, sls::Positions)) & - Detector::setReadNRows, - py::arg(), py::arg() = Positions{}) .def("getInterruptSubframe", (Result(Detector::*)(sls::Positions) const) & Detector::getInterruptSubframe, @@ -1022,9 +1072,17 @@ void init_det(py::module &m) { Detector::getGainMode, py::arg() = Positions{}) .def("setGainMode", - (void (Detector::*)(defs::gainMode, sls::Positions)) & + (void (Detector::*)(const defs::gainMode, sls::Positions)) & Detector::setGainMode, py::arg(), py::arg() = Positions{}) + .def("getFilterCell", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFilterCell, + py::arg() = Positions{}) + .def("setFilterCell", + (void (Detector::*)(int, sls::Positions)) & + Detector::setFilterCell, + py::arg(), py::arg() = Positions{}) .def("getROI", (Result(Detector::*)(sls::Positions) const) & Detector::getROI, @@ -1100,30 +1158,6 @@ void init_det(py::module &m) { .def("setCDSGain", (void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain, py::arg(), py::arg() = Positions{}) - .def("getFilterResistor", - (Result(Detector::*)(sls::Positions) const) & - Detector::getFilterResistor, - py::arg() = Positions{}) - .def("setFilterResistor", - (void (Detector::*)(int, sls::Positions)) & - Detector::setFilterResistor, - py::arg(), py::arg() = Positions{}) - .def("getFilterCell", - (Result(Detector::*)(sls::Positions) const) & - Detector::getFilterCell, - py::arg() = Positions{}) - .def("setFilterCell", - (void (Detector::*)(int, sls::Positions)) & - Detector::setFilterCell, - py::arg(), py::arg() = Positions{}) - .def("getCurrentSource", - (Result(Detector::*)(sls::Positions) const) & - Detector::getCurrentSource, - py::arg() = Positions{}) - .def("setCurrentSource", - (void (Detector::*)(bool, sls::Positions)) & - Detector::setCurrentSource, - py::arg(), py::arg() = Positions{}) .def("getTimingSource", (Result(Detector::*)(sls::Positions) const) & @@ -1315,14 +1349,6 @@ void init_det(py::module &m) { .def("setDBITClock", (void (Detector::*)(int, sls::Positions)) & Detector::setDBITClock, py::arg(), py::arg() = Positions{}) - .def("getDBITPipeline", - (Result(Detector::*)(sls::Positions) const) & - Detector::getDBITPipeline, - py::arg() = Positions{}) - .def("setDBITPipeline", - (void (Detector::*)(int, sls::Positions)) & - Detector::setDBITPipeline, - py::arg(), py::arg() = Positions{}) .def("getMeasuredVoltage", (Result(Detector::*)(defs::dacIndex, sls::Positions) const) & Detector::getMeasuredVoltage, diff --git a/python/src/main.cpp b/python/src/main.cpp index 291752c34..7afa194b2 100755 --- a/python/src/main.cpp +++ b/python/src/main.cpp @@ -21,6 +21,7 @@ void init_det(py::module &); void init_network(py::module &); void init_pattern(py::module &); void init_scan(py::module &); +void init_source(py::module &); PYBIND11_MODULE(_slsdet, m) { m.doc() = R"pbdoc( C/C++ API @@ -37,6 +38,7 @@ PYBIND11_MODULE(_slsdet, m) { init_network(m); init_pattern(m); init_scan(m); + init_source(m); // init_experimental(m); From 34fb823675b1ba124ca627b0ae3f4167600b5e82 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 6 Oct 2021 14:24:57 +0200 Subject: [PATCH 2/5] changing ports only in shared memory and not going to detector/receiver server to change current tcp port --- .../include/slsDetectorServer_funcs.h | 1 - .../src/slsDetectorServer_funcs.c | 38 ------------------- slsDetectorSoftware/src/Module.cpp | 19 ++-------- .../tests/test-CmdProxy-rx.cpp | 1 - slsReceiverSoftware/src/ClientInterface.cpp | 16 -------- slsReceiverSoftware/src/ClientInterface.h | 1 - .../include/sls/sls_detector_funcs.h | 4 -- 7 files changed, 3 insertions(+), 77 deletions(-) diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index 14df33e2b..bedad75f6 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -87,7 +87,6 @@ int set_roi(int); int get_roi(int); int lock_server(int); int get_last_client_ip(int); -int set_port(int); int calibrate_pedestal(int); int enable_ten_giga(int); int validateAndSetAllTrimbits(int arg); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index a3936c5e8..5c724b10e 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -230,7 +230,6 @@ void function_table() { flist[F_GET_ROI] = &get_roi; flist[F_LOCK_SERVER] = &lock_server; flist[F_GET_LAST_CLIENT_IP] = &get_last_client_ip; - flist[F_SET_PORT] = &set_port; flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga; flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits; flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control; @@ -2880,43 +2879,6 @@ int get_last_client_ip(int file_des) { return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } -int set_port(int file_des) { - ret = OK; - memset(mess, 0, sizeof(mess)); - int p_number = -1; - uint32_t oldLastClientIP = 0; - - if (receiveData(file_des, &p_number, sizeof(p_number), INT32) < 0) - return printSocketReadError(); - - // set only - int sd = -1; - if ((Server_VerifyLock() == OK)) { - // port number too low - if (p_number < 1024) { - ret = FAIL; - sprintf(mess, "%s port Number (%d) too low\n", - (isControlServer ? "control" : "stop"), p_number); - LOG(logERROR, (mess)); - } else { - LOG(logINFO, ("Setting %s port to %d\n", - (isControlServer ? "control" : "stop"), p_number)); - oldLastClientIP = lastClientIP; - sd = bindSocket(p_number); - } - } - - Server_SendResult(file_des, INT32, &p_number, sizeof(p_number)); - // delete old socket - if (ret != FAIL) { - closeConnection(file_des); - exitServer(sockfd); - sockfd = sd; - lastClientIP = oldLastClientIP; - } - return ret; -} - int enable_ten_giga(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 0f9a8d486..f05fce56f 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1215,12 +1215,7 @@ int Module::getReceiverPort() const { return shm()->rxTCPPort; } int Module::setReceiverPort(int port_number) { if (port_number >= 0 && port_number != shm()->rxTCPPort) { - if (shm()->useReceiverFlag) { - shm()->rxTCPPort = - sendToReceiver(F_SET_RECEIVER_PORT, port_number); - } else { - shm()->rxTCPPort = port_number; - } + shm()->rxTCPPort = port_number; } return shm()->rxTCPPort; } @@ -2567,21 +2562,13 @@ void Module::setADCInvert(uint32_t value) { int Module::getControlPort() const { return shm()->controlPort; } void Module::setControlPort(int port_number) { - if (strlen(shm()->hostname) > 0) { - shm()->controlPort = sendToDetector(F_SET_PORT, port_number); - } else { - shm()->controlPort = port_number; - } + shm()->controlPort = port_number; } int Module::getStopPort() const { return shm()->stopPort; } void Module::setStopPort(int port_number) { - if (strlen(shm()->hostname) > 0) { - shm()->stopPort = sendToDetectorStop(F_SET_PORT, port_number); - } else { - shm()->stopPort = port_number; - } + shm()->stopPort = port_number; } bool Module::getLockDetector() const { diff --git a/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp b/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp index 02eca29d5..ed4f1ce7b 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp @@ -190,7 +190,6 @@ TEST_CASE("rx_tcpport", "[.cmd][.rx]") { proxy.Call("rx_tcpport", {}, i, GET, oss); REQUIRE(oss.str() == "rx_tcpport " + std::to_string(port + i) + '\n'); } - REQUIRE_THROWS(proxy.Call("rx_tcpport", {"15"}, -1, PUT)); port = 5754; proxy.Call("rx_tcpport", {std::to_string(port)}, -1, PUT); for (int i = 0; i != det.size(); ++i) { diff --git a/slsReceiverSoftware/src/ClientInterface.cpp b/slsReceiverSoftware/src/ClientInterface.cpp index 12b1a3c35..bc838b7df 100644 --- a/slsReceiverSoftware/src/ClientInterface.cpp +++ b/slsReceiverSoftware/src/ClientInterface.cpp @@ -113,7 +113,6 @@ void ClientInterface::startTCPServer() { int ClientInterface::functionTable(){ flist[F_LOCK_RECEIVER] = &ClientInterface::lock_receiver; flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip; - flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port; flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version; flist[F_SETUP_RECEIVER] = &ClientInterface::setup_receiver; flist[F_RECEIVER_SET_ROI] = &ClientInterface::set_roi; @@ -302,21 +301,6 @@ int ClientInterface::get_last_client_ip(Interface &socket) { return socket.sendResult(server.getLastClient()); } -int ClientInterface::set_port(Interface &socket) { - auto p_number = socket.Receive(); - if (p_number < 1024) - throw RuntimeError("Port Number: " + std::to_string(p_number) + - " is too low (<1024)"); - - LOG(logINFO) << "TCP port set to " << p_number << std::endl; - sls::ServerSocket new_server(p_number); - new_server.setLockedBy(server.getLockedBy()); - new_server.setLastClient(server.getThisClient()); - server = std::move(new_server); - socket.sendResult(p_number); - return OK; -} - int ClientInterface::get_version(Interface &socket) { return socket.sendResult(getReceiverVersion()); } diff --git a/slsReceiverSoftware/src/ClientInterface.h b/slsReceiverSoftware/src/ClientInterface.h index 41b94b70a..dcba1812b 100644 --- a/slsReceiverSoftware/src/ClientInterface.h +++ b/slsReceiverSoftware/src/ClientInterface.h @@ -62,7 +62,6 @@ class ClientInterface : private virtual slsDetectorDefs { int lock_receiver(sls::ServerInterface &socket); int get_last_client_ip(sls::ServerInterface &socket); - int set_port(sls::ServerInterface &socket); int get_version(sls::ServerInterface &socket); int setup_receiver(sls::ServerInterface &socket); void setDetectorType(detectorType arg); diff --git a/slsSupportLib/include/sls/sls_detector_funcs.h b/slsSupportLib/include/sls/sls_detector_funcs.h index cd0fe477e..eba720a2a 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -69,7 +69,6 @@ enum detFuncs { F_GET_ROI, F_LOCK_SERVER, F_GET_LAST_CLIENT_IP, - F_SET_PORT, F_ENABLE_TEN_GIGA, F_SET_ALL_TRIMBITS, F_SET_PATTERN_IO_CONTROL, @@ -258,7 +257,6 @@ enum detFuncs { F_EXEC_RECEIVER_COMMAND, F_LOCK_RECEIVER, F_GET_LAST_RECEIVER_CLIENT_IP, - F_SET_RECEIVER_PORT, F_GET_RECEIVER_VERSION, F_RECEIVER_SET_ROI, F_RECEIVER_SET_NUM_FRAMES, @@ -427,7 +425,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_GET_ROI: return "F_GET_ROI"; case F_LOCK_SERVER: return "F_LOCK_SERVER"; case F_GET_LAST_CLIENT_IP: return "F_GET_LAST_CLIENT_IP"; - case F_SET_PORT: return "F_SET_PORT"; case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA"; case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS"; case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL"; @@ -614,7 +611,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_EXEC_RECEIVER_COMMAND: return "F_EXEC_RECEIVER_COMMAND"; case F_LOCK_RECEIVER: return "F_LOCK_RECEIVER"; case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP"; - case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT"; case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION"; case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI"; case F_RECEIVER_SET_NUM_FRAMES: return "F_RECEIVER_SET_NUM_FRAMES"; From ea77331a4a734fdfca293faac92c2475c0a709a9 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 6 Oct 2021 14:29:36 +0200 Subject: [PATCH 3/5] updated release --- RELEASE.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/RELEASE.txt b/RELEASE.txt index 672a4700e..c9f996499 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -160,6 +160,10 @@ This document describes the differences between 6.0.0 and 5.2.0 releases. Command line: datastream, API: getDataStream/ setDataStream Enable or disable each port. Default: enabled + 25. Changing TCP ports + This will only affect shared memory and will not try to change the + current tcp port of the control/stop server in detector. + Detector servers ---------------- @@ -184,6 +188,9 @@ This document describes the differences between 6.0.0 and 5.2.0 releases. Frames caught by the master receiver is added to master file metadata. Hdf5 and Binary version numbers changed to 6.3 + 2. Changing Receiver TCP ports + This will only affect shared memory and will not try to change the + current tcp port of the receiver. Gui ---- From 5ed1e1f43fe4276014b64e67094c049461e6d7f6 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 7 Oct 2021 10:59:00 +0200 Subject: [PATCH 4/5] added currentsource example for python --- python/examples/use_currentsource.py | 10 ++++++++++ python/examples/using_scan.py | 2 ++ python/slsdet/detector.py | 27 +++++++++++++++++++-------- 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 python/examples/use_currentsource.py diff --git a/python/examples/use_currentsource.py b/python/examples/use_currentsource.py new file mode 100644 index 000000000..6df565f05 --- /dev/null +++ b/python/examples/use_currentsource.py @@ -0,0 +1,10 @@ +from slsdet import Detector, currentSrcParameters + +s = currentSrcParameters() +s.enable_ = 1 +s.fix_= 1 +s.select_ = 10 + + +d = Detector() +d.currentsource = s \ No newline at end of file diff --git a/python/examples/using_scan.py b/python/examples/using_scan.py index 612cae754..2d8f5a74a 100644 --- a/python/examples/using_scan.py +++ b/python/examples/using_scan.py @@ -15,5 +15,7 @@ sp.dacSettleTime_ns = int(1e9) d = Mythen3() d.setScan(sp) +#or d.scan = sp + diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index ec14bb826..94f9ec483 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -362,6 +362,21 @@ class Detector(CppDetectorApi): """ return self.getNumberOfFramesFromStart() + + @property + @element + def scan(self): + """ + Pass in a scanParameters object + see python/examples/use_scan.py + + """ + return self.getScan() + + @scan.setter + def scan(self, s): + ut.set_using_dict(self.setScan, s) + @property @element def powerchip(self): @@ -2213,18 +2228,14 @@ class Detector(CppDetectorApi): self.setGainMode(value) @property + @element def currentsource(self): """ - [Gotthard2] - currentsource [0|1] - Enable or disable current source. Default is disabled. - - [Jungfrau] - currentsource [0|1] [fix|nofix] [select source] [(only for chipv1.1)normal|low] - Disable or enable current source with some parameters. The select source is 0-63 for chipv1.0 and a 64 bit mask for chipv1.1. To disable, one needs only one argument '0'. + Pass in a currentSrcParameters object + see python/examples/use_currentsource.py """ - return element_if_equal(self.getCurrentSource()) + return self.getCurrentSource() @currentsource.setter def currentsource(self, cs): From fac7e0fbb0ddfa893624221bab922afbefd7d203 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 7 Oct 2021 11:15:02 +0200 Subject: [PATCH 5/5] WIP --- python/examples/use_currentsource.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/examples/use_currentsource.py b/python/examples/use_currentsource.py index 6df565f05..a895126b0 100644 --- a/python/examples/use_currentsource.py +++ b/python/examples/use_currentsource.py @@ -3,6 +3,7 @@ from slsdet import Detector, currentSrcParameters s = currentSrcParameters() s.enable_ = 1 s.fix_= 1 +s.normal_ = 1 s.select_ = 10