Skip to content

Commit

Permalink
Rename LeBailFit2 to LeBailFit and fix the codes. Refs #5306.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Jul 26, 2012
1 parent 5530421 commit b013b29
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/CurveFitting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand All @@ -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";}
Expand Down Expand Up @@ -120,4 +120,4 @@ namespace CurveFitting
} // namespace CurveFitting
} // namespace Mantid

#endif /* MANTID_CURVEFITTING_LEBAILFIT2_H_ */
#endif /* MANTID_CURVEFITTING_LEBAILFIT_H_ */
34 changes: 17 additions & 17 deletions Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MantidCurveFitting/LeBailFit2.h"
#include "MantidCurveFitting/LeBailFit.h"
#include "MantidKernel/ListValidator.h"
#include "MantidAPI/TableRow.h"
#include "MantidAPI/FunctionDomain1D.h"
Expand All @@ -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. ");
Expand All @@ -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.");
Expand Down Expand Up @@ -75,7 +75,7 @@ void LeBailFit2::init()
/*
* Implement abstract Algorithm methods
*/
void LeBailFit2::exec()
void LeBailFit::exec()
{
// 1. Get input
dataWS = this->getProperty("InputWorkspace");
Expand Down Expand Up @@ -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;
Expand All @@ -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.");

Expand All @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
22 changes: 11 additions & 11 deletions Code/Mantid/Framework/CurveFitting/test/LeBailFitTest.h
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -61,7 +61,7 @@ class LeBailFit2Test : public CxxTest::TestSuite
AnalysisDataService::Instance().addOrReplace("Reflections", hklws);

// 2. Initialize the algorithm
LeBailFit2 lbfit;
LeBailFit lbfit;

TS_ASSERT_THROWS_NOTHING(lbfit.initialize());
TS_ASSERT(lbfit.isInitialized());
Expand Down Expand Up @@ -136,7 +136,7 @@ class LeBailFit2Test : public CxxTest::TestSuite
AnalysisDataService::Instance().addOrReplace("Reflections", hklws);

// 2. Create LeBailFit and do the calculation
LeBailFit2 lbfit;
LeBailFit lbfit;
lbfit.initialize();

// 3. Computation
Expand Down Expand Up @@ -263,7 +263,7 @@ class LeBailFit2Test : public CxxTest::TestSuite
AnalysisDataService::Instance().addOrReplace("Reflections", hklws);

// 2. Create LeBailFit and do the calculation
LeBailFit2 lbfit;
LeBailFit lbfit;
lbfit.initialize();

// 3. Computation
Expand Down Expand Up @@ -722,4 +722,4 @@ class LeBailFit2Test : public CxxTest::TestSuite
};


#endif /* MANTID_CURVEFITTING_LEBAILFIT2TEST_H_ */
#endif /* MANTID_CURVEFITTING_LEBAILFITTEST_H_ */

0 comments on commit b013b29

Please sign in to comment.