tests: hold the integer coordinate conversion to the module map
Build Packages / build:viewer-tgz:cpu (push) Successful in 6m40s
Build Packages / build:viewer-tgz:cuda (push) Successful in 7m28s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 10m51s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m20s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 11m38s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 12m35s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 11m39s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 12m10s
Build Packages / build:rpm (rocky8) (push) Successful in 11m55s
Build Packages / build:windows:nocuda (push) Successful in 19m48s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 12m4s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m42s
Build Packages / Generate python client (push) Successful in 20s
Build Packages / build:rpm (rocky9) (push) Successful in 13m33s
Build Packages / Create release (push) Skipped
Build Packages / Build documentation (push) Successful in 1m8s
Build Packages / XDS test (durin plugin) (push) Successful in 8m51s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m17s
Build Packages / DIALS test (push) Successful in 13m39s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m5s
Build Packages / build:windows:cuda (push) Successful in 21m16s
Build Packages / Unit tests (push) Successful in 1h47m1s
Build Packages / build:viewer-tgz:cpu (push) Successful in 6m40s
Build Packages / build:viewer-tgz:cuda (push) Successful in 7m28s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 10m51s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m20s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 11m38s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 12m35s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 11m39s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 12m10s
Build Packages / build:rpm (rocky8) (push) Successful in 11m55s
Build Packages / build:windows:nocuda (push) Successful in 19m48s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 12m4s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m42s
Build Packages / Generate python client (push) Successful in 20s
Build Packages / build:rpm (rocky9) (push) Successful in 13m33s
Build Packages / Create release (push) Skipped
Build Packages / Build documentation (push) Successful in 1m8s
Build Packages / XDS test (durin plugin) (push) Successful in 8m51s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m17s
Build Packages / DIALS test (push) Successful in 13m39s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m5s
Build Packages / build:windows:cuda (push) Successful in 21m16s
Build Packages / Unit tests (push) Successful in 1h47m1s
ConvertToImageCoordinates now transforms the photon-weighted sums instead of the centroid, which is only equivalent because a module's raw -> image map is a signed axis swap plus an integer translation. Check that against the map itself on every module of a detector whose modules do not share an orientation, and either side of the 256-column multipixel gaps where the translation changes. A wrong sign or a dropped gap term on any single module would otherwise only show up as mispositioned spots on that module. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
#include "../common/DiffractionSpot.h"
|
||||
#include "../common/RawToConvertedGeometry.h"
|
||||
|
||||
TEST_CASE("DiffractionSpot_ConvertToImageCoordinates", "[LinearAlgebra][Coord]") {
|
||||
DiffractionExperiment experiment(DetJF(4, 2, 8, 36, true));
|
||||
@@ -20,3 +21,30 @@ TEST_CASE("DiffractionSpot_ConvertToImageCoordinates", "[LinearAlgebra][Coord]")
|
||||
REQUIRE(spot_1.RawCoord().y == Catch::Approx(CONVERTED_MODULE_LINES * 2 + 36 - 1 - 300.25 - 2));
|
||||
REQUIRE(spot_1.Count() == 12 * 2 + 4 * 2);
|
||||
}
|
||||
|
||||
// ConvertToImageCoordinates transforms the photon-weighted SUMS in integers rather than converting
|
||||
// the centroid, which is only equivalent because the module map is a signed axis swap plus an
|
||||
// integer translation. Hold it to the map it is standing in for, on every module of a detector
|
||||
// whose modules do not all share an orientation, and either side of the 256-column multipixel gaps
|
||||
// where the translation changes.
|
||||
TEST_CASE("DiffractionSpot_ConvertMatchesModuleMap", "[LinearAlgebra][Coord]") {
|
||||
DiffractionExperiment experiment(DetJF(8, 2, 8, 36, true));
|
||||
|
||||
for (uint16_t module = 0; module < experiment.GetModulesNum(); module++) {
|
||||
for (const auto [col, line] : {std::pair<uint32_t, uint32_t>{3, 5},
|
||||
{255, 255}, {256, 256}, {700, 300}, {1020, 505}}) {
|
||||
INFO("module " << module << " pixel " << col << "," << line);
|
||||
// Two pixels of unequal weight, so the centroid is a genuine fraction rather than a
|
||||
// pixel centre - a whole-pixel centroid would not notice a lost fractional part.
|
||||
DiffractionSpot spot(col, line, 7);
|
||||
spot += DiffractionSpot(col, line + 1, 3);
|
||||
const Coord raw = spot.RawCoord();
|
||||
|
||||
spot.ConvertToImageCoordinates(experiment, module);
|
||||
const Coord expected = RawToConvertedCoordinate(experiment, module, raw);
|
||||
REQUIRE(spot.RawCoord().x == Catch::Approx(expected.x));
|
||||
REQUIRE(spot.RawCoord().y == Catch::Approx(expected.y));
|
||||
REQUIRE(spot.Count() == 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user