From f5f30faa6eccfa984a54f50537f36bacd802c603 Mon Sep 17 00:00:00 2001 From: Peter Parker Date: Tue, 22 Jul 2014 13:53:47 +0100 Subject: [PATCH] Refs #9896 - Remove SANSSolidAngleCorrectionTest as unit test. --- .../WorkflowAlgorithms/CMakeLists.txt | 1 - .../test/SANSSolidAngleCorrectionTest.h | 99 ------------------- 2 files changed, 100 deletions(-) delete mode 100644 Code/Mantid/Framework/WorkflowAlgorithms/test/SANSSolidAngleCorrectionTest.h diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt b/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt index 2528c2259393..97a92d438495 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt @@ -75,7 +75,6 @@ set ( INC_FILES set ( TEST_FILES MuonCalculateAsymmetryTest.h MuonLoadTest.h - SANSSolidAngleCorrectionTest.h StepScanTest.h ) diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/test/SANSSolidAngleCorrectionTest.h b/Code/Mantid/Framework/WorkflowAlgorithms/test/SANSSolidAngleCorrectionTest.h deleted file mode 100644 index a4ba51ffcd5c..000000000000 --- a/Code/Mantid/Framework/WorkflowAlgorithms/test/SANSSolidAngleCorrectionTest.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef SANSSOLIDANGLECORRECTIONTEST_H_ -#define SANSSOLIDANGLECORRECTIONTEST_H_ - -#include -#include "MantidWorkflowAlgorithms/SANSSolidAngleCorrection.h" -#include "MantidDataHandling/LoadSpice2D.h" -#include "MantidDataHandling/MoveInstrumentComponent.h" - -using namespace Mantid::API; -using namespace Mantid::Kernel; - -class SANSSolidAngleCorrectionTest : public CxxTest::TestSuite -{ -public: - void testName() - { - TS_ASSERT_EQUALS( correction.name(), "SANSSolidAngleCorrection" ) - } - - void testVersion() - { - TS_ASSERT_EQUALS( correction.version(), 1 ) - } - - void testInit() - { - TS_ASSERT_THROWS_NOTHING( correction.initialize() ) - TS_ASSERT( correction.isInitialized() ) - } - - void testExec() - { - Mantid::DataHandling::LoadSpice2D loader; - loader.initialize(); - loader.setPropertyValue("Filename","BioSANS_exp61_scan0004_0001.xml"); - const std::string inputWS("wav"); - loader.setPropertyValue("OutputWorkspace",inputWS); - loader.execute(); - - Mantid::DataHandling::MoveInstrumentComponent mover; - mover.initialize(); - mover.setPropertyValue("Workspace","wav"); - mover.setPropertyValue("ComponentName","detector1"); - // X = (16-192.0/2.0)*5.15/1000.0 = -0.412 - // Y = (95-192.0/2.0)*5.15/1000.0 = -0.00515 - mover.setPropertyValue("X","0.412"); - mover.setPropertyValue("Y","0.00515"); - mover.execute(); - - if (!correction.isInitialized()) correction.initialize(); - - TS_ASSERT_THROWS_NOTHING( correction.setPropertyValue("InputWorkspace",inputWS) ) - const std::string outputWS("result"); - TS_ASSERT_THROWS_NOTHING( correction.setPropertyValue("OutputWorkspace",outputWS) ) - - TS_ASSERT_THROWS_NOTHING( correction.execute() ) - - TS_ASSERT( correction.isExecuted() ) - - Mantid::API::MatrixWorkspace_sptr result; - TS_ASSERT_THROWS_NOTHING( result = boost::dynamic_pointer_cast - (Mantid::API::AnalysisDataService::Instance().retrieve(outputWS)) ) - TS_ASSERT_EQUALS( result->getNumberHistograms(), 36866 ) - - TS_ASSERT_EQUALS( result->getAxis(0)->unit()->unitID(), "Wavelength" ) - - Mantid::API::Workspace_sptr ws_in; - TS_ASSERT_THROWS_NOTHING( ws_in = Mantid::API::AnalysisDataService::Instance().retrieve(inputWS) ); - Mantid::DataObjects::Workspace2D_sptr ws2d_in = boost::dynamic_pointer_cast(ws_in); - - Mantid::API::Workspace_sptr ws_out; - TS_ASSERT_THROWS_NOTHING( ws_out = Mantid::API::AnalysisDataService::Instance().retrieve(outputWS) ); - Mantid::DataObjects::Workspace2D_sptr ws2d_out = boost::dynamic_pointer_cast(ws_out); - - // Pick a bin to test - int i = 130; - // Number of monitors - int nmon = Mantid::DataHandling::LoadSpice2D::nMonitors; - // Get the coordinate of the detector pixel - double iy = (i-nmon)%192; - double ix = (int)((i-nmon)/192); - double r = sqrt(1.0+5.15*5.15/6000/6000*( (ix-16.0)*(ix-16.0) + (iy-95.0)*(iy-95.0) )); - double corr = r*r*r; - double ratio = ws2d_out->dataY(130+nmon)[0]/ws2d_in->dataY(130+nmon)[0]; - - double tolerance(1e-03); - TS_ASSERT_DELTA( ratio, corr, tolerance ); - - Mantid::API::AnalysisDataService::Instance().remove(inputWS); - Mantid::API::AnalysisDataService::Instance().remove(outputWS); - - } - -private: - Mantid::WorkflowAlgorithms::SANSSolidAngleCorrection correction; - std::string inputWS; -}; - -#endif /*SANSSOLIDANGLECORRECTIONTEST_H_*/