mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-09 08:32:04 +02:00
bit depth via config file
This commit is contained in:
+5
-3
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.12)
|
||||
project(sf_daq_buffer)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
include_directories("/home/dbe/git/hdf5-1.12.0/hdf5/include/" "/usr/include/mpich-3.2-x86_64/")
|
||||
|
||||
set (SF_DAQ_BUFFER_VERSION "1.0.0")
|
||||
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
@@ -32,10 +34,10 @@ add_subdirectory(
|
||||
|
||||
add_subdirectory("core-buffer")
|
||||
#add_subdirectory("std-stream-send")
|
||||
add_subdirectory("std-udp-recv")
|
||||
add_subdirectory("std-udp-sync")
|
||||
#add_subdirectory("std-udp-recv")
|
||||
#add_subdirectory("std-udp-sync")
|
||||
#add_subdirectory("jf-buffer-writer")
|
||||
add_subdirectory("jf-assembler")
|
||||
#add_subdirectory("jf-assembler")
|
||||
#add_subdirectory("sf-stream")
|
||||
#add_subdirectory("sf-writer")
|
||||
add_subdirectory("std-det-writer")
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace BufferUtils
|
||||
const std::string detector_name;
|
||||
const std::string detector_type;
|
||||
const int n_modules;
|
||||
const int bit_depth;
|
||||
const int image_height;
|
||||
const int image_width;
|
||||
const int start_udp_port;
|
||||
@@ -23,6 +24,7 @@ namespace BufferUtils
|
||||
<< det_config.detector_type << ' '
|
||||
<< det_config.n_modules << ' '
|
||||
<< det_config.start_udp_port << ' '
|
||||
<< det_config.bit_depth << ' '
|
||||
<< det_config.image_height << ' '
|
||||
<< det_config.image_width << ' ';
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ BufferUtils::DetectorConfig BufferUtils::read_json_config(
|
||||
config_parameters["detector_name"].GetString(),
|
||||
config_parameters["detector_type"].GetString(),
|
||||
config_parameters["n_modules"].GetInt(),
|
||||
config_parameters["bit_depth"].GetInt(),
|
||||
config_parameters["image_height"].GetInt(),
|
||||
config_parameters["image_width"].GetInt(),
|
||||
config_parameters["start_udp_port"].GetInt(),
|
||||
|
||||
@@ -20,19 +20,16 @@ using namespace live_writer_config;
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3) {
|
||||
if (argc != 2) {
|
||||
cout << endl;
|
||||
cout << "Usage: std_det_writer [detector_json_filename]"
|
||||
" [bit_depth]" << endl;
|
||||
cout << "Usage: std_det_writer [detector_json_filename]" << endl;
|
||||
cout << "\tdetector_json_filename: detector config file path." << endl;
|
||||
cout << "\tbit_depth: bit depth of the incoming udp packets." << endl;
|
||||
cout << endl;
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
auto const config = DetWriterConfig::from_json_file(string(argv[1]));
|
||||
const int bit_depth = atoi(argv[2]);
|
||||
|
||||
MPI_Init(nullptr, nullptr);
|
||||
|
||||
@@ -47,7 +44,7 @@ int main (int argc, char *argv[])
|
||||
auto receiver = BufferUtils::connect_socket_gf(
|
||||
ctx, config.detector_name, "tcp://localhost:9911");
|
||||
|
||||
const size_t IMAGE_N_BYTES = config.image_width * config.image_height * bit_depth / 8;
|
||||
const size_t IMAGE_N_BYTES = config.image_width * config.image_height * config.bit_depth / 8;
|
||||
|
||||
|
||||
JFH5Writer writer(config.detector_name);
|
||||
@@ -96,7 +93,6 @@ int main (int argc, char *argv[])
|
||||
// i_image == n_images -> end of run.
|
||||
if (i_image == n_images && open_run == true) {
|
||||
writer.close_run();
|
||||
cout << "[ Writer" << i_writer << " AFTER CLOSE RUN.... " << endl;
|
||||
stats.end_run();
|
||||
open_run = false;
|
||||
continue;
|
||||
@@ -118,7 +114,6 @@ int main (int argc, char *argv[])
|
||||
if (img_nbytes != -1 && header_in == true && open_run == true){
|
||||
// Fair distribution of images among writers.
|
||||
if (i_image % n_writers == i_writer) {
|
||||
cout << "[ Writer" << i_writer << ":: Frame" << i_image << "]"<< endl;
|
||||
stats.start_image_write();
|
||||
writer.write_data(run_id, i_image, recv_buffer_data);
|
||||
stats.end_image_write();
|
||||
@@ -128,7 +123,6 @@ int main (int argc, char *argv[])
|
||||
|
||||
// Only the first instance writes metadata.
|
||||
if (i_writer == 0 && header_in == true && open_run == true) {
|
||||
cout << "[ Writer" << i_writer << "::META from image" << i_image << "]"<< endl;
|
||||
writer.write_meta_gf(run_id,
|
||||
i_image,
|
||||
(uint16_t)run_id,
|
||||
|
||||
Reference in New Issue
Block a user