flippeddataoverxaxis changed to flipRows

This commit is contained in:
maliakal_d 2021-08-05 14:44:25 +02:00
parent c5d6dd0dd4
commit 619f3b71c1
22 changed files with 143 additions and 126 deletions

View File

@ -63,7 +63,7 @@ This document describes the differences between 5.2.0 and 5.1.0 releases.
getAutoCompDisable->getAutoComparatorDisable getAutoCompDisable->getAutoComparatorDisable
setBottom->setFlippedDataAcrossXAxis setBottom->setFlipRows
3. Firmware Requirements 3. Firmware Requirements
======================== ========================

View File

@ -848,13 +848,13 @@ void init_det(py::module &m) {
(void (Detector::*)(bool, sls::Positions)) & (void (Detector::*)(bool, sls::Positions)) &
Detector::setOverFlowMode, Detector::setOverFlowMode,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getFlippedDataAcrossXAxis", .def("getFlipRows",
(Result<bool>(Detector::*)(sls::Positions) const) & (Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getFlippedDataAcrossXAxis, Detector::getFlipRows,
py::arg() = Positions{}) py::arg() = Positions{})
.def("setFlippedDataAcrossXAxis", .def("setFlipRows",
(void (Detector::*)(bool, sls::Positions)) & (void (Detector::*)(bool, sls::Positions)) &
Detector::setFlippedDataAcrossXAxis, Detector::setFlipRows,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getRateCorrection", .def("getRateCorrection",
(Result<sls::ns>(Detector::*)(sls::Positions) const) & (Result<sls::ns>(Detector::*)(sls::Positions) const) &

View File

@ -474,7 +474,7 @@ void setupDetector() {
// temp threshold and reset event // temp threshold and reset event
setThresholdTemperature(DEFAULT_TMP_THRSHLD); setThresholdTemperature(DEFAULT_TMP_THRSHLD);
setTemperatureEvent(0); setTemperatureEvent(0);
setFlippedDataAcrossXAxis(0); setFlipRows(0);
} }
int resetToDefaultDacs(int hardReset) { int resetToDefaultDacs(int hardReset) {
@ -2003,19 +2003,19 @@ void alignDeserializer() {
bus_r(ADC_DSRLZR_3_REG) & (~(ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK))); bus_r(ADC_DSRLZR_3_REG) & (~(ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK)));
} }
int getFlippedDataAcrossXAxis() { int getFlipRows() {
return ((bus_r(CONFIG_REG) & CONFIG_BOTTOM_INVERT_STREAM_MSK) >> return ((bus_r(CONFIG_REG) & CONFIG_BOTTOM_INVERT_STREAM_MSK) >>
CONFIG_BOTTOM_INVERT_STREAM_OFST); CONFIG_BOTTOM_INVERT_STREAM_OFST);
} }
void setFlippedDataAcrossXAxis(int arg) { void setFlipRows(int arg) {
if (arg >= 0) { if (arg >= 0) {
if (arg == 0) { if (arg == 0) {
LOG(logINFO, ("Switching off bottom flipping\n")); LOG(logINFO, ("Switching off bottom row flipping\n"));
bus_w(CONFIG_REG, bus_w(CONFIG_REG,
bus_r(CONFIG_REG) & ~CONFIG_BOTTOM_INVERT_STREAM_MSK); bus_r(CONFIG_REG) & ~CONFIG_BOTTOM_INVERT_STREAM_MSK);
} else { } else {
LOG(logINFO, ("Switching on bottom flipping\n")); LOG(logINFO, ("Switching on bottom row flipping\n"));
bus_w(CONFIG_REG, bus_w(CONFIG_REG,
bus_r(CONFIG_REG) | CONFIG_BOTTOM_INVERT_STREAM_MSK); bus_r(CONFIG_REG) | CONFIG_BOTTOM_INVERT_STREAM_MSK);
} }

View File

@ -460,8 +460,8 @@ int setThresholdTemperature(int val);
int setTemperatureControl(int val); int setTemperatureControl(int val);
int setTemperatureEvent(int val); int setTemperatureEvent(int val);
void alignDeserializer(); void alignDeserializer();
int getFlippedDataAcrossXAxis(); int getFlipRows();
void setFlippedDataAcrossXAxis(int arg); void setFlipRows(int arg);
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter // eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
#elif EIGERD #elif EIGERD

View File

@ -261,5 +261,5 @@ int get_gain_mode(int);
int set_gain_mode(int); int set_gain_mode(int);
int get_comp_disable_time(int); int get_comp_disable_time(int);
int set_comp_disable_time(int); int set_comp_disable_time(int);
int get_flipped_data_x(int); int get_flip_rows(int);
int set_flipped_data_x(int); int set_flip_rows(int);

View File

@ -386,8 +386,8 @@ void function_table() {
flist[F_SET_GAIN_MODE] = &set_gain_mode; flist[F_SET_GAIN_MODE] = &set_gain_mode;
flist[F_GET_COMP_DISABLE_TIME] = &get_comp_disable_time; flist[F_GET_COMP_DISABLE_TIME] = &get_comp_disable_time;
flist[F_SET_COMP_DISABLE_TIME] = &set_comp_disable_time; flist[F_SET_COMP_DISABLE_TIME] = &set_comp_disable_time;
flist[F_GET_FLIPPED_DATA_X] = &get_flipped_data_x; flist[F_GET_FLIP_ROWS] = &get_flip_rows;
flist[F_SET_FLIPPED_DATA_X] = &set_flipped_data_x; flist[F_SET_FLIP_ROWS] = &set_flip_rows;
// check // check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) { if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -8679,31 +8679,31 @@ int set_comp_disable_time(int file_des) {
return Server_SendResult(file_des, INT64, NULL, 0); return Server_SendResult(file_des, INT64, NULL, 0);
} }
int get_flipped_data_x(int file_des) { int get_flip_rows(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int retval = -1; int retval = -1;
LOG(logDEBUG1, ("Getting flipped data x\n")); LOG(logDEBUG1, ("Getting flip rows\n"));
#ifndef JUNGFRAUD #ifndef JUNGFRAUD
functionNotImplemented(); functionNotImplemented();
#else #else
// get only // get only
retval = getFlippedDataAcrossXAxis(); retval = getFlipRows();
LOG(logDEBUG1, ("flippeddatax retval: %u\n", retval)); LOG(logDEBUG1, ("flip rows retval: %u\n", retval));
#endif #endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
} }
int set_flipped_data_x(int file_des) { int set_flip_rows(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int arg = -1; int arg = -1;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
LOG(logINFO, ("Setting flipped data x: %u\n", (int)arg)); LOG(logINFO, ("Setting flip rows: %u\n", (int)arg));
#ifndef JUNGFRAUD #ifndef JUNGFRAUD
functionNotImplemented(); functionNotImplemented();
@ -8714,26 +8714,26 @@ int set_flipped_data_x(int file_des) {
if (arg != 0 && arg != 1) { if (arg != 0 && arg != 1) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set flipped data x. Invalid argument %d.\n", "Could not set flip rows. Invalid argument %d.\n",
arg); arg);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
// only for HW 2.0 (version = 3) // only for HW 2.0 (version = 3)
else if (isHardwareVersion2()) { else if (isHardwareVersion2()) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not set flipped data x. Only available for " strcpy(mess, "Could not set flip rows. Only available for "
"Hardware Board version 2.0.\n"); "Hardware Board version 2.0.\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if (getNumberofUDPInterfaces() == 1) { } else if (getNumberofUDPInterfaces() == 1) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not set flipped data x. Number of udp " strcpy(mess, "Could not set flip rows. Number of udp "
"interfaces is still 1.\n"); "interfaces is still 1.\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
setFlippedDataAcrossXAxis(arg); setFlipRows(arg);
int retval = getFlippedDataAcrossXAxis(); int retval = getFlipRows();
LOG(logDEBUG1, ("flippeddatax retval: %u\n", retval)); LOG(logDEBUG1, ("flip rows retval: %u\n", retval));
validate(&ret, mess, arg, retval, "set flipped data x", DEC); validate(&ret, mess, arg, retval, "set flip rows", DEC);
} }
} }
#endif #endif

View File

@ -173,13 +173,15 @@ class Detector {
void setGapPixelsinCallback(const bool enable); void setGapPixelsinCallback(const bool enable);
/** [Eiger][Jungfrau] */ /** [Eiger][Jungfrau] */
Result<bool> getFlippedDataAcrossXAxis(Positions pos = {}) const; Result<bool> getFlipRows(Positions pos = {}) const;
/** [Eiger] flips across x Axis paramater sent to slsreceiver to send to gui /** [Eiger] flips rows paramater sent to slsreceiver to stream as json
* (via zmq) to flip bottom [Jungfrau] flips data across x Axis in the * parameter to flip rows in gui \n[Jungfrau] flips rows in the detector
* detector itself. slsReceiver and slsDetectorGui does not handle. * itself. For bottom module and number of interfaces must be set to 2.
* slsReceiver and slsDetectorGui does not handle.slsReceiver and
* slsDetectorGui does not handle
*/ */
void setFlippedDataAcrossXAxis(bool value, Positions pos = {}); void setFlipRows(bool value, Positions pos = {});
Result<bool> isVirtualDetectorServer(Positions pos = {}) const; Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
///@{ ///@{

View File

@ -584,6 +584,7 @@ class CmdProxy {
{"detsizechan", "detsize"}, {"detsizechan", "detsize"},
{"trimdir", "settingspath"}, {"trimdir", "settingspath"},
{"settingsdir", "settingspath"}, {"settingsdir", "settingspath"},
{"flippeddatax", "fliprows"},
/* acquisition parameters */ /* acquisition parameters */
{"cycles", "triggers"}, {"cycles", "triggers"},
@ -769,7 +770,7 @@ class CmdProxy {
{"trimval", &CmdProxy::trimval}, {"trimval", &CmdProxy::trimval},
{"trimen", &CmdProxy::TrimEnergies}, {"trimen", &CmdProxy::TrimEnergies},
{"gappixels", &CmdProxy::GapPixels}, {"gappixels", &CmdProxy::GapPixels},
{"flippeddatax", &CmdProxy::flippeddatax}, {"fliprows", &CmdProxy::fliprows},
/* acquisition parameters */ /* acquisition parameters */
{"acquire", &CmdProxy::Acquire}, {"acquire", &CmdProxy::Acquire},
@ -1234,14 +1235,12 @@ class CmdProxy {
"value. Returns -1 if all trimbits are different values."); "value. Returns -1 if all trimbits are different values.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
flippeddatax, getFlippedDataAcrossXAxis, setFlippedDataAcrossXAxis, fliprows, getFlipRows, setFlipRows, StringTo<int>,
StringTo<int>, "[0, 1]\n\t[Eiger] flips rows paramater sent to slsreceiver "
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 " "to stream as json parameter to flip rows in gui \n\t[Jungfrau] flips "
"is top. Used to let Gui (via zmq from receiver) know to flip the " "rows in the detector itself. For bottom module and number of "
"bottom image over the x axis. Files are not written without the flip " "interfaces must be set to 2. slsReceiver and slsDetectorGui "
"however.\n\t[Jungfrau] If enabled, the bottom is flipped across the x " "does not handle.");
"axis from the detector. The slsReceiver nor the Gui handles this "
"parameter.");
/* acquisition parameters */ /* acquisition parameters */

View File

@ -279,12 +279,12 @@ void Detector::setGapPixelsinCallback(bool enable) {
pimpl->setGapPixelsinCallback(enable); pimpl->setGapPixelsinCallback(enable);
} }
Result<bool> Detector::getFlippedDataAcrossXAxis(Positions pos) const { Result<bool> Detector::getFlipRows(Positions pos) const {
return pimpl->Parallel(&Module::getFlippedDataAcrossXAxis, pos); return pimpl->Parallel(&Module::getFlipRows, pos);
} }
void Detector::setFlippedDataAcrossXAxis(bool value, Positions pos) { void Detector::setFlipRows(bool value, Positions pos) {
pimpl->Parallel(&Module::setFlippedDataAcrossXAxis, pos, value); pimpl->Parallel(&Module::setFlipRows, pos, value);
} }
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const { Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {

View File

@ -490,8 +490,7 @@ void DetectorImpl::readFrameFromReceiver() {
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1, uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1,
currentFileIndex = -1; currentFileIndex = -1;
double currentProgress = 0.00; double currentProgress = 0.00;
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, flipRows = -1;
flippedDataX = -1;
while (numZmqRunning != 0) { while (numZmqRunning != 0) {
// reset data // reset data
@ -571,7 +570,7 @@ void DetectorImpl::readFrameFromReceiver() {
if (eiger) { if (eiger) {
coordY = (nY - 1) - coordY; coordY = (nY - 1) - coordY;
} }
flippedDataX = zHeader.flippedDataX; flipRows = zHeader.flipRows;
if (zHeader.completeImage == 0) { if (zHeader.completeImage == 0) {
completeImage = false; completeImage = false;
} }
@ -585,7 +584,7 @@ void DetectorImpl::readFrameFromReceiver() {
<< "\n\tcurrentSubFrameIndex: " << currentSubFrameIndex << "\n\tcurrentSubFrameIndex: " << currentSubFrameIndex
<< "\n\tcurrentProgress: " << currentProgress << "\n\tcurrentProgress: " << currentProgress
<< "\n\tcoordX: " << coordX << "\n\tcoordY: " << coordY << "\n\tcoordX: " << coordX << "\n\tcoordY: " << coordY
<< "\n\tflippedDataX: " << flippedDataX << "\n\tflipRows: " << flipRows
<< "\n\tcompleteImage: " << completeImage; << "\n\tcompleteImage: " << completeImage;
} }
@ -609,7 +608,7 @@ void DetectorImpl::readFrameFromReceiver() {
<< "\n\tsingledetrowoffset: " << singledetrowoffset << "\n\tsingledetrowoffset: " << singledetrowoffset
<< "\n\trowoffset: " << rowoffset; << "\n\trowoffset: " << rowoffset;
if (eiger && (flippedDataX != 0U)) { if (eiger && (flipRows != 0U)) {
for (uint32_t i = 0; i < nPixelsY; ++i) { for (uint32_t i = 0; i < nPixelsY; ++i) {
memcpy((multiframe.get()) + memcpy((multiframe.get()) +
((yoffset + (nPixelsY - 1 - i)) * ((yoffset + (nPixelsY - 1 - i)) *

View File

@ -458,19 +458,18 @@ int Module::setTrimEn(const std::vector<int> &energies) {
return shm()->trimEnergies.size(); return shm()->trimEnergies.size();
} }
bool Module::getFlippedDataAcrossXAxis() const { bool Module::getFlipRows() const {
if (shm()->myDetectorType == EIGER) { if (shm()->myDetectorType == EIGER) {
return sendToReceiver<int>(F_SET_FLIPPED_DATA_RECEIVER, GET_FLAG); return sendToReceiver<int>(F_GET_FLIP_ROWS_RECEIVER);
} }
return sendToDetector<int>(F_GET_FLIPPED_DATA_X); return sendToDetector<int>(F_GET_FLIP_ROWS);
} }
void Module::setFlippedDataAcrossXAxis(bool value) { void Module::setFlipRows(bool value) {
if (shm()->myDetectorType == EIGER) { if (shm()->myDetectorType == EIGER) {
sendToReceiver<int>(F_SET_FLIPPED_DATA_RECEIVER, sendToReceiver<int>(F_SET_FLIP_ROWS_RECEIVER, static_cast<int>(value));
static_cast<int>(value));
} else { } else {
sendToDetector(F_SET_FLIPPED_DATA_X, static_cast<int>(value), nullptr); sendToDetector(F_SET_FLIP_ROWS, static_cast<int>(value), nullptr);
} }
} }

View File

@ -114,8 +114,8 @@ class Module : public virtual slsDetectorDefs {
void setAllTrimbits(int val); void setAllTrimbits(int val);
std::vector<int> getTrimEn() const; std::vector<int> getTrimEn() const;
int setTrimEn(const std::vector<int> &energies = {}); int setTrimEn(const std::vector<int> &energies = {});
bool getFlippedDataAcrossXAxis() const; bool getFlipRows() const;
void setFlippedDataAcrossXAxis(bool value); void setFlipRows(bool value);
bool isVirtualDetectorServer() const; bool isVirtualDetectorServer() const;
/************************************************** /**************************************************

View File

@ -510,31 +510,31 @@ TEST_CASE("gappixels", "[.cmd]") {
} }
} }
TEST_CASE("flippeddatax", "[.cmd]") { TEST_CASE("fliprows", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) { if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
auto previous = det.getFlippedDataAcrossXAxis(); auto previous = det.getFlipRows();
auto previous_numudp = det.getNumberofUDPInterfaces(); auto previous_numudp = det.getNumberofUDPInterfaces();
if (det_type == defs::JUNGFRAU) { if (det_type == defs::JUNGFRAU) {
det.setNumberofUDPInterfaces(2); det.setNumberofUDPInterfaces(2);
} }
std::ostringstream oss1, oss2, oss3; std::ostringstream oss1, oss2, oss3;
proxy.Call("flippeddatax", {"1"}, -1, PUT, oss1); proxy.Call("fliprows", {"1"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "flippeddatax 1\n"); REQUIRE(oss1.str() == "fliprows 1\n");
proxy.Call("flippeddatax", {}, -1, GET, oss2); proxy.Call("fliprows", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "flippeddatax 1\n"); REQUIRE(oss2.str() == "fliprows 1\n");
proxy.Call("flippeddatax", {"0"}, -1, PUT, oss3); proxy.Call("fliprows", {"0"}, -1, PUT, oss3);
REQUIRE(oss3.str() == "flippeddatax 0\n"); REQUIRE(oss3.str() == "fliprows 0\n");
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFlippedDataAcrossXAxis(previous[i], {i}); det.setFlipRows(previous[i], {i});
if (det_type == defs::JUNGFRAU) { if (det_type == defs::JUNGFRAU) {
det.setNumberofUDPInterfaces(previous_numudp[i], {i}); det.setNumberofUDPInterfaces(previous_numudp[i], {i});
} }
} }
} else { } else {
REQUIRE_THROWS(proxy.Call("flippeddatax", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("fliprows", {}, -1, GET));
} }
} }

View File

@ -156,7 +156,8 @@ int ClientInterface::functionTable(){
flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming; flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming;
flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming; flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
flist[F_RECEIVER_STREAMING_TIMER] = &ClientInterface::set_streaming_timer; flist[F_RECEIVER_STREAMING_TIMER] = &ClientInterface::set_streaming_timer;
flist[F_SET_FLIPPED_DATA_RECEIVER] = &ClientInterface::set_flipped_data; flist[F_GET_FLIP_ROWS_RECEIVER] = &ClientInterface::get_flip_rows;
flist[F_SET_FLIP_ROWS_RECEIVER] = &ClientInterface::set_flip_rows;
flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format; flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format;
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format; flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port; flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
@ -1020,20 +1021,32 @@ int ClientInterface::set_streaming_timer(Interface &socket) {
return socket.sendResult(retval); return socket.sendResult(retval);
} }
int ClientInterface::set_flipped_data(Interface &socket) { int ClientInterface::get_flip_rows(Interface &socket) {
if (myDetectorType != EIGER)
functionNotImplemented();
int retval = impl()->getFlipRows();
LOG(logDEBUG1) << "Flip rows:" << retval;
return socket.sendResult(retval);
}
int ClientInterface::set_flip_rows(Interface &socket) {
auto arg = socket.Receive<int>(); auto arg = socket.Receive<int>();
if (myDetectorType != EIGER) if (myDetectorType != EIGER)
functionNotImplemented(); functionNotImplemented();
if (arg >= 0) { if (arg != 0 && arg != 1) {
verifyIdle(socket); throw RuntimeError("Could not set flip rows. Invalid argument: " +
LOG(logDEBUG1) << "Setting flipped data:" << arg; std::to_string(arg));
impl()->setFlippedDataX(arg);
} }
int retval = impl()->getFlippedDataX(); verifyIdle(socket);
validate(arg, retval, std::string("set flipped data"), DEC); LOG(logDEBUG1) << "Setting flip rows:" << arg;
LOG(logDEBUG1) << "Flipped Data:" << retval; impl()->setFlipRows(static_cast<bool>(arg));
int retval = impl()->getFlipRows();
validate(arg, retval, std::string("set flip rows"), DEC);
LOG(logDEBUG1) << "Flip rows:" << retval;
return socket.sendResult(retval); return socket.sendResult(retval);
} }

View File

@ -107,7 +107,8 @@ class ClientInterface : private virtual slsDetectorDefs {
int set_streaming(sls::ServerInterface &socket); int set_streaming(sls::ServerInterface &socket);
int get_streaming(sls::ServerInterface &socket); int get_streaming(sls::ServerInterface &socket);
int set_streaming_timer(sls::ServerInterface &socket); int set_streaming_timer(sls::ServerInterface &socket);
int set_flipped_data(sls::ServerInterface &socket); int get_flip_rows(sls::ServerInterface &socket);
int set_flip_rows(sls::ServerInterface &socket);
int set_file_format(sls::ServerInterface &socket); int set_file_format(sls::ServerInterface &socket);
int get_file_format(sls::ServerInterface &socket); int get_file_format(sls::ServerInterface &socket);
int set_streaming_port(sls::ServerInterface &socket); int set_streaming_port(sls::ServerInterface &socket);

View File

@ -15,9 +15,9 @@
const std::string DataStreamer::TypeName = "DataStreamer"; const std::string DataStreamer::TypeName = "DataStreamer";
DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
int fd, int *nm, bool *qe, uint64_t *tot) bool fr, int *nm, bool *qe, uint64_t *tot)
: ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), roi(r), : ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), roi(r),
fileIndex(fi), flippedDataX(fd), quadEnable(qe), totalNumFrames(tot) { fileIndex(fi), flipRows(fr), quadEnable(qe), totalNumFrames(tot) {
numMods[0] = nm[0]; numMods[0] = nm[0];
numMods[1] = nm[1]; numMods[1] = nm[1];
@ -65,7 +65,7 @@ void DataStreamer::SetNumberofModules(int *nm) {
numMods[1] = nm[1]; numMods[1] = nm[1];
} }
void DataStreamer::SetFlippedDataX(int fd) { flippedDataX = fd; } void DataStreamer::SetFlipRows(bool fd) { flipRows = fd; }
void DataStreamer::SetAdditionalJsonHeader( void DataStreamer::SetAdditionalJsonHeader(
const std::map<std::string, std::string> &json) { const std::map<std::string, std::string> &json) {
@ -240,7 +240,7 @@ int DataStreamer::SendHeader(sls_receiver_header *rheader, uint32_t size,
zHeader.roundRNumber = header.roundRNumber; zHeader.roundRNumber = header.roundRNumber;
zHeader.detType = header.detType; zHeader.detType = header.detType;
zHeader.version = header.version; zHeader.version = header.version;
zHeader.flippedDataX = flippedDataX; zHeader.flipRows = static_cast<int>(flipRows);
zHeader.quad = *quadEnable; zHeader.quad = *quadEnable;
zHeader.completeImage = zHeader.completeImage =
(header.packetNumber < generalData->packetsPerFrame ? false : true); (header.packetNumber < generalData->packetsPerFrame ? false : true);

View File

@ -30,12 +30,12 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
* @param dr pointer to dynamic range * @param dr pointer to dynamic range
* @param r roi * @param r roi
* @param fi pointer to file index * @param fi pointer to file index
* @param fd flipped data enable for x dimension * @param fr flip rows
* @param nm pointer to number of modules in each dimension * @param nm pointer to number of modules in each dimension
* @param qe pointer to quad Enable * @param qe pointer to quad Enable
* @param tot pointer to total number of frames * @param tot pointer to total number of frames
*/ */
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, int fd, DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
int *nm, bool *qe, uint64_t *tot); int *nm, bool *qe, uint64_t *tot);
/** /**
@ -68,10 +68,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
void SetNumberofModules(int *nm); void SetNumberofModules(int *nm);
/** /**
* Set Flipped data enable across x dimension * Set Flipped rows
* @param fd data enable in x dimension * @param fd flip rows enable
*/ */
void SetFlippedDataX(int fd); void SetFlipRows(bool fd);
/** /**
* Set additional json header * Set additional json header
@ -165,8 +165,8 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
/** Pointer to file index */ /** Pointer to file index */
uint64_t *fileIndex; uint64_t *fileIndex;
/** flipped data across x axis */ /** flip rows */
int flippedDataX; bool flipRows;
/** additional json header */ /** additional json header */
std::map<std::string, std::string> additionalJsonHeader; std::map<std::string, std::string> additionalJsonHeader;

View File

@ -893,15 +893,15 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
// streamer threads // streamer threads
if (dataStreamEnable) { if (dataStreamEnable) {
try { try {
int fd = flippedDataX; bool flip = flipRows;
int nm[2] = {numMods[0], numMods[1]}; int nm[2] = {numMods[0], numMods[1]};
if (quadEnable) { if (quadEnable) {
fd = i; flip = (i == 1 ? true : false);
nm[0] = 1; nm[0] = 1;
nm[1] = 2; nm[1] = 2;
} }
dataStreamer.push_back(sls::make_unique<DataStreamer>( dataStreamer.push_back(sls::make_unique<DataStreamer>(
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, fd, i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
(int *)nm, &quadEnable, &numberOfTotalFrames)); (int *)nm, &quadEnable, &numberOfTotalFrames));
dataStreamer[i]->SetGeneralData(generalData); dataStreamer[i]->SetGeneralData(generalData);
dataStreamer[i]->CreateZmqSockets( dataStreamer[i]->CreateZmqSockets(
@ -1022,15 +1022,15 @@ void Implementation::setDataStreamEnable(const bool enable) {
if (enable) { if (enable) {
for (int i = 0; i < numThreads; ++i) { for (int i = 0; i < numThreads; ++i) {
try { try {
int fd = flippedDataX; bool flip = flipRows;
int nm[2] = {numMods[0], numMods[1]}; int nm[2] = {numMods[0], numMods[1]};
if (quadEnable) { if (quadEnable) {
fd = i; flip = (i == 1 ? true : false);
nm[0] = 1; nm[0] = 1;
nm[1] = 2; nm[1] = 2;
} }
dataStreamer.push_back(sls::make_unique<DataStreamer>( dataStreamer.push_back(sls::make_unique<DataStreamer>(
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, fd, i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
(int *)nm, &quadEnable, &numberOfTotalFrames)); (int *)nm, &quadEnable, &numberOfTotalFrames));
dataStreamer[i]->SetGeneralData(generalData); dataStreamer[i]->SetGeneralData(generalData);
dataStreamer[i]->CreateZmqSockets( dataStreamer[i]->CreateZmqSockets(
@ -1458,22 +1458,24 @@ void Implementation::setTenGigaEnable(const bool b) {
LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
} }
int Implementation::getFlippedDataX() const { return flippedDataX; } bool Implementation::getFlipRows() const { return flipRows; }
void Implementation::setFlippedDataX(int enable) { void Implementation::setFlipRows(bool enable) {
flippedDataX = (enable == 0) ? 0 : 1; flipRows = enable;
if (!quadEnable) { if (!quadEnable) {
for (const auto &it : dataStreamer) { for (const auto &it : dataStreamer) {
it->SetFlippedDataX(flippedDataX); it->SetFlipRows(flipRows);
} }
} else { }
// quad
else {
if (dataStreamer.size() == 2) { if (dataStreamer.size() == 2) {
dataStreamer[0]->SetFlippedDataX(0); dataStreamer[0]->SetFlipRows(false);
dataStreamer[1]->SetFlippedDataX(1); dataStreamer[1]->SetFlipRows(true);
} }
} }
LOG(logINFO) << "Flipped Data X: " << flippedDataX; LOG(logINFO) << "Flip Rows: " << flipRows;
} }
bool Implementation::getQuad() const { return quadEnable; } bool Implementation::getQuad() const { return quadEnable; }
@ -1485,7 +1487,7 @@ void Implementation::setQuad(const bool b) {
if (!quadEnable) { if (!quadEnable) {
for (const auto &it : dataStreamer) { for (const auto &it : dataStreamer) {
it->SetNumberofModules(numMods); it->SetNumberofModules(numMods);
it->SetFlippedDataX(flippedDataX); it->SetFlipRows(flipRows);
} }
} else { } else {
int size[2] = {1, 2}; int size[2] = {1, 2};
@ -1493,8 +1495,8 @@ void Implementation::setQuad(const bool b) {
it->SetNumberofModules(size); it->SetNumberofModules(size);
} }
if (dataStreamer.size() == 2) { if (dataStreamer.size() == 2) {
dataStreamer[0]->SetFlippedDataX(0); dataStreamer[0]->SetFlipRows(false);
dataStreamer[1]->SetFlippedDataX(1); dataStreamer[1]->SetFlipRows(true);
} }
} }
} }

View File

@ -202,8 +202,8 @@ class Implementation : private virtual slsDetectorDefs {
bool getTenGigaEnable() const; bool getTenGigaEnable() const;
/* [Eiger][Ctb] */ /* [Eiger][Ctb] */
void setTenGigaEnable(const bool b); void setTenGigaEnable(const bool b);
int getFlippedDataX() const; bool getFlipRows() const;
void setFlippedDataX(int enable = -1); void setFlipRows(bool enable);
bool getQuad() const; bool getQuad() const;
/* [Eiger] */ /* [Eiger] */
void setQuad(const bool b); void setQuad(const bool b);
@ -347,7 +347,7 @@ class Implementation : private virtual slsDetectorDefs {
uint32_t dynamicRange{16}; uint32_t dynamicRange{16};
ROI roi{}; ROI roi{};
bool tengigaEnable{false}; bool tengigaEnable{false};
int flippedDataX{0}; bool flipRows{false};
bool quadEnable{false}; bool quadEnable{false};
bool activated{true}; bool activated{true};
std::array<bool, 2> detectorDataStream = {{true, true}}; std::array<bool, 2> detectorDataStream = {{true, true}};

View File

@ -58,8 +58,8 @@ struct zmqHeader {
uint16_t roundRNumber{0}; uint16_t roundRNumber{0};
uint8_t detType{0}; uint8_t detType{0};
uint8_t version{0}; uint8_t version{0};
/** if image should be flipped across x axis */ /** if rows of image should be flipped */
int flippedDataX{0}; int flipRows{0};
/** quad type (eiger hardware specific) */ /** quad type (eiger hardware specific) */
uint32_t quad{0}; uint32_t quad{0};
/** true if complete image, else missing packets */ /** true if complete image, else missing packets */

View File

@ -237,8 +237,8 @@ enum detFuncs {
F_SET_GAIN_MODE, F_SET_GAIN_MODE,
F_GET_COMP_DISABLE_TIME, F_GET_COMP_DISABLE_TIME,
F_SET_COMP_DISABLE_TIME, F_SET_COMP_DISABLE_TIME,
F_GET_FLIPPED_DATA_X, F_GET_FLIP_ROWS,
F_SET_FLIPPED_DATA_X, F_SET_FLIP_ROWS,
NUM_DET_FUNCTIONS, NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
@ -289,7 +289,8 @@ enum detFuncs {
F_SET_RECEIVER_STREAMING, F_SET_RECEIVER_STREAMING,
F_GET_RECEIVER_STREAMING, F_GET_RECEIVER_STREAMING,
F_RECEIVER_STREAMING_TIMER, F_RECEIVER_STREAMING_TIMER,
F_SET_FLIPPED_DATA_RECEIVER, F_GET_FLIP_ROWS_RECEIVER,
F_SET_FLIP_ROWS_RECEIVER,
F_SET_RECEIVER_FILE_FORMAT, F_SET_RECEIVER_FILE_FORMAT,
F_GET_RECEIVER_FILE_FORMAT, F_GET_RECEIVER_FILE_FORMAT,
F_SET_RECEIVER_STREAMING_PORT, F_SET_RECEIVER_STREAMING_PORT,
@ -582,8 +583,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_GAIN_MODE: return "F_SET_GAIN_MODE"; case F_SET_GAIN_MODE: return "F_SET_GAIN_MODE";
case F_GET_COMP_DISABLE_TIME: return "F_GET_COMP_DISABLE_TIME"; case F_GET_COMP_DISABLE_TIME: return "F_GET_COMP_DISABLE_TIME";
case F_SET_COMP_DISABLE_TIME: return "F_SET_COMP_DISABLE_TIME"; case F_SET_COMP_DISABLE_TIME: return "F_SET_COMP_DISABLE_TIME";
case F_GET_FLIPPED_DATA_X: return "F_GET_FLIPPED_DATA_X"; case F_GET_FLIP_ROWS: return "F_GET_FLIP_ROWS";
case F_SET_FLIPPED_DATA_X: return "F_SET_FLIPPED_DATA_X"; case F_SET_FLIP_ROWS: return "F_SET_FLIP_ROWS";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
@ -633,7 +634,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING"; case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING";
case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING"; case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING";
case F_RECEIVER_STREAMING_TIMER: return "F_RECEIVER_STREAMING_TIMER"; case F_RECEIVER_STREAMING_TIMER: return "F_RECEIVER_STREAMING_TIMER";
case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER"; case F_GET_FLIP_ROWS_RECEIVER: return "F_GET_FLIP_ROWS_RECEIVER";
case F_SET_FLIP_ROWS_RECEIVER: return "F_SET_FLIP_ROWS_RECEIVER";
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT"; case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT"; case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT"; case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";

View File

@ -160,7 +160,7 @@ int ZmqSocket::SendHeader(int index, zmqHeader header) {
"\"version\":%u, " "\"version\":%u, "
// additional stuff // additional stuff
"\"flippedDataX\":%u, " "\"flipRows\":%u, "
"\"quad\":%u" "\"quad\":%u"
; //"}\n"; ; //"}\n";
@ -177,7 +177,7 @@ int ZmqSocket::SendHeader(int index, zmqHeader header) {
header.detType, header.version, header.detType, header.version,
// additional stuff // additional stuff
header.flippedDataX, header.quad); header.flipRows, header.quad);
if (!header.addJsonHeader.empty()) { if (!header.addJsonHeader.empty()) {
strcat(header_buffer.get(), ", "); strcat(header_buffer.get(), ", ");
@ -303,7 +303,7 @@ int ZmqSocket::ParseHeader(const int index, int length, char *buff,
zHeader.detType = document["detType"].GetUint(); zHeader.detType = document["detType"].GetUint();
zHeader.version = document["version"].GetUint(); zHeader.version = document["version"].GetUint();
zHeader.flippedDataX = document["flippedDataX"].GetUint(); zHeader.flipRows = document["flipRows"].GetUint();
zHeader.quad = document["quad"].GetUint(); zHeader.quad = document["quad"].GetUint();
zHeader.completeImage = document["completeImage"].GetUint(); zHeader.completeImage = document["completeImage"].GetUint();