jfjoch_viewer: Calibrant can be freely chosen from options (LaB6, Ag behenate, current sample)

This commit is contained in:
2025-10-29 14:49:14 +01:00
parent effe97a970
commit 549c0fade1
7 changed files with 109 additions and 30 deletions
+16 -4
View File
@@ -98,8 +98,8 @@ TEST_CASE("DetGeomCalib_AnalyzeClusters") {
REQUIRE(ret[1].R_obs == Catch::Approx(100.0f));
}
TEST_CASE("DetGeomCalib_build_u") {
auto ret = CalculateCubicXtalRings(2.0);
TEST_CASE("DetGeomCalib_CalculateXtalRings_cubic") {
auto ret = CalculateXtalRings(UnitCell(2.0, 2.0, 2.0, 90, 90, 90));
CHECK(ret[0] == Catch::Approx(2.0 * M_PI * 1.0 / 2.0));
CHECK(ret[1] == Catch::Approx(2.0 * M_PI * sqrt( 2.0 )/ 2.0));
CHECK(ret[2] == Catch::Approx(2.0 * M_PI * sqrt( 3.0 )/ 2.0));
@@ -108,6 +108,18 @@ TEST_CASE("DetGeomCalib_build_u") {
CHECK(ret[6] == Catch::Approx(2.0 * M_PI * sqrt( 8.0 )/ 2.0));
}
TEST_CASE("DetGeomCalib_CalculateXtalRings_one_long_axis") {
auto ret = CalculateXtalRings(UnitCell(50.0, 2.0, 2.0, 90, 90, 90));
CHECK(ret[0] == Catch::Approx(2.0 * M_PI * 1.0 / 50.0));
CHECK(ret[1] == Catch::Approx(2.0 * M_PI * 2.0 / 50.0));
CHECK(ret[2] == Catch::Approx(2.0 * M_PI * 3.0 / 50.0));
CHECK(ret[3] == Catch::Approx(2.0 * M_PI * 4.0 / 50.0));
CHECK(ret[4] == Catch::Approx(2.0 * M_PI * 5.0 / 50.0));
}
TEST_CASE("DetGeomCalib_GuessDetectorDistance") {
std::vector<SpotToSave> spots;
@@ -178,7 +190,7 @@ TEST_CASE("DetGeomCalib_GuessGeometry") {
DiffractionGeometry geom_out;
geom_out.Wavelength_A(1.0).DetectorDistance_mm(200.0);
GuessGeometry(geom_out, spots, LAB6_CELL_A);
GuessGeometry(geom_out, spots, UnitCell(LAB6_CELL_A, LAB6_CELL_A, LAB6_CELL_A, 90,90,90));
CHECK(fabsf(geom_out.GetBeamX_pxl() - geom.GetBeamX_pxl()) < 0.001f);
CHECK(fabsf(geom_out.GetBeamY_pxl() - geom.GetBeamY_pxl()) < 0.001f);
@@ -246,7 +258,7 @@ TEST_CASE("DetGeomCalib_OptimizeGeometry") {
geom_i.Wavelength_A(1.0).BeamX_pxl(995.0).BeamY_pxl(1277.0)
.DetectorDistance_mm(98).PoniRot1_rad(0.0975).PoniRot2_rad(0.055);
OptimizeGeometry(geom_i, spots, lab6_a);
OptimizeGeometry(geom_i, spots, UnitCell(LAB6_CELL_A, LAB6_CELL_A, LAB6_CELL_A, 90,90,90));
CHECK(geom_i.GetBeamX_pxl() == Catch::Approx(geom.GetBeamX_pxl()));
CHECK(geom_i.GetBeamY_pxl() == Catch::Approx(geom.GetBeamY_pxl()));