Skip to content

Commit

Permalink
Fix system VesuvioFitting tests.
Browse files Browse the repository at this point in the history
Converting the TOF from seconds to microseconds and then back seems
to have caused instability in the fitting when including the background.
It is actually more sensible to have convertToYSpace take the time in
seconds anyway.
Refs #8598
  • Loading branch information
martyngigg committed Jan 8, 2014
1 parent 8a0bfeb commit ba48d4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/CurveFitting/src/ComptonPeakProfile.cpp
Expand Up @@ -116,9 +116,9 @@ namespace CurveFitting
"hwhm_lorentz");
double yplus(0.0), yminus(0.0), dummy(0.0);
detpar.efixed += dELorentz;
ConvertToYSpace::calculateY(yplus,dummy,dummy,m_mass,trec*1e6,k1,v1,detpar);
ConvertToYSpace::calculateY(yplus,dummy,dummy,m_mass,trec,k1,v1,detpar);
detpar.efixed -= 2.0*dELorentz;
ConvertToYSpace::calculateY(yminus,dummy,dummy,m_mass,trec*1e6,k1,v1,detpar);
ConvertToYSpace::calculateY(yminus,dummy,dummy,m_mass,trec,k1,v1,detpar);
// lorentzian width
m_hwhmLorentz = 0.5*(yplus-yminus);
}
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/CurveFitting/src/ComptonProfile.cpp
Expand Up @@ -184,7 +184,7 @@ namespace CurveFitting
{
const double tsec = (isHistogram) ? 0.5*(tseconds[i] + tseconds[i+1]) : tseconds[i];
ConvertToYSpace::calculateY(m_yspace[i], m_modQ[i],m_e0[i],
m_mass,tsec*1e06,k1,v1,detpar);
m_mass,tsec,k1,v1,detpar);
}
}

Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/CurveFitting/src/ConvertToYSpace.cpp
Expand Up @@ -141,17 +141,16 @@ namespace CurveFitting
* @param qspace Output qspace value
* @param ei Output incident energy value
* @param mass Mass value for the transformation
* @param tmicro Time-of-flight in microseconds
* @param tsec Time-of-flight in seconds
* @param k1 Modulus of wavevector for final energy (sqrt(efixed/massToMeV)), avoids repeated calculation
* @param v1 Velocity of neutron for final energy (sqrt(efixed/massToMeV)), avoids repeated calculation
* @param detpar Struct defining Detector parameters @see ComptonProfile
*/
void ConvertToYSpace::calculateY(double & yspace, double & qspace, double &ei,
const double mass, const double tmicro,
const double mass, const double tsec,
const double k1, const double v1,
const DetectorParams & detpar)
{
const double tsec = tmicro*1e-06;
const double v0 = detpar.l1/(tsec - detpar.t0 - (detpar.l2/v1));
ei = MASS_TO_MEV*v0*v0;
const double w = ei - detpar.efixed;
Expand Down Expand Up @@ -254,7 +253,7 @@ namespace CurveFitting
for(size_t j = 0; j < npts; ++j)
{
double ys(0.0),qs(0.0),ei(0.0);
calculateY(ys,qs,ei,m_mass,inX[j],k1,v1,detPar);
calculateY(ys,qs,ei,m_mass,inX[j]*1e-06,k1,v1,detPar);
const size_t outIndex = (npts - j - 1);
outX[outIndex] = ys;
const double prefactor = qs/pow(ei,0.1);
Expand Down

0 comments on commit ba48d4c

Please sign in to comment.