JFJochReceiver: Per-data-file radial integration profile
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include "../image_analysis/RadialIntegrationProfile.h"
|
||||
#include "../image_analysis/RadialIntegrationMapping.h"
|
||||
#include "../image_analysis/RadialIntegration.h"
|
||||
|
||||
TEST_CASE("RadialIntegrationMapping_Constructor","[RadialIntegration]") {
|
||||
@@ -75,6 +78,38 @@ TEST_CASE("RadialIntegrationMapping_QToBin","[RadialIntegration]") {
|
||||
REQUIRE(mapping.QToBin(50.0) == Approx(38));
|
||||
}
|
||||
|
||||
TEST_CASE("RadialIntegrationProfile","[RadialIntegration]") {
|
||||
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<int32_t> sum(mapping.GetBinNumber());
|
||||
std::vector<int32_t> count(mapping.GetBinNumber());
|
||||
|
||||
for (int i = 0; i < mapping.GetBinNumber(); i++) {
|
||||
sum[i] = i * i * 4;
|
||||
count[i] = i;
|
||||
}
|
||||
REQUIRE_NOTHROW(profile.Add(sum, count));
|
||||
|
||||
std::vector<int32_t> sum_wr(mapping.GetBinNumber() - 1);
|
||||
REQUIRE_THROWS(profile.Add(sum_wr, count));
|
||||
|
||||
JFJochProtoBuf::Plot plot;
|
||||
profile.GetPlot(plot);
|
||||
|
||||
REQUIRE(plot.x_size() == mapping.GetBinNumber());
|
||||
REQUIRE(plot.y_size() == mapping.GetBinNumber());
|
||||
for (int i = 0; i < mapping.GetBinNumber(); i++) {
|
||||
REQUIRE(plot.x(i) == Approx(mapping.GetBinToQ()[i]));
|
||||
REQUIRE(plot.y(i) == Approx(i * 4));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("RadialIntegration_Process","[RadialIntegration]") {
|
||||
std::vector<uint16_t> pixel_to_bin = {0,1,2,4,3,1,2,3};
|
||||
std::vector<int16_t> test_image = {7,6,5,4,3,2,1,0};
|
||||
|
||||
Reference in New Issue
Block a user