mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-21 19:27:58 +02:00
review comments
This commit is contained in:
@ -27,6 +27,7 @@ struct ModuleConfig {
|
||||
};
|
||||
#ifdef AARE_TESTS
|
||||
TEST_CASE_PRIVATE_FWD(check_find_geometry) // forward declaration
|
||||
TEST_CASE_PRIVATE_FWD(open_multi_module_file_with_roi)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -39,6 +40,7 @@ class RawFile : public FileInterface {
|
||||
|
||||
#ifdef AARE_TESTS
|
||||
FRIEND_TEST(check_find_geometry)
|
||||
FRIEND_TEST(open_multi_module_file_with_roi)
|
||||
#endif
|
||||
std::vector<std::unique_ptr<RawSubFile>> m_subfiles;
|
||||
ModuleConfig cfg{0, 0};
|
||||
@ -48,7 +50,6 @@ class RawFile : public FileInterface {
|
||||
|
||||
std::vector<ssize_t> m_modules_in_roi{};
|
||||
|
||||
protected:
|
||||
DetectorGeometry m_geometry;
|
||||
|
||||
public:
|
||||
@ -84,7 +85,6 @@ class RawFile : public FileInterface {
|
||||
size_t bitdepth() const override;
|
||||
xy geometry();
|
||||
size_t n_modules() const;
|
||||
size_t n_modules_in_roi() const;
|
||||
|
||||
RawMasterFile master() const;
|
||||
|
||||
@ -116,7 +116,8 @@ class RawFile : public FileInterface {
|
||||
|
||||
void open_subfiles();
|
||||
|
||||
protected:
|
||||
size_t n_modules_in_roi() const;
|
||||
|
||||
void find_geometry();
|
||||
};
|
||||
|
||||
|
@ -148,7 +148,7 @@ RawMasterFile RawFile::master() const { return m_master; }
|
||||
*/
|
||||
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;
|
||||
col += m_master.udp_interfaces_per_module().col)
|
||||
for (size_t row = 0; row < m_master.geometry().row;
|
||||
|
@ -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 {
|
||||
const std::string master_filename{};
|
||||
const uint8_t num_ports{};
|
||||
@ -227,6 +212,7 @@ TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
|
||||
|
||||
RawFile f(fpath, "r");
|
||||
|
||||
f.m_geometry.module_pixel_0.clear();
|
||||
f.find_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);
|
||||
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.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
|
||||
|
||||
TEST_CASE("Open multi module file with ROI",
|
||||
"[.integration][.files][.rawfile]") {
|
||||
TEST_CASE_PRIVATE(aare, open_multi_module_file_with_roi,
|
||||
"Open multi module file with ROI",
|
||||
"[.integration][.files][.rawfile]") {
|
||||
|
||||
auto fpath = test_data_path() / "raw/SingleChipROI/Data_master_0.json";
|
||||
REQUIRE(std::filesystem::exists(fpath));
|
||||
@ -278,6 +265,7 @@ TEST_CASE("Open multi module file with ROI",
|
||||
|
||||
CHECK(f.n_modules_in_roi() == 1);
|
||||
}
|
||||
} // close namespace aare
|
||||
|
||||
TEST_CASE("Read file with unordered frames", "[.integration]") {
|
||||
// TODO! Better explanation and error message
|
||||
|
Reference in New Issue
Block a user