mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-07-12 10:51:50 +02:00
1d fixes
This commit is contained in:
@ -819,15 +819,17 @@ std::vector<defs::ROI> Caller::parseRoiVector(const std::string &input) {
|
|||||||
parts.push_back(num);
|
parts.push_back(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parts.size() != 4) {
|
if (parts.size() != 2 && parts.size() != 4) {
|
||||||
throw RuntimeError("ROI must have 4 comma-separated integers");
|
throw RuntimeError("ROI must have 2 or 4 comma-separated integers");
|
||||||
}
|
}
|
||||||
|
|
||||||
defs::ROI roi;
|
defs::ROI roi;
|
||||||
roi.xmin = StringTo<int>(parts[0]);
|
roi.xmin = StringTo<int>(parts[0]);
|
||||||
roi.xmax = StringTo<int>(parts[1]);
|
roi.xmax = StringTo<int>(parts[1]);
|
||||||
|
if (parts.size() == 4) {
|
||||||
roi.ymin = StringTo<int>(parts[2]);
|
roi.ymin = StringTo<int>(parts[2]);
|
||||||
roi.ymax = StringTo<int>(parts[3]);
|
roi.ymax = StringTo<int>(parts[3]);
|
||||||
|
}
|
||||||
rois.emplace_back(roi);
|
rois.emplace_back(roi);
|
||||||
}
|
}
|
||||||
return rois;
|
return rois;
|
||||||
|
@ -476,6 +476,8 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
} else {
|
} else {
|
||||||
auto prev_val = det.getRxROI();
|
auto prev_val = det.getRxROI();
|
||||||
defs::xy detsize = det.getDetectorSize();
|
defs::xy detsize = det.getDetectorSize();
|
||||||
|
auto portSize = det.getPortSize()[0];
|
||||||
|
int delta = 50;
|
||||||
|
|
||||||
// 1d
|
// 1d
|
||||||
if (det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3) {
|
if (det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3) {
|
||||||
@ -528,6 +530,19 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
"rx_roi [[5, 10], [" + stringMin + ", " + stringMax + "]]\n");
|
"rx_roi [[5, 10], [" + stringMin + ", " + stringMax + "]]\n");
|
||||||
|
|
||||||
|
// verify individual roi
|
||||||
|
{
|
||||||
|
stringMin = std::to_string(moduleSize.x - 50);
|
||||||
|
stringMax = std::to_string(moduleSize.x + 50);
|
||||||
|
std::ostringstream oss, oss1;
|
||||||
|
REQUIRE_NOTHROW(caller.call(
|
||||||
|
"rx_roi", {"[" + stringMin + ", " + stringMax + "]"}, -1, PUT, oss));
|
||||||
|
REQUIRE(oss.str() ==
|
||||||
|
"rx_roi [[" + stringMin + ", " + stringMax + "]]\n");
|
||||||
|
REQUIRE_NOTHROW(
|
||||||
|
caller.call("rx_roi", {}, 0, GET, oss1));
|
||||||
|
REQUIRE(oss1.str() == "rx_roi [[" + stringMin + ", " + std::to_string(moduleSize.x - 1) + "]]\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 2d eiger, jungfrau, moench
|
// 2d eiger, jungfrau, moench
|
||||||
@ -590,8 +605,7 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
|
|
||||||
int numinterfaces = det.getNumberofUDPInterfaces().tsquash(
|
int numinterfaces = det.getNumberofUDPInterfaces().tsquash(
|
||||||
"inconsistent number of interfaces");
|
"inconsistent number of interfaces");
|
||||||
auto portSize = det.getPortSize()[0];
|
|
||||||
int delta = 50;
|
|
||||||
// multiple ports horizontally
|
// multiple ports horizontally
|
||||||
if (det_type == defs::EIGER || (det.size() == 2 && det.getModuleGeometry().x > 1)) {
|
if (det_type == defs::EIGER || (det.size() == 2 && det.getModuleGeometry().x > 1)) {
|
||||||
std::string stringMin = std::to_string(portSize.x);
|
std::string stringMin = std::to_string(portSize.x);
|
||||||
@ -619,11 +633,11 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
caller.call("rx_roi", {}, 0, GET, oss1));
|
caller.call("rx_roi", {}, 0, GET, oss1));
|
||||||
// eiger returns 2 values for 2 ports per module
|
// eiger returns 2 values for 2 ports per module
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE(oss1.str() == "rx_roi [[" + stringMin + ", " + std::to_string(portSize.x - 1) + ", 20, 30], [" + std::to_string(portSize.x) + ", " + stringMax + ", 20, 30]]\n");
|
REQUIRE(oss1.str() == "rx_roi [[" + stringMin + ", " + std::to_string(portSize.x - 1) + ", 20, 30], [0, " + std::to_string(delta) + ", 20, 30]]\n");
|
||||||
}
|
}
|
||||||
// others return only 1 roi per module (1 port per module)
|
// others return only 1 roi per module (1 port per module)
|
||||||
else {
|
else {
|
||||||
REQUIRE(oss1.str() == "rx_roi [[" + stringMin + ", " + std::to_string(portSize.x - 1) + "20, 30]]\n");
|
REQUIRE(oss1.str() == "rx_roi [[" + stringMin + ", " + std::to_string(portSize.x - 1) + ", 20, 30]]\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -657,7 +671,7 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
|
|
||||||
// non-eiger with 2 interfaces returns 2 values for 2 ports per module
|
// non-eiger with 2 interfaces returns 2 values for 2 ports per module
|
||||||
if ((det_type == defs::JUNGFRAU || det_type == defs::MOENCH) && (numinterfaces == 2)) {
|
if ((det_type == defs::JUNGFRAU || det_type == defs::MOENCH) && (numinterfaces == 2)) {
|
||||||
REQUIRE(oss1.str() == "rx_roi [[20, 30, " + stringMin + ", " + std::to_string(portSize.y - 1) + "], [20, 30, " + std::to_string(portSize.y) + ", " + stringMax + "]]\n");
|
REQUIRE(oss1.str() == "rx_roi [[20, 30, " + stringMin + ", " + std::to_string(portSize.y - 1) + "], [20, 30, 0, " + std::to_string(delta) + "]]\n");
|
||||||
}
|
}
|
||||||
// others return only 1 roi per module (1 port per module)
|
// others return only 1 roi per module (1 port per module)
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user