v1.0.0-rc.97
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
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:
+58
-37
@@ -17,19 +17,7 @@ PixelMask::PixelMask(const DiffractionExperiment &experiment)
|
||||
CalcEdgePixels(experiment);
|
||||
}
|
||||
|
||||
PixelMask::PixelMask(const std::vector<uint32_t> &in_mask) : mask(in_mask) {
|
||||
statistics.user_mask = 0;
|
||||
statistics.wrong_gain = 0;
|
||||
statistics.too_high_pedestal_rms = 0;
|
||||
for (unsigned int i : mask) {
|
||||
if (i & (1 << UserMaskedPixelBit))
|
||||
statistics.user_mask++;
|
||||
if (i & (1 << ErrorPixelBit))
|
||||
statistics.wrong_gain++;
|
||||
if (i & (1 << TooHighPedestalRMSPixelBit))
|
||||
statistics.too_high_pedestal_rms++;
|
||||
}
|
||||
}
|
||||
PixelMask::PixelMask(const std::vector<uint32_t> &in_mask) : mask(in_mask) {}
|
||||
|
||||
uint32_t PixelMask::LoadMask(const std::vector<uint32_t> &input_mask, uint8_t bit) {
|
||||
uint32_t ret = 0;
|
||||
@@ -130,11 +118,8 @@ std::vector<uint32_t> PixelMask::GetUserMask(const DiffractionExperiment& experi
|
||||
|
||||
|
||||
void PixelMask::LoadDetectorBadPixelMask(const DiffractionExperiment &experiment, const JFCalibration *calib) {
|
||||
if (experiment.GetDetectorType() == DetectorType::DECTRIS) {
|
||||
statistics.wrong_gain = 0;
|
||||
statistics.too_high_pedestal_rms = 0;
|
||||
if (experiment.GetDetectorType() == DetectorType::DECTRIS)
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> input_mask(experiment.GetModulesNum() * RAW_MODULE_SIZE, 0);
|
||||
std::vector<uint32_t> input_mask_rms(experiment.GetModulesNum() * RAW_MODULE_SIZE, 0);
|
||||
@@ -167,27 +152,44 @@ void PixelMask::LoadDetectorBadPixelMask(const DiffractionExperiment &experiment
|
||||
|
||||
std::vector<uint32_t> input_mask_conv(experiment.GetPixelsNumConv(), 0);
|
||||
RawToConvertedGeometry(experiment, input_mask_conv.data(), input_mask.data());
|
||||
statistics.wrong_gain = LoadMask(input_mask_conv, ErrorPixelBit);
|
||||
|
||||
std::vector<uint32_t> input_mask_rms_conv(experiment.GetPixelsNumConv(), 0);
|
||||
RawToConvertedGeometry(experiment, input_mask_rms_conv.data(), input_mask_rms.data());
|
||||
statistics.too_high_pedestal_rms = LoadMask(input_mask_rms_conv, TooHighPedestalRMSPixelBit);
|
||||
|
||||
LoadMask(input_mask_conv, ErrorPixelBit);
|
||||
LoadMask(input_mask_rms_conv, NoisyPixelBit);
|
||||
|
||||
CalcEdgePixels(experiment);
|
||||
}
|
||||
|
||||
|
||||
PixelMaskStatistics PixelMask::GetStatistics() const {
|
||||
return statistics;
|
||||
PixelMaskStatistics ret{};
|
||||
for (const auto &i: mask) {
|
||||
if (i & (1 << ModuleGapPixelBit))
|
||||
ret.module_gap_pixel++;
|
||||
else {
|
||||
if (i != 0)
|
||||
ret.total_masked++;
|
||||
if (i & (1 << ErrorPixelBit))
|
||||
ret.error_pixel++;
|
||||
if (i & (1 << NoisyPixelBit))
|
||||
ret.noisy_pixel++;
|
||||
if (i & (1 << UserMaskedPixelBit))
|
||||
ret.user_mask++;
|
||||
if (i & ((1 << ChipGapPixelBit) | (1 << ModuleEdgePixelBit)))
|
||||
ret.chip_gap_pixel++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void PixelMask::LoadUserMask(const DiffractionExperiment& experiment, const std::vector<uint32_t> &in_mask) {
|
||||
if (in_mask.size() == mask.size()) {
|
||||
statistics.user_mask = LoadMask(in_mask, UserMaskedPixelBit);
|
||||
LoadMask(in_mask, UserMaskedPixelBit);
|
||||
} else if (in_mask.size() == experiment.GetModulesNum() * RAW_MODULE_SIZE) {
|
||||
std::vector<uint32_t> tmp(experiment.GetPixelsNumConv(), 0);
|
||||
RawToConvertedGeometry(experiment, tmp.data(), in_mask. data());
|
||||
statistics.user_mask = LoadMask(tmp, UserMaskedPixelBit);
|
||||
LoadMask(tmp, UserMaskedPixelBit);
|
||||
} else
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Size of input user mask invalid");
|
||||
@@ -199,22 +201,41 @@ void PixelMask::LoadDECTRISBadPixelMask(const std::vector<uint32_t> &input_mask)
|
||||
"Input match doesn't fit the detector ");
|
||||
|
||||
uint32_t user_bitmask = (1 << UserMaskedPixelBit);
|
||||
uint32_t det_bitmask = ~user_bitmask;
|
||||
uint32_t bad_pixel_bitmask = ~((1 << UserMaskedPixelBit) | (1 << ModuleGapPixelBit) | (1 << ChipGapPixelBit));
|
||||
|
||||
statistics.user_mask = 0;
|
||||
statistics.wrong_gain = 0;
|
||||
statistics.too_high_pedestal_rms = 0;
|
||||
|
||||
for (int i = 0; i < mask.size(); i++) {
|
||||
uint32_t user_mask = (mask[i] & user_bitmask);
|
||||
if (user_mask != 0)
|
||||
++statistics.user_mask;
|
||||
uint32_t detector_mask = (input_mask[i] & det_bitmask);
|
||||
uint32_t bad_pixel = (input_mask[i] & bad_pixel_bitmask);
|
||||
if (bad_pixel != 0)
|
||||
++statistics.wrong_gain;
|
||||
|
||||
mask[i] = user_mask | detector_mask;
|
||||
if ((input_mask[i] & (1 << ModuleGapPixelBit)) != 0) {
|
||||
mask[i] = (1 << ModuleGapPixelBit);
|
||||
} else {
|
||||
mask[i] = 0;
|
||||
if (input_mask[i] & bad_pixel_bitmask) {
|
||||
mask[i] |= (1 << ErrorPixelBit);
|
||||
}
|
||||
// User and chip gap are just transferred
|
||||
if ((input_mask[i] & (1 << UserMaskedPixelBit)) != 0) {
|
||||
mask[i] |= (1 << UserMaskedPixelBit);
|
||||
}
|
||||
if ((input_mask[i] & (1 << ChipGapPixelBit)) != 0) {
|
||||
mask[i] |= (1 << ChipGapPixelBit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PixelMask::LoadDarkBadPixelMask(const std::vector<uint32_t> &input_mask) {
|
||||
if (input_mask.size() != mask.size())
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Input match doesn't fit the detector ");
|
||||
|
||||
for (int i = 0; i < mask.size(); i++) {
|
||||
// Ignore module gap (doesn't matter) or bad pixels
|
||||
if ((mask[i] & (1 << ModuleGapPixelBit | 1 << ErrorPixelBit)) != 0)
|
||||
continue;
|
||||
|
||||
if (input_mask[i] != 0) {
|
||||
mask[i] |= (1 << NoisyPixelBit);
|
||||
} else {
|
||||
mask[i] &= ~(1 << NoisyPixelBit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user