Merge branch 'developer' into programsync

This commit is contained in:
maliakal_d 2021-10-07 16:12:03 +02:00
commit 0482e3bc37
17 changed files with 21 additions and 172 deletions

View File

@ -188,7 +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
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.

View File

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

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

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

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

@ -177,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;
@ -1259,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

@ -128,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;
}
// 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

@ -320,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,
@ -674,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";