Skip to content

Commit

Permalink
refs #4328, #3641 Work on mementos.
Browse files Browse the repository at this point in the history
 Can now store lattice information, so more transaction like. Improvements internal python algorithms used for UB generation.
  • Loading branch information
OwenArnold committed Jan 4, 2012
1 parent 9170059 commit 6166aba
Show file tree
Hide file tree
Showing 11 changed files with 472 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ namespace MantidQt
int runConfirmation(const std::string& message);
/// Checks the candidate is unique, then adds it to the existing data.
void addUniqueMemento(WorkspaceMemento_sptr candidate);
/// Get the first selected memento.
WorkspaceMemento_sptr getFirstSelected();

private slots:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,57 +135,204 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_mandatory">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_latticeCrystal">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_lattice">
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>UB Matrix</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_latticeCrystal">
<item>
<widget class="QGroupBox" name="groupBox_lattice">
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>UB Matrix</string>
</property>
<widget class="QPushButton" name="btn_set_ub_matrix">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>281</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Set UB Matrix</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_find_ub_matrix">
<property name="text">
<widget class="QGroupBox" name="gropBox_findUB">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>281</width>
<height>131</height>
</rect>
</property>
<property name="title">
<string>Find UB Matrix</string>
</property>
<widget class="QPushButton" name="btn_find_ub_matrix">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>261</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Find UB Matrix</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_PeakFinding">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>121</width>
<height>71</height>
</rect>
</property>
<property name="title">
<string>Peak Finding</string>
</property>
<widget class="QRadioButton" name="ckFindSXPeaks">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>101</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>FindSXPeaks</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_PeakIndexing">
<property name="geometry">
<rect>
<x>140</x>
<y>50</y>
<width>131</width>
<height>71</height>
</rect>
</property>
<property name="title">
<string>Peak Indexing</string>
</property>
<widget class="QRadioButton" name="ckIndexPeaks">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>82</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>IndexPeaks</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="ckIndexSXPeaks">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>91</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>IndexSXPeaks</string>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_logValues_Goniometer">
<item>
<widget class="QGroupBox" name="groupBox_goniometeroffsets">
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Goniometer Settings</string>
</property>
</widget>
<zorder>btn_set_ub_matrix</zorder>
<zorder>gropBox_findUB</zorder>
<zorder></zorder>
<zorder>goniometerGroupBox</zorder>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="goniometerGroupBox">
<property name="title">
<string>Goniometer Settings</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<widget class="QPushButton" name="btn_set_goniometer">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>281</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Set Goniometer</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Create MD Workspace</string>
</property>
<widget class="QPushButton" name="btn_create">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>281</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Create MD Workspace</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>20</x>
<y>150</y>
<width>161</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Merge All MD Workspaces</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="sizePolicy">
Expand All @@ -208,15 +355,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="controlButtonsLayout">
<item>
<widget class="QPushButton" name="btn_create">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
</layout>
<layout class="QHBoxLayout" name="controlButtonsLayout"/>
</item>
</layout>
</widget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace MantidQt
{
/** @class WorkspaceMemento
A memento carrying basic information about an existing workspace.
A memento carrying basic information about an existing workspace.
Mementos introduce transaction like behaviour because changes to mementos are not automatically persisted to workspaces and can occur independently.
@author Owen Arnold
@date 30/08/2011
Expand Down Expand Up @@ -68,36 +69,26 @@ namespace MantidQt
@throw if workspace has been moved since instantiation.
*/
virtual Mantid::API::MatrixWorkspace_sptr fetchIt() const = 0;
/**
Generates a status report based on the workspace state.
*/
std::string statusReport()
{
return m_statusReport;
}
/// Generates a status report based on the workspace state.
std::string statusReport() const;
/// Perform any clean up operations of the underlying workspace
virtual void cleanUp() = 0;
/// Sets the status report overrideing it with the provided message.
void setReport(const Status status);

/// Sets a ub matrix element by element.
void setUB(const double& ub00, const double& ub01, const double& ub02, const double& ub10, const double& ub11, const double& ub12, const double& ub20, const double& ub21, const double& ub22);
/// Getter for a ub matrix.
std::vector<double> getUB() const;
/// Destructor
virtual ~WorkspaceMemento(){};

protected:

/**
Common implementation of report generation.
@param ws : workspace to report on.
*/
void generateReport(Mantid::API::MatrixWorkspace_sptr ws);
/// Common implementation for generating status
const WorkspaceMemento::Status generateStatus() const;

private:

/// Extract a friendly status.
void interpretStatus(const Status arg);
std::string interpretStatus(const Status arg) const;

/// Status report.
std::string m_statusReport;
//Vector of elements describing a UB matrix.
std::vector<double> m_ub;

};

Expand Down

0 comments on commit 6166aba

Please sign in to comment.