HDF5DataFile: Save radial integration result
This commit is contained in:
@@ -5,9 +5,10 @@
|
||||
#include "../compression/JFJochCompressor.h"
|
||||
|
||||
HDF5DataFile::HDF5DataFile(const std::string &in_filename, int64_t width, int64_t height,
|
||||
int64_t pixel_depth_byte, bool is_signed, CompressionAlgorithm compression,
|
||||
int64_t pixel_depth_byte, bool is_signed, const std::vector<float>& in_rad_int_bin_to_q,
|
||||
CompressionAlgorithm compression,
|
||||
size_t in_max_spots) : data_type(pixel_depth_byte, is_signed),
|
||||
max_spots(in_max_spots) {
|
||||
max_spots(in_max_spots), rad_int_bin_to_q(in_rad_int_bin_to_q) {
|
||||
max_image_number = 0;
|
||||
nimages = 0;
|
||||
|
||||
@@ -27,14 +28,17 @@ HDF5DataFile::~HDF5DataFile() {
|
||||
data_set.reset();
|
||||
|
||||
if (!spot_count.empty()) {
|
||||
HDF5Group group(*data_file, "/entry/result");
|
||||
group.NXClass("NXcollection");
|
||||
std::vector<hsize_t> dims = {spot_count.size(), max_spots};
|
||||
group.SaveVector("nPeaks", spot_count);
|
||||
group.SaveVector("peakXPosRaw", spot_x, dims, CompressionAlgorithm::BSHUF_LZ4);
|
||||
group.SaveVector("peakYPosRaw", spot_y, dims, CompressionAlgorithm::BSHUF_LZ4);
|
||||
group.SaveVector("peakTotalIntensity", spot_intensity, dims, CompressionAlgorithm::BSHUF_LZ4);
|
||||
group.SaveVector("indexingResult", indexing_result);
|
||||
result_group->SaveVector("nPeaks", spot_count);
|
||||
result_group->SaveVector("peakXPosRaw", spot_x, dims, CompressionAlgorithm::BSHUF_LZ4);
|
||||
result_group->SaveVector("peakYPosRaw", spot_y, dims, CompressionAlgorithm::BSHUF_LZ4);
|
||||
result_group->SaveVector("peakTotalIntensity", spot_intensity, dims, CompressionAlgorithm::BSHUF_LZ4);
|
||||
result_group->SaveVector("indexingResult", indexing_result);
|
||||
|
||||
if (!rad_int_bin_to_q.empty())
|
||||
rad_int_group->SaveVector("bin_to_q", rad_int_bin_to_q);
|
||||
if (!rad_int_file_avg.empty() && (rad_int_file_avg.size() == rad_int_bin_to_q.size()))
|
||||
rad_int_group->SaveVector("file_avg", rad_int_file_avg);
|
||||
|
||||
HDF5Group group_exp(*data_file, "/entry/jungfrau");
|
||||
group_exp.NXClass("NXcollection");
|
||||
@@ -42,7 +46,8 @@ HDF5DataFile::~HDF5DataFile() {
|
||||
group_exp.SaveVector("info", jf_info);
|
||||
group_exp.SaveVector("timestamp", timestamp);
|
||||
}
|
||||
|
||||
rad_int_group.reset();
|
||||
result_group.reset();
|
||||
data_file.reset();
|
||||
}
|
||||
|
||||
@@ -51,6 +56,11 @@ void HDF5DataFile::CreateFile() {
|
||||
HDF5Group(*data_file, "/entry").NXClass("NXentry");
|
||||
HDF5Group(*data_file, "/entry/data").NXClass("NXdata");
|
||||
|
||||
result_group = std::make_unique<HDF5Group>(*data_file, "/entry/result");
|
||||
result_group->NXClass("NXcollection");
|
||||
|
||||
rad_int_group = std::make_unique<HDF5Group>(*data_file, "/entry/result/rad_int");
|
||||
|
||||
HDF5DataSpace data_space({1, ypixel, xpixel},{H5S_UNLIMITED, ypixel, xpixel});
|
||||
data_set = std::make_unique<HDF5DataSet>(*data_file, "/entry/data/data", data_type, data_space, dcpl);
|
||||
|
||||
@@ -99,6 +109,9 @@ void HDF5DataFile::Write(const DataMessage &msg, uint64_t image_number) {
|
||||
bunch_id[image_number] = msg.bunch_id;
|
||||
jf_info[image_number] = msg.jf_info;
|
||||
timestamp[image_number] = msg.timestamp;
|
||||
|
||||
if (!msg.rad_int_profile.empty() && (msg.rad_int_profile.size() == rad_int_bin_to_q.size()))
|
||||
rad_int_group->SaveVector("img" + std::to_string(image_number), msg.rad_int_profile);
|
||||
}
|
||||
|
||||
HDF5DataFileStatistics HDF5DataFile::GetStatistics() const {
|
||||
|
||||
Reference in New Issue
Block a user