Skip to content

Commit

Permalink
Re #4158. Removed remaining references to GenericFit
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Apr 2, 2012
1 parent 53b5dc5 commit ed24efb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 198 deletions.
87 changes: 0 additions & 87 deletions Code/Mantid/Framework/API/inc/MantidAPI/CompositeFunctionMD.h

This file was deleted.

12 changes: 12 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/FunctionValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,30 @@ class MANTID_API_DLL FunctionValues: public IFunctionValues
/// Add other calculated values
FunctionValues& operator+=(const FunctionValues& values)
{
if (size() != values.size())
{
throw std::runtime_error("Cannot add values: sizes do not match");
}
values.add(getPointerToCalculated(0));
return *this;
}
/// Multiply by other calculated values
FunctionValues& operator*=(const FunctionValues& values)
{
if (size() != values.size())
{
throw std::runtime_error("Cannot multiply values: sizes do not match");
}
values.multiply(getPointerToCalculated(0));
return *this;
}
/// Add other calculated values to these values starting with i.
void addToCalculated(size_t i, const FunctionValues& values)
{
if (i + size() < values.size())
{
throw std::runtime_error("Cannot add values: sizes do not match");
}
values.add(getPointerToCalculated(i));
}

Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/Framework/CurveFitting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ set ( INC_FILES
inc/MantidCurveFitting/Gaussian.h
inc/MantidCurveFitting/Gaussian1D.h
inc/MantidCurveFitting/GaussianLinearBG1D.h
inc/MantidCurveFitting/GenericFit.h
inc/MantidCurveFitting/IDomainCreator.h
inc/MantidCurveFitting/IFuncMinimizer.h
inc/MantidCurveFitting/IkedaCarpenterPV.h
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace Mantid
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
// This class will define the "function" method used by GenericFit but will not define the
// This class will define the "function" method used by Fit but will not define the
// actual sqwBroad or sqwSharp functions that define the real model
class DLLExport SimulateResolution : public API::ParamFunction, public API::IFunctionMD
{
Expand Down
30 changes: 15 additions & 15 deletions Code/Mantid/Framework/MDAlgorithms/test/QuadEnBackgroundTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <cxxtest/TestSuite.h>
//
#include "MantidMDAlgorithms/QuadEnBackground.h"
#include "MantidAPI/CompositeFunctionMD.h"
#include "MantidCurveFitting/GenericFit.h"
#include "MantidAPI/CompositeFunction.h"
#include "MantidCurveFitting/Fit.h"
#include "MantidKernel/UnitFactory.h"
#include "MantidKernel/ProgressText.h"
#include "MantidAPI/AnalysisDataService.h"
Expand Down Expand Up @@ -175,13 +175,13 @@ class QuadEnBackgroundTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( AnalysisDataService::Instance().add(testWrkspc3, outnew3) );
}

void testWithGenericFit()
void testWithFit()
{
// test GenericFit - note that fit is to cell data but that MDCell
// test Fit - note that fit is to cell data but that MDCell
// returns the sum of point contributions, not average.
// As the number of points in a cell varies 1 to 4 this must be taken into
// account if comparing the fit to the cell data.
GenericFit alg1;
Fit alg1;
TS_ASSERT_THROWS_NOTHING(alg1.initialize());
TS_ASSERT( alg1.isInitialized() );

Expand Down Expand Up @@ -212,13 +212,13 @@ class QuadEnBackgroundTest : public CxxTest::TestSuite
double chisq = alg1.getProperty("OutputChi2overDoF");
TS_ASSERT_DELTA( chisq, 0.0, 0.001 );

IFunction *out = FunctionFactory::Instance().createInitialized(alg1.getPropertyValue("Function"));
IFunction_sptr out = FunctionFactory::Instance().createInitialized(alg1.getPropertyValue("Function"));
TS_ASSERT_DELTA( out->getParameter("Constant"), 1.00 ,0.001);
TS_ASSERT_DELTA( out->getParameter("Linear"), 0.00 ,0.001);
TS_ASSERT_DELTA( out->getParameter("Quadratic"), 0.00 ,0.001);

// test with 2nd workspace that has a signal quadratic in energy
GenericFit alg2;
Fit alg2;
TS_ASSERT_THROWS_NOTHING(alg2.initialize());
TS_ASSERT( alg2.isInitialized() );
// Set which spectrum to fit against and initial starting values
Expand All @@ -238,7 +238,7 @@ class QuadEnBackgroundTest : public CxxTest::TestSuite
chisq = alg2.getProperty("OutputChi2overDoF");
TS_ASSERT_DELTA( chisq, 0.0, 0.001 );

// there is no such workspace for GenericFit as far as I can tell
// there is no such workspace for Fit as far as I can tell
//WS_type outWS = getWS("out3_Workspace");

TWS_type outParams = getTWS("out2_Parameters");
Expand All @@ -259,7 +259,7 @@ class QuadEnBackgroundTest : public CxxTest::TestSuite
TS_ASSERT_DELTA(row.Double(1),0.10,0.001);

// test with 3nd workspace that has a signal quadratic in energy plus noise
GenericFit alg3;
Fit alg3;
TS_ASSERT_THROWS_NOTHING(alg3.initialize());
TS_ASSERT( alg3.isInitialized() );
// Set which spectrum to fit against and initial starting values
Expand All @@ -279,7 +279,7 @@ class QuadEnBackgroundTest : public CxxTest::TestSuite
chisq = alg3.getProperty("OutputChi2overDoF");
TS_ASSERT_DELTA( chisq, 0.0, 0.001 );

// there is no such workspace for GenericFit as far as I can tell
// there is no such workspace for Fit as far as I can tell
//WS_type outWS = getWS("out3_Workspace");

TWS_type outParams3 = getTWS("out3_Parameters");
Expand Down Expand Up @@ -313,18 +313,18 @@ class QuadEnBackgroundTest : public CxxTest::TestSuite
*/
void testGenericFitandCompositeFunctionMD()
{
// test GenericFit with Composite fucntionMD
// test Fit with Composite fucntionMD
// Use same data as alg3 test above but with two functions to fit.
// The functions are identical but values are tied so that the problem is well defined.
GenericFit alg1;
Fit alg1;
TS_ASSERT_THROWS_NOTHING(alg1.initialize());
TS_ASSERT( alg1.isInitialized() );
// set up fitting functions
QuadEnBackground* fn1 = new QuadEnBackground();
auto fn1 = IFunction_sptr( new QuadEnBackground() );
fn1->initialize();
QuadEnBackground* fn2 = new QuadEnBackground();
auto fn2 = IFunction_sptr( new QuadEnBackground() );
fn2->initialize();
CompositeFunctionMD* compFn = new CompositeFunctionMD();
CompositeFunction* compFn = new CompositeFunction();
compFn->initialize();
compFn->addFunction(fn1);
compFn->addFunction(fn2);
Expand Down

0 comments on commit ed24efb

Please sign in to comment.