From 0e5f74cadd7c1b9bb529963ee8c9b3fb55e3d679 Mon Sep 17 00:00:00 2001 From: Ross Whitfield <whitfieldre@ornl.gov> Date: Thu, 3 Oct 2019 11:50:18 -0400 Subject: [PATCH] Add unit test for ModHKL ranges and release notes --- .../test/FindUBUsingIndexedPeaksTest.h | 35 +++++++++++++++++++ Testing/Data/UnitTest/Modulated2.peaks.md5 | 1 + docs/source/release/v4.2.0/diffraction.rst | 1 + 3 files changed, 37 insertions(+) create mode 100644 Testing/Data/UnitTest/Modulated2.peaks.md5 diff --git a/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h b/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h index 4663cf6d2a9..67e4b6bd0fd 100644 --- a/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h +++ b/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h @@ -134,6 +134,41 @@ public: TS_ASSERT_DELTA(correct_err2[i], err_calculated2[i], 5e-4); } + // Remove workspace from the data service. + AnalysisDataService::Instance().remove("peaks"); + } + void test_mod2() { + // this test check that the ModHKL vectors are the correct ranges + // -0.5<q<=0.5 + LoadIsawPeaks alg1; + TS_ASSERT_THROWS_NOTHING(alg1.initialize()) + TS_ASSERT(alg1.isInitialized()) + alg1.setPropertyValue("Filename", "Modulated2.peaks"); + alg1.setPropertyValue("OutputWorkspace", "peaks"); + + TS_ASSERT(alg1.execute()); + TS_ASSERT(alg1.isExecuted()); + + PeaksWorkspace_sptr ws; + TS_ASSERT_THROWS_NOTHING( + ws = boost::dynamic_pointer_cast<PeaksWorkspace>( + AnalysisDataService::Instance().retrieve("peaks"))); + TS_ASSERT(ws); + if (!ws) + return; + + OrientedLattice latt = ws->mutableSample().getOrientedLattice(); + + double correct_modHKL[] = {-0.37658208, -0.00133659, 0., + -0.00140254, 0.3747229, 0., + 0.00176291, 0.00042566, 0.}; + + auto modHKL = latt.getModHKL().getVector(); + + for (size_t i = 0; i < 9; i++) { + TS_ASSERT_DELTA(correct_modHKL[i], modHKL[i], 5e-4); + } + // Remove workspace from the data service. AnalysisDataService::Instance().remove("peaks"); } diff --git a/Testing/Data/UnitTest/Modulated2.peaks.md5 b/Testing/Data/UnitTest/Modulated2.peaks.md5 new file mode 100644 index 00000000000..12c4eb94b51 --- /dev/null +++ b/Testing/Data/UnitTest/Modulated2.peaks.md5 @@ -0,0 +1 @@ +85bb4af4571b4bbbf107015feb270088 diff --git a/docs/source/release/v4.2.0/diffraction.rst b/docs/source/release/v4.2.0/diffraction.rst index 0e39bf12b8b..7e2aaea2ad8 100644 --- a/docs/source/release/v4.2.0/diffraction.rst +++ b/docs/source/release/v4.2.0/diffraction.rst @@ -47,6 +47,7 @@ Bug Fixes - :ref:`IndexPeaksWithSatellites <algm-IndexPeaksWithSatellites>` & :ref:`IndexPeaks <algm-IndexPeaks>` have been fixed so that they correctly report the number of main & satellite reflections that have been indexed. Also, if a satellite peak cannot be indexed its HKL is reset to 000 rather than accidentally setting it to the HKL of the main reflection. +- When calculating ModUB the ModHKL are now set to the range -0.5<q<=0.5 Imaging ------- -- GitLab