diff --git a/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp b/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp index 2726cddd92ce9f6389b68c8c1ae144ace1ad2be5..bf558f0d064ea7dddb30f2fc6ba3a391b7f196ec 100644 --- a/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp +++ b/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp @@ -3,7 +3,7 @@ #include "MantidKernel/MDUnit.h" #include "MantidKernel/UnitLabelTypes.h" #include "MantidGeometry/MDGeometry/MDFrame.h" - +#include <boost/regex.hpp> namespace Mantid { namespace Geometry { @@ -58,9 +58,13 @@ bool HKLFrameFactory::canInterpret(const MDFrameArgument &argument) const { auto unitFactoryChain = Kernel::makeMDUnitFactoryChain(); auto mdUnit = unitFactoryChain->create(argument.unitString); // We expect units to be RLU or A^-1 - const bool compatibleUnit = - (mdUnit->getUnitLabel() == Units::Symbol::InverseAngstrom || - mdUnit->getUnitLabel() == Units::Symbol::RLU); + auto isInverseAngstrom = + mdUnit->getUnitLabel() == Units::Symbol::InverseAngstrom; + auto isRLU = mdUnit->getUnitLabel() == Units::Symbol::RLU; + boost::regex pattern("in.*A.*\\^-1"); + auto isHoraceStyle = + boost::regex_match(mdUnit->getUnitLabel().ascii(), pattern); + const bool compatibleUnit = isInverseAngstrom || isRLU || isHoraceStyle; // Check both the frame name and the unit name return argument.frameString == HKL::HKLName && compatibleUnit; } diff --git a/Framework/Geometry/test/MDFrameFactoryTest.h b/Framework/Geometry/test/MDFrameFactoryTest.h index e50d8015a1ab3a43e2570efae5e5828c4710fc5e..8032c178dd12009d7bb746ca43e6b3f58818285c 100644 --- a/Framework/Geometry/test/MDFrameFactoryTest.h +++ b/Framework/Geometry/test/MDFrameFactoryTest.h @@ -104,6 +104,10 @@ public: TSM_ASSERT("Should offer to produce HKL products", factory.canInterpret( MDFrameArgument(HKL::HKLName, Units::Symbol::RLU))); + + TSM_ASSERT( + "Should offer to produce HKL products", + factory.canInterpret(MDFrameArgument(HKL::HKLName, "in 1.684 A^-1"))); } void test_HKLFrameFactory_create_inverse_angstroms() {