Commit 1f7cf010 authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Move IPeaksWorkspace properties -> PeaksWorkspace properties

This makes these algorithms consistent with the rest of the code base.
parent 02503d8a
#include "MantidAlgorithms/AddPeak.h"
#include "MantidAPI/Axis.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/Run.h"
#include "MantidGeometry/Instrument/DetectorInfo.h"
......@@ -20,11 +20,13 @@ DECLARE_ALGORITHM(AddPeak)
using namespace Mantid::Kernel;
using namespace Mantid::API;
using Mantid::DataObjects::PeaksWorkspace;
using Mantid::DataObjects::PeaksWorkspace_sptr;
/** Initialize the algorithm's properties.
*/
void AddPeak::init() {
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"PeaksWorkspace", "", Direction::InOut),
"A peaks workspace.");
declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>(
......@@ -39,7 +41,7 @@ void AddPeak::init() {
/** Execute the algorithm.
*/
void AddPeak::exec() {
IPeaksWorkspace_sptr peaksWS = getProperty("PeaksWorkspace");
PeaksWorkspace_sptr peaksWS = getProperty("PeaksWorkspace");
MatrixWorkspace_sptr runWS = getProperty("RunWorkspace");
const int detID = getProperty("DetectorID");
......
......@@ -51,7 +51,7 @@ private:
void init() override;
void exec() override;
API::IPeaksWorkspace_sptr getPeaksWorkspace(
DataObjects::PeaksWorkspace_sptr getPeaksWorkspace(
const DataObjects::PeaksWorkspace_sptr &templateWorkspace,
const PeakStatisticsTools::UniqueReflectionCollection &reflections,
const Geometry::PointGroup_sptr &pointGroup) const;
......
......@@ -49,8 +49,6 @@ public:
private:
void init() override;
void exec() override;
Mantid::DataObjects::PeaksWorkspace_sptr tryFetchOutputWorkspace() const;
Mantid::DataObjects::PeaksWorkspace_sptr tryFetchInputWorkspace() const;
};
} // namespace Crystal
......
......@@ -90,7 +90,7 @@ void CountReflections::init() {
"Fraction of reflections with more than one observation.");
declareProperty(
Kernel::make_unique<WorkspaceProperty<IPeaksWorkspace>>(
Kernel::make_unique<WorkspaceProperty<PeaksWorkspace>>(
"MissingReflectionsWorkspace", "", Direction::Output,
PropertyMode::Optional),
"Reflections in specified d-range that are missing in input workspace.");
......@@ -148,7 +148,7 @@ void CountReflections::exec() {
setProperty("MultiplyObserved",
multiplyObservedReflections / observedUniqueReflectionsD);
IPeaksWorkspace_sptr outputWorkspace =
PeaksWorkspace_sptr outputWorkspace =
getPeaksWorkspace(inputPeaksWorkspace, reflections, pointGroup);
if (outputWorkspace) {
......@@ -171,7 +171,7 @@ void CountReflections::exec() {
* @param pointGroup :: Point group to expand unique reflections.
* @return :: PeaksWorkspace with missing reflections.
*/
IPeaksWorkspace_sptr CountReflections::getPeaksWorkspace(
PeaksWorkspace_sptr CountReflections::getPeaksWorkspace(
const PeaksWorkspace_sptr &templateWorkspace,
const PeakStatisticsTools::UniqueReflectionCollection &reflections,
const PointGroup_sptr &pointGroup) const {
......@@ -179,10 +179,10 @@ IPeaksWorkspace_sptr CountReflections::getPeaksWorkspace(
getPropertyValue("MissingReflectionsWorkspace");
if (outputWorkspaceName.empty()) {
return IPeaksWorkspace_sptr();
return PeaksWorkspace_sptr();
}
IPeaksWorkspace_sptr rawOutputPeaksWorkspace =
PeaksWorkspace_sptr rawOutputPeaksWorkspace =
getProperty("MissingReflectionsWorkspace");
PeaksWorkspace_sptr outputPeaksWorkspace =
......@@ -210,7 +210,7 @@ IPeaksWorkspace_sptr CountReflections::getPeaksWorkspace(
outputPeaksWorkspace->getPeaks().swap(peaks);
return boost::static_pointer_cast<IPeaksWorkspace>(outputPeaksWorkspace);
return outputPeaksWorkspace;
}
} // namespace Crystal
......
......@@ -54,7 +54,7 @@ void FilterPeaks::init() {
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"InputWorkspace", "", Direction::Input),
"The input workspace");
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"OutputWorkspace", "", Direction::Output),
"The filtered workspace");
......@@ -78,8 +78,9 @@ void FilterPeaks::init() {
*/
void FilterPeaks::exec() {
PeaksWorkspace_const_sptr inputWS = getProperty("InputWorkspace");
PeaksWorkspace_sptr filteredWS = boost::dynamic_pointer_cast<PeaksWorkspace>(
WorkspaceFactory::Instance().createPeaks());
IPeaksWorkspace_sptr filteredWS = WorkspaceFactory::Instance().createPeaks();
// Copy over ExperimentInfo from input workspace
filteredWS->copyExperimentInfoFrom(inputWS.get());
......
......@@ -2,10 +2,10 @@
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/IMDIterator.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IMDHistoWorkspace.h"
#include "MantidAPI/TableRow.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidKernel/BoundedValidator.h"
#include "MantidKernel/EnabledWhenProperty.h"
......@@ -16,6 +16,8 @@
using namespace Mantid::Kernel;
using namespace Mantid::Geometry;
using namespace Mantid::API;
using Mantid::DataObjects::PeaksWorkspace;
using Mantid::DataObjects::PeaksWorkspace_sptr;
namespace {
using namespace Mantid::Crystal;
......@@ -199,7 +201,7 @@ processing.
void executeFiltered(IMDIterator *mdIterator, ClusterFaces &localClusterFaces,
Progress &progress, IMDHistoWorkspace_sptr &clusterImage,
const std::vector<size_t> &imageShape,
IPeaksWorkspace_sptr &filterWorkspace,
PeaksWorkspace_sptr &filterWorkspace,
const OptionalLabelPeakIndexMap &optionalAllowedLabels) {
const int emptyLabelId = 0;
PeakClusterProjection projection(clusterImage);
......@@ -268,7 +270,7 @@ void FindClusterFaces::init() {
"An input image workspace consisting of cluster ids.");
declareProperty(
make_unique<WorkspaceProperty<IPeaksWorkspace>>(
make_unique<WorkspaceProperty<PeaksWorkspace>>(
"FilterWorkspace", "", Direction::Input, PropertyMode::Optional),
"Optional filtering peaks workspace. Used to restrict face finding to "
"clusters in image which correspond to peaks in the workspace.");
......@@ -308,7 +310,7 @@ void FindClusterFaces::exec() {
}
// Get the peaks workspace
IPeaksWorkspace_sptr filterWorkspace = this->getProperty("FilterWorkspace");
PeaksWorkspace_sptr filterWorkspace = this->getProperty("FilterWorkspace");
// Use the peaks workspace to filter to labels of interest
OptionalLabelPeakIndexMap optionalAllowedLabels = createOptionalLabelFilter(
......
......@@ -103,7 +103,7 @@ void IntegratePeaksHybrid::init() {
declareProperty(make_unique<WorkspaceProperty<IMDEventWorkspace>>(
"InputWorkspace", "", Direction::Input),
"Input md workspace.");
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"PeaksWorkspace", "", Direction::Input),
"A PeaksWorkspace containing the peaks to integrate.");
......@@ -129,7 +129,7 @@ void IntegratePeaksHybrid::init() {
"BackgroundOuterRadius", 0.0, compositeValidator, Direction::Input),
"Background outer radius estimate. Choose liberal value.");
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"OutputWorkspace", "", Direction::Output),
"An output integrated peaks workspace.");
......@@ -149,8 +149,8 @@ const std::string IntegratePeaksHybrid::summary() const {
*/
void IntegratePeaksHybrid::exec() {
IMDEventWorkspace_sptr mdWS = getProperty("InputWorkspace");
IPeaksWorkspace_sptr inPeakWS = getProperty("PeaksWorkspace");
IPeaksWorkspace_sptr peakWS = getProperty("OutputWorkspace");
PeaksWorkspace_sptr inPeakWS = getProperty("PeaksWorkspace");
PeaksWorkspace_sptr peakWS = getProperty("OutputWorkspace");
const int numBins = getProperty("NumberOfBins");
const double peakOuterRadius = getProperty("BackgroundOuterRadius");
const double halfPeakOuterRadius = peakOuterRadius / 2;
......
......@@ -49,7 +49,7 @@ void IntegratePeaksUsingClusters::init() {
declareProperty(make_unique<WorkspaceProperty<IMDHistoWorkspace>>(
"InputWorkspace", "", Direction::Input),
"Input md workspace.");
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"PeaksWorkspace", "", Direction::Input),
"A PeaksWorkspace containing the peaks to integrate.");
......@@ -74,7 +74,7 @@ void IntegratePeaksUsingClusters::init() {
"Normalization to use with Threshold. Defaults to "
"VolumeNormalization to account for different binning.");
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"OutputWorkspace", "", Direction::Output),
"An output integrated peaks workspace.");
declareProperty(make_unique<WorkspaceProperty<IMDHistoWorkspace>>(
......@@ -105,8 +105,8 @@ MDNormalization IntegratePeaksUsingClusters::getNormalization() {
*/
void IntegratePeaksUsingClusters::exec() {
IMDHistoWorkspace_sptr mdWS = getProperty("InputWorkspace");
IPeaksWorkspace_sptr inPeakWS = getProperty("PeaksWorkspace");
IPeaksWorkspace_sptr peakWS = getProperty("OutputWorkspace");
PeaksWorkspace_sptr inPeakWS = getProperty("PeaksWorkspace");
PeaksWorkspace_sptr peakWS = getProperty("OutputWorkspace");
if (peakWS != inPeakWS) {
peakWS = inPeakWS->clone();
}
......
#include "MantidKernel/ListValidator.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidAPI/TableRow.h"
#include "MantidCrystal/PeaksIntersection.h"
......@@ -10,6 +10,8 @@
using namespace Mantid::API;
using namespace Mantid::Geometry;
using namespace Mantid::Kernel;
using Mantid::DataObjects::PeaksWorkspace;
using Mantid::DataObjects::PeaksWorkspace_sptr;
namespace Mantid {
namespace Crystal {
......@@ -25,7 +27,7 @@ std::string PeaksIntersection::hklFrame() { return "HKL"; }
/** Initialize the algorithm's properties.
*/
void PeaksIntersection::initBaseProperties() {
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"InputWorkspace", "", Direction::Input),
"An input peaks workspace.");
......@@ -66,7 +68,7 @@ the surfaces.
*/
void PeaksIntersection::executePeaksIntersection(const bool checkPeakExtents) {
const std::string coordinateFrame = this->getPropertyValue("CoordinateFrame");
IPeaksWorkspace_sptr ws = this->getProperty("InputWorkspace");
PeaksWorkspace_sptr ws = this->getProperty("InputWorkspace");
m_peakRadius = this->getProperty("PeakRadius");
......
......@@ -29,14 +29,14 @@ DECLARE_ALGORITHM(PredictFractionalPeaks)
/// Initialise the properties
void PredictFractionalPeaks::init() {
declareProperty(
make_unique<WorkspaceProperty<IPeaksWorkspace>>("Peaks", "",
Direction::Input),
make_unique<WorkspaceProperty<PeaksWorkspace>>("Peaks", "",
Direction::Input),
"Workspace of Peaks with orientation matrix that indexed the peaks and "
"instrument loaded");
declareProperty(
make_unique<WorkspaceProperty<IPeaksWorkspace>>("FracPeaks", "",
Direction::Output),
make_unique<WorkspaceProperty<PeaksWorkspace>>("FracPeaks", "",
Direction::Output),
"Workspace of Peaks with peaks with fractional h,k, and/or l values");
declareProperty(Kernel::make_unique<Kernel::ArrayProperty<double>>(
string("HOffset"), "-0.5,0.0,0.5"),
......@@ -95,11 +95,10 @@ void PredictFractionalPeaks::init() {
/// Run the algorithm
void PredictFractionalPeaks::exec() {
IPeaksWorkspace_sptr ipeaks = getProperty("Peaks");
auto Peaks = boost::dynamic_pointer_cast<PeaksWorkspace>(ipeaks);
PeaksWorkspace_sptr Peaks = getProperty("Peaks");
if (!Peaks)
throw std::invalid_argument(
"Input workspace is not a PeaksWorkspace. Type=" + ipeaks->id());
"Input workspace is not a PeaksWorkspace. Type=" + Peaks->id());
vector<double> hOffsets = getProperty("HOffset");
vector<double> kOffsets = getProperty("KOffset");
......@@ -124,8 +123,8 @@ void PredictFractionalPeaks::exec() {
Geometry::Instrument_const_sptr Instr = Peaks->getInstrument();
boost::shared_ptr<IPeaksWorkspace> OutPeaks =
WorkspaceFactory::Instance().createPeaks();
auto OutPeaks = boost::dynamic_pointer_cast<IPeaksWorkspace>(
WorkspaceFactory::Instance().createPeaks());
OutPeaks->setInstrument(Instr);
V3D hkl;
......
......@@ -31,10 +31,10 @@ const std::string SortPeaksWorkspace::category() const {
/** Initialize the algorithm's properties.
*/
void SortPeaksWorkspace::init() {
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"InputWorkspace", "", Direction::Input),
"An input workspace.");
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
"OutputWorkspace", "", Direction::Output),
"An output workspace.");
......@@ -46,36 +46,14 @@ void SortPeaksWorkspace::init() {
"Sort the OutputWorkspace by the target column in a Ascending fashion.");
}
PeaksWorkspace_sptr SortPeaksWorkspace::tryFetchOutputWorkspace() const {
IPeaksWorkspace_sptr temp = getProperty("OutputWorkspace");
PeaksWorkspace_sptr outputWS;
if (temp != nullptr) {
outputWS = boost::dynamic_pointer_cast<PeaksWorkspace>(temp);
if (outputWS == nullptr) {
throw std::invalid_argument("OutputWorkspace is not a PeaksWorkspace.");
}
}
return outputWS;
}
PeaksWorkspace_sptr SortPeaksWorkspace::tryFetchInputWorkspace() const {
IPeaksWorkspace_sptr temp = getProperty("InputWorkspace");
PeaksWorkspace_sptr inputWS =
boost::dynamic_pointer_cast<PeaksWorkspace>(temp);
if (inputWS == nullptr) {
throw std::invalid_argument("InputWorkspace is not a PeaksWorkspace.");
}
return inputWS;
}
//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
*/
void SortPeaksWorkspace::exec() {
const std::string columnToSortBy = getProperty("ColumnNameToSortBy");
const bool sortAscending = getProperty("SortAscending");
PeaksWorkspace_sptr inputWS = tryFetchInputWorkspace();
PeaksWorkspace_sptr outputWS = tryFetchOutputWorkspace();
PeaksWorkspace_sptr inputWS = getProperty("InputWorkspace");
PeaksWorkspace_sptr outputWS = getProperty("OutputWorkspace");
try {
// Try to get the column. This will throw if the column does not exist.
......
......@@ -29,10 +29,10 @@ using namespace Mantid::Geometry;
// Helper typedef
using MDHistoPeaksWSTuple =
boost::tuple<IMDHistoWorkspace_sptr, IPeaksWorkspace_sptr>;
boost::tuple<IMDHistoWorkspace_sptr, PeaksWorkspace_sptr>;
// Helper typedef
using MDEventPeaksWSTuple =
boost::tuple<IMDEventWorkspace_sptr, IPeaksWorkspace_sptr>;
boost::tuple<IMDEventWorkspace_sptr, PeaksWorkspace_sptr>;
class ClusterIntegrationBaseTest {
protected:
......@@ -102,7 +102,7 @@ protected:
coordsAlg->execute();
// --- Make a fake PeaksWorkspace ---
IPeaksWorkspace_sptr peakWS(new PeaksWorkspace());
PeaksWorkspace_sptr peakWS(new PeaksWorkspace());
peakWS->setInstrument(inst);
// --- Set speical coordinates on fake PeaksWorkspace --
......
......@@ -19,8 +19,7 @@ using namespace Mantid::DataObjects;
using namespace Mantid::API;
namespace {
using AlgorithmOutputs =
boost::tuple<WorkspaceGroup_sptr, IPeaksWorkspace_sptr>;
using AlgorithmOutputs = boost::tuple<WorkspaceGroup_sptr, PeaksWorkspace_sptr>;
// Execute the clustering integration algorithm
AlgorithmOutputs execute_integration(const MDEventPeaksWSTuple &inputWorkspaces,
......@@ -41,7 +40,7 @@ AlgorithmOutputs execute_integration(const MDEventPeaksWSTuple &inputWorkspaces,
alg.setPropertyValue("OutputWorkspaces", "out_ws_md");
alg.execute();
// ------- Get the integrated results
IPeaksWorkspace_sptr outPeaksWS = alg.getProperty("OutputWorkspace");
PeaksWorkspace_sptr outPeaksWS = alg.getProperty("OutputWorkspace");
WorkspaceGroup_sptr outClustersWS = alg.getProperty("OutputWorkspaces");
return AlgorithmOutputs(outClustersWS, outPeaksWS);
}
......@@ -162,7 +161,7 @@ public:
execute_integration(inputWorkspaces, backgroundOuterRadius, nBins);
// ------- Get the integrated results
WorkspaceGroup_sptr outClustersWorkspaces = integratedWorkspaces.get<0>();
IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
PeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
TSM_ASSERT_EQUALS("Expect one output image", 1,
outClustersWorkspaces->size());
......@@ -220,9 +219,9 @@ public:
AlgorithmOutputs integratedWorkspaces3 =
execute_integration(inputWorkspaces, peakRadius * 3.5, nBins);
IPeaksWorkspace_sptr outPeaksWS1 = integratedWorkspaces1.get<1>();
IPeaksWorkspace_sptr outPeaksWS2 = integratedWorkspaces2.get<1>();
IPeaksWorkspace_sptr outPeaksWS3 = integratedWorkspaces3.get<1>();
PeaksWorkspace_sptr outPeaksWS1 = integratedWorkspaces1.get<1>();
PeaksWorkspace_sptr outPeaksWS2 = integratedWorkspaces2.get<1>();
PeaksWorkspace_sptr outPeaksWS3 = integratedWorkspaces3.get<1>();
TSM_ASSERT(
"Conservative intensities should lead to lower integrated values.",
......@@ -249,7 +248,7 @@ public:
execute_integration(inputWorkspaces, backgroundOuterRadius, nBins);
// ------- Get the integrated results
WorkspaceGroup_sptr outClustersWorkspaces = integratedWorkspaces.get<0>();
IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
PeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
TSM_ASSERT_EQUALS("Expect two output images", 2,
outClustersWorkspaces->size());
......@@ -326,7 +325,7 @@ public:
execute_integration(inputWorkspaces, backgroundOuterRadius, nBins);
// ------- Get the integrated results
WorkspaceGroup_sptr outClustersWorkspaces = integratedWorkspaces.get<0>();
IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
PeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
TSM_ASSERT_EQUALS("Expect two output images", 2,
outClustersWorkspaces->size());
......
......@@ -29,7 +29,7 @@ execute_integration(const MDHistoPeaksWSTuple &inputWorkspaces,
alg.setPropertyValue("OutputWorkspaceMD", "out_ws_md");
alg.execute();
// ------- Get the integrated results
IPeaksWorkspace_sptr outPeaksWS = alg.getProperty("OutputWorkspace");
PeaksWorkspace_sptr outPeaksWS = alg.getProperty("OutputWorkspace");
IMDHistoWorkspace_sptr outClustersWS = alg.getProperty("OutputWorkspaceMD");
return MDHistoPeaksWSTuple(outClustersWS, outPeaksWS);
}
......@@ -119,7 +119,7 @@ public:
execute_integration(inputWorkspaces, threshold);
// ------- Get the integrated results
IMDHistoWorkspace_sptr outClustersWS = integratedWorkspaces.get<0>();
IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
PeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
std::unordered_set<Mantid::signal_t> labelIds;
for (size_t i = 0; i < outClustersWS->getNPoints(); ++i) {
......@@ -149,7 +149,7 @@ public:
execute_integration(inputWorkspaces, threshold);
// ------- Get the integrated results
IMDHistoWorkspace_sptr outClustersWS = integratedWorkspaces.get<0>();
IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
PeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
// ------- Check the results.
// Basic checks
......@@ -190,7 +190,7 @@ public:
execute_integration(inputWorkspaces, threshold);
// ------- Get the integrated results
IMDHistoWorkspace_sptr outClustersWS = integratedWorkspaces.get<0>();
IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
PeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
// ------- Check the results.
// Basic checks
......@@ -245,7 +245,7 @@ public:
execute_integration(inputWorkspaces, threshold);
// ------- Get the integrated results
IMDHistoWorkspace_sptr outClustersWS = integratedWorkspaces.get<0>();
IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
PeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
// ------- Check the results.
// Basic checks
......
......@@ -77,7 +77,7 @@ public:
TS_ASSERT(alg.execute());
TS_ASSERT(alg.isExecuted());
alg.setPropertyValue("FracPeaks", "FracPeaks");
IPeaksWorkspace_sptr FracPeaks = alg.getProperty("FracPeaks");
PeaksWorkspace_sptr FracPeaks = alg.getProperty("FracPeaks");
TS_ASSERT_EQUALS(FracPeaks->getNumberPeaks(), 117);
......
......@@ -194,9 +194,7 @@ public:
TS_ASSERT_THROWS_NOTHING(alg.execute());
TS_ASSERT(alg.isExecuted());
IPeaksWorkspace_sptr temp = alg.getProperty("OutputWorkspace");
PeaksWorkspace_sptr outWS =
boost::dynamic_pointer_cast<PeaksWorkspace>(temp);
PeaksWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
TSM_ASSERT_EQUALS("Sorting should have happened in place. Output and input "
"workspaces should be the same.",
......
......@@ -64,6 +64,7 @@ void CentroidPeaksMD2::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
/// Output peaks workspace, create if needed
Mantid::DataObjects::PeaksWorkspace_sptr peakWS =
getProperty("OutputWorkspace");
if (peakWS != inPeakWS)
peakWS = inPeakWS->clone();
......
......@@ -21,6 +21,7 @@ set ( EXPORT_FILES
src/Exports/MDEventWorkspace.cpp
src/Exports/MDHistoWorkspace.cpp
src/Exports/PeaksWorkspace.cpp
src/Exports/PeaksWorkspaceProperty.cpp
src/Exports/TableWorkspace.cpp
src/Exports/SplittersWorkspace.cpp
src/Exports/WorkspaceSingleValue.cpp
......
#include "MantidPythonInterface/api/WorkspacePropertyExporter.h"
#include "MantidPythonInterface/kernel/GetPointer.h"
#include "MantidDataObjects/PeaksWorkspace.h"
using Mantid::DataObjects::PeaksWorkspace;
using Mantid::API::WorkspaceProperty; // NOLINT
GET_POINTER_SPECIALIZATION(WorkspaceProperty<PeaksWorkspace>)
void export_IPeaksWorkspaceProperty() {
using Mantid::PythonInterface::WorkspacePropertyExporter;
WorkspacePropertyExporter<PeaksWorkspace>::define("PeaksWorkspaceProperty");
}
......@@ -936,7 +936,7 @@ def _gather_returns(func_name, lhs, algm_obj, ignore_regex=None, inout=False):
value_str = prop.valueAsStr
retvals[name] = _api.AnalysisDataService[value_str]
except KeyError:
if not prop.isOptional() and prop.direction == _kernel.Direction.InOut:
if not (hasattr(prop, 'isOptional') and prop.isOptional()) and prop.direction == _kernel.Direction.InOut:
raise RuntimeError("Mandatory InOut workspace property '%s' on "
"algorithm '%s' has not been set correctly. " % (name, algm_obj.name()))
elif _is_function_property(prop):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment