Skip to content

Commit

Permalink
Start new LeBailFit version 2. Refs #5306.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Jul 23, 2012
1 parent 0217440 commit a61daff
Show file tree
Hide file tree
Showing 5 changed files with 710 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/CurveFitting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ set ( SRC_FILES
src/IFuncMinimizer.cpp
src/IkedaCarpenterPV.cpp
src/LeBailFit.cpp
src/LeBailFit2.cpp
src/LeBailFunction.cpp
src/LevenbergMarquardtMDMinimizer.cpp
src/LevenbergMarquardtMinimizer.cpp
Expand Down Expand Up @@ -120,6 +121,7 @@ set ( INC_FILES
inc/MantidCurveFitting/IkedaCarpenterPV.h
inc/MantidCurveFitting/Jacobian.h
inc/MantidCurveFitting/LeBailFit.h
inc/MantidCurveFitting/LeBailFit2.h
inc/MantidCurveFitting/LeBailFunction.h
inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h
inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h
Expand Down Expand Up @@ -183,6 +185,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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#ifndef MANTID_CURVEFITTING_LEBAILFIT2_H_
#define MANTID_CURVEFITTING_LEBAILFIT2_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPV.h"
#include "MantidAPI/CompositeFunction.h"


using namespace Mantid;
using namespace Mantid::Kernel;

namespace Mantid
{
namespace CurveFitting
{

/** LeBailFit2 : 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.
Copyright © 2012 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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
{
public:
LeBailFit2();
virtual ~LeBailFit2();

/// Algorithm's name for identification overriding a virtual method
virtual const std::string name() const { return "LeBailFit";}
/// Algorithm's version for identification overriding a virtual method
virtual int version() const { return 2;}
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "Diffraction";}

private:
/// Sets documentation strings for this algorithm
virtual void initDocs();
// Implement abstract Algorithm methods
void init();
// Implement abstract Algorithm methods
void exec();

/// Import peak parameters
void importParametersTable();
/// Import Miller Indices (HKL)
void importReflections();

/// Create a list of peaks
void generatePeaksFromInput();


API::MatrixWorkspace_sptr dataWS;
DataObjects::TableWorkspace_sptr parameterWS;
DataObjects::TableWorkspace_sptr reflectionWS;

std::vector<std::vector<int> > mPeakHKLs;
API::CompositeFunction_sptr mLeBailFunction;

std::map<std::string, std::pair<double, char> > mFuncParameters; // char = f: fit... = t: tie to value

std::vector<CurveFitting::ThermalNeutronBk2BkExpConvPV_sptr> mPeaks;

};


} // namespace CurveFitting
} // namespace Mantid

#endif /* MANTID_CURVEFITTING_LEBAILFIT2_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DLLExport ThermalNeutronBk2BkExpConvPV : virtual public API::IPeakFunction
virtual void setHeight(const double h);

/// overwrite IFunction base class methods
std::string name()const{return "Bk2BkExpConvPV";}
std::string name()const{return "ThermalNeutronBk2BkExpConvPV";}
virtual const std::string category() const { return "Peak";}

/// Set up the range of peak calculation for higher efficiency
Expand Down Expand Up @@ -106,6 +106,8 @@ class DLLExport ThermalNeutronBk2BkExpConvPV : virtual public API::IPeakFunction

};

/// Shared pointer to ThermalNeutronBk2BkExpConvPV peak/function
typedef boost::shared_ptr<ThermalNeutronBk2BkExpConvPV> ThermalNeutronBk2BkExpConvPV_sptr;

} // namespace CurveFitting
} // namespace Mantid
Expand Down

0 comments on commit a61daff

Please sign in to comment.