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