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

Merge pull request #21139 from mantidproject/21138_remove_test_the_curve_fit_widget

Removed the "Test the Curve Fit widget" interface
parents 10550a9a 81210331
No related branches found
No related tags found
No related merge requests found
...@@ -37,4 +37,10 @@ Single Crystal Diffraction ...@@ -37,4 +37,10 @@ Single Crystal Diffraction
Imaging Imaging
------- -------
Features Removed
----------------
* The "Test the Curve Fit widget" graphical interface has been removed, it was a test harness for developers and was not intended to be exposed during earlier releases.
:ref:`Release 3.12.0 <v3.12.0>` :ref:`Release 3.12.0 <v3.12.0>`
...@@ -5,7 +5,6 @@ set ( SRC_FILES ...@@ -5,7 +5,6 @@ set ( SRC_FILES
DPDFFitOptionsBrowser.cpp DPDFFitOptionsBrowser.cpp
DPDFFourierTransform.cpp DPDFFourierTransform.cpp
DPDFInputDataControl.cpp DPDFInputDataControl.cpp
DisplayCurveFitTest.cpp
SliceSelector.cpp SliceSelector.cpp
) )
...@@ -19,12 +18,10 @@ set ( INC_FILES ...@@ -19,12 +18,10 @@ set ( INC_FILES
DPDFFitOptionsBrowser.h DPDFFitOptionsBrowser.h
DPDFFourierTransform.h DPDFFourierTransform.h
DPDFInputDataControl.h DPDFInputDataControl.h
DisplayCurveFitTest.h
SliceSelector.h SliceSelector.h
) )
set ( MOC_FILES set ( MOC_FILES
DisplayCurveFitTest.h
DPDFBackgroundRemover.h DPDFBackgroundRemover.h
DPDFDisplayControl.h DPDFDisplayControl.h
DPDFFitControl.h DPDFFitControl.h
...@@ -34,8 +31,8 @@ set ( MOC_FILES ...@@ -34,8 +31,8 @@ set ( MOC_FILES
SliceSelector.h SliceSelector.h
) )
set ( UI_FILES
DisplayCurveFitTest.ui set ( UI_FILES
DPDFBackgroundRemover.ui DPDFBackgroundRemover.ui
DPDFFitControl.ui DPDFFitControl.ui
DPDFFourierTransform.ui DPDFFourierTransform.ui
......
#include "DisplayCurveFitTest.h"
// includes for workspace handling
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/MatrixWorkspace.h"
// includes for interface functionality
#include "MantidQtWidgets/LegacyQwt/DisplayCurveFit.h"
#include "MantidQtWidgets/LegacyQwt/RangeSelector.h"
namespace {
Mantid::Kernel::Logger g_log("DynamicPDF");
}
namespace MantidQt {
namespace CustomInterfaces {
namespace DynamicPDF {
// Add this class to the list of specialised dialogs in this namespace only if
// compiling in Debug mode
//#ifndef NDEBUG
DECLARE_SUBWINDOW(DisplayCurveFitTest)
//#endif
using curveType = MantidQt::MantidWidgets::DisplayCurveFit::curveType;
using dcRange = MantidQt::MantidWidgets::DisplayCurveFit::dcRange;
// ++++++++++++++++++++++++++++
// +++++ Public Members +++++
// ++++++++++++++++++++++++++++
/// Constructor
DisplayCurveFitTest::DisplayCurveFitTest(QWidget *parent)
: UserSubWindow{parent} {}
DisplayCurveFitTest::~DisplayCurveFitTest() {}
/**
* @brief Initialize the widgets defined within the form generated in
* Qt-Designer. Also, defined the SIGNALS to SLOTS connections.
*/
void DisplayCurveFitTest::initLayout() {
m_uiForm.setupUi(this);
connect(m_uiForm.dataSelector, SIGNAL(dataReady(const QString &)), this,
SLOT(loadSpectra(const QString &)));
}
// +++++++++++++++++++++++++++
// +++++ Private Slots +++++
// +++++++++++++++++++++++++++
/**
* @brief The test proper that loads the fit curves to be
* displayed and the two ranges.
* @param workspaceName the name of the workspace containing
* the data of the curves to be displayed.
*/
void DisplayCurveFitTest::loadSpectra(const QString &workspaceName) {
auto workspace = Mantid::API::AnalysisDataService::Instance()
.retrieveWS<Mantid::API::MatrixWorkspace>(
workspaceName.toStdString());
if (!workspace) {
auto title = QString::fromStdString(this->name());
auto error =
QString::fromStdString("Workspace must be of type MatrixWorkspace");
QMessageBox::warning(this, title, error);
return;
}
if (workspace->getNumberHistograms() < 4) {
auto title = QString::fromStdString(this->name());
auto error = QString("Not enough number of histograms in the workspace");
QMessageBox::warning(this, title, error);
return;
}
m_uiForm.displayFit->addSpectrum(curveType::data, workspace, 0);
auto curveRange = m_uiForm.displayFit->getCurveRange(curveType::data);
static bool firstPass{TRUE};
// Set up the range selector for the fit
m_uiForm.displayFit->addRangeSelector(dcRange::fit);
auto rangeSelectorFit = m_uiForm.displayFit->m_rangeSelector.at(dcRange::fit);
if (firstPass || m_uiForm.updateRangeSelectors->isChecked()) {
rangeSelectorFit->setRange(curveRange.first, curveRange.second);
rangeSelectorFit->setMinimum(1.05 * curveRange.first);
rangeSelectorFit->setMaximum(0.95 * curveRange.second);
}
// Set up the range evaluate range selector
m_uiForm.displayFit->addRangeSelector(dcRange::evaluate);
auto rangeSelectorEvaluate =
m_uiForm.displayFit->m_rangeSelector.at(dcRange::evaluate);
if (firstPass || m_uiForm.updateRangeSelectors->isChecked()) {
rangeSelectorEvaluate->setRange(curveRange.first, curveRange.second);
rangeSelectorEvaluate->setMinimum(curveRange.first);
rangeSelectorEvaluate->setMaximum(curveRange.second);
}
m_uiForm.displayFit->addSpectrum(curveType::fit, workspace, 1);
m_uiForm.displayFit->addSpectrum(curveType::residuals, workspace, 2);
m_uiForm.displayFit->addSpectrum(curveType::guess, workspace, 3);
m_uiForm.displayFit->addResidualsZeroline();
firstPass = FALSE;
}
} // namespace MantidQt
} // namespace CustomInterfaces
} // namespace DynamicPDF
#ifndef MANTIDQTCUSTOMINTERFACES_DYNAMICPDF_DISPLAYCURVEFITTEST_H_
#define MANTIDQTCUSTOMINTERFACES_DYNAMICPDF_DISPLAYCURVEFITTEST_H_
// includes for interace functionailty
#include "DllConfig.h"
#include "MantidQtWidgets/Common/UserSubWindow.h"
#include "ui_DisplayCurveFitTest.h"
namespace MantidQt {
namespace CustomInterfaces {
namespace DynamicPDF {
/** An interface whose only purpose is to test widget DisplayCurveFit
The interface is visible in MantidPlot only when compiled in Debug mode.
@date 2016-02-22
Copyright &copy; 2012 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class MANTIDQT_DYNAMICPDF_DLL DisplayCurveFitTest
: public MantidQt::API::UserSubWindow {
Q_OBJECT
public:
/// The name of the interface as registered into the factory
static std::string name() { return "Test the DisplayCurveFit widget"; }
// This interface's categories.
static QString categoryInfo() { return "DynamicPDF"; }
DisplayCurveFitTest(QWidget *parent = nullptr);
~DisplayCurveFitTest() override;
private slots:
void loadSpectra(const QString &workspaceName);
private:
void initLayout() override;
/// The object containing the widgets defined in the form created in Qt
/// Designer
Ui::DisplayCurveFitTest m_uiForm;
}; // class DisplayCurveFitTest
} // namespace CustomInterfaces
} // namespace DynamicPDF
} // namespace MantidQt
#endif // MANTIDQTCUSTOMINTERFACES_DYNAMICPDF_DISPLAYCURVEFITTEST_H_
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DisplayCurveFitTest</class>
<widget class="QMainWindow" name="DisplayCurveFitTest">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>613</width>
<height>740</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dynamic PDF - Test DisplayCurveFit</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="MantidQt::MantidWidgets::DataSelector" name="dataSelector">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="MantidQt::MantidWidgets::DisplayCurveFit" name="displayFit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="updateRangeSelectors">
<property name="text">
<string>Update range selectors?</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>MantidQt::MantidWidgets::DataSelector</class>
<extends>QWidget</extends>
<header>MantidQtWidgets/Common/DataSelector.h</header>
</customwidget>
<customwidget>
<class>MantidQt::MantidWidgets::DisplayCurveFit</class>
<extends>QWidget</extends>
<header>MantidQtWidgets/LegacyQwt/DisplayCurveFit.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
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