Skip to content
Snippets Groups Projects
Unverified Commit c21240c4 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #28124 from...

Merge pull request #28124 from mantidproject/28055_fix_function_crashes_when_adding_to_multi_domain_fitting

Fix crash when adding some functions to multidataset fitting
parents f0f97942 e28f1041
No related branches found
No related tags found
No related merge requests found
...@@ -109,6 +109,9 @@ void GaussianComptonProfile::massProfile(double *result, const size_t nData, ...@@ -109,6 +109,9 @@ void GaussianComptonProfile::massProfile(double *result, const size_t nData,
const auto &modq = modQ(); const auto &modq = modQ();
const auto &ei = e0(); const auto &ei = e0();
if (modq.empty() || ei.empty()) {
throw std::runtime_error("The Q values or e0 values have not been set");
}
// Include e_i^0.1*mass/q pre-factor // Include e_i^0.1*mass/q pre-factor
for (size_t j = 0; j < nData; ++j) { for (size_t j = 0; j < nData; ++j) {
const double q = modq[j]; const double q = modq[j];
......
...@@ -322,6 +322,10 @@ void GramCharlierComptonProfile::addFSETerm(std::vector<double> &lhs) const { ...@@ -322,6 +322,10 @@ void GramCharlierComptonProfile::addFSETerm(std::vector<double> &lhs) const {
if (m_userFixedFSE) if (m_userFixedFSE)
kfse *= getParameter("C_0"); kfse *= getParameter("C_0");
if (m_yfine.empty() || m_qfine.empty()) {
throw std::runtime_error("The Y values or Q values have not been set");
}
for (int j = 0; j < NFINE_Y; ++j) { for (int j = 0; j < NFINE_Y; ++j) {
const double y = m_yfine[j] / M_SQRT2 / wg; const double y = m_yfine[j] / M_SQRT2 / wg;
const double he3 = boost::math::hermite(3, y); const double he3 = boost::math::hermite(3, y);
......
...@@ -134,6 +134,9 @@ void MultivariateGaussianComptonProfile::massProfile( ...@@ -134,6 +134,9 @@ void MultivariateGaussianComptonProfile::massProfile(
const auto &yspace = ySpace(); const auto &yspace = ySpace();
const auto &modq = modQ(); const auto &modq = modQ();
if (modq.empty() || yspace.empty()) {
throw std::runtime_error("Y values or Q values not set");
}
for (size_t i = 0; i < nData; i++) { for (size_t i = 0; i < nData; i++) {
const double y(yspace[i]); const double y(yspace[i]);
......
...@@ -12,6 +12,8 @@ Bugfixes ...@@ -12,6 +12,8 @@ Bugfixes
######## ########
- The Show Instruments right click menu option is now disabled for workspaces that have had their spectrum axis converted to another axis using :ref:`ConvertSpectrumAxis <algm-ConvertSpectrumAxis>`. Once this axis has been converetd the workspace loses it's link between the data values and the detectors they were recorded on so we cannot display it in the instrument view. - The Show Instruments right click menu option is now disabled for workspaces that have had their spectrum axis converted to another axis using :ref:`ConvertSpectrumAxis <algm-ConvertSpectrumAxis>`. Once this axis has been converetd the workspace loses it's link between the data values and the detectors they were recorded on so we cannot display it in the instrument view.
- Fixed an issue with Workspace History where unrolling consecutive workflow algorithms would result in only one of the algorithms being unrolled. - Fixed an issue with Workspace History where unrolling consecutive workflow algorithms would result in only one of the algorithms being unrolled.
- Fixed an issue where adding specific functions to the multi-dataset fitting interface caused it to crash
- Fixed an issue where mantid crashed if you cleared the functions in the multi-dataset fitting interface - Fixed an issue where mantid crashed if you cleared the functions in the multi-dataset fitting interface
:ref:`Release 5.0.0 <v5.0.0>` :ref:`Release 5.0.0 <v5.0.0>`
\ No newline at end of file
...@@ -56,6 +56,7 @@ void MDFFunctionPlotData::setDomain(double startX, double endX, size_t nX) { ...@@ -56,6 +56,7 @@ void MDFFunctionPlotData::setDomain(double startX, double endX, size_t nX) {
Mantid::API::FunctionDomain1DVector x(startX, endX, nX); Mantid::API::FunctionDomain1DVector x(startX, endX, nX);
Mantid::API::FunctionValues y(x); Mantid::API::FunctionValues y(x);
try { try {
m_function.get()->setUpForFit();
m_function->function(x, y); m_function->function(x, y);
} catch (std::invalid_argument &) { } catch (std::invalid_argument &) {
// Do nothing. // Do nothing.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment