v1.0.0-rc.97
Some checks failed
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m11s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m9s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 9m18s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m14s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 10m3s
Build Packages / Generate python client (push) Successful in 15s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 8m31s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m21s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m42s
Build Packages / build:rpm (rocky9) (push) Successful in 9m11s
Build Packages / Unit tests (push) Failing after 1h13m19s

This is an UNSTABLE release and not recommended for production use (please use rc.96 instead).

* jfjoch_broker: For DECTRIS detectors add dark data collection during initialization for bad pixel mask
* jfjoch_broker: Refactor of calibration logic for more clear code (likely to introduce problems)
* jfjoch_viewer: Add option to handle user pixel mask (experimental)
* jfjoch_viewer: More options for ROI
* jfjoch_viewer: Add window to display calibration

Reviewed-on: #2
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
This commit was merged in pull request #2.
This commit is contained in:
2025-11-09 12:42:27 +01:00
committed by leonarski_f
parent 8b356a7001
commit 4dbbf0e365
243 changed files with 4532 additions and 1832 deletions

View File

@@ -6,7 +6,7 @@
TEST_CASE("PixelMask_MaskModuleEdges","[PixelMask]") {
DiffractionExperiment experiment(DetJF(4, 1));
experiment.MaskModuleEdges(true).MaskChipEdges(false).Mode(DetectorMode::Raw);
experiment.MaskModuleEdges(true).MaskChipEdges(false).Raw();
PixelMask mask(experiment);
@@ -30,7 +30,7 @@ TEST_CASE("PixelMask_MaskModuleEdges","[PixelMask]") {
TEST_CASE("PixelMask_MaskChipEdges","[PixelMask]") {
DiffractionExperiment experiment(DetJF(4,1));
experiment.MaskChipEdges(true).MaskModuleEdges(false).Mode(DetectorMode::Raw);
experiment.MaskChipEdges(true).MaskModuleEdges(false).Raw();
PixelMask mask(experiment);
auto mask_out = mask.GetMaskRaw(experiment);
@@ -80,8 +80,8 @@ TEST_CASE("PixelMask_MaskWrongGain","[PixelMask]") {
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().noisy_pixel == 0);
CHECK(mask.GetStatistics().error_pixel == 3);
CHECK(mask.GetStatistics().user_mask == 0);
image_format.MaskPixelsWithoutG0(false);
@@ -95,8 +95,8 @@ TEST_CASE("PixelMask_MaskWrongGain","[PixelMask]") {
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().noisy_pixel == 0);
CHECK(mask.GetStatistics().error_pixel == 2);
CHECK(mask.GetStatistics().user_mask == 0);
}
@@ -129,14 +129,14 @@ TEST_CASE("PixelMask_MaskG0RMS","[PixelMask]") {
auto mask_out = mask.GetMaskRaw(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 + 245] == (1 << PixelMask::NoisyPixelBit));
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 + 346] == ((1 << PixelMask::ErrorPixelBit) | (1 << PixelMask::NoisyPixelBit)));
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().noisy_pixel == 2);
CHECK(mask.GetStatistics().error_pixel == 3);
CHECK(mask.GetStatistics().user_mask == 0);
}
@@ -169,52 +169,11 @@ TEST_CASE("PixelMask_SCs","[PixelMask]") {
CHECK(mask_out[456] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask_out[RAW_MODULE_SIZE * 1 + 324] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask_out[RAW_MODULE_SIZE * 2 + 324] == (1 << PixelMask::TooHighPedestalRMSPixelBit));
CHECK(mask_out[RAW_MODULE_SIZE * 3 + 0] == ((1 << PixelMask::ErrorPixelBit) | (1 << PixelMask::TooHighPedestalRMSPixelBit)));
CHECK(mask_out[RAW_MODULE_SIZE * 2 + 324] == (1 << PixelMask::NoisyPixelBit));
CHECK(mask_out[RAW_MODULE_SIZE * 3 + 0] == ((1 << PixelMask::ErrorPixelBit) | (1 << PixelMask::NoisyPixelBit)));
CHECK(mask.GetStatistics().too_high_pedestal_rms == 2);
CHECK(mask.GetStatistics().wrong_gain == 3);
}
TEST_CASE("PixelMask_CalculateNexusMask_UserMaskRaw","[PixelMask]") {
DiffractionExperiment experiment(DetJF(4, 1, 8, 36, false));
experiment.MaskModuleEdges(false).MaskChipEdges(false);
PixelMask mask(experiment);
std::vector<uint32_t> v(4 * RAW_MODULE_SIZE, 0);
v[2] = 1;
v[4] = 1;
v[5] = 1;
REQUIRE_NOTHROW(mask.LoadUserMask(experiment, v));
auto mask_v = mask.GetMask(experiment);
REQUIRE(mask_v.size() == experiment.GetPixelsNum() );
REQUIRE(mask_v[0] == 0);
REQUIRE(mask_v[1] == 0);
REQUIRE(mask_v[2] == (1 << PixelMask::UserMaskedPixelBit));
REQUIRE(mask_v[3] == 0);
REQUIRE(mask_v[4] == (1 << PixelMask::UserMaskedPixelBit));
REQUIRE(mask_v[5] == (1 << PixelMask::UserMaskedPixelBit));
REQUIRE(mask_v[6] == 0);
REQUIRE(mask_v[1030 * 700 + 300] == 0);
REQUIRE(mask_v[(1030+8)*514] == (1 << PixelMask::ModuleGapPixelBit));
auto user_mask_v = mask.GetUserMask(experiment);
REQUIRE(user_mask_v.size() == experiment.GetPixelsNum() );
REQUIRE(user_mask_v[0] == 0);
REQUIRE(user_mask_v[1] == 0);
REQUIRE(user_mask_v[2] == 1);
REQUIRE(user_mask_v[3] == 0);
REQUIRE(user_mask_v[4] == 1);
REQUIRE(user_mask_v[5] == 1);
REQUIRE(user_mask_v[6] == 0);
REQUIRE(user_mask_v[1030 * 700 + 300] == 0);
REQUIRE(user_mask_v[(1030+8)*514] == 0);
CHECK(mask.GetStatistics().noisy_pixel == 2);
CHECK(mask.GetStatistics().error_pixel == 3);
}
TEST_CASE("PixelMask_CalculateNexusMask_UserMaskConv","[PixelMask]") {
@@ -262,3 +221,65 @@ TEST_CASE("PixelMask_MaskDetectorGaps","[PixelMask]") {
REQUIRE(mask_export[(1030*2+8)*514 + 566] == 1);
REQUIRE(mask_export[(1030*2+8)*(514*3+36*2+12) + 566] == 1);
}
TEST_CASE("PixelMask_LoadDECTRISBadPixelMask","[PixelMask]") {
DiffractionExperiment experiment(DetJF(4,1));
PixelMask mask(experiment);
std::vector<uint32_t> det_mask(experiment.GetPixelsNum(), 0);
det_mask[0] = (1 << PixelMask::UserMaskedPixelBit);
det_mask[534] = (1 << PixelMask::UserMaskedPixelBit) | (1 << PixelMask::ModuleGapPixelBit);
det_mask[535] = (1 << PixelMask::ModuleGapPixelBit);
det_mask[2 * 1000 * 5] = (1 << 3);
det_mask[2 * 1000 * 5 + 3] = (1 << 2);
det_mask[2 * 1000 * 5 + 4] = (1 << PixelMask::NoisyPixelBit);
det_mask[23 * 1000 * 5] = (1 << 5) | (1 << PixelMask::UserMaskedPixelBit);
mask.LoadDECTRISBadPixelMask(det_mask);
CHECK(mask.GetStatistics().user_mask == 2);
CHECK(mask.GetStatistics().error_pixel == 4);
CHECK(mask.GetStatistics().noisy_pixel == 0);
CHECK(mask.GetMask()[0] == (1 << PixelMask::UserMaskedPixelBit));
CHECK(mask.GetMask()[534] == (1 << PixelMask::ModuleGapPixelBit));
CHECK(mask.GetMask()[535] == (1 << PixelMask::ModuleGapPixelBit));
CHECK(mask.GetMask()[2 * 1000 * 5] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask.GetMask()[2 * 1000 * 5 + 3] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask.GetMask()[2 * 1000 * 5 + 4] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask.GetMask()[23 * 1000 * 5] == ((1 << PixelMask::ErrorPixelBit) | (1 << PixelMask::UserMaskedPixelBit)));
}
TEST_CASE("PixelMask_LoadDarkBadPixelMask","[PixelMask]") {
DiffractionExperiment experiment(DetJF(4,1));
PixelMask mask(experiment);
std::vector<uint32_t> det_mask(experiment.GetPixelsNum(), 0);
det_mask[0] = (1 << PixelMask::UserMaskedPixelBit);
det_mask[534] = (1 << PixelMask::UserMaskedPixelBit) | (1 << PixelMask::ModuleGapPixelBit);
det_mask[535] = (1 << PixelMask::ModuleGapPixelBit);
det_mask[2 * 1000 * 5] = (1 << 3);
det_mask[2 * 1000 * 5 + 3] = (1 << 2);
det_mask[2 * 1000 * 5 + 4] = (1 << PixelMask::NoisyPixelBit);
det_mask[23 * 1000 * 5] = (1 << 5) | (1 << PixelMask::UserMaskedPixelBit);
mask.LoadDECTRISBadPixelMask(det_mask);
std::vector<uint32_t> dark_mask(experiment.GetPixelsNum(), 0);
dark_mask[0] = 1; // user masked, should be included
dark_mask[534] = 1; // On gap, should be ignored
dark_mask[2 * 1000 * 5] = 1; // bad pixel, should be ignored
dark_mask[67867] = 1; // Nothing else, should be included
mask.LoadDarkBadPixelMask(dark_mask);
CHECK(mask.GetStatistics().user_mask == 2);
CHECK(mask.GetStatistics().error_pixel == 4);
CHECK(mask.GetStatistics().noisy_pixel == 2);
CHECK(mask.GetMask()[0] == (1 << PixelMask::UserMaskedPixelBit | 1 << PixelMask::NoisyPixelBit));
CHECK(mask.GetMask()[534] == (1 << PixelMask::ModuleGapPixelBit));
CHECK(mask.GetMask()[2 * 1000 * 5] == (1 << PixelMask::ErrorPixelBit));
CHECK(mask.GetMask()[67867] == (1 << PixelMask::NoisyPixelBit));
}