Skip to content

Commit

Permalink
Refs #7432 find center of peak
Browse files Browse the repository at this point in the history
  • Loading branch information
Vickie Lynch committed Jul 12, 2013
1 parent bc7c199 commit 0646b8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,14 @@ namespace MDAlgorithms
throw ;
}

size_t half = numSteps/2;
double Centre = wsProfile2D->dataX(i)[half];
const Mantid::MantidVec& Y = wsProfile2D->readY(i);
double peakHeight = Y[half];
const Mantid::MantidVec& yValues = wsProfile2D->readY(i);
MantidVec::const_iterator it = std::max_element(yValues.begin(), yValues.end());
const double peakHeight = *it;
const double Centre = wsProfile2D->readX(i)[it - yValues.begin()];
size_t iStep;
for (iStep=0; iStep <= half; iStep++)
for (iStep=0; iStep < numSteps; iStep++)
{
if(((Y[iStep]-peakHeight*0.75)*(Y[iStep+1]-peakHeight*0.75))<0.)break;
if(((yValues[iStep]-peakHeight*0.75)*(yValues[iStep+1]-peakHeight*0.75))<0.)break;
}
double Sigma = fabs(Centre-wsProfile2D->dataX(i)[iStep]);
std::string profileFunction = getProperty("ProfileFunction");
Expand All @@ -486,8 +486,8 @@ namespace MDAlgorithms
fit_alg->setProperty("WorkspaceIndex", i);
/*if (profileFunction.compare("ConvolutionExpGaussian") == 0)
{
fit_alg->setProperty("StartX", Centre - 4.0 * Sigma);
fit_alg->setProperty("EndX", Centre + 4.0 * Sigma);
fit_alg->setProperty("StartX", Centre - 5.0 * Sigma);
fit_alg->setProperty("EndX", Centre + 5.0 * Sigma);
}*/
fit_alg->setProperty("CreateOutput", true);
fit_alg->setProperty("Output", plot_str.str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ class IntegratePeaksMDTest : public CxxTest::TestSuite
TS_ASSERT_DELTA( peakWS0->getPeak(0).getIntensity(), 1000.0, 1e-2);

// Error is also calculated
/*TS_ASSERT_DELTA( peakWS0->getPeak(0).getSigmaIntensity(), sqrt(1000.0), 1e-2);
fnct = "ConvolutionExpGaussian";
TS_ASSERT_DELTA( peakWS0->getPeak(0).getSigmaIntensity(), sqrt(1000.0), 1e-2);
/*fnct = "ConvolutionExpGaussian";
doRun(0.1,0.0,"IntegratePeaksMDTest_peaks",0.0,true,true,fnct);
TS_ASSERT_DELTA( peakWS0->getPeak(0).getIntensity(), 2.0, 1e-2);
Expand Down

0 comments on commit 0646b8c

Please sign in to comment.