Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/7557_muon_rm_tmp_file'
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Oct 18, 2013
2 parents 2a2561c + ae512fb commit 7f5492f
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 255 deletions.
5 changes: 5 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/AsymmetryCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ void AsymmetryCalc::exec()
specIDs[1] = backward;
std::vector<size_t> indices;
tmpWS->getIndicesFromSpectra( specIDs, indices );

// If some spectra were not found, can't continue
if(specIDs.size() != indices.size())
throw std::invalid_argument("Some of the spectra specified do not exist in a workspace");

forward = static_cast<int>( indices[0] );
backward = static_cast<int>( indices[1] );
}
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ set( TEST_FILES CreateMDWorkspaceAlgDialogTest.h
WorkspaceMementoTest.h
WorkspaceInADSTest.h
RawFileMementoTest.h
IO_MuonGroupingTest.h
)

include_directories ( inc )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
// Includes
//----------------------
#include "ui_MuonAnalysis.h"
#include "MantidQtCustomInterfaces/MuonAnalysis.h"
#include "MantidQtAPI/UserSubWindow.h"
#include "MantidQtCustomInterfaces/MuonAnalysis.h"
#include "MantidQtCustomInterfaces/DllConfig.h"

#include "MantidQtMantidWidgets/pythonCalc.h"
#include "MantidQtMantidWidgets/MWRunFiles.h"
Expand Down Expand Up @@ -51,20 +52,53 @@ File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/

/// save XML grouping file
void saveGroupingTabletoXML(Ui::MuonAnalysis& m_uiForm, const std::string& filename);
using namespace Mantid;
using namespace Mantid::API;

/// Structure to represent grouping information for Muon Analysis
typedef struct {
std::vector<std::string> groupNames;
std::vector<std::string> groups; // Range strings, e.g. "1-32"

std::vector<std::string> pairNames;
std::vector<std::pair<size_t, size_t> > pairs; // Pairs of group ids
std::vector<double> pairAlphas;

std::string description;
std::string defaultName; // Not storing id because can be either group or pair
} Grouping;

/// Saves grouping to the XML file specified
void MANTIDQT_CUSTOMINTERFACES_DLL saveGroupingToXML(const Grouping& grouping,
const std::string& filename);

/// Loads grouping from the XML file specified
void MANTIDQT_CUSTOMINTERFACES_DLL loadGroupingFromXML(const std::string& filename,
Grouping& grouping);

/// Parses information from the grouping table and saves to Grouping struct
void MANTIDQT_CUSTOMINTERFACES_DLL parseGroupingTable(const Ui::MuonAnalysis& form,
Grouping& grouping);

/// Fills in the grouping table using information from provided Grouping struct
void MANTIDQT_CUSTOMINTERFACES_DLL fillGroupingTable(const Grouping& grouping,
Ui::MuonAnalysis& form);

/// load XML grouping file
void loadGroupingXMLtoTable(Ui::MuonAnalysis& m_uiForm, const std::string& filename);
/// Groups the workspace according to grouping provided
MatrixWorkspace_sptr MANTIDQT_CUSTOMINTERFACES_DLL groupWorkspace(MatrixWorkspace_const_sptr ws,
const Grouping& g);

/// create 'map' relating group number to row number in group table
void whichGroupToWhichRow(Ui::MuonAnalysis& m_uiForm, std::vector<int>& groupToRow);
void MANTIDQT_CUSTOMINTERFACES_DLL whichGroupToWhichRow(const Ui::MuonAnalysis& m_uiForm,
std::vector<int>& groupToRow);

/// create 'map' relating pair number to row number in pair table
void whichPairToWhichRow(Ui::MuonAnalysis& m_uiForm, std::vector<int>& pairToRow);
void MANTIDQT_CUSTOMINTERFACES_DLL whichPairToWhichRow(const Ui::MuonAnalysis& m_uiForm,
std::vector<int>& pairToRow);

/// Set Group / Group Pair name
void setGroupGroupPair(Ui::MuonAnalysis& m_uiForm, const std::string& name);
void MANTIDQT_CUSTOMINTERFACES_DLL setGroupGroupPair(Ui::MuonAnalysis& m_uiForm,
const std::string& name);

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,6 @@ private slots:
/// is grouping set
bool isGroupingSet();

/// Apply grouping specified in xml file to workspace
bool applyGroupingToWS( const std::string& inputWS, const std::string& outputWS,
const std::string& filename);

/// create WS contained the data for a plot
void createPlotWS(const std::string& groupName,
const std::string& inputWS, const std::string& outWS);
Expand Down Expand Up @@ -344,9 +340,6 @@ private slots:
/// List of current group names
std::vector<std::string> m_groupNames;

/// name for file to temperary store grouping
std::string m_groupingTempFilename;

/// Deal with input file changes.
void handleInputFileChanges();

Expand Down Expand Up @@ -412,6 +405,9 @@ private slots:
/// Boolean to show whether the gui is being updated
bool m_updating;

/// Flag to indicate that grouping table is being updated
bool m_updatingGrouping;

/// Boolean to show when data has been loaded. (Can't auto-update data that hasn't been loaded)
bool m_loaded;

Expand Down

0 comments on commit 7f5492f

Please sign in to comment.