Improvements before MAX IV test

This commit is contained in:
2024-04-25 20:11:58 +02:00
parent 2c8e1fd83d
commit ea70b27e85
80 changed files with 1835 additions and 1781 deletions

View File

@@ -9,6 +9,7 @@
#include "HDF5DataFilePluginXFEL.h"
#include "HDF5DataFilePluginJUNGFRAU.h"
#include "HDF5DataFilePluginResEstimation.h"
#include "../include/spdlog/fmt/fmt.h"
HDF5DataFile::HDF5DataFile(const std::string &in_filename,
const std::vector<float>& in_rad_int_bin_to_q,
@@ -21,6 +22,8 @@ HDF5DataFile::HDF5DataFile(const std::string &in_filename,
filename = in_filename;
image_low = in_image_low;
tmp_filename = fmt::format("{}.tmp{:8x}", filename, std::chrono::system_clock::now().time_since_epoch().count());
plugins.emplace_back(std::make_unique<HDF5DataFilePluginJUNGFRAU>());
plugins.emplace_back(std::make_unique<HDF5DataFilePluginAzInt>(in_rad_int_bin_to_q));
plugins.emplace_back(std::make_unique<HDF5DataFilePluginXFEL>());
@@ -46,8 +49,7 @@ HDF5DataFile::~HDF5DataFile() {
data_set.reset();
}
data_file.reset();
std::string old_filename = filename + ".tmp";
std::rename(old_filename.c_str(), filename.c_str());
std::rename(tmp_filename.c_str(), filename.c_str());
}
}
@@ -67,8 +69,8 @@ void HDF5DataFile::CreateFile(const DataMessage& msg) {
dcpl.SetFillValue32(INT32_MIN);
}
data_file = std::make_unique<HDF5File>(filename + ".tmp");
chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); // default permissions
data_file = std::make_unique<HDF5File>(tmp_filename);
chmod(tmp_filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); // default permissions
HDF5Group(*data_file, "/entry").NXClass("NXentry");
HDF5Group(*data_file, "/entry/data").NXClass("NXdata");
@@ -80,7 +82,6 @@ void HDF5DataFile::CreateFile(const DataMessage& msg) {
}
void HDF5DataFile::Write(const DataMessage &msg, uint64_t image_number) {
std::lock_guard<std::mutex> lock(hdf5_mutex);
bool new_file = false;
if (!data_file) {
@@ -100,11 +101,11 @@ void HDF5DataFile::Write(const DataMessage &msg, uint64_t image_number) {
data_set->WriteDirectChunk(msg.image.data, msg.image.size, {image_number, 0, 0});
for (auto &p: plugins)
p->Write(msg);
p->Write(msg, image_number);
timestamp[image_number] = msg.timestamp;
exptime[image_number] = msg.exptime;
number[image_number] = msg.number;
number[image_number] = (msg.original_number) ? msg.original_number.value() : msg.number;
}
HDF5DataFileStatistics HDF5DataFile::GetStatistics() const {