From b013b29f5787551f97ab6bdd15c1348bc2da30cc Mon Sep 17 00:00:00 2001 From: Wenduo Zhou <zhouw@ornl.gov> Date: Thu, 26 Jul 2012 12:11:33 -0400 Subject: [PATCH] Rename LeBailFit2 to LeBailFit and fix the codes. Refs #5306. --- .../Framework/CurveFitting/CMakeLists.txt | 6 ++-- .../inc/MantidCurveFitting/LeBailFit.h | 14 ++++---- .../Framework/CurveFitting/src/LeBailFit.cpp | 34 +++++++++---------- .../CurveFitting/test/LeBailFitTest.h | 22 ++++++------ 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Code/Mantid/Framework/CurveFitting/CMakeLists.txt b/Code/Mantid/Framework/CurveFitting/CMakeLists.txt index f8eb0bdba96..773c698090e 100644 --- a/Code/Mantid/Framework/CurveFitting/CMakeLists.txt +++ b/Code/Mantid/Framework/CurveFitting/CMakeLists.txt @@ -37,7 +37,7 @@ set ( SRC_FILES src/IDomainCreator.cpp src/IFuncMinimizer.cpp src/IkedaCarpenterPV.cpp - src/LeBailFit2.cpp + src/LeBailFit.cpp src/LeBailFunction.cpp src/LevenbergMarquardtMDMinimizer.cpp src/LevenbergMarquardtMinimizer.cpp @@ -119,7 +119,7 @@ set ( INC_FILES inc/MantidCurveFitting/IFuncMinimizer.h inc/MantidCurveFitting/IkedaCarpenterPV.h inc/MantidCurveFitting/Jacobian.h - inc/MantidCurveFitting/LeBailFit2.h + inc/MantidCurveFitting/LeBailFit.h inc/MantidCurveFitting/LeBailFunction.h inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h @@ -183,7 +183,7 @@ set ( TEST_FILES test/GaussianTest.h test/HighOrderPolynomialBackgroundTest.h test/IkedaCarpenterPVTest.h - test/LeBailFit2Test.h + test/LeBailFitTest.h test/LeBailFunctionTest.h test/LeastSquaresTest.h test/LevenbergMarquardtMDTest.h diff --git a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h index 055bc38ed2d..893ec96ad04 100644 --- a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h +++ b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h @@ -1,5 +1,5 @@ -#ifndef MANTID_CURVEFITTING_LEBAILFIT2_H_ -#define MANTID_CURVEFITTING_LEBAILFIT2_H_ +#ifndef MANTID_CURVEFITTING_LEBAILFIT_H_ +#define MANTID_CURVEFITTING_LEBAILFIT_H_ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" @@ -18,7 +18,7 @@ namespace Mantid namespace CurveFitting { - /** LeBailFit2 : Algorithm to do Le Bail Fit. + /** LeBailFit : Algorithm to do Le Bail Fit. The workflow and architecture of this algorithm is different from LeBailFit, though they hold the same interface to users. @@ -42,11 +42,11 @@ namespace CurveFitting File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ - class DLLExport LeBailFit2 : public API::Algorithm + class DLLExport LeBailFit : public API::Algorithm { public: - LeBailFit2(); - virtual ~LeBailFit2(); + LeBailFit(); + virtual ~LeBailFit(); /// Algorithm's name for identification overriding a virtual method virtual const std::string name() const { return "LeBailFit";} @@ -120,4 +120,4 @@ namespace CurveFitting } // namespace CurveFitting } // namespace Mantid -#endif /* MANTID_CURVEFITTING_LEBAILFIT2_H_ */ +#endif /* MANTID_CURVEFITTING_LEBAILFIT_H_ */ diff --git a/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp b/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp index 01d159c7162..ff4f0ee9381 100644 --- a/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/LeBailFit2.h" +#include "MantidCurveFitting/LeBailFit.h" #include "MantidKernel/ListValidator.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/FunctionDomain1D.h" @@ -16,26 +16,26 @@ bool compDescending(int a, int b) return (a >= b); } -DECLARE_ALGORITHM(LeBailFit2) +DECLARE_ALGORITHM(LeBailFit) //---------------------------------------------------------------------------------------------- /** Constructor */ -LeBailFit2::LeBailFit2() +LeBailFit::LeBailFit() { } //---------------------------------------------------------------------------------------------- /** Destructor */ -LeBailFit2::~LeBailFit2() +LeBailFit::~LeBailFit() { } /* * Sets documentation strings for this algorithm */ -void LeBailFit2::initDocs() +void LeBailFit::initDocs() { this->setWikiSummary("Do LeBail Fit to a spectrum of powder diffraction data.. "); this->setOptionalMessage("Do LeBail Fit to a spectrum of powder diffraction data. "); @@ -44,7 +44,7 @@ void LeBailFit2::initDocs() /* * Define the input properties for this algorithm */ -void LeBailFit2::init() +void LeBailFit::init() { this->declareProperty(new API::WorkspaceProperty<API::MatrixWorkspace>("InputWorkspace", "", Direction::Input), "Input workspace containing the data to fit by LeBail algorithm."); @@ -75,7 +75,7 @@ void LeBailFit2::init() /* * Implement abstract Algorithm methods */ -void LeBailFit2::exec() +void LeBailFit::exec() { // 1. Get input dataWS = this->getProperty("InputWorkspace"); @@ -184,7 +184,7 @@ void LeBailFit2::exec() /* * Calculate peaks' intensities -void LeBailFit2::calculatePeaksHeights(size_t workspaceindex) +void LeBailFit::calculatePeaksHeights(size_t workspaceindex) { // 1. Set parameters to each peak (no tie) std::map<int, CurveFitting::ThermalNeutronBk2BkExpConvPV_sptr>::iterator pit; @@ -210,7 +210,7 @@ void LeBailFit2::calculatePeaksHeights(size_t workspaceindex) /* * LeBail Fitting */ -void LeBailFit2::doLeBailFit(size_t workspaceindex) +void LeBailFit::doLeBailFit(size_t workspaceindex) { throw std::runtime_error("doLeBailFit has not been implemented yet."); @@ -220,7 +220,7 @@ void LeBailFit2::doLeBailFit(size_t workspaceindex) /* * Calcualte LeBail diffraction pattern */ -void LeBailFit2::calculatePattern(size_t workspaceindex) +void LeBailFit::calculatePattern(size_t workspaceindex) { // 1. Generate domain and value const std::vector<double> x = dataWS->readX(0); @@ -302,7 +302,7 @@ void LeBailFit2::calculatePattern(size_t workspaceindex) * (a) Assign peaks into groups; each group contains either (1) one peak or (2) peaks overlapped * (b) Calculate peak intensities for every peak per group */ -void LeBailFit2::calPeaksIntensities(std::vector<std::pair<int, double> >& peakheights, size_t workspaceindex) +void LeBailFit::calPeaksIntensities(std::vector<std::pair<int, double> >& peakheights, size_t workspaceindex) { std::cout << "--------- Calculate (ALL) Peaks' Heights" << std::endl; @@ -415,7 +415,7 @@ void LeBailFit2::calPeaksIntensities(std::vector<std::pair<int, double> >& peakh * (4) Peaks' boundaries * Output: Peak intensities (index is peaks' indicies in mPeakHKL2) */ -void LeBailFit2::calPerGroupPeaksIntensities(size_t wsindex, std::set<size_t> peakindices, std::vector<double> peakcenters, +void LeBailFit::calPerGroupPeaksIntensities(size_t wsindex, std::set<size_t> peakindices, std::vector<double> peakcenters, std::vector<std::pair<double, double> > peakboundaries, std::vector<std::pair<size_t, double> >& peakintensities) { std::cout << "----------- calPerGroupPeakIntensity() ----------" << std::endl; @@ -548,7 +548,7 @@ void LeBailFit2::calPerGroupPeaksIntensities(size_t wsindex, std::set<size_t> pe * WARNING: This algorithm fails if the peak only has the width of very few pixels. * because it heavily replies on observation data. */ -bool LeBailFit2::observePeakRange(size_t workspaceindex, double center, double fwhm, +bool LeBailFit::observePeakRange(size_t workspaceindex, double center, double fwhm, double& tof_center, double& tof_left, double& tof_right) { // 0. Get access to data @@ -665,7 +665,7 @@ bool LeBailFit2::observePeakRange(size_t workspaceindex, double center, double f /* * From table/map to set parameters to an individual peak */ -void LeBailFit2::setPeakParameters(CurveFitting::ThermalNeutronBk2BkExpConvPV_sptr peak, double peakheight) +void LeBailFit::setPeakParameters(CurveFitting::ThermalNeutronBk2BkExpConvPV_sptr peak, double peakheight) { // 1. Set parameters ... std::map<std::string, std::pair<double, char> >::iterator pit; @@ -719,7 +719,7 @@ void LeBailFit2::setPeakParameters(CurveFitting::ThermalNeutronBk2BkExpConvPV_sp /* * Generate a list of peaks from input */ -void LeBailFit2::generatePeaksFromInput() +void LeBailFit::generatePeaksFromInput() { // There is no need to consider peak's order now due to map for (size_t ipk = 0; ipk < mPeakHKLs.size(); ++ipk) @@ -742,7 +742,7 @@ void LeBailFit2::generatePeaksFromInput() /* * Parse the input TableWorkspace to some maps for easy access */ -void LeBailFit2::importParametersTable() +void LeBailFit::importParametersTable() { // 1. Check column orders std::vector<std::string> colnames = parameterWS->getColumnNames(); @@ -790,7 +790,7 @@ void LeBailFit2::importParametersTable() /* * Parse the reflections workspace to a list of reflections; */ -void LeBailFit2::importReflections() +void LeBailFit::importReflections() { // 1. Check column orders std::vector<std::string> colnames = reflectionWS->getColumnNames(); diff --git a/Code/Mantid/Framework/CurveFitting/test/LeBailFitTest.h b/Code/Mantid/Framework/CurveFitting/test/LeBailFitTest.h index a2c13f6cb21..ee95238b5e8 100644 --- a/Code/Mantid/Framework/CurveFitting/test/LeBailFitTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/LeBailFitTest.h @@ -1,5 +1,5 @@ -#ifndef MANTID_CURVEFITTING_LEBAILFIT2TEST_H_ -#define MANTID_CURVEFITTING_LEBAILFIT2TEST_H_ +#ifndef MANTID_CURVEFITTING_LEBAILFITTEST_H_ +#define MANTID_CURVEFITTING_LEBAILFITTEST_H_ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" @@ -12,22 +12,22 @@ #include "MantidAPI/TableRow.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidCurveFitting/LeBailFit2.h" +#include "MantidCurveFitting/LeBailFit.h" using namespace Mantid; using namespace Mantid::CurveFitting; using namespace Mantid::API; using namespace WorkspaceCreationHelper; -using Mantid::CurveFitting::LeBailFit2; +using Mantid::CurveFitting::LeBailFit; -class LeBailFit2Test : public CxxTest::TestSuite +class LeBailFitTest : 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 LeBailFit2Test *createSuite() { return new LeBailFit2Test(); } - static void destroySuite( LeBailFit2Test *suite ) { delete suite; } + static LeBailFitTest *createSuite() { return new LeBailFitTest(); } + static void destroySuite( LeBailFitTest *suite ) { delete suite; } /* * Fundamental test to calcualte 2 peak w/o background. @@ -61,7 +61,7 @@ public: AnalysisDataService::Instance().addOrReplace("Reflections", hklws); // 2. Initialize the algorithm - LeBailFit2 lbfit; + LeBailFit lbfit; TS_ASSERT_THROWS_NOTHING(lbfit.initialize()); TS_ASSERT(lbfit.isInitialized()); @@ -136,7 +136,7 @@ public: AnalysisDataService::Instance().addOrReplace("Reflections", hklws); // 2. Create LeBailFit and do the calculation - LeBailFit2 lbfit; + LeBailFit lbfit; lbfit.initialize(); // 3. Computation @@ -263,7 +263,7 @@ public: AnalysisDataService::Instance().addOrReplace("Reflections", hklws); // 2. Create LeBailFit and do the calculation - LeBailFit2 lbfit; + LeBailFit lbfit; lbfit.initialize(); // 3. Computation @@ -722,4 +722,4 @@ public: }; -#endif /* MANTID_CURVEFITTING_LEBAILFIT2TEST_H_ */ +#endif /* MANTID_CURVEFITTING_LEBAILFITTEST_H_ */ -- GitLab