Commit 1bbde4a8 authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #12863 use convention of workspace for saves

parent 0d4acd88
...@@ -119,6 +119,8 @@ public: ...@@ -119,6 +119,8 @@ public:
IMDIterator * IMDIterator *
createIterator(Mantid::Geometry::MDImplicitFunction *function = NULL) const; createIterator(Mantid::Geometry::MDImplicitFunction *function = NULL) const;
std::string getConvention() const;
signal_t getSignalAtVMD(const Mantid::Kernel::VMD &coords, signal_t getSignalAtVMD(const Mantid::Kernel::VMD &coords,
const Mantid::API::MDNormalization &normalization = const Mantid::API::MDNormalization &normalization =
Mantid::API::VolumeNormalization) const; Mantid::API::VolumeNormalization) const;
......
...@@ -64,6 +64,11 @@ public: ...@@ -64,6 +64,11 @@ public:
*/ */
virtual int getNumberPeaks() const = 0; virtual int getNumberPeaks() const = 0;
//---------------------------------------------------------------------------------------------
/** @return the number of peaks
*/
virtual std::string getConvention() const = 0;
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
/** Removes the indicated peak /** Removes the indicated peak
* @param peakNum the peak to remove. peakNum starts at 0 * @param peakNum the peak to remove. peakNum starts at 0
...@@ -155,6 +160,8 @@ public: ...@@ -155,6 +160,8 @@ public:
peakInfo(Kernel::V3D QFrame, bool labCoords) const = 0; peakInfo(Kernel::V3D QFrame, bool labCoords) const = 0;
virtual int peakInfoNumber(Kernel::V3D qLabFrame, bool labCoords) const = 0; virtual int peakInfoNumber(Kernel::V3D qLabFrame, bool labCoords) const = 0;
std::string convention;
protected: protected:
/// Protected copy constructor. May be used by childs for cloning. /// Protected copy constructor. May be used by childs for cloning.
IPeaksWorkspace(const IPeaksWorkspace &other) IPeaksWorkspace(const IPeaksWorkspace &other)
...@@ -165,7 +172,6 @@ protected: ...@@ -165,7 +172,6 @@ protected:
virtual const std::string toString() const; virtual const std::string toString() const;
private: private:
std::string convention;
virtual IPeaksWorkspace *doClone() const = 0; virtual IPeaksWorkspace *doClone() const = 0;
}; };
} }
......
...@@ -43,6 +43,11 @@ IMDIterator *IMDWorkspace::createIterator( ...@@ -43,6 +43,11 @@ IMDIterator *IMDWorkspace::createIterator(
return iterators[0]; return iterators[0];
} }
//---------------------------------------------------------------------------------------------
/** @return the convention
*/
std::string IMDWorkspace::getConvention() const { return convention; }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
/** Returns the signal (normalized by volume) at a given coordinates /** Returns the signal (normalized by volume) at a given coordinates
* *
...@@ -91,7 +96,7 @@ const std::string IMDWorkspace::toString() const { ...@@ -91,7 +96,7 @@ const std::string IMDWorkspace::toString() const {
os << "Binned from '" << getOriginalWorkspace()->getName(); os << "Binned from '" << getOriginalWorkspace()->getName();
} }
os << "\n"; os << "\n";
if (convention == "Crystallography") if (this->getConvention() == "Crystallography")
os << "Crystallography: kf-ki"; os << "Crystallography: kf-ki";
else else
os << "Inelastic: ki-kf"; os << "Inelastic: ki-kf";
......
...@@ -250,8 +250,7 @@ void SaveIsawPeaks::exec() { ...@@ -250,8 +250,7 @@ void SaveIsawPeaks::exec() {
// HKL's are flipped by -1 because of the internal Q convention // HKL's are flipped by -1 because of the internal Q convention
// unless Crystallography convention // unless Crystallography convention
double qSign = -1.0; double qSign = -1.0;
std::string convention = ConfigService::Instance().getString("Q.convention"); if (ws->getConvention() == "Crystallography")
if (convention == "Crystallography")
qSign = 1.0; qSign = 1.0;
// ============================== Save all Peaks // ============================== Save all Peaks
// ========================================= // =========================================
......
...@@ -102,6 +102,7 @@ public: ...@@ -102,6 +102,7 @@ public:
void sort(std::vector<std::pair<std::string, bool>> &criteria); void sort(std::vector<std::pair<std::string, bool>> &criteria);
int getNumberPeaks() const; int getNumberPeaks() const;
std::string getConvention() const;
void removePeak(int peakNum); void removePeak(int peakNum);
void addPeak(const Geometry::IPeak &ipeak); void addPeak(const Geometry::IPeak &ipeak);
Peak &getPeak(int peakNum); Peak &getPeak(int peakNum);
......
...@@ -752,7 +752,7 @@ void MDBoxFlatTree::saveWSGenericInfo(::NeXus::File *const file, ...@@ -752,7 +752,7 @@ void MDBoxFlatTree::saveWSGenericInfo(::NeXus::File *const file,
// Write out the Qconvention // Write out the Qconvention
// ki-kf for Inelastic convention; kf-ki for Crystallography convention // ki-kf for Inelastic convention; kf-ki for Crystallography convention
std::string m_QConvention = std::string m_QConvention =
Kernel::ConfigService::Instance().getString("Q.convention"); ws->getConvention();
file->putAttr("QConvention", m_QConvention); file->putAttr("QConvention", m_QConvention);
// Write out the set display normalization // Write out the set display normalization
......
...@@ -127,6 +127,11 @@ void PeaksWorkspace::sort(std::vector<std::pair<std::string, bool>> &criteria) { ...@@ -127,6 +127,11 @@ void PeaksWorkspace::sort(std::vector<std::pair<std::string, bool>> &criteria) {
*/ */
int PeaksWorkspace::getNumberPeaks() const { return int(peaks.size()); } int PeaksWorkspace::getNumberPeaks() const { return int(peaks.size()); }
//---------------------------------------------------------------------------------------------
/** @return the convention
*/
std::string PeaksWorkspace::getConvention() const { return convention; }
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
/** Removes the indicated peak /** Removes the indicated peak
* @param peakNum the peak to remove. peakNum starts at 0 * @param peakNum the peak to remove. peakNum starts at 0
...@@ -608,8 +613,7 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const { ...@@ -608,8 +613,7 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
// HKL is flipped by -1 due to different q convention in Crystallography. // HKL is flipped by -1 due to different q convention in Crystallography.
// Always write out in ki-kf so consistent with old files // Always write out in ki-kf so consistent with old files
double qSign = 1.0; double qSign = 1.0;
std::string convention = ConfigService::Instance().getString("Q.convention"); if (this->getConvention() == "Crystallography")
if (convention == "Crystallography")
qSign = -1.0; qSign = -1.0;
// Populate column vectors from Peak Workspace // Populate column vectors from Peak Workspace
......
Supports Markdown
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