Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write PeakShape #196

Merged
merged 14 commits into from
Feb 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ set ( INC_FILES
inc/MantidAPI/ScriptRepositoryFactory.h
inc/MantidAPI/SingleValueParameter.h
inc/MantidAPI/SingleValueParameterParser.h
inc/MantidAPI/SpecialCoordinateSystem.h
inc/MantidAPI/SpectraAxis.h
inc/MantidAPI/SpectrumDetectorMapping.h
inc/MantidAPI/TableRow.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MANTID_API_DLL IMDEventWorkspace : public API::IMDWorkspace,
virtual bool threadSafe() const;

virtual void setCoordinateSystem(
const Mantid::API::SpecialCoordinateSystem coordinateSystem) = 0;
const Mantid::Kernel::SpecialCoordinateSystem coordinateSystem) = 0;

protected:
virtual const std::string toString() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class DLLExport IMDHistoWorkspace : public IMDWorkspace,
virtual double &operator[](const size_t &index) = 0;

virtual void setCoordinateSystem(
const Mantid::API::SpecialCoordinateSystem coordinateSystem) = 0;
const Mantid::Kernel::SpecialCoordinateSystem coordinateSystem) = 0;

virtual boost::shared_ptr<IMDHistoWorkspace> clone() const = 0;

Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/IMDWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "MantidAPI/MDGeometry.h"
#include "MantidGeometry/MDGeometry/MDImplicitFunction.h"
#include "MantidAPI/IMDWorkspace.h"
#include "MantidAPI/SpecialCoordinateSystem.h"
#include "MantidKernel/SpecialCoordinateSystem.h"
#include "MantidAPI/ITableWorkspace.h"

namespace Mantid {
Expand Down Expand Up @@ -119,7 +119,7 @@ class MANTID_API_DLL IMDWorkspace : public Workspace,
/// Clear existing masks
virtual void clearMDMasking() = 0;
///
virtual Mantid::API::SpecialCoordinateSystem
virtual Mantid::Kernel::SpecialCoordinateSystem
getSpecialCoordinateSystem() const = 0;
/// if a workspace was filebacked, this should clear file-based status, delete
/// file-based information and close related files.
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "MantidAPI/DllConfig.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Crystal/PeakShape.h"
#include "MantidKernel/Matrix.h"
#include "MantidKernel/V3D.h"
#include "MantidKernel/PhysicalConstants.h"
Expand Down Expand Up @@ -84,6 +85,8 @@ class MANTID_API_DLL IPeak {
virtual Mantid::Kernel::V3D getDetPos() const = 0;
virtual double getL1() const = 0;
virtual double getL2() const = 0;

virtual const Mantid::Geometry::PeakShape& getPeakShape() = 0;
};

} // namespace Mantid
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPeaksWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//----------------------------------------------------------------------
#include "MantidAPI/ITableWorkspace.h"
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/SpecialCoordinateSystem.h"
#include "MantidKernel/SpecialCoordinateSystem.h"

namespace Mantid {

Expand Down Expand Up @@ -127,15 +127,15 @@ class MANTID_API_DLL IPeaksWorkspace : public ITableWorkspace,
* @param coordinateSystem : Special Q3D coordinate system to use.
*/
virtual void setCoordinateSystem(
const Mantid::API::SpecialCoordinateSystem coordinateSystem) = 0;
const Mantid::Kernel::SpecialCoordinateSystem coordinateSystem) = 0;

//---------------------------------------------------------------------------------------------
/**
* Get the special coordinate system.
* @returns special Q3D coordinate system to use being used by this
* PeaksWorkspace object. Probably the one the workspace was generated with.
*/
virtual Mantid::API::SpecialCoordinateSystem
virtual Mantid::Kernel::SpecialCoordinateSystem
getSpecialCoordinateSystem() const = 0;
virtual std::vector<std::pair<std::string, std::string>>
peakInfo(Kernel::V3D QFrame, bool labCoords) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class MANTID_API_DLL MatrixWorkspace : public IMDWorkspace,
void clearMDMasking();

/// @return the special coordinate system used if any.
virtual Mantid::API::SpecialCoordinateSystem
virtual Mantid::Kernel::SpecialCoordinateSystem
getSpecialCoordinateSystem() const;

//=====================================================================================
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/PeakTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "MantidAPI/IPeak.h"
#include <boost/regex.hpp>
#include <boost/shared_ptr.hpp>
#include "MantidAPI/SpecialCoordinateSystem.h"
#include "MantidKernel/SpecialCoordinateSystem.h"

namespace Mantid {
namespace API {
Expand Down Expand Up @@ -35,7 +35,7 @@ class DLLExport PeakTransform {
/// Getter for a friendly name to describe the transform type.
virtual std::string getFriendlyName() const = 0;
/// Getter for the special coordinate representation of this transform type.
virtual Mantid::API::SpecialCoordinateSystem getCoordinateSystem() const = 0;
virtual Mantid::Kernel::SpecialCoordinateSystem getCoordinateSystem() const = 0;

protected:
PeakTransform(const PeakTransform &other);
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/PeakTransformHKL.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DLLExport PeakTransformHKL : public PeakTransform {
/// Getter for a friendly name to describe the transform type.
virtual std::string getFriendlyName() const { return name(); }
/// Getter for the special coordinate representation of this transform type.
Mantid::API::SpecialCoordinateSystem getCoordinateSystem() const;
Mantid::Kernel::SpecialCoordinateSystem getCoordinateSystem() const;
};

/// Typedef a factory for type of PeaksTransform.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DLLExport PeakTransformQLab : public PeakTransform {
/// Get the transform friendly name.
virtual std::string getFriendlyName() const { return name(); }
/// Getter for the special coordinate representation of this transform type.
Mantid::API::SpecialCoordinateSystem getCoordinateSystem() const;
Mantid::Kernel::SpecialCoordinateSystem getCoordinateSystem() const;
};

/// Typedef a factory for type of PeaksTransform.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DLLExport PeakTransformQSample : public PeakTransform {
/// Getter for the transform name.
virtual std::string getFriendlyName() const { return name(); }
/// Getter for the special coordinate representation of this transform type.
Mantid::API::SpecialCoordinateSystem getCoordinateSystem() const;
Mantid::Kernel::SpecialCoordinateSystem getCoordinateSystem() const;
};

/// Typedef a factory for type of PeaksTransform.
Expand Down
13 changes: 0 additions & 13 deletions Code/Mantid/Framework/API/inc/MantidAPI/SpecialCoordinateSystem.h

This file was deleted.

4 changes: 2 additions & 2 deletions Code/Mantid/Framework/API/src/MatrixWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1704,9 +1704,9 @@ void MatrixWorkspace::clearMDMasking() {
/**
@return the special coordinate system used if any.
*/
Mantid::API::SpecialCoordinateSystem
Mantid::Kernel::SpecialCoordinateSystem
MatrixWorkspace::getSpecialCoordinateSystem() const {
return Mantid::API::None;
return Mantid::Kernel::None;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/API/src/PeakTransformHKL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ PeakTransformHKL::transformPeak(const Mantid::API::IPeak &peak) const {
/**
* @return Special coordinate system associated with this type of transform.
*/
Mantid::API::SpecialCoordinateSystem
Mantid::Kernel::SpecialCoordinateSystem
PeakTransformHKL::getCoordinateSystem() const {
return Mantid::API::HKL;
return Mantid::Kernel::HKL;
}
}
}
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/API/src/PeakTransformQLab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ PeakTransformQLab::transformPeak(const Mantid::API::IPeak &peak) const {
/**
* @return Special coordinate system associated with this type of transform.
*/
Mantid::API::SpecialCoordinateSystem
Mantid::Kernel::SpecialCoordinateSystem
PeakTransformQLab::getCoordinateSystem() const {
return Mantid::API::QLab;
return Mantid::Kernel::QLab;
}
}
}
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/API/src/PeakTransformQSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ PeakTransformQSample::transformPeak(const Mantid::API::IPeak &peak) const {
/**
* @return Special coordinate system associated with this type of transform.
*/
Mantid::API::SpecialCoordinateSystem
Mantid::Kernel::SpecialCoordinateSystem
PeakTransformQSample::getCoordinateSystem() const {
return Mantid::API::QSample;
return Mantid::Kernel::QSample;
}
}
}
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ class MatrixWorkspaceTest : public CxxTest::TestSuite
void test_getSpecialCoordinateSystem_default()
{
WorkspaceTester ws;
TSM_ASSERT_EQUALS("Should default to no special coordinate system.", Mantid::API::None, ws.getSpecialCoordinateSystem());
TSM_ASSERT_EQUALS("Should default to no special coordinate system.", Mantid::Kernel::None, ws.getSpecialCoordinateSystem());
}

void test_getFirstPulseTime_getLastPulseTime()
Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/API/test/MockObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include "MantidAPI/PeakTransform.h"
#include "MantidAPI/PeakTransformFactory.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IPeak.h"
#include "MantidKernel/SpecialCoordinateSystem.h"
#include <boost/regex.hpp>
#include <gmock/gmock.h>

Expand Down Expand Up @@ -39,7 +39,7 @@ namespace
MOCK_CONST_METHOD1(transform, Mantid::Kernel::V3D(const Mantid::Kernel::V3D&));
MOCK_CONST_METHOD1(transformPeak, Mantid::Kernel::V3D(const Mantid::API::IPeak&));
MOCK_CONST_METHOD0(getFriendlyName, std::string());
MOCK_CONST_METHOD0(getCoordinateSystem, Mantid::API::SpecialCoordinateSystem());
MOCK_CONST_METHOD0(getCoordinateSystem, Mantid::Kernel::SpecialCoordinateSystem());
};

/*------------------------------------------------------------
Expand Down Expand Up @@ -156,6 +156,7 @@ namespace
Mantid::Kernel::V3D());
MOCK_CONST_METHOD0(getDetectorPositionNoCheck,
Mantid::Kernel::V3D());
MOCK_METHOD0(getPeakShape, const Mantid::Geometry::PeakShape&());
};


Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/test/PeakTransformHKLTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void test_getFriendlyName()
void test_getCoordinateSystem()
{
PeakTransformHKL transform;
TS_ASSERT_EQUALS(Mantid::API::HKL, transform.getCoordinateSystem())
TS_ASSERT_EQUALS(Mantid::Kernel::HKL, transform.getCoordinateSystem())
}

};
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/test/PeakTransformQLabTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void test_getFriendlyName()
void test_getCoordinateSystem()
{
PeakTransformQLab transform;
TS_ASSERT_EQUALS(Mantid::API::QLab, transform.getCoordinateSystem())
TS_ASSERT_EQUALS(Mantid::Kernel::QLab, transform.getCoordinateSystem())
}


Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/test/PeakTransformQSampleTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void test_getFriendlyName()
void test_getCoordinateSystem()
{
PeakTransformQSample transform;
TS_ASSERT_EQUALS(Mantid::API::QSample, transform.getCoordinateSystem())
TS_ASSERT_EQUALS(Mantid::Kernel::QSample, transform.getCoordinateSystem())
}

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace
MOCK_METHOD1(getSpectrum, Mantid::API::ISpectrum*(const std::size_t));
MOCK_CONST_METHOD1(getSpectrum, const Mantid::API::ISpectrum*(const std::size_t));
MOCK_METHOD3(init, void(const size_t&, const size_t&, const size_t&));
MOCK_CONST_METHOD0(getSpecialCoordinateSystem, Mantid::API::SpecialCoordinateSystem());
MOCK_CONST_METHOD0(getSpecialCoordinateSystem, Mantid::Kernel::SpecialCoordinateSystem());
virtual ~MockIEventWorkspace()
{}
};}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DLLExport PeakBackground : public HardThresholdBackground {
/// Radius estimate
double m_radiusEstimate;
/// MD coordinates to use
Mantid::API::SpecialCoordinateSystem m_mdCoordinates;
Mantid::Kernel::SpecialCoordinateSystem m_mdCoordinates;
/// Pointer to member function used for coordinate determination.
boost::function<Mantid::Kernel::V3D(const Mantid::API::IPeak *)>
m_coordFunction;
Expand All @@ -59,7 +59,7 @@ class DLLExport PeakBackground : public HardThresholdBackground {
PeakBackground(Mantid::API::IPeaksWorkspace_const_sptr peaksWS,
const double &radiusEstimate, const double &thresholdSignal,
const Mantid::API::MDNormalization normalisation,
const Mantid::API::SpecialCoordinateSystem coordinates);
const Mantid::Kernel::SpecialCoordinateSystem coordinates);

/// Copy constructor
PeakBackground(const PeakBackground &other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ class DLLExport SetSpecialCoordinates : public API::Algorithm {
void init();
void exec();
std::vector<std::string> m_specialCoordinatesNames;
typedef std::map<std::string, Mantid::API::SpecialCoordinateSystem>
typedef std::map<std::string, Mantid::Kernel::SpecialCoordinateSystem>
SpecialCoordinatesNameMap;
SpecialCoordinatesNameMap m_specialCoordinatesMap;
static const std::string QLabOption();
static const std::string QSampleOption();
static const std::string HKLOption();
bool writeCoordinatesToMDEventWorkspace(
Mantid::API::Workspace_sptr inWS,
Mantid::API::SpecialCoordinateSystem coordinateSystem);
Mantid::Kernel::SpecialCoordinateSystem coordinateSystem);
bool writeCoordinatesToMDHistoWorkspace(
Mantid::API::Workspace_sptr inWS,
Mantid::API::SpecialCoordinateSystem coordinateSystem);
Mantid::Kernel::SpecialCoordinateSystem coordinateSystem);
bool writeCoordinatesToPeaksWorkspace(
Mantid::API::Workspace_sptr inWS,
Mantid::API::SpecialCoordinateSystem coordinateSystem);
Mantid::Kernel::SpecialCoordinateSystem coordinateSystem);
};

} // namespace Crystal
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Crystal/src/PeakBackground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PeakBackground::PeakBackground(IPeaksWorkspace_const_sptr peaksWS,
m_coordFunction = &IPeak::getQLabFrame;
} else if (m_mdCoordinates == QSample) {
m_coordFunction = &IPeak::getQSampleFrame;
} else if (m_mdCoordinates == Mantid::API::HKL) {
} else if (m_mdCoordinates == Mantid::Kernel::HKL) {
m_coordFunction = &IPeak::getHKL;
} else {
throw std::invalid_argument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PeakTransform_sptr makePeakTransform(IMDWorkspace const *const mdWS) {
peakTransformFactory = boost::make_shared<PeakTransformQLabFactory>();
} else if (mdCoordinates == QSample) {
peakTransformFactory = boost::make_shared<PeakTransformQSampleFactory>();
} else if (mdCoordinates == Mantid::API::HKL) {
} else if (mdCoordinates == Mantid::Kernel::HKL) {
peakTransformFactory = boost::make_shared<PeakTransformHKLFactory>();
}
const std::string xDim = mdWS->getDimension(0)->getName();
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/Crystal/src/SetSpecialCoordinates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ SetSpecialCoordinates::SetSpecialCoordinates() {
m_specialCoordinatesNames.push_back(SetSpecialCoordinates::HKLOption());

m_specialCoordinatesMap.insert(
std::make_pair(SetSpecialCoordinates::QLabOption(), Mantid::API::QLab));
std::make_pair(SetSpecialCoordinates::QLabOption(), Mantid::Kernel::QLab));
m_specialCoordinatesMap.insert(std::make_pair(
SetSpecialCoordinates::QSampleOption(), Mantid::API::QSample));
SetSpecialCoordinates::QSampleOption(), Mantid::Kernel::QSample));
m_specialCoordinatesMap.insert(
std::make_pair(SetSpecialCoordinates::HKLOption(), Mantid::API::HKL));
std::make_pair(SetSpecialCoordinates::HKLOption(), Mantid::Kernel::HKL));
}

//----------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Crystal/test/FindClusterFacesTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace
IPeaksWorkspace_sptr create_peaks_WS(Instrument_sptr inst)
{
PeaksWorkspace* pPeaksWS = new PeaksWorkspace();
pPeaksWS->setCoordinateSystem(Mantid::API::HKL);
pPeaksWS->setCoordinateSystem(Mantid::Kernel::HKL);
IPeaksWorkspace_sptr peakWS(pPeaksWS);
peakWS->setInstrument(inst);
return peakWS;
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/Crystal/test/PeakBackgroundTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class PeakBackgroundTest : public CxxTest::TestSuite
IPeaksWorkspace_const_sptr peaksWS = make_peaks_workspace(hklPeak);
const double radius = 1;
const double threshold = 100;
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::API::HKL);
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::Kernel::HKL);

MockIMDIterator mockIterator;
EXPECT_CALL(mockIterator, getNormalizedSignal()).WillOnce(Return(threshold+1)); // Returns above the threshold.
Expand All @@ -115,7 +115,7 @@ class PeakBackgroundTest : public CxxTest::TestSuite
IPeaksWorkspace_const_sptr peaksWS = make_peaks_workspace(hklPeak);
const double radius = 1;
const double threshold = 100;
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::API::HKL);
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::Kernel::HKL);

MockIMDIterator mockIterator;
V3D iteratorCenter(hklPeak[0] + radius, hklPeak[1], hklPeak[2]); // Offset so to be outside of peak radius.
Expand All @@ -133,7 +133,7 @@ class PeakBackgroundTest : public CxxTest::TestSuite
IPeaksWorkspace_const_sptr peaksWS = make_peaks_workspace(hklPeak);
const double radius = 1;
const double threshold = 100;
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::API::HKL);
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::Kernel::HKL);

MockIMDIterator mockIterator;
V3D iteratorCenter(hklPeak[0] + radius - 1e-4, hklPeak[1], hklPeak[2]); // Offset so to be outside of peak radius.
Expand All @@ -151,7 +151,7 @@ class PeakBackgroundTest : public CxxTest::TestSuite
IPeaksWorkspace_const_sptr peaksWS = make_peaks_workspace(hklPeak);
const double radius = 1;
const double threshold = 100;
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::API::HKL);
PeakBackground strategy(peaksWS, radius, threshold, NoNormalization, Mantid::Kernel::HKL);

MockIMDIterator mockIterator;
EXPECT_CALL(mockIterator, getNormalizedSignal()).WillOnce(Return(threshold)); // Returns equal to the threshold. Exclusive checking.
Expand Down