1001/fix no rx roi port (#1370)
Build on RHEL9 / build (push) Successful in 4m18s
Build on RHEL8 / build (push) Successful in 4m56s

* rx_roi fixed when there is no roi for a particular port. Fixed tests for it

* removing todo check if files created because its not enough to count matching pattern file names, but also look at timestamp and create files with timestamp else you read older ones. For now, checking individual rois is enough

* restore md5
This commit is contained in:
2026-03-05 12:28:13 +01:00
committed by GitHub
parent 6c2ae37c98
commit 344fc55464
2 changed files with 87 additions and 1 deletions
+7
View File
@@ -1831,6 +1831,13 @@ void DetectorImpl::setRxROI(const std::vector<defs::ROI> &args) {
auto moduleGlobalRoi = getModuleROI(iModule);
// at most 2 rois per module (for each port)
std::vector<defs::ROI> portRois(nPortsPerModule);
for (auto &roi : portRois) {
roi.setNoRoi();
if (shm()->numberOfChannels.y == 1) {
roi.ymin = -1;
roi.ymax = -1;
}
}
// check overlap with module
for (const auto &arg : args) {
@@ -540,6 +540,16 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
REQUIRE(oss.str() == "rx_roi [[5, 10], [" + stringMin + ", " +
stringMax + "]]\n");
// setting to only one port and verify individual roi
{
REQUIRE_NOTHROW(
caller.call("rx_roi", {"[5, 10, -1, -1]"}, -1, PUT));
std::ostringstream oss, oss1;
REQUIRE_NOTHROW(caller.call("rx_roi", {}, 0, GET, oss));
REQUIRE_NOTHROW(caller.call("rx_roi", {}, 1, GET, oss1));
REQUIRE(oss.str() == "rx_roi [[5, 10]]\n");
REQUIRE(oss1.str() == "rx_roi [[0, 0]]\n");
}
// verify individual roi
{
stringMin = std::to_string(moduleSize.x - 50);
@@ -643,6 +653,38 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
REQUIRE(oss.str() == "rx_roi [[5, 10, 20, 30], [" + stringMin +
", " + stringMax + ", 20, 30]]\n");
// setting to only one port and verify individual roi
{
REQUIRE_NOTHROW(
caller.call("rx_roi", {"[5, 10, 20, 30]"}, -1, PUT));
std::ostringstream oss, oss1;
REQUIRE_NOTHROW(caller.call("rx_roi", {}, 0, GET, oss));
// eiger returns 2 values for 2 ports per module
if (det_type == defs::EIGER) {
REQUIRE(oss.str() ==
"rx_roi [[5, 10, 20, 30], [0, 0, 0, 0]]\n");
}
// others return only 1 roi per module (1 port per module)
else {
REQUIRE(oss.str() == "rx_roi [[5, 10, 20, 30]]\n");
}
if (det.size() > 1) {
REQUIRE_NOTHROW(
caller.call("rx_roi", {}, 1, GET, oss1));
// eiger returns 2 values for 2 ports per module
if (det_type == defs::EIGER) {
REQUIRE(oss1.str() ==
"rx_roi [[0, 0, 0, 0], [0, 0, 0, 0]]\n");
}
// others return only 1 roi per module (1 port per
// module)
else {
REQUIRE(oss1.str() == "rx_roi [[0, 0, 0, 0]]\n");
}
}
}
// verify individual roi
{
stringMin = std::to_string(portSize.x - delta);
@@ -710,6 +752,43 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
REQUIRE(oss.str() == "rx_roi [[5, 10, 20, 30], [25, 28, " +
stringMin + ", " + stringMax + "]]\n");
// setting to only one port and verify individual roi
{
REQUIRE_NOTHROW(
caller.call("rx_roi", {"[ 5, 10, 20, 30]"}, -1, PUT));
std::ostringstream oss, oss1;
REQUIRE_NOTHROW(caller.call("rx_roi", {}, 0, GET, oss));
// 2 ports
if (((det_type == defs::JUNGFRAU ||
det_type == defs::MOENCH) &&
(numinterfaces == 2)) ||
(det_type == defs::EIGER)) {
REQUIRE(oss.str() ==
"rx_roi [[5, 10, 20, 30], [0, 0, 0, 0]]\n");
}
// others return only 1 roi per module (1 port per module)
else {
REQUIRE(oss.str() == "rx_roi [[5, 10, 20, 30]]\n");
}
if (det.size() > 2) {
REQUIRE_NOTHROW(
caller.call("rx_roi", {}, 1, GET, oss1));
// 2 ports
if (((det_type == defs::JUNGFRAU ||
det_type == defs::MOENCH) &&
(numinterfaces == 2)) ||
(det_type == defs::EIGER)) {
REQUIRE(oss1.str() ==
"rx_roi [[0, 0, 0, 0], [0, 0, 0, 0]]\n");
}
// others return only 1 roi per module (1 port per
// module)
else {
REQUIRE(oss1.str() == "rx_roi [[0, 0, 0, 0]]\n");
}
}
}
// verify individual roi
{
stringMin = std::to_string(portSize.y - delta);
@@ -741,7 +820,7 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
REQUIRE(oss1.str() ==
"rx_roi [[20, 30, " + stringMin + ", " +
std::to_string(portSize.y - 1) +
"], [-1, -1]]\n");
"], [0, 0, 0, 0]]\n");
} else {
REQUIRE(oss1.str() ==
"rx_roi [[20, 30, " + stringMin + ", " +