mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-06 21:00:41 +02:00

* read subfiles with unordered and missing frames * save work debugging * Revert "save work debugging" This reverts commit e791992a05efd754f93a80c980d17397eb4b6045. * Revert "read subfiles with unordered and missing frames" This reverts commit 1177fd129d3690db92e9597ccda62598e5a44d41. * throw when two frames have different frame numbers * write single part RawFile (working beta) * correct total number of frames in master file * add new mythen file with syncd frames * read frames with same frame number * clang-tidy fixes, formatting, add tests * improve readability in loop * fix failing tests --------- Co-authored-by: Bechir <bechir.brahem420@gmail.com>
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
// Your First C++ Program
|
|
#include "aare/examples/defs.hpp"
|
|
#include "aare/file_io/File.hpp"
|
|
#include "aare/utils/logger.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
using aare::File;
|
|
using aare::Frame;
|
|
|
|
void test1(File &f, int frame_number) {
|
|
std::cout << "frame number: " << frame_number << '\n';
|
|
Frame frame = f.iread(frame_number);
|
|
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 0))) << '\n';
|
|
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 1))) << '\n';
|
|
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 3839))) << '\n';
|
|
|
|
for (int i = 0; i < 3840; i++) {
|
|
uint16_t const x = *(reinterpret_cast<uint32_t *>(frame.get(0, i)));
|
|
if (x != i) {
|
|
aare::logger::error("error at i", i, "x", x);
|
|
}
|
|
}
|
|
}
|
|
|
|
void test2(File &f, int frame_number) {
|
|
std::cout << "frame number: " << frame_number << '\n';
|
|
Frame frame = f.iread(frame_number);
|
|
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 0))) << '\n';
|
|
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 1))) << '\n';
|
|
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 1280 * 4 - 1))) << '\n';
|
|
}
|
|
|
|
int main() {
|
|
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR));
|
|
if (PROJECT_ROOT_DIR.empty()) {
|
|
throw std::runtime_error("environment variable PROJECT_ROOT_DIR is not set");
|
|
}
|
|
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "mythen" / "m3_master_0.json");
|
|
File file(fpath, "r");
|
|
test1(file, 0);
|
|
|
|
fpath = (PROJECT_ROOT_DIR / "data" / "mythen" / "CORRECTED_scan242_master_3.raw");
|
|
File file2(fpath, "r");
|
|
test2(file2, 0);
|
|
} |