mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-26 03:21:09 +02:00
fixed rx_roi for multi modules jungfrau , tests for eiger, multi modules jungfrau in x and 2 interfaces
This commit is contained in:
@ -587,8 +587,13 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
REQUIRE_THROWS(caller.call(
|
REQUIRE_THROWS(caller.call(
|
||||||
"rx_roi", {"[0, 10, 0, 10];[0, 10, 9, 11]"}, -1, PUT));
|
"rx_roi", {"[0, 10, 0, 10];[0, 10, 9, 11]"}, -1, PUT));
|
||||||
|
|
||||||
|
|
||||||
|
int numinterfaces = det.getNumberofUDPInterfaces().tsquash(
|
||||||
|
"inconsistent number of interfaces");
|
||||||
auto portSize = det.getPortSize()[0];
|
auto portSize = det.getPortSize()[0];
|
||||||
if (det_type == defs::EIGER) {
|
int delta = 50;
|
||||||
|
// multiple ports horizontally
|
||||||
|
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);
|
||||||
std::string stringMax = std::to_string(portSize.x + 1);
|
std::string stringMax = std::to_string(portSize.x + 1);
|
||||||
|
|
||||||
@ -601,48 +606,60 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
"rx_roi", {"[5, 10, 20, 30];[" + stringMin + ", " + stringMax + ", 20, 30]"}, -1, PUT, oss));
|
"rx_roi", {"[5, 10, 20, 30];[" + stringMin + ", " + stringMax + ", 20, 30]"}, -1, PUT, oss));
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
"rx_roi [[5, 10, 20, 30], [" + stringMin + ", " + stringMax + ", 20, 30]]\n");
|
"rx_roi [[5, 10, 20, 30], [" + stringMin + ", " + stringMax + ", 20, 30]]\n");
|
||||||
}
|
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
// verify individual roi
|
||||||
// 2 interfaces or 2 modules
|
{
|
||||||
if ((det.getNumberofUDPInterfaces().tsquash(
|
stringMin = std::to_string(portSize.x - delta);
|
||||||
"inconsistent number of interfaces") == 2) || (det.size() == 2)) {
|
stringMax = std::to_string(portSize.x + delta);
|
||||||
std::string stringMin = std::to_string(portSize.y);
|
std::ostringstream oss, oss1;
|
||||||
std::string stringMax = std::to_string(portSize.y + 1);
|
REQUIRE_NOTHROW(caller.call(
|
||||||
if (det.size() == 2) {
|
"rx_roi", {"[" + stringMin + ", " + stringMax + ", 20, 30]"}, -1, PUT, oss));
|
||||||
auto moduleSize = det.getModuleSize()[0];
|
REQUIRE(oss.str() == "rx_roi [[" + stringMin + ", " + stringMax + ", 20, 30]]\n");
|
||||||
stringMin = std::to_string(moduleSize.y);
|
REQUIRE_NOTHROW(
|
||||||
stringMax = std::to_string(moduleSize.y + 1);
|
caller.call("rx_roi", {}, 0, GET, oss1));
|
||||||
|
// eiger returns 2 values for 2 ports per module
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
REQUIRE(oss1.str() == "rx_roi [[[" + stringMin + ", " + std::to_string(portSize.x - 1) + "20, 30], [" + std::to_string(portSize.x + 1) + ", " + stringMax + ", 20, 30]]]\n");
|
||||||
}
|
}
|
||||||
|
// others return only 1 roi per module (1 port per module)
|
||||||
|
else {
|
||||||
|
REQUIRE(oss1.str() == "rx_roi [[[" + stringMin + ", " + std::to_string(portSize.x - 1) + "20, 30]]]\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// separated by space is allowed
|
// multiple ports vertically
|
||||||
REQUIRE_NOTHROW(caller.call(
|
else if (numinterfaces == 2 || (det.size() == 2 && det.getModuleGeometry().y > 1)) {
|
||||||
"rx_roi", {"[5, 10, 20, 30]", "[25, 28, " + stringMin + ", " + stringMax + "]"}, -1, PUT));
|
std::string stringMin = std::to_string(portSize.y);
|
||||||
std::ostringstream oss;
|
std::string stringMax = std::to_string(portSize.y + 1);
|
||||||
// separated by semicolon is allowed
|
|
||||||
REQUIRE_NOTHROW(caller.call(
|
|
||||||
"rx_roi", {"[5, 10, 20, 30];[25, 28, " + stringMin + ", " + stringMax + "]"}, -1, PUT, oss));
|
|
||||||
REQUIRE(oss.str() ==
|
|
||||||
"rx_roi [[5, 10, 20, 30], [25, 28, " + stringMin + ", " + stringMax + "]]\n");
|
|
||||||
|
|
||||||
// verify individual roi
|
// separated by space is allowed
|
||||||
if (det_type == defs::JUNGFRAU) {
|
REQUIRE_NOTHROW(caller.call(
|
||||||
std::ostringstream oss, oss1;
|
"rx_roi", {"[5, 10, 20, 30]", "[25, 28, " + stringMin + ", " + stringMax + "]"}, -1, PUT));
|
||||||
REQUIRE_NOTHROW(caller.call(
|
std::ostringstream oss;
|
||||||
"rx_roi", {"[100,500,100,400]"}, -1, PUT, oss));
|
// separated by semicolon is allowed
|
||||||
REQUIRE(oss.str() == "rx_roi [[100, 500, 100, 400]]\n");
|
REQUIRE_NOTHROW(caller.call(
|
||||||
REQUIRE_NOTHROW(
|
"rx_roi", {"[5, 10, 20, 30];[25, 28, " + stringMin + ", " + stringMax + "]"}, -1, PUT, oss));
|
||||||
caller.call("rx_roi", {}, 0, GET, oss1));
|
REQUIRE(oss.str() ==
|
||||||
REQUIRE(oss1.str() == "rx_roi [[[100, 500, 100, 255], "
|
"rx_roi [[5, 10, 20, 30], [25, 28, " + stringMin + ", " + stringMax + "]]\n");
|
||||||
"[100, 500, 256, 400]]]\n");
|
|
||||||
} else {
|
// verify individual roi
|
||||||
std::ostringstream oss, oss1;
|
{
|
||||||
REQUIRE_NOTHROW(caller.call(
|
stringMin = std::to_string(portSize.y - delta);
|
||||||
"rx_roi", {"[100,200,100,300]"}, -1, PUT, oss));
|
stringMax = std::to_string(portSize.y + delta);
|
||||||
REQUIRE(oss.str() == "rx_roi [[100, 200, 100, 300]]\n");
|
std::ostringstream oss, oss1;
|
||||||
REQUIRE_NOTHROW(
|
REQUIRE_NOTHROW(caller.call(
|
||||||
caller.call("rx_roi", {}, 0, GET, oss1));
|
"rx_roi", {"[ 20, 30, " + stringMin + ", " + stringMax + "]"}, -1, PUT, oss));
|
||||||
REQUIRE(oss1.str() == "rx_roi [[[100, 200, 100, 199], "
|
REQUIRE(oss.str() == "rx_roi [[20, 30, " + stringMin + ", " + stringMax + "]]\n");
|
||||||
"[100, 200, 200, 300]]]\n");
|
REQUIRE_NOTHROW(
|
||||||
|
caller.call("rx_roi", {}, 0, GET, oss1));
|
||||||
|
// non-eiger with 2 interfaces returns 2 values for 2 ports per module
|
||||||
|
if (numinterfaces == 2) {
|
||||||
|
REQUIRE(oss1.str() == "rx_roi [[[20, 30, " + stringMin + ", " + std::to_string(portSize.y - 1) + "], [20, 30, " + std::to_string(portSize.y + 1) + ", " + stringMax + "]]]\n");
|
||||||
|
}
|
||||||
|
// others return only 1 roi per module (1 port per module)
|
||||||
|
else {
|
||||||
|
REQUIRE(oss1.str() == "rx_roi [[[20, 30, " + stringMin + ", " + std::to_string(portSize.y - 1) + "], [-1, -1]]]\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user