mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-11 06:47:14 +02:00
reading raw moench files (PR#3) (#32)
* reading moench and raw files * read mythen3 files * read multiport mythen3 * delete .vscode and .env.dev --------- Co-authored-by: Bechir <bechir.brahem420@gmail.com>
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
set(EXAMPLE_LIST "json_example;logger_example;numpy_example;multiport_example")
|
||||
|
||||
set(EXAMPLE_LIST "json_example;logger_example;numpy_example;multiport_example;raw_example;mythen_example")
|
||||
foreach(example ${EXAMPLE_LIST})
|
||||
add_executable(${example} ${example}.cpp)
|
||||
target_link_libraries(${example} PUBLIC aare PRIVATE aare_compiler_flags)
|
||||
|
@ -17,8 +17,7 @@ void test(File *f, int frame_number) {
|
||||
int main() {
|
||||
ContextManager ctx_manager;
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau_single_master_0.json");
|
||||
// std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "test_numpy_file.npy");
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" /"jungfrau"/ "jungfrau_single_master_0.json");
|
||||
std::cout << fpath << std::endl;
|
||||
|
||||
|
||||
@ -26,6 +25,4 @@ int main() {
|
||||
test(file, 0);
|
||||
test(file, 2);
|
||||
test(file, 9);
|
||||
|
||||
aare::logger::debug(LOCATION,"Hello", "World");
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
// Your First C++ Program
|
||||
#include "aare/ContextManager.hpp"
|
||||
#include <iostream>
|
||||
#include "aare/utils/logger.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
|
||||
|
||||
@ -9,26 +9,18 @@ void test(File *f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
Frame frame = f->get_frame(frame_number);
|
||||
std::cout << *((uint16_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(0,1)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(255, 1023)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(511, 1023)) << std::endl;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
ContextManager ctx_manager;
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau_double_master_0.json");
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau" / "jungfrau_double_master_0.json");
|
||||
std::cout << fpath << std::endl;
|
||||
|
||||
|
||||
File *file = ctx_manager.get_file(fpath);
|
||||
test(file, 0);
|
||||
test(file, 9);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
48
examples/mythen_example.cpp
Normal file
48
examples/mythen_example.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
// Your First C++ Program
|
||||
#include "aare/ContextManager.hpp"
|
||||
#include "aare/utils/logger.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
|
||||
|
||||
void test1(File *f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
Frame frame = f->get_frame(frame_number);
|
||||
std::cout << *((uint32_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 3839)) << std::endl;
|
||||
|
||||
for (int i = 0; i < 3840; i++) {
|
||||
uint16_t x = *((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 << std::endl;
|
||||
Frame frame = f->get_frame(frame_number);
|
||||
std::cout << *((uint32_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1280*4 -1)) << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
ContextManager ctx_manager;
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
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 = ctx_manager.get_file(fpath);
|
||||
test1(file, 0);
|
||||
|
||||
fpath = (PROJECT_ROOT_DIR / "data" / "mythen" / "scan242_master_3.raw");
|
||||
file = ctx_manager.get_file(fpath);
|
||||
test2(file, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -4,29 +4,24 @@
|
||||
|
||||
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
|
||||
|
||||
void test(File* f, int frame_number) {
|
||||
void test(File *f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
Frame frame = f->get_frame(frame_number);
|
||||
std::cout << *((uint16_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(1, 0)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(49, 49)) << std::endl;
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
ContextManager ctx_manager;
|
||||
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
// std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau_single_master_0.json");
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "test_numpy_file.npy");
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "numpy" / "test_numpy_file.npy");
|
||||
std::cout << fpath << std::endl;
|
||||
|
||||
File* file = ctx_manager.get_file(fpath);
|
||||
File *file = ctx_manager.get_file(fpath);
|
||||
test(file, 0);
|
||||
test(file, 2);
|
||||
test(file, 24);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
27
examples/raw_example.cpp
Normal file
27
examples/raw_example.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// Your First C++ Program
|
||||
#include "aare/ContextManager.hpp"
|
||||
#include <iostream>
|
||||
#include "aare/utils/logger.hpp"
|
||||
|
||||
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
|
||||
|
||||
void test(File *f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
Frame frame = f->get_frame(frame_number);
|
||||
std::cout << *((uint16_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(0, 95)) << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
ContextManager ctx_manager;
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
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" /"moench"/ "moench04_noise_200V_sto_both_100us_no_light_thresh_900_master_0.raw");
|
||||
File *file = ctx_manager.get_file(fpath);
|
||||
test(file, 0);
|
||||
test(file, 2);
|
||||
test(file, 99);
|
||||
}
|
Reference in New Issue
Block a user