HDF5DataFile: Save radial integration result
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#include <iostream>
|
||||
#include <bitshuffle/bitshuffle.h>
|
||||
|
||||
#include "../common/DiffractionExperiment.h"
|
||||
#include "../writer/HDF5Objects.h"
|
||||
#include "../writer/HDF5Writer.h"
|
||||
#include "../writer/HDF5NXmx.h"
|
||||
#include "../compression/JFJochCompressor.h"
|
||||
#include "../image_analysis/RadialIntegrationProfile.h"
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
@@ -195,6 +195,41 @@ TEST_CASE("HDF5Writer_Spots", "[HDF5][Full]") {
|
||||
REQUIRE (H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("HDF5Writer_Rad_Int_Profile", "[HDF5][Full]") {
|
||||
{
|
||||
RegisterHDF5Filter();
|
||||
DiffractionExperiment x(DetectorGeometry(8, 2, 8, 36));
|
||||
x.DetectorDistance_mm(50).BeamX_pxl(1000).BeamY_pxl(1000);
|
||||
x.QSpacingForRadialInt_recipA(0.1).LowQForRadialInt_recipA(0.1).HighQForRadialInt_recipA(4);
|
||||
|
||||
RadialIntegrationMapping mapping(x);
|
||||
RadialIntegrationProfile profile(mapping);
|
||||
|
||||
std::vector<float> rad_int_profile(mapping.GetBinNumber(), 4.0);
|
||||
std::vector<float> rad_int_avg(mapping.GetBinNumber(), 0.33);
|
||||
|
||||
x.FilePrefix("test02_1p10_spots").ImagesPerTrigger(5).DataFileCount(2).Compression(JFJochProtoBuf::NO_COMPRESSION);
|
||||
StartMessage start_message;
|
||||
x.FillMessage(start_message);
|
||||
start_message.rad_int_bin_to_q = mapping.GetBinToQ();
|
||||
|
||||
HDF5Writer file_set(start_message);
|
||||
std::vector<uint16_t> image(x.GetPixelsNum());
|
||||
|
||||
for (int i = 0; i < x.GetImageNum(); i++) {
|
||||
DataMessage message{};
|
||||
message.image.data = (uint8_t *) image.data();
|
||||
message.image.size = x.GetPixelsNum() * x.GetPixelDepth();
|
||||
message.rad_int_profile = std::vector<float>(mapping.GetBinNumber(), i);
|
||||
message.number = i;
|
||||
|
||||
REQUIRE_NOTHROW(file_set.Write(message));
|
||||
}
|
||||
}
|
||||
// No leftover HDF5 objects
|
||||
REQUIRE (H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("HDF5Writer_VDS", "[HDF5][Full]") {
|
||||
DiffractionExperiment x(DetectorGeometry(1));
|
||||
|
||||
@@ -345,7 +380,6 @@ TEST_CASE("HDF5Objects_ExtractFilename", "[HDF5]") {
|
||||
REQUIRE(ExtractFilename("dir1/dir2/filename_data_000001.h5") == "filename_data_000001.h5");
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("HDF5DataType", "[HDF5]") {
|
||||
HDF5DataType type1(1,true);
|
||||
REQUIRE(type1.GetElemSize() == 1);
|
||||
|
||||
Reference in New Issue
Block a user