Skip to content

Commit

Permalink
Checkpointing work (1113). Refs #7653.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Sep 6, 2013
1 parent b5e6349 commit 830ec7b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ namespace CurveFitting
* This is the core component to calcualte peak profile
*/
double NeutronBk2BkExpConvPVoigt::calOmega(const double x, const double eta, const double N,
const double alpha, const double beta, const double H,
const double sigma2, const double invert_sqrt2sigma,
const bool explicitoutput) const
const double alpha, const double beta, const double H,
const double sigma2, const double invert_sqrt2sigma,
const bool explicitoutput) const
{
// Transform to variable u, v, y, z
const double u = 0.5*alpha*(alpha*sigma2+2.*x);
Expand All @@ -521,20 +521,37 @@ namespace CurveFitting

// Calculate Lorenzian part
double omega2(0.);

cout << "Eta = " << eta << "; X = " << x << " N = " << N << ".\n";

if (eta >= 1.0E-8)
{
const double SQRT_H_5 = sqrt(H)*.5;
std::complex<double> p(alpha*x, alpha*SQRT_H_5);
std::complex<double> q(-beta*x, beta*SQRT_H_5);
double omega2a = imag(exp(p)*Mantid::API::E1(p));
double omega2b = imag(exp(q)*Mantid::API::E1(q));
double omega2b = imag(exp(q)*Mantid::API::E1(q));
omega2 = -1.0*N*eta*(omega2a + omega2b)*TWO_OVER_PI;

cout << "Exp(p) = " << exp(p) << ", Exp(q) = " << exp(q) << ".\n";

if (omega2 != omega2)
{
cout << "Omega2 is not physical. Omega2a = " << omega2a
<< ", Omega2b = " << omega2b << ", p = " << p.real() << ", " << p.imag() << ".\n";
}
else
{
cout << "X = " << x << " is OK. Omega 2 = " << omega2 << ", Omega2A = " << omega2a
<< ", Omega2B = " << omega2b << "\n";
}

}
const double omega = omega1+omega2;

if (explicitoutput)
if (explicitoutput || omega != omega)
{
if (omega <= NEG_DBL_MAX || omega >= DBL_MAX)
if (omega <= NEG_DBL_MAX || omega >= DBL_MAX || omega != omega)
{
stringstream errss;
errss << "Find omega = " << omega << " is infinity! omega1 = " << omega1 << ", omega2 = " << omega2 << "\n";
Expand All @@ -546,7 +563,7 @@ namespace CurveFitting
}
}

// cout << "[DB] Final Value = " << omega << endl;
g_log.information() << "[DB] Final Value = " << omega << endl;
return omega;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite
//----------------------------------------------------------------------------------------------
/** Set and get parameter
*/
void test_accessParameter()
void Ptest_accessParameter()
{
NeutronBk2BkExpConvPVoigt func;
func.initialize();
Expand All @@ -40,7 +40,7 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite
//----------------------------------------------------------------------------------------------
/** Calculate peak positions: data is from Fullprof's sample: arg_si
*/
void test_calculatePeakPositions()
void Ptest_calculatePeakPositions()
{
// (1,1,1)
NeutronBk2BkExpConvPVoigt func;
Expand Down Expand Up @@ -103,7 +103,7 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite
//----------------------------------------------------------------------------------------------
/** Calculate peak positions: data is from Fullprof's sample: arg_si
*/
void TODO_test_calculatePeakShape()
void TODOtest_calculatePeakShape()
{
NeutronBk2BkExpConvPVoigt func;
func.initialize();
Expand Down Expand Up @@ -137,7 +137,6 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite
double fwhm = func.fwhm();
TS_ASSERT_DELTA(fwhm, 47.049, 0.001);

/*
cout << "FWHM = " << fwhm << ".\n";

vector<double> vecX;
Expand All @@ -153,13 +152,12 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite
cout << vecX[i] << "\t\t" << vecY[i] << "\n";

TS_ASSERT_EQUALS(1, 432);
*/
}

//----------------------------------------------------------------------------------------------
/** Calculate peak positions: data is from Fullprof's sample: arg_si
*/
void test_calculateVulcanPeakPositions()
void Ptest_calculateVulcanPeakPositions()
{
// (2, 2, 0)
NeutronBk2BkExpConvPVoigt func;
Expand Down Expand Up @@ -229,7 +227,7 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite
//----------------------------------------------------------------------------------------------
/** Calculate peak positions: data is from Fullprof's sample: arg_si
*/
void TODO_test_calculateVulcanProfile()
void test_calculateVulcanProfile()
{
NeutronBk2BkExpConvPVoigt func;
func.initialize();
Expand Down

0 comments on commit 830ec7b

Please sign in to comment.