From de2217589abdf178c89753773c333c1c6765bc0f Mon Sep 17 00:00:00 2001 From: Anthony Lim <anthony.lim@stfc.ac.uk> Date: Mon, 11 Sep 2017 11:05:10 +0100 Subject: [PATCH] refs #20216 more review comments --- Framework/Algorithms/CMakeLists.txt | 12 +++++----- ...unctionHelper.h => ApodizationFunctions.h} | 11 ++++++--- ...reProcessing.h => PaddingAndApodization.h} | 6 ++--- ...ionHelper.cpp => ApodizationFunctions.cpp} | 0 ...ocessing.cpp => PaddingAndApodization.cpp} | 16 ++++++------- ...ocessingTest.h => PaddingAndApodization.h} | 24 +++++++++---------- 6 files changed, 37 insertions(+), 32 deletions(-) rename Framework/Algorithms/inc/MantidAlgorithms/{ApodizationFunctionHelper.h => ApodizationFunctions.h} (87%) rename Framework/Algorithms/inc/MantidAlgorithms/{FFTPreProcessing.h => PaddingAndApodization.h} (95%) rename Framework/Algorithms/src/{ApodizationFunctionHelper.cpp => ApodizationFunctions.cpp} (100%) rename Framework/Algorithms/src/{FFTPreProcessing.cpp => PaddingAndApodization.cpp} (94%) rename Framework/Algorithms/test/{FFTPreProcessingTest.h => PaddingAndApodization.h} (93%) diff --git a/Framework/Algorithms/CMakeLists.txt b/Framework/Algorithms/CMakeLists.txt index 916598be384..80a8395ea98 100644 --- a/Framework/Algorithms/CMakeLists.txt +++ b/Framework/Algorithms/CMakeLists.txt @@ -9,7 +9,7 @@ set ( SRC_FILES src/AlphaCalc.cpp src/AnnularRingAbsorption.cpp src/AnyShapeAbsorption.cpp - src/ApodizationFunctionHelper.cpp + src/ApodizationFunctions.cpp src/AppendSpectra.cpp src/ApplyCalibration.cpp src/ApplyDeadTimeCorr.cpp @@ -124,7 +124,6 @@ set ( SRC_FILES src/FFTDerivative.cpp src/FFTSmooth.cpp src/FFTSmooth2.cpp - src/FFTPreProcessing.cpp src/FilterBadPulses.cpp src/FilterByLogValue.cpp src/FilterByTime.cpp @@ -202,6 +201,7 @@ set ( SRC_FILES src/PDCalibration.cpp src/PDDetermineCharacterizations.cpp src/PDFFourierTransform.cpp + src/PaddingAndApodization.cpp src/Pause.cpp src/PerformIndexOperations.cpp src/PhaseQuadMuon.cpp @@ -329,7 +329,7 @@ set ( INC_FILES inc/MantidAlgorithms/AnnularRingAbsorption.h inc/MantidAlgorithms/AnyShapeAbsorption.h inc/MantidAlgorithms/AppendSpectra.h - inc/MantidAlgorithms/ApodizationFunctionHelper.h + inc/MantidAlgorithms/ApodizationFunctions.h inc/MantidAlgorithms/ApplyCalibration.h inc/MantidAlgorithms/ApplyDeadTimeCorr.h inc/MantidAlgorithms/ApplyDetailedBalance.h @@ -444,7 +444,6 @@ set ( INC_FILES inc/MantidAlgorithms/FFTDerivative.h inc/MantidAlgorithms/FFTSmooth.h inc/MantidAlgorithms/FFTSmooth2.h - inc/MantidAlgorithms/FFTPreProcessing.h inc/MantidAlgorithms/FilterBadPulses.h inc/MantidAlgorithms/FilterByLogValue.h inc/MantidAlgorithms/FilterByTime.h @@ -523,6 +522,7 @@ set ( INC_FILES inc/MantidAlgorithms/NormaliseToMonitor.h inc/MantidAlgorithms/NormaliseToUnity.h inc/MantidAlgorithms/OneMinusExponentialCor.h + inc/MantidAlgorithms/PaddingAndApodization.h inc/MantidAlgorithms/PDCalibration.h inc/MantidAlgorithms/PDDetermineCharacterizations.h inc/MantidAlgorithms/PDFFourierTransform.h @@ -774,7 +774,6 @@ set ( TEST_FILES ExtractSpectraTest.h ExtractUnmaskedSpectraTest.h FFTDerivativeTest.h - FFTPreProcessingTest.h FFTSmooth2Test.h FFTTest.h FilterBadPulsesTest.h @@ -814,7 +813,7 @@ set ( TEST_FILES IntegrationTest.h InterpolatingRebinTest.h InterpolationOptionTest.h - InvertMaskTest.h + InvertMaskTest.h LineProfileTest.h LogarithmTest.h LorentzCorrectionTest.h @@ -849,6 +848,7 @@ set ( TEST_FILES NormaliseByDetectorTest.h NormaliseToMonitorTest.h OneMinusExponentialCorTest.h + PaddingAndApodizationTest.h PDCalibrationTest.h PDDetermineCharacterizationsTest.h PDFFourierTransformTest.h diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ApodizationFunctionHelper.h b/Framework/Algorithms/inc/MantidAlgorithms/ApodizationFunctions.h similarity index 87% rename from Framework/Algorithms/inc/MantidAlgorithms/ApodizationFunctionHelper.h rename to Framework/Algorithms/inc/MantidAlgorithms/ApodizationFunctions.h index 7155be43253..890eacac88b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ApodizationFunctionHelper.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ApodizationFunctions.h @@ -1,5 +1,5 @@ -#ifndef MANTID_ALGORITHM_APODIZATIONFUNCTIONHELPER_H_ -#define MANTID_ALGORITHM_APODIZATIONFUNCTIONHELPER_H_ +#ifndef MANTID_ALGORITHM_APODIZATIONFUNCTIONS_H_ +#define MANTID_ALGORITHM_APODIZATIONFUNCTIONS_H_ //---------------------------------------------------------------------- // Includes @@ -33,8 +33,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ + +namespace Mantid { +namespace Algorithms { double lorentz(double time, double decayConstant); double gaussian(const double time, const double decayConstant); double none(const double, const double); +} +} -#endif /*MANTID_APODIZATIONFUNCTIONHELPER_H_*/ +#endif /*MANTID_APODIZATIONFUNCTIONS_H_*/ diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FFTPreProcessing.h b/Framework/Algorithms/inc/MantidAlgorithms/PaddingAndApodization.h similarity index 95% rename from Framework/Algorithms/inc/MantidAlgorithms/FFTPreProcessing.h rename to Framework/Algorithms/inc/MantidAlgorithms/PaddingAndApodization.h index a6d8a26302e..1d1baf1021e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/FFTPreProcessing.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/PaddingAndApodization.h @@ -1,5 +1,5 @@ -#ifndef MANTID_ALGORITHM_FFTPreProcessing_H_ -#define MANTID_ALGORITHM_FFTPreProcessing_H_ +#ifndef MANTID_ALGORITHM_PADDINGANDAPODUIZTION_H_ +#define MANTID_ALGORITHM_FPADDINGANDAPODUIZTION_H_ //---------------------------------------------------------------------- // Includes @@ -79,4 +79,4 @@ private: } // namespace Algorithm } // namespace Mantid -#endif /*MANTID_FFTPreProcessing_H_*/ +#endif /*MANTID_PADDINGANDAPODUIZTION_H_*/ diff --git a/Framework/Algorithms/src/ApodizationFunctionHelper.cpp b/Framework/Algorithms/src/ApodizationFunctions.cpp similarity index 100% rename from Framework/Algorithms/src/ApodizationFunctionHelper.cpp rename to Framework/Algorithms/src/ApodizationFunctions.cpp diff --git a/Framework/Algorithms/src/FFTPreProcessing.cpp b/Framework/Algorithms/src/PaddingAndApodization.cpp similarity index 94% rename from Framework/Algorithms/src/FFTPreProcessing.cpp rename to Framework/Algorithms/src/PaddingAndApodization.cpp index 9f912efa56a..f5903756ece 100644 --- a/Framework/Algorithms/src/FFTPreProcessing.cpp +++ b/Framework/Algorithms/src/PaddingAndApodization.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidAlgorithms/FFTPreProcessing.h" -#include "MantidAlgorithms/ApodizationFunctionHelper.h" +#include "MantidAlgorithms/ApodizationFunctions.h" +#include "MantidAlgorithms/PaddingAndApodization.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/MatrixWorkspace.h" @@ -25,12 +25,12 @@ using API::Progress; using std::size_t; // Register the class into the algorithm factory -DECLARE_ALGORITHM(FFTPreProcessing) +DECLARE_ALGORITHM(PaddingAndApodization) /** Initialisation method. Declares properties to be used in algorithm. * */ -void FFTPreProcessing::init() { +void PaddingAndApodization::init() { declareProperty(make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>( "InputWorkspace", "", Direction::Input), "The name of the input 2D workspace."); @@ -59,7 +59,7 @@ void FFTPreProcessing::init() { /** Executes the algorithm * */ -void FFTPreProcessing::exec() { +void PaddingAndApodization::exec() { // Get original workspace API::MatrixWorkspace_const_sptr inputWS = getProperty("InputWorkspace"); @@ -133,7 +133,7 @@ typedef double (*fptr)(const double time, const double decayConstant); * @param method :: [input] The name of the chosen function * @returns :: pointer to the function */ -fptr FFTPreProcessing::getApodizationFunction(const std::string method) { +fptr PaddingAndApodization::getApodizationFunction(const std::string method) { if (method == "None") { return none; } else if (method == "Lorentz") { @@ -151,7 +151,7 @@ fptr FFTPreProcessing::getApodizationFunction(const std::string method) { * @param decayConstant :: [input] the decay constant for apodization function * @returns :: Histogram of the apodized data */ -HistogramData::Histogram FFTPreProcessing::applyApodizationFunction( +HistogramData::Histogram PaddingAndApodization::applyApodizationFunction( const HistogramData::Histogram &histogram, const double decayConstant, fptr function) { HistogramData::Histogram result(histogram); @@ -177,7 +177,7 @@ HistogramData::Histogram FFTPreProcessing::applyApodizationFunction( * @returns :: Histogram of the padded data */ HistogramData::Histogram -FFTPreProcessing::addPadding(const HistogramData::Histogram &histogram, +PaddingAndApodization::addPadding(const HistogramData::Histogram &histogram, const int padding) { if (padding == 0) { return histogram; diff --git a/Framework/Algorithms/test/FFTPreProcessingTest.h b/Framework/Algorithms/test/PaddingAndApodization.h similarity index 93% rename from Framework/Algorithms/test/FFTPreProcessingTest.h rename to Framework/Algorithms/test/PaddingAndApodization.h index 28d6af6530f..f640aa9c07b 100644 --- a/Framework/Algorithms/test/FFTPreProcessingTest.h +++ b/Framework/Algorithms/test/PaddingAndApodization.h @@ -1,8 +1,8 @@ -#ifndef FFTPREPROCESSINGTEST_H_ -#define FFTPREPROCESSINGTEST_H_ +#ifndef PADDINGANDAPODIZATIONTEST_H_ +#define PADDINGANDAPODIZATIONTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidAlgorithms/FFTPreProcessing.h" +#include "MantidAlgorithms/PaddingAndApodization.h" #include "MantidKernel/VectorHelper.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AlgorithmManager.h" @@ -13,7 +13,7 @@ using namespace Mantid::API; using Mantid::MantidVec; -using Mantid::Algorithms::FFTPreProcessing; +using Mantid::Algorithms::PaddingAndApodization; namespace { struct yData { @@ -33,25 +33,25 @@ MatrixWorkspace_sptr createWorkspace(size_t nspec, size_t maxt) { IAlgorithm_sptr setUpAlg() { IAlgorithm_sptr FFTPreProcess = - AlgorithmManager::Instance().create("FFTPreProcessing"); + AlgorithmManager::Instance().create("PaddingAndApodization"); FFTPreProcess->initialize(); FFTPreProcess->setChild(true); FFTPreProcess->setProperty("DecayConstant", 2.0); - FFTPreProcess->setProperty("OutputWorkspace", "FFTPreProcessing_output"); + FFTPreProcess->setProperty("OutputWorkspace", "FPaddingAndApodization_output"); return FFTPreProcess; } } -class FFTPreProcessingTest : public CxxTest::TestSuite { +class PaddingAndApodizationTest : public CxxTest::TestSuite { public: // This pair of boilerplate methods prevent the suite being created statically // This means the constructor isn't called when running other tests - static FFTPreProcessingTest *createSuite() { - return new FFTPreProcessingTest(); + static PaddingAndApodizationTestt *createSuite() { + return new PaddingAndApodizationTest(); } - static void destroySuite(FFTPreProcessingTest *suite) { delete suite; } + static void destroySuite(PaddingAndApodizationTest *suite) { delete suite; } - FFTPreProcessingTest() { FrameworkManager::Instance(); } + PaddingAndApodizationTest() { FrameworkManager::Instance(); } void testInit() { IAlgorithm_sptr alg = setUpAlg(); @@ -301,4 +301,4 @@ public: } }; -#endif /*FFTPREPROCESSINGTSTEST_H_*/ +#endif /*PADDINGANDAPODIZATIONTEST_H_*/ -- GitLab