review comments
All checks were successful
Build on RHEL9 / build (push) Successful in 2m53s
Build on RHEL8 / build (push) Successful in 2m55s

This commit is contained in:
2025-06-12 18:14:48 +02:00
parent 75f63607fc
commit bd7870e75a
3 changed files with 11 additions and 22 deletions

View File

@ -27,6 +27,7 @@ struct ModuleConfig {
}; };
#ifdef AARE_TESTS #ifdef AARE_TESTS
TEST_CASE_PRIVATE_FWD(check_find_geometry) // forward declaration TEST_CASE_PRIVATE_FWD(check_find_geometry) // forward declaration
TEST_CASE_PRIVATE_FWD(open_multi_module_file_with_roi)
#endif #endif
/** /**
@ -39,6 +40,7 @@ class RawFile : public FileInterface {
#ifdef AARE_TESTS #ifdef AARE_TESTS
FRIEND_TEST(check_find_geometry) FRIEND_TEST(check_find_geometry)
FRIEND_TEST(open_multi_module_file_with_roi)
#endif #endif
std::vector<std::unique_ptr<RawSubFile>> m_subfiles; std::vector<std::unique_ptr<RawSubFile>> m_subfiles;
ModuleConfig cfg{0, 0}; ModuleConfig cfg{0, 0};
@ -48,7 +50,6 @@ class RawFile : public FileInterface {
std::vector<ssize_t> m_modules_in_roi{}; std::vector<ssize_t> m_modules_in_roi{};
protected:
DetectorGeometry m_geometry; DetectorGeometry m_geometry;
public: public:
@ -84,7 +85,6 @@ class RawFile : public FileInterface {
size_t bitdepth() const override; size_t bitdepth() const override;
xy geometry(); xy geometry();
size_t n_modules() const; size_t n_modules() const;
size_t n_modules_in_roi() const;
RawMasterFile master() const; RawMasterFile master() const;
@ -116,7 +116,8 @@ class RawFile : public FileInterface {
void open_subfiles(); void open_subfiles();
protected: size_t n_modules_in_roi() const;
void find_geometry(); void find_geometry();
}; };

View File

@ -148,7 +148,7 @@ RawMasterFile RawFile::master() const { return m_master; }
*/ */
void RawFile::find_geometry() { void RawFile::find_geometry() {
m_geometry.reserve(n_modules()); m_geometry.module_pixel_0.reserve(n_modules());
for (size_t col = 0; col < m_master.geometry().col; for (size_t col = 0; col < m_master.geometry().col;
col += m_master.udp_interfaces_per_module().col) col += m_master.udp_interfaces_per_module().col)
for (size_t row = 0; row < m_master.geometry().row; for (size_t row = 0; row < m_master.geometry().row;

View File

@ -164,21 +164,6 @@ TEST_CASE("Read multipart files", "[.integration]") {
} }
} }
// dummy test class for easy member access
class RawFileTestWrapper : public RawFile {
public:
RawFileTestWrapper(const std::filesystem::path &fname,
const std::string &mode = "r")
: RawFile(fname, mode) {}
void find_geometry() { RawFile::find_geometry(); }
DetectorGeometry get_geometry() { return this->m_geometry; }
static DetectorHeader read_header(const std::filesystem::path &fname) {
return RawFile::read_header(fname);
}
};
struct TestParameters { struct TestParameters {
const std::string master_filename{}; const std::string master_filename{};
const uint8_t num_ports{}; const uint8_t num_ports{};
@ -227,6 +212,7 @@ TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
RawFile f(fpath, "r"); RawFile f(fpath, "r");
f.m_geometry.module_pixel_0.clear();
f.find_geometry(); f.find_geometry();
auto geometry = f.m_geometry; auto geometry = f.m_geometry;
@ -244,7 +230,7 @@ TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
auto subfile1_path = f.master().data_fname(i, 0); auto subfile1_path = f.master().data_fname(i, 0);
REQUIRE(std::filesystem::exists(subfile1_path)); REQUIRE(std::filesystem::exists(subfile1_path));
auto header = RawFileTestWrapper::read_header(subfile1_path); auto header = RawFile::read_header(subfile1_path);
CHECK(header.column == geometry.module_pixel_0[i].col_index); CHECK(header.column == geometry.module_pixel_0[i].col_index);
CHECK(header.row == geometry.module_pixel_0[i].row_index); CHECK(header.row == geometry.module_pixel_0[i].row_index);
@ -263,8 +249,9 @@ TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
} // close the namespace } // close the namespace
TEST_CASE("Open multi module file with ROI", TEST_CASE_PRIVATE(aare, open_multi_module_file_with_roi,
"[.integration][.files][.rawfile]") { "Open multi module file with ROI",
"[.integration][.files][.rawfile]") {
auto fpath = test_data_path() / "raw/SingleChipROI/Data_master_0.json"; auto fpath = test_data_path() / "raw/SingleChipROI/Data_master_0.json";
REQUIRE(std::filesystem::exists(fpath)); REQUIRE(std::filesystem::exists(fpath));
@ -278,6 +265,7 @@ TEST_CASE("Open multi module file with ROI",
CHECK(f.n_modules_in_roi() == 1); CHECK(f.n_modules_in_roi() == 1);
} }
} // close namespace aare
TEST_CASE("Read file with unordered frames", "[.integration]") { TEST_CASE("Read file with unordered frames", "[.integration]") {
// TODO! Better explanation and error message // TODO! Better explanation and error message