Improve plotting
This commit is contained in:
@@ -411,111 +411,3 @@ TEST_CASE("FrameTransformation_Converted_bshuf_zstd_unsigned_16bit" ,"") {
|
||||
REQUIRE(input_1[(511+512)*1024] == output[CONVERTED_MODULE_SIZE * (nmodules - 2) + 1030]);
|
||||
REQUIRE(input_1[(511+512)*1024 + 800] == output[CONVERTED_MODULE_SIZE * (nmodules - 2) + 1030 + 800 + 6]);
|
||||
}
|
||||
|
||||
TEST_CASE("ImageROI_CalcSum_int16", "[ImageROI]") {
|
||||
const uint16_t nmodules = 4;
|
||||
const uint16_t ndatastreams = 2;
|
||||
DiffractionExperiment experiment(DetectorGeometry(ndatastreams * nmodules, 2, 0, 0, false));
|
||||
experiment.DataStreams(ndatastreams);
|
||||
|
||||
experiment.Mode(DetectorMode::Conversion).Compression(CompressionAlgorithm::BSHUF_ZSTD).FPGAOutputMode(FPGAPixelOutput::Int16);
|
||||
|
||||
REQUIRE(experiment.IsPixelSigned());
|
||||
REQUIRE(experiment.GetPixelDepth() == 2);
|
||||
|
||||
FrameTransformation transformation(experiment);
|
||||
|
||||
std::mt19937 g1(1987);
|
||||
std::uniform_int_distribution<int16_t> dist(INT16_MIN + 1, INT16_MAX - 1);
|
||||
|
||||
std::vector<int16_t> input_0(RAW_MODULE_SIZE);
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++)
|
||||
input_0[i] = dist(g1);
|
||||
|
||||
input_0[ 9 * RAW_MODULE_COLS + 8] = 7;
|
||||
input_0[ 9 * RAW_MODULE_COLS + 9] = -1;
|
||||
input_0[ 9 * RAW_MODULE_COLS + 10] = INT16_MIN;
|
||||
input_0[10 * RAW_MODULE_COLS + 8] = 3;
|
||||
input_0[10 * RAW_MODULE_COLS + 9] = 5;
|
||||
input_0[10 * RAW_MODULE_COLS + 10] = INT16_MAX;
|
||||
|
||||
REQUIRE_NOTHROW(transformation.ProcessModule(input_0.data(), 0, 0));
|
||||
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 9, 9, 10}) == 7 - 1 + 3 + 5);
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 10, 9, 10}) == INT64_MIN);
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 10, 10, 10}) == INT64_MAX);
|
||||
|
||||
REQUIRE_THROWS(transformation.CalculateROISum(ROIRectangle{8, 7, 10, 10}));
|
||||
REQUIRE_THROWS(transformation.CalculateROISum(ROIRectangle{8, 9, 11, 10}));
|
||||
REQUIRE_THROWS(transformation.CalculateROISum(ROIRectangle{8, (size_t) experiment.GetXPixelsNum(), 11, 12}));
|
||||
REQUIRE_THROWS(transformation.CalculateROISum(ROIRectangle{8, 15, 11, (size_t) experiment.GetYPixelsNum()}));
|
||||
}
|
||||
|
||||
TEST_CASE("ImageROI_CalcSum_uint16", "[ImageROI]") {
|
||||
const uint16_t nmodules = 4;
|
||||
const uint16_t ndatastreams = 2;
|
||||
DiffractionExperiment experiment(DetectorGeometry(ndatastreams * nmodules, 2, 0, 0, false));
|
||||
experiment.DataStreams(ndatastreams);
|
||||
|
||||
experiment.Mode(DetectorMode::Conversion).Compression(CompressionAlgorithm::BSHUF_ZSTD).FPGAOutputMode(FPGAPixelOutput::Uint16);
|
||||
|
||||
REQUIRE(!experiment.IsPixelSigned());
|
||||
REQUIRE(experiment.GetPixelDepth() == 2);
|
||||
|
||||
FrameTransformation transformation(experiment);
|
||||
|
||||
std::mt19937 g1(1987);
|
||||
std::uniform_int_distribution<uint16_t> dist(0, UINT16_MAX - 2);
|
||||
|
||||
std::vector<uint16_t> input_0(RAW_MODULE_SIZE);
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++)
|
||||
input_0[i] = dist(g1);
|
||||
|
||||
input_0[ 9 * RAW_MODULE_COLS + 8] = 7;
|
||||
input_0[ 9 * RAW_MODULE_COLS + 9] = INT16_MAX;
|
||||
input_0[ 9 * RAW_MODULE_COLS + 10] = UINT16_MAX;
|
||||
input_0[10 * RAW_MODULE_COLS + 8] = 3;
|
||||
input_0[10 * RAW_MODULE_COLS + 9] = 5;
|
||||
input_0[10 * RAW_MODULE_COLS + 10] = UINT16_MAX - 1;
|
||||
|
||||
REQUIRE_NOTHROW(transformation.ProcessModule(input_0.data(), 0, 0));
|
||||
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 9, 9, 10}) == 7 + INT16_MAX + 3 + 5);
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 10, 9, 10}) == INT64_MAX);
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 10, 10, 10}) == INT64_MAX);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("ImageROI_CalcSum_int32", "[ImageROI]") {
|
||||
const uint16_t nmodules = 4;
|
||||
const uint16_t ndatastreams = 2;
|
||||
DiffractionExperiment experiment(DetectorGeometry(ndatastreams * nmodules, 2, 0, 0, false));
|
||||
experiment.DataStreams(ndatastreams);
|
||||
|
||||
experiment.Mode(DetectorMode::Conversion).Compression(CompressionAlgorithm::BSHUF_ZSTD).FPGAOutputMode(FPGAPixelOutput::Int32);
|
||||
|
||||
REQUIRE(experiment.IsPixelSigned());
|
||||
REQUIRE(experiment.GetPixelDepth() == 4);
|
||||
|
||||
FrameTransformation transformation(experiment);
|
||||
|
||||
std::mt19937 g1(1987);
|
||||
std::uniform_int_distribution<int32_t> dist(INT32_MIN, INT32_MAX);
|
||||
|
||||
std::vector<int32_t> input_0(RAW_MODULE_SIZE);
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++)
|
||||
input_0[i] = dist(g1);
|
||||
|
||||
input_0[ 9 * RAW_MODULE_COLS + 8] = 7;
|
||||
input_0[ 9 * RAW_MODULE_COLS + 9] = INT16_MAX;
|
||||
input_0[ 9 * RAW_MODULE_COLS + 10] = INT32_MIN;
|
||||
input_0[10 * RAW_MODULE_COLS + 8] = 3;
|
||||
input_0[10 * RAW_MODULE_COLS + 9] = 5;
|
||||
input_0[10 * RAW_MODULE_COLS + 10] = INT32_MAX;
|
||||
|
||||
REQUIRE_NOTHROW(transformation.ProcessModule(input_0.data(), 0, 0));
|
||||
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 9, 9, 10}) == 7 + INT16_MAX + 3 + 5);
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 10, 9, 10}) == INT64_MIN);
|
||||
REQUIRE(transformation.CalculateROISum(ROIRectangle{8, 10, 10, 10}) == INT64_MAX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user