write rawfiles (single file) and read rawfiles in order (#66)

* read subfiles with unordered and missing frames

* save work debugging

* Revert "save work debugging"

This reverts commit e791992a05.

* Revert "read subfiles with unordered and missing frames"

This reverts commit 1177fd129d.

* 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>
This commit is contained in:
Bechir Braham
2024-05-07 10:46:24 +02:00
committed by GitHub
parent a4850892e0
commit 70acfbf4ac
33 changed files with 718 additions and 284 deletions

View File

@ -40,7 +40,7 @@ int main() {
File file(fpath, "r");
test1(file, 0);
fpath = (PROJECT_ROOT_DIR / "data" / "mythen" / "scan242_master_3.raw");
fpath = (PROJECT_ROOT_DIR / "data" / "mythen" / "CORRECTED_scan242_master_3.raw");
File file2(fpath, "r");
test2(file2, 0);
}

View File

@ -1,11 +1,9 @@
// Your First C++ Program
#include "aare/aare.hpp"
#include "aare/examples/defs.hpp"
#include "aare/file_io/File.hpp"
#include "aare/utils/logger.hpp"
#include <iostream>
using aare::File;
using aare::Frame;
using namespace aare;
void test(File &f, int frame_number) {
std::cout << "frame number: " << frame_number << '\n';
@ -26,4 +24,27 @@ int main() {
test(file, 0);
test(file, 2);
test(file, 99);
std::filesystem::path const path2("/tmp/raw_example_writing.json");
aare::FileConfig config;
config.version = "1.0";
config.geometry = {1, 1};
config.detector_type = aare::DetectorType::Moench;
config.max_frames_per_file = 100;
config.rows = 1024;
config.cols = 512;
config.dtype = aare::DType::UINT16;
File file2(path2, "w", config);
Frame frame(1024, 512, 16);
for (int i = 0; i < 1024; i++) {
for (int j = 0; j < 512; j++) {
frame.set(i, j, (uint16_t)(i + j));
}
}
sls_detector_header header;
header.frameNumber = 0;
file2.write(frame, header);
file2.set_total_frames(1);
}