Dense per-pixel maps through the panel table (panel layout stage 1)
Every dense map that needs geometry now evaluates each image pixel at its place on the detector plane (DetectorModules), so it is right for a stacked panel layout and picks up refined module placements: - AzimuthalIntegrationMapping: bins, resolution, solid-angle/polarisation corrections built per pixel through the table; a pixel on no panel is left as a masked one. The geometry cache key now includes the panel table, so a mapping built after the stills module placement is rebuilt rather than served from the cache. ResolutionMaskBits follows (it is a lookup). - ROIMap / ExportROIMap: azimuthal ROIs on the plane (box and circle ROIs stay in image pixels). - ROIIntegration CPU+GPU: the weighted sums are taken per ROI and panel in image pixels and placed on the plane at the end (exact; the affine commutes with a weighted mean). - HotPixelFinder: ring/sector keys and the zeta of the persistence rule on the plane. - Background beam-centre walk CPU+GPU: pixels binned at their plane position; host and device share BackgroundPlanePoint so they stay bit-identical. New common/PanelRows.h: ForEachPixelInRows, ForEachPixel cut to a band of rows in index order, for the row-parallel builders. An empty table takes the old arithmetic in the old order: rotation sets and every single-panel input are unchanged. [PanelLayout] AzintMapping and ResolutionMask enabled (+ azimuthal ROI map and ROI centroid on the plane); new BeamCenterFromBackground_BinsOnThePlane and ROIIntegrationGPU_MatchesCPU_Panels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
This commit is contained in:
1 parent
c8fb472f4d
commit
dcad4104ce
22 files changed
+427
-134
No files matched your search
@@ -308,6 +308,45 @@ TEST_CASE("FindBeamCenter_BlanksTheBeamStopOutOfTheCapture", "[BeamCenter]") {
|
||||
CHECK(masked_error <= unmasked_error);
|
||||
}
|
||||
|
||||
// The pixels are binned where the panel table puts them on the plane. Every module of the image moved by
|
||||
// the same fractional step: the background is isotropic about the beam on the plane, and the walk, which
|
||||
// works on the plane, finds the beam there - not where it would be on the image.
|
||||
TEST_CASE("BeamCenterFromBackground_BinsOnThePlane", "[BeamCenter]") {
|
||||
DiffractionExperiment x = TestExperiment();
|
||||
std::vector<DetectorModule> moved = ModulesAsImaged(x.GetDetectorSetup().GetGeometry()).Get();
|
||||
REQUIRE(!moved.empty());
|
||||
for (auto &m: moved) {
|
||||
m.ox += 20.4;
|
||||
m.oy -= 11.3;
|
||||
}
|
||||
x.Modules(DetectorModules(moved));
|
||||
PixelMask pixel_mask(x);
|
||||
const auto &mask = pixel_mask.GetMask(x);
|
||||
|
||||
const DiffractionGeometry geom_true = OffsetBy(x.GetDiffractionGeometry(), 3.0f, -2.5f);
|
||||
std::vector<float> projection(x.GetPixelsNum(), NAN);
|
||||
std::mt19937 rng(20261021);
|
||||
std::normal_distribution<float> gauss(0.0f, 1.0f);
|
||||
x.GetModules().ForEachPixel(x.GetXPixelsNumConv(), x.GetYPixelsNumConv(),
|
||||
[&](int64_t, size_t i, double px, double py) {
|
||||
if (mask[i] != 0)
|
||||
return;
|
||||
const float value = background(geom_true.TwoTheta_rad(static_cast<float>(px), static_cast<float>(py)), 60.0f);
|
||||
projection[i] = value + gauss(rng) * std::sqrt(value / 60.0f);
|
||||
});
|
||||
|
||||
const auto host = FindBeamCenterFromBackground(x, pixel_mask, projection, 0, {}, /*allow_device=*/false);
|
||||
REQUIRE(host.has_value());
|
||||
CHECK(host->beam_x_pxl == Catch::Approx(geom_true.GetBeamX_pxl()).margin(0.5));
|
||||
CHECK(host->beam_y_pxl == Catch::Approx(geom_true.GetBeamY_pxl()).margin(0.5));
|
||||
|
||||
// The device places the pixels the same way, to the bit.
|
||||
const auto device = FindBeamCenterFromBackground(x, pixel_mask, projection, 0, {}, /*allow_device=*/true);
|
||||
REQUIRE(device.has_value());
|
||||
CHECK(device->beam_x_pxl == host->beam_x_pxl);
|
||||
CHECK(device->beam_y_pxl == host->beam_y_pxl);
|
||||
}
|
||||
|
||||
#ifdef JFJOCH_USE_CUDA
|
||||
#include "../common/CUDAWrapper.h"
|
||||
|
||||
|
||||
Reference in new issue
Block a user