Merge branch 'developer' into j1.1fix

This commit is contained in:
maliakal_d 2021-10-07 16:14:50 +02:00
commit 8aa7ced83e
27 changed files with 178 additions and 298 deletions

View File

@ -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,11 @@ 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. Removed Padding option for Deactivated half modules.
3. Changing Receiver TCP ports
This will only affect shared memory and will not try to change the
current tcp port of the receiver.
Gui
----

View File

@ -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

View File

@ -0,0 +1,11 @@
from slsdet import Detector, currentSrcParameters
s = currentSrcParameters()
s.enable_ = 1
s.fix_= 1
s.normal_ = 1
s.select_ = 10
d = Detector()
d.currentsource = s

View File

@ -15,5 +15,7 @@ sp.dacSettleTime_ns = int(1e9)
d = Mythen3()
d.setScan(sp)
#or d.scan = sp

View File

@ -20,4 +20,5 @@ from .enums import *
IpAddr = _slsdet.IpAddr
MacAddr = _slsdet.MacAddr
scanParameters = _slsdet.scanParameters
scanParameters = _slsdet.scanParameters
currentSrcParameters = _slsdet.currentSrcParameters

View File

@ -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):
@ -1991,7 +2006,7 @@ class Detector(CppDetectorApi):
return ut.reduce_time(self.getMeasuredSubFramePeriod())
"""
Jungfrau specific
------------------<<<Jungfrau specific>>>-------------------------
"""
@property
@ -2212,6 +2227,20 @@ class Detector(CppDetectorApi):
def gainmode(self, value):
self.setGainMode(value)
@property
@element
def currentsource(self):
"""
Pass in a currentSrcParameters object
see python/examples/use_currentsource.py
"""
return self.getCurrentSource()
@currentsource.setter
def currentsource(self, cs):
ut.set_using_dict(self.setCurrentSource, cs)
"""
---------------------------<<<Gotthard2 specific>>>---------------------------
"""

26
python/src/current.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <pybind11/chrono.h>
#include <pybind11/numpy.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
// #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_<src> 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); });
}

View File

@ -160,6 +160,13 @@ void init_det(py::module &m) {
(void (Detector::*)(const bool)) &
Detector::setGapPixelsinCallback,
py::arg())
.def("getFlipRows",
(Result<bool>(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<bool>(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<int>(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<defs::currentSrcParameters>(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<int>(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<int>(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<sls::UdpDestination>(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<int>(Detector::*)(sls::Positions) const) &
Detector::getNumberofUDPDestinations,
py::arg() = Positions{})
.def("clearUDPDestinations",
(void (Detector::*)(sls::Positions)) &
Detector::clearUDPDestinations,
py::arg() = Positions{})
.def("getFirstUDPDestination",
(Result<int>(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<sls::IpAddr>(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<bool>(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<sls::ns>(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<int>(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<bool>(Detector::*)(sls::Positions) const) &
Detector::getInterruptSubframe,
@ -903,14 +953,6 @@ void init_det(py::module &m) {
(void (Detector::*)(const bool, sls::Positions)) &
Detector::setActive,
py::arg(), py::arg() = Positions{})
.def("getRxPadDeactivatedMode",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getRxPadDeactivatedMode,
py::arg() = Positions{})
.def("setRxPadDeactivatedMode",
(void (Detector::*)(bool, sls::Positions)) &
Detector::setRxPadDeactivatedMode,
py::arg(), py::arg() = Positions{})
.def("getPartialReset",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getPartialReset,
@ -1022,9 +1064,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<int>(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<defs::ROI>(Detector::*)(sls::Positions) const) &
Detector::getROI,
@ -1100,30 +1150,6 @@ void init_det(py::module &m) {
.def("setCDSGain",
(void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain,
py::arg(), py::arg() = Positions{})
.def("getFilterResistor",
(Result<int>(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<int>(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<bool>(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<defs::timingSourceType>(Detector::*)(sls::Positions)
const) &
@ -1315,14 +1341,6 @@ void init_det(py::module &m) {
.def("setDBITClock",
(void (Detector::*)(int, sls::Positions)) & Detector::setDBITClock,
py::arg(), py::arg() = Positions{})
.def("getDBITPipeline",
(Result<int>(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<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
Detector::getMeasuredVoltage,

View File

@ -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);

View File

@ -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);

View File

@ -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));

View File

@ -1091,12 +1091,6 @@ class Detector {
* send data or communicated with FEB or BEB */
void setActive(const bool active, Positions pos = {});
/** [Eiger] */
Result<bool> getRxPadDeactivatedMode(Positions pos = {}) const;
/** [Eiger] Pad deactivated modules in receiver. Enabled by default */
void setRxPadDeactivatedMode(bool pad, Positions pos = {});
/** [Eiger] Advanced */
Result<bool> getPartialReset(Positions pos = {}) const;

View File

@ -1669,50 +1669,6 @@ std::string CmdProxy::RateCorrection(int action) {
return os.str();
}
std::string CmdProxy::Activate(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[0, 1] [(optional) padding|nopadding]\n\t[Eiger] 1 is default. "
"0 deactivates readout and does not send data. \n\tPadding will "
"pad data files for deactivates readouts."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getActive(std::vector<int>{det_id});
auto p = det->getRxPadDeactivatedMode(std::vector<int>{det_id});
Result<std::string> pResult(p.size());
for (unsigned int i = 0; i < p.size(); ++i) {
pResult[i] = p[i] ? "padding" : "nopadding";
}
os << OutString(t) << ' ' << OutString(pResult) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.empty() || args.size() > 2) {
WrongNumberOfParameters(2);
}
int t = StringTo<int>(args[0]);
det->setActive(t, std::vector<int>{det_id});
os << args[0];
if (args.size() == 2) {
bool p = true;
if (args[1] == "nopadding") {
p = false;
} else if (args[1] != "padding") {
throw sls::RuntimeError(
"Unknown argument for deactivated padding.");
}
det->setRxPadDeactivatedMode(p, std::vector<int>{det_id});
os << ' ' << args[1];
}
os << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::PulsePixel(int action) {
std::ostringstream os;
os << cmd << ' ';

View File

@ -925,7 +925,7 @@ class CmdProxy {
{"interruptsubframe", &CmdProxy::interruptsubframe},
{"measuredperiod", &CmdProxy::measuredperiod},
{"measuredsubperiod", &CmdProxy::measuredsubperiod},
{"activate", &CmdProxy::Activate},
{"activate", &CmdProxy::activate},
{"partialreset", &CmdProxy::partialreset},
{"pulse", &CmdProxy::PulsePixel},
{"pulsenmove", &CmdProxy::PulsePixelAndMove},
@ -1131,7 +1131,6 @@ class CmdProxy {
std::string ZMQHWM(int action);
/* Eiger Specific */
std::string RateCorrection(int action);
std::string Activate(int action);
std::string PulsePixel(int action);
std::string PulsePixelAndMove(int action);
std::string PulseChip(int action);
@ -1857,6 +1856,11 @@ class CmdProxy {
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
"frame period between last sub frame and previous one.");
INTEGER_COMMAND_VEC_ID(
activate, getActive, setActive, StringTo<int>,
"[0, 1] \n\t[Eiger] 1 is default. 0 deactivates readout and does not send data.");
INTEGER_COMMAND_VEC_ID(
partialreset, getPartialReset, setPartialReset, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at "

View File

@ -1430,13 +1430,6 @@ void Detector::setActive(const bool active, Positions pos) {
pimpl->Parallel(&Module::setActivate, pos, active);
}
Result<bool> Detector::getRxPadDeactivatedMode(Positions pos) const {
return pimpl->Parallel(&Module::getDeactivatedRxrPaddingMode, pos);
}
void Detector::setRxPadDeactivatedMode(bool pad, Positions pos) {
pimpl->Parallel(&Module::setDeactivatedRxrPaddingMode, pos, pad);
}
Result<bool> Detector::getPartialReset(Positions pos) const {
return pimpl->Parallel(&Module::getCounterBit, pos);

View File

@ -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<int>(F_SET_RECEIVER_PORT, port_number);
} else {
shm()->rxTCPPort = port_number;
}
shm()->rxTCPPort = port_number;
}
return shm()->rxTCPPort;
}
@ -1559,15 +1554,6 @@ void Module::setActivate(const bool enable) {
}
}
bool Module::getDeactivatedRxrPaddingMode() const {
return sendToReceiver<int>(F_GET_RECEIVER_DEACTIVATED_PADDING);
}
void Module::setDeactivatedRxrPaddingMode(bool padding) {
sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING,
static_cast<int>(padding), nullptr);
}
bool Module::getCounterBit() const {
return (
!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
@ -2567,21 +2553,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<int>(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<int>(F_SET_PORT, port_number);
} else {
shm()->stopPort = port_number;
}
shm()->stopPort = port_number;
}
bool Module::getLockDetector() const {

View File

@ -349,8 +349,6 @@ class Module : public virtual slsDetectorDefs {
int64_t getMeasuredSubFramePeriod() const;
bool getActivate() const;
void setActivate(const bool enable);
bool getDeactivatedRxrPaddingMode() const;
void setDeactivatedRxrPaddingMode(bool padding);
bool getCounterBit() const;
void setCounterBit(bool cb);
void pulsePixel(int n = 0, int x = 0, int y = 0);

View File

@ -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) {

View File

@ -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;
@ -178,8 +177,6 @@ int ClientInterface::functionTable(){
flist[F_GET_RECEIVER_DISCARD_POLICY] = &ClientInterface::get_discard_policy;
flist[F_SET_RECEIVER_PADDING] = &ClientInterface::set_padding_enable;
flist[F_GET_RECEIVER_PADDING] = &ClientInterface::get_padding_enable;
flist[F_SET_RECEIVER_DEACTIVATED_PADDING] = &ClientInterface::set_deactivated_padding_enable;
flist[F_GET_RECEIVER_DEACTIVATED_PADDING] = &ClientInterface::get_deactivated_padding_enable;
flist[F_RECEIVER_SET_READOUT_MODE] = &ClientInterface::set_readout_mode;
flist[F_RECEIVER_SET_ADC_MASK] = &ClientInterface::set_adc_mask;
flist[F_SET_RECEIVER_DBIT_LIST] = &ClientInterface::set_dbit_list;
@ -302,21 +299,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<int>();
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());
}
@ -1275,29 +1257,6 @@ int ClientInterface::get_padding_enable(Interface &socket) {
return socket.sendResult(retval);
}
int ClientInterface::set_deactivated_padding_enable(Interface &socket) {
auto enable = socket.Receive<int>();
if (detType != EIGER) {
functionNotImplemented();
}
if (enable < 0) {
throw RuntimeError("Invalid Deactivated padding: " +
std::to_string(enable));
}
verifyIdle(socket);
LOG(logDEBUG1) << "Setting deactivated padding enable: " << enable;
impl()->setDeactivatedPadding(enable > 0);
return socket.Send(OK);
}
int ClientInterface::get_deactivated_padding_enable(Interface &socket) {
if (detType != EIGER)
functionNotImplemented();
auto retval = static_cast<int>(impl()->getDeactivatedPadding());
LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval;
return socket.sendResult(retval);
}
int ClientInterface::set_readout_mode(Interface &socket) {
auto arg = socket.Receive<readoutMode>();

View File

@ -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);
@ -129,8 +128,6 @@ class ClientInterface : private virtual slsDetectorDefs {
int get_discard_policy(sls::ServerInterface &socket);
int set_padding_enable(sls::ServerInterface &socket);
int get_padding_enable(sls::ServerInterface &socket);
int set_deactivated_padding_enable(sls::ServerInterface &socket);
int get_deactivated_padding_enable(sls::ServerInterface &socket);
int set_readout_mode(sls::ServerInterface &socket);
int set_adc_mask(sls::ServerInterface &socket);
int set_dbit_list(sls::ServerInterface &socket);

View File

@ -27,8 +27,7 @@
const std::string DataProcessor::typeName_ = "DataProcessor";
DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo,
bool *activated, bool *deactivatedPaddingEnable,
bool *dataStreamEnable,
bool *activated, bool *dataStreamEnable,
uint32_t *streamingFrequency,
uint32_t *streamingTimerInMs,
uint32_t *streamingStartFnum, bool *framePadding,
@ -36,7 +35,6 @@ DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo,
int *ctbAnalogDataBytes, std::mutex *hdf5Lib)
: ThreadObject(index, typeName_), fifo_(fifo), detectorType_(detectorType),
dataStreamEnable_(dataStreamEnable), activated_(activated),
deactivatedPaddingEnable_(deactivatedPaddingEnable),
streamingFrequency_(streamingFrequency),
streamingTimerInMs_(streamingTimerInMs),
streamingStartFnum_(streamingStartFnum), framePadding_(framePadding),
@ -169,13 +167,8 @@ void DataProcessor::CreateFirstFiles(
overWriteEnable, silentMode, attr);
}
// deactivated with padding enabled, dont write file
if (!*activated_ && !*deactivatedPaddingEnable_) {
return;
}
// deactivated port, dont write file
if (!detectorDataStream) {
// deactivated (half module/ single port), dont write file
if ((!*activated_) || (!detectorDataStream)) {
return;
}
@ -372,10 +365,6 @@ uint64_t DataProcessor::ProcessAnImage(char *buf) {
if (*activated_ && *framePadding_ && nump < generalData_->packetsPerFrame)
PadMissingPackets(buf);
// deactivated and padding enabled
else if (!*activated_ && *deactivatedPaddingEnable_)
PadMissingPackets(buf);
// rearrange ctb digital bits (if ctbDbitlist is not empty)
if (!(*ctbDbitList_).empty()) {
RearrangeDbitData(buf);

View File

@ -26,8 +26,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
public:
DataProcessor(int index, detectorType detectorType, Fifo *fifo,
bool *activated, bool *deactivatedPaddingEnable,
bool *dataStreamEnable, uint32_t *streamingFrequency,
bool *activated, bool *dataStreamEnable, uint32_t *streamingFrequency,
uint32_t *streamingTimerInMs, uint32_t *streamingStartFnum,
bool *framePadding, std::vector<int> *ctbDbitList,
int *ctbDbitOffset, int *ctbAnalogDataBytes,
@ -161,7 +160,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
detectorType detectorType_;
bool *dataStreamEnable_;
bool *activated_;
bool *deactivatedPaddingEnable_;
/** if 0, sending random images with a timer */
uint32_t *streamingFrequency_;
uint32_t *streamingTimerInMs_;

View File

@ -167,9 +167,9 @@ void Implementation::setDetectorType(const detectorType d) {
i, detType, fifo_ptr, &status, &udpPortNum[i], &eth[i],
&numberOfTotalFrames, &udpSocketBufferSize,
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
&activated, &detectorDataStream[i], &deactivatedPaddingEnable, &silentMode));
&activated, &detectorDataStream[i], &silentMode));
dataProcessor.push_back(sls::make_unique<DataProcessor>(
i, detType, fifo_ptr, &activated, &deactivatedPaddingEnable,
i, detType, fifo_ptr, &activated,
&dataStreamEnable, &streamingFrequency, &streamingTimerInMs,
&streamingStartFnum, &framePadding, &ctbDbitList,
&ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib));
@ -880,12 +880,11 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
i, detType, fifo_ptr, &status, &udpPortNum[i], &eth[i],
&numberOfTotalFrames, &udpSocketBufferSize,
&actualUDPSocketBufferSize, &framesPerFile,
&frameDiscardMode, &activated, &detectorDataStream[i], &deactivatedPaddingEnable,
&silentMode));
&frameDiscardMode, &activated, &detectorDataStream[i], &silentMode));
listener[i]->SetGeneralData(generalData);
dataProcessor.push_back(sls::make_unique<DataProcessor>(
i, detType, fifo_ptr, &activated, &deactivatedPaddingEnable,
i, detType, fifo_ptr, &activated,
&dataStreamEnable, &streamingFrequency, &streamingTimerInMs,
&streamingStartFnum, &framePadding, &ctbDbitList,
&ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib));
@ -1530,16 +1529,6 @@ void Implementation::setDetectorDataStream(const portPosition port,
<< " Port): " << sls::ToString(detectorDataStream[index]);
}
bool Implementation::getDeactivatedPadding() const {
return deactivatedPaddingEnable;
}
void Implementation::setDeactivatedPadding(bool enable) {
deactivatedPaddingEnable = enable;
LOG(logINFO) << "Deactivated Padding Enable: "
<< (deactivatedPaddingEnable ? "enabled" : "disabled");
}
int Implementation::getReadNRows() const { return readNRows; }
void Implementation::setReadNRows(const int value) {

View File

@ -215,9 +215,6 @@ class Implementation : private virtual slsDetectorDefs {
/** [Eiger] If datastream is disabled, receiver will create dummy data if deactivated
* padding for that port is enabled (as it will receive nothing from detector) */
void setDetectorDataStream(const portPosition port, const bool enable);
bool getDeactivatedPadding() const;
/* [Eiger] */
void setDeactivatedPadding(const bool enable);
int getReadNRows() const;
/* [Eiger][Jungfrau] */
void setReadNRows(const int value);
@ -351,7 +348,6 @@ class Implementation : private virtual slsDetectorDefs {
bool quadEnable{false};
bool activated{true};
std::array<bool, 2> detectorDataStream = {{true, true}};
bool deactivatedPaddingEnable{true};
int readNRows{0};
int thresholdEnergyeV{-1};
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};

View File

@ -22,11 +22,11 @@ const std::string Listener::TypeName = "Listener";
Listener::Listener(int ind, detectorType dtype, Fifo *f,
std::atomic<runStatus> *s, uint32_t *portno, std::string *e,
uint64_t *nf, int *us, int *as, uint32_t *fpf,
frameDiscardPolicy *fdp, bool *act, bool* detds, bool *depaden, bool *sm)
frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm)
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s),
udpPortNumber(portno), eth(e), numImages(nf), udpSocketBufferSize(us),
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
activated(act), detectorDataStream(detds), deactivatedPaddingEnable(depaden), silentMode(sm) {
activated(act), detectorDataStream(detds), silentMode(sm) {
LOG(logDEBUG) << "Listener " << ind << " created";
}
@ -299,24 +299,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
}
// deactivated (eiger)
if (!(*activated)) {
// no padding
if (!(*deactivatedPaddingEnable))
return 0;
// padding without setting bitmask (all missing packets padded in
// dataProcessor)
if (currentFrameIndex >= *numImages)
return 0;
//(eiger) first fnum starts at 1
if (!currentFrameIndex) {
++currentFrameIndex;
}
new_header->detHeader.frameNumber = currentFrameIndex;
new_header->detHeader.row = row;
new_header->detHeader.column = column;
new_header->detHeader.detType = (uint8_t)generalData->myDetectorType;
new_header->detHeader.version = (uint8_t)SLS_DETECTOR_HEADER_VERSION;
return imageSize;
return 0;
}
// look for carry over

View File

@ -38,13 +38,11 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
* @param fdp frame discard policy
* @param act pointer to activated
* @param detds pointer to detector data stream
* @param depaden pointer to deactivated padding enable
* @param sm pointer to silent mode
*/
Listener(int ind, detectorType dtype, Fifo *f, std::atomic<runStatus> *s,
uint32_t *portno, std::string *e, uint64_t *nf, int *us, int *as,
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool* detds, bool *depaden,
bool *sm);
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm);
/**
* Destructor
@ -191,9 +189,6 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
/** detector data stream */
bool* detectorDataStream;
/** Deactivated padding enable */
bool *deactivatedPaddingEnable;
/** Silent Mode */
bool *silentMode;

View File

@ -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,
@ -322,8 +320,6 @@ enum detFuncs {
F_GET_RECEIVER_DISCARD_POLICY,
F_SET_RECEIVER_PADDING,
F_GET_RECEIVER_PADDING,
F_SET_RECEIVER_DEACTIVATED_PADDING,
F_GET_RECEIVER_DEACTIVATED_PADDING,
F_RECEIVER_SET_READOUT_MODE,
F_RECEIVER_SET_ADC_MASK,
F_SET_RECEIVER_DBIT_LIST,
@ -427,7 +423,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 +609,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";
@ -678,8 +672,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_RECEIVER_DISCARD_POLICY: return "F_GET_RECEIVER_DISCARD_POLICY";
case F_SET_RECEIVER_PADDING: return "F_SET_RECEIVER_PADDING";
case F_GET_RECEIVER_PADDING: return "F_GET_RECEIVER_PADDING";
case F_SET_RECEIVER_DEACTIVATED_PADDING: return "F_SET_RECEIVER_DEACTIVATED_PADDING";
case F_GET_RECEIVER_DEACTIVATED_PADDING: return "F_GET_RECEIVER_DEACTIVATED_PADDING";
case F_RECEIVER_SET_READOUT_MODE: return "F_RECEIVER_SET_READOUT_MODE";
case F_RECEIVER_SET_ADC_MASK: return "F_RECEIVER_SET_ADC_MASK";
case F_SET_RECEIVER_DBIT_LIST: return "F_SET_RECEIVER_DBIT_LIST";