Skip to content

Commit

Permalink
Corrected an error in function name. Refs #9358.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed May 13, 2014
1 parent e0a33a3 commit 97085ab
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 22 deletions.
19 changes: 1 addition & 18 deletions Code/Mantid/Framework/Algorithms/src/GeneratePeaks.cpp
Expand Up @@ -203,7 +203,7 @@ namespace Algorithms
if (bkgdfunctype.compare("Auto") == 0)
{
m_useAutoBkgd = true;
bkgdfunctype = "Quardratic";
bkgdfunctype = "Quadratic";
}
else if (bkgdfunctype.compare("None") == 0)
{
Expand Down Expand Up @@ -369,23 +369,6 @@ namespace Algorithms
double centre = centrefunc.first;
double fwhm = thispeak->fwhm();

// Get to know workspace index
// specid_t specid = static_cast<specid_t>(getTableValue(peakparameters, "spectrum", ipk));


#if 0
// Generate function to plot
API::ICompositeFunction_sptr plotfunc = boost::make_shared<CompositeFunction>();
plotfunc->addFunction(m_peakFunction);
if (m_genBackground)
plotfunc->addFunction(m_bkgdFunction);

// Determine boundary
double centre = m_peakFunction->centre();
double fwhm = m_peakFunction->fwhm();
#endif


//
const MantidVec& X = dataWS->dataX(wsindex);
double leftbound = centre - m_numPeakWidth*fwhm;
Expand Down
43 changes: 39 additions & 4 deletions Code/Mantid/Framework/Algorithms/test/GeneratePeaksTest.h
Expand Up @@ -127,7 +127,7 @@ class GeneratePeaksTest : public CxxTest::TestSuite
void test_FromInputWorkspace()
{
// Create input
DataObjects::TableWorkspace_sptr peakparmsws = createTestPeakParameters();
DataObjects::TableWorkspace_sptr peakparmsws = createTestPeakParameters2();
API::MatrixWorkspace_sptr inputws = createTestInputWorkspace();

// Initialize algorithm class
Expand Down Expand Up @@ -186,8 +186,8 @@ class GeneratePeaksTest : public CxxTest::TestSuite
return;
}

/*
* Test to use user-provided binning parameters
//----------------------------------------------------------------------------------------------
/** Test to use user-provided binning parameters
*/
void test_Background()
{
Expand All @@ -200,10 +200,12 @@ class GeneratePeaksTest : public CxxTest::TestSuite
// 3. Set value
TS_ASSERT_THROWS_NOTHING(alg.setProperty("PeakParametersWorkspace", peakparmsws));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("PeakFunction", "Gaussian"));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("BackgroundFunction", "Auto"));
TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("BinningParameters", "0.0, 0.01, 10.0"));
TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "Test01WS"));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("GenerateBackground", true));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("MaxAllowedChi2", 100.0));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("IsRawParameterTable", false));

// 4. Execute
TS_ASSERT_THROWS_NOTHING(alg.execute());
Expand Down Expand Up @@ -245,7 +247,7 @@ class GeneratePeaksTest : public CxxTest::TestSuite
}

//----------------------------------------------------------------------------------------------
/** Generate a TableWorkspace containing 3 peaks on 2 spectra
/** Generate a TableWorkspace containing 3 peaks on 2 spectra by using effective parameters
* spectra 0: center = 2.0, width = 0.2, height = 5, a0 = 1.0, a1 = 2.0, a2 = 0
* spectra 0: center = 8.0, width = 0.1, height = 10, a0 = 2.0, a1 = 1.0, a2 = 0
* spectra 2: center = 4.0, width = 0.4, height = 20, a0 = 4.0, a1 = 0.0, a2 = 0
Expand Down Expand Up @@ -274,6 +276,39 @@ class GeneratePeaksTest : public CxxTest::TestSuite
API::TableRow row3 = peakparms->appendRow();
row3 << 2 << 4.5 << 0.4 << 20.0 << 1.0 << 9.0 << 0.0 << 1000.2;

return peakparms;
}

//----------------------------------------------------------------------------------------------
/** Generate a TableWorkspace containing 3 peaks on 2 spectra by using raw parameters
* spectra 0: center = 2.0, width = 0.2, height = 5, a0 = 1.0, a1 = 2.0, a2 = 0
* spectra 0: center = 8.0, width = 0.1, height = 10, a0 = 2.0, a1 = 1.0, a2 = 0
* spectra 2: center = 4.0, width = 0.4, height = 20, a0 = 4.0, a1 = 0.0, a2 = 0
*/
DataObjects::TableWorkspace_sptr createTestPeakParameters2()
{
// 1. Build a TableWorkspace
DataObjects::TableWorkspace_sptr peakparms =
boost::shared_ptr<DataObjects::TableWorkspace>(new DataObjects::TableWorkspace);
peakparms->addColumn("int", "spectrum");
peakparms->addColumn("double", "PeakCentre");
peakparms->addColumn("double", "Sigma");
peakparms->addColumn("double", "Height");
peakparms->addColumn("double", "A0");
peakparms->addColumn("double", "A1");
peakparms->addColumn("double", "A2");
peakparms->addColumn("double", "chi2");

// 2. Add value
API::TableRow row0 = peakparms->appendRow();
row0 << 0 << 2.0 << 0.0849322 << 5.0 << 1.0 << 2.0 << 0.0 << 0.1;
API::TableRow row1 = peakparms->appendRow();
row1 << 0 << 8.0 << 0.0424661 << 10.0 << 2.0 << 1.0 << 0.0 << 0.2;
API::TableRow row2 = peakparms->appendRow();
row2 << 2 << 4.0 << 0.169864 << 20.0 << 4.0 << 0.0 << 0.0 << 0.2;
API::TableRow row3 = peakparms->appendRow();
row3 << 2 << 4.5 << 0.4 << 20.0 << 1.0 << 9.0 << 0.0 << 1000.2;


return peakparms;
}
Expand Down

0 comments on commit 97085ab

Please sign in to comment.