Skip to content

Commit

Permalink
Added one more unit test. Refs #8744.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Feb 13, 2014
1 parent 3e4d8f8 commit 97afd4e
Showing 1 changed file with 34 additions and 2 deletions.
Expand Up @@ -51,7 +51,7 @@ class BackToBackExponentialPVTest : public CxxTest::TestSuite
//----------------------------------------------------------------------------------------------
/** test that parameter I equals integrated intensity of the peak: NO... IT IS NOT NORMALIZED!
*/
void test_integrated_intensity()
void test_integrated_intensity_gaussian()
{
BackToBackExponentialPV b2bExp;
b2bExp.initialize();
Expand All @@ -78,6 +78,38 @@ class BackToBackExponentialPVTest : public CxxTest::TestSuite
TS_ASSERT_DELTA(sum, 2.3, 0.00001);
}

//----------------------------------------------------------------------------------------------
/** test that parameter I equals integrated intensity of the peak: NO... IT IS NOT NORMALIZED!
*/
void test_integrated_intensity_voigt()
{
BackToBackExponentialPV b2bExp;
b2bExp.initialize();
b2bExp.setParameter("I", 1.0);
b2bExp.setParameter("A", 1.1);
b2bExp.setParameter("B", 2.2);
b2bExp.setParameter("X0",0.0);
b2bExp.setParameter("S", 4.0);
b2bExp.setParameter("Gamma", 2.0);

// I = 1.0
Mantid::API::FunctionDomain1DVector x(-60,60,100);
Mantid::API::FunctionValues y(x);
b2bExp.function(x,y);
double sum = 0.0;
for(size_t i = 0; i < x.size(); ++i) sum += y[i];
sum *= x[1] - x[0];
TS_ASSERT_DELTA(sum, 1.0, 0.004);

// I = 2.3
b2bExp.setParameter("I", 2.3);
b2bExp.function(x,y);
sum = 0.0;
for(size_t i = 0; i < x.size(); ++i) sum += y[i];
sum *= x[1] - x[0];
TS_ASSERT_DELTA(sum, 2.3, 0.008);
}

//----------------------------------------------------------------------------------------------
/** test that when gaussian is wide BackToBackExponential tends to Gaussian
*/
Expand Down Expand Up @@ -112,7 +144,7 @@ class BackToBackExponentialPVTest : public CxxTest::TestSuite
}

//----------------------------------------------------------------------------------------------
/** Test 1
/** Test back to back exponential convoluted with gaussian
*/
void test_functionCalculator()
{
Expand Down

0 comments on commit 97afd4e

Please sign in to comment.