Skip to content

Commit

Permalink
Refs #6473. Merge branch 'feature/6473_muon_seq_fitting' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	Code/Mantid/MantidQt/MantidWidgets/CMakeLists.txt
  • Loading branch information
arturbekasov committed Dec 11, 2013
2 parents 3740413 + 9483f88 commit f273d41
Show file tree
Hide file tree
Showing 8 changed files with 834 additions and 31 deletions.
27 changes: 15 additions & 12 deletions Code/Mantid/MantidQt/MantidWidgets/CMakeLists.txt
@@ -1,22 +1,23 @@
set ( SRC_FILES
src/AlgorithmSelectorWidget.cpp
src/CatalogHelper.cpp
src/CatalogSearch.cpp
src/CheckboxHeader.cpp
src/DataSelector.cpp
src/DiagResults.cpp
src/FindReplaceDialog.cpp
src/FindDialog.cpp
src/FindReplaceDialog.cpp
src/FitPropertyBrowser.cpp
src/FunctionBrowser.cpp
src/CatalogSearch.cpp
src/CatalogHelper.cpp
src/InstrumentSelector.cpp
src/MessageDisplay.cpp
src/MWDiag.cpp
src/MWRunFiles.cpp
src/MessageDisplay.cpp
src/MultifitSetupDialog.cpp
src/MuonFitPropertyBrowser.cpp
src/MuonSequentialFitDialog.cpp
src/ProcessingAlgoWidget.cpp
src/PropertyHandler.cpp
src/ProcessingAlgoWidget.cpp
src/RangeSelector.cpp
src/RenameParDialog.cpp
src/SafeQwtPlot.cpp
Expand All @@ -32,9 +33,9 @@ set ( SRC_FILES

# Header files with Q_OBJECT that qmake will "moc"
set ( MOC_FILES
inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h
inc/MantidQtMantidWidgets/CheckboxHeader.h
inc/MantidQtMantidWidgets/DataSelector.h
inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h
inc/MantidQtMantidWidgets/CheckboxHeader.h
inc/MantidQtMantidWidgets/DataSelector.h
inc/MantidQtMantidWidgets/DiagResults.h
inc/MantidQtMantidWidgets/FindReplaceDialog.h
inc/MantidQtMantidWidgets/FindDialog.h
Expand All @@ -45,14 +46,15 @@ set ( MOC_FILES
inc/MantidQtMantidWidgets/MessageDisplay.h
inc/MantidQtMantidWidgets/MultifitSetupDialog.h
inc/MantidQtMantidWidgets/MuonFitPropertyBrowser.h
inc/MantidQtMantidWidgets/MuonSequentialFitDialog.h
inc/MantidQtMantidWidgets/MWDiag.h
inc/MantidQtMantidWidgets/MWRunFiles.h
inc/MantidQtMantidWidgets/PropertyHandler.h
inc/MantidQtMantidWidgets/ProcessingAlgoWidget.h
inc/MantidQtMantidWidgets/pythonCalc.h
inc/MantidQtMantidWidgets/RangeSelector.h
inc/MantidQtMantidWidgets/RenameParDialog.h
inc/MantidQtMantidWidgets/SafeQwtPlot.h
inc/MantidQtMantidWidgets/SafeQwtPlot.h
inc/MantidQtMantidWidgets/SaveWorkspaces.h
inc/MantidQtMantidWidgets/ScriptEditor.h
inc/MantidQtMantidWidgets/SelectFunctionDialog.h
Expand All @@ -66,16 +68,17 @@ set ( MOC_FILES
set ( INC_FILES
${MOC_FILES}
inc/MantidQtMantidWidgets/CatalogHelper.h
inc/MantidQtMantidWidgets/WidgetDllOption.h
inc/MantidQtMantidWidgets/WidgetDllOption.h
)

# QtDesigner UI files to process
set ( UI_FILES
inc/MantidQtMantidWidgets/DataSelector.ui
inc/MantidQtMantidWidgets/DataSelector.ui
inc/MantidQtMantidWidgets/CatalogSearch.ui
inc/MantidQtMantidWidgets/MultifitSetupDialog.ui
inc/MantidQtMantidWidgets/MWDiag.ui
inc/MantidQtMantidWidgets/MWRunFiles.ui
inc/MantidQtMantidWidgets/MultifitSetupDialog.ui
inc/MantidQtMantidWidgets/MuonSequentialFitDialog.ui
inc/MantidQtMantidWidgets/ProcessingAlgoWidget.ui
inc/MantidQtMantidWidgets/RenameParDialog.ui
inc/MantidQtMantidWidgets/SelectFunctionDialog.ui
Expand Down
Expand Up @@ -96,8 +96,13 @@ class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS FitPropertyBrowser: public QDockWidget,

/// Create a new function
PropertyHandler* addFunction(const std::string& fnName);

/// Get Composite Function
boost::shared_ptr<Mantid::API::CompositeFunction> compositeFunction()const{return m_compositeFunction;}

/// Return the fitting function
Mantid::API::IFunction_sptr getFittingFunction() const;

/// Get the default function type
std::string defaultFunctionType()const;
/// Set the default function type
Expand Down Expand Up @@ -209,9 +214,10 @@ class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS FitPropertyBrowser: public QDockWidget,
/// Create a MatrixWorkspace from a TableWorkspace
Mantid::API::Workspace_sptr createMatrixFromTableWorkspace()const;


public slots:
virtual void fit(){ doFit(500); }
void sequentialFit();
virtual void sequentialFit();
void undoFit();
void clear();
void clearBrowser();
Expand Down Expand Up @@ -337,8 +343,6 @@ private slots:
void minimizerChanged();
/// Do the fitting
void doFit(int maxIterations);
/// Return the fitting function
Mantid::API::IFunction_sptr getFittingFunction() const;

/// Property managers:
QtGroupPropertyManager *m_groupManager;
Expand Down
Expand Up @@ -47,6 +47,8 @@ class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS MuonFitPropertyBrowser: public MantidQt:
public slots:
/// Perform the fit algorithm
virtual void fit();
/// Open sequential fit dialog
virtual void sequentialFit();


protected:
Expand All @@ -60,8 +62,6 @@ private slots:
private:
/// Get the registered function names
virtual void populateFunctionNames();
/// Enable/disable the Fit button;
virtual void setFitEnabled(bool yes);
/// Check if the workspace can be used in the fit
virtual bool isWorkspaceValid(Mantid::API::Workspace_sptr)const;

Expand All @@ -71,4 +71,4 @@ private slots:
} // API


#endif /*MUONFITPROPERTYBROWSER_H_*/
#endif /*MUONFITPROPERTYBROWSER_H_*/
@@ -0,0 +1,126 @@
#ifndef MANTID_MANTIDWIDGETS_MUONSEQUENTIALFITDIALOG_H_
#define MANTID_MANTIDWIDGETS_MUONSEQUENTIALFITDIALOG_H_

#include "MantidKernel/System.h"
#include "MantidKernel/Logger.h"

#include "ui_MuonSequentialFitDialog.h"

#include "MantidQtMantidWidgets/MuonFitPropertyBrowser.h"

#include <QDialog>

namespace MantidQt
{
namespace MantidWidgets
{
using namespace Mantid::Kernel;
using namespace Mantid::API;

/** MuonSequentialFitDialog : TODO: DESCRIPTION
Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
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 DLLExport MuonSequentialFitDialog : public QDialog
{

Q_OBJECT

public:
MuonSequentialFitDialog(MuonFitPropertyBrowser* fitPropBrowser);
virtual ~MuonSequentialFitDialog();

enum DialogState
{
Running,
Stopped
};

signals:
void stateChanged(DialogState newState);

private:

// -- FUNCTIONS -----------------------------------------------------------

/// Check if all the input field are valid
bool isInputValid();

/// Set current dialog state
void setState(DialogState newState);

/// Initialize diagnosis table
void initDiagnosisTable();

/// Add a new entry to the diagnosis table
void addDiagnosisEntry(const std::string& runTitle, double fitQuality,
IFunction_sptr fittedFunction);

// -- VARIABLES -----------------------------------------------------------

/// UI form
Ui::MuonSequentialFitDialog m_ui;

/// Fit properties browser used to start the dialog
MuonFitPropertyBrowser* m_fitPropBrowser;

/// Current state of the dialog
DialogState m_state;

/// Whether user requested fitting to be stopped
bool m_stopRequested;

// -- STATIC MEMBERS ------------------------------------------------------

/// Checks if specified name is valid as a name for label.
static std::string isValidLabel(const std::string& label);

/// Returns displayable title for the given workspace
static std::string getRunTitle(Workspace_const_sptr ws);

/// Instance used to print log messages
static Mantid::Kernel::Logger& g_log;

private slots:
/// Updates visibility/tooltip of label error asterisk
void updateLabelError(const QString& label);

/// Enables/disables start button depending on wether we are allowed to start
void updateControlButtonState();

/// Sets control button to be start/stop depending on new dialog state
void updateControlButtonType(DialogState newState);

/// Update enabled state off all the input widgets depending on new dialog state
void updateInputEnabled(DialogState newState);

/// Start fitting process
void startFit();

/// Stop fitting process
void stopFit();
};


} // namespace MantidWidgets
} // namespace Mantid

#endif /* MANTID_MANTIDWIDGETS_MUONSEQUENTIALFITDIALOG_H_ */

0 comments on commit f273d41

Please sign in to comment.