version 1.0.0-rc.24

This commit is contained in:
2024-11-17 14:55:09 +01:00
parent aeeae33ad9
commit adc13ff33e
361 changed files with 12513 additions and 3314 deletions
+91 -3
View File
@@ -47,6 +47,95 @@ TEST_CASE("PixelMask_MaskChipEdges","[PixelMask]") {
CHECK(mask_out[1024*18] == 0);
}
TEST_CASE("PixelMask_MaskWrongGain","[PixelMask]") {
ImageFormatSettings image_format;
image_format.MaskModuleEdges(false).MaskChipEdges(false).MaskPixelsWithoutG0(true).GeometryTransformed(false);
DiffractionExperiment experiment(DetectorGeometry(4, 1));
experiment.ImportImageFormatSettings(image_format);
PixelMask mask(experiment);
JFCalibration calibration(experiment);
for (int m = 0; m < experiment.GetModulesNum(); m++) {
calibration.Pedestal(m, 0) = JFModulePedestal(1500);
calibration.Pedestal(m, 1) = JFModulePedestal(12000);
calibration.Pedestal(m, 2) = JFModulePedestal(13000);
}
calibration.Pedestal(2,0).GetPedestal()[345] = UINT16_MAX;
calibration.Pedestal(2,1).GetPedestal()[346] = UINT16_MAX;
calibration.Pedestal(2,2).GetPedestal()[347] = UINT16_MAX;
mask.LoadDetectorBadPixelMask(experiment, &calibration);
auto mask_out = mask.GetMask(experiment);
REQUIRE(mask_out.size() == experiment.GetModulesNum() * RAW_MODULE_SIZE);
CHECK(mask_out[2*RAW_MODULE_SIZE + 345] != 0);
CHECK(mask_out[2*RAW_MODULE_SIZE + 346] != 0);
CHECK(mask_out[2*RAW_MODULE_SIZE + 347] != 0);
CHECK(mask.GetStatistics().too_high_pedestal_rms == 0);
CHECK(mask.GetStatistics().wrong_gain == 3);
CHECK(mask.GetStatistics().user_mask == 0);
image_format.MaskPixelsWithoutG0(false);
experiment.ImportImageFormatSettings(image_format);
REQUIRE(!experiment.IsMaskPixelsWithoutG0());
mask.LoadDetectorBadPixelMask(experiment, &calibration);
mask_out = mask.GetMask(experiment);
CHECK(mask_out[2*RAW_MODULE_SIZE + 345] == 0);
CHECK(mask_out[2*RAW_MODULE_SIZE + 346] != 0);
CHECK(mask_out[2*RAW_MODULE_SIZE + 347] != 0);
CHECK(mask.GetStatistics().too_high_pedestal_rms == 0);
CHECK(mask.GetStatistics().wrong_gain == 2);
CHECK(mask.GetStatistics().user_mask == 0);
}
TEST_CASE("PixelMask_MaskG0RMS","[PixelMask]") {
ImageFormatSettings image_format;
image_format.MaskModuleEdges(false).MaskChipEdges(false).MaskPixelsWithoutG0(true).GeometryTransformed(false);
image_format.PedestalG0RMSLimit(100);
DiffractionExperiment experiment(DetectorGeometry(4, 1));
experiment.ImportImageFormatSettings(image_format);
PixelMask mask(experiment);
JFCalibration calibration(experiment);
for (int m = 0; m < experiment.GetModulesNum(); m++) {
calibration.Pedestal(m, 0) = JFModulePedestal(1500);
calibration.Pedestal(m, 1) = JFModulePedestal(12000);
calibration.Pedestal(m, 2) = JFModulePedestal(13000);
}
calibration.Pedestal(2,0).GetPedestal()[345] = UINT16_MAX;
calibration.Pedestal(2,1).GetPedestal()[346] = UINT16_MAX;
calibration.Pedestal(2,2).GetPedestal()[347] = UINT16_MAX;
calibration.Pedestal(2, 0).GetPedestalRMS()[245] = 150;
calibration.Pedestal(2, 0).GetPedestalRMS()[345] = UINT16_MAX;
calibration.Pedestal(2, 0).GetPedestalRMS()[346] = UINT16_MAX;
mask.LoadDetectorBadPixelMask(experiment, &calibration);
auto mask_out = mask.GetMask(experiment);
REQUIRE(mask_out.size() == experiment.GetModulesNum() * RAW_MODULE_SIZE);
CHECK(mask_out[2*RAW_MODULE_SIZE + 245] == (1 << PixelMask::TooHighPedestalRMSPixelBit));
CHECK(mask_out[2*RAW_MODULE_SIZE + 345] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask_out[2*RAW_MODULE_SIZE + 346] == ((1 << PixelMask::ErrorPixelBit) | (1 << PixelMask::TooHighPedestalRMSPixelBit)));
CHECK(mask_out[2*RAW_MODULE_SIZE + 347] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask.GetStatistics().too_high_pedestal_rms == 2);
CHECK(mask.GetStatistics().wrong_gain == 3);
CHECK(mask.GetStatistics().user_mask == 0);
}
TEST_CASE("PixelMask_CalculateNexusMask","[PixelMask]") {
DiffractionExperiment experiment(DetectorGeometry(4, 1, 8, 36, false));
experiment.MaskModuleEdges(false).MaskChipEdges(false);
@@ -89,7 +178,7 @@ TEST_CASE("PixelMask_CalculateNexusMask_GetMaskRaw","[PixelMask]") {
REQUIRE_NOTHROW(mask.LoadDetectorBadPixelMask(v));
auto mask_v = mask.GetMask(experiment, false);
auto mask_v = mask.GetMaskRaw();
REQUIRE(mask_v.size() == 4 * RAW_MODULE_SIZE );
REQUIRE(mask_v[0] == 0);
@@ -117,7 +206,7 @@ TEST_CASE("PixelMask_CalculateNexusMask_GetMask_NoGeomTransfer","[PixelMask]") {
REQUIRE_NOTHROW(mask.LoadDetectorBadPixelMask(v));
auto mask_v = mask.GetMask(experiment, true);
auto mask_v = mask.GetMask(experiment);
REQUIRE(mask_v.size() == 4 * RAW_MODULE_SIZE );
REQUIRE(mask_v[0] == 0);
@@ -197,7 +286,6 @@ TEST_CASE("PixelMask_CalculateNexusMask_UserMaskConv","[PixelMask]") {
REQUIRE(user_mask_v[(1030+8)*514] == 0);
}
TEST_CASE("PixelMask_MaskDetectorGaps","[PixelMask]") {
DiffractionExperiment experiment(DetectorGeometry(8, 2, 8, 36, true));
experiment.MaskChipEdges(false).MaskModuleEdges(false);