diff --git a/Code/Mantid/Framework/Crystal/inc/MantidCrystal/PeaksInRegion.h b/Code/Mantid/Framework/Crystal/inc/MantidCrystal/PeaksInRegion.h index 1088c829c798b0e7ac5ac7736d27f57e1efcad5e..138b0be440a67bbb8f64c0cfaff7bd08125ef3c8 100644 --- a/Code/Mantid/Framework/Crystal/inc/MantidCrystal/PeaksInRegion.h +++ b/Code/Mantid/Framework/Crystal/inc/MantidCrystal/PeaksInRegion.h @@ -53,4 +53,4 @@ namespace Crystal } // namespace Crystal } // namespace Mantid -#endif /* MANTID_CRYSTAL_PEAKSINREGION_H_ */ \ No newline at end of file +#endif /* MANTID_CRYSTAL_PEAKSINREGION_H_ */ diff --git a/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp b/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp index bebc1b3fe44a95f761c0d8dd81f8caa03837d5ca..883322741c4cf68d4ee14bdb1be346bbcf383e60 100644 --- a/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp +++ b/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp @@ -13,6 +13,7 @@ Determines which peaks intersect a defined region in either QLab, QSample or HKL #include "MantidKernel/ListValidator.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/MandatoryValidator.h" +#include "MantidKernel/EnabledWhenProperty.h" #include "MantidDataObjects/TableWorkspace.h" using namespace Mantid::Kernel; @@ -100,6 +101,10 @@ namespace Crystal " HKL" ); + declareProperty("CheckPeakExtents", false, "Include any peak in the region that has a shape extent extending into that region."); + + declareProperty("PeakRadius", 0.0, "Effective peak radius in CoordinateFrame"); + auto manditoryExtents = boost::make_shared<Mantid::Kernel::MandatoryValidator<std::vector<double> > >(); std::vector<double> extents(2,0); @@ -110,6 +115,28 @@ namespace Crystal "specifying the extents of each dimension. Optional, default +-50 in each dimension."); declareProperty(new WorkspaceProperty<ITableWorkspace>("OutputWorkspace","",Direction::Output), "An output table workspace. Two columns. Peak index into input workspace, and boolean, where true is for positive intersection."); + + setPropertySettings("PeakRadius", new EnabledWhenProperty("CheckPeakExtents", IS_NOT_DEFAULT) ); + } + + void validateExtentsInput(std::vector<double>& extents) + { + if(extents.size() != 6) + { + throw std::invalid_argument("Six commma separated entries for the extents expected"); + } + if(extents[0] >= extents[1]) + { + throw std::invalid_argument("xmin >= xmax"); + } + if(extents[2] >= extents[3]) + { + throw std::invalid_argument("ymin >= ymax"); + } + if(extents[4] >= extents[5]) + { + throw std::invalid_argument("zmin >= zmax"); + } } //---------------------------------------------------------------------------------------------- @@ -118,13 +145,12 @@ namespace Crystal void PeaksInRegion::exec() { std::vector<double> extents = this->getProperty("Extents"); - if(extents.size() != 6) - { - throw std::invalid_argument("Six commma separated entries for the extents expected"); - } + validateExtentsInput(extents); const std::string coordinateFrame = this->getPropertyValue("CoordinateFrame"); IPeaksWorkspace_sptr ws = this->getProperty("InputWorkspace"); + const bool checkPeakExtents = this->getProperty("CheckPeakExtents"); + const double peakRadius = this->getProperty("PeakRadius"); boost::function<V3D(IPeak*)> coordFrameFunc = &IPeak::getHKL; if(coordinateFrame == detectorSpaceFrame()) @@ -146,10 +172,54 @@ namespace Crystal outputWorkspace->addColumn("int", "PeakIndex"); outputWorkspace->addColumn("bool", "Intersecting"); - // Candidate for parallelisation. - PARALLEL_FOR2(ws, outputWorkspace) - for(int i = 0; i < nPeaks; ++i) + const int minXIndex = 0; + const int maxXIndex = 1; + const int minYIndex = 2; + const int maxYIndex = 3; + const int minZIndex = 4; + const int maxZIndex = 5; + + // Clockwise ordering of points around the extents box + /* + + on front face. Positive z extends into plane. + + p2|---|p3 + | | + p1|---|p4 + */ + V3D point1(extents[minXIndex], extents[minYIndex], extents[minZIndex]); + V3D point2(extents[minXIndex], extents[maxYIndex], extents[minZIndex]); + V3D point3(extents[maxXIndex], extents[maxYIndex], extents[minZIndex]); + V3D point4(extents[maxXIndex], extents[minYIndex], extents[minZIndex]); + V3D point5(extents[minXIndex], extents[minYIndex], extents[maxZIndex]); + V3D point6(extents[minXIndex], extents[maxYIndex], extents[maxZIndex]); + V3D point7(extents[maxXIndex], extents[maxYIndex], extents[maxZIndex]); + V3D point8(extents[maxXIndex], extents[minYIndex], extents[maxZIndex]); + + V3D faces[6][3] = + { + {point1, point5, point6} // These define a face normal to x at xmin. + ,{point4, point7, point8} // These define a face normal to x at xmax. + ,{point1, point4, point8} // These define a face normal to y at ymin. + ,{point2, point3, point7} // These define a face normal to y at ymax. + ,{point1, point2, point3} // These define a face normal to z at zmin. + ,{point5, point6, point7} + }; // These define a face normal to z at zmax. + + // Calculate the normals for each face. + V3D normals[6]; + for(int i = 0; i < 6; ++i) { + V3D* face = faces[i]; + normals[i] = (face[1] - face[0]).cross_prod((face[2] - face[0])); + normals[i].normalize(); + } + + // Candidate for parallelisation. + PARALLEL_FOR2(ws, outputWorkspace) + for(int i = 0; i < nPeaks; ++i) + { PARALLEL_START_INTERUPT_REGION IPeak* peak = ws->getPeakPtr(i); V3D peakCenter = coordFrameFunc(peak); @@ -159,8 +229,23 @@ namespace Crystal || peakCenter[1] < extents[2] || peakCenter[1] >= extents[3] || peakCenter[2] < extents[4] || peakCenter[2] >= extents[5]) { + // Out of bounds. doesIntersect = false; + + if(checkPeakExtents) + { + // Take account of radius spherical extents. + for(int i = 0; i < 6; ++i) + { + double distance = normals[i].scalar_prod(peakCenter - faces[i][0]); // Distance between plane and peak center. + if(peakRadius > std::abs(normals[i].scalar_prod(peakCenter - faces[i][0]))) // Sphere passes through one of the faces, so intersects the box. + { + doesIntersect = true; + break; + } + } + } } TableRow row = outputWorkspace->getRow(i); @@ -176,4 +261,4 @@ namespace Crystal } // namespace Crystal -} // namespace Mantid \ No newline at end of file +} // namespace Mantid diff --git a/Code/Mantid/Framework/Crystal/test/PeaksInRegionTest.h b/Code/Mantid/Framework/Crystal/test/PeaksInRegionTest.h index 0e2e54c66c8233171a038a9ac184ae63a04d1736..a25d7dcca70a91157b17cda9a89307837b185f76 100644 --- a/Code/Mantid/Framework/Crystal/test/PeaksInRegionTest.h +++ b/Code/Mantid/Framework/Crystal/test/PeaksInRegionTest.h @@ -80,7 +80,7 @@ public: alg.setPropertyValue("OutputWorkspace", "OutWS"); } - void test_badExtents() + void do_test_extents_throws(const std::string& message, const std::string& extents) { PeaksInRegion alg; alg.setRethrows(true); @@ -88,17 +88,33 @@ public: TS_ASSERT( alg.isInitialized() ) ; alg.setProperty("InputWorkspace", WorkspaceCreationHelper::createPeaksWorkspace()); alg.setPropertyValue("CoordinateFrame", "Q (lab frame)"); - alg.setPropertyValue("Extents", "-1,1,-1,1,-1,1, -1"); // Too many + alg.setPropertyValue("Extents", extents); alg.setPropertyValue("OutputWorkspace", "OutWS"); - TS_ASSERT_THROWS( alg.execute(), std::invalid_argument&); + TSM_ASSERT_THROWS(message, alg.execute(), std::invalid_argument&); + } - alg.setPropertyValue("Extents", "-1"); // Too few + void test_bad_extent_format_too_few() + { + do_test_extents_throws("Too few extents", "-1,1,-1,1,-1,1,-1"); + } - TS_ASSERT_THROWS( alg.execute(), std::invalid_argument&); + void test_bad_extent_format_too_many() + { + do_test_extents_throws("Too many extents", "-1,1,-1,1,-1,1,-1,1,-1"); } - void do_test_within_bounds(const std::string coordFrame) + void test_bad_extent_pairs() + { + do_test_extents_throws("Invalid x extents", "-1,-1,-1,1,-1,1"); + + do_test_extents_throws("Invalid y extents", "-1,1,-1,-1,-1,1"); + + do_test_extents_throws("Invalid z extents", "-1,1,-1,1,-1,-1"); + + } + + void do_test_within_bounds_center_only(const std::string& coordFrame) { const std::string outName = "OutWS"; const double xMinFromPeak = 1; @@ -131,12 +147,11 @@ public: TSM_ASSERT_EQUALS("Peak intersect should be true", Boolean(true), outWS->cell<Boolean>(0, 1)); } - void do_test_out_of_bounds(const std::string coordFrame, double xMinFromPeak, double xMaxFromPeak, double yMinFromPeak, double yMaxFromPeak, double zMinFromPeak, double zMaxFromPeak) + void do_test_out_of_bounds_center_only(const std::string& coordFrame, double xMinFromPeak, double xMaxFromPeak, double yMinFromPeak, double yMaxFromPeak, double zMinFromPeak, double zMaxFromPeak) { const std::string outName = "OutWS"; PeakWorkspaceWithExtents tuple = createPeaksWorkspace(coordFrame, xMinFromPeak, xMaxFromPeak, yMinFromPeak, yMaxFromPeak, zMinFromPeak, zMaxFromPeak); - PeaksInRegion alg; alg.setRethrows(true); alg.initialize(); @@ -144,6 +159,7 @@ public: alg.setPropertyValue("CoordinateFrame", coordFrame); alg.setProperty("Extents", tuple.get<1>()); alg.setPropertyValue("OutputWorkspace", outName); + alg.setProperty("CheckPeakExtents", true); alg.execute(); ITableWorkspace_sptr outWS = AnalysisDataService::Instance().retrieveWS<ITableWorkspace>(outName); @@ -151,7 +167,6 @@ public: TS_ASSERT_EQUALS(2, outWS->columnCount()); TS_ASSERT_EQUALS("PeakIndex", outWS->getColumn(0)->name()); TS_ASSERT_EQUALS("Intersecting", outWS->getColumn(1)->name()); - TS_ASSERT_EQUALS(1, outWS->rowCount()); TSM_ASSERT_EQUALS("Peak index should be zero", 0, outWS->cell<int>(0, 0)); @@ -160,73 +175,168 @@ public: void test_detectorSpace_with_peak_in_bounds() { - do_test_within_bounds("Detector space"); + do_test_within_bounds_center_only("Detector space"); } void test_qLab_with_peak_in_bounds() { - do_test_within_bounds("Q (lab frame)"); + do_test_within_bounds_center_only("Q (lab frame)"); } void test_qSample_with_peak_in_bounds() { - do_test_within_bounds("Q (sample frame)"); + do_test_within_bounds_center_only("Q (sample frame)"); } void test_HKL_with_peak_in_bounds() { - do_test_within_bounds("HKL"); + do_test_within_bounds_center_only("HKL"); } void test_detectorSpace_with_peaks_out_of_bounds() { const std::string coordinateFrame = "Detector space"; - do_test_out_of_bounds(coordinateFrame, -1, 1, 1, 1, 1, 1); // outside xmin - do_test_out_of_bounds(coordinateFrame, 1, -1, 1, 1, 1, 1); // outside xmax - do_test_out_of_bounds(coordinateFrame, 1, 1, -1, 1, 1, 1); // outside ymin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, -1, 1, 1); // outside ymax - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, -1, 1); // outside zmin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, 1, -1); // outside zmax + do_test_out_of_bounds_center_only(coordinateFrame, -0.5, 1, 1, 1, 1, 1); // outside xmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, -0.5, 1, 1, 1, 1); // outside xmax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, -0.5, 1, 1, 1); // outside ymin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, -0.5, 1, 1); // outside ymax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, -0.5, 1); // outside zmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, 1, -0.5); // outside zmax } void test_qLab_with_peaks_out_of_bounds() { const std::string coordinateFrame = "Q (lab frame)"; - do_test_out_of_bounds(coordinateFrame, -1, 1, 1, 1, 1, 1); // outside xmin - do_test_out_of_bounds(coordinateFrame, 1, -1, 1, 1, 1, 1); // outside xmax - do_test_out_of_bounds(coordinateFrame, 1, 1, -1, 1, 1, 1); // outside ymin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, -1, 1, 1); // outside ymax - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, -1, 1); // outside zmin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, 1, -1); // outside zmax + do_test_out_of_bounds_center_only(coordinateFrame, -0.5, 1, 1, 1, 1, 1); // outside xmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, -0.5, 1, 1, 1, 1); // outside xmax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, -0.5, 1, 1, 1); // outside ymin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, -0.5, 1, 1); // outside ymax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, -0.5, 1); // outside zmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, 1, -0.5); // outside zmax } void test_qSample_with_peaks_out_of_bounds() { const std::string coordinateFrame = "Q (sample frame)"; - do_test_out_of_bounds(coordinateFrame, -1, 1, 1, 1, 1, 1); // outside xmin - do_test_out_of_bounds(coordinateFrame, 1, -1, 1, 1, 1, 1); // outside xmax - do_test_out_of_bounds(coordinateFrame, 1, 1, -1, 1, 1, 1); // outside ymin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, -1, 1, 1); // outside ymax - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, -1, 1); // outside zmin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, 1, -1); // outside zmax + do_test_out_of_bounds_center_only(coordinateFrame, -0.5, 1, 1, 1, 1, 1); // outside xmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, -0.5, 1, 1, 1, 1); // outside xmax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, -0.5, 1, 1, 1); // outside ymin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, -0.5, 1, 1); // outside ymax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, -0.5, 1); // outside zmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, 1, -0.5); // outside zmax } void test_qHKL_with_peaks_out_of_bounds() { const std::string coordinateFrame = "HKL"; - do_test_out_of_bounds(coordinateFrame, -1, 1, 1, 1, 1, 1); // outside xmin - do_test_out_of_bounds(coordinateFrame, 1, -1, 1, 1, 1, 1); // outside xmax - do_test_out_of_bounds(coordinateFrame, 1, 1, -1, 1, 1, 1); // outside ymin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, -1, 1, 1); // outside ymax - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, -1, 1); // outside zmin - do_test_out_of_bounds(coordinateFrame, 1, 1, 1, 1, 1, -1); // outside zmax + do_test_out_of_bounds_center_only(coordinateFrame, -0.5, 1, 1, 1, 1, 1); // outside xmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, -0.5, 1, 1, 1, 1); // outside xmax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, -0.5, 1, 1, 1); // outside ymin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, -0.5, 1, 1); // outside ymax + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, -0.5, 1); // outside zmin + do_test_out_of_bounds_center_only(coordinateFrame, 1, 1, 1, 1, 1, -0.5); // outside zmax + } + + void do_test_bounds_check_extents(const std::string coordFrame, double xMinFromPeak, double xMaxFromPeak, double yMinFromPeak, double yMaxFromPeak, double zMinFromPeak, double zMaxFromPeak, double radius, bool expectation) + { + const std::string outName = "OutWS"; + + PeakWorkspaceWithExtents tuple = createPeaksWorkspace(coordFrame, xMinFromPeak, xMaxFromPeak, yMinFromPeak, yMaxFromPeak, zMinFromPeak, zMaxFromPeak); + PeaksInRegion alg; + alg.setRethrows(true); + alg.initialize(); + alg.setProperty("InputWorkspace", tuple.get<0>()); + alg.setPropertyValue("CoordinateFrame", coordFrame); + alg.setProperty("Extents", tuple.get<1>()); + alg.setPropertyValue("OutputWorkspace", outName); + alg.setProperty("CheckPeakExtents", true); + alg.setProperty("PeakRadius", radius); + alg.execute(); + + ITableWorkspace_sptr outWS = AnalysisDataService::Instance().retrieveWS<ITableWorkspace>(outName); + + TS_ASSERT_EQUALS(1, outWS->rowCount()); + TSM_ASSERT_EQUALS("Peak index should be zero", 0, outWS->cell<int>(0, 0)); + TSM_ASSERT_EQUALS("Peak intersect calculated incorrectly", Boolean(expectation), outWS->cell<Boolean>(0, 1)); + } + + void test_peak_intersects_xmin_boundary_when_radius_large_enough() + { + const std::string coordinateFrame = "Detector space"; + const double wallDistanceFromPeakCenter = 0.5; + + double peakRadius = 0.49; // not enough for the sphere to penetrate the bounding box. Expect failure + do_test_bounds_check_extents(coordinateFrame, -wallDistanceFromPeakCenter, 1, 1, 1, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + + peakRadius = 0.51; // just enough for the sphere to penetrate the bounding box. Expect pass. + do_test_bounds_check_extents(coordinateFrame, -wallDistanceFromPeakCenter, 1, 1, 1, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + } + + void test_peak_intersects_xmax_boundary_when_radius_large_enough() + { + const std::string coordinateFrame = "Detector space"; + const double wallDistanceFromPeakCenter = 0.5; + + double peakRadius = 0.49; // not enough for the sphere to penetrate the bounding box. Expect failure + do_test_bounds_check_extents(coordinateFrame, 1, -wallDistanceFromPeakCenter, 1, 1, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + + peakRadius = 0.51; // just enough for the sphere to penetrate the bounding box. Expect pass. + do_test_bounds_check_extents(coordinateFrame, 1, -wallDistanceFromPeakCenter, 1, 1, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + } + + void test_peak_intersects_ymin_boundary_when_radius_large_enough() + { + const std::string coordinateFrame = "Detector space"; + const double wallDistanceFromPeakCenter = 0.5; + + double peakRadius = 0.49; // not enough for the sphere to penetrate the bounding box. Expect failure + do_test_bounds_check_extents(coordinateFrame, 1, 1, -wallDistanceFromPeakCenter, 1, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + + peakRadius = 0.51; // just enough for the sphere to penetrate the bounding box. Expect pass. + do_test_bounds_check_extents(coordinateFrame, 1, 1, -wallDistanceFromPeakCenter, 1, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + } + + void test_peak_intersects_ymax_boundary_when_radius_large_enough() + { + const std::string coordinateFrame = "Detector space"; + const double wallDistanceFromPeakCenter = 0.5; + + double peakRadius = 0.49; // not enough for the sphere to penetrate the bounding box. Expect failure + do_test_bounds_check_extents(coordinateFrame, 1, 1, 1, -wallDistanceFromPeakCenter, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + + peakRadius = 0.51; // just enough for the sphere to penetrate the bounding box. Expect pass. + do_test_bounds_check_extents(coordinateFrame, 1, 1, 1, -wallDistanceFromPeakCenter, 1, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + } + + void test_peak_intersects_zmin_boundary_when_radius_large_enough() + { + const std::string coordinateFrame = "Detector space"; + const double wallDistanceFromPeakCenter = 0.5; + + double peakRadius = 0.49; // not enough for the sphere to penetrate the bounding box. Expect failure + do_test_bounds_check_extents(coordinateFrame, 1, 1, 1, 1, -wallDistanceFromPeakCenter, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + + peakRadius = 0.51; // just enough for the sphere to penetrate the bounding box. Expect pass. + do_test_bounds_check_extents(coordinateFrame, 1, 1, 1, 1, -wallDistanceFromPeakCenter, 1, peakRadius, peakRadius > wallDistanceFromPeakCenter); + } + + void test_peak_intersects_zmax_boundary_when_radius_large_enough() + { + const std::string coordinateFrame = "Detector space"; + const double wallDistanceFromPeakCenter = 0.5; + + double peakRadius = 0.49; // not enough for the sphere to penetrate the bounding box. Expect failure + do_test_bounds_check_extents(coordinateFrame, 1, 1, 1, 1, 1, -wallDistanceFromPeakCenter, peakRadius, peakRadius > wallDistanceFromPeakCenter); + + peakRadius = 0.51; // just enough for the sphere to penetrate the bounding box. Expect pass. + do_test_bounds_check_extents(coordinateFrame, 1, 1, 1, 1, 1, -wallDistanceFromPeakCenter, peakRadius, peakRadius > wallDistanceFromPeakCenter); } }; /*------------------------------------------------------------------------------------------------------------------------------------------------------- -Functional Tests +Perfomance Tests -------------------------------------------------------------------------------------------------------------------------------------------------------*/ class PeaksInRegionTestPerformance : public CxxTest::TestSuite { @@ -249,12 +359,12 @@ public: for (int i = 0; i < numPeaks; ++i) { - Peak peak(inst, i, i+0.5); + Peak peak(inst, i, i+-0.5); inputWS->addPeak(peak); } } - void testPerformance() + void test_performance_peak_centers_only() { const std::string outName = "OutPerfWS"; @@ -266,6 +376,29 @@ public: alg.setPropertyValue("CoordinateFrame", "Detector space"); alg.setPropertyValue("Extents", "-1,1,-1,1,-1,1"); alg.setPropertyValue("OutputWorkspace", outName); + alg.setProperty("CheckPeakExtents", false); + alg.execute(); + + Mantid::API::ITableWorkspace_sptr outWS = AnalysisDataService::Instance().retrieveWS<ITableWorkspace>(outName); + + TS_ASSERT_EQUALS(2, outWS->columnCount()); + TS_ASSERT_EQUALS(inputWS->rowCount(), outWS->rowCount()); + } + + void test_performance_peak_extents_checking() + { + const std::string outName = "OutPerfWS"; + + PeaksInRegion alg; + alg.setRethrows(true); + alg.initialize() ; + TS_ASSERT( alg.isInitialized() ) ; + alg.setProperty("InputWorkspace", inputWS); + alg.setPropertyValue("CoordinateFrame", "Detector space"); + alg.setPropertyValue("Extents", "0.5,1,-1,1,-1,1"); + alg.setPropertyValue("OutputWorkspace", outName); + alg.setProperty("CheckPeakExtents", true); + alg.setProperty("PeakRadius", 0.4); alg.execute(); Mantid::API::ITableWorkspace_sptr outWS = AnalysisDataService::Instance().retrieveWS<ITableWorkspace>(outName); @@ -277,4 +410,4 @@ public: }; -#endif /* MANTID_CRYSTAL_PEAKSINREGIONTEST_H_ */ \ No newline at end of file +#endif /* MANTID_CRYSTAL_PEAKSINREGIONTEST_H_ */