Commit 31e588c1 authored by Alice Russell's avatar Alice Russell
Browse files

Re #28255 correct conversion scale factor

The scale factor uses converts the peak centre and uses as a scale factor
so conversion works for units which are inversely proportional to tof.
parent 506f5d05
......@@ -108,9 +108,12 @@ void Bk2BkExpConvPV::setMatrixWorkspace(
if (workspace) {
// convert alpha and beta to correct units so inital guess is resonable
auto tof = Mantid::Kernel::UnitFactory::Instance().create("TOF");
const auto scaleFactor = convertValue(1, tof, workspace, wi);
setParameter("Alpha", getParameter("Alpha") * scaleFactor);
setParameter("Beta", getParameter("Beta") * scaleFactor);
const auto centre = getParameter("X0");
const auto scaleFactor = centre / convertValue(centre, tof, workspace, wi);
if (scaleFactor != 0) {
setParameter("Alpha", getParameter("Alpha") / scaleFactor);
setParameter("Beta", getParameter("Beta") / scaleFactor);
}
}
IFunctionMW::setMatrixWorkspace(workspace, wi, startX, endX);
}
......
......@@ -417,11 +417,13 @@ void IkedaCarpenterPV::setMatrixWorkspace(
// convert inital parameters that depend on x axis to correct units so
// inital guess is reasonable
auto tof = Mantid::Kernel::UnitFactory::Instance().create("TOF");
const auto scaleFactor = convertValue(1, tof, workspace, wi);
setParameter("Alpha0", getParameter("Alpha0") / scaleFactor);
setParameter("Alpha1", getParameter("Alpha1") / scaleFactor);
setParameter("Beta0", getParameter("Beta0") / scaleFactor);
const auto centre = getParameter("X0");
const auto scaleFactor = centre / convertValue(centre, tof, workspace, wi);
if (scaleFactor != 0) {
setParameter("Alpha0", getParameter("Alpha0") * scaleFactor);
setParameter("Alpha1", getParameter("Alpha1") * scaleFactor);
setParameter("Beta0", getParameter("Beta0") * scaleFactor);
}
}
IFunctionMW::setMatrixWorkspace(workspace, wi, startX, endX);
}
......
......@@ -438,7 +438,8 @@ class FitPropertyBrowser(FitPropertyBrowserBase):
fun = self.addFunction(self.defaultPeakType())
self.setPeakCentreOf(fun, centre)
self.setPeakFwhmOf(fun, fwhm)
self.setPeakHeightOf(fun, height)
if height != 0:
self.setPeakHeightOf(fun, height)
self.peak_ids[peak_id] = fun
@Slot(int, float, float)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment