mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-02 21:54:14 +02:00
eiger config json update. det writer image id bugfix
This commit is contained in:
@@ -9,30 +9,26 @@ namespace BufferUtils
|
||||
{
|
||||
|
||||
struct DetectorConfig {
|
||||
const std::string streamvis_address;
|
||||
const int reduction_factor_streamvis;
|
||||
const std::string live_analysis_address;
|
||||
const int reduction_factor_live_analysis;
|
||||
const std::string PEDE_FILENAME;
|
||||
const std::string GAIN_FILENAME;
|
||||
|
||||
// const std::string streamvis_address;
|
||||
// const int reduction_factor_streamvis;
|
||||
// const std::string live_analysis_address;
|
||||
// const int reduction_factor_live_analysis;
|
||||
// const std::string PEDE_FILENAME;
|
||||
// const std::string GAIN_FILENAME;
|
||||
// const std::string buffer_folder;
|
||||
const std::string detector_name;
|
||||
const std::string detector_type;
|
||||
const int n_modules;
|
||||
const int image_n_pixels;
|
||||
const int start_udp_port;
|
||||
const std::string buffer_folder;
|
||||
|
||||
|
||||
friend std::ostream& operator <<(std::ostream& os, DetectorConfig const& det_config)
|
||||
{
|
||||
return os << det_config.streamvis_address << ' '
|
||||
<< det_config.reduction_factor_streamvis << ' '
|
||||
<< det_config.live_analysis_address << ' '
|
||||
<< det_config.reduction_factor_live_analysis << ' '
|
||||
<< det_config.PEDE_FILENAME << ' '
|
||||
<< det_config.GAIN_FILENAME << ' '
|
||||
<< det_config.detector_name << ' '
|
||||
return os << det_config.detector_name << ' '
|
||||
<< det_config.detector_type << ' '
|
||||
<< det_config.n_modules << ' '
|
||||
<< det_config.start_udp_port << ' '
|
||||
<< det_config.buffer_folder << ' ';
|
||||
<< det_config.start_udp_port << ' ';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ void* BufferUtils::connect_socket(
|
||||
string ipc_address = buffer_config::IPC_URL_BASE +
|
||||
detector_name + "-" +
|
||||
stream_name;
|
||||
|
||||
|
||||
void* socket = zmq_socket(ctx, ZMQ_SUB);
|
||||
if (socket == nullptr) {
|
||||
throw runtime_error(zmq_strerror(errno));
|
||||
@@ -159,15 +159,10 @@ BufferUtils::DetectorConfig BufferUtils::read_json_config(
|
||||
config_parameters.ParseStream(isw);
|
||||
|
||||
return {
|
||||
config_parameters["streamvis_stream"].GetString(),
|
||||
config_parameters["streamvis_rate"].GetInt(),
|
||||
config_parameters["live_stream"].GetString(),
|
||||
config_parameters["live_rate"].GetInt(),
|
||||
config_parameters["pedestal_file"].GetString(),
|
||||
config_parameters["gain_file"].GetString(),
|
||||
config_parameters["detector_name"].GetString(),
|
||||
config_parameters["detector_type"].GetString(),
|
||||
config_parameters["n_modules"].GetInt(),
|
||||
config_parameters["image_n_pixels"].GetInt(),
|
||||
config_parameters["start_udp_port"].GetInt(),
|
||||
config_parameters["buffer_folder"].GetString(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
{
|
||||
"streamvis_stream": "tcp://0.0.0.0:9006",
|
||||
"streamvis_rate": 10,
|
||||
"live_stream": "tcp://0.0.0.0:9106",
|
||||
"live_rate": 10,
|
||||
"pedestal_file": "",
|
||||
"gain_file": "",
|
||||
"detector_name": "eiger-16",
|
||||
"detector_name": "cSAXS.EG01V01",
|
||||
"detector_type": "eiger",
|
||||
"n_modules": 4,
|
||||
"start_udp_port": 50200,
|
||||
"buffer_folder": ""
|
||||
"image_n_pixels": 527364,
|
||||
"start_udp_port": 50200
|
||||
}
|
||||
|
||||
@@ -64,9 +64,11 @@ void EigerAssembler::assemble_image(const char* src_meta,
|
||||
// init good image status = 0
|
||||
image_meta->status = 0;
|
||||
image_meta->id = frame_meta->id;
|
||||
// todo fill rest of image metadata
|
||||
// image_meta->height
|
||||
// image_meta->width
|
||||
image_meta->height = n_modules_ / 2 * MODULE_Y_SIZE + GAP_Y_MODULE_PIXELS;
|
||||
image_meta->width = n_modules_ / 2 * MODULE_X_SIZE + GAP_X_MODULE_PIXELS;
|
||||
image_meta->dtype = (bit_depth_ <= 8) ? 1 : bit_depth_ / 8;
|
||||
image_meta->encoding = 0;
|
||||
image_meta->source_id = 0;
|
||||
is_pulse_init = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ int main (int argc, char *argv[])
|
||||
const int bit_depth = atoi(argv[2]);
|
||||
auto const stream_name = "assembler";
|
||||
|
||||
const size_t IMAGE_N_BYTES = config.image_n_pixels * bit_depth / 8;
|
||||
auto ctx = zmq_ctx_new();
|
||||
zmq_ctx_set(ctx, ZMQ_IO_THREADS, ASSEMBLER_ZMQ_IO_THREADS);
|
||||
auto sender = BufferUtils::bind_socket(
|
||||
@@ -82,7 +83,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
|
||||
RamBuffer image_buffer(config.detector_name + "_" + stream_name,
|
||||
sizeof(ImageMetadata), assembler.get_image_n_bytes(), 1,
|
||||
sizeof(ImageMetadata), IMAGE_N_BYTES, 1,
|
||||
buffer_config::RAM_BUFFER_N_SLOTS);
|
||||
|
||||
AssemblerStats stats(config.detector_name, ASSEMBLER_STATS_MODULO);
|
||||
|
||||
@@ -121,7 +121,7 @@ provided docker container. You need to start building it
|
||||
from the project **root**:
|
||||
|
||||
```bash
|
||||
docker build -f jf-live-writer/debug.Dockerfile -t jf-live-writer .
|
||||
docker build -f std-det-writer/debug.Dockerfile -t std-det-writer .
|
||||
```
|
||||
(Running this command from the project root is mandatory as the entire project
|
||||
folder needs to be part of the build context.)
|
||||
@@ -153,7 +153,7 @@ Please follow instructions below on how to do that manually.
|
||||
```
|
||||
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/src/hdf5-1.12.0.tar.gz
|
||||
tar -xzf hdf5-1.12.0.tar.gz
|
||||
cd hdf5-1.10.7
|
||||
cd hdf5-1.12.0
|
||||
./configure --enable-parallel
|
||||
make install
|
||||
sudo ln -v -s `pwd`/hdf5/lib/* /usr/lib64/
|
||||
|
||||
@@ -20,7 +20,7 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3) {
|
||||
cout << endl;
|
||||
cout << "Usage: std-det-writer [detector_json_filename]"
|
||||
cout << "Usage: std_det_writer [detector_json_filename]"
|
||||
" [bit_depth]" << endl;
|
||||
cout << "\tdetector_json_filename: detector config file path." << endl;
|
||||
cout << "\tbit_depth: bit depth of the incoming udp packets." << endl;
|
||||
@@ -55,18 +55,18 @@ int main (int argc, char *argv[])
|
||||
char recv_buffer[8192];
|
||||
while (true) {
|
||||
zmq_recv(receiver, &recv_buffer, sizeof(recv_buffer), 0);
|
||||
|
||||
|
||||
rapidjson::Document document;
|
||||
if (document.Parse(recv_buffer).HasParseError()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const string output_file = document["output_file"].GetString();
|
||||
const uint64_t image_id = document["image_id"].GetUint64();
|
||||
const uint64_t image_id = document["image_metadata"]["id"].GetUint64();
|
||||
const int run_id = document["run_id"].GetInt();
|
||||
const int i_image = document["i_image"].GetInt();
|
||||
const int n_images = document["n_images"].GetInt();
|
||||
|
||||
|
||||
// i_image == n_images -> end of run.
|
||||
if (i_image == n_images) {
|
||||
writer.close_run();
|
||||
|
||||
Reference in New Issue
Block a user