From 22498fd616aedce06ac8ba783dff223803b67aa4 Mon Sep 17 00:00:00 2001 From: Marina Ganeva Date: Tue, 27 May 2014 12:50:10 +0200 Subject: [PATCH 001/130] DarwinSetup.cmake is changed to use third party libraries also for mavericks. --- Code/Mantid/Build/CMake/DarwinSetup.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Mantid/Build/CMake/DarwinSetup.cmake b/Code/Mantid/Build/CMake/DarwinSetup.cmake index 88c3254dd594..94a5bf623626 100644 --- a/Code/Mantid/Build/CMake/DarwinSetup.cmake +++ b/Code/Mantid/Build/CMake/DarwinSetup.cmake @@ -43,7 +43,7 @@ message (STATUS "Operating System: Mac OS X ${OSX_VERSION} (${OSX_CODENAME})") ########################################################################### # Only use Third_Party for OS X older than Mavericks (10.9) -if (OSX_VERSION VERSION_LESS 10.9) +#if (OSX_VERSION VERSION_LESS 10.9) message ( STATUS "Using Third_Party.") set ( CMAKE_INCLUDE_PATH "${THIRD_PARTY}/include" ) @@ -51,9 +51,9 @@ if (OSX_VERSION VERSION_LESS 10.9) set ( CMAKE_LIBRARY_PATH "${THIRD_PARTY}/lib/mac64" ) set ( BOOST_LIBRARYDIR "${THIRD_PARTY}/lib/mac64" ) -else() - message ( STATUS "OS X Mavericks - Not using Mantid Third_Party libraries.") -endif() +#else() +# message ( STATUS "OS X Mavericks - Not using Mantid Third_Party libraries.") +#endif() # Enable the use of the -isystem flag to mark headers in Third_Party as system headers set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") From e4f146f5dae99c15f1326b27d45e5d8f924169be Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Mon, 27 Oct 2014 16:12:02 +0100 Subject: [PATCH 002/130] Refs #10263. Fixing constness in PoldiFitPeaks1D --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h | 24 ++++++++---------- .../Framework/SINQ/src/PoldiFitPeaks1D.cpp | 25 +++++++++++-------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h index 5d98b439e0c6..8139c5d3f33f 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h @@ -15,7 +15,6 @@ namespace Mantid { namespace Poldi { - /** PoldiFitPeaks1D : PoldiFitPeaks1D fits multiple peaks to POLDI auto-correlation data. @@ -43,7 +42,6 @@ namespace Poldi File change history is stored at: Code Documentation is available at: */ - class MANTID_SINQ_DLL PoldiFitPeaks1D : public API::Algorithm { public: @@ -58,21 +56,21 @@ namespace Poldi virtual const std::string category() const; protected: - void setPeakFunction(std::string peakFunction); - PoldiPeakCollection_sptr getInitializedPeakCollection(DataObjects::TableWorkspace_sptr peakTable); + void setPeakFunction(const std::string &peakFunction); + PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; - API::IFunction_sptr getPeakProfile(PoldiPeak_sptr poldiPeak); - void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, API::IFunction_sptr fittedFunction); - double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction); + API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; + void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; + double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; - API::IAlgorithm_sptr getFitAlgorithm(DataObjects::Workspace2D_sptr dataWorkspace, PoldiPeak_sptr peak, API::IFunction_sptr profile); + API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const API::IFunction_sptr &profile); - void addPeakFitCharacteristics(API::ITableWorkspace_sptr fitResult); - void initializeFitResultWorkspace(API::ITableWorkspace_sptr fitResult); + void addPeakFitCharacteristics(const API::ITableWorkspace_sptr &fitResult); + void initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult); - void initializePeakResultWorkspace(DataObjects::TableWorkspace_sptr peakResultWorkspace); - void storePeakResult(API::TableRow tableRow, PoldiPeak_sptr peak); - DataObjects::TableWorkspace_sptr generateResultTable(PoldiPeakCollection_sptr peaks); + void initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const; + void storePeakResult(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; + DataObjects::TableWorkspace_sptr generateResultTable(const PoldiPeakCollection_sptr &peaks) const; PoldiPeakCollection_sptr m_peaks; std::string m_profileTemplate; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp index cd8bf265e42e..f34124fdfeaf 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp @@ -78,12 +78,12 @@ void PoldiFitPeaks1D::init() m_profileTies = "f1.x0 = f0.PeakCentre"; } -void PoldiFitPeaks1D::setPeakFunction(std::string peakFunction) +void PoldiFitPeaks1D::setPeakFunction(const std::string &peakFunction) { m_profileTemplate = peakFunction; } -PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(TableWorkspace_sptr peakTable) +PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const { PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); peakCollection->setProfileFunctionName(m_profileTemplate); @@ -91,7 +91,7 @@ PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(TableWork return peakCollection; } -IFunction_sptr PoldiFitPeaks1D::getPeakProfile(PoldiPeak_sptr poldiPeak) { +IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); clonedProfile->setCentre(poldiPeak->q()); clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); @@ -111,7 +111,7 @@ IFunction_sptr PoldiFitPeaks1D::getPeakProfile(PoldiPeak_sptr poldiPeak) { return totalProfile; } -void PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, IFunction_sptr fittedFunction) +void PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const { CompositeFunction_sptr totalFunction = boost::dynamic_pointer_cast(fittedFunction); @@ -126,7 +126,7 @@ void PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, IFu } } -double PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) +double PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) const { return peakFunction->fwhm() / peakFunction->getParameter(2); } @@ -142,6 +142,7 @@ void PoldiFitPeaks1D::exec() TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); m_peaks = getInitializedPeakCollection(poldiPeakTable); + g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); @@ -149,6 +150,8 @@ void PoldiFitPeaks1D::exec() m_fitCharacteristics = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); + + for(size_t i = 0; i < m_peaks->peakCount(); ++i) { PoldiPeak_sptr currentPeak = m_peaks->peak(i); IFunction_sptr currentProfile = getPeakProfile(currentPeak); @@ -174,7 +177,7 @@ void PoldiFitPeaks1D::exec() setProperty("FitPlotsWorkspace", fitPlotGroup); } -IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(Workspace2D_sptr dataWorkspace, PoldiPeak_sptr peak, IFunction_sptr profile) +IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const IFunction_sptr &profile) { double width = peak->fwhm(); double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples; @@ -194,7 +197,7 @@ IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(Workspace2D_sptr dataWorkspace, return fitAlgorithm; } -void PoldiFitPeaks1D::addPeakFitCharacteristics(ITableWorkspace_sptr fitResult) +void PoldiFitPeaks1D::addPeakFitCharacteristics(const ITableWorkspace_sptr &fitResult) { if(m_fitCharacteristics->columnCount() == 0) { initializeFitResultWorkspace(fitResult); @@ -209,7 +212,7 @@ void PoldiFitPeaks1D::addPeakFitCharacteristics(ITableWorkspace_sptr fitResult) } } -void PoldiFitPeaks1D::initializeFitResultWorkspace(ITableWorkspace_sptr fitResult) +void PoldiFitPeaks1D::initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult) { for(size_t i = 0; i < fitResult->rowCount(); ++i) { TableRow currentRow = fitResult->getRow(i); @@ -217,7 +220,7 @@ void PoldiFitPeaks1D::initializeFitResultWorkspace(ITableWorkspace_sptr fitResul } } -void PoldiFitPeaks1D::initializePeakResultWorkspace(TableWorkspace_sptr peakResultWorkspace) +void PoldiFitPeaks1D::initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const { peakResultWorkspace->addColumn("str", "Q"); peakResultWorkspace->addColumn("str", "d"); @@ -226,7 +229,7 @@ void PoldiFitPeaks1D::initializePeakResultWorkspace(TableWorkspace_sptr peakResu peakResultWorkspace->addColumn("str", "Intensity"); } -void PoldiFitPeaks1D::storePeakResult(TableRow tableRow, PoldiPeak_sptr peak) +void PoldiFitPeaks1D::storePeakResult(TableRow tableRow, const PoldiPeak_sptr &peak) const { UncertainValue q = peak->q(); UncertainValue d = peak->d(); @@ -238,7 +241,7 @@ void PoldiFitPeaks1D::storePeakResult(TableRow tableRow, PoldiPeak_sptr peak) << UncertainValueIO::toString(peak->intensity()); } -TableWorkspace_sptr PoldiFitPeaks1D::generateResultTable(PoldiPeakCollection_sptr peaks) +TableWorkspace_sptr PoldiFitPeaks1D::generateResultTable(const PoldiPeakCollection_sptr &peaks) const { TableWorkspace_sptr outputTable = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); initializePeakResultWorkspace(outputTable); From 3c3dec4f1e04e91387ed668a3e7a56b02abd0434 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Mon, 27 Oct 2014 17:32:08 +0100 Subject: [PATCH 003/130] Refs #10263. Added RefinedRanges helper --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h | 28 ++++++ .../Framework/SINQ/src/PoldiFitPeaks1D.cpp | 98 ++++++++++++++++++- 2 files changed, 123 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h index 8139c5d3f33f..581c8041a285 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h @@ -15,6 +15,29 @@ namespace Mantid { namespace Poldi { + /// Helper class for refining peaks with overlapping ranges + class RefinedRange + { + public: + RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples); + RefinedRange(double xStart, double xEnd, const std::vector &peaks); + + bool operator <(const RefinedRange &other) const; + + bool overlaps(const RefinedRange &other) const; + RefinedRange merged(const RefinedRange &other) const; + + const std::vector getPeaks() const { return m_peaks; } + + double getXStart() const { return m_xStart; } + double getXEnd() const { return m_xEnd; } + + private: + std::vector m_peaks; + double m_xStart; + double m_xEnd; + }; + /** PoldiFitPeaks1D : PoldiFitPeaks1D fits multiple peaks to POLDI auto-correlation data. @@ -59,6 +82,11 @@ namespace Poldi void setPeakFunction(const std::string &peakFunction); PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; + std::vector getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; + std::vector getReducedRanges(const std::vector &ranges) const; + bool hasOverlappingRanges(const std::vector &ranges) const; + + API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp index f34124fdfeaf..5c1c1f67d5fd 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp @@ -26,6 +26,47 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +RefinedRange::RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples) : + m_peaks(1, peak) +{ + double width = peak->fwhm(); + double extent = std::min(0.05, std::max(0.002, width)) * fwhmMultiples; + + m_xStart = peak->q() - extent; + m_xEnd = peak->q() + extent; +} + +RefinedRange::RefinedRange(double xStart, double xEnd, const std::vector &peaks) : + m_peaks(peaks), + m_xStart(xStart), + m_xEnd(xEnd) +{ +} + +bool RefinedRange::operator <(const RefinedRange &other) const +{ + return m_xStart < other.m_xStart; +} + +bool RefinedRange::overlaps(const RefinedRange &other) const +{ + return (other.m_xStart > m_xStart && other.m_xStart < m_xEnd) + || (other.m_xEnd > m_xStart && other.m_xEnd < m_xEnd) + || (other.m_xStart < m_xStart && other.m_xEnd > m_xEnd); +} + +RefinedRange RefinedRange::merged(const RefinedRange &other) const +{ + std::vector mergedPeaks(m_peaks); + mergedPeaks.insert(mergedPeaks.end(), other.m_peaks.begin(), other.m_peaks.end()); + + double mergedXStart = std::min(m_xStart, other.m_xStart); + double mergedXEnd = std::max(m_xEnd, other.m_xEnd); + + return RefinedRange(mergedXStart, mergedXEnd, mergedPeaks); +} + + // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(PoldiFitPeaks1D) @@ -91,6 +132,55 @@ PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(const Dat return peakCollection; } +std::vector PoldiFitPeaks1D::getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const +{ + std::vector ranges; + for(size_t i = 0; i < peaks->peakCount(); ++i) { + ranges.push_back(RefinedRange(peaks->peak(i), m_fwhmMultiples)); + } + + return ranges; +} + +std::vector PoldiFitPeaks1D::getReducedRanges(const std::vector &ranges) const +{ + std::vector workingRanges(ranges); + std::sort(workingRanges.begin(), workingRanges.end()); + + if(!hasOverlappingRanges(workingRanges)) { + return ranges; + } + + std::vector reducedRanges; + + size_t i = 0; + while(i < (workingRanges.size() - 1) ) { + RefinedRange current = workingRanges[i]; + RefinedRange next = workingRanges[i + 1]; + + if(!current.overlaps(next)) { + reducedRanges.push_back(current); + i += 1; + } else { + reducedRanges.push_back(current.merged(next)); + i += 2; + } + } + + return getReducedRanges(reducedRanges); +} + +bool PoldiFitPeaks1D::hasOverlappingRanges(const std::vector &ranges) const +{ + for(size_t i = 0; i < ranges.size() - 1; ++i) { + if(ranges[i].overlaps(ranges[i+1])) { + return true; + } + } + + return false; +} + IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); clonedProfile->setCentre(poldiPeak->q()); @@ -142,16 +232,18 @@ void PoldiFitPeaks1D::exec() TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); m_peaks = getInitializedPeakCollection(poldiPeakTable); - g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; + std::vector rawRanges = getRefinedRanges(m_peaks); + std::vector reducedRanges = getReducedRanges(rawRanges); + + g_log.information() << "Ranges used for fitting: " << reducedRanges.size() << std::endl; + Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); m_fitCharacteristics = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); - - for(size_t i = 0; i < m_peaks->peakCount(); ++i) { PoldiPeak_sptr currentPeak = m_peaks->peak(i); IFunction_sptr currentProfile = getPeakProfile(currentPeak); From eea77dcd04c308c97ab49e583183405ba84b40eb Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Tue, 28 Oct 2014 10:23:27 +0100 Subject: [PATCH 004/130] Refs #10263. Changed ranges definition and reducing algorithm --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h | 13 ++-- .../Framework/SINQ/src/PoldiFitPeaks1D.cpp | 74 +++++++++---------- 2 files changed, 42 insertions(+), 45 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h index 581c8041a285..cd3345a4964a 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h @@ -21,11 +21,12 @@ namespace Poldi public: RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples); RefinedRange(double xStart, double xEnd, const std::vector &peaks); + RefinedRange(const RefinedRange &other); bool operator <(const RefinedRange &other) const; bool overlaps(const RefinedRange &other) const; - RefinedRange merged(const RefinedRange &other) const; + void merge(const RefinedRange &other); const std::vector getPeaks() const { return m_peaks; } @@ -38,6 +39,10 @@ namespace Poldi double m_xEnd; }; + typedef boost::shared_ptr RefinedRange_sptr; + + bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs); + /** PoldiFitPeaks1D : PoldiFitPeaks1D fits multiple peaks to POLDI auto-correlation data. @@ -82,10 +87,8 @@ namespace Poldi void setPeakFunction(const std::string &peakFunction); PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; - std::vector getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; - std::vector getReducedRanges(const std::vector &ranges) const; - bool hasOverlappingRanges(const std::vector &ranges) const; - + std::vector getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; + std::vector getReducedRanges(const std::vector &ranges) const; API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp index 5c1c1f67d5fd..287ab97fc850 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp @@ -14,6 +14,7 @@ #include "MantidSINQ/PoldiUtilities/UncertainValueIO.h" #include "MantidAPI/CompositeFunction.h" +#include namespace Mantid @@ -43,6 +44,14 @@ RefinedRange::RefinedRange(double xStart, double xEnd, const std::vector m_xEnd); } -RefinedRange RefinedRange::merged(const RefinedRange &other) const +void RefinedRange::merge(const RefinedRange &other) { - std::vector mergedPeaks(m_peaks); - mergedPeaks.insert(mergedPeaks.end(), other.m_peaks.begin(), other.m_peaks.end()); + m_peaks.insert(m_peaks.end(), other.m_peaks.begin(), other.m_peaks.end()); - double mergedXStart = std::min(m_xStart, other.m_xStart); - double mergedXEnd = std::max(m_xEnd, other.m_xEnd); + m_xStart = std::min(m_xStart, other.m_xStart); + m_xEnd = std::max(m_xEnd, other.m_xEnd); +} - return RefinedRange(mergedXStart, mergedXEnd, mergedPeaks); +bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs) +{ + return (*lhs) < (*rhs); } + // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(PoldiFitPeaks1D) @@ -132,53 +144,36 @@ PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(const Dat return peakCollection; } -std::vector PoldiFitPeaks1D::getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const +std::vector PoldiFitPeaks1D::getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const { - std::vector ranges; + std::vector ranges; for(size_t i = 0; i < peaks->peakCount(); ++i) { - ranges.push_back(RefinedRange(peaks->peak(i), m_fwhmMultiples)); + ranges.push_back(boost::make_shared(peaks->peak(i), m_fwhmMultiples)); } return ranges; } -std::vector PoldiFitPeaks1D::getReducedRanges(const std::vector &ranges) const +std::vector PoldiFitPeaks1D::getReducedRanges(const std::vector &ranges) const { - std::vector workingRanges(ranges); + std::vector workingRanges(ranges); std::sort(workingRanges.begin(), workingRanges.end()); - if(!hasOverlappingRanges(workingRanges)) { - return ranges; - } - - std::vector reducedRanges; + std::vector reducedRanges; + reducedRanges.push_back(boost::make_shared(*(workingRanges.front()))); - size_t i = 0; - while(i < (workingRanges.size() - 1) ) { - RefinedRange current = workingRanges[i]; - RefinedRange next = workingRanges[i + 1]; + for(size_t i = 1; i < workingRanges.size(); ++i) { + RefinedRange_sptr lastReduced = reducedRanges.back(); + RefinedRange_sptr current = workingRanges[i]; - if(!current.overlaps(next)) { - reducedRanges.push_back(current); - i += 1; + if(!lastReduced->overlaps(*current)) { + reducedRanges.push_back(boost::make_shared(*current)); } else { - reducedRanges.push_back(current.merged(next)); - i += 2; - } - } - - return getReducedRanges(reducedRanges); -} - -bool PoldiFitPeaks1D::hasOverlappingRanges(const std::vector &ranges) const -{ - for(size_t i = 0; i < ranges.size() - 1; ++i) { - if(ranges[i].overlaps(ranges[i+1])) { - return true; + lastReduced->merge(*current); } } - return false; + return reducedRanges; } IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { @@ -234,8 +229,8 @@ void PoldiFitPeaks1D::exec() g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; - std::vector rawRanges = getRefinedRanges(m_peaks); - std::vector reducedRanges = getReducedRanges(rawRanges); + std::vector rawRanges = getRefinedRanges(m_peaks); + std::vector reducedRanges = getReducedRanges(rawRanges); g_log.information() << "Ranges used for fitting: " << reducedRanges.size() << std::endl; @@ -345,6 +340,5 @@ TableWorkspace_sptr PoldiFitPeaks1D::generateResultTable(const PoldiPeakCollecti return outputTable; } - } // namespace Poldi } // namespace Mantid From 9e04b3305dc166d8f66442c9851f8f366575c639 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 26 Nov 2014 17:13:22 +0100 Subject: [PATCH 005/130] Refs #10623. Changed PoldiFitPeaks1D The algorithm now tries to find out which Chebyshev-polynomial (as background) gives the best fit. --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h | 18 +- .../Framework/SINQ/src/PoldiFitPeaks1D.cpp | 216 +++++++++++------- .../Framework/SINQ/test/PoldiFitPeaks1DTest.h | 14 +- 3 files changed, 144 insertions(+), 104 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h index cd3345a4964a..597cd9483211 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h @@ -84,20 +84,25 @@ namespace Poldi virtual const std::string category() const; protected: + PoldiPeakCollection_sptr fitPeaks(const PoldiPeakCollection_sptr &peaks); + + int getBestChebyshevPolynomialDegree(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range); + + PoldiPeakCollection_sptr getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const; + bool peakIsAcceptable(const PoldiPeak_sptr &peak) const; + void setPeakFunction(const std::string &peakFunction); PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; std::vector getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; std::vector getReducedRanges(const std::vector &ranges) const; + API::IFunction_sptr getRangeProfile(const RefinedRange_sptr &range, int n) const; API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; - API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const API::IFunction_sptr &profile); - - void addPeakFitCharacteristics(const API::ITableWorkspace_sptr &fitResult); - void initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult); + API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n); void initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const; void storePeakResult(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; @@ -105,11 +110,10 @@ namespace Poldi PoldiPeakCollection_sptr m_peaks; std::string m_profileTemplate; - API::IFunction_sptr m_backgroundTemplate; - std::string m_profileTies; - DataObjects::TableWorkspace_sptr m_fitCharacteristics; DataObjects::TableWorkspace_sptr m_peakResultOutput; + API::WorkspaceGroup_sptr m_fitplots; + double m_fwhmMultiples; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp index 287ab97fc850..285ca938093b 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp @@ -16,22 +16,25 @@ #include "MantidAPI/CompositeFunction.h" #include +#include +#include + namespace Mantid { namespace Poldi { -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::DataObjects; -using namespace Mantid::CurveFitting; +using namespace Kernel; +using namespace API; +using namespace DataObjects; +using namespace CurveFitting; RefinedRange::RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples) : m_peaks(1, peak) { double width = peak->fwhm(); - double extent = std::min(0.05, std::max(0.002, width)) * fwhmMultiples; + double extent = std::max(0.002, width) * fwhmMultiples; m_xStart = peak->q() - extent; m_xEnd = peak->q() + extent; @@ -86,10 +89,8 @@ DECLARE_ALGORITHM(PoldiFitPeaks1D) PoldiFitPeaks1D::PoldiFitPeaks1D() : m_peaks(), m_profileTemplate(), - m_backgroundTemplate(), - m_profileTies(), - m_fitCharacteristics(), m_peakResultOutput(), + m_fitplots(new WorkspaceGroup), m_fwhmMultiples(1.0) { @@ -124,11 +125,7 @@ void PoldiFitPeaks1D::init() declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); declareProperty(new WorkspaceProperty("ResultTableWorkspace","ResultTable",Direction::Output), "Fit results."); - declareProperty(new WorkspaceProperty("FitCharacteristicsWorkspace","FitCharacteristics",Direction::Output), "Fit characteristics for each peak."); declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); - - m_backgroundTemplate = FunctionFactory::Instance().createInitialized("name=UserFunction, Formula=A0 + A1*(x - x0)^2"); - m_profileTies = "f1.x0 = f0.PeakCentre"; } void PoldiFitPeaks1D::setPeakFunction(const std::string &peakFunction) @@ -176,38 +173,40 @@ std::vector PoldiFitPeaks1D::getReducedRanges(const std::vect return reducedRanges; } -IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { - IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); - clonedProfile->setCentre(poldiPeak->q()); - clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); - clonedProfile->setHeight(poldiPeak->intensity()); - - IFunction_sptr clonedBackground = m_backgroundTemplate->clone(); - +API::IFunction_sptr PoldiFitPeaks1D::getRangeProfile(const RefinedRange_sptr &range, int n) const +{ CompositeFunction_sptr totalProfile(new CompositeFunction); totalProfile->initialize(); - totalProfile->addFunction(clonedProfile); - totalProfile->addFunction(clonedBackground); - if(!m_profileTies.empty()) { - totalProfile->addTies(m_profileTies); + std::vector peaks = range->getPeaks(); + for(auto it = peaks.begin(); it != peaks.end(); ++it) { + totalProfile->addFunction(getPeakProfile(*it)); } + totalProfile->addFunction(FunctionFactory::Instance().createInitialized("name=Chebyshev,n=" + boost::lexical_cast(n) + + ",StartX=" + boost::lexical_cast(range->getXStart()) + + ",EndX=" + boost::lexical_cast(range->getXEnd()))); + return totalProfile; } +IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { + IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); + clonedProfile->setCentre(poldiPeak->q()); + clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); + clonedProfile->setHeight(poldiPeak->intensity()); + + return clonedProfile; +} + void PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const { - CompositeFunction_sptr totalFunction = boost::dynamic_pointer_cast(fittedFunction); - - if(totalFunction) { - IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(totalFunction->getFunction(0)); + IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(fittedFunction); - if(peakFunction) { - poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); - poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); - poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); - } + if(peakFunction) { + poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); + poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); + poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); } } @@ -216,95 +215,138 @@ double PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) co return peakFunction->fwhm() / peakFunction->getParameter(2); } -void PoldiFitPeaks1D::exec() +PoldiPeakCollection_sptr PoldiFitPeaks1D::fitPeaks(const PoldiPeakCollection_sptr &peaks) { - setPeakFunction(getProperty("PeakFunction")); - - // Number of points around the peak center to use for the fit - m_fwhmMultiples = getProperty("FwhmMultiples"); - - // try to construct PoldiPeakCollection from provided TableWorkspace - TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); - m_peaks = getInitializedPeakCollection(poldiPeakTable); + g_log.information() << "Peaks to fit: " << peaks->peakCount() << std::endl; - g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; - - std::vector rawRanges = getRefinedRanges(m_peaks); + std::vector rawRanges = getRefinedRanges(peaks); std::vector reducedRanges = getReducedRanges(rawRanges); g_log.information() << "Ranges used for fitting: " << reducedRanges.size() << std::endl; Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); + m_fitplots->removeAll(); + + for(size_t i = 0; i < reducedRanges.size(); ++i) { + RefinedRange_sptr currentRange = reducedRanges[i]; + int nMin = getBestChebyshevPolynomialDegree(dataWorkspace, currentRange); + + if(nMin > -1) { + IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentRange, nMin); + fit->execute(); + + IFunction_sptr fitFunction = fit->getProperty("Function"); + CompositeFunction_sptr composite = boost::dynamic_pointer_cast(fitFunction); + + if(!composite) { + throw std::runtime_error("Not a composite function!"); + } - m_fitCharacteristics = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); - WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); + std::vector peaks = currentRange->getPeaks(); + for(size_t i = 0; i < peaks.size(); ++i) { + setValuesFromProfileFunction(peaks[i], composite->getFunction(i)); + MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); + m_fitplots->addWorkspace(fpg); + } + } + } - for(size_t i = 0; i < m_peaks->peakCount(); ++i) { - PoldiPeak_sptr currentPeak = m_peaks->peak(i); - IFunction_sptr currentProfile = getPeakProfile(currentPeak); + return getReducedPeakCollection(peaks); +} - IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentPeak, currentProfile); +int PoldiFitPeaks1D::getBestChebyshevPolynomialDegree(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range) +{ + int n = 0; + double chiSquareMin = 1e10; + int nMin = -1; + while((n < 3)) { + IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, range, n); bool fitSuccess = fit->execute(); if(fitSuccess) { - setValuesFromProfileFunction(currentPeak, fit->getProperty("Function")); - addPeakFitCharacteristics(fit->getProperty("OutputParameters")); + ITableWorkspace_sptr fitCharacteristics = fit->getProperty("OutputParameters"); + TableRow row = fitCharacteristics->getRow(fitCharacteristics->rowCount() - 1); + + double chiSquare = row.Double(1); - MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); - fitPlotGroup->addWorkspace(fpg); + + if(fabs(chiSquare - 1) < fabs(chiSquareMin - 1)) { + chiSquareMin = chiSquare; + nMin = n; + } } + + ++n; } - m_peakResultOutput = generateResultTable(m_peaks); + g_log.information() << "Chi^2 for range [" << range->getXStart() << " - " << range->getXEnd() << "] is minimal at n = " << nMin << " with Chi^2 = " << chiSquareMin << std::endl; - setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("FitCharacteristicsWorkspace", m_fitCharacteristics); - setProperty("ResultTableWorkspace", m_peakResultOutput); - setProperty("FitPlotsWorkspace", fitPlotGroup); + return nMin; } -IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const IFunction_sptr &profile) +PoldiPeakCollection_sptr PoldiFitPeaks1D::getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const { - double width = peak->fwhm(); - double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples; + PoldiPeakCollection_sptr reducedPeaks = boost::make_shared(); + reducedPeaks->setProfileFunctionName(peaks->getProfileFunctionName()); - std::pair xBorders(peak->q() - extent, peak->q() + extent); + for(size_t i = 0; i < peaks->peakCount(); ++i) { + PoldiPeak_sptr currentPeak = peaks->peak(i); - IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); - fitAlgorithm->setProperty("CreateOutput", true); - fitAlgorithm->setProperty("Output", "FitPeaks1D"); - fitAlgorithm->setProperty("CalcErrors", true); - fitAlgorithm->setProperty("Function", profile); - fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); - fitAlgorithm->setProperty("WorkspaceIndex", 0); - fitAlgorithm->setProperty("StartX", xBorders.first); - fitAlgorithm->setProperty("EndX", xBorders.second); + if(peakIsAcceptable(currentPeak)) { + reducedPeaks->addPeak(currentPeak); + } + } - return fitAlgorithm; + return reducedPeaks; } -void PoldiFitPeaks1D::addPeakFitCharacteristics(const ITableWorkspace_sptr &fitResult) +bool PoldiFitPeaks1D::peakIsAcceptable(const PoldiPeak_sptr &peak) const { - if(m_fitCharacteristics->columnCount() == 0) { - initializeFitResultWorkspace(fitResult); - } + return peak->intensity() > 0 && peak->fwhm(PoldiPeak::Relative) < 0.02; +} + +void PoldiFitPeaks1D::exec() +{ + setPeakFunction(getProperty("PeakFunction")); - TableRow newRow = m_fitCharacteristics->appendRow(); + // Number of points around the peak center to use for the fit + m_fwhmMultiples = getProperty("FwhmMultiples"); - for(size_t i = 0; i < fitResult->rowCount(); ++i) { - TableRow currentRow = fitResult->getRow(i); + // try to construct PoldiPeakCollection from provided TableWorkspace + TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); + m_peaks = getInitializedPeakCollection(poldiPeakTable); - newRow << UncertainValueIO::toString(UncertainValue(currentRow.Double(1), currentRow.Double(2))); + PoldiPeakCollection_sptr fittedPeaksNew = fitPeaks(m_peaks); + PoldiPeakCollection_sptr fittedPeaksOld = m_peaks; + while(fittedPeaksNew->peakCount() < fittedPeaksOld->peakCount()) { + fittedPeaksOld = fittedPeaksNew; + fittedPeaksNew = fitPeaks(fittedPeaksOld); } + + m_peakResultOutput = generateResultTable(fittedPeaksNew); + + setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); + setProperty("ResultTableWorkspace", m_peakResultOutput); + setProperty("FitPlotsWorkspace", m_fitplots); } -void PoldiFitPeaks1D::initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult) +IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n) { - for(size_t i = 0; i < fitResult->rowCount(); ++i) { - TableRow currentRow = fitResult->getRow(i); - m_fitCharacteristics->addColumn("str", currentRow.cell(0)); - } + IFunction_sptr rangeProfile = getRangeProfile(range, n); + + IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); + fitAlgorithm->setProperty("CreateOutput", true); + fitAlgorithm->setProperty("Output", "FitPeaks1D"); + fitAlgorithm->setProperty("CalcErrors", true); + fitAlgorithm->setProperty("OutputCompositeMembers", true); + fitAlgorithm->setProperty("Function", rangeProfile); + fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); + fitAlgorithm->setProperty("WorkspaceIndex", 0); + fitAlgorithm->setProperty("StartX", range->getXStart()); + fitAlgorithm->setProperty("EndX", range->getXEnd()); + + return fitAlgorithm; } void PoldiFitPeaks1D::initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const diff --git a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h index 9750e9fca2ea..dbf599db07bd 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h @@ -59,18 +59,13 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite void testGetPeakProfile() { TestablePoldiFitPeaks1D poldiFitPeaks; - poldiFitPeaks.m_backgroundTemplate = m_backgroundTestFunction; poldiFitPeaks.initialize(); poldiFitPeaks.setPeakFunction(m_profileTestFunction); - IFunction_sptr totalProfile = poldiFitPeaks.getPeakProfile(m_testPeak); - - // make sure that we get back a composite of peak and background - CompositeFunction_sptr composite = boost::dynamic_pointer_cast(totalProfile); - TS_ASSERT(composite); + IFunction_sptr peakFunction = poldiFitPeaks.getPeakProfile(m_testPeak); - // make sure that the profile is the first function in the composite - IPeakFunction_sptr profile = boost::dynamic_pointer_cast(composite->getFunction(0)); + // make sure that the profile is correct + IPeakFunction_sptr profile = boost::dynamic_pointer_cast(peakFunction); TS_ASSERT(profile); TS_ASSERT_EQUALS(profile->centre(), m_testPeak->q()); @@ -100,7 +95,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite Mantid::Poldi::PoldiFitPeaks1D fitPeaks1D; fitPeaks1D.initialize(); - TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 8); + TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 7); std::vector properties = fitPeaks1D.getProperties(); std::set names; @@ -115,7 +110,6 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(names.count("PoldiPeakTable"), 1); TS_ASSERT_EQUALS(names.count("OutputWorkspace"), 1); TS_ASSERT_EQUALS(names.count("ResultTableWorkspace"), 1); - TS_ASSERT_EQUALS(names.count("FitCharacteristicsWorkspace"), 1); TS_ASSERT_EQUALS(names.count("FitPlotsWorkspace"), 1); } From 09301a40ad43382266a1801547263e0ab374121e Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 10:01:00 +0100 Subject: [PATCH 006/130] Refs #10263. Moving modified algorithm. Since the old algorithm should be preserved, the new one is moved to a new set of files which --- Code/Mantid/Framework/SINQ/CMakeLists.txt | 3 + .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h | 129 ++++++ .../Framework/SINQ/src/PoldiFitPeaks1D2.cpp | 386 ++++++++++++++++++ .../SINQ/test/PoldiFitPeaks1D2Test.h | 123 ++++++ 4 files changed, 641 insertions(+) create mode 100644 Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h create mode 100644 Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp create mode 100644 Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt b/Code/Mantid/Framework/SINQ/CMakeLists.txt index 1bf54624b59a..470abd6db4d5 100644 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/CMakeLists.txt @@ -5,6 +5,7 @@ set ( SRC_FILES src/PoldiAutoCorrelation5.cpp src/PoldiCalculateSpectrum2D.cpp src/PoldiFitPeaks1D.cpp + src/PoldiFitPeaks1D2.cpp src/PoldiLoadChopperSlits.cpp src/PoldiLoadIPP.cpp src/PoldiLoadLog.cpp @@ -47,6 +48,7 @@ set ( INC_FILES inc/MantidSINQ/PoldiAutoCorrelation5.h inc/MantidSINQ/PoldiCalculateSpectrum2D.h inc/MantidSINQ/PoldiFitPeaks1D.h + inc/MantidSINQ/PoldiFitPeaks1D2.h inc/MantidSINQ/PoldiLoadChopperSlits.h inc/MantidSINQ/PoldiLoadIPP.h inc/MantidSINQ/PoldiLoadLog.h @@ -104,6 +106,7 @@ set ( TEST_FILES PoldiDetectorFactoryTest.h PoldiDetectorTest.h PoldiFitPeaks1DTest.h + PoldiFitPeaks1D2Test.h PoldiInstrumentAdapterTest.h PoldiPeakCollectionTest.h PoldiPeakSearchTest.h diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h new file mode 100644 index 000000000000..cb084c52797c --- /dev/null +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h @@ -0,0 +1,129 @@ +#ifndef MANTID_SINQ_POLDIFITPEAKS1D2_H_ +#define MANTID_SINQ_POLDIFITPEAKS1D2_H_ + +#include "MantidKernel/System.h" +#include "MantidAPI/Algorithm.h" + +#include "MantidSINQ/DllConfig.h" +#include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" +#include "MantidAPI/IPeakFunction.h" +#include "MantidDataObjects/Workspace2D.h" +#include "MantidDataObjects/TableWorkspace.h" +#include "MantidAPI/TableRow.h" + +namespace Mantid +{ +namespace Poldi +{ + /// Helper class for refining peaks with overlapping ranges + class RefinedRange + { + public: + RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples); + RefinedRange(double xStart, double xEnd, const std::vector &peaks); + RefinedRange(const RefinedRange &other); + + bool operator <(const RefinedRange &other) const; + + bool overlaps(const RefinedRange &other) const; + void merge(const RefinedRange &other); + + const std::vector getPeaks() const { return m_peaks; } + + double getXStart() const { return m_xStart; } + double getXEnd() const { return m_xEnd; } + + private: + std::vector m_peaks; + double m_xStart; + double m_xEnd; + }; + + typedef boost::shared_ptr RefinedRange_sptr; + + bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs); + + /** PoldiFitPeaks1D2 : + + PoldiFitPeaks1D2 fits multiple peaks to POLDI auto-correlation data. + + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 17/03/2014 + + Copyright © 2014 PSI-MSS + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + File change history is stored at: + Code Documentation is available at: + */ + class MANTID_SINQ_DLL PoldiFitPeaks1D2 : public API::Algorithm + { + public: + PoldiFitPeaks1D2(); + virtual ~PoldiFitPeaks1D2(); + + virtual const std::string name() const; + ///Summary of algorithms purpose + virtual const std::string summary() const {return "PoldiPeakFit1D fits peak profiles to POLDI auto-correlation data.";} + + virtual int version() const; + virtual const std::string category() const; + + protected: + PoldiPeakCollection_sptr fitPeaks(const PoldiPeakCollection_sptr &peaks); + + int getBestChebyshevPolynomialDegree(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range); + + PoldiPeakCollection_sptr getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const; + bool peakIsAcceptable(const PoldiPeak_sptr &peak) const; + + void setPeakFunction(const std::string &peakFunction); + PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; + + std::vector getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; + std::vector getReducedRanges(const std::vector &ranges) const; + + API::IFunction_sptr getRangeProfile(const RefinedRange_sptr &range, int n) const; + API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; + void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; + double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; + + API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n); + + void initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const; + void storePeakResult(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; + DataObjects::TableWorkspace_sptr generateResultTable(const PoldiPeakCollection_sptr &peaks) const; + + PoldiPeakCollection_sptr m_peaks; + std::string m_profileTemplate; + + DataObjects::TableWorkspace_sptr m_peakResultOutput; + API::WorkspaceGroup_sptr m_fitplots; + + + double m_fwhmMultiples; + + private: + void init(); + void exec(); + }; + + +} // namespace Poldi +} // namespace Mantid + +#endif /* MANTID_SINQ_POLDIFITPEAKS1D2_H_ */ diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp new file mode 100644 index 000000000000..390dc0c78192 --- /dev/null +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -0,0 +1,386 @@ +#include "MantidAPI/WorkspaceProperty.h" +#include "MantidAPI/WorkspaceFactory.h" +#include "MantidAPI/WorkspaceGroup.h" + +#include "MantidSINQ/PoldiFitPeaks1D2.h" +#include "MantidDataObjects/Workspace2D.h" +#include "MantidDataObjects/TableWorkspace.h" +#include "MantidAPI/FunctionFactory.h" +#include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/ListValidator.h" +#include "MantidAPI/TableRow.h" + +#include "MantidSINQ/PoldiUtilities/UncertainValue.h" +#include "MantidSINQ/PoldiUtilities/UncertainValueIO.h" + +#include "MantidAPI/CompositeFunction.h" +#include + +#include +#include + + +namespace Mantid +{ +namespace Poldi +{ + +using namespace Kernel; +using namespace API; +using namespace DataObjects; +using namespace CurveFitting; + +RefinedRange::RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples) : + m_peaks(1, peak) +{ + double width = peak->fwhm(); + double extent = std::max(0.002, width) * fwhmMultiples; + + m_xStart = peak->q() - extent; + m_xEnd = peak->q() + extent; +} + +RefinedRange::RefinedRange(double xStart, double xEnd, const std::vector &peaks) : + m_peaks(peaks), + m_xStart(xStart), + m_xEnd(xEnd) +{ +} + +RefinedRange::RefinedRange(const RefinedRange &other) : + m_peaks(other.m_peaks), + m_xStart(other.m_xStart), + m_xEnd(other.m_xEnd) +{ + +} + +bool RefinedRange::operator <(const RefinedRange &other) const +{ + return m_xStart < other.m_xStart; +} + +bool RefinedRange::overlaps(const RefinedRange &other) const +{ + return (other.m_xStart > m_xStart && other.m_xStart < m_xEnd) + || (other.m_xEnd > m_xStart && other.m_xEnd < m_xEnd) + || (other.m_xStart < m_xStart && other.m_xEnd > m_xEnd); +} + +void RefinedRange::merge(const RefinedRange &other) +{ + m_peaks.insert(m_peaks.end(), other.m_peaks.begin(), other.m_peaks.end()); + + m_xStart = std::min(m_xStart, other.m_xStart); + m_xEnd = std::max(m_xEnd, other.m_xEnd); +} + +bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs) +{ + return (*lhs) < (*rhs); +} + + + +// Register the algorithm into the AlgorithmFactory +DECLARE_ALGORITHM(PoldiFitPeaks1D2) + + +PoldiFitPeaks1D2::PoldiFitPeaks1D2() : + m_peaks(), + m_profileTemplate(), + m_peakResultOutput(), + m_fitplots(new WorkspaceGroup), + m_fwhmMultiples(1.0) +{ + +} + +PoldiFitPeaks1D2::~PoldiFitPeaks1D2() +{ +} + + +/// Algorithm's name for identification. @see Algorithm::name +const std::string PoldiFitPeaks1D2::name() const { return "PoldiFitPeaks1D2";} + +/// Algorithm's version for identification. @see Algorithm::version +int PoldiFitPeaks1D2::version() const { return 2;} + +/// Algorithm's category for identification. @see Algorithm::category +const std::string PoldiFitPeaks1D2::category() const { return "SINQ\\Poldi"; } + +void PoldiFitPeaks1D2::init() +{ + declareProperty(new WorkspaceProperty("InputWorkspace","",Direction::Input), "An input workspace containing a POLDI auto-correlation spectrum."); + boost::shared_ptr > minFwhmPerDirection = boost::make_shared >(); + minFwhmPerDirection->setLower(2.0); + declareProperty("FwhmMultiples", 2.0, minFwhmPerDirection, "Each peak will be fitted using x times FWHM data in each direction.", Direction::Input); + + std::vector peakFunctions = FunctionFactory::Instance().getFunctionNames(); + boost::shared_ptr > peakFunctionNames(new ListValidator(peakFunctions)); + declareProperty("PeakFunction", "Gaussian", peakFunctionNames, "Peak function that will be fitted to all peaks.", Direction::Input); + + declareProperty(new WorkspaceProperty("PoldiPeakTable","",Direction::Input), "A table workspace containing POLDI peak data."); + + declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); + declareProperty(new WorkspaceProperty("ResultTableWorkspace","ResultTable",Direction::Output), "Fit results."); + declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); +} + +void PoldiFitPeaks1D2::setPeakFunction(const std::string &peakFunction) +{ + m_profileTemplate = peakFunction; +} + +PoldiPeakCollection_sptr PoldiFitPeaks1D2::getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const +{ + PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); + peakCollection->setProfileFunctionName(m_profileTemplate); + + return peakCollection; +} + +std::vector PoldiFitPeaks1D2::getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const +{ + std::vector ranges; + for(size_t i = 0; i < peaks->peakCount(); ++i) { + ranges.push_back(boost::make_shared(peaks->peak(i), m_fwhmMultiples)); + } + + return ranges; +} + +std::vector PoldiFitPeaks1D2::getReducedRanges(const std::vector &ranges) const +{ + std::vector workingRanges(ranges); + std::sort(workingRanges.begin(), workingRanges.end()); + + std::vector reducedRanges; + reducedRanges.push_back(boost::make_shared(*(workingRanges.front()))); + + for(size_t i = 1; i < workingRanges.size(); ++i) { + RefinedRange_sptr lastReduced = reducedRanges.back(); + RefinedRange_sptr current = workingRanges[i]; + + if(!lastReduced->overlaps(*current)) { + reducedRanges.push_back(boost::make_shared(*current)); + } else { + lastReduced->merge(*current); + } + } + + return reducedRanges; +} + +API::IFunction_sptr PoldiFitPeaks1D2::getRangeProfile(const RefinedRange_sptr &range, int n) const +{ + CompositeFunction_sptr totalProfile(new CompositeFunction); + totalProfile->initialize(); + + std::vector peaks = range->getPeaks(); + for(auto it = peaks.begin(); it != peaks.end(); ++it) { + totalProfile->addFunction(getPeakProfile(*it)); + } + + totalProfile->addFunction(FunctionFactory::Instance().createInitialized("name=Chebyshev,n=" + boost::lexical_cast(n) + + ",StartX=" + boost::lexical_cast(range->getXStart()) + + ",EndX=" + boost::lexical_cast(range->getXEnd()))); + + return totalProfile; +} + +IFunction_sptr PoldiFitPeaks1D2::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { + IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); + clonedProfile->setCentre(poldiPeak->q()); + clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); + clonedProfile->setHeight(poldiPeak->intensity()); + + return clonedProfile; +} + +void PoldiFitPeaks1D2::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const +{ + IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(fittedFunction); + + if(peakFunction) { + poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); + poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); + poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); + } +} + +double PoldiFitPeaks1D2::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) const +{ + return peakFunction->fwhm() / peakFunction->getParameter(2); +} + +PoldiPeakCollection_sptr PoldiFitPeaks1D2::fitPeaks(const PoldiPeakCollection_sptr &peaks) +{ + g_log.information() << "Peaks to fit: " << peaks->peakCount() << std::endl; + + std::vector rawRanges = getRefinedRanges(peaks); + std::vector reducedRanges = getReducedRanges(rawRanges); + + g_log.information() << "Ranges used for fitting: " << reducedRanges.size() << std::endl; + + Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); + m_fitplots->removeAll(); + + for(size_t i = 0; i < reducedRanges.size(); ++i) { + RefinedRange_sptr currentRange = reducedRanges[i]; + int nMin = getBestChebyshevPolynomialDegree(dataWorkspace, currentRange); + + if(nMin > -1) { + IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentRange, nMin); + fit->execute(); + + IFunction_sptr fitFunction = fit->getProperty("Function"); + CompositeFunction_sptr composite = boost::dynamic_pointer_cast(fitFunction); + + if(!composite) { + throw std::runtime_error("Not a composite function!"); + } + + std::vector peaks = currentRange->getPeaks(); + for(size_t i = 0; i < peaks.size(); ++i) { + setValuesFromProfileFunction(peaks[i], composite->getFunction(i)); + MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); + m_fitplots->addWorkspace(fpg); + } + } + } + + return getReducedPeakCollection(peaks); +} + +int PoldiFitPeaks1D2::getBestChebyshevPolynomialDegree(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range) +{ + int n = 0; + double chiSquareMin = 1e10; + int nMin = -1; + + while((n < 3)) { + IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, range, n); + bool fitSuccess = fit->execute(); + + if(fitSuccess) { + ITableWorkspace_sptr fitCharacteristics = fit->getProperty("OutputParameters"); + TableRow row = fitCharacteristics->getRow(fitCharacteristics->rowCount() - 1); + + double chiSquare = row.Double(1); + + + if(fabs(chiSquare - 1) < fabs(chiSquareMin - 1)) { + chiSquareMin = chiSquare; + nMin = n; + } + } + + ++n; + } + + g_log.information() << "Chi^2 for range [" << range->getXStart() << " - " << range->getXEnd() << "] is minimal at n = " << nMin << " with Chi^2 = " << chiSquareMin << std::endl; + + return nMin; +} + +PoldiPeakCollection_sptr PoldiFitPeaks1D2::getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const +{ + PoldiPeakCollection_sptr reducedPeaks = boost::make_shared(); + reducedPeaks->setProfileFunctionName(peaks->getProfileFunctionName()); + + for(size_t i = 0; i < peaks->peakCount(); ++i) { + PoldiPeak_sptr currentPeak = peaks->peak(i); + + if(peakIsAcceptable(currentPeak)) { + reducedPeaks->addPeak(currentPeak); + } + } + + return reducedPeaks; +} + +bool PoldiFitPeaks1D2::peakIsAcceptable(const PoldiPeak_sptr &peak) const +{ + return peak->intensity() > 0 && peak->fwhm(PoldiPeak::Relative) < 0.02; +} + +void PoldiFitPeaks1D2::exec() +{ + setPeakFunction(getProperty("PeakFunction")); + + // Number of points around the peak center to use for the fit + m_fwhmMultiples = getProperty("FwhmMultiples"); + + // try to construct PoldiPeakCollection from provided TableWorkspace + TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); + m_peaks = getInitializedPeakCollection(poldiPeakTable); + + PoldiPeakCollection_sptr fittedPeaksNew = fitPeaks(m_peaks); + PoldiPeakCollection_sptr fittedPeaksOld = m_peaks; + while(fittedPeaksNew->peakCount() < fittedPeaksOld->peakCount()) { + fittedPeaksOld = fittedPeaksNew; + fittedPeaksNew = fitPeaks(fittedPeaksOld); + } + + m_peakResultOutput = generateResultTable(fittedPeaksNew); + + setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); + setProperty("ResultTableWorkspace", m_peakResultOutput); + setProperty("FitPlotsWorkspace", m_fitplots); +} + +IAlgorithm_sptr PoldiFitPeaks1D2::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n) +{ + IFunction_sptr rangeProfile = getRangeProfile(range, n); + + IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); + fitAlgorithm->setProperty("CreateOutput", true); + fitAlgorithm->setProperty("Output", "FitPeaks1D"); + fitAlgorithm->setProperty("CalcErrors", true); + fitAlgorithm->setProperty("OutputCompositeMembers", true); + fitAlgorithm->setProperty("Function", rangeProfile); + fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); + fitAlgorithm->setProperty("WorkspaceIndex", 0); + fitAlgorithm->setProperty("StartX", range->getXStart()); + fitAlgorithm->setProperty("EndX", range->getXEnd()); + + return fitAlgorithm; +} + +void PoldiFitPeaks1D2::initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const +{ + peakResultWorkspace->addColumn("str", "Q"); + peakResultWorkspace->addColumn("str", "d"); + peakResultWorkspace->addColumn("double", "deltaD/d *10^3"); + peakResultWorkspace->addColumn("str", "FWHM rel. *10^3"); + peakResultWorkspace->addColumn("str", "Intensity"); +} + +void PoldiFitPeaks1D2::storePeakResult(TableRow tableRow, const PoldiPeak_sptr &peak) const +{ + UncertainValue q = peak->q(); + UncertainValue d = peak->d(); + + tableRow << UncertainValueIO::toString(q) + << UncertainValueIO::toString(d) + << d.error() / d.value() * 1e3 + << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3) + << UncertainValueIO::toString(peak->intensity()); +} + +TableWorkspace_sptr PoldiFitPeaks1D2::generateResultTable(const PoldiPeakCollection_sptr &peaks) const +{ + TableWorkspace_sptr outputTable = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); + initializePeakResultWorkspace(outputTable); + + for(size_t i = 0; i < peaks->peakCount(); ++i) { + storePeakResult(outputTable->appendRow(), peaks->peak(i)); + } + + return outputTable; +} + +} // namespace Poldi +} // namespace Mantid diff --git a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h new file mode 100644 index 000000000000..dbf599db07bd --- /dev/null +++ b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h @@ -0,0 +1,123 @@ +#ifndef MANTID_SINQ_POLDIFITPEAKS1DTEST_H_ +#define MANTID_SINQ_POLDIFITPEAKS1DTEST_H_ + +#include + +#include "MantidSINQ/PoldiFitPeaks1D.h" + +#include "MantidAPI/IFunction.h" +#include "MantidAPI/CompositeFunction.h" +#include "MantidAPI/IPeakFunction.h" + +#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/FlatBackground.h" + +#include "MantidSINQ/PoldiUtilities/PoldiPeak.h" + +using Mantid::Poldi::PoldiFitPeaks1D; +using namespace Mantid::Poldi; +using namespace Mantid::API; +using namespace Mantid::CurveFitting; +using namespace Mantid::Kernel; + +class PoldiFitPeaks1D; + +class TestablePoldiFitPeaks1D : public Mantid::Poldi::PoldiFitPeaks1D +{ + friend class PoldiFitPeaks1DTest; +public: + TestablePoldiFitPeaks1D() : + PoldiFitPeaks1D() + { + } +}; + +class PoldiFitPeaks1DTest : public CxxTest::TestSuite +{ +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static PoldiFitPeaks1DTest *createSuite() { return new PoldiFitPeaks1DTest(); } + static void destroySuite( PoldiFitPeaks1DTest *suite ) { delete suite; } + + PoldiFitPeaks1DTest() + { + m_testPeak = PoldiPeak::create(MillerIndices(1, 1, 1), UncertainValue(1.108329), UncertainValue(2948.231), UncertainValue(0.002)); + m_profileTestFunction = std::string("Gaussian"); + m_backgroundTestFunction = IFunction_sptr(new FlatBackground); + m_backgroundTestFunction->initialize(); + } + + void testSetPeakFunction() + { + TestablePoldiFitPeaks1D poldiFitPeaks; + poldiFitPeaks.setPeakFunction(m_profileTestFunction); + + TS_ASSERT_EQUALS(poldiFitPeaks.m_profileTemplate, m_profileTestFunction); + } + + void testGetPeakProfile() + { + TestablePoldiFitPeaks1D poldiFitPeaks; + poldiFitPeaks.initialize(); + poldiFitPeaks.setPeakFunction(m_profileTestFunction); + + IFunction_sptr peakFunction = poldiFitPeaks.getPeakProfile(m_testPeak); + + // make sure that the profile is correct + IPeakFunction_sptr profile = boost::dynamic_pointer_cast(peakFunction); + TS_ASSERT(profile); + + TS_ASSERT_EQUALS(profile->centre(), m_testPeak->q()); + TS_ASSERT_EQUALS(profile->height(), m_testPeak->intensity()); + TS_ASSERT_EQUALS(profile->fwhm(), m_testPeak->fwhm(PoldiPeak::AbsoluteQ)); + } + + void testSetValuesFromProfileFunction() + { + TestablePoldiFitPeaks1D poldiFitPeaks; + poldiFitPeaks.initialize(); + poldiFitPeaks.setPeakFunction(m_profileTestFunction); + + IFunction_sptr totalProfile = poldiFitPeaks.getPeakProfile(m_testPeak); + + // now we have a profile with known parameters. assign them to a new PoldiPeak + PoldiPeak_sptr newPeak = PoldiPeak::create(1.0); + poldiFitPeaks.setValuesFromProfileFunction(newPeak, totalProfile); + + TS_ASSERT_EQUALS(newPeak->q(), m_testPeak->q()); + TS_ASSERT_EQUALS(newPeak->intensity(), m_testPeak->intensity()); + TS_ASSERT_EQUALS(newPeak->fwhm(PoldiPeak::AbsoluteQ), m_testPeak->fwhm(PoldiPeak::AbsoluteQ)); + } + + void testProperties() + { + Mantid::Poldi::PoldiFitPeaks1D fitPeaks1D; + fitPeaks1D.initialize(); + + TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 7); + + std::vector properties = fitPeaks1D.getProperties(); + std::set names; + + for(size_t i = 0; i < properties.size(); ++i) { + names.insert(properties[i]->name()); + } + + TS_ASSERT_EQUALS(names.count("InputWorkspace"), 1); + TS_ASSERT_EQUALS(names.count("FwhmMultiples"), 1); + TS_ASSERT_EQUALS(names.count("PeakFunction"), 1); + TS_ASSERT_EQUALS(names.count("PoldiPeakTable"), 1); + TS_ASSERT_EQUALS(names.count("OutputWorkspace"), 1); + TS_ASSERT_EQUALS(names.count("ResultTableWorkspace"), 1); + TS_ASSERT_EQUALS(names.count("FitPlotsWorkspace"), 1); + } + +private: + PoldiPeak_sptr m_testPeak; + std::string m_profileTestFunction; + IFunction_sptr m_backgroundTestFunction; +}; + + +#endif /* MANTID_SINQ_POLDIFITPEAKS1DTEST_H_ */ From fa6cf75d7becbd2b02bb13424d4d21fc644e6076 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 10:05:02 +0100 Subject: [PATCH 007/130] Refs #10263. Reverting PoldiFitPeaks1D Since there's a new version of the algorithm now, version 1 is reverted. --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h | 49 +-- .../Framework/SINQ/src/PoldiFitPeaks1D.cpp | 292 +++++------------- .../Framework/SINQ/test/PoldiFitPeaks1DTest.h | 14 +- 3 files changed, 99 insertions(+), 256 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h index 597cd9483211..8139c5d3f33f 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h @@ -15,34 +15,6 @@ namespace Mantid { namespace Poldi { - /// Helper class for refining peaks with overlapping ranges - class RefinedRange - { - public: - RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples); - RefinedRange(double xStart, double xEnd, const std::vector &peaks); - RefinedRange(const RefinedRange &other); - - bool operator <(const RefinedRange &other) const; - - bool overlaps(const RefinedRange &other) const; - void merge(const RefinedRange &other); - - const std::vector getPeaks() const { return m_peaks; } - - double getXStart() const { return m_xStart; } - double getXEnd() const { return m_xEnd; } - - private: - std::vector m_peaks; - double m_xStart; - double m_xEnd; - }; - - typedef boost::shared_ptr RefinedRange_sptr; - - bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs); - /** PoldiFitPeaks1D : PoldiFitPeaks1D fits multiple peaks to POLDI auto-correlation data. @@ -84,25 +56,17 @@ namespace Poldi virtual const std::string category() const; protected: - PoldiPeakCollection_sptr fitPeaks(const PoldiPeakCollection_sptr &peaks); - - int getBestChebyshevPolynomialDegree(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range); - - PoldiPeakCollection_sptr getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const; - bool peakIsAcceptable(const PoldiPeak_sptr &peak) const; - void setPeakFunction(const std::string &peakFunction); PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; - std::vector getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; - std::vector getReducedRanges(const std::vector &ranges) const; - - API::IFunction_sptr getRangeProfile(const RefinedRange_sptr &range, int n) const; API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; - API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n); + API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const API::IFunction_sptr &profile); + + void addPeakFitCharacteristics(const API::ITableWorkspace_sptr &fitResult); + void initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult); void initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const; void storePeakResult(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; @@ -110,10 +74,11 @@ namespace Poldi PoldiPeakCollection_sptr m_peaks; std::string m_profileTemplate; + API::IFunction_sptr m_backgroundTemplate; + std::string m_profileTies; + DataObjects::TableWorkspace_sptr m_fitCharacteristics; DataObjects::TableWorkspace_sptr m_peakResultOutput; - API::WorkspaceGroup_sptr m_fitplots; - double m_fwhmMultiples; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp index 285ca938093b..f34124fdfeaf 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp @@ -14,10 +14,6 @@ #include "MantidSINQ/PoldiUtilities/UncertainValueIO.h" #include "MantidAPI/CompositeFunction.h" -#include - -#include -#include namespace Mantid @@ -25,62 +21,10 @@ namespace Mantid namespace Poldi { -using namespace Kernel; -using namespace API; -using namespace DataObjects; -using namespace CurveFitting; - -RefinedRange::RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples) : - m_peaks(1, peak) -{ - double width = peak->fwhm(); - double extent = std::max(0.002, width) * fwhmMultiples; - - m_xStart = peak->q() - extent; - m_xEnd = peak->q() + extent; -} - -RefinedRange::RefinedRange(double xStart, double xEnd, const std::vector &peaks) : - m_peaks(peaks), - m_xStart(xStart), - m_xEnd(xEnd) -{ -} - -RefinedRange::RefinedRange(const RefinedRange &other) : - m_peaks(other.m_peaks), - m_xStart(other.m_xStart), - m_xEnd(other.m_xEnd) -{ - -} - -bool RefinedRange::operator <(const RefinedRange &other) const -{ - return m_xStart < other.m_xStart; -} - -bool RefinedRange::overlaps(const RefinedRange &other) const -{ - return (other.m_xStart > m_xStart && other.m_xStart < m_xEnd) - || (other.m_xEnd > m_xStart && other.m_xEnd < m_xEnd) - || (other.m_xStart < m_xStart && other.m_xEnd > m_xEnd); -} - -void RefinedRange::merge(const RefinedRange &other) -{ - m_peaks.insert(m_peaks.end(), other.m_peaks.begin(), other.m_peaks.end()); - - m_xStart = std::min(m_xStart, other.m_xStart); - m_xEnd = std::max(m_xEnd, other.m_xEnd); -} - -bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs) -{ - return (*lhs) < (*rhs); -} - - +using namespace Mantid::Kernel; +using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::CurveFitting; // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(PoldiFitPeaks1D) @@ -89,8 +33,10 @@ DECLARE_ALGORITHM(PoldiFitPeaks1D) PoldiFitPeaks1D::PoldiFitPeaks1D() : m_peaks(), m_profileTemplate(), + m_backgroundTemplate(), + m_profileTies(), + m_fitCharacteristics(), m_peakResultOutput(), - m_fitplots(new WorkspaceGroup), m_fwhmMultiples(1.0) { @@ -125,7 +71,11 @@ void PoldiFitPeaks1D::init() declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); declareProperty(new WorkspaceProperty("ResultTableWorkspace","ResultTable",Direction::Output), "Fit results."); + declareProperty(new WorkspaceProperty("FitCharacteristicsWorkspace","FitCharacteristics",Direction::Output), "Fit characteristics for each peak."); declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); + + m_backgroundTemplate = FunctionFactory::Instance().createInitialized("name=UserFunction, Formula=A0 + A1*(x - x0)^2"); + m_profileTies = "f1.x0 = f0.PeakCentre"; } void PoldiFitPeaks1D::setPeakFunction(const std::string &peakFunction) @@ -141,72 +91,38 @@ PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(const Dat return peakCollection; } -std::vector PoldiFitPeaks1D::getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const -{ - std::vector ranges; - for(size_t i = 0; i < peaks->peakCount(); ++i) { - ranges.push_back(boost::make_shared(peaks->peak(i), m_fwhmMultiples)); - } - - return ranges; -} - -std::vector PoldiFitPeaks1D::getReducedRanges(const std::vector &ranges) const -{ - std::vector workingRanges(ranges); - std::sort(workingRanges.begin(), workingRanges.end()); - - std::vector reducedRanges; - reducedRanges.push_back(boost::make_shared(*(workingRanges.front()))); - - for(size_t i = 1; i < workingRanges.size(); ++i) { - RefinedRange_sptr lastReduced = reducedRanges.back(); - RefinedRange_sptr current = workingRanges[i]; - - if(!lastReduced->overlaps(*current)) { - reducedRanges.push_back(boost::make_shared(*current)); - } else { - lastReduced->merge(*current); - } - } +IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { + IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); + clonedProfile->setCentre(poldiPeak->q()); + clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); + clonedProfile->setHeight(poldiPeak->intensity()); - return reducedRanges; -} + IFunction_sptr clonedBackground = m_backgroundTemplate->clone(); -API::IFunction_sptr PoldiFitPeaks1D::getRangeProfile(const RefinedRange_sptr &range, int n) const -{ CompositeFunction_sptr totalProfile(new CompositeFunction); totalProfile->initialize(); + totalProfile->addFunction(clonedProfile); + totalProfile->addFunction(clonedBackground); - std::vector peaks = range->getPeaks(); - for(auto it = peaks.begin(); it != peaks.end(); ++it) { - totalProfile->addFunction(getPeakProfile(*it)); + if(!m_profileTies.empty()) { + totalProfile->addTies(m_profileTies); } - totalProfile->addFunction(FunctionFactory::Instance().createInitialized("name=Chebyshev,n=" + boost::lexical_cast(n) - + ",StartX=" + boost::lexical_cast(range->getXStart()) - + ",EndX=" + boost::lexical_cast(range->getXEnd()))); - return totalProfile; } -IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { - IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); - clonedProfile->setCentre(poldiPeak->q()); - clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); - clonedProfile->setHeight(poldiPeak->intensity()); - - return clonedProfile; -} - void PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const { - IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(fittedFunction); + CompositeFunction_sptr totalFunction = boost::dynamic_pointer_cast(fittedFunction); - if(peakFunction) { - poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); - poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); - poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); + if(totalFunction) { + IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(totalFunction->getFunction(0)); + + if(peakFunction) { + poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); + poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); + poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); + } } } @@ -215,138 +131,93 @@ double PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) co return peakFunction->fwhm() / peakFunction->getParameter(2); } -PoldiPeakCollection_sptr PoldiFitPeaks1D::fitPeaks(const PoldiPeakCollection_sptr &peaks) +void PoldiFitPeaks1D::exec() { - g_log.information() << "Peaks to fit: " << peaks->peakCount() << std::endl; + setPeakFunction(getProperty("PeakFunction")); - std::vector rawRanges = getRefinedRanges(peaks); - std::vector reducedRanges = getReducedRanges(rawRanges); + // Number of points around the peak center to use for the fit + m_fwhmMultiples = getProperty("FwhmMultiples"); - g_log.information() << "Ranges used for fitting: " << reducedRanges.size() << std::endl; + // try to construct PoldiPeakCollection from provided TableWorkspace + TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); + m_peaks = getInitializedPeakCollection(poldiPeakTable); - Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); - m_fitplots->removeAll(); - for(size_t i = 0; i < reducedRanges.size(); ++i) { - RefinedRange_sptr currentRange = reducedRanges[i]; - int nMin = getBestChebyshevPolynomialDegree(dataWorkspace, currentRange); + g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; - if(nMin > -1) { - IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentRange, nMin); - fit->execute(); + Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); - IFunction_sptr fitFunction = fit->getProperty("Function"); - CompositeFunction_sptr composite = boost::dynamic_pointer_cast(fitFunction); + m_fitCharacteristics = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); + WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); - if(!composite) { - throw std::runtime_error("Not a composite function!"); - } - std::vector peaks = currentRange->getPeaks(); - for(size_t i = 0; i < peaks.size(); ++i) { - setValuesFromProfileFunction(peaks[i], composite->getFunction(i)); - MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); - m_fitplots->addWorkspace(fpg); - } - } - } - return getReducedPeakCollection(peaks); -} + for(size_t i = 0; i < m_peaks->peakCount(); ++i) { + PoldiPeak_sptr currentPeak = m_peaks->peak(i); + IFunction_sptr currentProfile = getPeakProfile(currentPeak); -int PoldiFitPeaks1D::getBestChebyshevPolynomialDegree(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range) -{ - int n = 0; - double chiSquareMin = 1e10; - int nMin = -1; + IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentPeak, currentProfile); - while((n < 3)) { - IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, range, n); bool fitSuccess = fit->execute(); if(fitSuccess) { - ITableWorkspace_sptr fitCharacteristics = fit->getProperty("OutputParameters"); - TableRow row = fitCharacteristics->getRow(fitCharacteristics->rowCount() - 1); + setValuesFromProfileFunction(currentPeak, fit->getProperty("Function")); + addPeakFitCharacteristics(fit->getProperty("OutputParameters")); - double chiSquare = row.Double(1); - - - if(fabs(chiSquare - 1) < fabs(chiSquareMin - 1)) { - chiSquareMin = chiSquare; - nMin = n; - } + MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); + fitPlotGroup->addWorkspace(fpg); } - - ++n; } - g_log.information() << "Chi^2 for range [" << range->getXStart() << " - " << range->getXEnd() << "] is minimal at n = " << nMin << " with Chi^2 = " << chiSquareMin << std::endl; + m_peakResultOutput = generateResultTable(m_peaks); - return nMin; + setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); + setProperty("FitCharacteristicsWorkspace", m_fitCharacteristics); + setProperty("ResultTableWorkspace", m_peakResultOutput); + setProperty("FitPlotsWorkspace", fitPlotGroup); } -PoldiPeakCollection_sptr PoldiFitPeaks1D::getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const +IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const IFunction_sptr &profile) { - PoldiPeakCollection_sptr reducedPeaks = boost::make_shared(); - reducedPeaks->setProfileFunctionName(peaks->getProfileFunctionName()); - - for(size_t i = 0; i < peaks->peakCount(); ++i) { - PoldiPeak_sptr currentPeak = peaks->peak(i); + double width = peak->fwhm(); + double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples; - if(peakIsAcceptable(currentPeak)) { - reducedPeaks->addPeak(currentPeak); - } - } + std::pair xBorders(peak->q() - extent, peak->q() + extent); - return reducedPeaks; -} + IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); + fitAlgorithm->setProperty("CreateOutput", true); + fitAlgorithm->setProperty("Output", "FitPeaks1D"); + fitAlgorithm->setProperty("CalcErrors", true); + fitAlgorithm->setProperty("Function", profile); + fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); + fitAlgorithm->setProperty("WorkspaceIndex", 0); + fitAlgorithm->setProperty("StartX", xBorders.first); + fitAlgorithm->setProperty("EndX", xBorders.second); -bool PoldiFitPeaks1D::peakIsAcceptable(const PoldiPeak_sptr &peak) const -{ - return peak->intensity() > 0 && peak->fwhm(PoldiPeak::Relative) < 0.02; + return fitAlgorithm; } -void PoldiFitPeaks1D::exec() +void PoldiFitPeaks1D::addPeakFitCharacteristics(const ITableWorkspace_sptr &fitResult) { - setPeakFunction(getProperty("PeakFunction")); + if(m_fitCharacteristics->columnCount() == 0) { + initializeFitResultWorkspace(fitResult); + } - // Number of points around the peak center to use for the fit - m_fwhmMultiples = getProperty("FwhmMultiples"); + TableRow newRow = m_fitCharacteristics->appendRow(); - // try to construct PoldiPeakCollection from provided TableWorkspace - TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); - m_peaks = getInitializedPeakCollection(poldiPeakTable); + for(size_t i = 0; i < fitResult->rowCount(); ++i) { + TableRow currentRow = fitResult->getRow(i); - PoldiPeakCollection_sptr fittedPeaksNew = fitPeaks(m_peaks); - PoldiPeakCollection_sptr fittedPeaksOld = m_peaks; - while(fittedPeaksNew->peakCount() < fittedPeaksOld->peakCount()) { - fittedPeaksOld = fittedPeaksNew; - fittedPeaksNew = fitPeaks(fittedPeaksOld); + newRow << UncertainValueIO::toString(UncertainValue(currentRow.Double(1), currentRow.Double(2))); } - - m_peakResultOutput = generateResultTable(fittedPeaksNew); - - setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("ResultTableWorkspace", m_peakResultOutput); - setProperty("FitPlotsWorkspace", m_fitplots); } -IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n) +void PoldiFitPeaks1D::initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult) { - IFunction_sptr rangeProfile = getRangeProfile(range, n); - - IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); - fitAlgorithm->setProperty("CreateOutput", true); - fitAlgorithm->setProperty("Output", "FitPeaks1D"); - fitAlgorithm->setProperty("CalcErrors", true); - fitAlgorithm->setProperty("OutputCompositeMembers", true); - fitAlgorithm->setProperty("Function", rangeProfile); - fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); - fitAlgorithm->setProperty("WorkspaceIndex", 0); - fitAlgorithm->setProperty("StartX", range->getXStart()); - fitAlgorithm->setProperty("EndX", range->getXEnd()); - - return fitAlgorithm; + for(size_t i = 0; i < fitResult->rowCount(); ++i) { + TableRow currentRow = fitResult->getRow(i); + m_fitCharacteristics->addColumn("str", currentRow.cell(0)); + } } void PoldiFitPeaks1D::initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const @@ -382,5 +253,6 @@ TableWorkspace_sptr PoldiFitPeaks1D::generateResultTable(const PoldiPeakCollecti return outputTable; } + } // namespace Poldi } // namespace Mantid diff --git a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h index dbf599db07bd..9750e9fca2ea 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h @@ -59,13 +59,18 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite void testGetPeakProfile() { TestablePoldiFitPeaks1D poldiFitPeaks; + poldiFitPeaks.m_backgroundTemplate = m_backgroundTestFunction; poldiFitPeaks.initialize(); poldiFitPeaks.setPeakFunction(m_profileTestFunction); - IFunction_sptr peakFunction = poldiFitPeaks.getPeakProfile(m_testPeak); + IFunction_sptr totalProfile = poldiFitPeaks.getPeakProfile(m_testPeak); + + // make sure that we get back a composite of peak and background + CompositeFunction_sptr composite = boost::dynamic_pointer_cast(totalProfile); + TS_ASSERT(composite); - // make sure that the profile is correct - IPeakFunction_sptr profile = boost::dynamic_pointer_cast(peakFunction); + // make sure that the profile is the first function in the composite + IPeakFunction_sptr profile = boost::dynamic_pointer_cast(composite->getFunction(0)); TS_ASSERT(profile); TS_ASSERT_EQUALS(profile->centre(), m_testPeak->q()); @@ -95,7 +100,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite Mantid::Poldi::PoldiFitPeaks1D fitPeaks1D; fitPeaks1D.initialize(); - TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 7); + TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 8); std::vector properties = fitPeaks1D.getProperties(); std::set names; @@ -110,6 +115,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(names.count("PoldiPeakTable"), 1); TS_ASSERT_EQUALS(names.count("OutputWorkspace"), 1); TS_ASSERT_EQUALS(names.count("ResultTableWorkspace"), 1); + TS_ASSERT_EQUALS(names.count("FitCharacteristicsWorkspace"), 1); TS_ASSERT_EQUALS(names.count("FitPlotsWorkspace"), 1); } From 8706e65aae9f290536931d98960f1283976634c6 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 10:39:44 +0100 Subject: [PATCH 008/130] Refs #10263. Adding new algorithm PoldiPeakSummary PoldiFitPeaks1D produces a summary table with peak information. Since this will re-occur in the 2D-fit and also in version 2 of the algorithm, this is put into a separate algorithm. It's very small and it will be much easier to deal with possible changes to the output format of poldi peaks. --- Code/Mantid/Framework/SINQ/CMakeLists.txt | 3 + .../SINQ/inc/MantidSINQ/PoldiPeakSummary.h | 56 ++++++++++++++++ .../Framework/SINQ/src/PoldiPeakSummary.cpp | 65 +++++++++++++++++++ .../SINQ/test/PoldiPeakSummaryTest.h | 61 +++++++++++++++++ .../source/algorithms/PoldiPeakSummary-v1.rst | 44 +++++++++++++ 5 files changed, 229 insertions(+) create mode 100644 Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h create mode 100644 Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp create mode 100644 Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h create mode 100644 Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt b/Code/Mantid/Framework/SINQ/CMakeLists.txt index 470abd6db4d5..5d32bd4b9676 100644 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/CMakeLists.txt @@ -12,6 +12,7 @@ set ( SRC_FILES src/PoldiLoadSpectra.cpp src/PoldiPeakDetection2.cpp src/PoldiPeakSearch.cpp + src/PoldiPeakSummary.cpp src/PoldiRemoveDeadWires.cpp src/PoldiTruncateData.cpp src/PoldiUtilities/MillerIndices.cpp @@ -55,6 +56,7 @@ set ( INC_FILES inc/MantidSINQ/PoldiLoadSpectra.h inc/MantidSINQ/PoldiPeakDetection2.h inc/MantidSINQ/PoldiPeakSearch.h + inc/MantidSINQ/PoldiPeakSummary.h inc/MantidSINQ/PoldiRemoveDeadWires.h inc/MantidSINQ/PoldiTruncateData.h inc/MantidSINQ/PoldiUtilities/MillerIndices.h @@ -110,6 +112,7 @@ set ( TEST_FILES PoldiInstrumentAdapterTest.h PoldiPeakCollectionTest.h PoldiPeakSearchTest.h + PoldiPeakSummaryTest.h PoldiPeakTest.h PoldiSourceSpectrumTest.h PoldiSpectrumDomainFunctionTest.h diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h new file mode 100644 index 000000000000..6fb1c5bcd6dc --- /dev/null +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h @@ -0,0 +1,56 @@ +#ifndef MANTID_SINQ_POLDIPEAKSUMMARY_H_ +#define MANTID_SINQ_POLDIPEAKSUMMARY_H_ + +#include "MantidKernel/System.h" +#include "MantidAPI/Algorithm.h" + +namespace Mantid +{ +namespace SINQ +{ + + /** PoldiPeakSummary : TODO: DESCRIPTION + + Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + File change history is stored at: + Code Documentation is available at: + */ + class DLLExport PoldiPeakSummary : public API::Algorithm + { + public: + PoldiPeakSummary(); + virtual ~PoldiPeakSummary(); + + virtual const std::string name() const; + virtual int version() const; + virtual const std::string category() const; + virtual const std::string summary() const; + + private: + void init(); + void exec(); + + + }; + + +} // namespace SINQ +} // namespace Mantid + +#endif /* MANTID_SINQ_POLDIPEAKSUMMARY_H_ */ \ No newline at end of file diff --git a/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp b/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp new file mode 100644 index 000000000000..b19389c4349c --- /dev/null +++ b/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp @@ -0,0 +1,65 @@ +#include "MantidSINQ/PoldiPeakSummary.h" + +namespace Mantid +{ +namespace SINQ +{ + + using Mantid::Kernel::Direction; + using Mantid::API::WorkspaceProperty; + + // Register the algorithm into the AlgorithmFactory + DECLARE_ALGORITHM(PoldiPeakSummary) + + + + //---------------------------------------------------------------------------------------------- + /** Constructor + */ + PoldiPeakSummary::PoldiPeakSummary() + { + } + + //---------------------------------------------------------------------------------------------- + /** Destructor + */ + PoldiPeakSummary::~PoldiPeakSummary() + { + } + + + //---------------------------------------------------------------------------------------------- + + /// Algorithms name for identification. @see Algorithm::name + const std::string PoldiPeakSummary::name() const { return "PoldiPeakSummary"; } + + /// Algorithm's version for identification. @see Algorithm::version + int PoldiPeakSummary::version() const { return 1;}; + + /// Algorithm's category for identification. @see Algorithm::category + const std::string PoldiPeakSummary::category() const { return TODO: FILL IN A CATEGORY;} + + /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary + const std::string PoldiPeakSummary::summary() const { return TODO: FILL IN A SUMMARY;}; + + //---------------------------------------------------------------------------------------------- + /** Initialize the algorithm's properties. + */ + void PoldiPeakSummary::init() + { + declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input), "An input workspace."); + declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output), "An output workspace."); + } + + //---------------------------------------------------------------------------------------------- + /** Execute the algorithm. + */ + void PoldiPeakSummary::exec() + { + // TODO Auto-generated execute stub + } + + + +} // namespace SINQ +} // namespace Mantid \ No newline at end of file diff --git a/Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h b/Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h new file mode 100644 index 000000000000..4cda3399c163 --- /dev/null +++ b/Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h @@ -0,0 +1,61 @@ +#ifndef MANTID_SINQ_POLDIPEAKSUMMARYTEST_H_ +#define MANTID_SINQ_POLDIPEAKSUMMARYTEST_H_ + +#include + +#include "MantidSINQ/PoldiPeakSummary.h" + +using Mantid::SINQ::PoldiPeakSummary; +using namespace Mantid::API; + +class PoldiPeakSummaryTest : public CxxTest::TestSuite +{ +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static PoldiPeakSummaryTest *createSuite() { return new PoldiPeakSummaryTest(); } + static void destroySuite( PoldiPeakSummaryTest *suite ) { delete suite; } + + + void test_Init() + { + PoldiPeakSummary alg; + TS_ASSERT_THROWS_NOTHING( alg.initialize() ) + TS_ASSERT( alg.isInitialized() ) + } + + void test_exec() + { + // Name of the output workspace. + std::string outWSName("PoldiPeakSummaryTest_OutputWS"); + + PoldiPeakSummary alg; + TS_ASSERT_THROWS_NOTHING( alg.initialize() ) + TS_ASSERT( alg.isInitialized() ) + TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("REPLACE_PROPERTY_NAME_HERE!!!!", "value") ); + TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) ); + TS_ASSERT_THROWS_NOTHING( alg.execute(); ); + TS_ASSERT( alg.isExecuted() ); + + // Retrieve the workspace from data service. TODO: Change to your desired type + Workspace_sptr ws; + TS_ASSERT_THROWS_NOTHING( ws = AnalysisDataService::Instance().retrieveWS(outWSName) ); + TS_ASSERT(ws); + if (!ws) return; + + // TODO: Check the results + + // Remove workspace from the data service. + AnalysisDataService::Instance().remove(outWSName); + } + + void test_Something() + { + TSM_ASSERT( "You forgot to write a test!", 0); + } + + +}; + + +#endif /* MANTID_SINQ_POLDIPEAKSUMMARYTEST_H_ */ \ No newline at end of file diff --git a/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst new file mode 100644 index 000000000000..66f7667ad1ee --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst @@ -0,0 +1,44 @@ + +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +TODO: Enter a full rst-markup description of your algorithm here. + + +Usage +----- +.. Try not to use files in your examples, + but if you cannot avoid it then the (small) files must be added to + autotestdata\UsageData and the following tag unindented + .. include:: ../usagedata-note.txt + +**Example - PoldiPeakSummary** + +.. testcode:: PoldiPeakSummaryExample + + # Create a host workspace + ws = CreateWorkspace(DataX=range(0,3), DataY=(0,2)) + or + ws = CreateSampleWorkspace() + + wsOut = PoldiPeakSummary() + + # Print the result + print "The output workspace has %i spectra" % wsOut.getNumberHistograms() + +Output: + +.. testoutput:: PoldiPeakSummaryExample + + The output workspace has ?? spectra + +.. categories:: + From 0896503b93abef4682be25ed4dc4089a64da7e47 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 11:34:19 +0100 Subject: [PATCH 009/130] Refs #10263. Corrected algorithm name for versioning --- Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp index 390dc0c78192..c941e97aa70a 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -102,7 +102,7 @@ PoldiFitPeaks1D2::~PoldiFitPeaks1D2() /// Algorithm's name for identification. @see Algorithm::name -const std::string PoldiFitPeaks1D2::name() const { return "PoldiFitPeaks1D2";} +const std::string PoldiFitPeaks1D2::name() const { return "PoldiFitPeaks1D";} /// Algorithm's version for identification. @see Algorithm::version int PoldiFitPeaks1D2::version() const { return 2;} From 9b396adfc096a1d62cdd96d8c831eb5be9f17359 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 11:34:47 +0100 Subject: [PATCH 010/130] Refs #10263. First working version of PoldiPeakSummary --- .../SINQ/inc/MantidSINQ/PoldiPeakSummary.h | 33 ++++++--- .../Framework/SINQ/src/PoldiPeakSummary.cpp | 74 ++++++++++++++++--- 2 files changed, 87 insertions(+), 20 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h index 6fb1c5bcd6dc..69eed34ecd6e 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h @@ -1,17 +1,28 @@ -#ifndef MANTID_SINQ_POLDIPEAKSUMMARY_H_ -#define MANTID_SINQ_POLDIPEAKSUMMARY_H_ +#ifndef MANTID_POLDI_POLDIPEAKSUMMARY_H_ +#define MANTID_POLDI_POLDIPEAKSUMMARY_H_ -#include "MantidKernel/System.h" +#include "MantidSINQ/DllConfig.h" #include "MantidAPI/Algorithm.h" +#include "MantidDataObjects/TableWorkspace.h" +#include "MantidAPI/TableRow.h" +#include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" + namespace Mantid { -namespace SINQ +namespace Poldi { - /** PoldiPeakSummary : TODO: DESCRIPTION + /** PoldiPeakSummary + + This small algorithm produces a summary table for a given + PoldiPeakCollection, similar to what the original data + analysis software produced. - Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 03/12/2014 + + Copyright © 2014 PSI-MSS This file is part of Mantid. @@ -31,7 +42,7 @@ namespace SINQ File change history is stored at: Code Documentation is available at: */ - class DLLExport PoldiPeakSummary : public API::Algorithm + class MANTID_SINQ_DLL PoldiPeakSummary : public API::Algorithm { public: PoldiPeakSummary(); @@ -46,11 +57,15 @@ namespace SINQ void init(); void exec(); + DataObjects::TableWorkspace_sptr getSummaryTable(const PoldiPeakCollection_sptr &peakCollection) const; + DataObjects::TableWorkspace_sptr getInitializedResultWorkspace() const; + + void storePeakSummary(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; }; -} // namespace SINQ +} // namespace Poldi } // namespace Mantid -#endif /* MANTID_SINQ_POLDIPEAKSUMMARY_H_ */ \ No newline at end of file +#endif /* MANTID_POLDI_POLDIPEAKSUMMARY_H_ */ diff --git a/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp b/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp index b19389c4349c..232b96c8a04c 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp @@ -1,12 +1,18 @@ #include "MantidSINQ/PoldiPeakSummary.h" +#include "MantidAPI/WorkspaceProperty.h" +#include "MantidSINQ/PoldiUtilities/UncertainValueIO.h" +#include "MantidSINQ/PoldiUtilities/MillerIndicesIO.h" +#include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" + namespace Mantid { -namespace SINQ +namespace Poldi { - using Mantid::Kernel::Direction; - using Mantid::API::WorkspaceProperty; + using namespace API; + using namespace DataObjects; + using namespace Kernel; // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(PoldiPeakSummary) @@ -34,21 +40,21 @@ namespace SINQ const std::string PoldiPeakSummary::name() const { return "PoldiPeakSummary"; } /// Algorithm's version for identification. @see Algorithm::version - int PoldiPeakSummary::version() const { return 1;}; + int PoldiPeakSummary::version() const { return 1;} /// Algorithm's category for identification. @see Algorithm::category - const std::string PoldiPeakSummary::category() const { return TODO: FILL IN A CATEGORY;} + const std::string PoldiPeakSummary::category() const { return "SINQ\\Poldi";} /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary - const std::string PoldiPeakSummary::summary() const { return TODO: FILL IN A SUMMARY;}; + const std::string PoldiPeakSummary::summary() const { return "The algorithm takes a table with peaks from POLDI analysis algorithms and creates a summary table.";} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. */ void PoldiPeakSummary::init() { - declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input), "An input workspace."); - declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output), "An output workspace."); + declareProperty(new WorkspaceProperty("InputWorkspace","",Direction::Input), "Input workspace containing a table with peaks from a POLDI fit routine."); + declareProperty(new WorkspaceProperty("OutputWorkspace","",Direction::Output), "Output table workspace that contains "); } //---------------------------------------------------------------------------------------------- @@ -56,10 +62,56 @@ namespace SINQ */ void PoldiPeakSummary::exec() { - // TODO Auto-generated execute stub + TableWorkspace_sptr poldiPeakTableWorkspace = getProperty("InputWorkspace"); + PoldiPeakCollection_sptr peaks = boost::make_shared(poldiPeakTableWorkspace); + + TableWorkspace_sptr resultTable = getSummaryTable(peaks); + + setProperty("OutputWorkspace", resultTable); + } + + TableWorkspace_sptr PoldiPeakSummary::getSummaryTable(const PoldiPeakCollection_sptr &peakCollection) const + { + if(!peakCollection) { + throw std::invalid_argument("Cannot create summary of a null PoldiPeakCollection."); + } + + TableWorkspace_sptr peakResultWorkspace = getInitializedResultWorkspace(); + + for(size_t i = 0; i < peakCollection->peakCount(); ++i) { + storePeakSummary(peakResultWorkspace->appendRow(), peakCollection->peak(i)); + } + + return peakResultWorkspace; + } + + TableWorkspace_sptr PoldiPeakSummary::getInitializedResultWorkspace() const + { + TableWorkspace_sptr peakResultWorkspace = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); + + peakResultWorkspace->addColumn("str", "hkl"); + peakResultWorkspace->addColumn("str", "Q"); + peakResultWorkspace->addColumn("str", "d"); + peakResultWorkspace->addColumn("double", "deltaD/d *10^3"); + peakResultWorkspace->addColumn("str", "FWHM rel. *10^3"); + peakResultWorkspace->addColumn("str", "Intensity"); + + return peakResultWorkspace; } + void PoldiPeakSummary::storePeakSummary(TableRow tableRow, const PoldiPeak_sptr &peak) const + { + UncertainValue q = peak->q(); + UncertainValue d = peak->d(); + + tableRow << MillerIndicesIO::toString(peak->hkl()) + << UncertainValueIO::toString(q) + << UncertainValueIO::toString(d) + << d.error() / d.value() * 1e3 + << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3) + << UncertainValueIO::toString(peak->intensity()); + } -} // namespace SINQ -} // namespace Mantid \ No newline at end of file +} // namespace Poldi +} // namespace Mantid From e2a9105af0577dedd8732ee76d7f52c9b7239dcb Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 14:10:30 +0100 Subject: [PATCH 011/130] Refs #10263. Completing PoldiPeakSummary --- .../SINQ/inc/MantidSINQ/PoldiPeakSummary.h | 9 +-- .../SINQ/test/PoldiPeakSummaryTest.h | 58 ++++++++++++++++--- .../source/algorithms/PoldiPeakSummary-v1.rst | 37 +++++++----- 3 files changed, 76 insertions(+), 28 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h index 69eed34ecd6e..4c814fc35faf 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h @@ -53,15 +53,16 @@ namespace Poldi virtual const std::string category() const; virtual const std::string summary() const; - private: - void init(); - void exec(); - + protected: DataObjects::TableWorkspace_sptr getSummaryTable(const PoldiPeakCollection_sptr &peakCollection) const; DataObjects::TableWorkspace_sptr getInitializedResultWorkspace() const; void storePeakSummary(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; + private: + void init(); + void exec(); + }; diff --git a/Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h b/Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h index 4cda3399c163..9ba8b7ca42db 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiPeakSummaryTest.h @@ -4,9 +4,11 @@ #include #include "MantidSINQ/PoldiPeakSummary.h" +#include "MantidSINQ/PoldiUtilities/PoldiMockInstrumentHelpers.h" -using Mantid::SINQ::PoldiPeakSummary; +using namespace Mantid::Poldi; using namespace Mantid::API; +using namespace Mantid::DataObjects; class PoldiPeakSummaryTest : public CxxTest::TestSuite { @@ -30,9 +32,12 @@ class PoldiPeakSummaryTest : public CxxTest::TestSuite std::string outWSName("PoldiPeakSummaryTest_OutputWS"); PoldiPeakSummary alg; - TS_ASSERT_THROWS_NOTHING( alg.initialize() ) - TS_ASSERT( alg.isInitialized() ) - TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("REPLACE_PROPERTY_NAME_HERE!!!!", "value") ); + TS_ASSERT_THROWS_NOTHING( alg.initialize() ); + TS_ASSERT( alg.isInitialized() ); + + TableWorkspace_sptr poldiPeaks = PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace(); + + TS_ASSERT_THROWS_NOTHING( alg.setProperty("InputWorkspace", poldiPeaks) ); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) ); TS_ASSERT_THROWS_NOTHING( alg.execute(); ); TS_ASSERT( alg.isExecuted() ); @@ -43,19 +48,54 @@ class PoldiPeakSummaryTest : public CxxTest::TestSuite TS_ASSERT(ws); if (!ws) return; - // TODO: Check the results + /* Here we only check that there is a workspace. The content is determined by protected methods + * which are tested separately. + */ // Remove workspace from the data service. AnalysisDataService::Instance().remove(outWSName); } - - void test_Something() + + void testGetInitializedResultWorkspace() { - TSM_ASSERT( "You forgot to write a test!", 0); + TestablePoldiPeakSummary alg; + TableWorkspace_sptr table = alg.getInitializedResultWorkspace(); + + TS_ASSERT_EQUALS(table->columnCount(), 6); + TS_ASSERT_EQUALS(table->rowCount(), 0); } + void testStorePeakSummary() + { + TestablePoldiPeakSummary alg; + TableWorkspace_sptr table = alg.getInitializedResultWorkspace(); + + PoldiPeak_sptr peak = PoldiPeak::create(MillerIndices(1, 2, 3), + UncertainValue(1.2, 0.001), + UncertainValue(100.0, 0.1), + UncertainValue(0.01, 0.0001)); + + TS_ASSERT_THROWS_NOTHING(alg.storePeakSummary(table->appendRow(), peak)); + TS_ASSERT_EQUALS(table->rowCount(), 1); + } + + void testGetSummaryTable() + { + PoldiPeakCollection_sptr peaks = PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum(); + + TestablePoldiPeakSummary alg; + TableWorkspace_sptr summary = alg.getSummaryTable(peaks); + + TS_ASSERT_EQUALS(summary->rowCount(), peaks->peakCount()); + } + +private: + class TestablePoldiPeakSummary : public PoldiPeakSummary + { + friend class PoldiPeakSummaryTest; + }; }; -#endif /* MANTID_SINQ_POLDIPEAKSUMMARYTEST_H_ */ \ No newline at end of file +#endif /* MANTID_SINQ_POLDIPEAKSUMMARYTEST_H_ */ diff --git a/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst index 66f7667ad1ee..50aacea59c4c 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst @@ -10,35 +10,42 @@ Description ----------- -TODO: Enter a full rst-markup description of your algorithm here. +This algorithm takes the peak table resulting from one of the POLDI peak fitting routines (for example :ref:`algm-PoldiFitPeaks1D`) and summarizes the data in another table with the relevant information. Usage ----- -.. Try not to use files in your examples, - but if you cannot avoid it then the (small) files must be added to - autotestdata\UsageData and the following tag unindented - .. include:: ../usagedata-note.txt + +.. include:: ../usagedata-note.txt **Example - PoldiPeakSummary** .. testcode:: PoldiPeakSummaryExample - # Create a host workspace - ws = CreateWorkspace(DataX=range(0,3), DataY=(0,2)) - or - ws = CreateSampleWorkspace() - - wsOut = PoldiPeakSummary() - - # Print the result - print "The output workspace has %i spectra" % wsOut.getNumberHistograms() + # Load data file and instrument, perform correlation analysis + raw_6904 = LoadSINQFile(Filename = "poldi2013n006904.hdf", Instrument = "POLDI") + LoadInstrument(raw_6904, InstrumentName = "POLDI") + correlated_6904 = PoldiAutoCorrelation(raw_6904) + + # Run peak search algorithm, store peaks in TableWorkspace + peaks_6904 = PoldiPeakSearch(correlated_6904) + + PoldiFitPeaks1D(InputWorkspace = correlated_6904, FwhmMultiples = 4.0, + PeakFunction = "Gaussian", PoldiPeakTable = peaks_6904, + OutputWorkspace = "peaks_refined_6904", ResultTableWorkspace = "result_table_6904", + FitPlotsWorkspace = "fit_plots_6904") + + summary_6904 = PoldiPeakSummary(mtd["peaks_refined_6904"]) + + print "Number of refined peaks:", summary_6904.rowCount() + print "Number of columns that describe a peak:", summary_6904.columnCount() Output: .. testoutput:: PoldiPeakSummaryExample - The output workspace has ?? spectra + Number of refined peaks: 14 + Number of columns that describe a peak: 6 .. categories:: From 914eed4f9ae7006bed6723a937c363ba27e2231e Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 14:10:57 +0100 Subject: [PATCH 012/130] Refs #10263. Correcting test for PoldiFitPeaks1D version 2 --- .../SINQ/test/PoldiFitPeaks1D2Test.h | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h index dbf599db07bd..1e26f52a0e10 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h @@ -1,9 +1,9 @@ -#ifndef MANTID_SINQ_POLDIFITPEAKS1DTEST_H_ -#define MANTID_SINQ_POLDIFITPEAKS1DTEST_H_ +#ifndef MANTID_SINQ_POLDIFITPEAKS1D2TEST_H_ +#define MANTID_SINQ_POLDIFITPEAKS1D2TEST_H_ #include -#include "MantidSINQ/PoldiFitPeaks1D.h" +#include "MantidSINQ/PoldiFitPeaks1D2.h" #include "MantidAPI/IFunction.h" #include "MantidAPI/CompositeFunction.h" @@ -14,33 +14,33 @@ #include "MantidSINQ/PoldiUtilities/PoldiPeak.h" -using Mantid::Poldi::PoldiFitPeaks1D; +using Mantid::Poldi::PoldiFitPeaks1D2; using namespace Mantid::Poldi; using namespace Mantid::API; using namespace Mantid::CurveFitting; using namespace Mantid::Kernel; -class PoldiFitPeaks1D; +class PoldiFitPeaks1D2; -class TestablePoldiFitPeaks1D : public Mantid::Poldi::PoldiFitPeaks1D +class TestablePoldiFitPeaks1D2 : public Mantid::Poldi::PoldiFitPeaks1D2 { - friend class PoldiFitPeaks1DTest; + friend class PoldiFitPeaks1D2Test; public: - TestablePoldiFitPeaks1D() : - PoldiFitPeaks1D() + TestablePoldiFitPeaks1D2() : + PoldiFitPeaks1D2() { } }; -class PoldiFitPeaks1DTest : public CxxTest::TestSuite +class PoldiFitPeaks1D2Test : public CxxTest::TestSuite { public: // This pair of boilerplate methods prevent the suite being created statically // This means the constructor isn't called when running other tests - static PoldiFitPeaks1DTest *createSuite() { return new PoldiFitPeaks1DTest(); } - static void destroySuite( PoldiFitPeaks1DTest *suite ) { delete suite; } + static PoldiFitPeaks1D2Test *createSuite() { return new PoldiFitPeaks1D2Test(); } + static void destroySuite( PoldiFitPeaks1D2Test *suite ) { delete suite; } - PoldiFitPeaks1DTest() + PoldiFitPeaks1D2Test() { m_testPeak = PoldiPeak::create(MillerIndices(1, 1, 1), UncertainValue(1.108329), UncertainValue(2948.231), UncertainValue(0.002)); m_profileTestFunction = std::string("Gaussian"); @@ -50,7 +50,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite void testSetPeakFunction() { - TestablePoldiFitPeaks1D poldiFitPeaks; + TestablePoldiFitPeaks1D2 poldiFitPeaks; poldiFitPeaks.setPeakFunction(m_profileTestFunction); TS_ASSERT_EQUALS(poldiFitPeaks.m_profileTemplate, m_profileTestFunction); @@ -58,7 +58,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite void testGetPeakProfile() { - TestablePoldiFitPeaks1D poldiFitPeaks; + TestablePoldiFitPeaks1D2 poldiFitPeaks; poldiFitPeaks.initialize(); poldiFitPeaks.setPeakFunction(m_profileTestFunction); @@ -75,7 +75,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite void testSetValuesFromProfileFunction() { - TestablePoldiFitPeaks1D poldiFitPeaks; + TestablePoldiFitPeaks1D2 poldiFitPeaks; poldiFitPeaks.initialize(); poldiFitPeaks.setPeakFunction(m_profileTestFunction); @@ -92,7 +92,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite void testProperties() { - Mantid::Poldi::PoldiFitPeaks1D fitPeaks1D; + Mantid::Poldi::PoldiFitPeaks1D2 fitPeaks1D; fitPeaks1D.initialize(); TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 7); @@ -120,4 +120,4 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite }; -#endif /* MANTID_SINQ_POLDIFITPEAKS1DTEST_H_ */ +#endif /* MANTID_SINQ_POLDIFITPEAKS1D2TEST_H_ */ From ba3fdc1398633a19a6173b1c7dc02c80728c31f3 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 15:57:54 +0100 Subject: [PATCH 013/130] Refs #10263. Removing summary code from PoldiFitPeaks1D. FitCharacteristics is gone too, this is information that could probably go into the log, but it's not necessary to have this information in an output workspace. --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h | 10 --- .../Framework/SINQ/src/PoldiFitPeaks1D.cpp | 68 ------------------- .../Framework/SINQ/test/PoldiFitPeaks1DTest.h | 4 +- .../source/algorithms/PoldiFitPeaks1D-v1.rst | 6 +- 4 files changed, 4 insertions(+), 84 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h index 8139c5d3f33f..f4abac839c58 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h @@ -65,21 +65,11 @@ namespace Poldi API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const API::IFunction_sptr &profile); - void addPeakFitCharacteristics(const API::ITableWorkspace_sptr &fitResult); - void initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult); - - void initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const; - void storePeakResult(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; - DataObjects::TableWorkspace_sptr generateResultTable(const PoldiPeakCollection_sptr &peaks) const; - PoldiPeakCollection_sptr m_peaks; std::string m_profileTemplate; API::IFunction_sptr m_backgroundTemplate; std::string m_profileTies; - DataObjects::TableWorkspace_sptr m_fitCharacteristics; - DataObjects::TableWorkspace_sptr m_peakResultOutput; - double m_fwhmMultiples; private: diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp index f34124fdfeaf..dddcbc5a272d 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp @@ -35,8 +35,6 @@ PoldiFitPeaks1D::PoldiFitPeaks1D() : m_profileTemplate(), m_backgroundTemplate(), m_profileTies(), - m_fitCharacteristics(), - m_peakResultOutput(), m_fwhmMultiples(1.0) { @@ -70,8 +68,6 @@ void PoldiFitPeaks1D::init() declareProperty(new WorkspaceProperty("PoldiPeakTable","",Direction::Input), "A table workspace containing POLDI peak data."); declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); - declareProperty(new WorkspaceProperty("ResultTableWorkspace","ResultTable",Direction::Output), "Fit results."); - declareProperty(new WorkspaceProperty("FitCharacteristicsWorkspace","FitCharacteristics",Direction::Output), "Fit characteristics for each peak."); declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); m_backgroundTemplate = FunctionFactory::Instance().createInitialized("name=UserFunction, Formula=A0 + A1*(x - x0)^2"); @@ -147,11 +143,8 @@ void PoldiFitPeaks1D::exec() Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); - m_fitCharacteristics = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); - - for(size_t i = 0; i < m_peaks->peakCount(); ++i) { PoldiPeak_sptr currentPeak = m_peaks->peak(i); IFunction_sptr currentProfile = getPeakProfile(currentPeak); @@ -162,18 +155,14 @@ void PoldiFitPeaks1D::exec() if(fitSuccess) { setValuesFromProfileFunction(currentPeak, fit->getProperty("Function")); - addPeakFitCharacteristics(fit->getProperty("OutputParameters")); MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); fitPlotGroup->addWorkspace(fpg); } } - m_peakResultOutput = generateResultTable(m_peaks); setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("FitCharacteristicsWorkspace", m_fitCharacteristics); - setProperty("ResultTableWorkspace", m_peakResultOutput); setProperty("FitPlotsWorkspace", fitPlotGroup); } @@ -197,62 +186,5 @@ IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWor return fitAlgorithm; } -void PoldiFitPeaks1D::addPeakFitCharacteristics(const ITableWorkspace_sptr &fitResult) -{ - if(m_fitCharacteristics->columnCount() == 0) { - initializeFitResultWorkspace(fitResult); - } - - TableRow newRow = m_fitCharacteristics->appendRow(); - - for(size_t i = 0; i < fitResult->rowCount(); ++i) { - TableRow currentRow = fitResult->getRow(i); - - newRow << UncertainValueIO::toString(UncertainValue(currentRow.Double(1), currentRow.Double(2))); - } -} - -void PoldiFitPeaks1D::initializeFitResultWorkspace(const API::ITableWorkspace_sptr &fitResult) -{ - for(size_t i = 0; i < fitResult->rowCount(); ++i) { - TableRow currentRow = fitResult->getRow(i); - m_fitCharacteristics->addColumn("str", currentRow.cell(0)); - } -} - -void PoldiFitPeaks1D::initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const -{ - peakResultWorkspace->addColumn("str", "Q"); - peakResultWorkspace->addColumn("str", "d"); - peakResultWorkspace->addColumn("double", "deltaD/d *10^3"); - peakResultWorkspace->addColumn("str", "FWHM rel. *10^3"); - peakResultWorkspace->addColumn("str", "Intensity"); -} - -void PoldiFitPeaks1D::storePeakResult(TableRow tableRow, const PoldiPeak_sptr &peak) const -{ - UncertainValue q = peak->q(); - UncertainValue d = peak->d(); - - tableRow << UncertainValueIO::toString(q) - << UncertainValueIO::toString(d) - << d.error() / d.value() * 1e3 - << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3) - << UncertainValueIO::toString(peak->intensity()); -} - -TableWorkspace_sptr PoldiFitPeaks1D::generateResultTable(const PoldiPeakCollection_sptr &peaks) const -{ - TableWorkspace_sptr outputTable = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); - initializePeakResultWorkspace(outputTable); - - for(size_t i = 0; i < peaks->peakCount(); ++i) { - storePeakResult(outputTable->appendRow(), peaks->peak(i)); - } - - return outputTable; -} - - } // namespace Poldi } // namespace Mantid diff --git a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h index 9750e9fca2ea..2c00ad05c368 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1DTest.h @@ -100,7 +100,7 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite Mantid::Poldi::PoldiFitPeaks1D fitPeaks1D; fitPeaks1D.initialize(); - TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 8); + TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 6); std::vector properties = fitPeaks1D.getProperties(); std::set names; @@ -114,8 +114,6 @@ class PoldiFitPeaks1DTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(names.count("PeakFunction"), 1); TS_ASSERT_EQUALS(names.count("PoldiPeakTable"), 1); TS_ASSERT_EQUALS(names.count("OutputWorkspace"), 1); - TS_ASSERT_EQUALS(names.count("ResultTableWorkspace"), 1); - TS_ASSERT_EQUALS(names.count("FitCharacteristicsWorkspace"), 1); TS_ASSERT_EQUALS(names.count("FitPlotsWorkspace"), 1); } diff --git a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst index 6c6d69862016..8f600749b57b 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst @@ -43,9 +43,9 @@ The following small usage example performs a peak fit on the sample data already PoldiFitPeaks1D(InputWorkspace = correlated_6904, FwhmMultiples = 4.0, PeakFunction = "Gaussian", PoldiPeakTable = peaks_6904, - OutputWorkspace = "peaks_refined_6904", ResultTableWorkspace = "result_table_6904", - FitCharacteristicsWorkspace = "raw_fit_results_6904", - FitPlotsWorkspace = "fit_plots_6904") + OutputWorkspace = "peaks_refined_6904", + FitPlotsWorkspace = "fit_plots_6904", + Version=1) print "There are", mtd['fit_plots_6904'].getNumberOfEntries(), "plots available for inspection." From a77709877b81f8ec8c0510843c13815f48f2a61b Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 3 Dec 2014 16:52:36 +0100 Subject: [PATCH 014/130] Refs #10263. Removed summary part from PoldiFitPeaks1D version 2 --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h | 5 --- .../Framework/SINQ/src/PoldiFitPeaks1D2.cpp | 37 ------------------- .../PoldiCalculateSpectrum2D-v1.rst | 6 +-- .../source/algorithms/PoldiPeakSummary-v1.rst | 2 +- 4 files changed, 3 insertions(+), 47 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h index cb084c52797c..c0026de1deb0 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h @@ -104,14 +104,9 @@ namespace Poldi API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n); - void initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const; - void storePeakResult(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; - DataObjects::TableWorkspace_sptr generateResultTable(const PoldiPeakCollection_sptr &peaks) const; - PoldiPeakCollection_sptr m_peaks; std::string m_profileTemplate; - DataObjects::TableWorkspace_sptr m_peakResultOutput; API::WorkspaceGroup_sptr m_fitplots; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp index c941e97aa70a..af202a5283ca 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -89,7 +89,6 @@ DECLARE_ALGORITHM(PoldiFitPeaks1D2) PoldiFitPeaks1D2::PoldiFitPeaks1D2() : m_peaks(), m_profileTemplate(), - m_peakResultOutput(), m_fitplots(new WorkspaceGroup), m_fwhmMultiples(1.0) { @@ -124,7 +123,6 @@ void PoldiFitPeaks1D2::init() declareProperty(new WorkspaceProperty("PoldiPeakTable","",Direction::Input), "A table workspace containing POLDI peak data."); declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); - declareProperty(new WorkspaceProperty("ResultTableWorkspace","ResultTable",Direction::Output), "Fit results."); declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); } @@ -324,10 +322,8 @@ void PoldiFitPeaks1D2::exec() fittedPeaksNew = fitPeaks(fittedPeaksOld); } - m_peakResultOutput = generateResultTable(fittedPeaksNew); setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("ResultTableWorkspace", m_peakResultOutput); setProperty("FitPlotsWorkspace", m_fitplots); } @@ -349,38 +345,5 @@ IAlgorithm_sptr PoldiFitPeaks1D2::getFitAlgorithm(const Workspace2D_sptr &dataWo return fitAlgorithm; } -void PoldiFitPeaks1D2::initializePeakResultWorkspace(const DataObjects::TableWorkspace_sptr &peakResultWorkspace) const -{ - peakResultWorkspace->addColumn("str", "Q"); - peakResultWorkspace->addColumn("str", "d"); - peakResultWorkspace->addColumn("double", "deltaD/d *10^3"); - peakResultWorkspace->addColumn("str", "FWHM rel. *10^3"); - peakResultWorkspace->addColumn("str", "Intensity"); -} - -void PoldiFitPeaks1D2::storePeakResult(TableRow tableRow, const PoldiPeak_sptr &peak) const -{ - UncertainValue q = peak->q(); - UncertainValue d = peak->d(); - - tableRow << UncertainValueIO::toString(q) - << UncertainValueIO::toString(d) - << d.error() / d.value() * 1e3 - << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3) - << UncertainValueIO::toString(peak->intensity()); -} - -TableWorkspace_sptr PoldiFitPeaks1D2::generateResultTable(const PoldiPeakCollection_sptr &peaks) const -{ - TableWorkspace_sptr outputTable = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); - initializePeakResultWorkspace(outputTable); - - for(size_t i = 0; i < peaks->peakCount(); ++i) { - storePeakResult(outputTable->appendRow(), peaks->peak(i)); - } - - return outputTable; -} - } // namespace Poldi } // namespace Mantid diff --git a/Code/Mantid/docs/source/algorithms/PoldiCalculateSpectrum2D-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiCalculateSpectrum2D-v1.rst index 87a2cb348b96..7c688e72367e 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiCalculateSpectrum2D-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiCalculateSpectrum2D-v1.rst @@ -37,8 +37,7 @@ PoldiAutoCorrelation operates on a MatrixWorkspace with a valid POLDI instrument PoldiFitPeaks1D(InputWorkspace = correlated_6904, FwhmMultiples = 4.0, PeakFunction = "Gaussian", PoldiPeakTable = peaks_6904, - OutputWorkspace = "peaks_refined_6904", ResultTableWorkspace = "result_table_6904", - FitCharacteristicsWorkspace = "raw_fit_results_6904", + OutputWorkspace = "peaks_refined_6904", FitPlotsWorkspace = "fit_plots_6904") # Calculate a 2D spectrum using the refined peaks @@ -72,8 +71,7 @@ In general, there is a background in POLDI data that depends on :math:`2\theta`. PoldiFitPeaks1D(InputWorkspace = correlated_6904, FwhmMultiples = 4.0, PeakFunction = "Gaussian", PoldiPeakTable = peaks_6904, - OutputWorkspace = "peaks_refined_6904", ResultTableWorkspace = "result_table_6904", - FitCharacteristicsWorkspace = "raw_fit_results_6904", + OutputWorkspace = "peaks_refined_6904", FitPlotsWorkspace = "fit_plots_6904") # Calculate a 2D spectrum using the refined peaks - with background linear in 2theta diff --git a/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst index 50aacea59c4c..9c60215ef13c 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiPeakSummary-v1.rst @@ -32,7 +32,7 @@ Usage PoldiFitPeaks1D(InputWorkspace = correlated_6904, FwhmMultiples = 4.0, PeakFunction = "Gaussian", PoldiPeakTable = peaks_6904, - OutputWorkspace = "peaks_refined_6904", ResultTableWorkspace = "result_table_6904", + OutputWorkspace = "peaks_refined_6904", FitPlotsWorkspace = "fit_plots_6904") summary_6904 = PoldiPeakSummary(mtd["peaks_refined_6904"]) From fd72a2e5cdb5671909f9b246686d85ba1579c233 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Tue, 6 Jan 2015 10:10:32 +0100 Subject: [PATCH 015/130] Refs #10774. Typedef for Poldi2DFunction shared pointer --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h | 5 ++--- .../MantidSINQ/PoldiUtilities/Poldi2DFunction.h | 2 ++ .../Framework/SINQ/src/PoldiFitPeaks2D.cpp | 16 ++++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h index 1cafa2ea06b8..95534e37da04 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h @@ -73,10 +73,9 @@ class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm { PoldiPeakCollection_sptr getPeakCollectionFromFunction(const API::IFunction_sptr &fitFunction) const; - boost::shared_ptr getFunctionFromPeakCollection( + Poldi2DFunction_sptr getFunctionFromPeakCollection( const PoldiPeakCollection_sptr &peakCollection) const; - void - addBackgroundTerms(boost::shared_ptr poldi2DFunction) const; + void addBackgroundTerms(Poldi2DFunction_sptr poldi2DFunction) const; API::IAlgorithm_sptr calculateSpectrum(const PoldiPeakCollection_sptr &peakCollection, diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h index a9b5a09c23ba..bc17b31692ed 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h @@ -58,6 +58,8 @@ class MANTID_SINQ_DLL Poldi2DFunction : virtual public API::IFunction1DSpectrum, size_t m_iteration; }; +typedef boost::shared_ptr Poldi2DFunction_sptr; + } // namespace SINQ } // namespace Mantid diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 368a1ff38866..1c5bb354f7af 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -102,7 +102,7 @@ void PoldiFitPeaks2D::init() { */ PoldiPeakCollection_sptr PoldiFitPeaks2D::getPeakCollectionFromFunction( const IFunction_sptr &fitFunction) const { - boost::shared_ptr poldi2DFunction = + Poldi2DFunction_sptr poldi2DFunction = boost::dynamic_pointer_cast(fitFunction); if (!poldi2DFunction) { @@ -153,10 +153,9 @@ PoldiPeakCollection_sptr PoldiFitPeaks2D::getPeakCollectionFromFunction( *intensities * @return Poldi2DFunction with one PoldiSpectrumDomainFunction per peak */ -boost::shared_ptr -PoldiFitPeaks2D::getFunctionFromPeakCollection( +Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionFromPeakCollection( const PoldiPeakCollection_sptr &peakCollection) const { - boost::shared_ptr mdFunction(new Poldi2DFunction); + Poldi2DFunction_sptr mdFunction(new Poldi2DFunction); for (size_t i = 0; i < peakCollection->peakCount(); ++i) { PoldiPeak_sptr peak = peakCollection->peak(i); @@ -217,8 +216,8 @@ void PoldiFitPeaks2D::exec() { * * @param poldi2DFunction :: Poldi2DFunction to which the background is added. */ -void PoldiFitPeaks2D::addBackgroundTerms( - boost::shared_ptr poldi2DFunction) const { +void PoldiFitPeaks2D::addBackgroundTerms(Poldi2DFunction_sptr poldi2DFunction) + const { bool addConstantBackground = getProperty("FitConstantBackground"); if (addConstantBackground) { IFunction_sptr constantBackground = @@ -258,7 +257,7 @@ IAlgorithm_sptr PoldiFitPeaks2D::calculateSpectrum( PoldiPeakCollection_sptr normalizedPeakCollection = getNormalizedPeakCollection(integratedPeaks); - boost::shared_ptr mdFunction = + Poldi2DFunction_sptr mdFunction = getFunctionFromPeakCollection(normalizedPeakCollection); addBackgroundTerms(mdFunction); @@ -392,7 +391,8 @@ PoldiPeakCollection_sptr PoldiFitPeaks2D::getPeakCollection(const TableWorkspace_sptr &peakTable) const { try { return boost::make_shared(peakTable); - } catch (...) { + } + catch (...) { throw std::runtime_error("Could not initialize peak collection."); } } From 2366db7c1597123fe37fe1fa9f41ce4ccbb2331f Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 7 Jan 2015 09:34:40 +0100 Subject: [PATCH 016/130] Refs #10774. More recent parameter files for POLDI --- .../instrument/POLDI_Definition_2014d.xml | 2 +- .../instrument/POLDI_Definition_2014e.xml | 278 ++++++++++++++++++ .../instrument/POLDI_Definition_2014f.xml | 278 ++++++++++++++++++ .../instrument/POLDI_Parameters_2014d.xml | 6 +- .../instrument/POLDI_Parameters_2014e.xml | 258 ++++++++++++++++ .../instrument/POLDI_Parameters_2014f.xml | 258 ++++++++++++++++ 6 files changed, 1076 insertions(+), 4 deletions(-) create mode 100644 Code/Mantid/instrument/POLDI_Definition_2014e.xml create mode 100644 Code/Mantid/instrument/POLDI_Definition_2014f.xml create mode 100644 Code/Mantid/instrument/POLDI_Parameters_2014e.xml create mode 100644 Code/Mantid/instrument/POLDI_Parameters_2014f.xml diff --git a/Code/Mantid/instrument/POLDI_Definition_2014d.xml b/Code/Mantid/instrument/POLDI_Definition_2014d.xml index c2f74151a547..8229972d9ce2 100644 --- a/Code/Mantid/instrument/POLDI_Definition_2014d.xml +++ b/Code/Mantid/instrument/POLDI_Definition_2014d.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 Schema/IDFSchema.xsd" name="POLDI" - valid-from="2014-09-08 00:00:00" + valid-from="2014-09-07 00:00:00" last-modified="2014-09-10 00:00:00"> diff --git a/Code/Mantid/instrument/POLDI_Definition_2014e.xml b/Code/Mantid/instrument/POLDI_Definition_2014e.xml new file mode 100644 index 000000000000..10878c58b5bf --- /dev/null +++ b/Code/Mantid/instrument/POLDI_Definition_2014e.xml @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/Mantid/instrument/POLDI_Definition_2014f.xml b/Code/Mantid/instrument/POLDI_Definition_2014f.xml new file mode 100644 index 000000000000..1f9e54b73abc --- /dev/null +++ b/Code/Mantid/instrument/POLDI_Definition_2014f.xml @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/Mantid/instrument/POLDI_Parameters_2014d.xml b/Code/Mantid/instrument/POLDI_Parameters_2014d.xml index fe573287c6a5..099322c11b5c 100644 --- a/Code/Mantid/instrument/POLDI_Parameters_2014d.xml +++ b/Code/Mantid/instrument/POLDI_Parameters_2014d.xml @@ -1,12 +1,12 @@ - + - + @@ -15,7 +15,7 @@ - + diff --git a/Code/Mantid/instrument/POLDI_Parameters_2014e.xml b/Code/Mantid/instrument/POLDI_Parameters_2014e.xml new file mode 100644 index 000000000000..478bc35ecd97 --- /dev/null +++ b/Code/Mantid/instrument/POLDI_Parameters_2014e.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Code/Mantid/instrument/POLDI_Parameters_2014f.xml b/Code/Mantid/instrument/POLDI_Parameters_2014f.xml new file mode 100644 index 000000000000..fcd68cb1e5c1 --- /dev/null +++ b/Code/Mantid/instrument/POLDI_Parameters_2014f.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4ab70dc1f02a8886fa7173cce0b963fa906d5884 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 7 Jan 2015 09:35:32 +0100 Subject: [PATCH 017/130] Refs #10774. PoldiSpectrumDomainFunction has 1D method --- .../PoldiSpectrumDomainFunction.h | 3 ++ .../PoldiSpectrumDomainFunction.cpp | 34 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h index 42821f5f9ff9..6eebd538ee87 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h @@ -53,6 +53,9 @@ class MANTID_SINQ_DLL PoldiSpectrumDomainFunction virtual void function1DSpectrum(const API::FunctionDomain1DSpectrum &domain, API::FunctionValues &values) const; + void functionPoldi1D(size_t index, const API::FunctionDomain1D &domain, + API::FunctionValues &values) const; + protected: virtual void init(); void initializeParametersFromWorkspace( diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp index 00d36a647c1b..8f8e452d486f 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp @@ -117,6 +117,40 @@ void PoldiSpectrumDomainFunction::function1DSpectrum( } } +void +PoldiSpectrumDomainFunction::functionPoldi1D(size_t index, + const FunctionDomain1D &domain, + FunctionValues &values) const { + + double deltaD = domain[1] - domain[0]; + + double fwhm = getParameter("Fwhm"); + double fwhmChannel = fwhm / deltaD; + double sigmaChannel = fwhmChannel / (2.0 * sqrt(2.0 * log(2.0))); + + double centre = getParameter("Centre"); + + double area = getParameter("Area"); + double areaT = + m_timeTransformer->timeTransformedIntensity(area, centre, index); + + double centreTOffsetChannel = centre / deltaD; + int centreChannel = static_cast(centreTOffsetChannel); + int widthChannels = std::max(2, static_cast(fwhmChannel * 2.0)); + + int offset = static_cast(domain[0] / deltaD + 0.5); + + for (int i = centreChannel - widthChannels; + i <= centreChannel + widthChannels; ++i) { + double xValue = static_cast(i); + + values.addToCalculated( + i - offset, + actualFunction(xValue, centreTOffsetChannel, sigmaChannel, areaT) * + static_cast(m_chopperSlitOffsets.size())); + } +} + /** * Initializes function parameters */ From dde24518c53b41235784222e45691566ee37d2fa Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 7 Jan 2015 09:36:00 +0100 Subject: [PATCH 018/130] Refs #10774. Added 1d calculation to PoldiFitPeaks2D --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h | 6 + .../Framework/SINQ/src/PoldiFitPeaks2D.cpp | 106 +++++++++++++++++- 2 files changed, 109 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h index 95534e37da04..117e9fc9c199 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h @@ -85,6 +85,11 @@ class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm { API::IFunction_sptr getFunction(const API::IAlgorithm_sptr &fitAlgorithm) const; + API::MatrixWorkspace_sptr + get1DSpectrum(const API::IFunction_sptr &fitFunction, + const API::MatrixWorkspace_sptr &workspace) const; + + void setPoldiInstrument(const PoldiInstrumentAdapter_sptr &instrument); void setTimeTransformerFromInstrument( const PoldiInstrumentAdapter_sptr &poldiInstrument); void @@ -96,6 +101,7 @@ class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm { void throwOnInsufficientState(); + PoldiInstrumentAdapter_sptr m_poldiInstrument; PoldiTimeTransformer_sptr m_timeTransformer; double m_deltaT; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 1c5bb354f7af..086c557919e3 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -11,15 +11,19 @@ use the Build/wiki_maker.py script to generate your full wiki page. #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MultiDomainFunction.h" #include "MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h" +#include "MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h" +#include "MantidAPI/FunctionDomain1D.h" #include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" #include "MantidSINQ/PoldiUtilities/PoldiInstrumentAdapter.h" +#include "MantidSINQ/PoldiUtilities/PoldiDeadWireDecorator.h" #include "MantidSINQ/PoldiUtilities/PeakFunctionIntegrator.h" #include "MantidAPI/IPeakFunction.h" #include "MantidSINQ/PoldiUtilities/Poldi2DFunction.h" #include "boost/make_shared.hpp" +#include "MantidSINQ/PoldiUtilities/PoldiDGrid.h" namespace Mantid { namespace Poldi { @@ -33,7 +37,7 @@ using namespace DataObjects; /** Constructor */ PoldiFitPeaks2D::PoldiFitPeaks2D() - : Algorithm(), m_timeTransformer(), m_deltaT(0.0) {} + : Algorithm(), m_poldiInstrument(), m_timeTransformer(), m_deltaT(0.0) {} /** Destructor */ @@ -84,6 +88,10 @@ void PoldiFitPeaks2D::init() { declareProperty(new WorkspaceProperty("OutputWorkspace", "", Direction::Output), "Calculated POLDI 2D-spectrum"); + declareProperty(new WorkspaceProperty("Calculated1DSpectrum", + "", Direction::Output), + "Calculated POLDI 1D-spectrum."); + declareProperty(new WorkspaceProperty( "RefinedPoldiPeakWorkspace", "", Direction::Output), "Table workspace with fitted peaks."); @@ -182,8 +190,8 @@ void PoldiFitPeaks2D::exec() { MatrixWorkspace_sptr ws = getProperty("InputWorkspace"); setDeltaTFromWorkspace(ws); - setTimeTransformerFromInstrument( - boost::make_shared(ws)); + setPoldiInstrument(boost::make_shared(ws)); + setTimeTransformerFromInstrument(m_poldiInstrument); PoldiPeakCollection_sptr peakCollection = getPeakCollection(peakTable); @@ -196,6 +204,9 @@ void PoldiFitPeaks2D::exec() { IAlgorithm_sptr fitAlgorithm = calculateSpectrum(peakCollection, ws); IFunction_sptr fitFunction = getFunction(fitAlgorithm); + + MatrixWorkspace_sptr outWs1D = get1DSpectrum(fitFunction, ws); + PoldiPeakCollection_sptr normalizedPeaks = getPeakCollectionFromFunction(fitFunction); PoldiPeakCollection_sptr integralPeaks = @@ -205,6 +216,7 @@ void PoldiFitPeaks2D::exec() { setProperty("OutputWorkspace", getWorkspace(fitAlgorithm)); setProperty("RefinedPoldiPeakWorkspace", integralPeaks->asTableWorkspace()); + setProperty("Calculated1DSpectrum", outWs1D); } /** @@ -306,6 +318,94 @@ PoldiFitPeaks2D::getFunction(const IAlgorithm_sptr &fitAlgorithm) const { return fitFunction; } +MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( + const IFunction_sptr &fitFunction, + const API::MatrixWorkspace_sptr &workspace) const { + if (!m_poldiInstrument) { + throw std::runtime_error("No time transformer available."); + } + + if (!fitFunction) { + throw std::invalid_argument("Cannot process null-function."); + } + + boost::shared_ptr poldiFunction = + boost::dynamic_pointer_cast(fitFunction); + + if (!poldiFunction) { + throw std::invalid_argument("Can only process Poldi2DFunctions."); + } + + PoldiAbstractDetector_sptr detector(new PoldiDeadWireDecorator( + workspace->getInstrument(), m_poldiInstrument->detector())); + std::vector indices = detector->availableElements(); + + PoldiDGrid grid(detector, m_poldiInstrument->chopper(), m_deltaT, + std::make_pair(1.1, 5.0)); + + FunctionDomain1DVector domain(grid.grid()); + FunctionValues values(domain); + + for (size_t i = 0; i < poldiFunction->nFunctions(); ++i) { + IFunction_sptr currentFunction = poldiFunction->getFunction(i); + boost::shared_ptr spectrumFunction = + boost::dynamic_pointer_cast( + currentFunction); + + if (spectrumFunction) { + // std::cout << "Gauss: " << spectrumFunction->getParameter(3) << "+/-" << + // spectrumFunction->getError(3) << std::endl; + + for (size_t j = 0; j < indices.size(); ++j) { + spectrumFunction->functionPoldi1D(static_cast(indices[j]), + domain, values); + } + + continue; + } + + double factor = static_cast(indices.size()) * 500.0 / + static_cast(domain.size()); + + boost::shared_ptr linearBg = + boost::dynamic_pointer_cast( + currentFunction); + if (linearBg) { + double linearBgParam = linearBg->getParameter(0); + for (size_t j = 0; j < domain.size(); ++j) { + values.addToCalculated(j, linearBgParam * + static_cast(indices.size()) / + 2.0 * factor); + } + + continue; + } + + double constantBgParam = currentFunction->getParameter(0); + for (size_t j = 0; j < domain.size(); ++j) { + values.addToCalculated(j, constantBgParam * factor); + } + } + + MatrixWorkspace_sptr ws1D = WorkspaceFactory::Instance().create( + "Workspace2D", 1, domain.size(), values.size()); + + MantidVec &xData = ws1D->dataX(0); + MantidVec &yData = ws1D->dataY(0); + size_t offset = values.size() - 1; + for (size_t i = 0; i < values.size(); ++i) { + xData[offset - i] = Conversions::dToQ(domain[i]); + yData[offset - i] = values[i]; + } + + return ws1D; +} + +void PoldiFitPeaks2D::setPoldiInstrument( + const PoldiInstrumentAdapter_sptr &instrument) { + m_poldiInstrument = instrument; +} + /** * Constructs a PoldiTimeTransformer from given instrument and calls *setTimeTransformer. From 68994e0bae2cb78e6e8ad3d6c65070c656d48174 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 7 Jan 2015 11:05:37 +0100 Subject: [PATCH 019/130] Refs #10774. Added interface for POLDI 1d functions. --- Code/Mantid/Framework/SINQ/CMakeLists.txt | 2 + .../PoldiUtilities/IPoldiFunction1D.h | 52 +++++++++++++++++++ .../PoldiSpectrumDomainFunction.h | 7 ++- .../Framework/SINQ/src/PoldiFitPeaks2D.cpp | 14 ++--- .../src/PoldiUtilities/IPoldiFunction1D.cpp | 12 +++++ .../PoldiSpectrumDomainFunction.cpp | 43 +++++++-------- 6 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h create mode 100644 Code/Mantid/Framework/SINQ/src/PoldiUtilities/IPoldiFunction1D.cpp diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt b/Code/Mantid/Framework/SINQ/CMakeLists.txt index 38be718d4b2f..8c6650defdb3 100644 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/CMakeLists.txt @@ -16,6 +16,7 @@ set ( SRC_FILES src/PoldiPeakSearch.cpp src/PoldiRemoveDeadWires.cpp src/PoldiTruncateData.cpp + src/PoldiUtilities/IPoldiFunction1D.cpp src/PoldiUtilities/MillerIndices.cpp src/PoldiUtilities/PeakFunctionIntegrator.cpp src/PoldiUtilities/Poldi2DFunction.cpp @@ -62,6 +63,7 @@ set ( INC_FILES inc/MantidSINQ/PoldiPeakSearch.h inc/MantidSINQ/PoldiRemoveDeadWires.h inc/MantidSINQ/PoldiTruncateData.h + inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h inc/MantidSINQ/PoldiUtilities/MillerIndices.h inc/MantidSINQ/PoldiUtilities/MillerIndicesIO.h inc/MantidSINQ/PoldiUtilities/PeakFunctionIntegrator.h diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h new file mode 100644 index 000000000000..138503d0e3e7 --- /dev/null +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h @@ -0,0 +1,52 @@ +#ifndef MANTID_SINQ_IPOLDIFUNCTION1D_H_ +#define MANTID_SINQ_IPOLDIFUNCTION1D_H_ + +#include "MantidSINQ/DllConfig.h" +#include "MantidAPI/FunctionDomain1D.h" +#include "MantidAPI/FunctionValues.h" + +namespace Mantid { +namespace Poldi { + +/** IPoldiFunction1D : + + This is an auxilliary interface that has to be implemented by + functions that are supposed to be used for POLDI fits. + + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 14/03/2014 + + Copyright © 2014 PSI-MSS + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + File change history is stored at: + Code Documentation is available at: + */ +class MANTID_SINQ_DLL IPoldiFunction1D { +public: + IPoldiFunction1D(); + virtual ~IPoldiFunction1D() {} + + virtual void poldiFunction1D(const std::vector &indices, + const API::FunctionDomain1D &domain, + API::FunctionValues &values) const = 0; +}; + +} // namespace Poldi +} // namespace Mantid + +#endif /* MANTID_SINQ_IPOLDIFUNCTION1D_H_ */ diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h index 6eebd538ee87..429d1fdc102c 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h @@ -7,6 +7,7 @@ #include "MantidAPI/FunctionDomain1D.h" #include +#include "MantidSINQ/PoldiUtilities/IPoldiFunction1D.h" #include "MantidSINQ/PoldiUtilities/PoldiInstrumentAdapter.h" #include "MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h" @@ -42,7 +43,8 @@ namespace Poldi { class MANTID_SINQ_DLL PoldiSpectrumDomainFunction : virtual public API::ParamFunction, - virtual public API::IFunction1DSpectrum { + virtual public API::IFunction1DSpectrum, + public IPoldiFunction1D { public: PoldiSpectrumDomainFunction(); virtual ~PoldiSpectrumDomainFunction() {} @@ -53,7 +55,8 @@ class MANTID_SINQ_DLL PoldiSpectrumDomainFunction virtual void function1DSpectrum(const API::FunctionDomain1DSpectrum &domain, API::FunctionValues &values) const; - void functionPoldi1D(size_t index, const API::FunctionDomain1D &domain, + void poldiFunction1D(const std::vector &indices, + const API::FunctionDomain1D &domain, API::FunctionValues &values) const; protected: diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 086c557919e3..52bdc419c398 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -14,6 +14,7 @@ use the Build/wiki_maker.py script to generate your full wiki page. #include "MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h" #include "MantidAPI/FunctionDomain1D.h" +#include "MantidSINQ/PoldiUtilities/IPoldiFunction1D.h" #include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" #include "MantidSINQ/PoldiUtilities/PoldiInstrumentAdapter.h" #include "MantidSINQ/PoldiUtilities/PoldiDeadWireDecorator.h" @@ -348,19 +349,12 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( for (size_t i = 0; i < poldiFunction->nFunctions(); ++i) { IFunction_sptr currentFunction = poldiFunction->getFunction(i); - boost::shared_ptr spectrumFunction = - boost::dynamic_pointer_cast( + boost::shared_ptr spectrumFunction = + boost::dynamic_pointer_cast( currentFunction); if (spectrumFunction) { - // std::cout << "Gauss: " << spectrumFunction->getParameter(3) << "+/-" << - // spectrumFunction->getError(3) << std::endl; - - for (size_t j = 0; j < indices.size(); ++j) { - spectrumFunction->functionPoldi1D(static_cast(indices[j]), - domain, values); - } - + spectrumFunction->poldiFunction1D(indices, domain, values); continue; } diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/IPoldiFunction1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/IPoldiFunction1D.cpp new file mode 100644 index 000000000000..ac9060a93a16 --- /dev/null +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/IPoldiFunction1D.cpp @@ -0,0 +1,12 @@ +#include "MantidSINQ/PoldiUtilities/IPoldiFunction1D.h" + +namespace Mantid { +namespace Poldi { + +//---------------------------------------------------------------------------------------------- +/** Constructor + */ +IPoldiFunction1D::IPoldiFunction1D() {} + +} // namespace SINQ +} // namespace Mantid diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp index 8f8e452d486f..7e2ddc44b6e7 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp @@ -118,36 +118,37 @@ void PoldiSpectrumDomainFunction::function1DSpectrum( } void -PoldiSpectrumDomainFunction::functionPoldi1D(size_t index, +PoldiSpectrumDomainFunction::poldiFunction1D(const std::vector &indices, const FunctionDomain1D &domain, FunctionValues &values) const { + for (auto index = indices.begin(); index != indices.end(); ++index) { + double deltaD = domain[1] - domain[0]; - double deltaD = domain[1] - domain[0]; + double fwhm = getParameter("Fwhm"); + double fwhmChannel = fwhm / deltaD; + double sigmaChannel = fwhmChannel / (2.0 * sqrt(2.0 * log(2.0))); - double fwhm = getParameter("Fwhm"); - double fwhmChannel = fwhm / deltaD; - double sigmaChannel = fwhmChannel / (2.0 * sqrt(2.0 * log(2.0))); - - double centre = getParameter("Centre"); + double centre = getParameter("Centre"); - double area = getParameter("Area"); - double areaT = - m_timeTransformer->timeTransformedIntensity(area, centre, index); + double area = getParameter("Area"); + double areaT = m_timeTransformer->timeTransformedIntensity( + area, centre, static_cast(*index)); - double centreTOffsetChannel = centre / deltaD; - int centreChannel = static_cast(centreTOffsetChannel); - int widthChannels = std::max(2, static_cast(fwhmChannel * 2.0)); + double centreTOffsetChannel = centre / deltaD; + int centreChannel = static_cast(centreTOffsetChannel); + int widthChannels = std::max(2, static_cast(fwhmChannel * 2.0)); - int offset = static_cast(domain[0] / deltaD + 0.5); + int offset = static_cast(domain[0] / deltaD + 0.5); - for (int i = centreChannel - widthChannels; - i <= centreChannel + widthChannels; ++i) { - double xValue = static_cast(i); + for (int i = centreChannel - widthChannels; + i <= centreChannel + widthChannels; ++i) { + double xValue = static_cast(i); - values.addToCalculated( - i - offset, - actualFunction(xValue, centreTOffsetChannel, sigmaChannel, areaT) * - static_cast(m_chopperSlitOffsets.size())); + values.addToCalculated( + i - offset, + actualFunction(xValue, centreTOffsetChannel, sigmaChannel, areaT) * + static_cast(m_chopperSlitOffsets.size())); + } } } From c07be4c936f8f96494727267c0fe71ee02ed9442 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 7 Jan 2015 13:39:58 +0100 Subject: [PATCH 020/130] Refs #10774. PoldiSpectrumLinearBackground uses workspace. --- .../PoldiSpectrumLinearBackground.h | 5 +++++ .../PoldiSpectrumLinearBackground.cpp | 17 ++++++++++++++++- .../test/PoldiSpectrumLinearBackgroundTest.h | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h index 55e7d25f8b79..02fe96fc6c5c 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h @@ -50,6 +50,9 @@ class MANTID_SINQ_DLL PoldiSpectrumLinearBackground virtual std::string name() const { return "PoldiSpectrumLinearBackground"; } + virtual void setWorkspace(boost::shared_ptr ws); + size_t getTimeBinCount() const; + virtual void function1DSpectrum(const API::FunctionDomain1DSpectrum &domain, API::FunctionValues &values) const; virtual void @@ -58,6 +61,8 @@ class MANTID_SINQ_DLL PoldiSpectrumLinearBackground protected: void init(); + + size_t m_timeBinCount; }; } // namespace Poldi diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp index 0c88a25550ad..bdef45b7488a 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp @@ -1,5 +1,6 @@ #include "MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h" #include "MantidAPI/FunctionFactory.h" +#include "MantidAPI/MatrixWorkspace.h" namespace Mantid { namespace Poldi { @@ -10,7 +11,21 @@ DECLARE_FUNCTION(PoldiSpectrumLinearBackground) /// Default constructor PoldiSpectrumLinearBackground::PoldiSpectrumLinearBackground() - : ParamFunction(), IFunction1DSpectrum() {} + : ParamFunction(), IFunction1DSpectrum(), m_timeBinCount(0) {} + +void PoldiSpectrumLinearBackground::setWorkspace(boost::shared_ptr ws) +{ + MatrixWorkspace_const_sptr matrixWs = boost::dynamic_pointer_cast(ws); + + if(matrixWs && matrixWs->getNumberHistograms() > 0) { + m_timeBinCount = matrixWs->readX(0).size(); + } +} + +size_t PoldiSpectrumLinearBackground::getTimeBinCount() const +{ + return m_timeBinCount; +} /// Calculates the function values as f(x) = A1 * wi void PoldiSpectrumLinearBackground::function1DSpectrum( diff --git a/Code/Mantid/Framework/SINQ/test/PoldiSpectrumLinearBackgroundTest.h b/Code/Mantid/Framework/SINQ/test/PoldiSpectrumLinearBackgroundTest.h index 598d851c1320..78237dc8242b 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiSpectrumLinearBackgroundTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiSpectrumLinearBackgroundTest.h @@ -50,6 +50,25 @@ class PoldiSpectrumLinearBackgroundTest : public CxxTest::TestSuite TS_ASSERT(function); } + void testSetWorkspace() + { + IFunction_sptr function = FunctionFactory::Instance().createFunction("PoldiSpectrumLinearBackground"); + boost::shared_ptr castedFunction = boost::dynamic_pointer_cast(function); + + // default is 0 + TS_ASSERT_EQUALS(castedFunction->getTimeBinCount(), 0); + + // invalid workspace, nothing happens + MatrixWorkspace_const_sptr invalid; + TS_ASSERT_THROWS_NOTHING(castedFunction->setWorkspace(invalid)); + TS_ASSERT_EQUALS(castedFunction->getTimeBinCount(), 0); + + // valid workspace with 10 bins + MatrixWorkspace_sptr ws = WorkspaceCreationHelper::Create2DWorkspace123(1, 10); + TS_ASSERT_THROWS_NOTHING(castedFunction->setWorkspace(ws)); + TS_ASSERT_EQUALS(castedFunction->getTimeBinCount(), 10); + } + void testFunctionValue() { IFunction_sptr function = FunctionFactory::Instance().createFunction("PoldiSpectrumLinearBackground"); From 3e269136ceb020d87c0723a8d62b60d4a1ff8fb9 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 7 Jan 2015 15:57:31 +0100 Subject: [PATCH 021/130] Refs #10774. PoldiSpectrumLinearBackground implements IPoldiFunction1D --- .../PoldiSpectrumLinearBackground.h | 8 +++- .../Framework/SINQ/src/PoldiFitPeaks2D.cpp | 19 +--------- .../PoldiSpectrumLinearBackground.cpp | 37 ++++++++++++++----- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h index 02fe96fc6c5c..197e47677e61 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h @@ -4,6 +4,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidAPI/ParamFunction.h" #include "MantidAPI/IFunction1DSpectrum.h" +#include "MantidSINQ/PoldiUtilities/IPoldiFunction1D.h" namespace Mantid { namespace Poldi { @@ -43,7 +44,8 @@ namespace Poldi { */ class MANTID_SINQ_DLL PoldiSpectrumLinearBackground : virtual public API::ParamFunction, - virtual public API::IFunction1DSpectrum { + virtual public API::IFunction1DSpectrum, + public IPoldiFunction1D { public: PoldiSpectrumLinearBackground(); virtual ~PoldiSpectrumLinearBackground() {} @@ -59,6 +61,10 @@ class MANTID_SINQ_DLL PoldiSpectrumLinearBackground functionDeriv1DSpectrum(const API::FunctionDomain1DSpectrum &domain, API::Jacobian &jacobian); + virtual void poldiFunction1D(const std::vector &indices, + const API::FunctionDomain1D &domain, + API::FunctionValues &values) const; + protected: void init(); diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 52bdc419c398..bb5c684e122a 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -350,31 +350,16 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( for (size_t i = 0; i < poldiFunction->nFunctions(); ++i) { IFunction_sptr currentFunction = poldiFunction->getFunction(i); boost::shared_ptr spectrumFunction = - boost::dynamic_pointer_cast( - currentFunction); + boost::dynamic_pointer_cast(currentFunction); if (spectrumFunction) { - spectrumFunction->poldiFunction1D(indices, domain, values); + spectrumFunction->poldiFunction1D(indices, domain, values); continue; } double factor = static_cast(indices.size()) * 500.0 / static_cast(domain.size()); - boost::shared_ptr linearBg = - boost::dynamic_pointer_cast( - currentFunction); - if (linearBg) { - double linearBgParam = linearBg->getParameter(0); - for (size_t j = 0; j < domain.size(); ++j) { - values.addToCalculated(j, linearBgParam * - static_cast(indices.size()) / - 2.0 * factor); - } - - continue; - } - double constantBgParam = currentFunction->getParameter(0); for (size_t j = 0; j < domain.size(); ++j) { values.addToCalculated(j, constantBgParam * factor); diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp index bdef45b7488a..8d110413af8d 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp @@ -11,20 +11,21 @@ DECLARE_FUNCTION(PoldiSpectrumLinearBackground) /// Default constructor PoldiSpectrumLinearBackground::PoldiSpectrumLinearBackground() - : ParamFunction(), IFunction1DSpectrum(), m_timeBinCount(0) {} + : ParamFunction(), IFunction1DSpectrum(), IPoldiFunction1D(), + m_timeBinCount(0) {} -void PoldiSpectrumLinearBackground::setWorkspace(boost::shared_ptr ws) -{ - MatrixWorkspace_const_sptr matrixWs = boost::dynamic_pointer_cast(ws); +void PoldiSpectrumLinearBackground::setWorkspace( + boost::shared_ptr ws) { + MatrixWorkspace_const_sptr matrixWs = + boost::dynamic_pointer_cast(ws); - if(matrixWs && matrixWs->getNumberHistograms() > 0) { - m_timeBinCount = matrixWs->readX(0).size(); - } + if (matrixWs && matrixWs->getNumberHistograms() > 0) { + m_timeBinCount = matrixWs->readX(0).size(); + } } -size_t PoldiSpectrumLinearBackground::getTimeBinCount() const -{ - return m_timeBinCount; +size_t PoldiSpectrumLinearBackground::getTimeBinCount() const { + return m_timeBinCount; } /// Calculates the function values as f(x) = A1 * wi @@ -45,6 +46,22 @@ void PoldiSpectrumLinearBackground::functionDeriv1DSpectrum( } } +void +PoldiSpectrumLinearBackground::poldiFunction1D(const std::vector &indices, + const FunctionDomain1D &domain, + FunctionValues &values) const { + double backgroundDetector = getParameter(0); + double wireCount = static_cast(indices.size()); + double distributionFactor = wireCount * wireCount * + static_cast(m_timeBinCount) / + (2.0 * static_cast(domain.size())); + double backgroundD = backgroundDetector * distributionFactor; + + for (size_t i = 0; i < values.size(); ++i) { + values.addToCalculated(i, backgroundD); + } +} + /// Declares the function's single parameter A1. void PoldiSpectrumLinearBackground::init() { declareParameter("A1"); } From 20509324473681be8c05a15e726778ef92d911e5 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 8 Jan 2015 08:42:15 +0100 Subject: [PATCH 022/130] Refs #10774. Added PoldiSpectrumConstantBackground This function inherits from FlatBackground and implements IPoldiFunction1D. --- Code/Mantid/Framework/SINQ/CMakeLists.txt | 7 +- .../PoldiSpectrumConstantBackground.h | 62 +++++++++++++++ .../PoldiSpectrumConstantBackground.cpp | 49 ++++++++++++ .../PoldiSpectrumConstantBackgroundTest.h | 79 +++++++++++++++++++ 4 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h create mode 100644 Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp create mode 100644 Code/Mantid/Framework/SINQ/test/PoldiSpectrumConstantBackgroundTest.h diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt b/Code/Mantid/Framework/SINQ/CMakeLists.txt index 8c6650defdb3..e38ecd28e68a 100644 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/CMakeLists.txt @@ -35,6 +35,7 @@ set ( SRC_FILES src/PoldiUtilities/PoldiResidualCorrelationCore.cpp src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp src/PoldiUtilities/PoldiSourceSpectrum.cpp + src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp src/PoldiUtilities/PoldiTimeTransformer.cpp src/PoldiUtilities/UncertainValue.cpp @@ -84,6 +85,7 @@ set ( INC_FILES inc/MantidSINQ/PoldiUtilities/PoldiPeak.h inc/MantidSINQ/PoldiUtilities/PoldiPeakCollection.h inc/MantidSINQ/PoldiUtilities/PoldiResidualCorrelationCore.h + inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h inc/MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h @@ -124,6 +126,7 @@ set ( TEST_FILES PoldiResidualCorrelationCoreTest.h PoldiSourceSpectrumTest.h PoldiSpectrumDomainFunctionTest.h + PoldiSpectrumConstantBackgroundTest.h PoldiSpectrumLinearBackgroundTest.h PoldiTimeTransformerTest.h PoldiTruncateDataTest.h @@ -144,9 +147,9 @@ set_target_properties ( SINQ PROPERTIES OUTPUT_NAME MantidSINQ # Add to the 'Framework' group in VS set_property ( TARGET SINQ PROPERTY FOLDER "MantidFramework" ) -include_directories ( inc ../MDEvents/inc ) +include_directories ( inc ../MDEvents/inc ../CurveFitting/inc ) -target_link_libraries ( SINQ ${MANTIDLIBS} MDEvents ) +target_link_libraries ( SINQ ${MANTIDLIBS} MDEvents CurveFitting ) # Add the unit tests directory add_subdirectory ( test ) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h new file mode 100644 index 000000000000..2b444e0f654d --- /dev/null +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h @@ -0,0 +1,62 @@ +#ifndef MANTID_SINQ_POLDISPECTRUMCONSTANTBACKGROUND_H_ +#define MANTID_SINQ_POLDISPECTRUMCONSTANTBACKGROUND_H_ + +#include "MantidSINQ/DllConfig.h" +#include "MantidCurveFitting/FlatBackground.h" +#include "MantidSINQ/PoldiUtilities/IPoldiFunction1D.h" + +namespace Mantid { +namespace Poldi { + +/** PoldiSpectrumConstantBackground + + The function inherits from FlatBackground and also implements the + IPoldiFunction1D interface. + + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 07/01/2015 + + Copyright © 2015 PSI-MSS + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + File change history is stored at: + Code Documentation is available at: + */ +class MANTID_SINQ_DLL PoldiSpectrumConstantBackground + : public CurveFitting::FlatBackground, + public IPoldiFunction1D { +public: + PoldiSpectrumConstantBackground(); + virtual ~PoldiSpectrumConstantBackground(); + + virtual std::string name() const { return "PoldiSpectrumConstantBackground"; } + + virtual void setWorkspace(boost::shared_ptr ws); + size_t getTimeBinCount() const; + + virtual void poldiFunction1D(const std::vector &indices, + const API::FunctionDomain1D &domain, + API::FunctionValues &values) const; + +protected: + size_t m_timeBinCount; +}; + +} // namespace Poldi +} // namespace Mantid + +#endif /* MANTID_SINQ_POLDISPECTRUMCONSTANTBACKGROUND_H_ */ diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp new file mode 100644 index 000000000000..3473eb28eff5 --- /dev/null +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp @@ -0,0 +1,49 @@ +#include "MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h" +#include "MantidAPI/FunctionFactory.h" +#include "MantidAPI/MatrixWorkspace.h" + +namespace Mantid { +namespace Poldi { + +using namespace CurveFitting; +using namespace API; + +DECLARE_FUNCTION(PoldiSpectrumConstantBackground) + +/// Default constructor +PoldiSpectrumConstantBackground::PoldiSpectrumConstantBackground() + : FlatBackground(), IPoldiFunction1D(), m_timeBinCount(0) {} + +/// Destructor +PoldiSpectrumConstantBackground::~PoldiSpectrumConstantBackground() {} + +void PoldiSpectrumConstantBackground::setWorkspace( + boost::shared_ptr ws) { + MatrixWorkspace_const_sptr matrixWs = + boost::dynamic_pointer_cast(ws); + + if (matrixWs && matrixWs->getNumberHistograms() > 0) { + m_timeBinCount = matrixWs->readX(0).size(); + } +} + +size_t PoldiSpectrumConstantBackground::getTimeBinCount() const { + return m_timeBinCount; +} + +void PoldiSpectrumConstantBackground::poldiFunction1D( + const std::vector &indices, const API::FunctionDomain1D &domain, + API::FunctionValues &values) const { + double backgroundDetector = getParameter(0); + double wireCount = static_cast(indices.size()); + double distributionFactor = wireCount * static_cast(m_timeBinCount) / + static_cast(domain.size()); + double backgroundD = backgroundDetector * distributionFactor; + + for (size_t i = 0; i < values.size(); ++i) { + values.addToCalculated(i, backgroundD); + } +} + +} // namespace SINQ +} // namespace Mantid diff --git a/Code/Mantid/Framework/SINQ/test/PoldiSpectrumConstantBackgroundTest.h b/Code/Mantid/Framework/SINQ/test/PoldiSpectrumConstantBackgroundTest.h new file mode 100644 index 000000000000..2acf6175aa50 --- /dev/null +++ b/Code/Mantid/Framework/SINQ/test/PoldiSpectrumConstantBackgroundTest.h @@ -0,0 +1,79 @@ +#ifndef MANTID_SINQ_POLDISPECTRUMCONSTANTBACKGROUNDTEST_H_ +#define MANTID_SINQ_POLDISPECTRUMCONSTANTBACKGROUNDTEST_H_ + +#include + +#include "MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h" + +#include "MantidAPI/FrameworkManager.h" +#include "MantidAPI/FunctionFactory.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + +using namespace Mantid::API; +using namespace Mantid::Poldi; + +class PoldiSpectrumConstantBackgroundTest : public CxxTest::TestSuite +{ +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static PoldiSpectrumConstantBackgroundTest *createSuite() { return new PoldiSpectrumConstantBackgroundTest(); } + static void destroySuite( PoldiSpectrumConstantBackgroundTest *suite ) { delete suite; } + + PoldiSpectrumConstantBackgroundTest() + { + FrameworkManager::Instance(); + } + + void testParameterCount() + { + PoldiSpectrumConstantBackground function; + function.initialize(); + + TS_ASSERT_EQUALS(function.nParams(), 1); + } + + void testFunction() + { + IFunction_sptr function = FunctionFactory::Instance().createFunction("PoldiSpectrumConstantBackground"); + MatrixWorkspace_sptr ws = WorkspaceCreationHelper::Create2DWorkspaceWhereYIsWorkspaceIndex(20, 2); + + TS_ASSERT_THROWS_NOTHING(function->setWorkspace(ws)); + function->setParameter(0, 10.0); + + FunctionDomain1DVector domain(ws->readX(0)); + FunctionValues values(domain); + + function->function(domain, values); + + TS_ASSERT_EQUALS(values[0], 10.0); + TS_ASSERT_EQUALS(values[1], 10.0); + } + + void testPoldiFunction1D() + { + IFunction_sptr function = FunctionFactory::Instance().createFunction("PoldiSpectrumConstantBackground"); + MatrixWorkspace_sptr ws = WorkspaceCreationHelper::Create2DWorkspace123(20, 2); + + TS_ASSERT_THROWS_NOTHING(function->setWorkspace(ws)); + function->setParameter(0, 10.0); + + FunctionDomain1DVector domain(0.0, 10.0, 100); + FunctionValues values(domain); + + // workspace has 20 spectra, value does not matter for function + std::vector indices(20, 1); + + boost::shared_ptr poldiFunction = boost::dynamic_pointer_cast(function); + TS_ASSERT(poldiFunction); + poldiFunction->poldiFunction1D(indices, domain, values); + + for(size_t i = 0; i < values.size(); ++i) { + TS_ASSERT_EQUALS(values[i], 4.0) + } + } + +}; + + +#endif /* MANTID_SINQ_POLDISPECTRUMCONSTANTBACKGROUNDTEST_H_ */ From 351d15e2e749fcd64e207e7e45033275dbf743e6 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 8 Jan 2015 08:42:38 +0100 Subject: [PATCH 023/130] Refs #10774. Replaced FlatBackground function in PoldiFitPeaks2D --- Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index bb5c684e122a..bbfaaac031b6 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -234,7 +234,7 @@ void PoldiFitPeaks2D::addBackgroundTerms(Poldi2DFunction_sptr poldi2DFunction) bool addConstantBackground = getProperty("FitConstantBackground"); if (addConstantBackground) { IFunction_sptr constantBackground = - FunctionFactory::Instance().createFunction("FlatBackground"); + FunctionFactory::Instance().createFunction("PoldiSpectrumConstantBackground"); constantBackground->setParameter( 0, getProperty("ConstantBackgroundParameter")); poldi2DFunction->addFunction(constantBackground); @@ -354,15 +354,6 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( if (spectrumFunction) { spectrumFunction->poldiFunction1D(indices, domain, values); - continue; - } - - double factor = static_cast(indices.size()) * 500.0 / - static_cast(domain.size()); - - double constantBgParam = currentFunction->getParameter(0); - for (size_t j = 0; j < domain.size(); ++j) { - values.addToCalculated(j, constantBgParam * factor); } } From 829ddd26f5ae81c1a06aea051c7ed570ddf09bd8 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 8 Jan 2015 09:44:59 +0100 Subject: [PATCH 024/130] Refs #10774. Put calculation into Poldi2DFunction. --- .../PoldiUtilities/Poldi2DFunction.h | 8 ++++- .../Framework/SINQ/src/PoldiFitPeaks2D.cpp | 23 ++++-------- .../src/PoldiUtilities/Poldi2DFunction.cpp | 25 +++++++++++++ .../Framework/SINQ/test/Poldi2DFunctionTest.h | 36 +++++++++++++++++++ 4 files changed, 74 insertions(+), 18 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h index bc17b31692ed..1ef261895b76 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h @@ -5,6 +5,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/IFunction1DSpectrum.h" +#include "MantidSINQ/PoldiUtilities/IPoldiFunction1D.h" namespace Mantid { namespace Poldi { @@ -39,7 +40,8 @@ namespace Poldi { Code Documentation is available at: */ class MANTID_SINQ_DLL Poldi2DFunction : virtual public API::IFunction1DSpectrum, - virtual public API::CompositeFunction { + virtual public API::CompositeFunction, + public IPoldiFunction1D { public: Poldi2DFunction(); virtual ~Poldi2DFunction() {} @@ -52,6 +54,10 @@ class MANTID_SINQ_DLL Poldi2DFunction : virtual public API::IFunction1DSpectrum, virtual void function1DSpectrum(const API::FunctionDomain1DSpectrum &domain, API::FunctionValues &values) const; + virtual void poldiFunction1D(const std::vector &indices, + const API::FunctionDomain1D &domain, + API::FunctionValues &values) const; + void iterationFinished(); private: diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index bbfaaac031b6..c8c2b383da52 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -234,7 +234,8 @@ void PoldiFitPeaks2D::addBackgroundTerms(Poldi2DFunction_sptr poldi2DFunction) bool addConstantBackground = getProperty("FitConstantBackground"); if (addConstantBackground) { IFunction_sptr constantBackground = - FunctionFactory::Instance().createFunction("PoldiSpectrumConstantBackground"); + FunctionFactory::Instance().createFunction( + "PoldiSpectrumConstantBackground"); constantBackground->setParameter( 0, getProperty("ConstantBackgroundParameter")); poldi2DFunction->addFunction(constantBackground); @@ -323,15 +324,11 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( const IFunction_sptr &fitFunction, const API::MatrixWorkspace_sptr &workspace) const { if (!m_poldiInstrument) { - throw std::runtime_error("No time transformer available."); - } - - if (!fitFunction) { - throw std::invalid_argument("Cannot process null-function."); + throw std::runtime_error("No POLDI instrument available."); } - boost::shared_ptr poldiFunction = - boost::dynamic_pointer_cast(fitFunction); + boost::shared_ptr poldiFunction = + boost::dynamic_pointer_cast(fitFunction); if (!poldiFunction) { throw std::invalid_argument("Can only process Poldi2DFunctions."); @@ -347,15 +344,7 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( FunctionDomain1DVector domain(grid.grid()); FunctionValues values(domain); - for (size_t i = 0; i < poldiFunction->nFunctions(); ++i) { - IFunction_sptr currentFunction = poldiFunction->getFunction(i); - boost::shared_ptr spectrumFunction = - boost::dynamic_pointer_cast(currentFunction); - - if (spectrumFunction) { - spectrumFunction->poldiFunction1D(indices, domain, values); - } - } + poldiFunction->poldiFunction1D(indices, domain, values); MatrixWorkspace_sptr ws1D = WorkspaceFactory::Instance().create( "Workspace2D", 1, domain.size(), values.size()); diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/Poldi2DFunction.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/Poldi2DFunction.cpp index 2bce3e96db96..8a29489e2a37 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/Poldi2DFunction.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/Poldi2DFunction.cpp @@ -57,6 +57,31 @@ void Poldi2DFunction::function1DSpectrum(const FunctionDomain1DSpectrum &domain, UNUSED_ARG(values); } +/** + * Calculates the 1D spectrum for this function + * + * This method checks all member functions whether they implement the + * IPoldiFunction1D interface. Those who do are used for calculating + * the function on the 1D d-domain. + * + * @param indices :: Allowed workspace indices. + * @param domain :: d-based 1D-domain. + * @param values :: Function values. + */ +void Poldi2DFunction::poldiFunction1D(const std::vector &indices, + const FunctionDomain1D &domain, + FunctionValues &values) const { + for (size_t i = 0; i < nFunctions(); ++i) { + IFunction_sptr currentFunction = getFunction(i); + boost::shared_ptr spectrumFunction = + boost::dynamic_pointer_cast(currentFunction); + + if (spectrumFunction) { + spectrumFunction->poldiFunction1D(indices, domain, values); + } + } +} + void Poldi2DFunction::iterationFinished() { ++m_iteration; } } // namespace Poldi diff --git a/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h b/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h index dfa5170163dc..f7707144889a 100644 --- a/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h +++ b/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h @@ -89,6 +89,29 @@ class Poldi2DFunctionTest : public CxxTest::TestSuite } } + void testPoldiFunction1D() + { + boost::shared_ptr function2D(new Poldi2DFunction); + + IFunction_sptr first(new SummingFunction); + IFunction_sptr second(new TestPoldiFunction1D); + + function2D->addFunction(first); + function2D->addFunction(second); + + // indices for poldiFunction1D + std::vector indices(10, 0.0); + + FunctionDomain1DVector domain(0.0, 10.0, 11); + FunctionValues values(domain); + + function2D->poldiFunction1D(indices, domain, values); + + for(size_t i = 0; i < values.size(); ++i) { + TS_ASSERT_EQUALS(values[i], static_cast(i) + 10.0) + } + } + private: /* small test function that behaves like PoldiSpectrumDomainFunction * in that it uses FunctionValues::addToCalculated. @@ -110,6 +133,19 @@ class Poldi2DFunctionTest : public CxxTest::TestSuite UNUSED_ARG(domain); UNUSED_ARG(jacobian); } + }; + + class TestPoldiFunction1D : public SummingFunction, public IPoldiFunction1D + { + public: + void poldiFunction1D(const std::vector &indices, const FunctionDomain1D &domain, FunctionValues &values) const + { + double totalSize = static_cast(indices.size()); + + for(size_t i = 0; i < values.size(); ++i) { + values.addToCalculated(i, domain[i] + totalSize); + } + } }; From 2781d9bca4beddba42039718239c4da95ae12454 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 8 Jan 2015 10:19:21 +0100 Subject: [PATCH 025/130] Refs #10774. Refactoring method for 1D spectrum. --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h | 4 +++ .../Framework/SINQ/src/PoldiFitPeaks2D.cpp | 32 +++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h index 117e9fc9c199..dc3d2cf70ccf 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h @@ -89,6 +89,10 @@ class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm { get1DSpectrum(const API::IFunction_sptr &fitFunction, const API::MatrixWorkspace_sptr &workspace) const; + API::MatrixWorkspace_sptr + getQSpectrum(const API::FunctionDomain &domain, + const API::FunctionValues &values) const; + void setPoldiInstrument(const PoldiInstrumentAdapter_sptr &instrument); void setTimeTransformerFromInstrument( const PoldiInstrumentAdapter_sptr &poldiInstrument); diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index c8c2b383da52..1d1d192cbc93 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -310,6 +310,7 @@ PoldiFitPeaks2D::getWorkspace(const IAlgorithm_sptr &fitAlgorithm) const { return outputWorkspace; } +/// Extracts the fit function from the fit algorithm IFunction_sptr PoldiFitPeaks2D::getFunction(const IAlgorithm_sptr &fitAlgorithm) const { if (!fitAlgorithm) { @@ -320,13 +321,22 @@ PoldiFitPeaks2D::getFunction(const IAlgorithm_sptr &fitAlgorithm) const { return fitFunction; } +/** + * Calculates the 1D diffractogram based on the supplied function + * + * This method takes a fit function and checks whether it implements the + * IPoldiFunction1D interface. If that's the case, it calculates the + * diffractogram based on the function. + * + * @param fitFunction :: IFunction that also implements IPoldiFunction1D. + * @param workspace :: Workspace with POLDI raw data. + * @return :: Q-based diffractogram. + */ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( const IFunction_sptr &fitFunction, const API::MatrixWorkspace_sptr &workspace) const { - if (!m_poldiInstrument) { - throw std::runtime_error("No POLDI instrument available."); - } + // Check whether the function is of correct type boost::shared_ptr poldiFunction = boost::dynamic_pointer_cast(fitFunction); @@ -334,18 +344,34 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( throw std::invalid_argument("Can only process Poldi2DFunctions."); } + // And that we have an instrument available + if (!m_poldiInstrument) { + throw std::runtime_error("No POLDI instrument available."); + } + PoldiAbstractDetector_sptr detector(new PoldiDeadWireDecorator( workspace->getInstrument(), m_poldiInstrument->detector())); std::vector indices = detector->availableElements(); + // Create the grid for the diffractogram and corresponding domain/values PoldiDGrid grid(detector, m_poldiInstrument->chopper(), m_deltaT, std::make_pair(1.1, 5.0)); FunctionDomain1DVector domain(grid.grid()); FunctionValues values(domain); + // Calculate 1D function poldiFunction->poldiFunction1D(indices, domain, values); + // Create and return Q-based workspace with spectrum + return getQSpectrum(domain, values); +} + +/// Takes a d-based domain and creates a Q-based MatrixWorkspace. +MatrixWorkspace_sptr +PoldiFitPeaks2D::getQSpectrum(const FunctionDomain &domain, + const FunctionValues &values) const { + // Put result into workspace, based on Q MatrixWorkspace_sptr ws1D = WorkspaceFactory::Instance().create( "Workspace2D", 1, domain.size(), values.size()); From d35d6e30242af395c464bb16f76d4e009e1586bd Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 8 Jan 2015 10:32:03 +0100 Subject: [PATCH 026/130] Refs #10774. Fixed problem with domain type. --- .../Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h | 2 +- Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h index dc3d2cf70ccf..dc2d381822e3 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h @@ -90,7 +90,7 @@ class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm { const API::MatrixWorkspace_sptr &workspace) const; API::MatrixWorkspace_sptr - getQSpectrum(const API::FunctionDomain &domain, + getQSpectrum(const API::FunctionDomain1D &domain, const API::FunctionValues &values) const; void setPoldiInstrument(const PoldiInstrumentAdapter_sptr &instrument); diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 1d1d192cbc93..132734766a02 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -93,6 +93,11 @@ void PoldiFitPeaks2D::init() { "", Direction::Output), "Calculated POLDI 1D-spectrum."); + declareProperty("LambdaMin", 1.1, + "Minimum wavelength for 1D spectrum calculation"); + declareProperty("LambdaMax", 5.0, + "Minimum wavelength for 1D spectrum calculation"); + declareProperty(new WorkspaceProperty( "RefinedPoldiPeakWorkspace", "", Direction::Output), "Table workspace with fitted peaks."); @@ -369,7 +374,7 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( /// Takes a d-based domain and creates a Q-based MatrixWorkspace. MatrixWorkspace_sptr -PoldiFitPeaks2D::getQSpectrum(const FunctionDomain &domain, +PoldiFitPeaks2D::getQSpectrum(const FunctionDomain1D &domain, const FunctionValues &values) const { // Put result into workspace, based on Q MatrixWorkspace_sptr ws1D = WorkspaceFactory::Instance().create( From c8fe98b5681a7cd524bd73caafad41148e756b37 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 8 Jan 2015 11:29:28 +0100 Subject: [PATCH 027/130] Refs #10774. Added properties for lambda range, updated documentation --- .../inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h | 12 ++++++++++-- Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp | 5 ++++- .../docs/source/algorithms/PoldiFitPeaks2D-v1.rst | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h index 138503d0e3e7..20b477fcc074 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/IPoldiFunction1D.h @@ -13,10 +13,18 @@ namespace Poldi { This is an auxilliary interface that has to be implemented by functions that are supposed to be used for POLDI fits. + This way the calculation of a theoretical diffractogram can be + performed by the corresponding functions, which may behave differently + depending on their nature. For examples see the following classes: + + PoldiSpectrumConstantBackground + PoldiSpectrumDomainFunction + Poldi2DFunction + @author Michael Wedel, Paul Scherrer Institut - SINQ - @date 14/03/2014 + @date 07/01/2015 - Copyright © 2014 PSI-MSS + Copyright © 2015 PSI-MSS This file is part of Mantid. diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 132734766a02..03f0f205eef0 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -359,8 +359,11 @@ MatrixWorkspace_sptr PoldiFitPeaks2D::get1DSpectrum( std::vector indices = detector->availableElements(); // Create the grid for the diffractogram and corresponding domain/values + double lambdaMin = getProperty("LambdaMin"); + double lambdaMax = getProperty("LambdaMax"); + PoldiDGrid grid(detector, m_poldiInstrument->chopper(), m_deltaT, - std::make_pair(1.1, 5.0)); + std::make_pair(lambdaMin, lambdaMax)); FunctionDomain1DVector domain(grid.grid()); FunctionValues values(domain); diff --git a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst index f42b53e36333..c9f86b42e680 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst @@ -17,6 +17,8 @@ At the moment all profiles are calculated independently, using Gaussian function PoldiFitPeaks2D can also be used to calculate a theoretical 2D pattern from a set of peaks by limiting the iterations to 0. +In addition to performing the 2D-fit, a theoretical 1D-diffractogram of the fit-function is calculated as well, which can be used in conjunction with :ref:`algm-PoldiAnalyseResiduals` to assess the quality of a fit. + Usage ----- @@ -47,6 +49,7 @@ PoldiFitPeaks2D operates on a MatrixWorkspace with a valid POLDI instrument defi PoldiFitPeaks2D(InputWorkspace=truncated_6904, PoldiPeakWorkspace="peaks_refined_6904", RefinedPoldiPeakWorkspace="peaks_fit_2d_6904", + Calculated1DSpectrum="simulated_1d_6904", OutputWorkspace="simulated_6904") After this step, there is a new workspace containing the simulated spectrum. It should look similar to the one in the following figure: @@ -84,6 +87,7 @@ In general, there is a background in POLDI data that depends on :math:`2\theta`. PoldiPeakWorkspace="peaks_refined_6904", OutputWorkspace="simulated_6904", RefinedPoldiPeakWorkspace="peaks_fit_2d_6904", + Calculated1DSpectrum="simulated_1d_6904", LinearBackgroundParameter=0.01) Now the spectrum looks different, like in the example below. From a7b547998793c23761d06119fcda3962af0e6212 Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Fri, 9 Jan 2015 12:27:27 +0000 Subject: [PATCH 028/130] spectra-filtered EventWorkspace tests, skeleton, to be contd, re #7523 --- .../test/LoadNexusProcessedTest.h | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h index a4e787971604..d5ebe2fb9b02 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h @@ -403,6 +403,69 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite dotest_LoadAnEventFile(WEIGHTED_NOTIME); } + void test_loadEventNexus_Min() + { + // TODO + } + + void test_loadEventNexus_Max() + { + // TODO + } + + void test_loadEventNexus_Min_Max() + { + // TODO: re-use file, don't repeat... (can also be re-used in other, older tests in this file) + std::string filename_root = "LoadNexusProcessed_ExecEvent_"; + std::string savedFile; + EventWorkspace_sptr origWS = SaveNexusProcessedTest::do_testExec_EventWorkspaces(filename_root, TOF, + savedFile, false, false); + // this will make for example 'bin/Testing/LoadNexusProcessed_ExecEvent_0.nxs' (0: TOF) + + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", savedFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumMin", "2"); + alg.setPropertyValue("SpectrumMax", "4"); + // this should imply 3==ws->getNumberHistograms() + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), 3); + + doHistoryTest(ews); + + // remove saved /loaded test event data file + if (Poco::File(savedFile).exists()) + Poco::File(savedFile).remove(); + } + + void test_loadEventNexus_List() + { + // TODO + } + + void test_loadEventNexus_Min_Max_List() + { + // TODO + } + void test_load_saved_workspace_group() { LoadNexusProcessed alg; From 74821fa97ffc0aeddfea6831a9fa953dd8ad9920 Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Fri, 9 Jan 2015 12:29:07 +0000 Subject: [PATCH 029/130] bring doc up-to-date re support of spectra filters, re #7523 --- .../algorithms/LoadNexusProcessed-v1.rst | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Code/Mantid/docs/source/algorithms/LoadNexusProcessed-v1.rst b/Code/Mantid/docs/source/algorithms/LoadNexusProcessed-v1.rst index 1e91ff3dd06b..0fa41c95b394 100644 --- a/Code/Mantid/docs/source/algorithms/LoadNexusProcessed-v1.rst +++ b/Code/Mantid/docs/source/algorithms/LoadNexusProcessed-v1.rst @@ -9,14 +9,19 @@ Description ----------- -The algorithm LoadNexusProcessed will read a Nexus data file created by -:ref:`algm-SaveNexusProcessed` and place the data into the -named workspace. The file name can be an absolute or relative path and -should have the extension .nxs, .nx5 or .xml. Warning - using XML format -can be extremely slow for large data sets and generate very large files. -The optional parameters can be used to control which spectra are loaded -into the workspace (not yet implemented). If spectrum\_min and -spectrum\_max are given, then only that range to data will be loaded. +The algorithm LoadNexusProcessed will read a Nexus data file created +by :ref:`algm-SaveNexusProcessed` and place the data into the named +workspace. The file name can be an absolute or relative path and +should have the extension .nxs, .nx5 or .xml. Warning - using XML +format can be extremely slow for large data sets and generate very +large files. + +The optional parameters can be used to control which spectra are +loaded into the workspace. If SpectrumMin and SpectrumMax are given, +then only that range to data will be loaded. A specific list of +spectra to load can also be given (SpectrumList). Filtering of spectra +is supported when loading into workspaces of type :ref:`Workspace2Ds +` and also :ref:`EventWorkspaces `. A Mantid Nexus file may contain several workspace entries each labelled with an integer starting at 1. By default the highest number workspace From 045aee38172bea5db6324f9c3846c0595b7aeb4d Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Mon, 12 Jan 2015 16:39:57 +0000 Subject: [PATCH 030/130] Support for partial event loading (spectra min, max, list), re #7523 --- .../MantidDataHandling/LoadNexusProcessed.h | 24 +- .../DataHandling/src/LoadNexusProcessed.cpp | 473 ++++++++++-------- 2 files changed, 292 insertions(+), 205 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h index 025f41a0b37d..076d62d044f8 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h @@ -9,7 +9,10 @@ #include "MantidAPI/MatrixWorkspace.h" #include "MantidNexus/NexusClasses.h" -#include + +namespace NeXus { + class File; +} namespace Mantid { @@ -129,6 +132,13 @@ class DLLExport LoadNexusProcessed Mantid::NeXus::NXDouble &xbins, const double &progressStart, const double &progressRange); + API::MatrixWorkspace_sptr loadNonEventEntry(Mantid::NeXus::NXData &wksp_cls, + Mantid::NeXus::NXDouble &xbins, + const double &progressStart, + const double &progressRange, + const Mantid::NeXus::NXEntry &mtd_entry, + const int xlength, + std::string &workspaceType); /// Read the data from the sample group void readSampleGroup(Mantid::NeXus::NXEntry &mtd_entry, @@ -182,7 +192,8 @@ class DLLExport LoadNexusProcessed void checkOptionalProperties(const std::size_t numberofspectra); /// calculates the workspace size - std::size_t calculateWorkspacesize(const std::size_t numberofspectra); + std::size_t calculateWorkspaceSize(const std::size_t numberofspectra, + bool gen_filtered_list=false); /// Accellerated multiperiod loading Mantid::API::Workspace_sptr doAccelleratedMultiPeriodLoading( @@ -201,13 +212,18 @@ class DLLExport LoadNexusProcessed bool m_list; /// Flag set if interval of spectra to write is set bool m_interval; - /// The value of the spectrum_list property - std::vector m_spec_list; + /// The value of the spectrum_min property int64_t m_spec_min; /// The value of the spectrum_max property int64_t m_spec_max; + /// The value of the spectrum_list property + std::vector m_spec_list; + /// list of spectra filtered by min/max/list, currently + /// used only when loading data into event_workspace + std::vector m_filtered_spec_idxs; + // C++ interface to the NXS file ::NeXus::File *m_cppFile; }; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index c1d718f2d016..35ee803d08c6 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -12,24 +12,23 @@ #include "MantidDataHandling/LoadNexusProcessed.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/RebinnedOutput.h" +#include "MantidDataObjects/PeaksWorkspace.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/DateAndTime.h" #include "MantidKernel/UnitFactory.h" #include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/MultiThreaded.h" #include "MantidNexus/NexusClasses.h" #include "MantidNexus/NexusFileIO.h" -#include + #include #include #include #include #include -#include #include #include -#include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidKernel/MultiThreaded.h" namespace Mantid { namespace DataHandling { @@ -190,8 +189,8 @@ bool isMultiPeriodFile(int nWorkspaceEntries, Workspace_sptr sampleWS, /// Default constructor LoadNexusProcessed::LoadNexusProcessed() : m_shared_bins(false), m_xbins(), m_axis1vals(), m_list(false), - m_interval(false), m_spec_list(), m_spec_min(0), - m_spec_max(Mantid::EMPTY_INT()), m_cppFile(NULL) {} + m_interval(false), m_spec_min(0), m_spec_max(Mantid::EMPTY_INT()), + m_spec_list(), m_filtered_spec_idxs(), m_cppFile(NULL) {} /// Delete NexusFileIO in destructor LoadNexusProcessed::~LoadNexusProcessed() { delete m_cppFile; } @@ -435,7 +434,6 @@ void LoadNexusProcessed::exec() { base_name += "_"; const std::string prop_name = "OutputWorkspace_"; - double nWorkspaceEntries_d = static_cast(nWorkspaceEntries); MatrixWorkspace_sptr tempMatrixWorkspace = boost::dynamic_pointer_cast(tempWS); @@ -479,6 +477,8 @@ void LoadNexusProcessed::exec() { p); } else // Fall-back for generic loading { + const double nWorkspaceEntries_d = + static_cast(nWorkspaceEntries); local_workspace = loadEntry(root, basename + os.str(), static_cast(p - 1) / nWorkspaceEntries_d, @@ -622,13 +622,15 @@ LoadNexusProcessed::loadWorkspaceName(NXRoot &root, } //------------------------------------------------------------------------------------------------- -/** Load the event_workspace field +/** + * Load an event_workspace field * - * @param wksp_cls - * @param xbins - * @param progressStart - * @param progressRange - * @return + * @param wksp_cls Nexus data for "event_workspace" + * @param xbins bins on the "X" axis + * @param progressStart algorithm progress (from 0) + * @param progressRange progress made after loading an entry + * + * @return event_workspace object with data */ API::MatrixWorkspace_sptr LoadNexusProcessed::loadEventEntry(NXData &wksp_cls, NXDouble &xbins, @@ -637,8 +639,13 @@ LoadNexusProcessed::loadEventEntry(NXData &wksp_cls, NXDouble &xbins, NXDataSetTyped indices_data = wksp_cls.openNXDataSet("indices"); indices_data.load(); - boost::shared_array indices = indices_data.sharedBuffer(); - int numspec = indices_data.dim0() - 1; + size_t numspec = indices_data.dim0() - 1; + + // process optional spectrum parameters, if set + checkOptionalProperties(numspec); + // Actual number of spectra in output workspace (if only a user-specified + // range and/or list was going to be loaded) + numspec = calculateWorkspaceSize(numspec, true); int num_xbins = xbins.dim0(); if (num_xbins < 2) @@ -696,14 +703,17 @@ LoadNexusProcessed::loadEventEntry(NXData &wksp_cls, NXDouble &xbins, else throw std::runtime_error("Could not figure out the type of event list!"); + // indices of events + boost::shared_array indices = indices_data.sharedBuffer(); // Create all the event lists PARALLEL_FOR_NO_WSP_CHECK() - for (int wi = 0; wi < numspec; wi++) { + for (size_t j = 0; j < m_filtered_spec_idxs.size(); j++) { PARALLEL_START_INTERUPT_REGION + size_t wi = m_filtered_spec_idxs[j] - 1; int64_t index_start = indices[wi]; int64_t index_end = indices[wi + 1]; if (index_end >= index_start) { - EventList &el = ws->getEventList(wi); + EventList &el = ws->getEventList(j); el.switchTo(type); // Allocate all the required memory @@ -732,12 +742,13 @@ LoadNexusProcessed::loadEventEntry(NXData &wksp_cls, NXDouble &xbins, MantidVec x; x.resize(xbins.dim0()); for (int i = 0; i < xbins.dim0(); i++) - x[i] = xbins(wi, i); + x[i] = xbins(static_cast(wi), i); el.setX(x); } } - progress(progressStart + progressRange * (1.0 / numspec)); + progress(progressStart + progressRange * + (1.0 / static_cast(numspec))); PARALLEL_END_INTERUPT_REGION } PARALLEL_CHECK_INTERUPT_REGION @@ -1121,7 +1132,206 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) { //------------------------------------------------------------------------------------------------- /** - * Load a single entry into a workspace + * Load a Workspace2D + * + * @param wksp_cls Nexus data for "Workspace2D" (or "offsets_workspace") + * @param xbins bins on the "X" axis + * @param progressStart algorithm progress (from 0) + * @param progressRange progress made after loading an entry + * @param mtd_entry Nexus entry for "mantid_workspace_..." + * @param xlength bins in the "X" axis (xbins) + * @param workspaceType Takes values like "Workspace2D", "RebinnedOutput", etc. + * @param total_specs actual number of spectra to load (filtering by min/max/list) + * + * @return workspace object containing loaded data + */ +API::MatrixWorkspace_sptr +LoadNexusProcessed::loadNonEventEntry(NXData &wksp_cls, + NXDouble &xbins, + const double &progressStart, + const double &progressRange, + const NXEntry &mtd_entry, + const int xlength, + std::string &workspaceType) { + // Filter the list of spectra to process, applying min/max/list options + NXDataSetTyped data = wksp_cls.openDoubleData(); + int64_t nchannels = data.dim1(); + size_t nspectra = data.dim0(); + // process optional spectrum parameters, if set + checkOptionalProperties(nspectra); + // Actual number of spectra in output workspace (if only a range was going + // to be loaded) + size_t total_specs = calculateWorkspaceSize(nspectra); + + //// Create the 2D workspace for the output + bool hasFracArea = false; + if (wksp_cls.isValid("frac_area")) { + // frac_area entry is the signal for a RebinnedOutput workspace + hasFracArea = true; + workspaceType.clear(); + workspaceType = "RebinnedOutput"; + } + + API::MatrixWorkspace_sptr local_workspace = + boost::dynamic_pointer_cast( + WorkspaceFactory::Instance().create(workspaceType, total_specs, xlength, + nchannels)); + try { + local_workspace->setTitle(mtd_entry.getString("title")); + } catch (std::runtime_error &) { + g_log.debug() << "No title was found in the input file, " + << getPropertyValue("Filename") << std::endl; + } + + // Set the YUnit label + local_workspace->setYUnit(data.attributes("units")); + std::string unitLabel = data.attributes("unit_label"); + if (unitLabel.empty()) + unitLabel = data.attributes("units"); + local_workspace->setYUnitLabel(unitLabel); + + readBinMasking(wksp_cls, local_workspace); + NXDataSetTyped errors = wksp_cls.openNXDouble("errors"); + NXDataSetTyped fracarea = errors; + if (hasFracArea) { + fracarea = wksp_cls.openNXDouble("frac_area"); + } + + int64_t blocksize(8); + // const int fullblocks = nspectra / blocksize; + // size of the workspace + int64_t fullblocks = total_specs / blocksize; + int64_t read_stop = (fullblocks * blocksize); + const double progressBegin = progressStart + 0.25 * progressRange; + const double progressScaler = 0.75 * progressRange; + int64_t hist_index = 0; + int64_t wsIndex = 0; + if (m_shared_bins) { + // if spectrum min,max,list properties are set + if (m_interval || m_list) { + // if spectrum max,min properties are set read the data as a + // block(multiple of 8) and + // then read the remaining data as finalblock + if (m_interval) { + // specs at the min-max interval + int interval_specs = static_cast(m_spec_max - m_spec_min); + fullblocks = (interval_specs) / blocksize; + read_stop = (fullblocks * blocksize) + m_spec_min - 1; + + if (interval_specs < blocksize) { + blocksize = total_specs; + read_stop = m_spec_max - 1; + } + hist_index = m_spec_min - 1; + + for (; hist_index < read_stop;) { + progress(progressBegin + + progressScaler * static_cast(hist_index) / + static_cast(read_stop), + "Reading workspace data..."); + loadBlock(data, errors, fracarea, hasFracArea, blocksize, nchannels, + hist_index, wsIndex, local_workspace); + } + int64_t finalblock = m_spec_max - 1 - read_stop; + if (finalblock > 0) { + loadBlock(data, errors, fracarea, hasFracArea, finalblock, + nchannels, hist_index, wsIndex, local_workspace); + } + } + // if spectrum list property is set read each spectrum separately by + // setting blocksize=1 + if (m_list) { + std::vector::iterator itr = m_spec_list.begin(); + for (; itr != m_spec_list.end(); ++itr) { + int64_t specIndex = (*itr) - 1; + progress(progressBegin + + progressScaler * static_cast(specIndex) / + static_cast(m_spec_list.size()), + "Reading workspace data..."); + loadBlock(data, errors, fracarea, hasFracArea, + static_cast(1), nchannels, specIndex, wsIndex, + local_workspace); + } + } + } else { + for (; hist_index < read_stop;) { + progress(progressBegin + + progressScaler * static_cast(hist_index) / + static_cast(read_stop), + "Reading workspace data..."); + loadBlock(data, errors, fracarea, hasFracArea, blocksize, nchannels, + hist_index, wsIndex, local_workspace); + } + int64_t finalblock = total_specs - read_stop; + if (finalblock > 0) { + loadBlock(data, errors, fracarea, hasFracArea, finalblock, nchannels, + hist_index, wsIndex, local_workspace); + } + } + + } else { + if (m_interval || m_list) { + if (m_interval) { + int64_t interval_specs = m_spec_max - m_spec_min; + fullblocks = (interval_specs) / blocksize; + read_stop = (fullblocks * blocksize) + m_spec_min - 1; + + if (interval_specs < blocksize) { + blocksize = interval_specs; + read_stop = m_spec_max - 1; + } + hist_index = m_spec_min - 1; + + for (; hist_index < read_stop;) { + progress(progressBegin + + progressScaler * static_cast(hist_index) / + static_cast(read_stop), + "Reading workspace data..."); + loadBlock(data, errors, fracarea, hasFracArea, xbins, blocksize, + nchannels, hist_index, wsIndex, local_workspace); + } + int64_t finalblock = m_spec_max - 1 - read_stop; + if (finalblock > 0) { + loadBlock(data, errors, fracarea, hasFracArea, xbins, finalblock, + nchannels, hist_index, wsIndex, local_workspace); + } + } + // + if (m_list) { + std::vector::iterator itr = m_spec_list.begin(); + for (; itr != m_spec_list.end(); ++itr) { + int64_t specIndex = (*itr) - 1; + progress(progressBegin + + progressScaler * static_cast(specIndex) / + static_cast(read_stop), + "Reading workspace data..."); + loadBlock(data, errors, fracarea, hasFracArea, xbins, 1, nchannels, + specIndex, wsIndex, local_workspace); + } + } + } else { + for (; hist_index < read_stop;) { + progress(progressBegin + + progressScaler * static_cast(hist_index) / + static_cast(read_stop), + "Reading workspace data..."); + loadBlock(data, errors, fracarea, hasFracArea, xbins, blocksize, + nchannels, hist_index, wsIndex, local_workspace); + } + int64_t finalblock = total_specs - read_stop; + if (finalblock > 0) { + loadBlock(data, errors, fracarea, hasFracArea, xbins, finalblock, + nchannels, hist_index, wsIndex, local_workspace); + } + } + } + return local_workspace; +} + +//------------------------------------------------------------------------------------------------- +/** + * Load a single entry into a workspace (event_workspace or workspace2d) + * * @param root :: The opened root node * @param entry_name :: The entry name * @param progressStart :: The percentage value to start the progress reporting @@ -1186,188 +1396,17 @@ API::Workspace_sptr LoadNexusProcessed::loadEntry(NXRoot &root, NXDouble axis2 = wksp_cls.openNXDouble("axis2"); std::string unit2 = axis2.attributes("units"); - // The workspace being worked on + // --- Load workspace (as event_workspace or workspace2d) --- API::MatrixWorkspace_sptr local_workspace; - size_t nspectra; - int64_t nchannels; - - // -------- Process as event ? -------------------- if (isEvent) { local_workspace = loadEventEntry(wksp_cls, xbins, progressStart, progressRange); - nspectra = local_workspace->getNumberHistograms(); - nchannels = local_workspace->blocksize(); } else { - NXDataSetTyped data = wksp_cls.openDoubleData(); - nspectra = data.dim0(); - nchannels = data.dim1(); - //// validate the optional spectrum parameters, if set - checkOptionalProperties(nspectra); - // Actual number of spectra in output workspace (if only a range was going - // to be loaded) - size_t total_specs = calculateWorkspacesize(nspectra); - - //// Create the 2D workspace for the output - bool hasFracArea = false; - if (wksp_cls.isValid("frac_area")) { - // frac_area entry is the signal for a RebinnedOutput workspace - hasFracArea = true; - workspaceType.clear(); - workspaceType = "RebinnedOutput"; - } - local_workspace = boost::dynamic_pointer_cast( - WorkspaceFactory::Instance().create(workspaceType, total_specs, xlength, - nchannels)); - try { - local_workspace->setTitle(mtd_entry.getString("title")); - } catch (std::runtime_error &) { - g_log.debug() << "No title was found in the input file, " - << getPropertyValue("Filename") << std::endl; - } - - // Set the YUnit label - local_workspace->setYUnit(data.attributes("units")); - std::string unitLabel = data.attributes("unit_label"); - if (unitLabel.empty()) - unitLabel = data.attributes("units"); - local_workspace->setYUnitLabel(unitLabel); - - readBinMasking(wksp_cls, local_workspace); - NXDataSetTyped errors = wksp_cls.openNXDouble("errors"); - NXDataSetTyped fracarea = errors; - if (hasFracArea) { - fracarea = wksp_cls.openNXDouble("frac_area"); - } - - int64_t blocksize(8); - // const int fullblocks = nspectra / blocksize; - // size of the workspace - int64_t fullblocks = total_specs / blocksize; - int64_t read_stop = (fullblocks * blocksize); - const double progressBegin = progressStart + 0.25 * progressRange; - const double progressScaler = 0.75 * progressRange; - int64_t hist_index = 0; - int64_t wsIndex = 0; - if (m_shared_bins) { - // if spectrum min,max,list properties are set - if (m_interval || m_list) { - // if spectrum max,min properties are set read the data as a - // block(multiple of 8) and - // then read the remaining data as finalblock - if (m_interval) { - // specs at the min-max interval - int interval_specs = static_cast(m_spec_max - m_spec_min); - fullblocks = (interval_specs) / blocksize; - read_stop = (fullblocks * blocksize) + m_spec_min - 1; - - if (interval_specs < blocksize) { - blocksize = total_specs; - read_stop = m_spec_max - 1; - } - hist_index = m_spec_min - 1; - - for (; hist_index < read_stop;) { - progress(progressBegin + - progressScaler * static_cast(hist_index) / - static_cast(read_stop), - "Reading workspace data..."); - loadBlock(data, errors, fracarea, hasFracArea, blocksize, nchannels, - hist_index, wsIndex, local_workspace); - } - int64_t finalblock = m_spec_max - 1 - read_stop; - if (finalblock > 0) { - loadBlock(data, errors, fracarea, hasFracArea, finalblock, - nchannels, hist_index, wsIndex, local_workspace); - } - } - // if spectrum list property is set read each spectrum separately by - // setting blocksize=1 - if (m_list) { - std::vector::iterator itr = m_spec_list.begin(); - for (; itr != m_spec_list.end(); ++itr) { - int64_t specIndex = (*itr) - 1; - progress(progressBegin + - progressScaler * static_cast(specIndex) / - static_cast(m_spec_list.size()), - "Reading workspace data..."); - loadBlock(data, errors, fracarea, hasFracArea, - static_cast(1), nchannels, specIndex, wsIndex, - local_workspace); - } - } - } else { - for (; hist_index < read_stop;) { - progress(progressBegin + - progressScaler * static_cast(hist_index) / - static_cast(read_stop), - "Reading workspace data..."); - loadBlock(data, errors, fracarea, hasFracArea, blocksize, nchannels, - hist_index, wsIndex, local_workspace); - } - int64_t finalblock = total_specs - read_stop; - if (finalblock > 0) { - loadBlock(data, errors, fracarea, hasFracArea, finalblock, nchannels, - hist_index, wsIndex, local_workspace); - } - } - - } else { - if (m_interval || m_list) { - if (m_interval) { - int64_t interval_specs = m_spec_max - m_spec_min; - fullblocks = (interval_specs) / blocksize; - read_stop = (fullblocks * blocksize) + m_spec_min - 1; - - if (interval_specs < blocksize) { - blocksize = interval_specs; - read_stop = m_spec_max - 1; - } - hist_index = m_spec_min - 1; - - for (; hist_index < read_stop;) { - progress(progressBegin + - progressScaler * static_cast(hist_index) / - static_cast(read_stop), - "Reading workspace data..."); - loadBlock(data, errors, fracarea, hasFracArea, xbins, blocksize, - nchannels, hist_index, wsIndex, local_workspace); - } - int64_t finalblock = m_spec_max - 1 - read_stop; - if (finalblock > 0) { - loadBlock(data, errors, fracarea, hasFracArea, xbins, finalblock, - nchannels, hist_index, wsIndex, local_workspace); - } - } - // - if (m_list) { - std::vector::iterator itr = m_spec_list.begin(); - for (; itr != m_spec_list.end(); ++itr) { - int64_t specIndex = (*itr) - 1; - progress(progressBegin + - progressScaler * static_cast(specIndex) / - static_cast(read_stop), - "Reading workspace data..."); - loadBlock(data, errors, fracarea, hasFracArea, xbins, 1, nchannels, - specIndex, wsIndex, local_workspace); - } - } - } else { - for (; hist_index < read_stop;) { - progress(progressBegin + - progressScaler * static_cast(hist_index) / - static_cast(read_stop), - "Reading workspace data..."); - loadBlock(data, errors, fracarea, hasFracArea, xbins, blocksize, - nchannels, hist_index, wsIndex, local_workspace); - } - int64_t finalblock = total_specs - read_stop; - if (finalblock > 0) { - loadBlock(data, errors, fracarea, hasFracArea, xbins, finalblock, - nchannels, hist_index, wsIndex, local_workspace); - } - } - } - } // end of NOT an event ------------------------------- + local_workspace = + loadNonEventEntry(wksp_cls, xbins, progressStart, progressRange, + mtd_entry, xlength, workspaceType); + } + size_t nspectra = local_workspace->getNumberHistograms(); // Units bool verticalHistogram(false); @@ -1889,13 +1928,22 @@ LoadNexusProcessed::checkOptionalProperties(const std::size_t numberofspectra) { /** * Calculate the size of a workspace - * @param numberofspectra :: number of spectrums + * + * @param numberofspectra :: count of spectra found in the file being loaded + * + * @param calculate_filtered_list :: process SpectrumList and SpectrumMin/Max + * and save resulting explicit list of + * spectra indices into a vector data + * member, presently used only when loading + * into event_workspace + * * @return the size of a workspace */ size_t -LoadNexusProcessed::calculateWorkspacesize(const std::size_t numberofspectra) { +LoadNexusProcessed::calculateWorkspaceSize(const std::size_t numberofspectra, + bool gen_filtered_list) { // Calculate the size of a workspace, given its number of spectra to read - int total_specs; + int64_t total_specs; if (m_interval || m_list) { if (m_interval) { if (m_spec_min != 1 && m_spec_max == 1) { @@ -1903,8 +1951,16 @@ LoadNexusProcessed::calculateWorkspacesize(const std::size_t numberofspectra) { } total_specs = static_cast(m_spec_max - m_spec_min + 1); m_spec_max += 1; - } else + + if (gen_filtered_list) { + m_filtered_spec_idxs.resize(total_specs); + size_t j = 0; + for(int64_t si = m_spec_min; si < m_spec_max; si++, j++) + m_filtered_spec_idxs[j] = si; + } + } else { total_specs = 0; + } if (m_list) { if (m_interval) { @@ -1918,11 +1974,26 @@ LoadNexusProcessed::calculateWorkspacesize(const std::size_t numberofspectra) { if (m_spec_list.size() == 0) m_list = false; total_specs += static_cast(m_spec_list.size()); + + if (gen_filtered_list) { + // range list + spare indices from list + // example: min: 2, max: 8, list: 3,4,5,10,12; + // result: 2,3,...,7,8,10,12 + m_filtered_spec_idxs.insert(m_filtered_spec_idxs.end(), + m_spec_list.begin(), + m_spec_list.end()); + } } } else { total_specs = static_cast(numberofspectra); m_spec_min = 1; m_spec_max = static_cast(numberofspectra) + 1; + + if (gen_filtered_list) { + m_filtered_spec_idxs.resize(total_specs, 0); + for(int64_t j = 0; j < total_specs; j++) + m_filtered_spec_idxs[j] = m_spec_min+j; + } } return total_specs; } From 27d636f975c30942b35375c8de650e7fde7c9b4d Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Mon, 12 Jan 2015 17:50:39 +0000 Subject: [PATCH 031/130] Tests for partial loading of event files, re #7523 --- .../test/LoadNexusProcessedTest.h | 307 ++++++++++++++++-- .../test/LoadRawSaveNxsLoadNxsTest.h | 15 +- 2 files changed, 292 insertions(+), 30 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h index d5ebe2fb9b02..0c01d02711a5 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h @@ -42,15 +42,16 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite delete suite; } - LoadNexusProcessedTest() : - testFile("GEM38370_Focussed_Legacy.nxs"), output_ws("nxstest") + LoadNexusProcessedTest(): + testFile("GEM38370_Focussed_Legacy.nxs"), output_ws("nxstest"), + m_savedTmpEventFile("") { - } ~LoadNexusProcessedTest() { AnalysisDataService::Instance().clear(); + clearTmpEventNexus(); } void testFastMultiPeriodDefault() @@ -405,34 +406,88 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite void test_loadEventNexus_Min() { - // TODO + writeTmpEventNexus(); + + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumMin", "3"); + // this should imply 4==ws->getNumberHistograms() + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT( alg.isExecuted()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), 4); + + TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Max() { - // TODO + writeTmpEventNexus(); + + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumMax", "2"); + // this should imply 3==ws->getNumberHistograms() + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT( alg.isExecuted()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), 2); + + TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Min_Max() { - // TODO: re-use file, don't repeat... (can also be re-used in other, older tests in this file) - std::string filename_root = "LoadNexusProcessed_ExecEvent_"; - std::string savedFile; - EventWorkspace_sptr origWS = SaveNexusProcessedTest::do_testExec_EventWorkspaces(filename_root, TOF, - savedFile, false, false); - // this will make for example 'bin/Testing/LoadNexusProcessed_ExecEvent_0.nxs' (0: TOF) + writeTmpEventNexus(); LoadNexusProcessed alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT( alg.isInitialized()); - alg.setPropertyValue("Filename", savedFile); + alg.setPropertyValue("Filename", m_savedTmpEventFile); alg.setPropertyValue("OutputWorkspace", output_ws); alg.setPropertyValue("SpectrumMin", "2"); alg.setPropertyValue("SpectrumMax", "4"); // this should imply 3==ws->getNumberHistograms() TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT( alg.isExecuted()); // Test basic props of the ws Workspace_sptr workspace; @@ -449,21 +504,165 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite TS_ASSERT(ews.get()); TS_ASSERT_EQUALS(ews->getNumberHistograms(), 3); - doHistoryTest(ews); + // expect: load + LoadInst (child) + TS_ASSERT_EQUALS(ews->getHistory().size(), 2); + } + + void test_loadEventNexus_Fail() + { + writeTmpEventNexus(); - // remove saved /loaded test event data file - if (Poco::File(savedFile).exists()) - Poco::File(savedFile).remove(); + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumList", "1,3,5,89"); + // the 89 should cause trouble, but gracefully... + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT(!alg.isExecuted()); } void test_loadEventNexus_List() { - // TODO + writeTmpEventNexus(); + + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumList", "1,3,5"); + // this should imply 3==ws->getNumberHistograms() + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT(alg.isExecuted()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), 3); + + TS_ASSERT_EQUALS(ews->getHistory().size(), 2); + } + + void test_loadEventNexus_Min_List() + { + writeTmpEventNexus(); + + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumList", "5"); + alg.setPropertyValue("SpectrumMin", "4"); + // this should imply 2==ws->getNumberHistograms() + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT(alg.isExecuted()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), 3); + + TS_ASSERT_EQUALS(ews->getHistory().size(), 2); + } + + void test_loadEventNexus_Max_List() + { + writeTmpEventNexus(); + + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumMax", "2"); + alg.setPropertyValue("SpectrumList", "3,5"); + // this should imply 4==ws->getNumberHistograms() + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT(alg.isExecuted()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), 4); + + TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Min_Max_List() { - // TODO + writeTmpEventNexus(); + + LoadNexusProcessed alg; + TS_ASSERT_THROWS_NOTHING(alg.initialize()); + TS_ASSERT( alg.isInitialized()); + + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("OutputWorkspace", output_ws); + alg.setPropertyValue("SpectrumMin", "3"); + alg.setPropertyValue("SpectrumMax", "5"); + alg.setPropertyValue("SpectrumList", "1,2,3,5"); + // this should imply 5(all)==ws->getNumberHistograms() + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT(alg.isExecuted()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), 5); + + TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_load_saved_workspace_group() @@ -727,8 +926,9 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite saveAlg.initialize(); saveAlg.setPropertyValue("InputWorkspace", inTableEntry.name()); saveAlg.setPropertyValue("Filename", savedFileName); - TS_ASSERT_THROWS_NOTHING( saveAlg.execute()); - TS_ASSERT( saveAlg.isExecuted()); + + TS_ASSERT_THROWS_NOTHING(saveAlg.execute()); + TS_ASSERT(saveAlg.isExecuted()); if (!saveAlg.isExecuted()) return; // Nothing to check @@ -847,8 +1047,73 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite } } - LoadNexusProcessed algToBeTested; + void writeTmpEventNexus() + { + //return; + if (!m_savedTmpEventFile.empty() && Poco::File(m_savedTmpEventFile).exists()) { + std::cerr << "NOOOOOT SAVING ------" << std::endl; + return; + } else { + std::cerr << "SAVING ------" << std::endl; + /* + SaveNexusProcessedTest::do_testExec_EventWorkspaces("LoadNexusProcessed_TmpEvent_", + WEIGHTED, + m_savedTmpEventFile, + true, false); + std::cerr << " --------- output tmp file: " << m_savedTmpEventFile << std::endl; + */ + // after this, m_savedTmpEventFile will be like 'LoadNexusProcessed_TmpEvent_1.nxs' + /* + if (!m_savedTmpEventFile.empty() && Poco::File(m_savedTmpEventFile).exists()) + Poco::File(m_savedTmpEventFile).remove(); + */ + + std::vector< std::vector > groups(6); + groups[0].push_back(9); + groups[0].push_back(12); + groups[1].push_back(5); + groups[1].push_back(10); + groups[2].push_back(20); + groups[2].push_back(21); + groups[3].push_back(10); + groups[4].push_back(50); + groups[5].push_back(15); + groups[5].push_back(20); + + EventWorkspace_sptr ws = WorkspaceCreationHelper::CreateGroupedEventWorkspace(groups, 30, 1.0); + ws->getEventList(4).clear(); + + TS_ASSERT_EQUALS( ws->getNumberHistograms(), groups.size()); + + SaveNexusProcessed alg; + alg.initialize(); + alg.setProperty("InputWorkspace", boost::dynamic_pointer_cast(ws)); + m_savedTmpEventFile = "LoadNexusProcessed_TmpEvent.nxs"; + alg.setPropertyValue("Filename", m_savedTmpEventFile); + alg.setPropertyValue("Title", "Tmp test event workspace as NexusProcessed file"); + + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT( alg.isExecuted() ); + + // Get absolute path to the saved file + m_savedTmpEventFile = alg.getPropertyValue("Filename"); + std::cerr << " -------------- ABS PATH saved: " << m_savedTmpEventFile << std::endl; + + } + } + + void clearTmpEventNexus() + { + // remove saved/re-loaded test event data file + if (!m_savedTmpEventFile.empty() && Poco::File(m_savedTmpEventFile).exists()) + Poco::File(m_savedTmpEventFile).remove(); + } + + std::string testFile, output_ws; + /// Saved using SaveNexusProcessed and re-used in several load event tests + std::string m_savedTmpEventFile; + static const EventType m_savedTmpType = TOF; }; //------------------------------------------------------------------------------ diff --git a/Code/Mantid/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h b/Code/Mantid/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h index 18e325acb1fe..aa87b5eaf66d 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h @@ -171,7 +171,6 @@ void testExecOnLoadraw() // obtain the expected log data which was read from the Nexus file (NXlog) - Property *l_property =output->run().getLogData( std::string("height") ); TimeSeriesProperty *l_timeSeriesDouble1 = dynamic_cast*>(l_property); std::string timeSeriesString = l_timeSeriesDouble1->value(); @@ -185,22 +184,20 @@ void testExecOnLoadraw() TimeSeriesProperty *l_timeSeriesString = dynamic_cast*>(l_property); timeSeriesString = l_timeSeriesString->value(); -// TODO: Re-enable this particular test. -// // -// // Testing log data - this was failing at one time as internal format of log data changed, but now OK again -// // -// std::cout << timeSeriesString; -// TS_ASSERT_EQUALS( timeSeriesString.substr(0,38), "2008-Jun-17 11:11:13 CHANGE PERIOD 12" ); + // + // Testing log data - this was failing at one time as internal format of log data changed, but now OK again + // It was disabled, with a TODO comment, with this string: "2008-Jun-17 11:11:13 CHANGE PERIOD 12", + // now enabled after changing 12=> 1 (and added one more space character before CHANGE). + std::cout << timeSeriesString; + TS_ASSERT_EQUALS( timeSeriesString.substr(0,38), "2008-Jun-17 11:11:13 CHANGE PERIOD 1" ); remove(outputFile.c_str()); - } private: LoadNexus algToBeTested; - LoadNexus algToBeTested2; std::string inputFile; int entryNumber; From c68802397862377ca4a7f5f0fe6dccc671bb6369 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Tue, 13 Jan 2015 08:46:13 +0100 Subject: [PATCH 032/130] Refs #10774. Setting correct unit on 1D-spectrum. --- Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 03f0f205eef0..6653f1c3cfbc 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -391,6 +391,7 @@ PoldiFitPeaks2D::getQSpectrum(const FunctionDomain1D &domain, yData[offset - i] = values[i]; } + ws1D->getAxis(0)->setUnit("MomentumTransfer"); return ws1D; } From cd0f9c41ab955894d3c4c356ac5e4322afccf00c Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Tue, 13 Jan 2015 08:56:50 +0000 Subject: [PATCH 033/130] clean and refactor common event tests, re #7523 --- .../test/LoadNexusProcessedTest.h | 105 +++++++++++------- 1 file changed, 66 insertions(+), 39 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h index 0c01d02711a5..4cfd382897c3 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h @@ -417,25 +417,8 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite alg.setPropertyValue("SpectrumMin", "3"); // this should imply 4==ws->getNumberHistograms() - TS_ASSERT_THROWS_NOTHING(alg.execute()); - TS_ASSERT( alg.isExecuted()); - - // Test basic props of the ws - Workspace_sptr workspace; - TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); - TS_ASSERT(workspace); - if (!workspace) - return; - TS_ASSERT(workspace.get()); - - EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); - TS_ASSERT(ews); - if (!ews) - return; - TS_ASSERT(ews.get()); - TS_ASSERT_EQUALS(ews->getNumberHistograms(), 4); - - TS_ASSERT_EQUALS(ews->getHistory().size(), 2); + // expected number of spectra and length of the alg history + doCommonEventLoadChecks(alg, 4, 2); } void test_loadEventNexus_Max() @@ -451,6 +434,10 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite alg.setPropertyValue("SpectrumMax", "2"); // this should imply 3==ws->getNumberHistograms() + // expected number of spectra and length of the alg history + doCommonEventLoadChecks(alg, 2, 2); + return; + TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT( alg.isExecuted()); @@ -486,6 +473,11 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite alg.setPropertyValue("SpectrumMax", "4"); // this should imply 3==ws->getNumberHistograms() + // expected number of spectra and length of the alg history + doCommonEventLoadChecks(alg, 3, 2); + return; + + TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT( alg.isExecuted()); @@ -538,6 +530,11 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite alg.setPropertyValue("SpectrumList", "1,3,5"); // this should imply 3==ws->getNumberHistograms() + // expected number of spectra and length of the alg history + doCommonEventLoadChecks(alg, 3, 2); + return; + + TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT(alg.isExecuted()); @@ -573,6 +570,10 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite alg.setPropertyValue("SpectrumMin", "4"); // this should imply 2==ws->getNumberHistograms() + // expected number of spectra and length of the alg history + doCommonEventLoadChecks(alg, 3, 2); + return; + TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT(alg.isExecuted()); @@ -608,6 +609,12 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite alg.setPropertyValue("SpectrumList", "3,5"); // this should imply 4==ws->getNumberHistograms() + // expected number of spectra and length of the alg history + doCommonEventLoadChecks(alg, 4, 2); + return; + + + TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT(alg.isExecuted()); @@ -644,6 +651,11 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite alg.setPropertyValue("SpectrumList", "1,2,3,5"); // this should imply 5(all)==ws->getNumberHistograms() + // expected number of spectra and length of the alg history + doCommonEventLoadChecks(alg, 5, 2); + return; + + TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT(alg.isExecuted()); @@ -1032,6 +1044,7 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite } private: + void doHistoryTest(MatrixWorkspace_sptr matrix_ws) { const WorkspaceHistory history = matrix_ws->getHistory(); @@ -1047,26 +1060,44 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite } } + /** + * Do a few standard checks that are repeated in multiple tests of + * partial event data loading + * + * @param alg initialized and parameterized load algorithm + * @param nSpectra expected number of spectra + * @param nHistory expected number of entries in the algorithm + * history + **/ + void doCommonEventLoadChecks(LoadNexusProcessed& alg, size_t nSpectra, + size_t nHistory) + { + TS_ASSERT_THROWS_NOTHING(alg.execute()); + TS_ASSERT( alg.isExecuted()); + + // Test basic props of the ws + Workspace_sptr workspace; + TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); + TS_ASSERT(workspace); + if (!workspace) + return; + TS_ASSERT(workspace.get()); + + EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); + TS_ASSERT(ews); + if (!ews) + return; + TS_ASSERT(ews.get()); + TS_ASSERT_EQUALS(ews->getNumberHistograms(), nSpectra); + + TS_ASSERT_EQUALS(ews->getHistory().size(), nHistory); + } + void writeTmpEventNexus() { //return; - if (!m_savedTmpEventFile.empty() && Poco::File(m_savedTmpEventFile).exists()) { - std::cerr << "NOOOOOT SAVING ------" << std::endl; - return; - } else { - std::cerr << "SAVING ------" << std::endl; - /* - SaveNexusProcessedTest::do_testExec_EventWorkspaces("LoadNexusProcessed_TmpEvent_", - WEIGHTED, - m_savedTmpEventFile, - true, false); - std::cerr << " --------- output tmp file: " << m_savedTmpEventFile << std::endl; - */ - // after this, m_savedTmpEventFile will be like 'LoadNexusProcessed_TmpEvent_1.nxs' - /* if (!m_savedTmpEventFile.empty() && Poco::File(m_savedTmpEventFile).exists()) - Poco::File(m_savedTmpEventFile).remove(); - */ + return; std::vector< std::vector > groups(6); groups[0].push_back(9); @@ -1097,9 +1128,6 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite // Get absolute path to the saved file m_savedTmpEventFile = alg.getPropertyValue("Filename"); - std::cerr << " -------------- ABS PATH saved: " << m_savedTmpEventFile << std::endl; - - } } void clearTmpEventNexus() @@ -1109,7 +1137,6 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite Poco::File(m_savedTmpEventFile).remove(); } - std::string testFile, output_ws; /// Saved using SaveNexusProcessed and re-used in several load event tests std::string m_savedTmpEventFile; From a748d1a9fe16d081a19943857865166c29605821 Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Tue, 13 Jan 2015 09:02:09 +0000 Subject: [PATCH 034/130] and old repeated checks can go away, re #7523 --- .../test/LoadNexusProcessedTest.h | 133 +----------------- 1 file changed, 1 insertion(+), 132 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h index 4cfd382897c3..b6ae62ae48c6 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadNexusProcessedTest.h @@ -436,27 +436,6 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite // expected number of spectra and length of the alg history doCommonEventLoadChecks(alg, 2, 2); - return; - - TS_ASSERT_THROWS_NOTHING(alg.execute()); - TS_ASSERT( alg.isExecuted()); - - // Test basic props of the ws - Workspace_sptr workspace; - TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); - TS_ASSERT(workspace); - if (!workspace) - return; - TS_ASSERT(workspace.get()); - - EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); - TS_ASSERT(ews); - if (!ews) - return; - TS_ASSERT(ews.get()); - TS_ASSERT_EQUALS(ews->getNumberHistograms(), 2); - - TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Min_Max() @@ -474,30 +453,8 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite // this should imply 3==ws->getNumberHistograms() // expected number of spectra and length of the alg history + // in history, expect: load + LoadInst (child) doCommonEventLoadChecks(alg, 3, 2); - return; - - - TS_ASSERT_THROWS_NOTHING(alg.execute()); - TS_ASSERT( alg.isExecuted()); - - // Test basic props of the ws - Workspace_sptr workspace; - TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); - TS_ASSERT(workspace); - if (!workspace) - return; - TS_ASSERT(workspace.get()); - - EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); - TS_ASSERT(ews); - if (!ews) - return; - TS_ASSERT(ews.get()); - TS_ASSERT_EQUALS(ews->getNumberHistograms(), 3); - - // expect: load + LoadInst (child) - TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Fail() @@ -532,28 +489,6 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite // expected number of spectra and length of the alg history doCommonEventLoadChecks(alg, 3, 2); - return; - - - TS_ASSERT_THROWS_NOTHING(alg.execute()); - TS_ASSERT(alg.isExecuted()); - - // Test basic props of the ws - Workspace_sptr workspace; - TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); - TS_ASSERT(workspace); - if (!workspace) - return; - TS_ASSERT(workspace.get()); - - EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); - TS_ASSERT(ews); - if (!ews) - return; - TS_ASSERT(ews.get()); - TS_ASSERT_EQUALS(ews->getNumberHistograms(), 3); - - TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Min_List() @@ -572,27 +507,6 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite // expected number of spectra and length of the alg history doCommonEventLoadChecks(alg, 3, 2); - return; - - TS_ASSERT_THROWS_NOTHING(alg.execute()); - TS_ASSERT(alg.isExecuted()); - - // Test basic props of the ws - Workspace_sptr workspace; - TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); - TS_ASSERT(workspace); - if (!workspace) - return; - TS_ASSERT(workspace.get()); - - EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); - TS_ASSERT(ews); - if (!ews) - return; - TS_ASSERT(ews.get()); - TS_ASSERT_EQUALS(ews->getNumberHistograms(), 3); - - TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Max_List() @@ -611,29 +525,6 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite // expected number of spectra and length of the alg history doCommonEventLoadChecks(alg, 4, 2); - return; - - - - TS_ASSERT_THROWS_NOTHING(alg.execute()); - TS_ASSERT(alg.isExecuted()); - - // Test basic props of the ws - Workspace_sptr workspace; - TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); - TS_ASSERT(workspace); - if (!workspace) - return; - TS_ASSERT(workspace.get()); - - EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); - TS_ASSERT(ews); - if (!ews) - return; - TS_ASSERT(ews.get()); - TS_ASSERT_EQUALS(ews->getNumberHistograms(), 4); - - TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_loadEventNexus_Min_Max_List() @@ -653,28 +544,6 @@ class LoadNexusProcessedTest: public CxxTest::TestSuite // expected number of spectra and length of the alg history doCommonEventLoadChecks(alg, 5, 2); - return; - - - TS_ASSERT_THROWS_NOTHING(alg.execute()); - TS_ASSERT(alg.isExecuted()); - - // Test basic props of the ws - Workspace_sptr workspace; - TS_ASSERT_THROWS_NOTHING(workspace = AnalysisDataService::Instance().retrieve(output_ws)); - TS_ASSERT(workspace); - if (!workspace) - return; - TS_ASSERT(workspace.get()); - - EventWorkspace_sptr ews = boost::dynamic_pointer_cast(workspace); - TS_ASSERT(ews); - if (!ews) - return; - TS_ASSERT(ews.get()); - TS_ASSERT_EQUALS(ews->getNumberHistograms(), 5); - - TS_ASSERT_EQUALS(ews->getHistory().size(), 2); } void test_load_saved_workspace_group() From 34427bb6f3c0b0bd3099b8aacabff969942f450f Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Tue, 13 Jan 2015 12:57:51 +0100 Subject: [PATCH 035/130] Refs #10774. Adding small correction to width in 1D-spectrum --- .../PoldiUtilities/PoldiTimeTransformer.h | 3 ++ .../PoldiSpectrumDomainFunction.cpp | 29 ++++++++++--------- .../PoldiUtilities/PoldiTimeTransformer.cpp | 5 +--- .../SINQ/test/PoldiTimeTransformerTest.h | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h index b8fc6cc67b57..090bee3613f7 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h @@ -76,18 +76,21 @@ class DetectorElementData { m_timeFactor = current.sinTheta / center.sinTheta * current.totalDistance / center.totalDistance; m_widthFactor = current.cosTheta - center.cosTheta; + m_tofFactor = center.tof1A / current.tof1A; } double intensityFactor() const { return m_intensityFactor; } double lambdaFactor() const { return m_lambdaFactor; } double timeFactor() const { return m_timeFactor; } double widthFactor() const { return m_widthFactor; } + double tofFactor() const { return m_tofFactor; } protected: double m_intensityFactor; double m_lambdaFactor; double m_timeFactor; double m_widthFactor; + double m_tofFactor; }; typedef boost::shared_ptr diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp index 7e2ddc44b6e7..5185433915be 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp @@ -64,7 +64,7 @@ void PoldiSpectrumDomainFunction::function1DSpectrum( * terminated by the position in the detector, so the index is stored. */ double fwhm = getParameter("Fwhm"); - double fwhmT = m_timeTransformer->timeTransformedWidth(fwhm, index); + double fwhmT = m_timeTransformer->dToTOF(fwhm); double fwhmChannel = fwhmT / m_deltaT; double sigmaChannel = fwhmChannel / (2.0 * sqrt(2.0 * log(2.0))); @@ -121,24 +121,27 @@ void PoldiSpectrumDomainFunction::poldiFunction1D(const std::vector &indices, const FunctionDomain1D &domain, FunctionValues &values) const { - for (auto index = indices.begin(); index != indices.end(); ++index) { - double deltaD = domain[1] - domain[0]; - double fwhm = getParameter("Fwhm"); - double fwhmChannel = fwhm / deltaD; - double sigmaChannel = fwhmChannel / (2.0 * sqrt(2.0 * log(2.0))); + double deltaD = domain[1] - domain[0]; - double centre = getParameter("Centre"); + double fwhm = getParameter("Fwhm"); - double area = getParameter("Area"); - double areaT = m_timeTransformer->timeTransformedIntensity( - area, centre, static_cast(*index)); + double centre = getParameter("Centre"); + double area = getParameter("Area"); - double centreTOffsetChannel = centre / deltaD; - int centreChannel = static_cast(centreTOffsetChannel); + double centreTOffsetChannel = centre / deltaD; + int centreChannel = static_cast(centreTOffsetChannel); + + int offset = static_cast(domain[0] / deltaD + 0.5); + + for (auto index = indices.begin(); index != indices.end(); ++index) { + double fwhmT = m_timeTransformer->timeTransformedWidth(fwhm, *index); + double fwhmChannel = fwhmT / m_deltaT; + double sigmaChannel = fwhmChannel / (2.0 * sqrt(2.0 * log(2.0))); int widthChannels = std::max(2, static_cast(fwhmChannel * 2.0)); - int offset = static_cast(domain[0] / deltaD + 0.5); + double areaT = m_timeTransformer->timeTransformedIntensity( + area, centre, static_cast(*index)); for (int i = centreChannel - widthChannels; i <= centreChannel + widthChannels; ++i) { diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiTimeTransformer.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiTimeTransformer.cpp index 2a036d82f8a3..6fcdd803f240 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiTimeTransformer.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiTimeTransformer.cpp @@ -39,10 +39,7 @@ double PoldiTimeTransformer::dToTOF(double d) const { double PoldiTimeTransformer::timeTransformedWidth(double widthD, size_t detectorIndex) const { - UNUSED_ARG(detectorIndex); - - return dToTOF( - widthD); // + m_detectorElementData[detectorIndex]->widthFactor() * 0.0; + return dToTOF(widthD) * m_detectorElementData[detectorIndex]->tofFactor(); } double PoldiTimeTransformer::timeTransformedCentre(double centreD, diff --git a/Code/Mantid/Framework/SINQ/test/PoldiTimeTransformerTest.h b/Code/Mantid/Framework/SINQ/test/PoldiTimeTransformerTest.h index 1c238e4304fb..b385bdd1a870 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiTimeTransformerTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiTimeTransformerTest.h @@ -108,7 +108,7 @@ class PoldiTimeTransformerTest : public CxxTest::TestSuite TestablePoldiTimeTransformer function; function.initializeFromPoldiInstrument(m_instrument); - TS_ASSERT_DELTA(function.timeTransformedWidth(fwhm, 342) / deltaT, 4.526804, 1e-5); + TS_ASSERT_DELTA(function.timeTransformedWidth(fwhm, 342) / deltaT, 4.526804 * function.m_detectorElementData[342]->tofFactor(), 1e-5); } void testTimeTransformedCentre() From 88079ac179841c93612ec4fb3536a0be9585381a Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Tue, 13 Jan 2015 14:29:28 +0100 Subject: [PATCH 036/130] Refs #10774. Fixing double/int problem. --- Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h b/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h index f7707144889a..c12b0493bab6 100644 --- a/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h +++ b/Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h @@ -100,7 +100,7 @@ class Poldi2DFunctionTest : public CxxTest::TestSuite function2D->addFunction(second); // indices for poldiFunction1D - std::vector indices(10, 0.0); + std::vector indices(10, 0); FunctionDomain1DVector domain(0.0, 10.0, 11); FunctionValues values(domain); From 506d67c551d914b2ce4874d5a17b509c5662b632 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Tue, 13 Jan 2015 15:01:44 +0100 Subject: [PATCH 037/130] Refs #10774. Small addition to docs. --- .../source/algorithms/PoldiFitPeaks2D-v1.rst | 9 +++++++++ .../source/images/PoldiFitPeaks2D_Si_1D.png | Bin 0 -> 21466 bytes 2 files changed, 9 insertions(+) create mode 100644 Code/Mantid/docs/source/images/PoldiFitPeaks2D_Si_1D.png diff --git a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst index c9f86b42e680..6073a0da5748 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst @@ -99,4 +99,13 @@ Now the spectrum looks different, like in the example below. Simulated 2D-spectrum of silicon powder with background. +Furthermore, a 1D diffractogram is also calculated, which shows all peaks that were used to calculate the 2D spectrum as well. + +.. figure:: /images/PoldiFitPeaks2D_Si_1D.png + :figwidth: 15 cm + :align: center + :alt: Calculated diffractogram for Silicon powder standard. + + Calculated diffractogram for Silicon powder standard. + .. categories:: diff --git a/Code/Mantid/docs/source/images/PoldiFitPeaks2D_Si_1D.png b/Code/Mantid/docs/source/images/PoldiFitPeaks2D_Si_1D.png new file mode 100644 index 0000000000000000000000000000000000000000..4091d018d5f7074e79d4815b232aa4602d529bd9 GIT binary patch literal 21466 zcmce;1yoht+6KB2uxL?0T2MgPbhm_}gfvKZNJ{4h1Sydc>F(~5?rtgRlJ3}a+`0YY zob#W*?mzChjNw?W*mKQ%-{*baXD)x4w_+Ig3GYK75R5mkMdct6WEBVmDdz4iaK+k# zR2dwQZG_(_+`W5uYC(D)oZkEJTEzwe!E8nRLkg$EB!WQ5A#X&56ddEWW*pRUPj2q) zIs6nBMhQ*!_)c)2=05GBsF1no44ReV%OSj?(F&9N+{v+u2BrMeu{z`Y@}RMgYGpE3 z^2NqQ6e%>_At*Qx4lb4^U5A+6Kt5=%O$lbhL@Aq(901fDR^TrJS z)+-bh?4u1=-9^)@W-QX5?z^-6$uf=?$J>m`c~MLZC3$&YW|}qYUAtUkOqLG|SFU$+ z3ljwTFwn3pf24I)l^RLM^S#&8WBo7~tEzIkn#cfZcV*pnKOZVJP+>j+4V~VH!!gzd zg|3{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b?mMvR0m2p9z&sSGhXEvLoSQP+F8|H`s005E~ zJqki5u(0002V>mT_YU6287-#!2U002ovPDHLk FV1g9g=WYN1 literal 0 HcmV?d00001 From 31b6bc518a2bab566ce4af657bada8270c6b131e Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Tue, 13 Jan 2015 16:47:39 +0100 Subject: [PATCH 038/130] Refs #10263. Clang-formatting new source code --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h | 169 ++++--- .../SINQ/inc/MantidSINQ/PoldiPeakSummary.h | 87 ++-- .../Framework/SINQ/src/PoldiFitPeaks1D.cpp | 258 +++++----- .../Framework/SINQ/src/PoldiFitPeaks1D2.cpp | 458 +++++++++--------- .../Framework/SINQ/src/PoldiPeakSummary.cpp | 202 ++++---- 5 files changed, 598 insertions(+), 576 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h index c0026de1deb0..6266d520f896 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h @@ -11,114 +11,127 @@ #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" -namespace Mantid -{ -namespace Poldi -{ - /// Helper class for refining peaks with overlapping ranges - class RefinedRange - { - public: - RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples); - RefinedRange(double xStart, double xEnd, const std::vector &peaks); - RefinedRange(const RefinedRange &other); +namespace Mantid { +namespace Poldi { +/// Helper class for refining peaks with overlapping ranges +class RefinedRange { +public: + RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples); + RefinedRange(double xStart, double xEnd, + const std::vector &peaks); + RefinedRange(const RefinedRange &other); - bool operator <(const RefinedRange &other) const; + bool operator<(const RefinedRange &other) const; - bool overlaps(const RefinedRange &other) const; - void merge(const RefinedRange &other); + bool overlaps(const RefinedRange &other) const; + void merge(const RefinedRange &other); - const std::vector getPeaks() const { return m_peaks; } + const std::vector getPeaks() const { return m_peaks; } - double getXStart() const { return m_xStart; } - double getXEnd() const { return m_xEnd; } + double getXStart() const { return m_xStart; } + double getXEnd() const { return m_xEnd; } - private: - std::vector m_peaks; - double m_xStart; - double m_xEnd; - }; +private: + std::vector m_peaks; + double m_xStart; + double m_xEnd; +}; - typedef boost::shared_ptr RefinedRange_sptr; +typedef boost::shared_ptr RefinedRange_sptr; - bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs); +bool operator<(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs); - /** PoldiFitPeaks1D2 : - - PoldiFitPeaks1D2 fits multiple peaks to POLDI auto-correlation data. +/** PoldiFitPeaks1D2 : - @author Michael Wedel, Paul Scherrer Institut - SINQ - @date 17/03/2014 + PoldiFitPeaks1D2 fits multiple peaks to POLDI auto-correlation data. - Copyright © 2014 PSI-MSS + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 17/03/2014 - This file is part of Mantid. + Copyright © 2014 PSI-MSS - Mantid is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is part of Mantid. - Mantid is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - File change history is stored at: - Code Documentation is available at: - */ - class MANTID_SINQ_DLL PoldiFitPeaks1D2 : public API::Algorithm - { - public: - PoldiFitPeaks1D2(); - virtual ~PoldiFitPeaks1D2(); - - virtual const std::string name() const; - ///Summary of algorithms purpose - virtual const std::string summary() const {return "PoldiPeakFit1D fits peak profiles to POLDI auto-correlation data.";} + You should have received a copy of the GNU General Public License + along with this program. If not, see . - virtual int version() const; - virtual const std::string category() const; + File change history is stored at: + Code Documentation is available at: +*/ +class MANTID_SINQ_DLL PoldiFitPeaks1D2 : public API::Algorithm { +public: + PoldiFitPeaks1D2(); + virtual ~PoldiFitPeaks1D2(); - protected: - PoldiPeakCollection_sptr fitPeaks(const PoldiPeakCollection_sptr &peaks); + virtual const std::string name() const; + /// Summary of algorithms purpose + virtual const std::string summary() const { + return "PoldiPeakFit1D fits peak profiles to POLDI auto-correlation data."; + } - int getBestChebyshevPolynomialDegree(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range); + virtual int version() const; + virtual const std::string category() const; - PoldiPeakCollection_sptr getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const; - bool peakIsAcceptable(const PoldiPeak_sptr &peak) const; +protected: + PoldiPeakCollection_sptr fitPeaks(const PoldiPeakCollection_sptr &peaks); - void setPeakFunction(const std::string &peakFunction); - PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; + int getBestChebyshevPolynomialDegree( + const DataObjects::Workspace2D_sptr &dataWorkspace, + const RefinedRange_sptr &range); - std::vector getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; - std::vector getReducedRanges(const std::vector &ranges) const; + PoldiPeakCollection_sptr + getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const; - API::IFunction_sptr getRangeProfile(const RefinedRange_sptr &range, int n) const; - API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; - void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; - double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; + bool peakIsAcceptable(const PoldiPeak_sptr &peak) const; + void setPeakFunction(const std::string &peakFunction); - API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n); + PoldiPeakCollection_sptr getInitializedPeakCollection( + const DataObjects::TableWorkspace_sptr &peakTable) const; - PoldiPeakCollection_sptr m_peaks; - std::string m_profileTemplate; + std::vector + getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const; - API::WorkspaceGroup_sptr m_fitplots; + std::vector + getReducedRanges(const std::vector &ranges) const; + API::IFunction_sptr getRangeProfile(const RefinedRange_sptr &range, + int n) const; - double m_fwhmMultiples; + API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; - private: - void init(); - void exec(); - }; + void + setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, + const API::IFunction_sptr &fittedFunction) const; + double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; + + API::IAlgorithm_sptr + getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, + const RefinedRange_sptr &range, int n); + + PoldiPeakCollection_sptr m_peaks; + std::string m_profileTemplate; + + API::WorkspaceGroup_sptr m_fitplots; + + double m_fwhmMultiples; + +private: + void init(); + void exec(); +}; } // namespace Poldi } // namespace Mantid -#endif /* MANTID_SINQ_POLDIFITPEAKS1D2_H_ */ +#endif /* MANTID_SINQ_POLDIFITPEAKS1D2_H_ */ diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h index 4c814fc35faf..75370c301473 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSummary.h @@ -8,65 +8,62 @@ #include "MantidAPI/TableRow.h" #include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" -namespace Mantid -{ -namespace Poldi -{ +namespace Mantid { +namespace Poldi { - /** PoldiPeakSummary +/** PoldiPeakSummary - This small algorithm produces a summary table for a given - PoldiPeakCollection, similar to what the original data - analysis software produced. + This small algorithm produces a summary table for a given + PoldiPeakCollection, similar to what the original data + analysis software produced. - @author Michael Wedel, Paul Scherrer Institut - SINQ - @date 03/12/2014 + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 03/12/2014 - Copyright © 2014 PSI-MSS + Copyright © 2014 PSI-MSS - This file is part of Mantid. + This file is part of Mantid. - Mantid is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. - Mantid is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . - File change history is stored at: - Code Documentation is available at: - */ - class MANTID_SINQ_DLL PoldiPeakSummary : public API::Algorithm - { - public: - PoldiPeakSummary(); - virtual ~PoldiPeakSummary(); - - virtual const std::string name() const; - virtual int version() const; - virtual const std::string category() const; - virtual const std::string summary() const; + File change history is stored at: + Code Documentation is available at: +*/ +class MANTID_SINQ_DLL PoldiPeakSummary : public API::Algorithm { +public: + PoldiPeakSummary(); + virtual ~PoldiPeakSummary(); - protected: - DataObjects::TableWorkspace_sptr getSummaryTable(const PoldiPeakCollection_sptr &peakCollection) const; - DataObjects::TableWorkspace_sptr getInitializedResultWorkspace() const; + virtual const std::string name() const; + virtual int version() const; + virtual const std::string category() const; + virtual const std::string summary() const; - void storePeakSummary(API::TableRow tableRow, const PoldiPeak_sptr &peak) const; +protected: + DataObjects::TableWorkspace_sptr + getSummaryTable(const PoldiPeakCollection_sptr &peakCollection) const; + DataObjects::TableWorkspace_sptr getInitializedResultWorkspace() const; - private: - void init(); - void exec(); - - }; + void storePeakSummary(API::TableRow tableRow, + const PoldiPeak_sptr &peak) const; +private: + void init(); + void exec(); +}; } // namespace Poldi } // namespace Mantid -#endif /* MANTID_POLDI_POLDIPEAKSUMMARY_H_ */ +#endif /* MANTID_POLDI_POLDIPEAKSUMMARY_H_ */ diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp index dddcbc5a272d..6fb0379d58b1 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp @@ -15,175 +15,187 @@ #include "MantidAPI/CompositeFunction.h" +namespace Mantid { +namespace Poldi { -namespace Mantid -{ -namespace Poldi -{ - -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::DataObjects; -using namespace Mantid::CurveFitting; +using namespace Kernel; +using namespace API; +using namespace DataObjects; +using namespace CurveFitting; // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(PoldiFitPeaks1D) +PoldiFitPeaks1D::PoldiFitPeaks1D() + : m_peaks(), m_profileTemplate(), m_backgroundTemplate(), m_profileTies(), + m_fwhmMultiples(1.0) {} -PoldiFitPeaks1D::PoldiFitPeaks1D() : - m_peaks(), - m_profileTemplate(), - m_backgroundTemplate(), - m_profileTies(), - m_fwhmMultiples(1.0) -{ - -} - -PoldiFitPeaks1D::~PoldiFitPeaks1D() -{ -} - +PoldiFitPeaks1D::~PoldiFitPeaks1D() {} /// Algorithm's name for identification. @see Algorithm::name -const std::string PoldiFitPeaks1D::name() const { return "PoldiFitPeaks1D";} +const std::string PoldiFitPeaks1D::name() const { return "PoldiFitPeaks1D"; } /// Algorithm's version for identification. @see Algorithm::version -int PoldiFitPeaks1D::version() const { return 1;} +int PoldiFitPeaks1D::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string PoldiFitPeaks1D::category() const { return "SINQ\\Poldi"; } -void PoldiFitPeaks1D::init() -{ - declareProperty(new WorkspaceProperty("InputWorkspace","",Direction::Input), "An input workspace containing a POLDI auto-correlation spectrum."); - boost::shared_ptr > minFwhmPerDirection = boost::make_shared >(); - minFwhmPerDirection->setLower(2.0); - declareProperty("FwhmMultiples", 2.0, minFwhmPerDirection, "Each peak will be fitted using x times FWHM data in each direction.", Direction::Input); - - std::vector peakFunctions = FunctionFactory::Instance().getFunctionNames(); - boost::shared_ptr > peakFunctionNames(new ListValidator(peakFunctions)); - declareProperty("PeakFunction", "Gaussian", peakFunctionNames, "Peak function that will be fitted to all peaks.", Direction::Input); - - declareProperty(new WorkspaceProperty("PoldiPeakTable","",Direction::Input), "A table workspace containing POLDI peak data."); - - declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); - declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); - - m_backgroundTemplate = FunctionFactory::Instance().createInitialized("name=UserFunction, Formula=A0 + A1*(x - x0)^2"); - m_profileTies = "f1.x0 = f0.PeakCentre"; +void PoldiFitPeaks1D::init() { + declareProperty( + new WorkspaceProperty("InputWorkspace", "", + Direction::Input), + "An input workspace containing a POLDI auto-correlation spectrum."); + boost::shared_ptr > minFwhmPerDirection = + boost::make_shared >(); + minFwhmPerDirection->setLower(2.0); + declareProperty( + "FwhmMultiples", 2.0, minFwhmPerDirection, + "Each peak will be fitted using x times FWHM data in each direction.", + Direction::Input); + + std::vector peakFunctions = + FunctionFactory::Instance().getFunctionNames(); + boost::shared_ptr > peakFunctionNames( + new ListValidator(peakFunctions)); + declareProperty("PeakFunction", "Gaussian", peakFunctionNames, + "Peak function that will be fitted to all peaks.", + Direction::Input); + + declareProperty(new WorkspaceProperty("PoldiPeakTable", "", + Direction::Input), + "A table workspace containing POLDI peak data."); + + declareProperty(new WorkspaceProperty( + "OutputWorkspace", "RefinedPeakTable", Direction::Output), + "Output workspace with refined peak data."); + declareProperty(new WorkspaceProperty( + "FitPlotsWorkspace", "FitPlots", Direction::Output), + "Plots of all peak fits."); + + m_backgroundTemplate = FunctionFactory::Instance().createInitialized( + "name=UserFunction, Formula=A0 + A1*(x - x0)^2"); + m_profileTies = "f1.x0 = f0.PeakCentre"; } -void PoldiFitPeaks1D::setPeakFunction(const std::string &peakFunction) -{ - m_profileTemplate = peakFunction; +void PoldiFitPeaks1D::setPeakFunction(const std::string &peakFunction) { + m_profileTemplate = peakFunction; } -PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const -{ - PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); - peakCollection->setProfileFunctionName(m_profileTemplate); +PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection( + const DataObjects::TableWorkspace_sptr &peakTable) const { + PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); + peakCollection->setProfileFunctionName(m_profileTemplate); - return peakCollection; + return peakCollection; } -IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { - IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); - clonedProfile->setCentre(poldiPeak->q()); - clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); - clonedProfile->setHeight(poldiPeak->intensity()); +IFunction_sptr +PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { + IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction(m_profileTemplate)); + clonedProfile->setCentre(poldiPeak->q()); + clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); + clonedProfile->setHeight(poldiPeak->intensity()); - IFunction_sptr clonedBackground = m_backgroundTemplate->clone(); + IFunction_sptr clonedBackground = m_backgroundTemplate->clone(); - CompositeFunction_sptr totalProfile(new CompositeFunction); - totalProfile->initialize(); - totalProfile->addFunction(clonedProfile); - totalProfile->addFunction(clonedBackground); + CompositeFunction_sptr totalProfile(new CompositeFunction); + totalProfile->initialize(); + totalProfile->addFunction(clonedProfile); + totalProfile->addFunction(clonedBackground); - if(!m_profileTies.empty()) { - totalProfile->addTies(m_profileTies); - } + if (!m_profileTies.empty()) { + totalProfile->addTies(m_profileTies); + } - return totalProfile; + return totalProfile; } -void PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const -{ - CompositeFunction_sptr totalFunction = boost::dynamic_pointer_cast(fittedFunction); - - if(totalFunction) { - IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(totalFunction->getFunction(0)); - - if(peakFunction) { - poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); - poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); - poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); - } +void PoldiFitPeaks1D::setValuesFromProfileFunction( + PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const { + CompositeFunction_sptr totalFunction = + boost::dynamic_pointer_cast(fittedFunction); + + if (totalFunction) { + IPeakFunction_sptr peakFunction = + boost::dynamic_pointer_cast( + totalFunction->getFunction(0)); + + if (peakFunction) { + poldiPeak->setIntensity( + UncertainValue(peakFunction->height(), peakFunction->getError(0))); + poldiPeak->setQ( + UncertainValue(peakFunction->centre(), peakFunction->getError(1))); + poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), + getFwhmWidthRelation(peakFunction) * + peakFunction->getError(2))); } + } } -double PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) const -{ - return peakFunction->fwhm() / peakFunction->getParameter(2); +double +PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) const { + return peakFunction->fwhm() / peakFunction->getParameter(2); } -void PoldiFitPeaks1D::exec() -{ - setPeakFunction(getProperty("PeakFunction")); - - // Number of points around the peak center to use for the fit - m_fwhmMultiples = getProperty("FwhmMultiples"); +void PoldiFitPeaks1D::exec() { + setPeakFunction(getProperty("PeakFunction")); - // try to construct PoldiPeakCollection from provided TableWorkspace - TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); - m_peaks = getInitializedPeakCollection(poldiPeakTable); + // Number of points around the peak center to use for the fit + m_fwhmMultiples = getProperty("FwhmMultiples"); + // try to construct PoldiPeakCollection from provided TableWorkspace + TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); + m_peaks = getInitializedPeakCollection(poldiPeakTable); - g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; + g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; - Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); + Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); - WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); + WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); - for(size_t i = 0; i < m_peaks->peakCount(); ++i) { - PoldiPeak_sptr currentPeak = m_peaks->peak(i); - IFunction_sptr currentProfile = getPeakProfile(currentPeak); + for (size_t i = 0; i < m_peaks->peakCount(); ++i) { + PoldiPeak_sptr currentPeak = m_peaks->peak(i); + IFunction_sptr currentProfile = getPeakProfile(currentPeak); - IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentPeak, currentProfile); + IAlgorithm_sptr fit = + getFitAlgorithm(dataWorkspace, currentPeak, currentProfile); - bool fitSuccess = fit->execute(); + bool fitSuccess = fit->execute(); - if(fitSuccess) { - setValuesFromProfileFunction(currentPeak, fit->getProperty("Function")); + if (fitSuccess) { + setValuesFromProfileFunction(currentPeak, fit->getProperty("Function")); - MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); - fitPlotGroup->addWorkspace(fpg); - } + MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); + fitPlotGroup->addWorkspace(fpg); } + } - - setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("FitPlotsWorkspace", fitPlotGroup); + setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); + setProperty("FitPlotsWorkspace", fitPlotGroup); } -IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const IFunction_sptr &profile) -{ - double width = peak->fwhm(); - double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples; - - std::pair xBorders(peak->q() - extent, peak->q() + extent); - - IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); - fitAlgorithm->setProperty("CreateOutput", true); - fitAlgorithm->setProperty("Output", "FitPeaks1D"); - fitAlgorithm->setProperty("CalcErrors", true); - fitAlgorithm->setProperty("Function", profile); - fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); - fitAlgorithm->setProperty("WorkspaceIndex", 0); - fitAlgorithm->setProperty("StartX", xBorders.first); - fitAlgorithm->setProperty("EndX", xBorders.second); - - return fitAlgorithm; +IAlgorithm_sptr +PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, + const PoldiPeak_sptr &peak, + const IFunction_sptr &profile) { + double width = peak->fwhm(); + double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples; + + std::pair xBorders(peak->q() - extent, peak->q() + extent); + + IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); + fitAlgorithm->setProperty("CreateOutput", true); + fitAlgorithm->setProperty("Output", "FitPeaks1D"); + fitAlgorithm->setProperty("CalcErrors", true); + fitAlgorithm->setProperty("Function", profile); + fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); + fitAlgorithm->setProperty("WorkspaceIndex", 0); + fitAlgorithm->setProperty("StartX", xBorders.first); + fitAlgorithm->setProperty("EndX", xBorders.second); + + return fitAlgorithm; } } // namespace Poldi diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp index af202a5283ca..aec218c26060 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -19,330 +19,332 @@ #include #include - -namespace Mantid -{ -namespace Poldi -{ +namespace Mantid { +namespace Poldi { using namespace Kernel; using namespace API; using namespace DataObjects; using namespace CurveFitting; -RefinedRange::RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples) : - m_peaks(1, peak) -{ - double width = peak->fwhm(); - double extent = std::max(0.002, width) * fwhmMultiples; - - m_xStart = peak->q() - extent; - m_xEnd = peak->q() + extent; -} +RefinedRange::RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples) + : m_peaks(1, peak) { + double width = peak->fwhm(); + double extent = std::max(0.002, width) * fwhmMultiples; -RefinedRange::RefinedRange(double xStart, double xEnd, const std::vector &peaks) : - m_peaks(peaks), - m_xStart(xStart), - m_xEnd(xEnd) -{ + m_xStart = peak->q() - extent; + m_xEnd = peak->q() + extent; } -RefinedRange::RefinedRange(const RefinedRange &other) : - m_peaks(other.m_peaks), - m_xStart(other.m_xStart), - m_xEnd(other.m_xEnd) -{ +RefinedRange::RefinedRange(double xStart, double xEnd, + const std::vector &peaks) + : m_peaks(peaks), m_xStart(xStart), m_xEnd(xEnd) {} -} +RefinedRange::RefinedRange(const RefinedRange &other) + : m_peaks(other.m_peaks), m_xStart(other.m_xStart), m_xEnd(other.m_xEnd) {} -bool RefinedRange::operator <(const RefinedRange &other) const -{ - return m_xStart < other.m_xStart; +bool RefinedRange::operator<(const RefinedRange &other) const { + return m_xStart < other.m_xStart; } -bool RefinedRange::overlaps(const RefinedRange &other) const -{ - return (other.m_xStart > m_xStart && other.m_xStart < m_xEnd) - || (other.m_xEnd > m_xStart && other.m_xEnd < m_xEnd) - || (other.m_xStart < m_xStart && other.m_xEnd > m_xEnd); +bool RefinedRange::overlaps(const RefinedRange &other) const { + return (other.m_xStart > m_xStart && other.m_xStart < m_xEnd) || + (other.m_xEnd > m_xStart && other.m_xEnd < m_xEnd) || + (other.m_xStart < m_xStart && other.m_xEnd > m_xEnd); } -void RefinedRange::merge(const RefinedRange &other) -{ - m_peaks.insert(m_peaks.end(), other.m_peaks.begin(), other.m_peaks.end()); +void RefinedRange::merge(const RefinedRange &other) { + m_peaks.insert(m_peaks.end(), other.m_peaks.begin(), other.m_peaks.end()); - m_xStart = std::min(m_xStart, other.m_xStart); - m_xEnd = std::max(m_xEnd, other.m_xEnd); + m_xStart = std::min(m_xStart, other.m_xStart); + m_xEnd = std::max(m_xEnd, other.m_xEnd); } -bool operator <(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs) -{ - return (*lhs) < (*rhs); +bool operator<(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs) { + return (*lhs) < (*rhs); } - - // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(PoldiFitPeaks1D2) +PoldiFitPeaks1D2::PoldiFitPeaks1D2() + : m_peaks(), m_profileTemplate(), m_fitplots(new WorkspaceGroup), + m_fwhmMultiples(1.0) {} -PoldiFitPeaks1D2::PoldiFitPeaks1D2() : - m_peaks(), - m_profileTemplate(), - m_fitplots(new WorkspaceGroup), - m_fwhmMultiples(1.0) -{ - -} - -PoldiFitPeaks1D2::~PoldiFitPeaks1D2() -{ -} - +PoldiFitPeaks1D2::~PoldiFitPeaks1D2() {} /// Algorithm's name for identification. @see Algorithm::name -const std::string PoldiFitPeaks1D2::name() const { return "PoldiFitPeaks1D";} +const std::string PoldiFitPeaks1D2::name() const { return "PoldiFitPeaks1D"; } /// Algorithm's version for identification. @see Algorithm::version -int PoldiFitPeaks1D2::version() const { return 2;} +int PoldiFitPeaks1D2::version() const { return 2; } /// Algorithm's category for identification. @see Algorithm::category const std::string PoldiFitPeaks1D2::category() const { return "SINQ\\Poldi"; } -void PoldiFitPeaks1D2::init() -{ - declareProperty(new WorkspaceProperty("InputWorkspace","",Direction::Input), "An input workspace containing a POLDI auto-correlation spectrum."); - boost::shared_ptr > minFwhmPerDirection = boost::make_shared >(); - minFwhmPerDirection->setLower(2.0); - declareProperty("FwhmMultiples", 2.0, minFwhmPerDirection, "Each peak will be fitted using x times FWHM data in each direction.", Direction::Input); - - std::vector peakFunctions = FunctionFactory::Instance().getFunctionNames(); - boost::shared_ptr > peakFunctionNames(new ListValidator(peakFunctions)); - declareProperty("PeakFunction", "Gaussian", peakFunctionNames, "Peak function that will be fitted to all peaks.", Direction::Input); - - declareProperty(new WorkspaceProperty("PoldiPeakTable","",Direction::Input), "A table workspace containing POLDI peak data."); - - declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); - declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); +void PoldiFitPeaks1D2::init() { + declareProperty( + new WorkspaceProperty("InputWorkspace", "", + Direction::Input), + "An input workspace containing a POLDI auto-correlation spectrum."); + boost::shared_ptr > minFwhmPerDirection = + boost::make_shared >(); + minFwhmPerDirection->setLower(2.0); + declareProperty( + "FwhmMultiples", 2.0, minFwhmPerDirection, + "Each peak will be fitted using x times FWHM data in each direction.", + Direction::Input); + + std::vector peakFunctions = + FunctionFactory::Instance().getFunctionNames(); + boost::shared_ptr > peakFunctionNames( + new ListValidator(peakFunctions)); + declareProperty("PeakFunction", "Gaussian", peakFunctionNames, + "Peak function that will be fitted to all peaks.", + Direction::Input); + + declareProperty(new WorkspaceProperty("PoldiPeakTable", "", + Direction::Input), + "A table workspace containing POLDI peak data."); + + declareProperty(new WorkspaceProperty( + "OutputWorkspace", "RefinedPeakTable", Direction::Output), + "Output workspace with refined peak data."); + declareProperty(new WorkspaceProperty( + "FitPlotsWorkspace", "FitPlots", Direction::Output), + "Plots of all peak fits."); } -void PoldiFitPeaks1D2::setPeakFunction(const std::string &peakFunction) -{ - m_profileTemplate = peakFunction; +void PoldiFitPeaks1D2::setPeakFunction(const std::string &peakFunction) { + m_profileTemplate = peakFunction; } -PoldiPeakCollection_sptr PoldiFitPeaks1D2::getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const -{ - PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); - peakCollection->setProfileFunctionName(m_profileTemplate); +PoldiPeakCollection_sptr PoldiFitPeaks1D2::getInitializedPeakCollection( + const DataObjects::TableWorkspace_sptr &peakTable) const { + PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); + peakCollection->setProfileFunctionName(m_profileTemplate); - return peakCollection; + return peakCollection; } -std::vector PoldiFitPeaks1D2::getRefinedRanges(const PoldiPeakCollection_sptr &peaks) const -{ - std::vector ranges; - for(size_t i = 0; i < peaks->peakCount(); ++i) { - ranges.push_back(boost::make_shared(peaks->peak(i), m_fwhmMultiples)); - } +std::vector PoldiFitPeaks1D2::getRefinedRanges( + const PoldiPeakCollection_sptr &peaks) const { + std::vector ranges; + for (size_t i = 0; i < peaks->peakCount(); ++i) { + ranges.push_back( + boost::make_shared(peaks->peak(i), m_fwhmMultiples)); + } - return ranges; + return ranges; } -std::vector PoldiFitPeaks1D2::getReducedRanges(const std::vector &ranges) const -{ - std::vector workingRanges(ranges); - std::sort(workingRanges.begin(), workingRanges.end()); +std::vector PoldiFitPeaks1D2::getReducedRanges( + const std::vector &ranges) const { + std::vector workingRanges(ranges); + std::sort(workingRanges.begin(), workingRanges.end()); - std::vector reducedRanges; - reducedRanges.push_back(boost::make_shared(*(workingRanges.front()))); + std::vector reducedRanges; + reducedRanges.push_back( + boost::make_shared(*(workingRanges.front()))); - for(size_t i = 1; i < workingRanges.size(); ++i) { - RefinedRange_sptr lastReduced = reducedRanges.back(); - RefinedRange_sptr current = workingRanges[i]; + for (size_t i = 1; i < workingRanges.size(); ++i) { + RefinedRange_sptr lastReduced = reducedRanges.back(); + RefinedRange_sptr current = workingRanges[i]; - if(!lastReduced->overlaps(*current)) { - reducedRanges.push_back(boost::make_shared(*current)); - } else { - lastReduced->merge(*current); - } + if (!lastReduced->overlaps(*current)) { + reducedRanges.push_back(boost::make_shared(*current)); + } else { + lastReduced->merge(*current); } + } - return reducedRanges; + return reducedRanges; } -API::IFunction_sptr PoldiFitPeaks1D2::getRangeProfile(const RefinedRange_sptr &range, int n) const -{ - CompositeFunction_sptr totalProfile(new CompositeFunction); - totalProfile->initialize(); +API::IFunction_sptr +PoldiFitPeaks1D2::getRangeProfile(const RefinedRange_sptr &range, int n) const { + CompositeFunction_sptr totalProfile(new CompositeFunction); + totalProfile->initialize(); - std::vector peaks = range->getPeaks(); - for(auto it = peaks.begin(); it != peaks.end(); ++it) { - totalProfile->addFunction(getPeakProfile(*it)); - } + std::vector peaks = range->getPeaks(); + for (auto it = peaks.begin(); it != peaks.end(); ++it) { + totalProfile->addFunction(getPeakProfile(*it)); + } - totalProfile->addFunction(FunctionFactory::Instance().createInitialized("name=Chebyshev,n=" + boost::lexical_cast(n) - + ",StartX=" + boost::lexical_cast(range->getXStart()) - + ",EndX=" + boost::lexical_cast(range->getXEnd()))); + totalProfile->addFunction(FunctionFactory::Instance().createInitialized( + "name=Chebyshev,n=" + boost::lexical_cast(n) + ",StartX=" + + boost::lexical_cast(range->getXStart()) + ",EndX=" + + boost::lexical_cast(range->getXEnd()))); - return totalProfile; + return totalProfile; } -IFunction_sptr PoldiFitPeaks1D2::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { - IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); - clonedProfile->setCentre(poldiPeak->q()); - clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); - clonedProfile->setHeight(poldiPeak->intensity()); +IFunction_sptr +PoldiFitPeaks1D2::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { + IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction(m_profileTemplate)); + clonedProfile->setCentre(poldiPeak->q()); + clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); + clonedProfile->setHeight(poldiPeak->intensity()); - return clonedProfile; + return clonedProfile; } -void PoldiFitPeaks1D2::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const -{ - IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(fittedFunction); - - if(peakFunction) { - poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); - poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); - poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); - } +void PoldiFitPeaks1D2::setValuesFromProfileFunction( + PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const { + IPeakFunction_sptr peakFunction = + boost::dynamic_pointer_cast(fittedFunction); + + if (peakFunction) { + poldiPeak->setIntensity( + UncertainValue(peakFunction->height(), peakFunction->getError(0))); + poldiPeak->setQ( + UncertainValue(peakFunction->centre(), peakFunction->getError(1))); + poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), + getFwhmWidthRelation(peakFunction) * + peakFunction->getError(2))); + } } -double PoldiFitPeaks1D2::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) const -{ - return peakFunction->fwhm() / peakFunction->getParameter(2); +double +PoldiFitPeaks1D2::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) const { + return peakFunction->fwhm() / peakFunction->getParameter(2); } -PoldiPeakCollection_sptr PoldiFitPeaks1D2::fitPeaks(const PoldiPeakCollection_sptr &peaks) -{ - g_log.information() << "Peaks to fit: " << peaks->peakCount() << std::endl; +PoldiPeakCollection_sptr +PoldiFitPeaks1D2::fitPeaks(const PoldiPeakCollection_sptr &peaks) { + g_log.information() << "Peaks to fit: " << peaks->peakCount() << std::endl; - std::vector rawRanges = getRefinedRanges(peaks); - std::vector reducedRanges = getReducedRanges(rawRanges); + std::vector rawRanges = getRefinedRanges(peaks); + std::vector reducedRanges = getReducedRanges(rawRanges); - g_log.information() << "Ranges used for fitting: " << reducedRanges.size() << std::endl; + g_log.information() << "Ranges used for fitting: " << reducedRanges.size() + << std::endl; - Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); - m_fitplots->removeAll(); + Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); + m_fitplots->removeAll(); - for(size_t i = 0; i < reducedRanges.size(); ++i) { - RefinedRange_sptr currentRange = reducedRanges[i]; - int nMin = getBestChebyshevPolynomialDegree(dataWorkspace, currentRange); + for (size_t i = 0; i < reducedRanges.size(); ++i) { + RefinedRange_sptr currentRange = reducedRanges[i]; + int nMin = getBestChebyshevPolynomialDegree(dataWorkspace, currentRange); - if(nMin > -1) { - IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentRange, nMin); - fit->execute(); + if (nMin > -1) { + IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, currentRange, nMin); + fit->execute(); - IFunction_sptr fitFunction = fit->getProperty("Function"); - CompositeFunction_sptr composite = boost::dynamic_pointer_cast(fitFunction); + IFunction_sptr fitFunction = fit->getProperty("Function"); + CompositeFunction_sptr composite = + boost::dynamic_pointer_cast(fitFunction); - if(!composite) { - throw std::runtime_error("Not a composite function!"); - } + if (!composite) { + throw std::runtime_error("Not a composite function!"); + } - std::vector peaks = currentRange->getPeaks(); - for(size_t i = 0; i < peaks.size(); ++i) { - setValuesFromProfileFunction(peaks[i], composite->getFunction(i)); - MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); - m_fitplots->addWorkspace(fpg); - } - } + std::vector peaks = currentRange->getPeaks(); + for (size_t i = 0; i < peaks.size(); ++i) { + setValuesFromProfileFunction(peaks[i], composite->getFunction(i)); + MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); + m_fitplots->addWorkspace(fpg); + } } + } - return getReducedPeakCollection(peaks); + return getReducedPeakCollection(peaks); } -int PoldiFitPeaks1D2::getBestChebyshevPolynomialDegree(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range) -{ - int n = 0; - double chiSquareMin = 1e10; - int nMin = -1; +int PoldiFitPeaks1D2::getBestChebyshevPolynomialDegree( + const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range) { + int n = 0; + double chiSquareMin = 1e10; + int nMin = -1; - while((n < 3)) { - IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, range, n); - bool fitSuccess = fit->execute(); + while ((n < 3)) { + IAlgorithm_sptr fit = getFitAlgorithm(dataWorkspace, range, n); + bool fitSuccess = fit->execute(); - if(fitSuccess) { - ITableWorkspace_sptr fitCharacteristics = fit->getProperty("OutputParameters"); - TableRow row = fitCharacteristics->getRow(fitCharacteristics->rowCount() - 1); + if (fitSuccess) { + ITableWorkspace_sptr fitCharacteristics = + fit->getProperty("OutputParameters"); + TableRow row = + fitCharacteristics->getRow(fitCharacteristics->rowCount() - 1); - double chiSquare = row.Double(1); + double chiSquare = row.Double(1); - - if(fabs(chiSquare - 1) < fabs(chiSquareMin - 1)) { - chiSquareMin = chiSquare; - nMin = n; - } - } - - ++n; + if (fabs(chiSquare - 1) < fabs(chiSquareMin - 1)) { + chiSquareMin = chiSquare; + nMin = n; + } } - g_log.information() << "Chi^2 for range [" << range->getXStart() << " - " << range->getXEnd() << "] is minimal at n = " << nMin << " with Chi^2 = " << chiSquareMin << std::endl; + ++n; + } + + g_log.information() << "Chi^2 for range [" << range->getXStart() << " - " + << range->getXEnd() << "] is minimal at n = " << nMin + << " with Chi^2 = " << chiSquareMin << std::endl; - return nMin; + return nMin; } -PoldiPeakCollection_sptr PoldiFitPeaks1D2::getReducedPeakCollection(const PoldiPeakCollection_sptr &peaks) const -{ - PoldiPeakCollection_sptr reducedPeaks = boost::make_shared(); - reducedPeaks->setProfileFunctionName(peaks->getProfileFunctionName()); +PoldiPeakCollection_sptr PoldiFitPeaks1D2::getReducedPeakCollection( + const PoldiPeakCollection_sptr &peaks) const { + PoldiPeakCollection_sptr reducedPeaks = + boost::make_shared(); + reducedPeaks->setProfileFunctionName(peaks->getProfileFunctionName()); - for(size_t i = 0; i < peaks->peakCount(); ++i) { - PoldiPeak_sptr currentPeak = peaks->peak(i); + for (size_t i = 0; i < peaks->peakCount(); ++i) { + PoldiPeak_sptr currentPeak = peaks->peak(i); - if(peakIsAcceptable(currentPeak)) { - reducedPeaks->addPeak(currentPeak); - } + if (peakIsAcceptable(currentPeak)) { + reducedPeaks->addPeak(currentPeak); } + } - return reducedPeaks; + return reducedPeaks; } -bool PoldiFitPeaks1D2::peakIsAcceptable(const PoldiPeak_sptr &peak) const -{ - return peak->intensity() > 0 && peak->fwhm(PoldiPeak::Relative) < 0.02; +bool PoldiFitPeaks1D2::peakIsAcceptable(const PoldiPeak_sptr &peak) const { + return peak->intensity() > 0 && peak->fwhm(PoldiPeak::Relative) < 0.02; } -void PoldiFitPeaks1D2::exec() -{ - setPeakFunction(getProperty("PeakFunction")); +void PoldiFitPeaks1D2::exec() { + setPeakFunction(getProperty("PeakFunction")); - // Number of points around the peak center to use for the fit - m_fwhmMultiples = getProperty("FwhmMultiples"); + // Number of points around the peak center to use for the fit + m_fwhmMultiples = getProperty("FwhmMultiples"); - // try to construct PoldiPeakCollection from provided TableWorkspace - TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); - m_peaks = getInitializedPeakCollection(poldiPeakTable); - - PoldiPeakCollection_sptr fittedPeaksNew = fitPeaks(m_peaks); - PoldiPeakCollection_sptr fittedPeaksOld = m_peaks; - while(fittedPeaksNew->peakCount() < fittedPeaksOld->peakCount()) { - fittedPeaksOld = fittedPeaksNew; - fittedPeaksNew = fitPeaks(fittedPeaksOld); - } + // try to construct PoldiPeakCollection from provided TableWorkspace + TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); + m_peaks = getInitializedPeakCollection(poldiPeakTable); + PoldiPeakCollection_sptr fittedPeaksNew = fitPeaks(m_peaks); + PoldiPeakCollection_sptr fittedPeaksOld = m_peaks; + while (fittedPeaksNew->peakCount() < fittedPeaksOld->peakCount()) { + fittedPeaksOld = fittedPeaksNew; + fittedPeaksNew = fitPeaks(fittedPeaksOld); + } - setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("FitPlotsWorkspace", m_fitplots); + setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); + setProperty("FitPlotsWorkspace", m_fitplots); } -IAlgorithm_sptr PoldiFitPeaks1D2::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const RefinedRange_sptr &range, int n) -{ - IFunction_sptr rangeProfile = getRangeProfile(range, n); - - IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); - fitAlgorithm->setProperty("CreateOutput", true); - fitAlgorithm->setProperty("Output", "FitPeaks1D"); - fitAlgorithm->setProperty("CalcErrors", true); - fitAlgorithm->setProperty("OutputCompositeMembers", true); - fitAlgorithm->setProperty("Function", rangeProfile); - fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); - fitAlgorithm->setProperty("WorkspaceIndex", 0); - fitAlgorithm->setProperty("StartX", range->getXStart()); - fitAlgorithm->setProperty("EndX", range->getXEnd()); - - return fitAlgorithm; +IAlgorithm_sptr +PoldiFitPeaks1D2::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, + const RefinedRange_sptr &range, int n) { + IFunction_sptr rangeProfile = getRangeProfile(range, n); + + IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); + fitAlgorithm->setProperty("CreateOutput", true); + fitAlgorithm->setProperty("Output", "FitPeaks1D"); + fitAlgorithm->setProperty("CalcErrors", true); + fitAlgorithm->setProperty("OutputCompositeMembers", true); + fitAlgorithm->setProperty("Function", rangeProfile); + fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); + fitAlgorithm->setProperty("WorkspaceIndex", 0); + fitAlgorithm->setProperty("StartX", range->getXStart()); + fitAlgorithm->setProperty("EndX", range->getXEnd()); + + return fitAlgorithm; } } // namespace Poldi diff --git a/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp b/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp index 232b96c8a04c..67e3a68f44cc 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiPeakSummary.cpp @@ -5,113 +5,111 @@ #include "MantidSINQ/PoldiUtilities/MillerIndicesIO.h" #include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" -namespace Mantid -{ -namespace Poldi -{ - - using namespace API; - using namespace DataObjects; - using namespace Kernel; - - // Register the algorithm into the AlgorithmFactory - DECLARE_ALGORITHM(PoldiPeakSummary) - - - - //---------------------------------------------------------------------------------------------- - /** Constructor - */ - PoldiPeakSummary::PoldiPeakSummary() - { - } - - //---------------------------------------------------------------------------------------------- - /** Destructor - */ - PoldiPeakSummary::~PoldiPeakSummary() - { +namespace Mantid { +namespace Poldi { + +using namespace API; +using namespace DataObjects; +using namespace Kernel; + +// Register the algorithm into the AlgorithmFactory +DECLARE_ALGORITHM(PoldiPeakSummary) + +//---------------------------------------------------------------------------------------------- +/** Constructor + */ +PoldiPeakSummary::PoldiPeakSummary() {} + +//---------------------------------------------------------------------------------------------- +/** Destructor + */ +PoldiPeakSummary::~PoldiPeakSummary() {} + +//---------------------------------------------------------------------------------------------- + +/// Algorithms name for identification. @see Algorithm::name +const std::string PoldiPeakSummary::name() const { return "PoldiPeakSummary"; } + +/// Algorithm's version for identification. @see Algorithm::version +int PoldiPeakSummary::version() const { return 1; } + +/// Algorithm's category for identification. @see Algorithm::category +const std::string PoldiPeakSummary::category() const { return "SINQ\\Poldi"; } + +/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary +const std::string PoldiPeakSummary::summary() const { + return "The algorithm takes a table with peaks from POLDI analysis " + "algorithms and creates a summary table."; +} + +//---------------------------------------------------------------------------------------------- +/** Initialize the algorithm's properties. + */ +void PoldiPeakSummary::init() { + declareProperty(new WorkspaceProperty("InputWorkspace", "", + Direction::Input), + "Input workspace containing a table with peaks from a POLDI " + "fit routine."); + declareProperty(new WorkspaceProperty("OutputWorkspace", "", + Direction::Output), + "Output table workspace that contains "); +} + +//---------------------------------------------------------------------------------------------- +/** Execute the algorithm. + */ +void PoldiPeakSummary::exec() { + TableWorkspace_sptr poldiPeakTableWorkspace = getProperty("InputWorkspace"); + PoldiPeakCollection_sptr peaks = + boost::make_shared(poldiPeakTableWorkspace); + + TableWorkspace_sptr resultTable = getSummaryTable(peaks); + + setProperty("OutputWorkspace", resultTable); +} + +TableWorkspace_sptr PoldiPeakSummary::getSummaryTable( + const PoldiPeakCollection_sptr &peakCollection) const { + if (!peakCollection) { + throw std::invalid_argument( + "Cannot create summary of a null PoldiPeakCollection."); } + TableWorkspace_sptr peakResultWorkspace = getInitializedResultWorkspace(); - //---------------------------------------------------------------------------------------------- - - /// Algorithms name for identification. @see Algorithm::name - const std::string PoldiPeakSummary::name() const { return "PoldiPeakSummary"; } - - /// Algorithm's version for identification. @see Algorithm::version - int PoldiPeakSummary::version() const { return 1;} - - /// Algorithm's category for identification. @see Algorithm::category - const std::string PoldiPeakSummary::category() const { return "SINQ\\Poldi";} - - /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary - const std::string PoldiPeakSummary::summary() const { return "The algorithm takes a table with peaks from POLDI analysis algorithms and creates a summary table.";} - - //---------------------------------------------------------------------------------------------- - /** Initialize the algorithm's properties. - */ - void PoldiPeakSummary::init() - { - declareProperty(new WorkspaceProperty("InputWorkspace","",Direction::Input), "Input workspace containing a table with peaks from a POLDI fit routine."); - declareProperty(new WorkspaceProperty("OutputWorkspace","",Direction::Output), "Output table workspace that contains "); - } - - //---------------------------------------------------------------------------------------------- - /** Execute the algorithm. - */ - void PoldiPeakSummary::exec() - { - TableWorkspace_sptr poldiPeakTableWorkspace = getProperty("InputWorkspace"); - PoldiPeakCollection_sptr peaks = boost::make_shared(poldiPeakTableWorkspace); - - TableWorkspace_sptr resultTable = getSummaryTable(peaks); - - setProperty("OutputWorkspace", resultTable); - } - - TableWorkspace_sptr PoldiPeakSummary::getSummaryTable(const PoldiPeakCollection_sptr &peakCollection) const - { - if(!peakCollection) { - throw std::invalid_argument("Cannot create summary of a null PoldiPeakCollection."); - } - - TableWorkspace_sptr peakResultWorkspace = getInitializedResultWorkspace(); - - for(size_t i = 0; i < peakCollection->peakCount(); ++i) { - storePeakSummary(peakResultWorkspace->appendRow(), peakCollection->peak(i)); - } - - return peakResultWorkspace; - } - - TableWorkspace_sptr PoldiPeakSummary::getInitializedResultWorkspace() const - { - TableWorkspace_sptr peakResultWorkspace = boost::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable()); - - peakResultWorkspace->addColumn("str", "hkl"); - peakResultWorkspace->addColumn("str", "Q"); - peakResultWorkspace->addColumn("str", "d"); - peakResultWorkspace->addColumn("double", "deltaD/d *10^3"); - peakResultWorkspace->addColumn("str", "FWHM rel. *10^3"); - peakResultWorkspace->addColumn("str", "Intensity"); - - return peakResultWorkspace; - } - - void PoldiPeakSummary::storePeakSummary(TableRow tableRow, const PoldiPeak_sptr &peak) const - { - UncertainValue q = peak->q(); - UncertainValue d = peak->d(); - - tableRow << MillerIndicesIO::toString(peak->hkl()) - << UncertainValueIO::toString(q) - << UncertainValueIO::toString(d) - << d.error() / d.value() * 1e3 - << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3) - << UncertainValueIO::toString(peak->intensity()); + for (size_t i = 0; i < peakCollection->peakCount(); ++i) { + storePeakSummary(peakResultWorkspace->appendRow(), peakCollection->peak(i)); } + return peakResultWorkspace; +} + +TableWorkspace_sptr PoldiPeakSummary::getInitializedResultWorkspace() const { + TableWorkspace_sptr peakResultWorkspace = + boost::dynamic_pointer_cast( + WorkspaceFactory::Instance().createTable()); + + peakResultWorkspace->addColumn("str", "hkl"); + peakResultWorkspace->addColumn("str", "Q"); + peakResultWorkspace->addColumn("str", "d"); + peakResultWorkspace->addColumn("double", "deltaD/d *10^3"); + peakResultWorkspace->addColumn("str", "FWHM rel. *10^3"); + peakResultWorkspace->addColumn("str", "Intensity"); + + return peakResultWorkspace; +} + +void PoldiPeakSummary::storePeakSummary(TableRow tableRow, + const PoldiPeak_sptr &peak) const { + UncertainValue q = peak->q(); + UncertainValue d = peak->d(); + + tableRow << MillerIndicesIO::toString(peak->hkl()) + << UncertainValueIO::toString(q) << UncertainValueIO::toString(d) + << d.error() / d.value() * 1e3 + << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3) + << UncertainValueIO::toString(peak->intensity()); +} } // namespace Poldi } // namespace Mantid From 1c6001f0637d738d90111065fa7378b60cd46038 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 14 Jan 2015 11:16:00 +0100 Subject: [PATCH 039/130] Refs #10263. Allowing for a tolerance when merging ranges. --- .../SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h | 10 ++ .../Framework/SINQ/src/PoldiFitPeaks1D2.cpp | 79 +++++++++-- .../SINQ/test/PoldiFitPeaks1D2Test.h | 129 +++++++++++++++++- 3 files changed, 207 insertions(+), 11 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h index 6266d520f896..6ce131ad2682 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h @@ -21,9 +21,16 @@ class RefinedRange { const std::vector &peaks); RefinedRange(const RefinedRange &other); + double getWidth() const; + bool operator<(const RefinedRange &other) const; bool overlaps(const RefinedRange &other) const; + bool overlaps(const RefinedRange &other, double fraction) const; + bool contains(const RefinedRange &other) const; + + double getOverlapFraction(const RefinedRange &other) const; + void merge(const RefinedRange &other); const std::vector getPeaks() const { return m_peaks; } @@ -32,9 +39,12 @@ class RefinedRange { double getXEnd() const { return m_xEnd; } private: + void setRangeBorders(double start, double end); + std::vector m_peaks; double m_xStart; double m_xEnd; + double m_width; }; typedef boost::shared_ptr RefinedRange_sptr; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp index aec218c26060..22fe1e382f0f 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -29,35 +29,84 @@ using namespace CurveFitting; RefinedRange::RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples) : m_peaks(1, peak) { + + if (!peak) { + throw std::invalid_argument( + "Cannot construct RefinedRange from null-peak."); + } + + if (fwhmMultiples < 0) { + throw std::invalid_argument("Cannot construct a RefinedRange of width 0."); + } + double width = peak->fwhm(); double extent = std::max(0.002, width) * fwhmMultiples; - m_xStart = peak->q() - extent; - m_xEnd = peak->q() + extent; + setRangeBorders(peak->q() - extent, peak->q() + extent); } RefinedRange::RefinedRange(double xStart, double xEnd, const std::vector &peaks) - : m_peaks(peaks), m_xStart(xStart), m_xEnd(xEnd) {} + : m_peaks(peaks) { + + setRangeBorders(xStart, xEnd); +} RefinedRange::RefinedRange(const RefinedRange &other) - : m_peaks(other.m_peaks), m_xStart(other.m_xStart), m_xEnd(other.m_xEnd) {} + : m_peaks(other.m_peaks), m_xStart(other.m_xStart), m_xEnd(other.m_xEnd), + m_width(other.m_width) {} + +double RefinedRange::getWidth() const { return m_width; } bool RefinedRange::operator<(const RefinedRange &other) const { return m_xStart < other.m_xStart; } bool RefinedRange::overlaps(const RefinedRange &other) const { - return (other.m_xStart > m_xStart && other.m_xStart < m_xEnd) || - (other.m_xEnd > m_xStart && other.m_xEnd < m_xEnd) || - (other.m_xStart < m_xStart && other.m_xEnd > m_xEnd); + return overlaps(other, 0.0); +} + +bool RefinedRange::overlaps(const RefinedRange &other, double fraction) const { + return getOverlapFraction(other) > fraction; +} + +bool RefinedRange::contains(const RefinedRange &other) const { + return (other.m_xStart > m_xStart && other.m_xEnd < m_xEnd); +} + +double RefinedRange::getOverlapFraction(const RefinedRange &other) const { + double reference = getWidth(); + + if (contains(other)) { + return other.getWidth() / reference; + } + + if (other.contains(*this)) { + return reference / other.getWidth(); + } + + if (*this < other) { + return std::max(0.0, m_xEnd - other.m_xStart) / reference; + } else { + return std::max(0.0, other.m_xEnd - m_xStart) / reference; + } } void RefinedRange::merge(const RefinedRange &other) { m_peaks.insert(m_peaks.end(), other.m_peaks.begin(), other.m_peaks.end()); - m_xStart = std::min(m_xStart, other.m_xStart); - m_xEnd = std::max(m_xEnd, other.m_xEnd); + setRangeBorders(std::min(m_xStart, other.m_xStart), + std::max(m_xEnd, other.m_xEnd)); +} + +void RefinedRange::setRangeBorders(double start, double end) { + if (start >= end) { + throw std::invalid_argument("Range start is larger than range end."); + } + + m_xStart = start; + m_xEnd = end; + m_width = end - start; } bool operator<(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs) { @@ -95,8 +144,15 @@ void PoldiFitPeaks1D2::init() { "Each peak will be fitted using x times FWHM data in each direction.", Direction::Input); + boost::shared_ptr > allowedOverlapFraction = + boost::make_shared >(0.0, 1.0); + declareProperty("AllowedOverlap", 0.25, allowedOverlapFraction, + "If a fraction larger than this value overlaps with the next " + "range, the ranges are merged."); + std::vector peakFunctions = FunctionFactory::Instance().getFunctionNames(); + boost::shared_ptr > peakFunctionNames( new ListValidator(peakFunctions)); declareProperty("PeakFunction", "Gaussian", peakFunctionNames, @@ -147,11 +203,14 @@ std::vector PoldiFitPeaks1D2::getReducedRanges( reducedRanges.push_back( boost::make_shared(*(workingRanges.front()))); + double allowedOverlap = getProperty("AllowedOverlap"); + for (size_t i = 1; i < workingRanges.size(); ++i) { RefinedRange_sptr lastReduced = reducedRanges.back(); RefinedRange_sptr current = workingRanges[i]; - if (!lastReduced->overlaps(*current)) { + if (!lastReduced->contains(*current) && + !lastReduced->overlaps(*current, allowedOverlap)) { reducedRanges.push_back(boost::make_shared(*current)); } else { lastReduced->merge(*current); diff --git a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h index 1e26f52a0e10..90b0fa2203ee 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks1D2Test.h @@ -109,10 +109,137 @@ class PoldiFitPeaks1D2Test : public CxxTest::TestSuite TS_ASSERT_EQUALS(names.count("PeakFunction"), 1); TS_ASSERT_EQUALS(names.count("PoldiPeakTable"), 1); TS_ASSERT_EQUALS(names.count("OutputWorkspace"), 1); - TS_ASSERT_EQUALS(names.count("ResultTableWorkspace"), 1); TS_ASSERT_EQUALS(names.count("FitPlotsWorkspace"), 1); + TS_ASSERT_EQUALS(names.count("AllowedOverlap"), 1); } + void testRefinedRangePeakConstructor() + { + double fwhm = m_testPeak->fwhm(); + double peakQ = m_testPeak->q(); + double rangeXStart = peakQ - 2.0 * fwhm; + double rangeXEnd = peakQ + 2.0 * fwhm; + + RefinedRange range(m_testPeak, 2.0); + TS_ASSERT_EQUALS(range.getXStart(), rangeXStart); + TS_ASSERT_EQUALS(range.getXEnd(), rangeXEnd); + TS_ASSERT_DELTA(range.getWidth(), 4.0 * fwhm, 1e-15); + + // Null pointer does not work + PoldiPeak_sptr nullPeak; + TS_ASSERT_THROWS(RefinedRange invalid(nullPeak, 2.0), std::invalid_argument); + + // 0 or fewer multiples does not work + TS_ASSERT_THROWS(RefinedRange invalid(m_testPeak, 0.0), std::invalid_argument); + TS_ASSERT_THROWS(RefinedRange invalid(m_testPeak, -1.0), std::invalid_argument); + } + + void testRefinedRangeLimitConstructor() + { + std::vector peaks(1, m_testPeak); + + TS_ASSERT_THROWS_NOTHING(RefinedRange range(0.0, 1.0, peaks)); + TS_ASSERT_THROWS(RefinedRange invalid(1.0, 0.0, peaks), std::invalid_argument); + TS_ASSERT_THROWS(RefinedRange invalid(1.0, 1.0, peaks), std::invalid_argument); + + RefinedRange range(3.0, 4.0, peaks); + TS_ASSERT_EQUALS(range.getXStart(), 3.0); + TS_ASSERT_EQUALS(range.getXEnd(), 4.0); + TS_ASSERT_EQUALS(range.getWidth(), 1.0); + } + + void testContains() + { + std::vector peaks(1, m_testPeak); + + RefinedRange largeRange(1.0, 3.0, peaks); + RefinedRange smallRange(1.5, 2.5, peaks); + + TS_ASSERT(largeRange.contains(smallRange)); + TS_ASSERT(!smallRange.contains(largeRange)); + + RefinedRange outsideRange(2.5, 4.5, peaks); + TS_ASSERT(!largeRange.contains(outsideRange)); + } + + void testOperatorLessThan() + { + std::vector peaks(1, m_testPeak); + + RefinedRange firstRange(1.0, 3.0, peaks); + RefinedRange secondRange(1.5, 2.5, peaks); + + TS_ASSERT(firstRange < secondRange); + TS_ASSERT(!(secondRange < firstRange)); + } + + void testMerge() + { + std::vector peaks(1, m_testPeak); + + RefinedRange firstRange(1.0, 2.0, peaks); + RefinedRange secondRange(1.5, 3.5, peaks); + + TS_ASSERT_THROWS_NOTHING(firstRange.merge(secondRange)); + TS_ASSERT_EQUALS(firstRange.getXStart(), 1.0); + TS_ASSERT_EQUALS(firstRange.getXEnd(), 3.5); + TS_ASSERT_EQUALS(firstRange.getWidth(), 2.5); + } + + void testGetOverlap() + { + std::vector peaks(1, m_testPeak); + + RefinedRange firstRange(1.0, 2.0, peaks); + RefinedRange secondRange(1.5, 3.5, peaks); + + TS_ASSERT_EQUALS(firstRange.getOverlapFraction(secondRange), 0.5); + TS_ASSERT_EQUALS(secondRange.getOverlapFraction(firstRange), 0.25); + + RefinedRange noOverlapLeft(0.0, 0.5, peaks); + TS_ASSERT_EQUALS(firstRange.getOverlapFraction(noOverlapLeft), 0.0); + TS_ASSERT_EQUALS(noOverlapLeft.getOverlapFraction(firstRange), 0.0); + + RefinedRange noOverlapRight(4.0, 4.5, peaks); + TS_ASSERT_EQUALS(firstRange.getOverlapFraction(noOverlapRight), 0.0); + TS_ASSERT_EQUALS(noOverlapRight.getOverlapFraction(firstRange), 0.0); + + RefinedRange noOverlapLeftLimit(0.0, 1.0, peaks); + TS_ASSERT_EQUALS(firstRange.getOverlapFraction(noOverlapLeftLimit), 0.0); + TS_ASSERT_EQUALS(noOverlapLeftLimit.getOverlapFraction(firstRange), 0.0); + + RefinedRange contained(2.0, 2.5, peaks); + TS_ASSERT_EQUALS(secondRange.getOverlapFraction(contained), 0.25); + } + + void testOverlaps() + { + std::vector peaks(1, m_testPeak); + + RefinedRange firstRange(1.0, 2.0, peaks); + RefinedRange secondRange(1.5, 3.5, peaks); + + TS_ASSERT(firstRange.overlaps(secondRange)); + TS_ASSERT(secondRange.overlaps(firstRange)); + + RefinedRange noOverlapLeft(0.0, 0.5, peaks); + TS_ASSERT(!firstRange.overlaps(noOverlapLeft)); + } + + void testOverlapsFraction() + { + std::vector peaks(1, m_testPeak); + + RefinedRange firstRange(1.0, 2.0, peaks); + RefinedRange secondRange(1.5, 3.5, peaks); + + TS_ASSERT(firstRange.overlaps(secondRange, 0.1)); + TS_ASSERT(firstRange.overlaps(secondRange, 0.15)); + TS_ASSERT(!firstRange.overlaps(secondRange, 0.55)); + } + + + private: PoldiPeak_sptr m_testPeak; std::string m_profileTestFunction; From 0f45e5b204822d8415f3239cb62ec4f5317d9c35 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 15 Jan 2015 09:06:37 +0100 Subject: [PATCH 040/130] Refs #10263. Removing "recursion borders" from PoldiPeakSearch After careful consideration and inspection of the code and what it does and does not find, I came to the conclusion that this is not needed at all. It caused some strange problems in the past with debug-builds and so I decided it has to go. In fact, if anything, it was cutting down the searched parts of the vector. --- .../SINQ/inc/MantidSINQ/PoldiPeakSearch.h | 11 --- .../Framework/SINQ/src/PoldiPeakSearch.cpp | 70 ++--------------- .../Framework/SINQ/test/PoldiPeakSearchTest.h | 75 +------------------ 3 files changed, 9 insertions(+), 147 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h index a85251bb756a..8d89c85bb038 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h @@ -68,10 +68,6 @@ class MANTID_SINQ_DLL PoldiPeakSearch : public API::Algorithm { std::list findPeaksRecursive(MantidVec::const_iterator begin, MantidVec::const_iterator end) const; - MantidVec::const_iterator - getLeftRangeBegin(MantidVec::const_iterator begin) const; - MantidVec::const_iterator - getRightRangeEnd(MantidVec::const_iterator end) const; std::list mapPeakPositionsToCorrelationData( std::list peakPositions, @@ -112,9 +108,6 @@ class MANTID_SINQ_DLL PoldiPeakSearch : public API::Algorithm { void setMinimumPeakHeight(double newMinimumPeakHeight); void setMaximumPeakNumber(int newMaximumPeakNumber); - void setRecursionAbsoluteBorders(MantidVec::const_iterator begin, - MantidVec::const_iterator end); - static bool vectorElementGreaterThan(MantidVec::const_iterator first, MantidVec::const_iterator second); bool isLessThanMinimum(PoldiPeak_sptr peak); @@ -124,10 +117,6 @@ class MANTID_SINQ_DLL PoldiPeakSearch : public API::Algorithm { double m_minimumPeakHeight; int m_maximumPeakNumber; - MantidVec::const_iterator m_recursionAbsoluteBegin; - MantidVec::const_iterator m_recursionAbsoluteEnd; - bool m_recursionBordersInitialized; - PoldiPeakCollection_sptr m_peaks; private: diff --git a/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp b/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp index 534ea68be9ee..b4ba513d01e9 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp @@ -33,8 +33,7 @@ using namespace DataObjects; PoldiPeakSearch::PoldiPeakSearch() : API::Algorithm(), m_minimumDistance(0), m_doubleMinimumDistance(0), m_minimumPeakHeight(0.0), m_maximumPeakNumber(0), - m_recursionAbsoluteBegin(), m_recursionAbsoluteEnd(), - m_recursionBordersInitialized(false), m_peaks(new PoldiPeakCollection()) { + m_peaks(new PoldiPeakCollection()) { } /** Sums the counts of neighboring d-values @@ -102,9 +101,6 @@ MantidVec PoldiPeakSearch::getNeighborSums(MantidVec correlationCounts) const { std::list PoldiPeakSearch::findPeaks(MantidVec::const_iterator begin, MantidVec::const_iterator end) { - // These borders need to be known for handling the edges correctly in the - // recursion - setRecursionAbsoluteBorders(begin, end); std::list rawPeaks = findPeaksRecursive(begin, end); @@ -154,69 +150,22 @@ PoldiPeakSearch::findPeaksRecursive(MantidVec::const_iterator begin, peaks.push_back(maxInRange); // ...and perform same search on sub-list left of maximum... - MantidVec::const_iterator leftBegin = getLeftRangeBegin(begin); - if (std::distance(leftBegin, maxInRange) > m_minimumDistance) { + if (std::distance(begin, maxInRange) > m_minimumDistance) { std::list leftBranchPeaks = - findPeaksRecursive(leftBegin, maxInRange - m_minimumDistance); + findPeaksRecursive(begin, maxInRange - m_minimumDistance); peaks.insert(peaks.end(), leftBranchPeaks.begin(), leftBranchPeaks.end()); } // ...and right of maximum - MantidVec::const_iterator rightEnd = getRightRangeEnd(end); - if (std::distance(maxInRange + 1, rightEnd) > m_minimumDistance) { + if (std::distance(maxInRange + 1, end) > m_minimumDistance) { std::list rightBranchPeaks = - findPeaksRecursive(maxInRange + 1 + m_minimumDistance, rightEnd); + findPeaksRecursive(maxInRange + 1 + m_minimumDistance, end); peaks.insert(peaks.end(), rightBranchPeaks.begin(), rightBranchPeaks.end()); } return peaks; } -/** Returns starting iterator for "left" half of sub-range - * - * This method "cleans" the begin-iterator for use in a sub-range during the - *recursion. Without this, - * considerable parts at the vector beginning would not be searched. - * - * @param begin :: Raw begin-iterator of "left" recursion sub-range. - * @returns Corrected begin-iterator for "left" recursion sub-range. - */ -MantidVec::const_iterator -PoldiPeakSearch::getLeftRangeBegin(MantidVec::const_iterator begin) const { - /* The edges of the searched range require special treatment. Without this - *sanitation, - * each recursion step that includes the leftmost sublist would chop off - *m_minimumDistance - * elements from the beginning, so the index is compared to the range's - *absolute start. - * - * Exactly the same considerations are valid for the rightmost sublist. - */ - if (!m_recursionBordersInitialized || begin != m_recursionAbsoluteBegin) { - return begin + m_minimumDistance; - } - - return begin; -} - -/** Returns end iterator for "right" half of sub-range - * - * This method "cleans" the end-iterator for use in a sub-range during the - *recursion. Without this, - * considerable parts at the vector end would not be searched. - * - * @param end :: Raw end-iterator of "right" recursion sub-range. - * @returns Corrected end-iterator for "right" recursion sub-range. - */ -MantidVec::const_iterator -PoldiPeakSearch::getRightRangeEnd(MantidVec::const_iterator end) const { - if (!m_recursionBordersInitialized || end != m_recursionAbsoluteEnd) { - return end - m_minimumDistance; - } - - return end; -} - /** Maps peak position iterators from one vector to another * * This method is required because the actual peak search is better performed @@ -535,15 +484,6 @@ void PoldiPeakSearch::setMaximumPeakNumber(int newMaximumPeakNumber) { m_maximumPeakNumber = newMaximumPeakNumber; } -void -PoldiPeakSearch::setRecursionAbsoluteBorders(MantidVec::const_iterator begin, - MantidVec::const_iterator end) { - m_recursionAbsoluteBegin = begin; - m_recursionAbsoluteEnd = end; - - m_recursionBordersInitialized = true; -} - bool PoldiPeakSearch::vectorElementGreaterThan(MantidVec::const_iterator first, MantidVec::const_iterator second) { diff --git a/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h b/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h index 3943c2898812..491c132c6a4f 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h @@ -81,83 +81,16 @@ class PoldiPeakSearchTest : public CxxTest::TestSuite std::vector testList(testListRaw, testListRaw + 17); std::list::const_iterator> maxima = poldiPeakSearch.findPeaksRecursive(testList.begin(), testList.end()); - TS_ASSERT_EQUALS(maxima.size(), 3); + TS_ASSERT_EQUALS(maxima.size(), 4); maxima.sort(); - double shouldGiveMaxima[] = {12.0, 34.0, 12.0}; + double shouldGiveMaxima[] = {12.0, 34.0, 12.0, 7.0}; - for(size_t i = 0; i < 3; ++i) { + for(size_t i = 0; i < 4; ++i) { TS_ASSERT_EQUALS(*maxima.front(), shouldGiveMaxima[i]); maxima.pop_front(); } - - // Same test with absolute recursion borders gives one additional peak at the right edge - poldiPeakSearch.setRecursionAbsoluteBorders(testList.begin(), testList.end()); - std::list::const_iterator> edgeCasesMaxima = poldiPeakSearch.findPeaksRecursive(testList.begin(), testList.end()); - TS_ASSERT_EQUALS(edgeCasesMaxima.size(), 4); - - edgeCasesMaxima.sort(); - - double shouldGiveAbsoluteBordersMaxima[] = {12.0, 34.0, 12.0, 7.0}; - - for(size_t i = 0; i < 4; ++i) { - TS_ASSERT_EQUALS(*edgeCasesMaxima.front(), shouldGiveAbsoluteBordersMaxima[i]); - edgeCasesMaxima.pop_front(); - } - } - - void testsetRecursionAbsoluteBorders() - { - TestablePoldiPeakSearch poldiPeakSearch; - - double testListRaw[] = {2.0, -3.0, -2.0, 12.0, 3.0 }; - std::vector baseData(testListRaw, testListRaw + 5); - - TS_ASSERT_EQUALS(poldiPeakSearch.m_recursionBordersInitialized, false); - - poldiPeakSearch.setRecursionAbsoluteBorders(baseData.begin(), baseData.end()); - - TS_ASSERT_EQUALS(poldiPeakSearch.m_recursionAbsoluteBegin, baseData.begin()); - TS_ASSERT_EQUALS(poldiPeakSearch.m_recursionAbsoluteEnd, baseData.end()); - - TS_ASSERT_EQUALS(poldiPeakSearch.m_recursionBordersInitialized, true); - } - - void testgetLeftRangeBegin() - { - int minimumDistance = 2; - - TestablePoldiPeakSearch poldiPeakSearch; - poldiPeakSearch.setMinimumDistance(minimumDistance); - - double testListRaw[] = {2.0, -3.0, -2.0, 12.0, 3.0 }; - std::vector baseData(testListRaw, testListRaw + 5); - - TS_ASSERT_EQUALS(poldiPeakSearch.getLeftRangeBegin(baseData.begin()), baseData.begin() + minimumDistance); - - poldiPeakSearch.setRecursionAbsoluteBorders(baseData.begin(), baseData.end()); - - TS_ASSERT_EQUALS(poldiPeakSearch.getLeftRangeBegin(baseData.begin()), baseData.begin()); - TS_ASSERT_EQUALS(poldiPeakSearch.getLeftRangeBegin(baseData.end() - minimumDistance), baseData.end()); - } - - void testgetRightRangeEnd() - { - int minimumDistance = 2; - - TestablePoldiPeakSearch poldiPeakSearch; - poldiPeakSearch.setMinimumDistance(minimumDistance); - - double testListRaw[] = {2.0, -3.0, -2.0, 12.0, 3.0 }; - std::vector baseData(testListRaw, testListRaw + 5); - - TS_ASSERT_EQUALS(poldiPeakSearch.getRightRangeEnd(baseData.end()), baseData.end() - minimumDistance); - - poldiPeakSearch.setRecursionAbsoluteBorders(baseData.begin(), baseData.end()); - - TS_ASSERT_EQUALS(poldiPeakSearch.getRightRangeEnd(baseData.end()), baseData.end()); - TS_ASSERT_EQUALS(poldiPeakSearch.getRightRangeEnd(baseData.begin() + minimumDistance), baseData.begin()); } void testfindPeaks() @@ -202,7 +135,7 @@ class PoldiPeakSearchTest : public CxxTest::TestSuite std::vector peaks = poldiPeakSearch.getPeaks(baseData.begin(), maxima, testXData); - TS_ASSERT_EQUALS(peaks.size(), 3); + TS_ASSERT_EQUALS(peaks.size(), 4); PoldiPeak_sptr peak0 = peaks[0]; TS_ASSERT_EQUALS(peak0->q(), 3.0); From 9c9f09f373896bbf55588afa6b2771dd4c5c2e3d Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Fri, 16 Jan 2015 11:01:12 +0100 Subject: [PATCH 041/130] Refs #10263. Fixing documentation --- .../docs/source/algorithms/PoldiAnalyseResiduals-v1.rst | 5 ++--- .../docs/source/algorithms/PoldiIndexKnownCompounds-v1.rst | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst index 05d75f2496a5..e34169891782 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst @@ -36,9 +36,8 @@ The following example shows how to calculate the residuals following a fit perfo DeleteTableRows(TableWorkspace=peaks_Si_raw, Rows="12-20") peaks_Si_1D = PoldiFitPeaks1D(correlation_Si, FwhmMultiples=4, PoldiPeakTable="peaks_Si_raw", - ResultTableWorkspace = "result_table_Si", - FitCharacteristicsWorkspace = "raw_fit_results_Si", - FitPlotsWorkspace = "fit_plots_Si") + FitPlotsWorkspace = "fit_plots_Si", + Version=1) # Fit peaks to original 2D data fit_result_Si_2D = PoldiFitPeaks2D(data_Si, PoldiPeakWorkspace="peaks_Si_1D", MaximumIterations=100, RefinedPoldiPeakWorkspace="peaks_Si_2D") diff --git a/Code/Mantid/docs/source/algorithms/PoldiIndexKnownCompounds-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiIndexKnownCompounds-v1.rst index 214958e664c1..9f7c6fd6b9ab 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiIndexKnownCompounds-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiIndexKnownCompounds-v1.rst @@ -41,8 +41,7 @@ The following example extracts peaks from the correlation spectrum of a Silicon PoldiFitPeaks1D(InputWorkspace = correlated_6904, FwhmMultiples = 4.0, PeakFunction = "Gaussian", PoldiPeakTable = peaks_6904, - OutputWorkspace = "peaks_refined_6904", ResultTableWorkspace = "result_table_6904", - FitCharacteristicsWorkspace = "raw_fit_results_6904", + OutputWorkspace = "peaks_refined_6904", FitPlotsWorkspace = "fit_plots_6904") # Create theoretical reflections for Silicon From a64996a5e1db20123f36b3ea5978be783277735a Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Fri, 16 Jan 2015 11:17:31 +0100 Subject: [PATCH 042/130] Refs #10263. Exporting symbols for DLL. --- Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h index 6ce131ad2682..1bc1d922cdf0 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D2.h @@ -14,7 +14,7 @@ namespace Mantid { namespace Poldi { /// Helper class for refining peaks with overlapping ranges -class RefinedRange { +class MANTID_SINQ_DLL RefinedRange { public: RefinedRange(const PoldiPeak_sptr &peak, double fwhmMultiples); RefinedRange(double xStart, double xEnd, @@ -49,7 +49,7 @@ class RefinedRange { typedef boost::shared_ptr RefinedRange_sptr; -bool operator<(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs); +bool MANTID_SINQ_DLL operator<(const RefinedRange_sptr &lhs, const RefinedRange_sptr &rhs); /** PoldiFitPeaks1D2 : From 0c5a17e88987a5ab4f5e3ae0827ba076596dcad8 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Fri, 16 Jan 2015 14:01:52 +0100 Subject: [PATCH 043/130] Refs #10263. Loop was never executed, but should run at least once. --- Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp index 22fe1e382f0f..f009cceecec6 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -378,9 +378,12 @@ void PoldiFitPeaks1D2::exec() { PoldiPeakCollection_sptr fittedPeaksNew = fitPeaks(m_peaks); PoldiPeakCollection_sptr fittedPeaksOld = m_peaks; - while (fittedPeaksNew->peakCount() < fittedPeaksOld->peakCount()) { + + int i = 0; + while (fittedPeaksNew->peakCount() < fittedPeaksOld->peakCount() || i < 1) { fittedPeaksOld = fittedPeaksNew; fittedPeaksNew = fitPeaks(fittedPeaksOld); + ++i; } setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); From fc45320745b5cd6ef66020fb8615af89688a64ff Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Mon, 19 Jan 2015 15:30:10 +0000 Subject: [PATCH 044/130] fix parameter names in doxygen doc, re #7523 --- .../Framework/DataHandling/src/LoadNexusProcessed.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index 35ee803d08c6..778f1d153dfb 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -1141,7 +1141,6 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) { * @param mtd_entry Nexus entry for "mantid_workspace_..." * @param xlength bins in the "X" axis (xbins) * @param workspaceType Takes values like "Workspace2D", "RebinnedOutput", etc. - * @param total_specs actual number of spectra to load (filtering by min/max/list) * * @return workspace object containing loaded data */ @@ -1931,11 +1930,11 @@ LoadNexusProcessed::checkOptionalProperties(const std::size_t numberofspectra) { * * @param numberofspectra :: count of spectra found in the file being loaded * - * @param calculate_filtered_list :: process SpectrumList and SpectrumMin/Max - * and save resulting explicit list of - * spectra indices into a vector data - * member, presently used only when loading - * into event_workspace + * @param gen_filtered_list :: process SpectrumList and SpectrumMin/Max + * and save resulting explicit list of + * spectra indices into a vector data + * member, presently used only when loading + * into event_workspace * * @return the size of a workspace */ From 6abdd51d6cd18ab94f1e59b2318efb8165b87928 Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Mon, 19 Jan 2015 16:57:06 +0000 Subject: [PATCH 045/130] windoze: index variable in OpenMP for must have signed type, re #7523 --- Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index 778f1d153dfb..33d12b4959cc 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -707,7 +707,7 @@ LoadNexusProcessed::loadEventEntry(NXData &wksp_cls, NXDouble &xbins, boost::shared_array indices = indices_data.sharedBuffer(); // Create all the event lists PARALLEL_FOR_NO_WSP_CHECK() - for (size_t j = 0; j < m_filtered_spec_idxs.size(); j++) { + for (int64_t j = 0; j < m_filtered_spec_idxs.size(); j++) { PARALLEL_START_INTERUPT_REGION size_t wi = m_filtered_spec_idxs[j] - 1; int64_t index_start = indices[wi]; From 5608ae8cdd47ab6824e69be73fdb39f78434951e Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Mon, 19 Jan 2015 17:00:09 +0000 Subject: [PATCH 046/130] and then avoid signed / unsigned comparison warning, re #7523 --- Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index 33d12b4959cc..ac768aad77f7 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -707,7 +707,7 @@ LoadNexusProcessed::loadEventEntry(NXData &wksp_cls, NXDouble &xbins, boost::shared_array indices = indices_data.sharedBuffer(); // Create all the event lists PARALLEL_FOR_NO_WSP_CHECK() - for (int64_t j = 0; j < m_filtered_spec_idxs.size(); j++) { + for (int64_t j = 0; j < static_cast(m_filtered_spec_idxs.size()); j++) { PARALLEL_START_INTERUPT_REGION size_t wi = m_filtered_spec_idxs[j] - 1; int64_t index_start = indices[wi]; From 31482d8d11df070c4f3f5a58458a6fb67ed1482b Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Mon, 19 Jan 2015 17:00:59 +0000 Subject: [PATCH 047/130] typo fix in for loop, re #7523 --- Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index ac768aad77f7..c92cd1abba6a 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -707,7 +707,7 @@ LoadNexusProcessed::loadEventEntry(NXData &wksp_cls, NXDouble &xbins, boost::shared_array indices = indices_data.sharedBuffer(); // Create all the event lists PARALLEL_FOR_NO_WSP_CHECK() - for (int64_t j = 0; j < static_cast(m_filtered_spec_idxs.size()); j++) { + for (int64_t j = 0; j < static_cast(m_filtered_spec_idxs.size()); j++) { PARALLEL_START_INTERUPT_REGION size_t wi = m_filtered_spec_idxs[j] - 1; int64_t index_start = indices[wi]; From e42005ed3cc11dfed81dd538944b879f4e494ce7 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 23 Jan 2015 11:04:49 +0000 Subject: [PATCH 048/130] Add skeleton UI for DoS Refs #10298 --- .../MantidQt/CustomInterfaces/CMakeLists.txt | 4 + .../DensityOfStates.h | 35 +++++ .../DensityOfStates.ui | 128 ++++++++++++++++++ .../IndirectSimulation.h | 1 + .../IndirectSimulation.ui | 5 + .../CustomInterfaces/src/DensityOfStates.cpp | 51 +++++++ .../src/IndirectSimulation.cpp | 2 + 7 files changed, 226 insertions(+) create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp diff --git a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt index 049063234c6d..22b033b4a04f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt @@ -2,6 +2,7 @@ set ( SRC_FILES src/ApplyCorr.cpp src/CalcCorr.cpp src/ConvFit.cpp + src/DensityOfStates.cpp src/DirectConvertToEnergy.cpp src/Elwin.cpp src/Fury.cpp @@ -78,6 +79,7 @@ set ( INC_FILES inc/MantidQtCustomInterfaces/Background.h inc/MantidQtCustomInterfaces/CalcCorr.h inc/MantidQtCustomInterfaces/ConvFit.h + inc/MantidQtCustomInterfaces/DensityOfStates.h inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h inc/MantidQtCustomInterfaces/DllConfig.h inc/MantidQtCustomInterfaces/Elwin.h @@ -164,6 +166,7 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h inc/MantidQtCustomInterfaces/ApplyCorr.h inc/MantidQtCustomInterfaces/CalcCorr.h inc/MantidQtCustomInterfaces/ConvFit.h + inc/MantidQtCustomInterfaces/DensityOfStates.h inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h inc/MantidQtCustomInterfaces/Elwin.h inc/MantidQtCustomInterfaces/Fury.h @@ -227,6 +230,7 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h ) set ( UI_FILES inc/MantidQtCustomInterfaces/AddWorkspace.ui + inc/MantidQtCustomInterfaces/DensityOfStates.ui inc/MantidQtCustomInterfaces/DirectConvertToEnergy.ui inc/MantidQtCustomInterfaces/IndirectBayes.ui inc/MantidQtCustomInterfaces/IndirectDataAnalysis.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h new file mode 100644 index 000000000000..3efd8135f69d --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h @@ -0,0 +1,35 @@ +#ifndef MANTIDQTCUSTOMINTERFACES_DENSITYOFSTATES_H_ +#define MANTIDQTCUSTOMINTERFACES_DENSITYOFSTATES_H_ + +#include "ui_DensityOfStates.h" +#include "MantidQtCustomInterfaces/IndirectSimulationTab.h" + +namespace MantidQt +{ + namespace CustomInterfaces + { + class DLLExport DensityOfStates : public IndirectSimulationTab + { + Q_OBJECT + + public: + DensityOfStates(QWidget * parent = 0); + + QString help() { return "DensityOfStates"; }; + + void setup(); + bool validate(); + void run(); + + /// Load default settings into the interface + void loadSettings(const QSettings& settings); + + private: + /// The ui form + Ui::DensityOfStates m_uiForm; + + }; + } // namespace CustomInterfaces +} // namespace MantidQt + +#endif //MANTIDQTCUSTOMINTERFACES_DENSITYOFSTATES_H_ diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui new file mode 100644 index 000000000000..84dc085d0573 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui @@ -0,0 +1,128 @@ + + + DensityOfStates + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + Input File + + + + 6 + + + + + + 0 + 0 + + + + + + + + .phonon + + + + + + + + Sample File: + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + Output Options + + + + + + true + + + Plot Result + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + + + MantidQt::MantidWidgets::MWRunFiles + QWidget +
MantidQtMantidWidgets/MWRunFiles.h
+
+
+ + mwInputFile + chkPlot + chkSave + + + +
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.h index 5ac204d0b15e..79bdb61e7371 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.h @@ -53,6 +53,7 @@ namespace MantidQt { MOLDYN, SASSENA, + DOS }; public: // public constructor, destructor and functions diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui index 0143af0267c7..a5193c752edd 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui @@ -36,6 +36,11 @@ Sassena + + + DensityOfStates + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp new file mode 100644 index 000000000000..4b8806259a06 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp @@ -0,0 +1,51 @@ +#include "MantidQtCustomInterfaces/DensityOfStates.h" + +#include +#include + +namespace MantidQt +{ + namespace CustomInterfaces + { + DensityOfStates::DensityOfStates(QWidget * parent) : + IndirectSimulationTab(parent) + { + m_uiForm.setupUi(parent); + } + + void DensityOfStates::setup() + { + } + + /** + * Validate the form to check the program can be run. + * + * @return Whether the form was valid + */ + bool DensityOfStates::validate() + { + //TODO + return true; + } + + /** + * Configures and executes the LoadSassena algorithm. + */ + void DensityOfStates::run() + { + //TODO + } + + /** + * Set the data selectors to use the default save directory + * when browsing for input files. + * + * @param settings :: The settings to loading into the interface + */ + void DensityOfStates::loadSettings(const QSettings& settings) + { + m_uiForm.mwInputFile->readSettings(settings.group()); + } + + } // namespace CustomInterfaces +} // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulation.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulation.cpp index 649cdfa022b9..540d746bdc80 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulation.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulation.cpp @@ -1,5 +1,6 @@ #include "MantidKernel/ConfigService.h" #include "MantidQtAPI/ManageUserDirectories.h" +#include "MantidQtCustomInterfaces/DensityOfStates.h" #include "MantidQtCustomInterfaces/IndirectSimulation.h" #include "MantidQtCustomInterfaces/IndirectMolDyn.h" #include "MantidQtCustomInterfaces/IndirectSassena.h" @@ -37,6 +38,7 @@ void IndirectSimulation::initLayout() // Insert each tab into the interface on creation m_simulationTabs.insert(std::make_pair(MOLDYN, new IndirectMolDyn(m_uiForm.IndirectSimulationTabs->widget(MOLDYN)))); m_simulationTabs.insert(std::make_pair(SASSENA, new IndirectSassena(m_uiForm.IndirectSimulationTabs->widget(SASSENA)))); + m_simulationTabs.insert(std::make_pair(DOS, new DensityOfStates(m_uiForm.IndirectSimulationTabs->widget(DOS)))); // Connect each tab to the actions available in this GUI std::map::iterator iter; From 0cc9cc709f60174e1dec0d00f3cb6cbb48790429 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 23 Jan 2015 17:02:43 +0000 Subject: [PATCH 049/130] Checkpointing work on UI Refs #10298 --- .../WorkflowAlgorithms/DensityOfStates.py | 2 +- .../DensityOfStates.h | 12 + .../DensityOfStates.ui | 489 +++++++++++++++++- .../CustomInterfaces/src/DensityOfStates.cpp | 180 ++++++- 4 files changed, 668 insertions(+), 15 deletions(-) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py index 4220284a2370..3370a19e0cd3 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py @@ -7,7 +7,7 @@ import os.path import math -class DensityOfStates(DataProcessorAlgorithm): +class DensityOfStates(PythonAlgorithm): def summary(self): return "Calculates phonon densities of states, Raman and IR spectrum." diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h index 3efd8135f69d..9544bffc7631 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h @@ -24,9 +24,21 @@ namespace MantidQt /// Load default settings into the interface void loadSettings(const QSettings& settings); + private slots: + void dosAlgoComplete(bool error); + void handleFileChange(); + void ionLoadComplete(bool error); + + void addAllIons(); + void removeAllIons(); + void addSelectedIons(); + void removeSelectedIons(); + private: /// The ui form Ui::DensityOfStates m_uiForm; + /// Name of output workspace + QString m_outputWsName; }; } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui index 84dc085d0573..f9f96552f20f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui @@ -6,8 +6,8 @@ 0 0 - 444 - 251 + 596 + 626
@@ -20,10 +20,7 @@ Input File - - 6 - - + @@ -37,20 +34,453 @@ .phonon + .castep + + false + + + + + + + + + + General + + + + + + Peak Width: + + + + + + + <html><head/><body><p>Select type of intensities to extract from file.</p></body></html> + + + + DensityOfStates + + + + + IR + + + + + Raman + + + + + + + + Peak Shape: + + + + + + + <html><head/><body><p>Shape of peaks to fit.</p></body></html> + + + + Gaussian + + + + + Lorentzian + + + + + + + + <html><head/><body><p>FWHM to broaden peaks by.</p></body></html> + + + 1000.000000000000000 + + + 0.100000000000000 + + + 10.000000000000000 + + + + + + + <html><head/><body><p>Width of bins to use for histogram rebinning (in eV or cm<span style=" vertical-align:super;">-1</span>).</p></body></html> + + + 1000.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + Bin Width: + - + + + Spectrum Type: + + + + + - Sample File: + Zero Threshold: + + + + + + + <html><head/><body><p>Threshold intensity at below which to ignore frequencies.</p></body></html> + + + 1000.000000000000000 + + + 0.100000000000000 + + + 3.000000000000000 + + + + + + + false + + + <html><head/><body><p>Factor by which to scale result.</p></body></html> + + + 1000.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + <html><head/><body><p>Toggle result scaling.</p></body></html> + + + Scale by factor: + + + + + 0 + 0 + + + + 0 + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 60 + + + + DensityOfStates + + + + + + Ions in File + + + + + + + Selected Ions + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Add all ions to partial DoS.</p></body></html> + + + >> + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Add selected ions to partial DoS.</p></body></html> + + + > + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Remove selected ions from partial DoS.</p></body></html> + + + < + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Remove all ions from partial DoS.</p></body></html> + + + << + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + + + + <html><head/><body><p>Sum contributions from selected ions.</p></body></html> + + + Sum Contributions + + + + + + + + + + + + 0 + 0 + + + + + 0 + + + + + + + 0 + + + + + + 0 + 0 + + + + Raman + + + + + + Temperature: + + + + + + + K + + + 1000.000000000000000 + + + 0.100000000000000 + + + 300.000000000000000 + + + + + + + + + + @@ -77,7 +507,7 @@ - + true @@ -100,7 +530,7 @@ - + Save Result @@ -120,9 +550,42 @@ mwInputFile - chkPlot - chkSave + ckPlot + ckSave - + + + cbSpectrumType + currentIndexChanged(int) + swOptions + setCurrentIndex(int) + + + 324 + 66 + + + 221 + 152 + + + + + ckScale + toggled(bool) + spScale + setEnabled(bool) + + + 119 + 237 + + + 324 + 238 + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp index 4b8806259a06..0f7fcd084c8a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp @@ -3,6 +3,14 @@ #include #include +using namespace Mantid::API; + +namespace +{ + Mantid::Kernel::Logger g_log("DensityOfStates"); +} + + namespace MantidQt { namespace CustomInterfaces @@ -11,12 +19,21 @@ namespace MantidQt IndirectSimulationTab(parent) { m_uiForm.setupUi(parent); + + connect(m_uiForm.mwInputFile, SIGNAL(filesFound()), this, SLOT(handleFileChange())); + + connect(m_uiForm.pbAddIons, SIGNAL(clicked()), this, SLOT(addSelectedIons())); + connect(m_uiForm.pbAddAllIons, SIGNAL(clicked()), this, SLOT(addAllIons())); + connect(m_uiForm.pbRemoveIons, SIGNAL(clicked()), this, SLOT(removeSelectedIons())); + connect(m_uiForm.pbRemoveAllIons, SIGNAL(clicked()), this, SLOT(removeAllIons())); } + void DensityOfStates::setup() { } + /** * Validate the form to check the program can be run. * @@ -28,14 +45,175 @@ namespace MantidQt return true; } + /** * Configures and executes the LoadSassena algorithm. */ void DensityOfStates::run() { - //TODO + // Get the DensityOfStates algorithm + IAlgorithm_sptr dosAlgo = AlgorithmManager::Instance().create("DensityOfStates"); + + QString filename = m_uiForm.mwInputFile->getFirstFilename(); + QFileInfo inputFileInfo(filename); + m_outputWsName = inputFileInfo.baseName(); + QString specType = m_uiForm.cbSpectrumType->currentText(); + + // Set common properties + dosAlgo->setProperty("File", filename.toStdString()); + dosAlgo->setProperty("OutputWorkspace", m_outputWsName.toStdString()); + + QString peakShape = m_uiForm.cbPeakShape->currentText(); + dosAlgo->setProperty("Function", peakShape.toStdString()); + + double peakWidth = m_uiForm.spPeakWidth->value(); + dosAlgo->setProperty("PeakWidth", peakWidth); + + double binWidth = m_uiForm.spBinWidth->value(); + dosAlgo->setProperty("BinWidth", binWidth); + + double zeroThreshold = m_uiForm.spZeroThreshold->value(); + dosAlgo->setProperty("ZeroThreshold", zeroThreshold); + + bool scale = m_uiForm.ckScale->isChecked(); + double scaleFactor = m_uiForm.spScale->value(); + if(scale) + dosAlgo->setProperty("Scale", scaleFactor); + + // Set spectrum type specific properties + if(specType == "DensityOfStates") + { + //TODO + + dosAlgo->setProperty("SpectrumType", "DOS"); + } + else if(specType == "IR") + { + dosAlgo->setProperty("SpectrumType", "IR_Active"); + } + else if(specType == "Raman") + { + double temperature = m_uiForm.spTemperature->value(); + dosAlgo->setProperty("Temperature", temperature); + + dosAlgo->setProperty("SpectrumType", "Raman_Active"); + } + + m_batchAlgoRunner->addAlgorithm(dosAlgo); + + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); + m_batchAlgoRunner->executeBatchAsync(); } + + /** + * Handles completion of the DensityOfStates algorithm. + * + * @param error If the algorithm failed + */ + void DensityOfStates::dosAlgoComplete(bool error) + { + if(error) + return; + + //TODO: plotting/saving + } + + + /** + * Handles a new file being selected by the browser. + */ + void DensityOfStates::handleFileChange() + { + QString filename = m_uiForm.mwInputFile->getFirstFilename(); + + IAlgorithm_sptr ionTableAlgo = AlgorithmManager::Instance().create("DensityOfStates"); + ionTableAlgo->initialize(); + ionTableAlgo->setProperty("File", filename.toStdString()); + ionTableAlgo->setProperty("SpectrumType", "IonTable"); + ionTableAlgo->setProperty("OutputWorkspace", "__dos_ions"); + + m_batchAlgoRunner->addAlgorithm(ionTableAlgo); + + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); + m_batchAlgoRunner->executeBatchAsync(); + } + + + /** + * Handles the algorithm loading the list of ions in a file + * being completed. + * + * @param error If the algorithm failed + */ + void DensityOfStates::ionLoadComplete(bool error) + { + if(error) + g_log.error("Could not get a list of ions from .phonon file"); + + ITableWorkspace_sptr ionTable = AnalysisDataService::Instance().retrieveWS("__dos_ions"); + Column_sptr ionColumn = ionTable->getColumn("Ion"); + size_t numIons = ionColumn->size(); + + m_uiForm.lwAllIons->clear(); + m_uiForm.lwSelectedIons->clear(); + + for(size_t ion = 0; ion < numIons; ion++) + { + const std::string ionName = ionColumn->cell(ion); + m_uiForm.lwAllIons->addItem(QString::fromStdString(ionName)); + } + } + + + /** + * Handle adding all ions from the list of available ions + * to the list of selected ions. + */ + void DensityOfStates::addAllIons() + { + m_uiForm.lwAllIons->selectAll(); + addSelectedIons(); + } + + + /** + * Handle removing all ions from the list of selected ions. + */ + void DensityOfStates::removeAllIons() + { + m_uiForm.lwSelectedIons->selectAll(); + removeSelectedIons(); + } + + + /** + * Handle adding selected ions from the list of available ions + * to the list of selected ions. + */ + void DensityOfStates::addSelectedIons() + { + auto items = m_uiForm.lwAllIons->selectedItems(); + + for(auto it = items.begin(); it != items.end(); ++it) + m_uiForm.lwSelectedIons->addItem(*it); + } + + + /** + * Handle removing selected ions from the list of selected ions. + */ + void DensityOfStates::removeSelectedIons() + { + auto items = m_uiForm.lwSelectedIons->selectedItems(); + + for(auto it = items.begin(); it != items.end(); ++it) + m_uiForm.lwAllIons->addItem(*it); + } + + /** * Set the data selectors to use the default save directory * when browsing for input files. From 4235123db5ff8ec035e9d37798a14fb0c9f9c044 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Sat, 24 Jan 2015 20:44:07 +0000 Subject: [PATCH 050/130] Re #10958 Initial commit. (Nothing working yest) --- .../Inelastic/Direct/ReductionWrapper.py | 47 ++++---- Code/Mantid/scripts/test/MariReduction.py | 100 +++++++++++------- 2 files changed, 93 insertions(+), 54 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 3e805b8f7ce6..96b267c926e2 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -17,18 +17,33 @@ class ReductionWrapper(object): """ def __init__(self,instrumentName,web_var=None): """ sets properties defaults for the instrument with Name""" - self.iliad_prop = PropertyManager(instrumentName) + #self.iliad_prop = PropertyManager(instrumentName) # the variables which are set up from the main properties self._main_properties=[] # the variables which are set up from the advanced properties. self._advanced_properties=[] - # The variables which are set up from web interface. - self._web_var = web_var + # The variables which are set up from web interface or to be exported to + # web interface + if web_var: + self._run_from_web = True + self._web_var_stor = web_var + else: + self._run_from_web = False + self._web_var_stor = object() + # Initialize reduced for given instrument + self._reducer = DirectEnergyConversion(instrumentName) + + def save_web_variables(self,FileName=None): + """ Method to write simple and advanced properties and help + information into dictionary, to use by web reduction + interface + + If no file is provided, reduce_var.py file will be written + to - def export_changed_values(self,FileName='reduce_vars.py'): - """ Method to write changed simple and advanced properties into dictionary, to process by - web reduction interface """ + if not FileName: + FileName = 'reduce_vars.py' f=open(FileName,'w') f.write("standard_vars = {\n") @@ -86,11 +101,13 @@ def main(self,input_file=None,output_directory=None): def MainProperties(main_prop_definition): """ Decorator stores properties dedicated as main and sets these properties as input to reduction parameters.""" def main_prop_wrapper(*args): + # execute decorated function properties = main_prop_definition(*args) #print "in decorator: ",properties host = args[0] - host._main_properties=properties - host.iliad_prop.set_input_parameters(**properties) + if not host._run_from_web: # property run locally + host._web_var_stor.main_prop =properties + host._reducer.prop_man.set_input_parameters(**properties) return properties return main_prop_wrapper @@ -101,19 +118,13 @@ def advanced_prop_wrapper(*args): properties = adv_prop_definition(*args) #print "in decorator: ",properties host = args[0] - host._advanced_properties=properties - host.iliad_prop.set_input_parameters(**properties) + if not host._run_from_web: # property run locally + host._web_var_stor.adv_prop =properties + host._reducer.prop_man.set_input_parameters(**properties) return properties return advanced_prop_wrapper -def using_web_data(self): - if self._web_var: - return True - else: - return False - - def iliad(main): """ This decorator wraps around main procedure, tries to identify if the procedure is run from web services or @@ -147,7 +158,7 @@ def iliad_wrapper(*args): host.iliad_prop.set_input_parameters(**web_vars) host.iliad_prop.sample_run = input_file - rez = main(*args) + rez = run_reducer(*args) # prohibit returning workspace to web services. if use_web_variables and not isinstance(rez,str): rez="" diff --git a/Code/Mantid/scripts/test/MariReduction.py b/Code/Mantid/scripts/test/MariReduction.py index 0d65d84434fc..390b6447ad0c 100644 --- a/Code/Mantid/scripts/test/MariReduction.py +++ b/Code/Mantid/scripts/test/MariReduction.py @@ -10,13 +10,14 @@ class ReduceMARI(ReductionWrapper): +#-------------------------------------------------------------------------------------------------# @MainProperties def def_main_properties(self): """ Define main properties used in reduction """ - prop = {}; - prop['sample_run'] = 11001; + prop = {} + prop['sample_run'] = 11001 prop['wb_run'] = 11060 - prop['incident_energy'] = 12; + prop['incident_energy'] = 12 prop['energy_bins'] = [-11,0.05,11] # Absolute units reduction properties. @@ -24,56 +25,83 @@ def def_main_properties(self): prop['sample_mass'] = 10 prop['sample_rmm'] = 435.96 return prop - +#-------------------------------------------------------------------------------------------------# @AdvancedProperties def def_advanced_properties(self): """ separation between simple and advanced properties depends on scientist, experiment and user. main properties override advanced properties. """ - prop = {}; + prop = {} prop['map_file'] = "mari_res.map" prop['monovan_mapfile'] = "mari_res.map" - prop['hard_mask_file'] ="mar11015.msk" - prop['det_cal_file'] ="11060" - prop['save_format']='' - return prop; + prop['hard_mask_file'] = "mar11015.msk" + prop['det_cal_file'] = "11060" + prop['save_format'] = '' + return prop # +#-------------------------------------------------------------------------------------------------# @iliad - def main(self,input_file=None,output_directory=None): - # run reduction, write auxiliary script to add something here. + def reduce(self,input_file=None,output_directory=None): + """ Method executes reduction over single file""" + + ws = red.convert_to_energy(None,input_file) + #SaveNexus(ws,Filename = 'MARNewReduction.nxs') - red = DirectEnergyConversion(); - red.initialise(self.red_prop); - ws = red.convert_to_energy(); - #SaveNexus(ws,Filename = 'MARNewReduction.nxs') + #when run from web service, return additional path for web server to copy + #data to" + return ws - #when run from web service, return additional path for web server to copy data to"; - return ws - def __init__(self): + def __init__(self,web_var=None): """ sets properties defaults for the instrument with Name""" ReductionWrapper.__init__(self,'MAR',web_var) - - -if __name__=="__main__": - maps_dir = 'd:/Data/MantidSystemTests/Data' - data_dir ='d:/Data/Mantid_Testing/14_11_27' +#-------------------------------------------------------------------------------------------------# +#-------------------------------------------------------------------------------------------------# +#-------------------------------------------------------------------------------------------------# +def main(input_file,output_directory): + """ This method is used to run code from web service + and should not be touched unless you change the name of the + particular ReductionWrapper class (e.g. ReduceMARI here) + + exception to change the output folder to save data to + """ + # note web variables initialization + rd = ReduceMARI(web_var) + rd.main(input_file,output_directory) + + # Define folder for web service to copy results to + output_folder = '' + return output_folder + +if __name__ == "__main__": +#-------------------------------------------------------------------------------------------------# +# SECTION USED TO RUN REDUCTION FROM MANTID SCRIPT WINDOW # +#-------------------------------------------------------------------------------------------------# +##### Here one sets up folders where to find input data and where to save results ##### + # It can be done here or from Mantid GUI + # Folder where map files are located: + map_mask_dir = 'd:/Data/MantidSystemTests/Data' + # folder where input data can be found + data_dir = 'd:/Data/Mantid_Testing/14_11_27' + # auxiliary folder with results ref_data_dir = 'd:/Data/MantidSystemTests/SystemTests/AnalysisTests/ReferenceResults' - config.setDataSearchDirs('{0};{1};{2}'.format(data_dir,maps_dir,ref_data_dir)) + # Set input path to + config.setDataSearchDirs('{0};{1};{2}'.format(data_dir,map_mask_dir,ref_data_dir)) + # use appendDataSearch directory to add to existing data search path #config.appendDataSearchDir('d:/Data/Mantid_GIT/Test/AutoTestData') - config['defaultsave.directory'] = data_dir # folder to save resulting spe/nxspe files. Defaults are in - - # execute stuff from Mantid - rd = ReduceMARI(); - rd.def_advanced_properties(); - rd.def_main_properties(); + # folder to save resulting spe/nxspe files. + config['defaultsave.directory'] = data_dir +###### Initialize reduction class above and set up reduction properties. Note no parameters ###### + rd = ReduceMARI() + # set up advanced and main properties + rd.def_advanced_properties() + rd.def_main_properties() - using_web_data = False; - if not using_web_data: - run_dir=os.path.dirname(os.path.realpath(__file__)) - file = os.path.join(run_dir,'reduce_vars.py'); - rd.export_changed_values(file); + # uncomment rows below to save web variables to use in web services. + run_dir = os.path.dirname(os.path.realpath(__file__)) + file = os.path.join(run_dir,'reduce_vars.py') + rd.save_web_variables(file) - rd.main(); + rd.main() From 35b9ac8bd213ad3d95193956c7726a56fc0a7613 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 09:40:47 +0000 Subject: [PATCH 051/130] Fix ion selection and UI size Refs #10298 --- .../DensityOfStates.ui | 843 +++++++++--------- .../IndirectMolDyn.ui | 4 +- .../IndirectSassena.ui | 4 +- .../IndirectSimulation.ui | 4 +- .../CustomInterfaces/src/DensityOfStates.cpp | 13 +- 5 files changed, 448 insertions(+), 420 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui index f9f96552f20f..77369f2e2c7f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui @@ -6,8 +6,8 @@ 0 0 - 596 - 626 + 500 + 500
@@ -46,422 +46,136 @@ - - - General + + + true - - - - - Peak Width: - - - - - - - <html><head/><body><p>Select type of intensities to extract from file.</p></body></html> - - - - DensityOfStates - - - - - IR - - - - - Raman - - - - - - - - Peak Shape: - - - - - - - <html><head/><body><p>Shape of peaks to fit.</p></body></html> - - - - Gaussian - - - - - Lorentzian - - - - - - - - <html><head/><body><p>FWHM to broaden peaks by.</p></body></html> - - - 1000.000000000000000 - - - 0.100000000000000 - - - 10.000000000000000 - - - - - - - <html><head/><body><p>Width of bins to use for histogram rebinning (in eV or cm<span style=" vertical-align:super;">-1</span>).</p></body></html> - - - 1000.000000000000000 - - - 0.100000000000000 - - - 1.000000000000000 - - - - - - - Bin Width: - - - - - - - Spectrum Type: - - - - - - - Zero Threshold: - - - - - - - <html><head/><body><p>Threshold intensity at below which to ignore frequencies.</p></body></html> - - - 1000.000000000000000 - - - 0.100000000000000 - - - 3.000000000000000 - - - - - - - false - - - <html><head/><body><p>Factor by which to scale result.</p></body></html> - - - 1000.000000000000000 - - - 0.100000000000000 - - - 1.000000000000000 - - - - - - - <html><head/><body><p>Toggle result scaling.</p></body></html> - - - Scale by factor: - - - - - - - - - - - 0 - 0 - - - - 0 - - - - - 0 - - - - - - 0 - 0 - - - - - 0 - 60 - - + + + + 0 + 0 + 462 + 433 + + + + + - DensityOfStates + General - - - + + + - Ions in File + Peak Width: - - - - Selected Ions - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + <html><head/><body><p>Select type of intensities to extract from file.</p></body></html> - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 0 - 0 - - - - - 30 - 30 - - - - <html><head/><body><p>Add all ions to partial DoS.</p></body></html> - - - >> - - + + DensityOfStates + - - - - 0 - 0 - - - - - 30 - 30 - - - - <html><head/><body><p>Add selected ions to partial DoS.</p></body></html> - - - > - - + + IR + - - - - 0 - 0 - - - - - 30 - 30 - - - - <html><head/><body><p>Remove selected ions from partial DoS.</p></body></html> - - - < - - + + Raman + + + + + + + Peak Shape: + + + + + + + <html><head/><body><p>Shape of peaks to fit.</p></body></html> + - - - - 0 - 0 - - - - - 30 - 30 - - - - <html><head/><body><p>Remove all ions from partial DoS.</p></body></html> - - - << - - + + Gaussian + - - - Qt::Vertical - - - - 20 - 40 - - - + + Lorentzian + - + - - - - - 0 - 0 - + + + + <html><head/><body><p>FWHM to broaden peaks by.</p></body></html> - - - 0 - 50 - + + 1000.000000000000000 - - - - - - - 0 - 0 - + + 0.100000000000000 - - - 0 - 50 - + + 10.000000000000000 - - + + - <html><head/><body><p>Sum contributions from selected ions.</p></body></html> + <html><head/><body><p>Width of bins to use for histogram rebinning (in eV or cm<span style=" vertical-align:super;">-1</span>).</p></body></html> + + + 1000.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + - Sum Contributions + Bin Width: - - - - - - - - - 0 - 0 - - - - - 0 - - - - - - - 0 - - - - - - 0 - 0 - - - - Raman - - - + - Temperature: + Spectrum Type: - - - - K + + + + Zero Threshold: + + + + + + + <html><head/><body><p>Threshold intensity at below which to ignore frequencies.</p></body></html> 1000.000000000000000 @@ -470,30 +184,335 @@ 0.100000000000000 - 300.000000000000000 + 3.000000000000000 + + + + + + + false + + + <html><head/><body><p>Factor by which to scale result.</p></body></html> + + + 1000.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + <html><head/><body><p>Toggle result scaling.</p></body></html> + + + Scale by factor: + + + + + 0 + 0 + + + + 0 + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 60 + + + + DensityOfStates + + + + + + Ions in File + + + + + + + Selected Ions + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Add all ions to partial DoS.</p></body></html> + + + >> + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Add selected ions to partial DoS.</p></body></html> + + + > + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Remove selected ions from partial DoS.</p></body></html> + + + < + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p>Remove all ions from partial DoS.</p></body></html> + + + << + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + + + + <html><head/><body><p>Sum contributions from selected ions.</p></body></html> + + + Sum Contributions + + + + + + + + + + + + 0 + 0 + + + + + 0 + + + + + + + 0 + + + + + + 0 + 0 + + + + Raman + + + + + + Temperature: + + + + + + + K + + + 1000.000000000000000 + + + 0.100000000000000 + + + 300.000000000000000 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -555,22 +574,6 @@ - - cbSpectrumType - currentIndexChanged(int) - swOptions - setCurrentIndex(int) - - - 324 - 66 - - - 221 - 152 - - - ckScale toggled(bool) @@ -587,5 +590,21 @@ + + cbSpectrumType + currentIndexChanged(int) + swOptions + setCurrentIndex(int) + + + 348 + 99 + + + 241 + 369 + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.ui index 56686f597263..36e8e4db23f0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.ui @@ -6,8 +6,8 @@ 0 0 - 445 - 450 + 500 + 500 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.ui index db0f69caa544..62ae159ce2df 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.ui @@ -6,8 +6,8 @@ 0 0 - 444 - 251 + 500 + 500 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui index a5193c752edd..1add339d839a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui @@ -6,8 +6,8 @@ 0 0 - 445 - 450 + 500 + 500 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp index 0f7fcd084c8a..9f57c18c6a82 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp @@ -26,6 +26,9 @@ namespace MantidQt connect(m_uiForm.pbAddAllIons, SIGNAL(clicked()), this, SLOT(addAllIons())); connect(m_uiForm.pbRemoveIons, SIGNAL(clicked()), this, SLOT(removeSelectedIons())); connect(m_uiForm.pbRemoveAllIons, SIGNAL(clicked()), this, SLOT(removeAllIons())); + + m_uiForm.lwAllIons->setSelectionMode(QAbstractItemView::MultiSelection); + m_uiForm.lwSelectedIons->setSelectionMode(QAbstractItemView::MultiSelection); } @@ -198,7 +201,10 @@ namespace MantidQt auto items = m_uiForm.lwAllIons->selectedItems(); for(auto it = items.begin(); it != items.end(); ++it) - m_uiForm.lwSelectedIons->addItem(*it); + { + m_uiForm.lwSelectedIons->addItem((*it)->text()); + m_uiForm.lwAllIons->takeItem(m_uiForm.lwAllIons->row(*it)); + } } @@ -210,7 +216,10 @@ namespace MantidQt auto items = m_uiForm.lwSelectedIons->selectedItems(); for(auto it = items.begin(); it != items.end(); ++it) - m_uiForm.lwAllIons->addItem(*it); + { + m_uiForm.lwAllIons->addItem((*it)->text()); + m_uiForm.lwSelectedIons->takeItem(m_uiForm.lwSelectedIons->row(*it)); + } } From b3ea0d49324f3afa1c43a2fa36abdbeca0706fda Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 10:11:37 +0000 Subject: [PATCH 052/130] Simpler ion selection for DOS Refs #10298 --- .../DensityOfStates.h | 5 - .../DensityOfStates.ui | 170 ++++++------------ .../CustomInterfaces/src/DensityOfStates.cpp | 95 +++------- 3 files changed, 77 insertions(+), 193 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h index 9544bffc7631..1def23931327 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.h @@ -29,11 +29,6 @@ namespace MantidQt void handleFileChange(); void ionLoadComplete(bool error); - void addAllIons(); - void removeAllIons(); - void addSelectedIons(); - void removeSelectedIons(); - private: /// The ui form Ui::DensityOfStates m_uiForm; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui index 77369f2e2c7f..ce62ebfacd83 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui @@ -55,8 +55,8 @@ 0 0 - 462 - 433 + 478 + 372 @@ -254,127 +254,51 @@ DensityOfStates - - - - Ions in File - - - - - - - Selected Ions - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + + + 0 0 - - - 30 - 30 - - <html><head/><body><p>Add all ions to partial DoS.</p></body></html> - >> - - - - - - - - 0 - 0 - - - - - 30 - 30 - - - - <html><head/><body><p>Add selected ions to partial DoS.</p></body></html> - - - > + Select All - - + + 0 0 - - - 30 - 30 - - - <html><head/><body><p>Remove selected ions from partial DoS.</p></body></html> + <html><head/><body><p>Remove all ions from partial DoS.</p></body></html> - < + Deselect All - - - - - 0 - 0 - - - - - 30 - 30 - - + + - <html><head/><body><p>Remove all ions from partial DoS.</p></body></html> + <html><head/><body><p>Sum contributions from selected ions.</p></body></html> - << + Sum Contributions - + Qt::Vertical @@ -389,24 +313,8 @@ - - - - - 0 - 0 - - - - - 0 - 50 - - - - - - + + 0 @@ -421,16 +329,6 @@ - - - - <html><head/><body><p>Sum contributions from selected ions.</p></body></html> - - - Sum Contributions - - - @@ -606,5 +504,37 @@ + + pbSelectAllIons + clicked() + lwIons + selectAll() + + + 334 + 301 + + + 158 + 346 + + + + + pbDeselectAllIons + clicked() + lwIons + clearSelection() + + + 421 + 301 + + + 158 + 346 + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp index 9f57c18c6a82..1eb3e14b93f4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp @@ -1,5 +1,7 @@ #include "MantidQtCustomInterfaces/DensityOfStates.h" +#include "MantidQtCustomInterfaces/UserInputValidator.h" + #include #include @@ -22,13 +24,7 @@ namespace MantidQt connect(m_uiForm.mwInputFile, SIGNAL(filesFound()), this, SLOT(handleFileChange())); - connect(m_uiForm.pbAddIons, SIGNAL(clicked()), this, SLOT(addSelectedIons())); - connect(m_uiForm.pbAddAllIons, SIGNAL(clicked()), this, SLOT(addAllIons())); - connect(m_uiForm.pbRemoveIons, SIGNAL(clicked()), this, SLOT(removeSelectedIons())); - connect(m_uiForm.pbRemoveAllIons, SIGNAL(clicked()), this, SLOT(removeAllIons())); - - m_uiForm.lwAllIons->setSelectionMode(QAbstractItemView::MultiSelection); - m_uiForm.lwSelectedIons->setSelectionMode(QAbstractItemView::MultiSelection); + m_uiForm.lwIons->setSelectionMode(QAbstractItemView::MultiSelection); } @@ -44,8 +40,17 @@ namespace MantidQt */ bool DensityOfStates::validate() { - //TODO - return true; + UserInputValidator uiv; + + QString specType = m_uiForm.cbSpectrumType->currentText(); + auto items = m_uiForm.lwIons->selectedItems(); + if(specType == "DensityOfStates" && items.size() < 1) + uiv.addErrorMessage("Must select at least one ion for DensityOfStates."); + + if(!uiv.isAllInputValid()) + emit showMessageBox(uiv.generateErrorMessage()); + + return uiv.isAllInputValid(); } @@ -86,9 +91,16 @@ namespace MantidQt // Set spectrum type specific properties if(specType == "DensityOfStates") { - //TODO - dosAlgo->setProperty("SpectrumType", "DOS"); + + bool sumContributions = m_uiForm.ckSumContributions->isChecked(); + dosAlgo->setProperty("SumContributions", sumContributions); + + std::vector selectedIons; + auto items = m_uiForm.lwIons->selectedItems(); + for(auto it = items.begin(); it != items.end(); ++it) + selectedIons.push_back((*it)->text().toStdString()); + dosAlgo->setProperty("Ions", selectedIons); } else if(specType == "IR") { @@ -96,10 +108,10 @@ namespace MantidQt } else if(specType == "Raman") { + dosAlgo->setProperty("SpectrumType", "Raman_Active"); + double temperature = m_uiForm.spTemperature->value(); dosAlgo->setProperty("Temperature", temperature); - - dosAlgo->setProperty("SpectrumType", "Raman_Active"); } m_batchAlgoRunner->addAlgorithm(dosAlgo); @@ -160,65 +172,12 @@ namespace MantidQt Column_sptr ionColumn = ionTable->getColumn("Ion"); size_t numIons = ionColumn->size(); - m_uiForm.lwAllIons->clear(); - m_uiForm.lwSelectedIons->clear(); + m_uiForm.lwIons->clear(); for(size_t ion = 0; ion < numIons; ion++) { const std::string ionName = ionColumn->cell(ion); - m_uiForm.lwAllIons->addItem(QString::fromStdString(ionName)); - } - } - - - /** - * Handle adding all ions from the list of available ions - * to the list of selected ions. - */ - void DensityOfStates::addAllIons() - { - m_uiForm.lwAllIons->selectAll(); - addSelectedIons(); - } - - - /** - * Handle removing all ions from the list of selected ions. - */ - void DensityOfStates::removeAllIons() - { - m_uiForm.lwSelectedIons->selectAll(); - removeSelectedIons(); - } - - - /** - * Handle adding selected ions from the list of available ions - * to the list of selected ions. - */ - void DensityOfStates::addSelectedIons() - { - auto items = m_uiForm.lwAllIons->selectedItems(); - - for(auto it = items.begin(); it != items.end(); ++it) - { - m_uiForm.lwSelectedIons->addItem((*it)->text()); - m_uiForm.lwAllIons->takeItem(m_uiForm.lwAllIons->row(*it)); - } - } - - - /** - * Handle removing selected ions from the list of selected ions. - */ - void DensityOfStates::removeSelectedIons() - { - auto items = m_uiForm.lwSelectedIons->selectedItems(); - - for(auto it = items.begin(); it != items.end(); ++it) - { - m_uiForm.lwAllIons->addItem((*it)->text()); - m_uiForm.lwSelectedIons->takeItem(m_uiForm.lwSelectedIons->row(*it)); + m_uiForm.lwIons->addItem(QString::fromStdString(ionName)); } } From 646047990ef623f0b840c6595a1506593511431f Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 10:46:30 +0000 Subject: [PATCH 053/130] Make sizes a little more consistent Refs #10960 --- .../inc/MantidQtCustomInterfaces/IndirectBayes.ui | 4 ++-- .../inc/MantidQtCustomInterfaces/IndirectDataReduction.ui | 4 ++-- .../inc/MantidQtCustomInterfaces/IndirectLoadILL.ui | 4 ++-- .../inc/MantidQtCustomInterfaces/IndirectTools.ui | 4 ++-- .../inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui | 4 ++-- .../CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.ui | 4 ++-- .../CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.ui | 4 ++-- .../CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.ui | 4 ++-- .../CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.ui | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.ui index 763246e4e2af..d72987740e14 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.ui @@ -6,8 +6,8 @@ 0 0 - 899 - 686 + 900 + 600
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.ui index a1b78ee2f699..cd1d4dae0e91 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.ui @@ -6,8 +6,8 @@ 0 0 - 621 - 699 + 650 + 700 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.ui index 699e50c553f7..70b5b08b8f0d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.ui @@ -6,8 +6,8 @@ 0 0 - 697 - 278 + 800 + 320 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.ui index 6b4009c67d9d..43d42836cf73 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.ui @@ -6,8 +6,8 @@ 0 0 - 900 - 350 + 800 + 320 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui index 5024e0641a7a..468a56f48867 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui @@ -6,8 +6,8 @@ 0 0 - 697 - 278 + 800 + 320 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.ui index ae6a514a585d..31701866223b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.ui @@ -6,8 +6,8 @@ 0 0 - 806 - 572 + 900 + 600 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.ui index ff228eb43500..053f3108129b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.ui @@ -6,8 +6,8 @@ 0 0 - 838 - 554 + 900 + 600 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.ui index 0711d295886d..e4c4685232ee 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.ui @@ -6,8 +6,8 @@ 0 0 - 683 - 319 + 900 + 600 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.ui index 5e79aa47d4f7..da7af34497c8 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.ui @@ -6,8 +6,8 @@ 0 0 - 950 - 615 + 900 + 600 From 5ae5c459ad25d6f759e52a0ac24010f22ec61bcb Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Mon, 26 Jan 2015 12:34:22 +0000 Subject: [PATCH 054/130] Re #10958 Intermediate checkout --- .../Inelastic/Direct/ReductionWrapper.py | 64 ++++++++++--------- .../scripts/test/ReductionWrapperTest.py | 30 ++++----- 2 files changed, 48 insertions(+), 46 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 96b267c926e2..e41feb504714 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -15,21 +15,24 @@ class ReductionWrapper(object): using the same interface and the same run file placed in different locations. """ + def var_holder(object): + """ A simple wrapper class to keep web variables""" + def __init__(self): + pass + def __init__(self,instrumentName,web_var=None): - """ sets properties defaults for the instrument with Name""" - #self.iliad_prop = PropertyManager(instrumentName) - # the variables which are set up from the main properties - self._main_properties=[] - # the variables which are set up from the advanced properties. - self._advanced_properties=[] - # The variables which are set up from web interface or to be exported to + """ sets properties defaults for the instrument with Name + and define if wrapper runs from web services or not + """ + + # The variables which are set up from web interface or to be exported to # web interface if web_var: self._run_from_web = True - self._web_var_stor = web_var + self._wvs = web_var else: self._run_from_web = False - self._web_var_stor = object() + self._wvs = ReductionWrapper.var_holder # Initialize reduced for given instrument self._reducer = DirectEnergyConversion(instrumentName) @@ -91,7 +94,7 @@ def def_advanced_properties(self): raise NotImplementedError('def_advanced_properties has to be implemented') @abstractmethod - def main(self,input_file=None,output_directory=None): + def reduce(self,input_file=None,output_directory=None): """ The method which performs all main reduction operations. """ @@ -102,12 +105,12 @@ def MainProperties(main_prop_definition): """ Decorator stores properties dedicated as main and sets these properties as input to reduction parameters.""" def main_prop_wrapper(*args): # execute decorated function - properties = main_prop_definition(*args) + prop_dict = main_prop_definition(*args) #print "in decorator: ",properties host = args[0] if not host._run_from_web: # property run locally - host._web_var_stor.main_prop =properties - host._reducer.prop_man.set_input_parameters(**properties) + host._wvs.standard_vars = prop_dict + host._reducer.prop_man.set_input_parameters(**prop_dict) return properties return main_prop_wrapper @@ -115,26 +118,21 @@ def main_prop_wrapper(*args): def AdvancedProperties(adv_prop_definition): """ Decorator stores properties decided to be advanced and sets these properties as input for reduction parameters """ def advanced_prop_wrapper(*args): - properties = adv_prop_definition(*args) + prop_dict = adv_prop_definition(*args) #print "in decorator: ",properties host = args[0] if not host._run_from_web: # property run locally - host._web_var_stor.adv_prop =properties - host._reducer.prop_man.set_input_parameters(**properties) + host._wvs.advanced_vars =prop_dict + host._reducer.prop_man.set_input_parameters(**prop_dict) return properties return advanced_prop_wrapper def iliad(main): - """ This decorator wraps around main procedure, tries to identify if the procedure is run from web services or - from Mantid directly and sets up web-modified variables as input for reduction if it runs from web services. - - The procedure to identify web services presence is simplified and contains two checks: - 1) file reduce_vars.py is present and has been imported by reduction script as web_vars - 2) the method, this decorators frames, is called with arguments, where second argument defines output directory for reduction data - (this variable is present and not empty) - + """ This decorator wraps around main procedure and switch input from + web variables to properties or vise versa depending on web variables + presence """ def iliad_wrapper(*args): #seq = inspect.stack() @@ -149,18 +147,22 @@ def iliad_wrapper(*args): else: input_file=None output_directory=None - - use_web_variables= False - if host._web_var and output_directory: - use_web_variables = True - config.appendDataSearchDir(str(output_directory)) - web_vars = dict(host._web_var.standard_vars.items()+host._web_var.advanced_vars.items()) + # add input file folder to data search directory if file has it + if input_file: + data_path = os.path.dirname(input_file) + try: + config.appendDataSearchDir(str(output_directory)) + except: # if mantid is not available, this should ignore config + pass + + if host._run_from_web: + web_vars = dict(host._web_var.standard_vars.items()+host._web_var.standard_vars.items()) host.iliad_prop.set_input_parameters(**web_vars) host.iliad_prop.sample_run = input_file rez = run_reducer(*args) # prohibit returning workspace to web services. - if use_web_variables and not isinstance(rez,str): + if host._run_from_web and not isinstance(rez,str): rez="" return rez diff --git a/Code/Mantid/scripts/test/ReductionWrapperTest.py b/Code/Mantid/scripts/test/ReductionWrapperTest.py index 679a6ef3347e..21a1e6294c59 100644 --- a/Code/Mantid/scripts/test/ReductionWrapperTest.py +++ b/Code/Mantid/scripts/test/ReductionWrapperTest.py @@ -1,5 +1,5 @@ import os,sys -#os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] +os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] from mantid.simpleapi import * from mantid import api @@ -28,7 +28,7 @@ def tearDown(self): pass def test_default_fails(self): - red=ReductionWrapper('MAR'); + red=ReductionWrapper('MAR') self.assertRaises(NotImplementedError,red.def_main_properties) @@ -38,33 +38,33 @@ def test_default_fails(self): def test_export_advanced_values(self): - red = ReduceMARI(); + red = ReduceMARI() - main_prop=red.def_main_properties(); - adv_prop=red.def_advanced_properties(); + main_prop=red.def_main_properties() + adv_prop=red.def_advanced_properties() # see what have changed and what have changed as advanced properties. - all_changed_prop = red.iliad_prop.getChangedProperties(); + all_changed_prop = red.iliad_prop.getChangedProperties() - self.assertEqual(set(main_prop.keys()+adv_prop.keys()),all_changed_prop); + self.assertEqual(set(main_prop.keys()+adv_prop.keys()),all_changed_prop) - test_dir = config['defaultsave.directory']; - file = os.path.join(test_dir,'reduce_vars.py'); - red.export_changed_values(file); - self.assertTrue(os.path.isfile(file)); + test_dir = config['defaultsave.directory'] + file = os.path.join(test_dir,'reduce_vars.py') + red.export_changed_values(file) + self.assertTrue(os.path.isfile(file)) # restore saved parameters. - sys.path.insert(0,test_dir); + sys.path.insert(0,test_dir) import reduce_vars as rv - self.assertEqual(rv.standard_vars,main_prop); - self.assertEqual(rv.advanced_vars,adv_prop); + self.assertEqual(rv.standard_vars,main_prop) + self.assertEqual(rv.advanced_vars,adv_prop) - os.remove(file); + os.remove(file) fbase,fext = os.path.splitext(file) fcomp = fbase+'.pyc' if os.path.isfile(fcomp): From 4158b5ce8721d8c6efa75b5519a6ea3e2bdced79 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 14:23:42 +0000 Subject: [PATCH 055/130] Add cross section scale option to DoS UI Refs #10298 --- .../DensityOfStates.ui | 152 ++++++++++++------ .../CustomInterfaces/src/DensityOfStates.cpp | 5 + 2 files changed, 112 insertions(+), 45 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui index ce62ebfacd83..414659460424 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DensityOfStates.ui @@ -254,52 +254,114 @@ DensityOfStates + + + + + 0 + 0 + + + + + 0 + 50 + + + + - - - - - 0 - 0 - - - - <html><head/><body><p>Add all ions to partial DoS.</p></body></html> - + + - Select All + Scale by cross sections: - - - - - 0 - 0 - - - - <html><head/><body><p>Remove all ions from partial DoS.</p></body></html> - - - Deselect All + + + + + + + 0 + 0 + + + + <html><head/><body><p>Add all ions to partial DoS.</p></body></html> + + + Select All + + + + + + + + 0 + 0 + + + + <html><head/><body><p>Remove all ions from partial DoS.</p></body></html> + + + Deselect All + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + false + + + Total + + + + + Incoherent + + + + + Coherent + + - + <html><head/><body><p>Sum contributions from selected ions.</p></body></html> - Sum Contributions + Sum Ion Contributions - - + + Qt::Vertical @@ -313,22 +375,6 @@ - - - - - 0 - 0 - - - - - 0 - 50 - - - - @@ -536,5 +582,21 @@ + + ckCrossSectionScale + toggled(bool) + cbCrossSectionScale + setEnabled(bool) + + + 280 + 357 + + + 418 + 358 + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp index 1eb3e14b93f4..1a92068d1c4e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp @@ -93,6 +93,11 @@ namespace MantidQt { dosAlgo->setProperty("SpectrumType", "DOS"); + bool crossSectionScale = m_uiForm.ckCrossSectionScale->isChecked(); + QString crossSectionScaleType = m_uiForm.cbCrossSectionScale->currentText(); + if(crossSectionScale) + dosAlgo->setProperty("ScaleByCrossSection", crossSectionScaleType.toStdString()); + bool sumContributions = m_uiForm.ckSumContributions->isChecked(); dosAlgo->setProperty("SumContributions", sumContributions); From c9c9f44ceaddb1dfc24721391dc570bb28d3624e Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 15:00:28 +0000 Subject: [PATCH 056/130] Moved Indirect interface files to their own folder Previously that accounted for around half the UI and source files, this is just to help keep the directories a little cleaner. Refs #10960 --- .../MantidQt/CustomInterfaces/CMakeLists.txt | 232 +++++++++--------- .../{ => Indirect}/ApplyCorr.h | 2 +- .../{ => Indirect}/CalcCorr.h | 2 +- .../{ => Indirect}/ConvFit.h | 2 +- .../{ => Indirect}/Elwin.h | 2 +- .../{ => Indirect}/Fury.h | 2 +- .../{ => Indirect}/FuryFit.h | 2 +- .../{ => Indirect}/IDATab.h | 4 +- .../{ => Indirect}/IndirectBayes.h | 2 +- .../{ => Indirect}/IndirectBayes.ui | 0 .../{ => Indirect}/IndirectBayesTab.h | 2 +- .../{ => Indirect}/IndirectCalibration.h | 2 +- .../{ => Indirect}/IndirectConvertToEnergy.h | 2 +- .../{ => Indirect}/IndirectDataAnalysis.h | 2 +- .../{ => Indirect}/IndirectDataAnalysis.ui | 0 .../{ => Indirect}/IndirectDataReduction.h | 2 +- .../{ => Indirect}/IndirectDataReduction.ui | 0 .../{ => Indirect}/IndirectDataReductionTab.h | 4 +- .../{ => Indirect}/IndirectDiagnostics.h | 2 +- .../IndirectDiffractionReduction.h | 0 .../IndirectDiffractionReduction.ui | 0 .../{ => Indirect}/IndirectLoadILL.h | 2 +- .../{ => Indirect}/IndirectLoadILL.ui | 0 .../{ => Indirect}/IndirectMolDyn.h | 2 +- .../{ => Indirect}/IndirectMolDyn.ui | 0 .../{ => Indirect}/IndirectMoments.h | 2 +- .../{ => Indirect}/IndirectSassena.h | 2 +- .../{ => Indirect}/IndirectSassena.ui | 0 .../{ => Indirect}/IndirectSimulation.h | 2 +- .../{ => Indirect}/IndirectSimulation.ui | 0 .../{ => Indirect}/IndirectSimulationTab.h | 2 +- .../{ => Indirect}/IndirectSqw.h | 2 +- .../{ => Indirect}/IndirectSymmetrise.h | 2 +- .../{ => Indirect}/IndirectTab.h | 0 .../{ => Indirect}/IndirectTools.h | 2 +- .../{ => Indirect}/IndirectTools.ui | 0 .../{ => Indirect}/IndirectToolsTab.h | 0 .../{ => Indirect}/IndirectTransmission.h | 2 +- .../{ => Indirect}/IndirectTransmissionCalc.h | 2 +- .../IndirectTransmissionCalc.ui | 0 .../{ => Indirect}/JumpFit.h | 2 +- .../{ => Indirect}/JumpFit.ui | 0 .../{ => Indirect}/MSDFit.h | 2 +- .../{ => Indirect}/Quasi.h | 2 +- .../{ => Indirect}/Quasi.ui | 0 .../{ => Indirect}/ResNorm.h | 2 +- .../{ => Indirect}/ResNorm.ui | 0 .../{ => Indirect}/Stretch.h | 2 +- .../{ => Indirect}/Stretch.ui | 0 .../src/{ => Indirect}/ApplyCorr.cpp | 2 +- .../src/{ => Indirect}/CalcCorr.cpp | 2 +- .../src/{ => Indirect}/ConvFit.cpp | 2 +- .../src/{ => Indirect}/Elwin.cpp | 2 +- .../src/{ => Indirect}/Fury.cpp | 2 +- .../src/{ => Indirect}/FuryFit.cpp | 2 +- .../src/{ => Indirect}/IDATab.cpp | 2 +- .../src/{ => Indirect}/IndirectBayes.cpp | 10 +- .../src/{ => Indirect}/IndirectBayesTab.cpp | 2 +- .../{ => Indirect}/IndirectCalibration.cpp | 2 +- .../IndirectConvertToEnergy.cpp | 2 +- .../{ => Indirect}/IndirectDataAnalysis.cpp | 16 +- .../{ => Indirect}/IndirectDataReduction.cpp | 16 +- .../IndirectDataReductionTab.cpp | 2 +- .../{ => Indirect}/IndirectDiagnostics.cpp | 2 +- .../IndirectDiffractionReduction.cpp | 2 +- .../src/{ => Indirect}/IndirectLoadILL.cpp | 2 +- .../src/{ => Indirect}/IndirectMolDyn.cpp | 2 +- .../src/{ => Indirect}/IndirectMoments.cpp | 2 +- .../src/{ => Indirect}/IndirectSassena.cpp | 2 +- .../src/{ => Indirect}/IndirectSimulation.cpp | 6 +- .../{ => Indirect}/IndirectSimulationTab.cpp | 2 +- .../src/{ => Indirect}/IndirectSqw.cpp | 2 +- .../src/{ => Indirect}/IndirectSymmetrise.cpp | 2 +- .../src/{ => Indirect}/IndirectTab.cpp | 2 +- .../src/{ => Indirect}/IndirectTools.cpp | 6 +- .../src/{ => Indirect}/IndirectToolsTab.cpp | 2 +- .../{ => Indirect}/IndirectTransmission.cpp | 2 +- .../IndirectTransmissionCalc.cpp | 2 +- .../src/{ => Indirect}/JumpFit.cpp | 2 +- .../src/{ => Indirect}/MSDFit.cpp | 2 +- .../src/{ => Indirect}/Quasi.cpp | 2 +- .../src/{ => Indirect}/ResNorm.cpp | 2 +- .../src/{ => Indirect}/Stretch.cpp | 2 +- 83 files changed, 205 insertions(+), 205 deletions(-) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/ApplyCorr.h (96%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/CalcCorr.h (94%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/ConvFit.h (97%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/Elwin.h (95%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/Fury.h (95%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/FuryFit.h (97%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IDATab.h (96%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectBayes.h (98%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectBayes.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectBayesTab.h (98%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectCalibration.h (97%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectConvertToEnergy.h (98%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDataAnalysis.h (98%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDataAnalysis.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDataReduction.h (98%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDataReduction.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDataReductionTab.h (96%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDiagnostics.h (97%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDiffractionReduction.h (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectDiffractionReduction.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectLoadILL.h (94%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectLoadILL.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectMolDyn.h (92%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectMolDyn.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectMoments.h (97%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectSassena.h (93%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectSassena.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectSimulation.h (98%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectSimulation.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectSimulationTab.h (97%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectSqw.h (96%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectSymmetrise.h (97%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectTab.h (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectTools.h (98%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectTools.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectToolsTab.h (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectTransmission.h (96%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectTransmissionCalc.h (95%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/IndirectTransmissionCalc.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/JumpFit.h (96%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/JumpFit.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/MSDFit.h (95%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/Quasi.h (96%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/Quasi.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/ResNorm.h (95%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/ResNorm.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/Stretch.h (95%) rename Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/{ => Indirect}/Stretch.ui (100%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/ApplyCorr.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/CalcCorr.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/ConvFit.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/Elwin.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/Fury.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/FuryFit.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IDATab.cpp (98%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectBayes.cpp (93%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectBayesTab.cpp (98%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectCalibration.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectConvertToEnergy.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectDataAnalysis.cpp (92%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectDataReduction.cpp (96%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectDataReductionTab.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectDiagnostics.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectDiffractionReduction.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectLoadILL.cpp (98%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectMolDyn.cpp (98%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectMoments.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectSassena.cpp (98%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectSimulation.cpp (95%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectSimulationTab.cpp (92%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectSqw.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectSymmetrise.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectTab.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectTools.cpp (95%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectToolsTab.cpp (94%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectTransmission.cpp (98%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/IndirectTransmissionCalc.cpp (98%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/JumpFit.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/MSDFit.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/Quasi.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/ResNorm.cpp (99%) rename Code/Mantid/MantidQt/CustomInterfaces/src/{ => Indirect}/Stretch.cpp (99%) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt index 049063234c6d..939d62cb6129 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt @@ -1,37 +1,37 @@ set ( SRC_FILES - src/ApplyCorr.cpp - src/CalcCorr.cpp - src/ConvFit.cpp + src/Indirect/ApplyCorr.cpp + src/Indirect/CalcCorr.cpp + src/Indirect/ConvFit.cpp src/DirectConvertToEnergy.cpp - src/Elwin.cpp - src/Fury.cpp - src/FuryFit.cpp + src/Indirect/Elwin.cpp + src/Indirect/Fury.cpp + src/Indirect/FuryFit.cpp src/Homer.cpp - src/IDATab.cpp - src/IndirectBayes.cpp - src/IndirectBayesTab.cpp - src/IndirectCalibration.cpp - src/IndirectConvertToEnergy.cpp - src/IndirectDataAnalysis.cpp - src/IndirectDataReduction.cpp - src/IndirectDataReductionTab.cpp - src/IndirectDiagnostics.cpp - src/IndirectDiffractionReduction.cpp - src/IndirectLoadILL.cpp - src/IndirectMolDyn.cpp - src/IndirectMoments.cpp - src/IndirectSassena.cpp - src/IndirectSimulation.cpp - src/IndirectSimulationTab.cpp - src/IndirectSqw.cpp - src/IndirectSymmetrise.cpp - src/IndirectTab.cpp - src/IndirectTools.cpp - src/IndirectToolsTab.cpp - src/IndirectTransmission.cpp - src/IndirectTransmissionCalc.cpp - src/JumpFit.cpp - src/MSDFit.cpp + src/Indirect/IDATab.cpp + src/Indirect/IndirectBayes.cpp + src/Indirect/IndirectBayesTab.cpp + src/Indirect/IndirectCalibration.cpp + src/Indirect/IndirectConvertToEnergy.cpp + src/Indirect/IndirectDataAnalysis.cpp + src/Indirect/IndirectDataReduction.cpp + src/Indirect/IndirectDataReductionTab.cpp + src/Indirect/IndirectDiagnostics.cpp + src/Indirect/IndirectDiffractionReduction.cpp + src/Indirect/IndirectLoadILL.cpp + src/Indirect/IndirectMolDyn.cpp + src/Indirect/IndirectMoments.cpp + src/Indirect/IndirectSassena.cpp + src/Indirect/IndirectSimulation.cpp + src/Indirect/IndirectSimulationTab.cpp + src/Indirect/IndirectSqw.cpp + src/Indirect/IndirectSymmetrise.cpp + src/Indirect/IndirectTab.cpp + src/Indirect/IndirectTools.cpp + src/Indirect/IndirectToolsTab.cpp + src/Indirect/IndirectTransmission.cpp + src/Indirect/IndirectTransmissionCalc.cpp + src/Indirect/JumpFit.cpp + src/Indirect/MSDFit.cpp src/MantidEV.cpp src/MantidEVWorker.cpp src/MultiDatasetFit.cpp @@ -54,19 +54,19 @@ set ( SRC_FILES src/QReflTableModel.cpp src/QtReflMainView.cpp src/QtReflOptionsDialog.cpp - src/Quasi.cpp + src/Indirect/Quasi.cpp src/ReflCatalogSearcher.cpp src/ReflLegacyTransferStrategy.cpp src/ReflMainViewPresenter.cpp src/ReflSearchModel.cpp - src/ResNorm.cpp + src/Indirect/ResNorm.cpp src/SANSAddFiles.cpp src/SANSDiagnostics.cpp src/SANSEventSlicing.cpp src/SANSPlotSpecial.cpp src/SANSRunWindow.cpp src/StepScan.cpp - src/Stretch.cpp + src/Indirect/Stretch.cpp src/UserInputValidator.cpp src/background.cpp src/deltaECalc.cpp @@ -74,43 +74,43 @@ set ( SRC_FILES # Include files aren't required, but this makes them appear in Visual Studio set ( INC_FILES - inc/MantidQtCustomInterfaces/ApplyCorr.h + inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h inc/MantidQtCustomInterfaces/Background.h - inc/MantidQtCustomInterfaces/CalcCorr.h - inc/MantidQtCustomInterfaces/ConvFit.h + inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h + inc/MantidQtCustomInterfaces/Indirect/ConvFit.h inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h inc/MantidQtCustomInterfaces/DllConfig.h - inc/MantidQtCustomInterfaces/Elwin.h - inc/MantidQtCustomInterfaces/Fury.h - inc/MantidQtCustomInterfaces/FuryFit.h + inc/MantidQtCustomInterfaces/Indirect/Elwin.h + inc/MantidQtCustomInterfaces/Indirect/Fury.h + inc/MantidQtCustomInterfaces/Indirect/FuryFit.h inc/MantidQtCustomInterfaces/Homer.h - inc/MantidQtCustomInterfaces/IDATab.h - inc/MantidQtCustomInterfaces/IndirectBayes.h - inc/MantidQtCustomInterfaces/IndirectBayesTab.h - inc/MantidQtCustomInterfaces/IndirectCalibration.h - inc/MantidQtCustomInterfaces/IndirectConvertToEnergy.h - inc/MantidQtCustomInterfaces/IndirectDataAnalysis.h - inc/MantidQtCustomInterfaces/IndirectDataReduction.h - inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h - inc/MantidQtCustomInterfaces/IndirectDiagnostics.h - inc/MantidQtCustomInterfaces/IndirectDiffractionReduction.h - inc/MantidQtCustomInterfaces/IndirectLoadILL.h - inc/MantidQtCustomInterfaces/IndirectMolDyn.h - inc/MantidQtCustomInterfaces/IndirectMoments.h - inc/MantidQtCustomInterfaces/IndirectSassena.h - inc/MantidQtCustomInterfaces/IndirectSimulation.h - inc/MantidQtCustomInterfaces/IndirectSimulationTab.h - inc/MantidQtCustomInterfaces/IndirectSqw.h - inc/MantidQtCustomInterfaces/IndirectSymmetrise.h - inc/MantidQtCustomInterfaces/IndirectTransmission.h - inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.h - inc/MantidQtCustomInterfaces/IndirectTools.h - inc/MantidQtCustomInterfaces/IndirectToolsTab.h - inc/MantidQtCustomInterfaces/IndirectTab.h + inc/MantidQtCustomInterfaces/Indirect/IDATab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.h + inc/MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h + inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.h + inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.h + inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.h + inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSimulationTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTools.h + inc/MantidQtCustomInterfaces/Indirect/IndirectToolsTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h inc/MantidQtCustomInterfaces/IReflPresenter.h inc/MantidQtCustomInterfaces/IReflSearcher.h - inc/MantidQtCustomInterfaces/JumpFit.h - inc/MantidQtCustomInterfaces/MSDFit.h + inc/MantidQtCustomInterfaces/Indirect/JumpFit.h + inc/MantidQtCustomInterfaces/Indirect/MSDFit.h inc/MantidQtCustomInterfaces/MantidEV.h inc/MantidQtCustomInterfaces/MantidEVWorker.h inc/MantidQtCustomInterfaces/MultiDatasetFit.h @@ -144,15 +144,15 @@ set ( INC_FILES inc/MantidQtCustomInterfaces/QReflTableModel.h inc/MantidQtCustomInterfaces/QtReflMainView.h inc/MantidQtCustomInterfaces/QtReflOptionsDialog.h - inc/MantidQtCustomInterfaces/Quasi.h - inc/MantidQtCustomInterfaces/ResNorm.h + inc/MantidQtCustomInterfaces/Indirect/Quasi.h + inc/MantidQtCustomInterfaces/Indirect/ResNorm.h inc/MantidQtCustomInterfaces/SANSAddFiles.h inc/MantidQtCustomInterfaces/SANSDiagnostics.h inc/MantidQtCustomInterfaces/SANSEventSlicing.h inc/MantidQtCustomInterfaces/SANSPlotSpecial.h inc/MantidQtCustomInterfaces/SANSRunWindow.h inc/MantidQtCustomInterfaces/StepScan.h - inc/MantidQtCustomInterfaces/Stretch.h + inc/MantidQtCustomInterfaces/Indirect/Stretch.h inc/MantidQtCustomInterfaces/Updateable.h inc/MantidQtCustomInterfaces/UserInputValidator.h inc/MantidQtCustomInterfaces/deltaECalc.h @@ -161,39 +161,39 @@ set ( INC_FILES set ( SRC_UNITY_IGNORE_FILES ) set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h - inc/MantidQtCustomInterfaces/ApplyCorr.h - inc/MantidQtCustomInterfaces/CalcCorr.h - inc/MantidQtCustomInterfaces/ConvFit.h + inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h + inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h + inc/MantidQtCustomInterfaces/Indirect/ConvFit.h inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h - inc/MantidQtCustomInterfaces/Elwin.h - inc/MantidQtCustomInterfaces/Fury.h - inc/MantidQtCustomInterfaces/FuryFit.h + inc/MantidQtCustomInterfaces/Indirect/Elwin.h + inc/MantidQtCustomInterfaces/Indirect/Fury.h + inc/MantidQtCustomInterfaces/Indirect/FuryFit.h inc/MantidQtCustomInterfaces/Homer.h - inc/MantidQtCustomInterfaces/IDATab.h - inc/MantidQtCustomInterfaces/IndirectBayes.h - inc/MantidQtCustomInterfaces/IndirectBayesTab.h - inc/MantidQtCustomInterfaces/IndirectCalibration.h - inc/MantidQtCustomInterfaces/IndirectConvertToEnergy.h - inc/MantidQtCustomInterfaces/IndirectDataAnalysis.h - inc/MantidQtCustomInterfaces/IndirectDataReduction.h - inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h - inc/MantidQtCustomInterfaces/IndirectDiagnostics.h - inc/MantidQtCustomInterfaces/IndirectDiffractionReduction.h - inc/MantidQtCustomInterfaces/IndirectLoadILL.h - inc/MantidQtCustomInterfaces/IndirectMolDyn.h - inc/MantidQtCustomInterfaces/IndirectMoments.h - inc/MantidQtCustomInterfaces/IndirectSassena.h - inc/MantidQtCustomInterfaces/IndirectSimulation.h - inc/MantidQtCustomInterfaces/IndirectSimulationTab.h - inc/MantidQtCustomInterfaces/IndirectSqw.h - inc/MantidQtCustomInterfaces/IndirectSymmetrise.h - inc/MantidQtCustomInterfaces/IndirectTransmission.h - inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.h - inc/MantidQtCustomInterfaces/IndirectTools.h - inc/MantidQtCustomInterfaces/IndirectToolsTab.h - inc/MantidQtCustomInterfaces/IndirectTab.h - inc/MantidQtCustomInterfaces/JumpFit.h - inc/MantidQtCustomInterfaces/MSDFit.h + inc/MantidQtCustomInterfaces/Indirect/IDATab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.h + inc/MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h + inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h + inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.h + inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.h + inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.h + inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSimulationTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h + inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTools.h + inc/MantidQtCustomInterfaces/Indirect/IndirectToolsTab.h + inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h + inc/MantidQtCustomInterfaces/Indirect/JumpFit.h + inc/MantidQtCustomInterfaces/Indirect/MSDFit.h inc/MantidQtCustomInterfaces/MultiDatasetFit.h inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingPresenter.h inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h @@ -214,46 +214,46 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h inc/MantidQtCustomInterfaces/QReflTableModel.h inc/MantidQtCustomInterfaces/QtReflMainView.h inc/MantidQtCustomInterfaces/QtReflOptionsDialog.h - inc/MantidQtCustomInterfaces/Quasi.h - inc/MantidQtCustomInterfaces/ResNorm.h + inc/MantidQtCustomInterfaces/Indirect/Quasi.h + inc/MantidQtCustomInterfaces/Indirect/ResNorm.h inc/MantidQtCustomInterfaces/SANSAddFiles.h inc/MantidQtCustomInterfaces/SANSPlotSpecial.h inc/MantidQtCustomInterfaces/SANSRunWindow.h inc/MantidQtCustomInterfaces/SANSEventSlicing.h inc/MantidQtCustomInterfaces/SANSDiagnostics.h - inc/MantidQtCustomInterfaces/Stretch.h + inc/MantidQtCustomInterfaces/Indirect/Stretch.h inc/MantidQtCustomInterfaces/MantidEV.h inc/MantidQtCustomInterfaces/StepScan.h ) set ( UI_FILES inc/MantidQtCustomInterfaces/AddWorkspace.ui inc/MantidQtCustomInterfaces/DirectConvertToEnergy.ui - inc/MantidQtCustomInterfaces/IndirectBayes.ui - inc/MantidQtCustomInterfaces/IndirectDataAnalysis.ui - inc/MantidQtCustomInterfaces/IndirectDataReduction.ui - inc/MantidQtCustomInterfaces/IndirectDiffractionReduction.ui - inc/MantidQtCustomInterfaces/IndirectLoadILL.ui - inc/MantidQtCustomInterfaces/IndirectMolDyn.ui - inc/MantidQtCustomInterfaces/IndirectSassena.ui - inc/MantidQtCustomInterfaces/IndirectSimulation.ui - inc/MantidQtCustomInterfaces/IndirectTools.ui - inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui - inc/MantidQtCustomInterfaces/JumpFit.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectTools.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.ui + inc/MantidQtCustomInterfaces/Indirect/JumpFit.ui inc/MantidQtCustomInterfaces/MultiDatasetFit.ui inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.ui inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui inc/MantidQtCustomInterfaces/Muon/ALCInterface.ui inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.ui inc/MantidQtCustomInterfaces/Muon/MuonAnalysis.ui - inc/MantidQtCustomInterfaces/Quasi.ui + inc/MantidQtCustomInterfaces/Indirect/Quasi.ui inc/MantidQtCustomInterfaces/ReflMainWidget.ui inc/MantidQtCustomInterfaces/ReflOptionsDialog.ui inc/MantidQtCustomInterfaces/ReflWindow.ui - inc/MantidQtCustomInterfaces/ResNorm.ui + inc/MantidQtCustomInterfaces/Indirect/ResNorm.ui inc/MantidQtCustomInterfaces/SANSPlotSpecial.ui inc/MantidQtCustomInterfaces/SANSRunWindow.ui inc/MantidQtCustomInterfaces/SANSEventSlicing.ui - inc/MantidQtCustomInterfaces/Stretch.ui + inc/MantidQtCustomInterfaces/Indirect/Stretch.ui inc/MantidQtCustomInterfaces/MantidEV.ui inc/MantidQtCustomInterfaces/StepScan.ui inc/MantidQtCustomInterfaces/EditLocalParameterDialog.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ApplyCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ApplyCorr.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h index 8549dfa10175..1a6f5ed49a67 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ApplyCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACESIDA_APPLYCORR_H_ #include "MantidAPI/MatrixWorkspace.h" -#include "MantidQtCustomInterfaces/IDATab.h" +#include "IDATab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/CalcCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h similarity index 94% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/CalcCorr.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h index 1c56fd8fefcc..9845fa67d11b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/CalcCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_CALCCORR_H_ #define MANTIDQTCUSTOMINTERFACESIDA_CALCCORR_H_ -#include "MantidQtCustomInterfaces/IDATab.h" +#include "IDATab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ConvFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.h similarity index 97% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ConvFit.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.h index 7a3b8fe60abf..c396eae1bee0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ConvFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_CONVFIT_H_ #define MANTIDQTCUSTOMINTERFACESIDA_CONVFIT_H_ -#include "MantidQtCustomInterfaces/IDATab.h" +#include "IDATab.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/CompositeFunction.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Elwin.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.h similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Elwin.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.h index b3e70b9750ed..7e860508075e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Elwin.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACESIDA_ELWIN_H_ #include "MantidAPI/MatrixWorkspace.h" -#include "MantidQtCustomInterfaces/IDATab.h" +#include "MantidQtCustomInterfaces/Indirect/IDATab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Fury.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.h similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Fury.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.h index eb63d5f60663..3de4cc766740 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Fury.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_FURY_H_ #define MANTIDQTCUSTOMINTERFACESIDA_FURY_H_ -#include "MantidQtCustomInterfaces/IDATab.h" +#include "IDATab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/FuryFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.h similarity index 97% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/FuryFit.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.h index 2d30bde7ff6c..c11edb0f0cba 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/FuryFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_FURYFIT_H_ #define MANTIDQTCUSTOMINTERFACESIDA_FURYFIT_H_ -#include "MantidQtCustomInterfaces/IDATab.h" +#include "IDATab.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/MatrixWorkspace.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IDATab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IDATab.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h index 0370f251f717..3349a0d61683 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IDATab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h @@ -3,8 +3,8 @@ #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidQtCustomInterfaces/IndirectDataAnalysis.h" -#include "MantidQtCustomInterfaces/IndirectTab.h" +#include "IndirectDataAnalysis.h" +#include "IndirectTab.h" class QwtPlotCurve; class QwtPlot; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.h similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.h index 149be80b7199..83cdc666b5da 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.h @@ -6,7 +6,7 @@ //---------------------- #include "ui_IndirectBayes.h" #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectBayesTab.h" +#include "IndirectBayesTab.h" #include #include "MantidKernel/ConfigService.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayes.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h index 3f073e758bbd..b0e55dd30fd0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h @@ -2,7 +2,7 @@ #define MANTID_CUSTOMINTERFACES_INDIRECTBAYESTAB_H_ #include "MantidAPI/MatrixWorkspace.h" -#include "MantidQtCustomInterfaces/IndirectTab.h" +#include "IndirectTab.h" #include "MantidQtMantidWidgets/RangeSelector.h" #include "MantidQtAPI/AlgorithmRunner.h" #include "MantidQtAPI/QwtWorkspaceSpectrumData.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectCalibration.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h similarity index 97% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectCalibration.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h index 694965155797..c14ec0a22ba8 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectCalibration.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACES_INDIRECTCALIBRATION_H_ #define MANTIDQTCUSTOMINTERFACES_INDIRECTCALIBRATION_H_ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include "MantidKernel/System.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectConvertToEnergy.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectConvertToEnergy.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h index e09ab59bc350..5c430ced51fb 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectConvertToEnergy.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACES_INDIRECTCONVERTTOENERGY_H_ #define MANTIDQTCUSTOMINTERFACES_INDIRECTCONVERTTOENERGY_H_ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include "MantidKernel/System.h" #include "MantidQtCustomInterfaces/Background.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataAnalysis.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataAnalysis.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h index c1d283acdeaa..c7233144d7e0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataAnalysis.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h @@ -6,7 +6,7 @@ //---------------------- #include "ui_IndirectDataAnalysis.h" #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectTab.h" +#include "IndirectTab.h" #include #include "MantidKernel/ConfigService.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataAnalysis.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataAnalysis.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h index 79eb954a858f..0f3219bbbe12 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h @@ -8,7 +8,7 @@ #include "MantidQtAPI/AlgorithmRunner.h" #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h index 10079fcd9290..bd9af5f20f5c 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h @@ -8,8 +8,8 @@ #include "MantidQtAPI/BatchAlgorithmRunner.h" #include "MantidQtAPI/PythonRunner.h" #include "MantidQtAPI/QwtWorkspaceSpectrumData.h" -#include "MantidQtCustomInterfaces/IndirectDataReduction.h" -#include "MantidQtCustomInterfaces/IndirectTab.h" +#include "IndirectDataReduction.h" +#include "IndirectTab.h" #include "MantidQtMantidWidgets/RangeSelector.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDiagnostics.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h similarity index 97% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDiagnostics.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h index c58d8f69300e..72b6dcc0609f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDiagnostics.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACES_INDIRECTDIAGNOSTICS_H_ #define MANTIDQTCUSTOMINTERFACES_INDIRECTDIAGNOSTICS_H_ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/System.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDiffractionReduction.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.h similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDiffractionReduction.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.h diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDiffractionReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDiffractionReduction.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.h similarity index 94% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.h index a29fcea2d348..9fed1e099c0f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_INDIRECTLOADILL_H_ #include "ui_IndirectLoadILL.h" -#include "MantidQtCustomInterfaces/IndirectToolsTab.h" +#include "IndirectToolsTab.h" #include "MantidAPI/ExperimentInfo.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectLoadILL.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.h similarity index 92% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.h index 000c1a164acd..49641a23e471 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_INDIRECTMOLDYN_H_ #include "ui_IndirectMolDyn.h" -#include "MantidQtCustomInterfaces/IndirectSimulationTab.h" +#include "IndirectSimulationTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMolDyn.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMoments.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h similarity index 97% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMoments.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h index c28b5cb44ac6..8e6ce70f3278 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectMoments.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h @@ -1,7 +1,7 @@ #ifndef MANTID_CUSTOMINTERFACES_INDIRECTMOMENTS_H_ #define MANTID_CUSTOMINTERFACES_INDIRECTMOMENTS_H_ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include "MantidKernel/System.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.h similarity index 93% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.h index dc373046b05a..25837e522d68 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_INDIRECTSASSENA_H_ #include "ui_IndirectSassena.h" -#include "MantidQtCustomInterfaces/IndirectSimulationTab.h" +#include "IndirectSimulationTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSassena.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h index 5ac204d0b15e..b41d06333333 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h @@ -7,7 +7,7 @@ #include "ui_IndirectSimulation.h" #include "MantidKernel/ConfigService.h" #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectSimulationTab.h" +#include "IndirectSimulationTab.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulation.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulationTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulationTab.h similarity index 97% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulationTab.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulationTab.h index 5b29466890c7..d2a1c1d51c26 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSimulationTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulationTab.h @@ -4,7 +4,7 @@ #include "MantidAPI/AlgorithmManager.h" #include "MantidKernel/System.h" #include "MantidQtAPI/AlgorithmRunner.h" -#include "MantidQtCustomInterfaces/IndirectTab.h" +#include "IndirectTab.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSqw.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSqw.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h index 8185f93f6191..c8a730e7479a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSqw.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACES_INDIRECTSQW_H_ #define MANTIDQTCUSTOMINTERFACES_INDIRECTSQW_H_ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include "MantidKernel/System.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSymmetrise.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h similarity index 97% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSymmetrise.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h index 2951a409215f..c391d8f3806d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectSymmetrise.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACES_INDIRECTSYMMETRISE_H_ #define MANTIDQTCUSTOMINTERFACES_INDIRECTSYMMETRISE_H_ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/System.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTab.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTools.h similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTools.h index 7acf833d1efc..664ce3f1c272 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTools.h @@ -7,7 +7,7 @@ #include "ui_IndirectTools.h" #include "MantidKernel/ConfigService.h" #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectToolsTab.h" +#include "IndirectToolsTab.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTools.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTools.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTools.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectToolsTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectToolsTab.h similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectToolsTab.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectToolsTab.h diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmission.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmission.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h index f0b69a709584..bc57dc29e72f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmission.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h @@ -1,7 +1,7 @@ #ifndef MANTID_CUSTOMINTERFACES_INDIRECTTRANSMISSION_H_ #define MANTID_CUSTOMINTERFACES_INDIRECTTRANSMISSION_H_ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "IndirectDataReductionTab.h" #include "MantidKernel/System.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.h similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.h index c1b2b31011c8..a52722639af2 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_INDIRECTTRANSMISSIONCALC_H_ #include "ui_IndirectTransmissionCalc.h" -#include "MantidQtCustomInterfaces/IndirectToolsTab.h" +#include "IndirectToolsTab.h" #include "MantidAPI/ExperimentInfo.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTransmissionCalc.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/JumpFit.h similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/JumpFit.h index fbde3aabb082..3f2b97506573 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/JumpFit.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_JUMPFIT_H_ #include "ui_JumpFit.h" -#include "MantidQtCustomInterfaces/IndirectBayesTab.h" +#include "IndirectBayesTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/JumpFit.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/JumpFit.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MSDFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.h similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MSDFit.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.h index fd0951849eee..bd23d836b3d4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MSDFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_MSDFIT_H_ #define MANTIDQTCUSTOMINTERFACESIDA_MSDFIT_H_ -#include "MantidQtCustomInterfaces/IDATab.h" +#include "IDATab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Quasi.h similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Quasi.h index d7cd02ab6dc3..df94ec39c20a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Quasi.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_QUASI_H_ #include "ui_Quasi.h" -#include "MantidQtCustomInterfaces/IndirectBayesTab.h" +#include "IndirectBayesTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Quasi.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Quasi.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ResNorm.h similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ResNorm.h index 66c0f03b7a16..1377de73f023 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ResNorm.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_RESNORM_H_ #include "ui_ResNorm.h" -#include "MantidQtCustomInterfaces/IndirectBayesTab.h" +#include "IndirectBayesTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ResNorm.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ResNorm.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Stretch.h similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.h rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Stretch.h index b35d2dec4adf..6fbfdaea0c33 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Stretch.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_STRETCH_H_ #include "ui_Stretch.h" -#include "MantidQtCustomInterfaces/IndirectBayesTab.h" +#include "IndirectBayesTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Stretch.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.ui rename to Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Stretch.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp index 3b7de751945c..138fe1c3e9d9 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/ApplyCorr.h" +#include "MantidQtCustomInterfaces/Indirect/ApplyCorr.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/TextAxis.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/CalcCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/CalcCorr.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp index 325451b7e798..ea58f2f06cb1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/CalcCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp @@ -1,5 +1,5 @@ #include "MantidAPI/AnalysisDataService.h" -#include "MantidQtCustomInterfaces/CalcCorr.h" +#include "MantidQtCustomInterfaces/Indirect/CalcCorr.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidQtMantidWidgets/WorkspaceSelector.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp index 81a70982483f..897185cd9abc 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/ConvFit.h" +#include "MantidQtCustomInterfaces/Indirect/ConvFit.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidQtMantidWidgets/RangeSelector.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Elwin.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/Elwin.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp index 919f78b05490..ac1443964f09 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Elwin.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/Elwin.h" +#include "MantidQtCustomInterfaces/Indirect/Elwin.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidQtMantidWidgets/RangeSelector.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Fury.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/Fury.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp index 8ae8c8e68187..6598db8fc9d4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Fury.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/Fury.h" +#include "MantidQtCustomInterfaces/Indirect/Fury.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidQtMantidWidgets/RangeSelector.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/FuryFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/FuryFit.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp index 6fab6fc6d2f6..d9e3a568d019 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/FuryFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/FuryFit.h" +#include "MantidQtCustomInterfaces/Indirect/FuryFit.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidQtMantidWidgets/RangeSelector.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IDATab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IDATab.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp index 587c2921c733..225408fc783d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IDATab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IDATab.h" +#include "MantidQtCustomInterfaces/Indirect/IDATab.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/AnalysisDataService.h" #include "boost/shared_ptr.hpp" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayes.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp similarity index 93% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayes.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp index 49db0e54f64a..2460528a5828 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayes.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp @@ -1,9 +1,9 @@ #include "MantidQtAPI/ManageUserDirectories.h" -#include "MantidQtCustomInterfaces/IndirectBayes.h" -#include "MantidQtCustomInterfaces/JumpFit.h" -#include "MantidQtCustomInterfaces/Quasi.h" -#include "MantidQtCustomInterfaces/ResNorm.h" -#include "MantidQtCustomInterfaces/Stretch.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectBayes.h" +#include "MantidQtCustomInterfaces/Indirect/JumpFit.h" +#include "MantidQtCustomInterfaces/Indirect/Quasi.h" +#include "MantidQtCustomInterfaces/Indirect/ResNorm.h" +#include "MantidQtCustomInterfaces/Indirect/Stretch.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayesTab.cpp similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayesTab.cpp index 6ce219f719e2..c87d289b062b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayesTab.cpp @@ -2,7 +2,7 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidQtAPI/QwtWorkspaceSpectrumData.h" #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectBayesTab.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h" using MantidQt::MantidWidgets::RangeSelector; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectCalibration.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectCalibration.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp index 498b5fbc8617..c67673eb9a51 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectCalibration.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectCalibration.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectCalibration.h" #include "MantidKernel/Logger.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectConvertToEnergy.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp index 15d765f96f8d..e55a58c742bf 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectConvertToEnergy.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h" #include "MantidQtCustomInterfaces/Background.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataAnalysis.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp similarity index 92% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataAnalysis.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp index 6ca177b45362..c8debe579969 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataAnalysis.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp @@ -1,16 +1,16 @@ //---------------------- // Includes //---------------------- -#include "MantidQtCustomInterfaces/IndirectDataAnalysis.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h" // IDATab subclasses: -#include "MantidQtCustomInterfaces/Elwin.h" -#include "MantidQtCustomInterfaces/MSDFit.h" -#include "MantidQtCustomInterfaces/Fury.h" -#include "MantidQtCustomInterfaces/FuryFit.h" -#include "MantidQtCustomInterfaces/ConvFit.h" -#include "MantidQtCustomInterfaces/CalcCorr.h" -#include "MantidQtCustomInterfaces/ApplyCorr.h" +#include "MantidQtCustomInterfaces/Indirect/Elwin.h" +#include "MantidQtCustomInterfaces/Indirect/MSDFit.h" +#include "MantidQtCustomInterfaces/Indirect/Fury.h" +#include "MantidQtCustomInterfaces/Indirect/FuryFit.h" +#include "MantidQtCustomInterfaces/Indirect/ConvFit.h" +#include "MantidQtCustomInterfaces/Indirect/CalcCorr.h" +#include "MantidQtCustomInterfaces/Indirect/ApplyCorr.h" #include "MantidQtAPI/ManageUserDirectories.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp similarity index 96% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp index a77827f97c32..bc53306820a8 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp @@ -1,20 +1,20 @@ //---------------------- // Includes //---------------------- -#include "MantidQtCustomInterfaces/IndirectDataReduction.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/ExperimentInfo.h" #include "MantidKernel/ConfigService.h" #include "MantidQtAPI/ManageUserDirectories.h" -#include "MantidQtCustomInterfaces/IndirectCalibration.h" -#include "MantidQtCustomInterfaces/IndirectConvertToEnergy.h" -#include "MantidQtCustomInterfaces/IndirectDiagnostics.h" -#include "MantidQtCustomInterfaces/IndirectMoments.h" -#include "MantidQtCustomInterfaces/IndirectSqw.h" -#include "MantidQtCustomInterfaces/IndirectSymmetrise.h" -#include "MantidQtCustomInterfaces/IndirectTransmission.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectCalibration.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectMoments.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSqw.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectTransmission.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReductionTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReductionTab.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp index b2013ec7468b..714864136dcb 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReductionTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectDataReductionTab.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidKernel/Logger.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiagnostics.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiagnostics.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp index f67c7e3a023f..308bed8c099c 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiagnostics.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectDiagnostics.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/Logger.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiffractionReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiffractionReduction.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp index db1faf3e8103..c78a88e67c7c 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiffractionReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp @@ -1,7 +1,7 @@ //---------------------- // Includes //---------------------- -#include "MantidQtCustomInterfaces/IndirectDiffractionReduction.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.h" #include "MantidQtAPI/ManageUserDirectories.h" #include "MantidAPI/AlgorithmManager.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectLoadILL.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectLoadILL.cpp similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectLoadILL.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectLoadILL.cpp index 65692fbe9d41..a0a004f611a5 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectLoadILL.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectLoadILL.cpp @@ -3,7 +3,7 @@ #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/FacilityInfo.h" -#include "MantidQtCustomInterfaces/IndirectLoadILL.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectLoadILL.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMolDyn.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMolDyn.cpp similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMolDyn.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMolDyn.cpp index ed3b97c72d12..53d90a12c739 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMolDyn.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMolDyn.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectMolDyn.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectMolDyn.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMoments.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMoments.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp index 3c485433864a..75ddd23b90f4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMoments.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectMoments.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectMoments.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSassena.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSassena.cpp similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSassena.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSassena.cpp index 457718358c6e..ad7c83269025 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSassena.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSassena.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectSassena.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSassena.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulation.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulation.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp index 649cdfa022b9..17386eaa3a0e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulation.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp @@ -1,8 +1,8 @@ #include "MantidKernel/ConfigService.h" #include "MantidQtAPI/ManageUserDirectories.h" -#include "MantidQtCustomInterfaces/IndirectSimulation.h" -#include "MantidQtCustomInterfaces/IndirectMolDyn.h" -#include "MantidQtCustomInterfaces/IndirectSassena.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSimulation.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectMolDyn.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSassena.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulationTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulationTab.cpp similarity index 92% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulationTab.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulationTab.cpp index 47d7cef49b87..d0f2a7f11cd2 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSimulationTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulationTab.cpp @@ -1,5 +1,5 @@ #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectSimulationTab.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSimulationTab.h" using namespace Mantid::API; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSqw.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSqw.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp index 3003c32c3af8..71ee2abab166 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSqw.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectSqw.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSqw.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSymmetrise.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSymmetrise.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp index ce99f8dcb63d..0bbe9cad0859 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectSymmetrise.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectSymmetrise.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ITableWorkspace.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTab.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp index 8940d782fcfc..6e2d5109c05f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectTab.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectTab.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidKernel/Logger.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTools.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp similarity index 95% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTools.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp index 23729ba8c0c2..2b6fb85e5ae0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTools.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp @@ -1,8 +1,8 @@ #include "MantidKernel/ConfigService.h" #include "MantidQtAPI/ManageUserDirectories.h" -#include "MantidQtCustomInterfaces/IndirectTools.h" -#include "MantidQtCustomInterfaces/IndirectTransmissionCalc.h" -#include "MantidQtCustomInterfaces/IndirectLoadILL.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectTools.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectLoadILL.h" #include #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectToolsTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectToolsTab.cpp similarity index 94% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectToolsTab.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectToolsTab.cpp index 768f9aafa863..f1b1c0076480 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectToolsTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectToolsTab.cpp @@ -1,5 +1,5 @@ #include "MantidQtAPI/UserSubWindow.h" -#include "MantidQtCustomInterfaces/IndirectToolsTab.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectToolsTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTransmission.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTransmission.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp index 035353ab4c6c..c1d4683fad2f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTransmission.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/IndirectTransmission.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectTransmission.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTransmissionCalc.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmissionCalc.cpp similarity index 98% rename from Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTransmissionCalc.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmissionCalc.cpp index 1ff2c198a7f8..08b4c88e807c 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTransmissionCalc.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmissionCalc.cpp @@ -2,7 +2,7 @@ #include "MantidAPI/ExperimentInfo.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ITableWorkspace.h" -#include "MantidQtCustomInterfaces/IndirectTransmissionCalc.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/JumpFit.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/JumpFit.cpp index 240174dc14ce..6a093dcd26df 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/JumpFit.cpp @@ -1,7 +1,7 @@ #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/Run.h" #include "MantidAPI/TextAxis.h" -#include "MantidQtCustomInterfaces/JumpFit.h" +#include "MantidQtCustomInterfaces/Indirect/JumpFit.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp index 8ea5836e8c06..fda5bdef0cfc 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp @@ -1,6 +1,6 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceGroup.h" -#include "MantidQtCustomInterfaces/MSDFit.h" +#include "MantidQtCustomInterfaces/Indirect/MSDFit.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidQtMantidWidgets/RangeSelector.h" diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Quasi.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Quasi.cpp index a27a8d564b01..e70b4d3310fe 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Quasi.cpp @@ -1,5 +1,5 @@ #include "MantidAPI/TextAxis.h" -#include "MantidQtCustomInterfaces/Quasi.h" +#include "MantidQtCustomInterfaces/Indirect/Quasi.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" using namespace Mantid::API; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ResNorm.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ResNorm.cpp index 907609ff5ff3..a9ccfd47614b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ResNorm.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/ResNorm.h" +#include "MantidQtCustomInterfaces/Indirect/ResNorm.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" using namespace Mantid::API; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Stretch.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp rename to Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Stretch.cpp index 83f8217d2830..616c9ff85231 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Stretch.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/Stretch.h" +#include "MantidQtCustomInterfaces/Indirect/Stretch.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" namespace From 023701af544c3022fd9f1ec39d9dd5f4c278c4e4 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 15:18:01 +0000 Subject: [PATCH 057/130] Added empty new UI files Refs #10960 --- .../MantidQt/CustomInterfaces/CMakeLists.txt | 14 +++++++++++ .../Indirect/ApplyCorr.ui | 25 +++++++++++++++++++ .../Indirect/CalcCorr.ui | 25 +++++++++++++++++++ .../Indirect/ConvFit.ui | 25 +++++++++++++++++++ .../Indirect/Elwin.ui | 25 +++++++++++++++++++ .../MantidQtCustomInterfaces/Indirect/Fury.ui | 25 +++++++++++++++++++ .../Indirect/FuryFit.ui | 25 +++++++++++++++++++ .../Indirect/IndirectCalibration.ui | 25 +++++++++++++++++++ .../Indirect/IndirectConvertToEnergy.ui | 25 +++++++++++++++++++ .../Indirect/IndirectDiagnostics.ui | 25 +++++++++++++++++++ .../Indirect/IndirectMoments.ui | 25 +++++++++++++++++++ .../Indirect/IndirectSqw.ui | 25 +++++++++++++++++++ .../Indirect/IndirectSymmetrise.ui | 25 +++++++++++++++++++ .../Indirect/IndirectTransmission.ui | 25 +++++++++++++++++++ .../Indirect/MSDFit.ui | 25 +++++++++++++++++++ 15 files changed, 364 insertions(+) create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui create mode 100644 Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt index 939d62cb6129..76df5b4270da 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt @@ -228,17 +228,31 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h set ( UI_FILES inc/MantidQtCustomInterfaces/AddWorkspace.ui inc/MantidQtCustomInterfaces/DirectConvertToEnergy.ui + inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui + inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui + inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui + inc/MantidQtCustomInterfaces/Indirect/Elwin.ui + inc/MantidQtCustomInterfaces/Indirect/Fury.ui + inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui inc/MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.ui inc/MantidQtCustomInterfaces/Indirect/IndirectLoadILL.ui inc/MantidQtCustomInterfaces/Indirect/IndirectMolDyn.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui inc/MantidQtCustomInterfaces/Indirect/IndirectSassena.ui inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui inc/MantidQtCustomInterfaces/Indirect/IndirectTools.ui + inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.ui inc/MantidQtCustomInterfaces/Indirect/JumpFit.ui + inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui inc/MantidQtCustomInterfaces/MultiDatasetFit.ui inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.ui inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui new file mode 100644 index 000000000000..e598c5ba84b2 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui @@ -0,0 +1,25 @@ + + + ApplyCorr + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui new file mode 100644 index 000000000000..d6a3def8cab0 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui @@ -0,0 +1,25 @@ + + + CalcCorr + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui new file mode 100644 index 000000000000..f435f64f45a5 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui @@ -0,0 +1,25 @@ + + + ConvFit + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui new file mode 100644 index 000000000000..02f22acf97df --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui @@ -0,0 +1,25 @@ + + + Elwin + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui new file mode 100644 index 000000000000..93d95948eedf --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui @@ -0,0 +1,25 @@ + + + Fury + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui new file mode 100644 index 000000000000..bd96076a0074 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui @@ -0,0 +1,25 @@ + + + FuryFit + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui new file mode 100644 index 000000000000..228dc22242b5 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui @@ -0,0 +1,25 @@ + + + IndirectCalibration + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui new file mode 100644 index 000000000000..315446af3e89 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui @@ -0,0 +1,25 @@ + + + IndirectConvertToEnergy + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui new file mode 100644 index 000000000000..51fc2d787cc1 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui @@ -0,0 +1,25 @@ + + + IndirectDiagnostics + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui new file mode 100644 index 000000000000..ccd8114a8b7f --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui @@ -0,0 +1,25 @@ + + + IndirectMoments + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui new file mode 100644 index 000000000000..e70e85c12f45 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui @@ -0,0 +1,25 @@ + + + IndirectSqw + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui new file mode 100644 index 000000000000..c46f56a5ae01 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui @@ -0,0 +1,25 @@ + + + IndirectSymmetrise + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui new file mode 100644 index 000000000000..040c1ddb207d --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui @@ -0,0 +1,25 @@ + + + IndirectTransmission + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui new file mode 100644 index 000000000000..426636ce2bf2 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui @@ -0,0 +1,25 @@ + + + MSDFit + + + + 0 + 0 + 444 + 251 + + + + Form + + + + + + + + + + + From 84e21b16758bd7db98cbaa5aeb6026d86d41c1e8 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 16:22:09 +0000 Subject: [PATCH 058/130] Added refactored UI files for IDR Refs #10960 --- .../Indirect/IndirectCalibration.ui | 268 ++++- .../Indirect/IndirectConvertToEnergy.ui | 1007 ++++++++++++++++- .../Indirect/IndirectDiagnostics.ui | 189 +++- .../Indirect/IndirectMoments.ui | 237 +++- .../Indirect/IndirectSqw.ui | 517 ++++++++- .../Indirect/IndirectSymmetrise.ui | 149 ++- .../Indirect/IndirectTransmission.ui | 211 +++- 7 files changed, 2533 insertions(+), 45 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui index 228dc22242b5..468b236c1416 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui @@ -6,20 +6,274 @@ 0 0 - 444 - 251 + 423 + 339
Form - - + + + + + Input + + + + + + + + + 0 + 41 + + + + Run No + + + true + + + + + + + .raw + + + + + + + + Plot first detector spectra + + + Plot Raw + + + + + + + + + + + Scale by factor: + + + + + + + false + + + 999.990000000000009 + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + + Calibration + + + + + + + + + + + + + + + Resolution + + + + + + + + + + true + + + Scale RES: + + + + + + + Create RES file + + + Create RES File + + + + + + + Apply WienerSmooth algorithm to resolution + + + Smooth RES + + + + + + + false + + + 999.990000000000009 + + + + + + + + + + + + + + + + + Output + + + + + + Verbose + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot resulting calibration file when created. + + + Plot Result + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::MWRunFiles + QWidget +
mantidqt::mantidwidgets::mwrunfiles.h
+
- - - + + + ckResolutionScale + toggled(bool) + spResolutionScale + setEnabled(bool) + + + 69 + 252 + + + 169 + 253 + + + + + ckScale + toggled(bool) + spScale + setEnabled(bool) + + + 81 + 80 + + + 180 + 81 + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui index 315446af3e89..b294d5b0f330 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui @@ -6,20 +6,1013 @@ 0 0 - 444 - 251 + 601 + 532 Form - - + + + + + Input + + + + 0 + + + 0 + + + + + 0 + + + 0 + + + + + + + + + + + + 0 + 41 + + + + Run Files + + + true + + + + + + + false + + + + 0 + 41 + + + + false + + + Calibration File + + + false + + + true + + + + _calib.nxs + + + + + + + + + + + + Sum multiple files together. + + + Sum Files + + + + + + + Load Logs + + + + + + + Use calibration file to adjust for detector efficiency. + + + Use Calib File + + + + + + + + + + + 6 + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Grouping + + + cbMappingOptions + + + + + + + Select type of detector grouping to apply. + + + + Default + + + + + Individual + + + + + Groups + + + + + All + + + + + File + + + + + + + + 0 + + + 0 + + + + + + + + 0 + 41 + + + + false + + + + + + false + + + + + + + .map + + + + + + + + + + + + Number of Groups: + + + leNoGroups + + + + + + + Desired number of groups. + + + + + + + color: rgb(255, 0, 4) + + + * + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + Remove a range of background value. + + + Background Removal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot raw time values. + + + Plot Time + + + + + + + + + + + + + + + + Analysis + + + + QLayout::SetDefaultConstraint + + + 0 + + + + + Detailed Balance + + + + + + + Scale by factor: + + + + + + + false + + + K + + + 999.990000000000009 + + + 300.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + 99.989999999999995 + + + + + + + + + + Conversion to Energy Transfer + + + + 6 + + + + + Efixed value: + + + leEfixed + + + + + + + false + + + Value of Efixed for conversion from time to energy. + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Spectra Min: + + + + + + + 9999 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Spectra Max + + + + + + + 9999 + + + + + + + + + + Rebin (meV) + + + + 6 + + + 6 + + + + + 0 + + + + + Do not perform rebinning step on this data. + + + Rebin + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Rebin Steps: + + + + + + + + 0 + 0 + + + + + Single + + + + + Multiple + + + + + + + + 0 + + + + + 0 + + + 0 + + + + + 6 + + + 6 + + + + + Low + + + + + + + -999.990000000000009 + + + 999.990000000000009 + + + + + + + color: rgb(255, 0, 4) + + + * + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Width + + + + + + + -999.990000000000009 + + + 999.990000000000009 + + + + + + + color: rgb(255, 0, 4) + + + * + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + High + + + + + + + -999.990000000000009 + + + 999.990000000000009 + + + + + + + color: rgb(255, 0, 4) + + + * + + + + + + + + + + + 0 + + + 0 + + + + + Rebin String + + + + + + + + + + + + + + + + + + + Output + + + + 6 + + + 6 + + + 6 + + + 0 + + + + + + + Select Save Formats: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save file in SPE format. + + + SPE + + + false + + + + + + + Save file in Nexus format. + + + NeXus + + + + + + + NXSPE + + + + + + + ASCII + + + + + + + Aclimax + + + + + + + DaveGrp + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Plot Output: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + None + + + + + Spectra + + + + + Contour + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + If this box is unchecked and the raw files are determined to contain multiple frames, then the reduction process will end at the step where they would have been folded together. +Later steps in the process (saving, renaming) will not be done. + + + Fold Multiple Frames + + + true + + + + + + + Output in cm-1 + + + + + + + + + + + MantidQt::MantidWidgets::MWRunFiles + QWidget +
mantidqt::mantidwidgets::mwrunfiles.h
+
- - - + + + ckRebin + toggled(bool) + cbRebinType + setEnabled(bool) + + + 69 + 362 + + + 138 + 397 + + + + + ckRebin + toggled(bool) + leRebinString + setEnabled(bool) + + + 46 + 362 + + + 413 + 397 + + + + + cbRebinType + currentIndexChanged(int) + swRebin + setCurrentIndex(int) + + + 138 + 397 + + + 376 + 397 + + + + + ckScaleMultiplier + toggled(bool) + spScaleMultiplier + setEnabled(bool) + + + 432 + 244 + + + 527 + 245 + + + + + ckDetailedBalance + toggled(bool) + spDetailedBalance + setEnabled(bool) + + + 84 + 244 + + + 193 + 245 + + + + + ckRebin + toggled(bool) + spRebinLow + setEnabled(bool) + + + 46 + 371 + + + 256 + 406 + + + + + ckRebin + toggled(bool) + spRebinWidth + setEnabled(bool) + + + 46 + 371 + + + 392 + 406 + + + + + ckRebin + toggled(bool) + lbRebinHigh + setEnabled(bool) + + + 46 + 371 + + + 465 + 406 + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui index 51fc2d787cc1..85b8f54f644f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui @@ -6,20 +6,197 @@ 0 0 - 444 - 251 + 524 + 448 Form - - + + + + + Input + + + + + + + + + 0 + 41 + + + + true + + + Input Files + + + true + + + + .raw + + + + + + + + + + + + + 0 + 0 + + + + Use Calibration + + + + + + + + 0 + 0 + + + + true + + + + + + + _calib + + + + + _calib.nxs + + + + false + + + + + + + + + + + + Time Slice + + + + + + + + + + + + + + + Preview + + + + + + + + + + + + Output + + + + + + Save Result + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + Verbose + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot Result + + + + + + + + + MantidQt::MantidWidgets::MWRunFiles + QWidget +
mantidqt::mantidwidgets::mwrunfiles.h
+
+ + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui index ccd8114a8b7f..bc906704e1e4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui @@ -7,19 +7,244 @@ 0 0 444 - 251 + 288 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + Plot Input + + + + _sqw + + + + + _sqw.nxs + + + + false + + + + + + + + + Scale By: + + + + + + + false + + + 999.990000000000009 + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + + Options + + + + + + + + + + + + + + + Preview + + + + 6 + + + + + + + + + + color: green; + + + M0 + + + + + + + color: black; + + + M2 + + + + + + + color: red; + + + M4 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Output + + + + + + Verbose + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - - + + + ckScale + toggled(bool) + spScale + setEnabled(bool) + + + 60 + 45 + + + 139 + 46 + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui index e70e85c12f45..19138671f576 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui @@ -6,20 +6,523 @@ 0 0 - 444 - 251 + 508 + 268 Form - - + + + + + + 16777215 + 150 + + + + Input + + + + + + + 0 + 0 + + + + true + + + Plot Input + + + + _red + + + + + _red.nxs + + + + true + + + + + + + + + + Options + + + + + + + + false + + + + 0 + 0 + + + + + 200 + 16777215 + + + + 4 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.100000000000000 + + + + + + + true + + + + 0 + 0 + + + + + 43 + 0 + + + + E Width: + + + + + + + + 43 + 0 + + + + Q Width: + + + + + + + false + + + + 0 + 0 + + + + + 200 + 16777215 + + + + 4 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.100000000000000 + + + + + + + true + + + + 43 + 0 + + + + E High: + + + + + + + + 43 + 0 + + + + Rebin Type: + + + + + + + + 43 + 0 + + + + Q Low: + + + + + + + + 43 + 0 + + + + Q High: + + + + + + + false + + + + 0 + 0 + + + + + 200 + 16777215 + + + + 4 + + + 0.000000000000000 + + + 1000.000000000000000 + + + 0.010000000000000 + + + + + + + Rebin in Energy + + + + + + + true + + + + 43 + 0 + + + + E Low: + + + + + + + + 0 + 0 + + + + 4 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.100000000000000 + + + + + + + + 0 + 0 + + + + 4 + + + 0.000000000000000 + + + 1000.000000000000000 + + + 0.100000000000000 + + + + + + + + 0 + 0 + + + + 4 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.100000000000000 + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + 0 + + + + Parallelepiped (SofQW2) + + + + + Parallelepiped/Fractional Area (SofQW3) + + + + + + + + + + + + + Output + + + + + + Verbose + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot Output: + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + + None + + + + + Contour + + + + + Spectra + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - - + + + ckRebinInEnergy + toggled(bool) + spEHigh + setEnabled(bool) + + + 394 + 89 + + + 419 + 171 + + + + + ckRebinInEnergy + toggled(bool) + spEWidth + setEnabled(bool) + + + 394 + 89 + + + 419 + 144 + + + + + ckRebinInEnergy + toggled(bool) + spELow + setEnabled(bool) + + + 394 + 89 + + + 419 + 117 + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui index c46f56a5ae01..7c0841fc2f32 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui @@ -6,20 +6,157 @@ 0 0 - 444 - 251 + 507 + 232 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + false + + + _red + + + _red.nxs + + + + + + + + + + Symmetrise + + + + 6 + + + + + + + + + + + + + + Preview + + + + + + + + Preview + + + + + + + + + + + + + + + + + + Output + + + + 6 + + + + + true + + + Verbose + + + + + + + Qt::Horizontal + + + + 165 + 20 + + + + + + + + Plot Result + + + + + + + Qt::Horizontal + + + + 164 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui index 040c1ddb207d..a706f8949c5e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui @@ -6,20 +6,219 @@ 0 0 - 444 - 251 + 469 + 227 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + true + + + + + + + + + + .raw + + + + false + + + + + + + Sample: + + + + + + + + 0 + 0 + + + + true + + + + + + + + + + .raw + + + + false + + + + + + + Background: + + + + + + + + + + Preview + + + + + + QLayout::SetMinimumSize + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + color: rgb(255, 0, 0); + + + Sample + + + + + + + Background + + + + + + + color: rgb(0, 255, 0); + + + Transmission + + + + + + + + + + + + Output + + + + + + true + + + Verbose + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot Result + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - From a420eba74063e2d9880c6fa52a334a305ec667c8 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 26 Jan 2015 16:57:12 +0000 Subject: [PATCH 059/130] Added partially refactored UI files for IDA Refs #10960 --- .../Indirect/ApplyCorr.ui | 407 ++++++- .../Indirect/CalcCorr.ui | 1045 ++++++++++++++++- .../Indirect/ConvFit.ui | 429 ++++++- .../Indirect/Elwin.ui | 174 ++- .../MantidQtCustomInterfaces/Indirect/Fury.ui | 178 ++- .../Indirect/FuryFit.ui | 338 +++++- .../Indirect/MSDFit.ui | 248 +++- 7 files changed, 2781 insertions(+), 38 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui index e598c5ba84b2..db8c395fa2fc 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui @@ -6,20 +6,413 @@ 0 0 - 444 - 251 + 420 + 418 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + true + + + + _red + _sqw + + + + + _red.nxs + _sqw.nxs + + + + false + + + + + + + + + + Options + + + + + + Use Can: + + + + + + + Use Corrections: + + + + + + + + Flat + + + + + Cylinder + + + + + + + + false + + + + 0 + 0 + + + + false + + + + _flt_abs + + + + + _flt_abs.nxs + + + + false + + + + + + + false + + + + 0 + 0 + + + + true + + + + _red + _sqw + + + + + _red.nxs + _sqw.nxs + + + + false + + + + + + + Geometry: + + + + + + + false + + + Scale Can by factor: + + + false + + + + + + + false + + + 999.990000000000009 + + + + + + + + + + Preview + + + + + + + + + + + Sample + + + + + + + color: rgb(255, 0, 0); + + + Can + + + + + + + color: rgb(0, 255, 0); + + + Corrected + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Spectrum: + + + + + + + + + + + + + + + Output Options + + + + + + true + + + Verbose + + + true + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Plot Output: + + + + + + + + None + + + + + Contour + + + + + Spectra + + + + + Both + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - - + + + ckUseCan + toggled(bool) + ckScaleCan + setEnabled(bool) + + + 50 + 111 + + + 61 + 142 + + + + + ckScaleCan + toggled(bool) + spCanScale + setEnabled(bool) + + + 133 + 143 + + + 251 + 147 + + + + + ckUseCan + toggled(bool) + dsContainer + setEnabled(bool) + + + 119 + 114 + + + 324 + 114 + + + + + ckUseCorrections + toggled(bool) + dsCorrections + setEnabled(bool) + + + 119 + 167 + + + 324 + 167 + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui index d6a3def8cab0..bd1778cd8ed9 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui @@ -6,20 +6,1053 @@ 0 0 - 444 - 251 + 661 + 504 Form - - + + + + + Input + + + + + + false + + + + 0 + 0 + + + + true + + + + _red + _sqw + + + + + _red.nxs + _sqw.nxs + + + + false + + + + + + + Use Can: + + + + + + + + 0 + 0 + + + + true + + + + _red + _sqw + + + + + _red.nxs + _sqw.nxs + + + + false + + + + + + + Input type: + + + + + + + + + + + 0 + 0 + + + + Shape Details + + + + + + + + + 0 + 0 + + + + Sample Shape: + + + + + + + + 0 + 0 + + + + + Flat + + + + + Cylinder + + + + + + + + Beam Width: + + + + + + + + + + + + + + + 0 + 0 + + + + Sample Angle: + + + + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + + + + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + 0 + 0 + + + + 1 + + + 0 + + + + + 0 + + + + + + + color: rgb(255, 0, 0); + + + * + + + + + + + false + + + + 0 + 0 + + + + + 9 + 24 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + false + + + + 0 + 0 + + + + + 9 + 24 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + false + + + + 0 + 0 + + + + + + + + + + + false + + + Can Back Thickness: + + + + + + + false + + + Can Front Thickness: + + + + + + + Thickness: + + + + + + + false + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + + + + + + + Radius 1: + + + + + + + Radius 2: + + + + + + + false + + + + + + + + + + color: rgb(255, 0, 0); + + + * + + + + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + 0 + 0 + + + + + + + + + + + false + + + + 0 + 0 + + + + + 9 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + false + + + Can Radius: + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + Sample Details + + + + + + + + + 0 + 0 + + + + Number Density: + + + + + + + + 0 + 0 + + + + Cross Sections From: + + + + + + + + 0 + 0 + + + + 0 + + + + + 0 + 0 + + + + + 0 + + + + + + + + + + + + + + Scattering cross-section: + + + + + + + + + + + + + + Absorption cross-section: + + + + + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + + + + 0 + 0 + + + + + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + + + + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + + + + + + + + 0 + 0 + + + + + Input + + + + + Formula + + + + + + + + + + + + + true + + + + 0 + 0 + + + + Can Details + + + + + + + + + 0 + 0 + + + + Number Density: + + + + + + + + 0 + 0 + + + + Cross Sections From: + + + + + + + true + + + + 0 + 0 + + + + 0 + + + + true + + + + 0 + 0 + + + + + 0 + + + + + + + true + + + + 0 + 0 + + + + Scattering cross-section: + + + + + + + true + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + + + + + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + 0 + 0 + + + + Absorption cross-section: + + + + + + + + + + + 0 + 0 + + + + + 0 + + + + + + + + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + + + + + + true + + + + 0 + 0 + + + + color: rgb(255, 0, 0); + + + * + + + + + + + + + + + + + + + 0 + 0 + + + + + Input + + + + + Formula + + + + + + + + + + + + + + 0 + 0 + + + + Output Options + + + + + + + + true + + + Verbose + + + true + + + true + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + + 0 + 0 + + + + Plot Output + + + + + + + + None + + + + + Wavelength + + + + + Angle + + + + + Both + + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + Save Result + + + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui index f435f64f45a5..198b12c7f014 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui @@ -6,20 +6,437 @@ 0 0 - 444 - 251 + 617 + 284 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + Sample + + + + + + + + 0 + 0 + + + + Resolution + + + + + + + + 0 + 0 + + + + true + + + + _red + _sqw + + + + + _red.nxs + _sqw.nxs + .sqw + .red + + + + false + + + + + + + + 0 + 0 + + + + false + + + + _res + _red + _sqw + + + + + _res.nxs + _red.nxs + _sqw.nxs + + + + false + + + + + + + + + + + + + + + + + + Fit Type: + + + + + + + + Zero Lorentzians + + + + + One Lorentzian + + + + + Two Lorentzians + + + + + + + + + + + + Background + + + + + + + + Fixed Flat + + + + + Fit Flat + + + + + Fit Linear + + + + + + + + + + + + Temp. Correction + + + + + + + false + + + + 0 + 0 + + + + If set, applies the correction x*temp / 1-exp(x*temp) to the lorentzian before convolution. + + + + + + + + + + + Plot Guess + + + + + + + Tie Centres + + + + + + + + + + + + + + + + + + + + + + + Fit Single Spectrum + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Sample + + + + + + + color: rgb(255, 0, 0); + + + Fit + + + + + + + + + + + Plot Spectrum: + + + + + + + 0 + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Spectra Range: + + + + + + + 0 + + + 0 + + + + + + + to + + + + + + + 0 + + + 0 + + + + + + + + + + + + + Output + + + + + + Verbose + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot Output: + + + + + + + + None + + + + + All + + + + + Amplitude + + + + + FWHM + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui index 02f22acf97df..f03b188a0750 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui @@ -13,13 +13,179 @@ Form - - + + + + + Input + + + + + + + 0 + 41 + + + + false + + + Input File + + + true + + + + _red.nxs + _sqw.nxs + + + + + + + + + + + + + + + + + + + + Preview file: + + + + + + + + 0 + 0 + + + + + + + + Spectrum: + + + + + + + 0 + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + SE log name: + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Output + + + + + + Plot Result + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::MWRunFiles + QWidget +
mantidqt::mantidwidgets::mwrunfiles.h
+
- - diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui index 93d95948eedf..d9dc49b2230d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui @@ -7,19 +7,187 @@ 0 0 444 - 251 + 194 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + Resolution + + + + + + + + 0 + 0 + + + + Sample + + + + + + + + 0 + 0 + + + + Plot Input + + + + _red + _sqw + + + + + _red.nxs + _sqw.nxs + + + + false + + + + + + + + 0 + 0 + + + + true + + + + _res + _red + _sqw + + + + + _res.nxs + _red.nxs + _sqw.nxs + + + + false + + + + + + + + + + + + + + + + + + + + Output + + + + + + true + + + Verbose + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot Result + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui index bd96076a0074..d8b2d65731c1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui @@ -6,20 +6,348 @@ 0 0 - 444 + 719 251 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + true + + + + _iqt + + + + + _iqt.nxs + + + + false + + + + + + + + + + + + + + + + + 0 + 0 + + + + Fit Type: + + + + + + + + 1 Exponential + + + + + 2 Exponentials + + + + + 1 Stretched Exponential + + + + + 1 Stretched Exponential and 1 Exponential + + + + + + + + + + + + Plot Guess + + + true + + + + + + + Constrain Intensities + + + true + + + + + + + false + + + Constrain Beta Over All Q + + + + + + + + + + + + + + + + + + + + + Fit Single Spectrum + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Sample + + + + + + + color: rgb(255, 0, 0); + + + Fit + + + + + + + + + + + Plot Spectrum: + + + + + + + 0 + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Spectra Range: + + + + + + + 0 + + + 0 + + + + + + + to + + + + + + + 0 + + + 0 + + + + + + + + + + + + + Output + + + + + + Verbose + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot Output: + + + + + + + + None + + + + + All + + + + + Intensity + + + + + Tau + + + + + Beta + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui index 426636ce2bf2..084729eabb1b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui @@ -7,19 +7,257 @@ 0 0 444 - 251 + 223 Form - - + + + + + Input + + + + + + + 0 + 0 + + + + + _eq2 + + + + + _eq2.nxs + + + + false + + + + + + + + + + + + + + + + + + + + + + Fit Single Spectrum + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Sample + + + + + + + color: rgb(255, 0, 0); + + + Fit + + + + + + + + + + + Plot Spectrum: + + + + + + + 0 + + + 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Spectra Range: + + + + + + + 0 + + + 0 + + + + + + + + 0 + 0 + + + + to + + + + + + + 0 + + + 0 + + + + + + + + + + + + + Output + + + + + + true + + + Verbose + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot Result + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save Result + + + + + + + + + MantidQt::MantidWidgets::DataSelector + QWidget +
mantidqt::mantidwidgets::dataselector.h
+
- - From e0e2f49a8034dace0b3d8bf6ddd131e854153689 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Mon, 26 Jan 2015 21:17:25 +0000 Subject: [PATCH 060/130] Re #10958 ReductionWrapper modified to run in web-like way --- .../Direct/DirectEnergyConversion.py | 2 - .../Inelastic/Direct/ReductionWrapper.py | 146 +++++++++++++++--- .../scripts/Inelastic/Direct/RunDescriptor.py | 44 ++++-- Code/Mantid/scripts/test/MariReduction.py | 21 ++- .../scripts/test/ReductionWrapperTest.py | 21 ++- 5 files changed, 175 insertions(+), 59 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py index c71b938a2594..757bdf5f34ed 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py +++ b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py @@ -283,8 +283,6 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, """ One step conversion of run into workspace containing information about energy transfer """ - # Clear information about sample runs, processed previously. - PropertyManager.sample_run.set_action_suffix('') # Support for old reduction interface: self.prop_man.set_input_parameters_ignore_nan\ (wb_run=wb_run,sample_run=sample_run,incident_energy=ei_guess,energy_bins=rebin, diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index e41feb504714..4460c95cdc08 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -15,27 +15,48 @@ class ReductionWrapper(object): using the same interface and the same run file placed in different locations. """ - def var_holder(object): + class var_holder(object): """ A simple wrapper class to keep web variables""" def __init__(self): + self.standard_vars = None + self.advanced_vars = None pass def __init__(self,instrumentName,web_var=None): """ sets properties defaults for the instrument with Name and define if wrapper runs from web services or not """ + # internal variable, indicating if we should try to wait for input files to appear + self._wait_for_file=False - # The variables which are set up from web interface or to be exported to + # The variables which are set up from web interface or to be exported to # web interface if web_var: self._run_from_web = True self._wvs = web_var else: self._run_from_web = False - self._wvs = ReductionWrapper.var_holder + self._wvs = ReductionWrapper.var_holder() # Initialize reduced for given instrument - self._reducer = DirectEnergyConversion(instrumentName) + self.reducer = DirectEnergyConversion(instrumentName) +# + @property + def wait_for_file(self): + """ If this variable set to positive value, this value + is interpreted as time to wait until check for specified run file + if this file have not been find immediately. + if this variable is 0 or false and the the file have not been found, + reduction will fail + """ + return self._wait_for_file + @wait_for_file.setter + def wait_for_file(self,value): + if value>0: + self._wait_for_file = value + else: + self._wait_for_file = False +# def save_web_variables(self,FileName=None): """ Method to write simple and advanced properties and help information into dictionary, to use by web reduction @@ -51,7 +72,7 @@ def save_web_variables(self,FileName=None): f=open(FileName,'w') f.write("standard_vars = {\n") str_wrapper = ' ' - for key,val in self._main_properties.iteritems(): + for key,val in self._wvs.standard_vars.iteritems(): if isinstance(val,str): row = "{0}\'{1}\':\'{2}\'".format(str_wrapper,key,val) else: @@ -61,7 +82,7 @@ def save_web_variables(self,FileName=None): f.write("\n}\nadvanced_vars={\n") str_wrapper=' ' - for key,val in self._advanced_properties.iteritems(): + for key,val in self._wvs.advanced_vars.iteritems(): if isinstance(val,str): row = "{0}\'{1}\':\'{2}\'".format(str_wrapper,key,val) else: @@ -71,6 +92,49 @@ def save_web_variables(self,FileName=None): f.write("\n}\n") f.close() +# + def get_validation_file_name(self): + """ Define file used as sample to ensure reduction validity + """ + return None +# + def validate_result(self,Error=1.e-3,ToleranceRelErr=True): + """ Method validates results of the reduction against reference file provided + by get_validation_file_name() method + + At the moment, get_validation_file_name method should return the name of a file, + where workspace sample reduced workspace with default properties + is stored. + CheckWorkspaceMatch method is applied to verify if current reduced workspace is + equivalent to the workspace, stored in the reference file. + """ + + validation_file = self.get_validation_file_name() + if not validation_file: + return True,'No validation defined' + + sample = Load(validation_file) + + # just in case, to be sure + current_web_state = self._run_from_web + current_wait_state= self.wait_for_file + # disable wait for input and + self._run_from_web = False + self.wait_for_file = False + # + self.def_advanced_properties() + self.def_main_properties() + reduced = self.reduce() + + result = CheckWorkspaceMatch(Workspace1=sample,Workspace2=reduced,Tolerance=Error,CheckSampe=False, + ChceckInstrument=False,ToleranceRelErr=ToleranceRelErr) + + self.wait_for_file = current_wait_state + self._run_from_web = current_web_state + if result == 'Success!': + return True,'Reference file and reduced workspace are equivalent' + else: + return False,result @abstractmethod def def_main_properties(self): @@ -93,16 +157,41 @@ def def_advanced_properties(self): """ raise NotImplementedError('def_advanced_properties has to be implemented') - @abstractmethod - def reduce(self,input_file=None,output_directory=None): - """ The method which performs all main reduction operations. + + def reduce(self,input_file=None,output_directory=None): + """ The method performs all main reduction operations over + single run file + + Wrap it into @iliad wrapper to switch input for + reduction properties between script and web variables """ - raise NotImplementedError('main routine has to be implemented') + + if input_file: + self.reducer.sample_run = input_file + + timeToWait = self._wait_for_file + if timeToWait: + file = PropertyManager.sample_run.find_file() + while len(file)==0: + file_hint,fext = PropertyManager.sample_run.file_hint() + self.reduced.prop_man.log("*** Waiting {0}sec for file {1} to appear on the data search path"\ + .format(timeToWait,file_hint),'notice') + Pause(timeToWait) + file = PropertyManager.sample_run.find_file() + ws = self.reducer.convert_to_energy(None,input_file) + + else: + ws = self.reducer.convert_to_energy(None,input_file) + + return ws + + def MainProperties(main_prop_definition): - """ Decorator stores properties dedicated as main and sets these properties as input to reduction parameters.""" + """ Decorator stores properties dedicated as main and sets these properties + as input to reduction parameters.""" def main_prop_wrapper(*args): # execute decorated function prop_dict = main_prop_definition(*args) @@ -110,26 +199,28 @@ def main_prop_wrapper(*args): host = args[0] if not host._run_from_web: # property run locally host._wvs.standard_vars = prop_dict - host._reducer.prop_man.set_input_parameters(**prop_dict) - return properties + host.reducer.prop_man.set_input_parameters(**prop_dict) + return prop_dict return main_prop_wrapper # def AdvancedProperties(adv_prop_definition): - """ Decorator stores properties decided to be advanced and sets these properties as input for reduction parameters """ + """ Decorator stores properties decided to be advanced and sets these properties + as input for reduction parameters + """ def advanced_prop_wrapper(*args): prop_dict = adv_prop_definition(*args) #print "in decorator: ",properties host = args[0] if not host._run_from_web: # property run locally host._wvs.advanced_vars =prop_dict - host._reducer.prop_man.set_input_parameters(**prop_dict) - return properties + host.reducer.prop_man.set_input_parameters(**prop_dict) + return prop_dict return advanced_prop_wrapper -def iliad(main): +def iliad(reduce): """ This decorator wraps around main procedure and switch input from web variables to properties or vise versa depending on web variables presence @@ -150,17 +241,22 @@ def iliad_wrapper(*args): # add input file folder to data search directory if file has it if input_file: data_path = os.path.dirname(input_file) - try: - config.appendDataSearchDir(str(output_directory)) - except: # if mantid is not available, this should ignore config - pass + if len(data_path)>0: + try: + config.appendDataSearchDir(str(data_path)) + except: # if mantid is not available, this should ignore config + pass + if output_directory: + config['defaultsave.directory'] = output_directory if host._run_from_web: - web_vars = dict(host._web_var.standard_vars.items()+host._web_var.standard_vars.items()) - host.iliad_prop.set_input_parameters(**web_vars) - host.iliad_prop.sample_run = input_file + web_vars = dict(host._wvs.standard_vars.items()+host._wvs.advanced_vars.items()) + host.reducer.prop_man.set_input_parameters(**web_vars) + else: + pass # we should set already set up variables using + - rez = run_reducer(*args) + rez = reduce(*args) # prohibit returning workspace to web services. if host._run_from_web and not isinstance(rez,str): rez="" diff --git a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py index 7c67d8641306..6bb7ebae0c88 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py +++ b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py @@ -202,18 +202,16 @@ def set_file_ext(self,val): self._run_ext = value else: raise AttributeError('Source file extension can be only a string') -#-------------------------------------------------------------------------------------------------------------------- - def find_file(self,run_num = None,filePath=None,fileExt=None,**kwargs): - """Use Mantid to search for the given run. """ + + def file_hint(self,run_num_str,filePath=None,fileExt=None,**kwargs): + """ procedure to provide run file guess name from run properties + + main purpose -- to support customized order of file extensions + """ inst_name = RunDescriptor._holder.short_inst_name - if run_num: - run_num_str = str(run_num) - else: - run_num_str = str(self.run_number()) - # if 'file_hint' in kwargs: - file_hint = kwargs['file_hint'] + hint = kwargs['file_hint'] fname,old_ext=os.path.splitext(file_hint) if len(old_ext) == 0: old_ext = self.get_file_ext() @@ -223,15 +221,28 @@ def find_file(self,run_num = None,filePath=None,fileExt=None,**kwargs): else: old_ext = self.get_file_ext() - file_hint =inst_name + run_num_str + old_ext + hint =inst_name + run_num_str + old_ext if not filePath: filePath = self._run_file_path if os.path.exists(filePath): - file_hint = os.path.join(filePath,file_hint) - if os.path.exists(file_hint): - return file_hint + hint = os.path.join(filePath,hint) + if os.path.exists(hint): + return hint,old_ext else: - fp,file_hint=os.path.split(file_hint) + fp,hint=os.path.split(hint) + return hint,old_ext + +#-------------------------------------------------------------------------------------------------------------------- + def find_file(self,run_num = None,filePath=None,fileExt=None,**kwargs): + """Use Mantid to search for the given run. """ + + inst_name = RunDescriptor._holder.short_inst_name + if run_num: + run_num_str = str(run_num) + else: + run_num_str = str(self.run_number()) + # + file_hint,old_ext = self.file_hint(run_num_str,filePath,fileExt,**kwargs) try: file = FileFinder.findRuns(file_hint)[0] @@ -573,7 +584,10 @@ def _clear_old_ws(self,old_ws_name,new_name,clear_runs_to_add=True): #------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------- class RunDescriptorDependent(RunDescriptor): - """ A RunDescriptor class dependent on another RunDescriptor""" + """ Simple RunDescriptor class dependent on another RunDescriptor, + providing the host descriptor if current descriptor value is not defined + or usual descriptor functionality if somebody sets current descriptor up + """ def __init__(self,host_run,ws_preffix,DocString=None): RunDescriptor.__init__(self,ws_preffix,DocString) diff --git a/Code/Mantid/scripts/test/MariReduction.py b/Code/Mantid/scripts/test/MariReduction.py index 390b6447ad0c..4c7f2909eda2 100644 --- a/Code/Mantid/scripts/test/MariReduction.py +++ b/Code/Mantid/scripts/test/MariReduction.py @@ -43,13 +43,12 @@ def def_advanced_properties(self): #-------------------------------------------------------------------------------------------------# @iliad def reduce(self,input_file=None,output_directory=None): - """ Method executes reduction over single file""" + """ Method executes reduction over single file - ws = red.convert_to_energy(None,input_file) + Overload only if custom reduction is needed + """ + ws = ReductionWrapper.reduce(input_file,output_directory) #SaveNexus(ws,Filename = 'MARNewReduction.nxs') - - #when run from web service, return additional path for web server to copy - #data to" return ws def __init__(self,web_var=None): @@ -58,7 +57,7 @@ def __init__(self,web_var=None): #-------------------------------------------------------------------------------------------------# #-------------------------------------------------------------------------------------------------# #-------------------------------------------------------------------------------------------------# -def main(input_file,output_directory): +def main(input_file=None,output_directory=None): """ This method is used to run code from web service and should not be touched unless you change the name of the particular ReductionWrapper class (e.g. ReduceMARI here) @@ -67,7 +66,7 @@ def main(input_file,output_directory): """ # note web variables initialization rd = ReduceMARI(web_var) - rd.main(input_file,output_directory) + rd.reduce(input_file,output_directory) # Define folder for web service to copy results to output_folder = '' @@ -99,9 +98,9 @@ def main(input_file,output_directory): rd.def_main_properties() # uncomment rows below to save web variables to use in web services. - run_dir = os.path.dirname(os.path.realpath(__file__)) - file = os.path.join(run_dir,'reduce_vars.py') - rd.save_web_variables(file) + #run_dir = os.path.dirname(os.path.realpath(__file__)) + #file = os.path.join(run_dir,'reduce_vars.py') + #rd.save_web_variables(file) - rd.main() + rd.reduce() diff --git a/Code/Mantid/scripts/test/ReductionWrapperTest.py b/Code/Mantid/scripts/test/ReductionWrapperTest.py index 21a1e6294c59..4a708052a005 100644 --- a/Code/Mantid/scripts/test/ReductionWrapperTest.py +++ b/Code/Mantid/scripts/test/ReductionWrapperTest.py @@ -5,7 +5,7 @@ from mantid import api from Direct.ReductionWrapper import ReductionWrapper -from MariReduction import ReduceMARI +import MariReduction as mr # @@ -33,25 +33,25 @@ def test_default_fails(self): self.assertRaises(NotImplementedError,red.def_main_properties) self.assertRaises(NotImplementedError,red.def_advanced_properties) - self.assertRaises(NotImplementedError,red.main) + self.assertTrue('reduce' in dir(red)) def test_export_advanced_values(self): - red = ReduceMARI() + red = mr.ReduceMARI() main_prop=red.def_main_properties() adv_prop=red.def_advanced_properties() # see what have changed and what have changed as advanced properties. - all_changed_prop = red.iliad_prop.getChangedProperties() + all_changed_prop = red.reducer.prop_man.getChangedProperties() self.assertEqual(set(main_prop.keys()+adv_prop.keys()),all_changed_prop) test_dir = config['defaultsave.directory'] file = os.path.join(test_dir,'reduce_vars.py') - red.export_changed_values(file) + red.save_web_variables(file) self.assertTrue(os.path.isfile(file)) # restore saved parameters. @@ -62,13 +62,22 @@ def test_export_advanced_values(self): self.assertEqual(rv.standard_vars,main_prop) self.assertEqual(rv.advanced_vars,adv_prop) + reload(mr) + + # tis will run MARI reduction, which probably not work from unit tests + # will move this to system tests + #rez = mr.main() + + self.assertTrue(mr.web_var) + self.assertEqual(mr.web_var.standard_vars,main_prop) + self.assertEqual(mr.web_var.advanced_vars,adv_prop) os.remove(file) fbase,fext = os.path.splitext(file) fcomp = fbase+'.pyc' if os.path.isfile(fcomp): - os.remove(fcomp); + os.remove(fcomp) if __name__=="__main__": unittest.main() From eabee4d50ce60fa39d4090f928af4b346d3e0fa9 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Mon, 26 Jan 2015 22:45:56 +0000 Subject: [PATCH 061/130] Re #10958 Fixed output workspace name --- .../scripts/Inelastic/Direct/ReductionWrapper.py | 15 +++++++++++++-- .../scripts/Inelastic/Direct/RunDescriptor.py | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 4460c95cdc08..4a3742831309 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -1,5 +1,6 @@ from mantid.simpleapi import * from mantid import config +from mantid.kernel import funcreturns from PropertyManager import PropertyManager # this import is used by children @@ -166,7 +167,6 @@ def reduce(self,input_file=None,output_directory=None): Wrap it into @iliad wrapper to switch input for reduction properties between script and web variables """ - if input_file: self.reducer.sample_run = input_file @@ -227,6 +227,12 @@ def iliad(reduce): """ def iliad_wrapper(*args): #seq = inspect.stack() + # output workspace name. + try: + n,r = funcreturns.lhs_info('both') + out_ws_name = r[0] + except: + out_ws_name = None host = args[0] if len(args)>1: @@ -255,11 +261,16 @@ def iliad_wrapper(*args): else: pass # we should set already set up variables using - + rez = reduce(*args) + # prohibit returning workspace to web services. if host._run_from_web and not isinstance(rez,str): rez="" + else: + if out_ws_name and rez.name() != out_ws_name : + rez=RenameWorkspace(InputWorkspace=rez,OutputWorkspace=out_ws_name) + return rez return iliad_wrapper diff --git a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py index 6bb7ebae0c88..a663a27f81d3 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py +++ b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py @@ -212,7 +212,7 @@ def file_hint(self,run_num_str,filePath=None,fileExt=None,**kwargs): inst_name = RunDescriptor._holder.short_inst_name if 'file_hint' in kwargs: hint = kwargs['file_hint'] - fname,old_ext=os.path.splitext(file_hint) + fname,old_ext=os.path.splitext(hint) if len(old_ext) == 0: old_ext = self.get_file_ext() else: From dcf85543a770979c072a66cb1a6bb4249470b5a2 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Mon, 26 Jan 2015 22:55:59 +0000 Subject: [PATCH 062/130] Re #10958 minor comments --- Code/Mantid/scripts/test/ReductionWrapperTest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/scripts/test/ReductionWrapperTest.py b/Code/Mantid/scripts/test/ReductionWrapperTest.py index 4a708052a005..ed8b1e042043 100644 --- a/Code/Mantid/scripts/test/ReductionWrapperTest.py +++ b/Code/Mantid/scripts/test/ReductionWrapperTest.py @@ -1,5 +1,5 @@ import os,sys -os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] +#os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] from mantid.simpleapi import * from mantid import api From 485df58b0bc6d5ae7c8d9abc7789ad32c09cd131 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Tue, 27 Jan 2015 10:17:08 +0000 Subject: [PATCH 063/130] Re #10958 fixed reduce return in case of multiple workspaces (multirep mode) --- Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 4a3742831309..8bc5e26af2dd 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -267,7 +267,10 @@ def iliad_wrapper(*args): # prohibit returning workspace to web services. if host._run_from_web and not isinstance(rez,str): rez="" - else: + else: + if isinstance(rez,list): + # multirep run, just return as it is + return rez if out_ws_name and rez.name() != out_ws_name : rez=RenameWorkspace(InputWorkspace=rez,OutputWorkspace=out_ws_name) From 06356e112acd08f30c8f38207a6aa2d54a05dd93 Mon Sep 17 00:00:00 2001 From: Anton Piccardo-Selg Date: Tue, 27 Jan 2015 10:58:05 +0000 Subject: [PATCH 064/130] Refs #10959 Fix the slice algorithm dialog dimension issue --- .../MantidQt/API/inc/MantidQtAPI/AlgorithmDialog.h | 3 +++ Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp | 12 +++++++++++- .../CustomDialogs/src/SlicingAlgorithmDialog.cpp | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/AlgorithmDialog.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/AlgorithmDialog.h index 318729daac54..03624acce871 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/AlgorithmDialog.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/AlgorithmDialog.h @@ -145,6 +145,9 @@ class EXPORT_OPT_MANTIDQT_API AlgorithmDialog : public QDialog /// Adds a property (name,value) pair to the stored map void storePropertyValue(const QString & name, const QString & value); + /// Removes a property (name, value) pair from the stored map + void removePropertyValue(const QString& name); + /// Set properties on this algorithm by pulling values from the tied widgets bool setPropertyValues(const QStringList & skipList = QStringList()); bool setPropertyValue(const QString pName, bool validateOthers); diff --git a/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp b/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp index a0f8fb862d3b..f3b1de35208f 100644 --- a/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp +++ b/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp @@ -263,6 +263,17 @@ void AlgorithmDialog::storePropertyValue(const QString & name, const QString & v m_propertyValueMap.insert(name, value); } +//------------------------------------------------------------------------------------------------- +/** + * Adds a property (name,value) pair to the stored map. + * @param name :: The name of the property. + */ +void AlgorithmDialog::removePropertyValue(const QString& name) +{ + if( name.isEmpty() ) return; + m_propertyValueMap.remove(name); +} + //------------------------------------------------------------------------------------------------- /** Show the validators for all the properties */ @@ -290,7 +301,6 @@ void AlgorithmDialog::showValidators() } } // widget is tied } // for each property - } //------------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp index e36a785d03a4..89c798bbb089 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp @@ -278,6 +278,20 @@ namespace MantidQt void SlicingAlgorithmDialog::makeDimensionInputs(const QString& propertyPrefix, QLayout* owningLayout, QString (*format)(IMDDimension_const_sptr), History history) { + // Remove excess dimensions from the tied properties and the stored property values + size_t indexRemoved = 0; + QString propertyNameRemoved = propertyPrefix.copy().append(QString().number(indexRemoved)); + Mantid::Kernel::Property *propertyRemoved = getAlgorithmProperty(propertyNameRemoved); + + while(propertyRemoved) + { + untie(propertyNameRemoved); + removePropertyValue(propertyNameRemoved); + + indexRemoved++; + propertyNameRemoved = propertyPrefix.copy().append(QString().number(indexRemoved)); + propertyRemoved = getAlgorithmProperty(propertyNameRemoved); + } const QString& txt = getCurrentInputWorkspaceName(); if (!txt.isEmpty()) From af7155ae8b35d0ce8418f61ab65070f450691504 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 10:59:13 +0000 Subject: [PATCH 065/130] Updated moments, sqw, trans and symm Refs #10960 --- .../Indirect/IndirectDataReduction.ui | 1121 +---------------- .../Indirect/IndirectMoments.h | 6 +- .../Indirect/IndirectMoments.ui | 2 +- .../Indirect/IndirectSqw.h | 5 +- .../Indirect/IndirectSqw.ui | 4 +- .../Indirect/IndirectSymmetrise.h | 4 + .../Indirect/IndirectSymmetrise.ui | 2 +- .../Indirect/IndirectTransmission.h | 10 +- .../Indirect/IndirectTransmission.ui | 2 +- .../src/Indirect/IndirectDataReduction.cpp | 56 +- .../src/Indirect/IndirectMoments.cpp | 55 +- .../src/Indirect/IndirectSqw.cpp | 51 +- .../src/Indirect/IndirectSymmetrise.cpp | 36 +- .../src/Indirect/IndirectTransmission.cpp | 32 +- 14 files changed, 134 insertions(+), 1252 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui index cd1d4dae0e91..24db13c1d401 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui @@ -55,7 +55,7 @@ - + 0 @@ -1581,1083 +1581,21 @@ Later steps in the process (saving, renaming) will not be done. Transmission - - - - - Input - - - - - - - 0 - 0 - - - - true - - - - - - - - - - .raw - - - - false - - - - - - - Sample: - - - - - - - - 0 - 0 - - - - true - - - - - - - - - - .raw - - - - false - - - - - - - Background: - - - - - - - - - - Preview - - - - - - QLayout::SetMinimumSize - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - color: rgb(255, 0, 0); - - - Sample - - - - - - - Background - - - - - - - color: rgb(0, 255, 0); - - - Transmission - - - - - - - - - - - - - - - Output - - - - - - - - true - - - Verbose - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Result - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - - - Symmetrise - - - - - Input - - - - - - - 0 - 0 - - - - false - - - _red - - - _red.nxs - - - - - - - - - - Symmetrise - - - - 6 - - - - - - - - - - - - - - Preview - - - - - - - - Preview - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Output - - - - 6 - - - - - true - - - Verbose - - - - - - - Qt::Horizontal - - - - 165 - 20 - - - - - - - - Plot Result - - - - - - - Qt::Horizontal - - - - 164 - 20 - - - - - - - - Save Result - - - - - - - S(Q, w) - - - - - - 16777215 - 150 - - - - Input - - - - - - - 0 - 0 - - - - true - - - Plot Input - - - - _red - - - - - _red.nxs - - - - true - - - - - - - - - - Options - - - - - - - - - - false - - - 0.1 - - - -1000.0 - - - 1000.0 - - - 4 - - - - 0 - 0 - - - - - 200 - 16777215 - - - - - - - - false - - - - 0 - 0 - - - - - 43 - 0 - - - - E Width: - - - - - - - - 43 - 0 - - - - Q Width: - - - - - - - false - - - 0.1 - - - -1000.0 - - - 1000.0 - - - 4 - - - - 0 - 0 - - - - - 200 - 16777215 - - - - - - - - false - - - - 43 - 0 - - - - E High: - - - - - - - - 43 - 0 - - - - Rebin Type: - - - - - - - - 43 - 0 - - - - Q Low: - - - - - - - - 43 - 0 - - - - Q High: - - - - - - - false - - - 0.01 - - - 0.0 - - - 1000.0 - - - 4 - - - - 0 - 0 - - - - - 200 - 16777215 - - - - - - - - Rebin in Energy - - - - - - - false - - - - 43 - 0 - - - - E Low: - - - - - - - 0.1 - - - -1000.0 - - - 1000.0 - - - 4 - - - - 0 - 0 - - - - - - - - 0.1 - - - 0.0 - - - 1000.0 - - - 4 - - - - 0 - 0 - - - - - - - - 0.1 - - - -1000.0 - - - 1000.0 - - - 4 - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - 0 - - - - Parallelepiped (SofQW2) - - - - - Parallelepiped/Fractional Area (SofQW3) - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Output - - - - - - - - Verbose - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Output: - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - - None - - - - - Contour - - - - - Spectra - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - - - Moments - - - - - Input - - - - - - - - - 0 - 0 - - - - Plot Input - - - - _sqw - - - - - _sqw.nxs - - - - false - - - - - - - - - Scale By: - - - - - - - false - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - - <html><head/><body style=" color:#aa0000;"></body></html> - - - Qt::RichText - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - - - Options - - - - - - - - - - - - - - - Preview - - - - 6 - - - - - - - - - - color: green; - - - M0 - - - - - - - color: black; - - - M2 - - - - - - - color: red; - - - M4 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - Output - - - - - - - - Verbose - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save - - - - - - - - - @@ -2785,62 +1723,7 @@ Later steps in the process (saving, renaming) will not be done. - tabWidget - save_ckSPE - save_ckNexus - pbRun - pbHelp - leEfixed - leSpectraMin - leSpectraMax - rebin_ckDNR - entryRebinLow - entryRebinWidth - entryRebinHigh - pbBack_2 - pbPlotRaw - ckSumFiles - cbMappingOptions - leNoGroups - ckUseCalib - ind_runFiles - ind_calibFile - ckLoadLogs - ind_mapFile - ckDetailedBalance - leDetailedBalance - ckScaleMultiplier - leScaleMultiplier - comboRebinType - entryRebinString - save_ckNxSPE - save_ckAscii - save_ckAclimax - ind_cbPlotOutput - cal_ckIntensityScaleMultiplier - cal_leIntensityScaleMultiplier - cal_ckResScale - cal_leResScale - cal_ckRES - cal_ckPlotResult - slice_inputFile - slice_ckVerbose - slice_ckPlot - slice_ckSave - trans_ckVerbose - trans_ckPlot - trans_ckSave - sqw_cbRebinType - sqw_spQLow - sqw_spQWidth - sqw_spQHigh - sqw_ckRebinE - sqw_spELow - sqw_spEWidth - sqw_spEHigh - sqw_ckVerbose - sqw_cbPlotType - sqw_ckSave + twIDRTabs pbManageDirectories cal_ckVerbose cal_ckSave diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h index 8e6ce70f3278..2c5f7c34429f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h @@ -3,6 +3,7 @@ #include "IndirectDataReductionTab.h" +#include "ui_IndirectMoments.h" #include "MantidKernel/System.h" #include @@ -12,7 +13,7 @@ namespace MantidQt namespace CustomInterfaces { /** IndirectMoments : TODO: DESCRIPTION - + @author Samuel Jackson @date 13/08/2013 @@ -61,6 +62,9 @@ namespace CustomInterfaces /// Called when the algorithm completes to update preview plot void momentsAlgComplete(bool error); + private: + Ui::IndirectMoments m_uiForm; + }; } // namespace CustomInterfaces } // namespace Mantid diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui index bc906704e1e4..3893e6d3254e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui @@ -225,7 +225,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h index c8a730e7479a..88e70d90b3f1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h @@ -3,6 +3,7 @@ #include "IndirectDataReductionTab.h" +#include "ui_IndirectSqw.h" #include "MantidKernel/System.h" namespace MantidQt @@ -47,10 +48,12 @@ namespace CustomInterfaces virtual bool validate(); private slots: - void energyRebinToggle(bool state); void plotContour(); void sqwAlgDone(bool error); + private: + Ui::IndirectSqw m_uiForm; + }; } // namespace CustomInterfaces } // namespace Mantid diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui index 19138671f576..a2968dec9e2c 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui @@ -412,7 +412,7 @@ - + 0 @@ -471,7 +471,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h index c391d8f3806d..d2335ae0a0ad 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h @@ -3,6 +3,7 @@ #include "IndirectDataReductionTab.h" +#include "ui_IndirectSymmetrise.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/System.h" @@ -76,6 +77,9 @@ namespace CustomInterfaces void xRangeMaxChanged(double value); void xRangeMinChanged(double value); + private: + Ui::IndirectSymmetrise m_uiForm; + }; } // namespace CustomInterfaces } // namespace Mantid diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui index 7c0841fc2f32..6cd8dc001310 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.ui @@ -154,7 +154,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h index bc57dc29e72f..bcd7539c34bd 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h @@ -2,6 +2,7 @@ #define MANTID_CUSTOMINTERFACES_INDIRECTTRANSMISSION_H_ #include "IndirectDataReductionTab.h" +#include "ui_IndirectTransmission.h" #include "MantidKernel/System.h" @@ -9,7 +10,10 @@ namespace MantidQt { namespace CustomInterfaces { - /** IndirectTransmission : TODO: DESCRIPTION + /** IndirectTransmission + + Provides the UI interface to the IndirectTransmissionMonitor algorithm to calculate + sample transmission using a sample and container raw run file. @author Samuel Jackson @@ -51,6 +55,10 @@ namespace CustomInterfaces void dataLoaded(); void previewPlot(); void transAlgDone(bool error); + + private: + Ui::IndirectTransmission m_uiForm; + }; } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui index a706f8949c5e..4859b7f2151d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui @@ -216,7 +216,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp index bc53306820a8..29bf45767c86 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp @@ -79,8 +79,8 @@ IndirectDataReduction::~IndirectDataReduction() void IndirectDataReduction::helpClicked() { - QString tabName = m_uiForm.tabWidget->tabText( - m_uiForm.tabWidget->currentIndex()); + QString tabName = m_uiForm.twIDRTabs->tabText( + m_uiForm.twIDRTabs->currentIndex()); QString url = "http://www.mantidproject.org/Indirect:"; @@ -108,7 +108,7 @@ void IndirectDataReduction::helpClicked() */ void IndirectDataReduction::exportTabPython() { - QString tabName = m_uiForm.tabWidget->tabText(m_uiForm.tabWidget->currentIndex()); + QString tabName = m_uiForm.twIDRTabs->tabText(m_uiForm.twIDRTabs->currentIndex()); m_tabs[tabName]->exportPythonScript(); } @@ -119,7 +119,7 @@ void IndirectDataReduction::exportTabPython() */ void IndirectDataReduction::runClicked() { - QString tabName = m_uiForm.tabWidget->tabText(m_uiForm.tabWidget->currentIndex()); + QString tabName = m_uiForm.twIDRTabs->tabText(m_uiForm.twIDRTabs->currentIndex()); m_tabs[tabName]->runTab(); } @@ -135,13 +135,14 @@ void IndirectDataReduction::initLayout() updateRunButton(false, "Loading UI", "Initialising user interface components..."); // Create the tabs - m_tabs["Energy Transfer"] = new IndirectConvertToEnergy(m_uiForm, this); - m_tabs["Calibration"] = new IndirectCalibration(m_uiForm, this); - m_tabs["Diagnostics"] = new IndirectDiagnostics(m_uiForm, this); - m_tabs["Transmission"] = new IndirectTransmission(m_uiForm, this); - m_tabs["Symmetrise"] = new IndirectSymmetrise(m_uiForm, this); - m_tabs["S(Q, w)"] = new IndirectSqw(m_uiForm, this); - m_tabs["Moments"] = new IndirectMoments(m_uiForm, this); + //TODO + /* m_tabs["Energy Transfer"] = new IndirectConvertToEnergy(m_uiForm, m_uiForm.twIDRTabs->widget(0)); */ + /* m_tabs["Calibration"] = new IndirectCalibration(m_uiForm, m_uiForm.twIDRTabs->widget(1)); */ + /* m_tabs["Diagnostics"] = new IndirectDiagnostics(m_uiForm, m_uiForm.twIDRTabs->widget(2)); */ + /* m_tabs["Transmission"] = new IndirectTransmission(m_uiForm, m_uiForm.twIDRTabs->widget(3)); */ + /* m_tabs["Symmetrise"] = new IndirectSymmetrise(m_uiForm, m_uiForm.twIDRTabs->widget(4)); */ + /* m_tabs["S(Q, w)"] = new IndirectSqw(m_uiForm, m_uiForm.twIDRTabs->widget(5)); */ + /* m_tabs["Moments"] = new IndirectMoments(m_uiForm, m_uiForm.twIDRTabs->widget(6)); */ // Connect "?" (Help) Button connect(m_uiForm.pbHelp, SIGNAL(clicked()), this, SLOT(helpClicked())); @@ -153,7 +154,7 @@ void IndirectDataReduction::initLayout() connect(m_uiForm.pbManageDirectories, SIGNAL(clicked()), this, SLOT(openDirectoryDialog())); // Reset the Run button state when the tab is changed - connect(m_uiForm.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateRunButton())); + connect(m_uiForm.twIDRTabs, SIGNAL(currentChanged(int)), this, SLOT(updateRunButton())); // Connect tab signals and run any setup code for(auto it = m_tabs.begin(); it != m_tabs.end(); ++it) @@ -401,21 +402,22 @@ void IndirectDataReduction::readSettings() QSettings settings; // Load settings for MWRunFile widgets - settings.beginGroup(m_settingsGroup + "DataFiles"); - settings.setValue("last_directory", m_dataDir); - m_uiForm.ind_runFiles->readSettings(settings.group()); - m_uiForm.cal_leRunNo->readSettings(settings.group()); - m_uiForm.slice_inputFile->readSettings(settings.group()); - settings.endGroup(); - - settings.beginGroup(m_settingsGroup + "ProcessedFiles"); - settings.setValue("last_directory", m_saveDir); - m_uiForm.ind_calibFile->readSettings(settings.group()); - m_uiForm.ind_mapFile->readSettings(settings.group()); - m_uiForm.slice_dsCalibFile->readSettings(settings.group()); - m_uiForm.moment_dsInput->readSettings(settings.group()); - m_uiForm.sqw_dsSampleInput->readSettings(settings.group()); - settings.endGroup(); + //TODO + /* settings.beginGroup(m_settingsGroup + "DataFiles"); */ + /* settings.setValue("last_directory", m_dataDir); */ + /* m_uiForm.ind_runFiles->readSettings(settings.group()); */ + /* m_uiForm.cal_leRunNo->readSettings(settings.group()); */ + /* m_uiForm.slice_inputFile->readSettings(settings.group()); */ + /* settings.endGroup(); */ + + /* settings.beginGroup(m_settingsGroup + "ProcessedFiles"); */ + /* settings.setValue("last_directory", m_saveDir); */ + /* m_uiForm.ind_calibFile->readSettings(settings.group()); */ + /* m_uiForm.ind_mapFile->readSettings(settings.group()); */ + /* m_uiForm.slice_dsCalibFile->readSettings(settings.group()); */ + /* m_uiForm.moment_dsInput->readSettings(settings.group()); */ + /* m_uiForm.sqw_dsSampleInput->readSettings(settings.group()); */ + /* settings.endGroup(); */ // Load the last used instrument settings.beginGroup(m_settingsGroup); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp index 75ddd23b90f4..6db08399ca52 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp @@ -17,6 +17,8 @@ namespace CustomInterfaces */ IndirectMoments::IndirectMoments(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent) { + m_uiForm.setupUi(parent); + const unsigned int NUM_DECIMALS = 6; // RAW PLOT @@ -31,7 +33,7 @@ namespace CustomInterfaces m_plots["MomentsPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); // Add plot to UI - m_uiForm.moment_plotSpace->addWidget(m_plots["MomentsPlot"]); + m_uiForm.plotRaw->addWidget(m_plots["MomentsPlot"]); // PREVIEW PLOT m_plots["MomentsPreviewPlot"] = new QwtPlot(m_parentWidget); @@ -42,12 +44,12 @@ namespace CustomInterfaces m_plots["MomentsPreviewPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); // Add plot to UI - m_uiForm.moment_plotPreview->addWidget(m_plots["MomentsPreviewPlot"]); + m_uiForm.plotPreview->addWidget(m_plots["MomentsPreviewPlot"]); // PROPERTY TREE m_propTrees["MomentsPropTree"] = new QtTreePropertyBrowser(); m_propTrees["MomentsPropTree"]->setFactoryForManager(m_dblManager, m_dblEdFac); - m_uiForm.moment_treeSpace->addWidget(m_propTrees["MomentsPropTree"]); + m_uiForm.properties->addWidget(m_propTrees["MomentsPropTree"]); m_properties["EMin"] = m_dblManager->addProperty("EMin"); m_properties["EMax"] = m_dblManager->addProperty("EMax"); @@ -57,19 +59,13 @@ namespace CustomInterfaces m_dblManager->setDecimals(m_properties["EMin"], NUM_DECIMALS); m_dblManager->setDecimals(m_properties["EMax"], NUM_DECIMALS); - m_uiForm.moment_leScale->setValidator(new QDoubleValidator()); - - connect(m_uiForm.moment_dsInput, SIGNAL(dataReady(const QString&)), this, SLOT(handleSampleInputReady(const QString&))); - connect(m_uiForm.moment_ckScale, SIGNAL(toggled(bool)), m_uiForm.moment_leScale, SLOT(setEnabled(bool))); - connect(m_uiForm.moment_ckScale, SIGNAL(toggled(bool)), m_uiForm.moment_validScale, SLOT(setVisible(bool))); + connect(m_uiForm.dsInput, SIGNAL(dataReady(const QString&)), this, SLOT(handleSampleInputReady(const QString&))); connect(m_rangeSelectors["MomentsRangeSelector"], SIGNAL(selectionChangedLazy(double, double)), this, SLOT(rangeChanged(double, double))); connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateProperties(QtProperty*, double))); // Update the preview plot when the algorithm completes connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(momentsAlgComplete(bool))); - - m_uiForm.moment_validScale->setStyleSheet("QLabel { color : #aa0000; }"); } //---------------------------------------------------------------------------------------------- @@ -85,26 +81,21 @@ namespace CustomInterfaces void IndirectMoments::run() { - QString workspaceName = m_uiForm.moment_dsInput->getCurrentDataName(); + QString workspaceName = m_uiForm.dsInput->getCurrentDataName(); QString outputName = workspaceName.left(workspaceName.length() - 4); - QString scaleString = m_uiForm.moment_leScale->text(); - double scale = 1.0; + double scale = m_uiForm.spScale->value(); double eMin = m_dblManager->value(m_properties["EMin"]); double eMax = m_dblManager->value(m_properties["EMax"]); - bool plot = m_uiForm.moment_ckPlot->isChecked(); - bool verbose = m_uiForm.moment_ckVerbose->isChecked(); - bool save = m_uiForm.moment_ckSave->isChecked(); - - if(!scaleString.isEmpty()) - scale = scaleString.toDouble(); + bool plot = m_uiForm.ckPlot->isChecked(); + bool verbose = m_uiForm.ckVerbose->isChecked(); + bool save = m_uiForm.ckSave->isChecked(); std::string outputWorkspaceName = outputName.toStdString() + "_Moments"; IAlgorithm_sptr momentsAlg = AlgorithmManager::Instance().create("SofQWMoments", -1); momentsAlg->initialize(); momentsAlg->setProperty("Sample", workspaceName.toStdString()); - momentsAlg->setProperty("Scale", scale); momentsAlg->setProperty("EnergyMin", eMin); momentsAlg->setProperty("EnergyMax", eMax); momentsAlg->setProperty("Plot", plot); @@ -112,6 +103,9 @@ namespace CustomInterfaces momentsAlg->setProperty("Save", save); momentsAlg->setProperty("OutputWorkspace", outputWorkspaceName); + if(m_uiForm.ckScale->isChecked()) + momentsAlg->setProperty("Scale", scale); + // Set the workspace name for Python script export m_pythonExportWsName = outputWorkspaceName + "_M0"; @@ -123,10 +117,7 @@ namespace CustomInterfaces { UserInputValidator uiv; - uiv.checkDataSelectorIsValid("Sample input", m_uiForm.moment_dsInput); - - if (m_uiForm.moment_ckScale->isChecked()) - uiv.checkFieldIsValid("A valid scale must be supplied.\n", m_uiForm.moment_leScale, m_uiForm.moment_validScale); + uiv.checkDataSelectorIsValid("Sample input", m_uiForm.dsInput); QString msg = uiv.generateErrorMessage(); if (!msg.isEmpty()) @@ -209,25 +200,20 @@ namespace CustomInterfaces void IndirectMoments::updatePreviewPlot(QString workspaceName) { if(workspaceName.isEmpty()) - workspaceName = m_uiForm.moment_dsInput->getCurrentDataName(); + workspaceName = m_uiForm.dsInput->getCurrentDataName(); QString outputName = workspaceName.left(workspaceName.length() - 4); - QString scaleString = m_uiForm.moment_leScale->text(); - double scale = 1.0; + double scale = m_uiForm.spScale->value(); double eMin = m_dblManager->value(m_properties["EMin"]); double eMax = m_dblManager->value(m_properties["EMax"]); - bool verbose = m_uiForm.moment_ckVerbose->isChecked(); - - if(!scaleString.isEmpty()) - scale = scaleString.toDouble(); + bool verbose = m_uiForm.ckVerbose->isChecked(); std::string outputWorkspaceName = outputName.toStdString() + "_Moments"; IAlgorithm_sptr momentsAlg = AlgorithmManager::Instance().create("SofQWMoments"); momentsAlg->initialize(); momentsAlg->setProperty("Sample", workspaceName.toStdString()); - momentsAlg->setProperty("Scale", scale); momentsAlg->setProperty("EnergyMin", eMin); momentsAlg->setProperty("EnergyMax", eMax); momentsAlg->setProperty("Plot", false); @@ -235,6 +221,9 @@ namespace CustomInterfaces momentsAlg->setProperty("Save", false); momentsAlg->setProperty("OutputWorkspace", outputWorkspaceName); + if(m_uiForm.ckScale->isChecked()) + momentsAlg->setProperty("Scale", scale); + // Make sure there are no other algorithms in the queue. // It seems to be possible to have the selctionChangedLazy signal fire multiple times // if the renage selector is moved in a certain way. @@ -252,7 +241,7 @@ namespace CustomInterfaces if(error) return; - QString workspaceName = m_uiForm.moment_dsInput->getCurrentDataName(); + QString workspaceName = m_uiForm.dsInput->getCurrentDataName(); QString outputName = workspaceName.left(workspaceName.length() - 4); std::string outputWorkspaceName = outputName.toStdString() + "_Moments"; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp index 71ee2abab166..403e3bd2b5af 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp @@ -17,9 +17,9 @@ namespace CustomInterfaces IndirectSqw::IndirectSqw(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent) { - connect(m_uiForm.sqw_ckRebinE, SIGNAL(toggled(bool)), this, SLOT(energyRebinToggle(bool))); - connect(m_uiForm.sqw_dsSampleInput, SIGNAL(loadClicked()), this, SLOT(plotContour())); + m_uiForm.setupUi(parent); + connect(m_uiForm.dsSampleInput, SIGNAL(loadClicked()), this, SLOT(plotContour())); connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(sqwAlgDone(bool))); } @@ -40,14 +40,14 @@ namespace CustomInterfaces UserInputValidator uiv; // Validate the data selector - uiv.checkDataSelectorIsValid("Sample", m_uiForm.sqw_dsSampleInput); + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSampleInput); // Validate Q binning - uiv.checkBins(m_uiForm.sqw_spQLow->value(), m_uiForm.sqw_spQWidth->value(), m_uiForm.sqw_spQHigh->value(), tolerance); + uiv.checkBins(m_uiForm.spQLow->value(), m_uiForm.spQWidth->value(), m_uiForm.spQHigh->value(), tolerance); // If selected, validate energy binning - if(m_uiForm.sqw_ckRebinE->isChecked()) - uiv.checkBins(m_uiForm.sqw_spELow->value(), m_uiForm.sqw_spEWidth->value(), m_uiForm.sqw_spEHigh->value(), tolerance); + if(m_uiForm.ckRebinInEnergy->isChecked()) + uiv.checkBins(m_uiForm.spELow->value(), m_uiForm.spEWidth->value(), m_uiForm.spEHigh->value(), tolerance); QString errorMessage = uiv.generateErrorMessage(); @@ -60,19 +60,19 @@ namespace CustomInterfaces void IndirectSqw::run() { - QString sampleWsName = m_uiForm.sqw_dsSampleInput->getCurrentDataName(); + QString sampleWsName = m_uiForm.dsSampleInput->getCurrentDataName(); QString sqwWsName = sampleWsName.left(sampleWsName.length() - 4) + "_sqw"; QString eRebinWsName = sampleWsName.left(sampleWsName.length() - 4) + "_r"; - QString rebinString = m_uiForm.sqw_spQLow->text() + "," + m_uiForm.sqw_spQWidth->text() + - "," + m_uiForm.sqw_spQHigh->text(); + QString rebinString = m_uiForm.spQLow->text() + "," + m_uiForm.spQWidth->text() + + "," + m_uiForm.spQHigh->text(); // Rebin in energy - bool rebinInEnergy = m_uiForm.sqw_ckRebinE->isChecked(); + bool rebinInEnergy = m_uiForm.ckRebinInEnergy->isChecked(); if(rebinInEnergy) { - QString eRebinString = m_uiForm.sqw_spELow->text() + "," + m_uiForm.sqw_spEWidth->text() + - "," + m_uiForm.sqw_spEHigh->text(); + QString eRebinString = m_uiForm.spELow->text() + "," + m_uiForm.spEWidth->text() + + "," + m_uiForm.spEHigh->text(); IAlgorithm_sptr energyRebinAlg = AlgorithmManager::Instance().create("Rebin"); energyRebinAlg->initialize(); @@ -88,7 +88,7 @@ namespace CustomInterfaces QString eFixed = getInstrumentDetails()["efixed-val"]; IAlgorithm_sptr sqwAlg; - QString rebinType = m_uiForm.sqw_cbRebinType->currentText(); + QString rebinType = m_uiForm.cbRebinType->currentText(); if(rebinType == "Parallelepiped (SofQW2)") sqwAlg = AlgorithmManager::Instance().create("SofQW2"); @@ -125,7 +125,7 @@ namespace CustomInterfaces m_batchAlgoRunner->addAlgorithm(sampleLogAlg, inputToAddSampleLogProps); // Save S(Q, w) workspace - if(m_uiForm.sqw_ckSave->isChecked()) + if(m_uiForm.ckSave->isChecked()) { QString saveFilename = sqwWsName + ".nxs"; @@ -157,11 +157,11 @@ namespace CustomInterfaces return; // Get the workspace name - QString sampleWsName = m_uiForm.sqw_dsSampleInput->getCurrentDataName(); + QString sampleWsName = m_uiForm.dsSampleInput->getCurrentDataName(); QString sqwWsName = sampleWsName.left(sampleWsName.length() - 4) + "_sqw"; QString pyInput = "sqw_ws = '" + sqwWsName + "'\n"; - QString plotType = m_uiForm.sqw_cbPlotType->currentText(); + QString plotType = m_uiForm.cbPlotType->currentText(); if(plotType == "Contour") { @@ -178,21 +178,6 @@ namespace CustomInterfaces m_pythonRunner.runPythonCode(pyInput); } - /** - * Enabled/disables the rebin in energy UI widgets - * - * @param state :: True to enable RiE UI, false to disable - */ - void IndirectSqw::energyRebinToggle(bool state) - { - m_uiForm.sqw_spELow->setEnabled(state); - m_uiForm.sqw_spEWidth->setEnabled(state); - m_uiForm.sqw_spEHigh->setEnabled(state); - m_uiForm.sqw_lbELow->setEnabled(state); - m_uiForm.sqw_lbEWidth->setEnabled(state); - m_uiForm.sqw_lbEHigh->setEnabled(state); - } - /** * Handles the Plot Input button * @@ -200,9 +185,9 @@ namespace CustomInterfaces */ void IndirectSqw::plotContour() { - if(m_uiForm.sqw_dsSampleInput->isValid()) + if(m_uiForm.dsSampleInput->isValid()) { - QString sampleWsName = m_uiForm.sqw_dsSampleInput->getCurrentDataName(); + QString sampleWsName = m_uiForm.dsSampleInput->getCurrentDataName(); QString convertedWsName = sampleWsName.left(sampleWsName.length() - 4) + "_rqw"; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp index 0bbe9cad0859..d0555deadabc 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp @@ -24,14 +24,16 @@ namespace CustomInterfaces IndirectSymmetrise::IndirectSymmetrise(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent) { + m_uiForm.setupUi(parent); + int numDecimals = 6; // Property Trees m_propTrees["SymmPropTree"] = new QtTreePropertyBrowser(); - m_uiForm.symm_properties->addWidget(m_propTrees["SymmPropTree"]); + m_uiForm.properties->addWidget(m_propTrees["SymmPropTree"]); m_propTrees["SymmPVPropTree"] = new QtTreePropertyBrowser(); - m_uiForm.symm_previewProperties->addWidget(m_propTrees["SymmPVPropTree"]); + m_uiForm.propertiesPreview->addWidget(m_propTrees["SymmPVPropTree"]); // Editor Factories DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(); @@ -74,7 +76,7 @@ namespace CustomInterfaces m_plots["SymmRawPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); m_plots["SymmRawPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_plots["SymmRawPlot"]->setCanvasBackground(Qt::white); - m_uiForm.symm_plot->addWidget(m_plots["SymmRawPlot"]); + m_uiForm.plotRaw->addWidget(m_plots["SymmRawPlot"]); // Indicators for Y value at each EMin position m_rangeSelectors["NegativeEMinYPos"] = new MantidWidgets::RangeSelector(m_plots["SymmRawPlot"], @@ -108,7 +110,7 @@ namespace CustomInterfaces m_plots["SymmPreviewPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); m_plots["SymmPreviewPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_plots["SymmPreviewPlot"]->setCanvasBackground(Qt::white); - m_uiForm.symm_previewPlot->addWidget(m_plots["SymmPreviewPlot"]); + m_uiForm.plotPreview->addWidget(m_plots["SymmPreviewPlot"]); // Indicators for negative and positive X range values on X axis m_rangeSelectors["NegativeE_PV"] = new MantidWidgets::RangeSelector(m_plots["SymmPreviewPlot"], @@ -135,9 +137,9 @@ namespace CustomInterfaces // Plot a new spectrum when the user changes the value of the preview spectrum connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(replotNewSpectrum(QtProperty*, double))); // Plot miniplot when file has finished loading - connect(m_uiForm.symm_dsInput, SIGNAL(dataReady(const QString&)), this, SLOT(plotRawInput(const QString&))); + connect(m_uiForm.dsInput, SIGNAL(dataReady(const QString&)), this, SLOT(plotRawInput(const QString&))); // Preview symmetrise - connect(m_uiForm.symm_previewButton, SIGNAL(clicked()), this, SLOT(preview())); + connect(m_uiForm.pbPreview, SIGNAL(clicked()), this, SLOT(preview())); // X range selectors connect(m_rangeSelectors["PositiveE_Raw"], SIGNAL(minValueChanged(double)), this, SLOT(xRangeMinChanged(double))); connect(m_rangeSelectors["PositiveE_Raw"], SIGNAL(maxValueChanged(double)), this, SLOT(xRangeMaxChanged(double))); @@ -168,7 +170,7 @@ namespace CustomInterfaces bool IndirectSymmetrise::validate() { // Check for a valid input file - if(!m_uiForm.symm_dsInput->isValid()) + if(!m_uiForm.dsInput->isValid()) return false; // EMin and EMax must be positive @@ -182,12 +184,12 @@ namespace CustomInterfaces void IndirectSymmetrise::run() { - QString workspaceName = m_uiForm.symm_dsInput->getCurrentDataName(); + QString workspaceName = m_uiForm.dsInput->getCurrentDataName(); QString outputWorkspaceName = workspaceName.left(workspaceName.length() - 4) + "_sym" + workspaceName.right(4); - bool plot = m_uiForm.symm_ckPlot->isChecked(); - bool verbose = m_uiForm.symm_ckVerbose->isChecked(); - bool save = m_uiForm.symm_ckSave->isChecked(); + bool plot = m_uiForm.ckPlot->isChecked(); + bool verbose = m_uiForm.ckVerbose->isChecked(); + bool save = m_uiForm.ckSave->isChecked(); double e_min = m_dblManager->value(m_properties["EMin"]); double e_max = m_dblManager->value(m_properties["EMax"]); @@ -246,10 +248,10 @@ namespace CustomInterfaces */ void IndirectSymmetrise::updateMiniPlots() { - if(!m_uiForm.symm_dsInput->isValid()) + if(!m_uiForm.dsInput->isValid()) return; - QString workspaceName = m_uiForm.symm_dsInput->getCurrentDataName(); + QString workspaceName = m_uiForm.dsInput->getCurrentDataName(); int spectrumNumber = static_cast(m_dblManager->value(m_properties["PreviewSpec"])); Mantid::API::MatrixWorkspace_sptr input = boost::dynamic_pointer_cast( @@ -293,7 +295,7 @@ namespace CustomInterfaces if(prop == m_properties["PreviewSpec"]) { // Get the range of possible spectra numbers - QString workspaceName = m_uiForm.symm_dsInput->getCurrentDataName(); + QString workspaceName = m_uiForm.dsInput->getCurrentDataName(); MatrixWorkspace_sptr sampleWS = AnalysisDataService::Instance().retrieveWS(workspaceName.toStdString()); int minSpectrumRange = sampleWS->getSpectrum(0)->getSpectrumNo(); int maxSpectrumRange = sampleWS->getSpectrum(sampleWS->getNumberHistograms()-1)->getSpectrumNo(); @@ -384,11 +386,11 @@ namespace CustomInterfaces connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(previewAlgDone(bool))); // Do nothing if no data has been laoded - QString workspaceName = m_uiForm.symm_dsInput->getCurrentDataName(); + QString workspaceName = m_uiForm.dsInput->getCurrentDataName(); if(workspaceName.isEmpty()) return; - bool verbose = m_uiForm.symm_ckVerbose->isChecked(); + bool verbose = m_uiForm.ckVerbose->isChecked(); double e_min = m_dblManager->value(m_properties["EMin"]); double e_max = m_dblManager->value(m_properties["EMax"]); long spectrumNumber = static_cast(m_dblManager->value(m_properties["PreviewSpec"])); @@ -420,7 +422,7 @@ namespace CustomInterfaces if(error) return; - QString workspaceName = m_uiForm.symm_dsInput->getCurrentDataName(); + QString workspaceName = m_uiForm.dsInput->getCurrentDataName(); int spectrumNumber = static_cast(m_dblManager->value(m_properties["PreviewSpec"])); MatrixWorkspace_sptr sampleWS = AnalysisDataService::Instance().retrieveWS(workspaceName.toStdString()); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp index c1d4683fad2f..cd7a75987353 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp @@ -15,17 +15,19 @@ namespace CustomInterfaces IndirectTransmission::IndirectTransmission(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent) { + m_uiForm.setupUi(parent); + // Preview plot m_plots["PreviewPlot"] = new QwtPlot(m_parentWidget); m_plots["PreviewPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); m_plots["PreviewPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_plots["PreviewPlot"]->setCanvasBackground(Qt::white); - m_uiForm.trans_plotPreview->addWidget(m_plots["PreviewPlot"]); + m_uiForm.plotPreview->addWidget(m_plots["PreviewPlot"]); // Update the preview plot when the algorithm is complete connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(transAlgDone(bool))); - connect(m_uiForm.trans_dsSampleInput, SIGNAL(dataReady(QString)), this, SLOT(dataLoaded())); - connect(m_uiForm.trans_dsCanInput, SIGNAL(dataReady(QString)), this, SLOT(dataLoaded())); + connect(m_uiForm.dsSampleInput, SIGNAL(dataReady(QString)), this, SLOT(dataLoaded())); + connect(m_uiForm.dsCanInput, SIGNAL(dataReady(QString)), this, SLOT(dataLoaded())); } //---------------------------------------------------------------------------------------------- @@ -41,8 +43,8 @@ namespace CustomInterfaces void IndirectTransmission::run() { - QString sampleWsName = m_uiForm.trans_dsSampleInput->getCurrentDataName(); - QString canWsName = m_uiForm.trans_dsCanInput->getCurrentDataName(); + QString sampleWsName = m_uiForm.dsSampleInput->getCurrentDataName(); + QString canWsName = m_uiForm.dsCanInput->getCurrentDataName(); QString outWsName = sampleWsName + "_trans"; IAlgorithm_sptr transAlg = AlgorithmManager::Instance().create("IndirectTransmissionMonitor", -1); @@ -52,9 +54,9 @@ namespace CustomInterfaces transAlg->setProperty("CanWorkspace", canWsName.toStdString()); transAlg->setProperty("OutputWorkspace", outWsName.toStdString()); - transAlg->setProperty("Verbose", m_uiForm.trans_ckVerbose->isChecked()); - transAlg->setProperty("Plot", m_uiForm.trans_ckPlot->isChecked()); - transAlg->setProperty("Save", m_uiForm.trans_ckSave->isChecked()); + transAlg->setProperty("Verbose", m_uiForm.ckVerbose->isChecked()); + transAlg->setProperty("Plot", m_uiForm.ckPlot->isChecked()); + transAlg->setProperty("Save", m_uiForm.ckSave->isChecked()); runAlgorithm(transAlg); } @@ -62,16 +64,16 @@ namespace CustomInterfaces bool IndirectTransmission::validate() { // Check if we have an appropriate instrument - QString currentInst = m_uiForm.iicInstrumentConfiguration->getInstrumentName(); + QString currentInst = "IRIS"; //m_uiForm.iicInstrumentConfiguration->getInstrumentName(); TODO if(currentInst != "IRIS" && currentInst != "OSIRIS") return false; // Check for an invalid sample input - if(!m_uiForm.trans_dsSampleInput->isValid()) + if(!m_uiForm.dsSampleInput->isValid()) return false; // Check for an invalid can input - if(!m_uiForm.trans_dsCanInput->isValid()) + if(!m_uiForm.dsCanInput->isValid()) return false; return true; @@ -85,8 +87,8 @@ namespace CustomInterfaces void IndirectTransmission::previewPlot() { - QString sampleWsName = m_uiForm.trans_dsSampleInput->getCurrentDataName(); - QString canWsName = m_uiForm.trans_dsCanInput->getCurrentDataName(); + QString sampleWsName = m_uiForm.dsSampleInput->getCurrentDataName(); + QString canWsName = m_uiForm.dsCanInput->getCurrentDataName(); QString outWsName = sampleWsName + "_trans"; IAlgorithm_sptr transAlg = AlgorithmManager::Instance().create("IndirectTransmissionMonitor", -1); @@ -96,7 +98,7 @@ namespace CustomInterfaces transAlg->setProperty("CanWorkspace", canWsName.toStdString()); transAlg->setProperty("OutputWorkspace", outWsName.toStdString()); - transAlg->setProperty("Verbose", m_uiForm.trans_ckVerbose->isChecked()); + transAlg->setProperty("Verbose", m_uiForm.ckVerbose->isChecked()); transAlg->setProperty("Plot", false); transAlg->setProperty("Save", false); @@ -111,7 +113,7 @@ namespace CustomInterfaces if(error) return; - QString sampleWsName = m_uiForm.trans_dsSampleInput->getCurrentDataName(); + QString sampleWsName = m_uiForm.dsSampleInput->getCurrentDataName(); QString outWsName = sampleWsName + "_trans"; WorkspaceGroup_sptr resultWsGroup = AnalysisDataService::Instance().retrieveWS(outWsName.toStdString()); From 179be9b43fb92f29da7e41add2f96c3d7db00b47 Mon Sep 17 00:00:00 2001 From: Anton Piccardo-Selg Date: Tue, 27 Jan 2015 11:21:20 +0000 Subject: [PATCH 066/130] Refs #10959 Moving slice algorithm dialog to MantidWidgets --- Code/Mantid/MantidQt/CustomDialogs/CMakeLists.txt | 3 --- Code/Mantid/MantidQt/MantidWidgets/CMakeLists.txt | 5 ++++- .../inc/MantidQtMantidWidgets}/SlicingAlgorithmDialog.h | 0 .../inc/MantidQtMantidWidgets}/SlicingAlgorithmDialog.ui | 0 .../src/SlicingAlgorithmDialog.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename Code/Mantid/MantidQt/{CustomDialogs/inc/MantidQtCustomDialogs => MantidWidgets/inc/MantidQtMantidWidgets}/SlicingAlgorithmDialog.h (100%) rename Code/Mantid/MantidQt/{CustomDialogs/inc/MantidQtCustomDialogs => MantidWidgets/inc/MantidQtMantidWidgets}/SlicingAlgorithmDialog.ui (100%) rename Code/Mantid/MantidQt/{CustomDialogs => MantidWidgets}/src/SlicingAlgorithmDialog.cpp (99%) diff --git a/Code/Mantid/MantidQt/CustomDialogs/CMakeLists.txt b/Code/Mantid/MantidQt/CustomDialogs/CMakeLists.txt index b27d919b32bd..cd1fcd58f96e 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/CMakeLists.txt +++ b/Code/Mantid/MantidQt/CustomDialogs/CMakeLists.txt @@ -12,7 +12,6 @@ set ( SRC_FILES src/CatalogPublishDialog.cpp src/MantidGLWidget.cpp src/PlotAsymmetryByLogValueDialog.cpp src/SampleShapeHelpers.cpp - src/SlicingAlgorithmDialog.cpp src/SmoothNeighboursDialog.cpp src/SortTableWorkspaceDialog.cpp ) @@ -34,7 +33,6 @@ set ( MOC_FILES inc/MantidQtCustomDialogs/CatalogPublishDialog.h inc/MantidQtCustomDialogs/MantidGLWidget.h inc/MantidQtCustomDialogs/PlotAsymmetryByLogValueDialog.h inc/MantidQtCustomDialogs/SampleShapeHelpers.h - inc/MantidQtCustomDialogs/SlicingAlgorithmDialog.h inc/MantidQtCustomDialogs/SmoothNeighboursDialog.h inc/MantidQtCustomDialogs/SortTableWorkspaceDialog.h ) @@ -53,7 +51,6 @@ set ( UI_FILES inc/MantidQtCustomDialogs/CatalogPublishDialog.ui inc/MantidQtCustomDialogs/LoadDialog.ui inc/MantidQtCustomDialogs/LoadInstrumentDialog.ui inc/MantidQtCustomDialogs/StartLiveDataDialog.ui - inc/MantidQtCustomDialogs/SlicingAlgorithmDialog.ui inc/MantidQtCustomDialogs/FitDialog.ui inc/MantidQtCustomDialogs/SortTableWorkspaceDialog.ui ) diff --git a/Code/Mantid/MantidQt/MantidWidgets/CMakeLists.txt b/Code/Mantid/MantidQt/MantidWidgets/CMakeLists.txt index c7a613275f15..2307030baf01 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/CMakeLists.txt +++ b/Code/Mantid/MantidQt/MantidWidgets/CMakeLists.txt @@ -32,7 +32,8 @@ set ( SRC_FILES src/ScriptEditor.cpp src/SelectFunctionDialog.cpp src/SelectWorkspacesDialog.cpp - src/SequentialFitDialog.cpp + src/SequentialFitDialog.cpp + src/SlicingAlgorithmDialog.cpp src/StringDialogEditor.cpp src/StringEditorFactory.cpp src/UserFunctionDialog.cpp @@ -80,6 +81,7 @@ set ( MOC_FILES inc/MantidQtMantidWidgets/SelectFunctionDialog.h inc/MantidQtMantidWidgets/SelectWorkspacesDialog.h inc/MantidQtMantidWidgets/SequentialFitDialog.h + inc/MantidQtMantidWidgets/SlicingAlgorithmDialog.h inc/MantidQtMantidWidgets/StringDialogEditor.h inc/MantidQtMantidWidgets/StringEditorFactory.h inc/MantidQtMantidWidgets/UserFunctionDialog.h @@ -111,6 +113,7 @@ set ( UI_FILES inc/MantidQtMantidWidgets/RenameParDialog.ui inc/MantidQtMantidWidgets/SelectFunctionDialog.ui inc/MantidQtMantidWidgets/SequentialFitDialog.ui + inc/MantidQtMantidWidgets/SlicingAlgorithmDialog.ui inc/MantidQtMantidWidgets/UserFunctionDialog.ui inc/MantidQtMantidWidgets/pqHelpWindow.ui ) diff --git a/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SlicingAlgorithmDialog.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SlicingAlgorithmDialog.h similarity index 100% rename from Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SlicingAlgorithmDialog.h rename to Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SlicingAlgorithmDialog.h diff --git a/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SlicingAlgorithmDialog.ui b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SlicingAlgorithmDialog.ui similarity index 100% rename from Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SlicingAlgorithmDialog.ui rename to Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SlicingAlgorithmDialog.ui diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp similarity index 99% rename from Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp rename to Code/Mantid/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp index 89c798bbb089..accd00dacb6a 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomDialogs/SlicingAlgorithmDialog.h" +#include "MantidQtMantidWidgets/SlicingAlgorithmDialog.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/AlgorithmManager.h" From 6acc0450cffc016414ee36e09dd0ebc5a1b4b1b2 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 12:28:21 +0000 Subject: [PATCH 067/130] Work in progress replaceing other IDR tabs Refs #10960 --- .../Indirect/IndirectCalibration.h | 5 +- .../Indirect/IndirectCalibration.ui | 2 +- .../Indirect/IndirectConvertToEnergy.h | 4 +- .../Indirect/IndirectConvertToEnergy.ui | 28 +- .../Indirect/IndirectDataReduction.h | 1 - .../Indirect/IndirectDataReduction.ui | 1493 +---------------- .../Indirect/IndirectDiagnostics.h | 3 +- .../Indirect/IndirectDiagnostics.ui | 6 +- .../src/Indirect/IndirectCalibration.cpp | 156 +- .../src/Indirect/IndirectConvertToEnergy.cpp | 298 +--- .../src/Indirect/IndirectDiagnostics.cpp | 68 +- 11 files changed, 165 insertions(+), 1899 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h index c14ec0a22ba8..074b21039483 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_INDIRECTCALIBRATION_H_ #include "IndirectDataReductionTab.h" - +#include "ui_IndirectCalibration.h" #include "MantidKernel/System.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" @@ -56,8 +56,6 @@ namespace CustomInterfaces void calUpdateRS(QtProperty*, double); void calSetDefaultResolution(Mantid::API::MatrixWorkspace_const_sptr ws); void resCheck(bool state); ///< handles checking/unchecking of "Create RES File" checkbox - void intensityScaleMultiplierCheck(bool state); /// Toggle the intensity scale multiplier box - void calibValidateIntensity(const QString & text); /// Check that the scale multiplier is valid void setDefaultInstDetails(); void pbRunEditing(); //< Called when a user starts to type / edit the runs to load. void pbRunFinding(); //< Called when the FileFinder starts finding the files. @@ -66,6 +64,7 @@ namespace CustomInterfaces private: void createRESfile(const QString& file); + Ui::IndirectCalibration m_uiForm; QString m_lastCalPlotFilename; }; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui index 468b236c1416..adbfa401df8b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.ui @@ -238,7 +238,7 @@ MantidQt::MantidWidgets::MWRunFiles QWidget -
mantidqt::mantidwidgets::mwrunfiles.h
+
MantidQtMantidWidgets/MWRunFiles.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h index 5c430ced51fb..80d0c7b11f5a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_INDIRECTCONVERTTOENERGY_H_ #include "IndirectDataReductionTab.h" - +#include "ui_IndirectConvertToEnergy.h" #include "MantidKernel/System.h" #include "MantidQtCustomInterfaces/Background.h" @@ -65,6 +65,8 @@ namespace CustomInterfaces void plotRawComplete(bool error); //< Called when the Plot Raw algorithmm chain completes private: + Ui::IndirectConvertToEnergy m_uiForm; + Background *m_backgroundDialog; ///< background removal dialog bool m_bgRemoval; ///< whether user has set values for BG removal diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui index b294d5b0f330..a0dae0df83e2 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui @@ -481,12 +481,12 @@ 0
- + Do not perform rebinning step on this data. - Rebin + Do Not Rebin true @@ -815,7 +815,7 @@ - + None @@ -881,16 +881,16 @@ Later steps in the process (saving, renaming) will not be done. MantidQt::MantidWidgets::MWRunFiles QWidget -
mantidqt::mantidwidgets::mwrunfiles.h
+
MantidQtMantidWidgets/MWRunFiles.h
- ckRebin + ckDoNotRebin toggled(bool) cbRebinType - setEnabled(bool) + setDisabled(bool) 69 @@ -903,10 +903,10 @@ Later steps in the process (saving, renaming) will not be done. - ckRebin + ckDoNotRebin toggled(bool) leRebinString - setEnabled(bool) + setDisabled(bool) 46 @@ -967,10 +967,10 @@ Later steps in the process (saving, renaming) will not be done. - ckRebin + ckDoNotRebin toggled(bool) spRebinLow - setEnabled(bool) + setDisabled(bool) 46 @@ -983,10 +983,10 @@ Later steps in the process (saving, renaming) will not be done. - ckRebin + ckDoNotRebin toggled(bool) spRebinWidth - setEnabled(bool) + setDisabled(bool) 46 @@ -999,10 +999,10 @@ Later steps in the process (saving, renaming) will not be done. - ckRebin + ckDoNotRebin toggled(bool) lbRebinHigh - setEnabled(bool) + setDisabled(bool) 46 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h index 0f3219bbbe12..5410445177de 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h @@ -111,7 +111,6 @@ namespace MantidQt void saveSettings(); /// Set and show an instrument-specific widget - void setInstSpecificWidget(const std::string & parameterName, QCheckBox * checkBox, QCheckBox::ToggleState defaultState); virtual void closeEvent(QCloseEvent* close); /// The .ui form generated by Qt Designer diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui index 24db13c1d401..3beeaa0146fc 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui @@ -78,1504 +78,16 @@ Energy Transfer - - - - - Input - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - - - - - - - - 0 - 41 - - - - Run Files - - - true - - - - - - - false - - - - 0 - 41 - - - - false - - - Calibration File - - - false - - - true - - - - _calib.nxs - - - - - - - - - - - - Sum multiple files together. - - - Sum Files - - - - - - - Load Logs - - - - - - - Use calibration file to adjust for detector efficiency. - - - Use Calib File - - - - - - - - - - - 6 - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - Grouping - - - cbMappingOptions - - - - - - - Select type of detector grouping to apply. - - - - Default - - - - - Individual - - - - - Groups - - - - - All - - - - - File - - - - - - - - 0 - - - 0 - - - - - - - - 0 - 41 - - - - false - - - - - - false - - - - - - - .map - - - - - - - - - - - - Number of Groups: - - - leNoGroups - - - - - - - Desired number of groups. - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - Remove a range of background value. - - - Background Removal - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot raw time values. - - - Plot Time - - - - - - - - - - - - - - - - Analysis - - - - QLayout::SetDefaultConstraint - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Detailed Balance - - - - - - - - 112 - 16777215 - - - - 300 - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - Kelvin - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Scale: Multiply by - - - - - - - 1.0 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#ff0000;">*</span></p></body></html> - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - Conversion to Energy Transfer - - - - 0 - - - 0 - - - - - 0 - - - - - - - Efixed value: - - - leEfixed - - - - - - - false - - - Value of Efixed for conversion from time to energy. - - - - - - - Spectra Min: - - - leSpectraMin - - - - - - - Minimum spectra number for data. - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - Spectra Max - - - leSpectraMax - - - - - - - Maximum spectra number for data. - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - - - - - - - - 0 - - - - - 0 - - - 0 - - - - - Energy Transfer Range (meV) - - - - 6 - - - 6 - - - - - - - Rebin Steps: - - - - - - - - 0 - 0 - - - - - Single - - - - - Multiple - - - - - - - - 0 - - - - - 0 - - - 0 - - - - - 6 - - - 6 - - - - - Low - - - entryRebinLow - - - - - - - - 0 - 0 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">x<span style=" vertical-align:sub;">1 </span>value for rebinning (start point for range of bins)</p></body></html> - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Width - - - entryRebinWidth - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Δx<span style=" vertical-align:sub;">1</span> for rebinning (width of bins)</p></body></html> - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - High - - - entryRebinHigh - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x<span style=" vertical-align:sub;">2</span> value for rebinning (end point for range of bins)</p></body></html> - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - - - - - 0 - - - 0 - - - - - Rebin String - - - - - - - - - - - - - - - - 0 - - - - - Do not perform rebinning step on this data. - - - Do Not Rebin - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 40 - 40 - - - - - - - - Output - - - - 6 - - - 6 - - - 6 - - - 0 - - - 0 - - - - - - - Select Save Formats: - - - - - - - Save file in SPE format. - - - SPE - - - false - - - - - - - Save file in Nexus format. - - - NeXus - - - - - - - NXSPE - - - - - - - ASCII - - - - - - - Aclimax - - - - - - - DaveGrp - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Plot Output: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - None - - - - - Spectra - - - - - Contour - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - If this box is unchecked and the raw files are determined to contain multiple frames, then the reduction process will end at the step where they would have been folded together. -Later steps in the process (saving, renaming) will not be done. - - - Fold Multiple Frames - - - true - - - - - - - Output in cm-1 - - - - - - - - -
Calibration - - - - - - - - - Input - - - - - - - - - 0 - 41 - - - - Run No - - - true - - - - - - - .raw - - - - - - - - Plot first detector spectra - - - Plot Raw - - - - - - - - - - - Intensity Scale Factor - - - - - - - false - - - - 0 - 0 - - - - - 50 - 16777215 - - - - 1.0 - - - - - - - - - - - 10 - 20 - - - - - 10 - 0 - - - - - - - - - 170 - 0 - 0 - - - - - - - - - 170 - 0 - 0 - - - - - - - - - 118 - 116 - 108 - - - - - - - - * - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - - - - - Calibration - - - - - - - - - - - - - - - Resolution - - - - - - - - - - false - - - Scale RES: - - - - - - - false - - - - 0 - 0 - - - - 1.0 - - - - - - - - - - Create RES file - - - Create RES File - - - - - - - Apply WienerSmooth algorithm to resolution - - - Smooth RES - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Output - - - - - - - - Verbose - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot resulting calibration file when created. - - - Plot Result - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - - - Diagnostics - - - - - Input - - - - - - - - - 0 - 41 - - - - true - - - Input Files - - - true - - - - .raw - - - - - - - - - - - - - 0 - 0 - - - - Use Calibration - - - - - - - - 0 - 0 - - - - true - - - - - - - _calib - - - - - _calib.nxs - - - - false - - - - - - - - - - - - Time Slice - - - - - - - - - - - - - - - Preview - - - - - - - - - - - - Output - - - - - - - - true - - - Verbose - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Result - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - - - @@ -1724,9 +236,10 @@ Later steps in the process (saving, renaming) will not be done. twIDRTabs + pbHelp + pbPythonExport + pbRun pbManageDirectories - cal_ckVerbose - cal_ckSave diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h index 72b6dcc0609f..d1f2defef108 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_INDIRECTDIAGNOSTICS_H_ #include "IndirectDataReductionTab.h" - +#include "ui_IndirectDiagnostics.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/System.h" @@ -79,6 +79,7 @@ namespace CustomInterfaces void pbRunFinished(); //< Called when the FileFinder has finished finding the files. private: + Ui::IndirectDiagnostics m_uiForm; QString m_lastDiagFilename; }; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui index 85b8f54f644f..a8f59082c4f4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.ui @@ -23,7 +23,7 @@ - + 0 @@ -189,12 +189,12 @@ MantidQt::MantidWidgets::MWRunFiles QWidget -
mantidqt::mantidwidgets::mwrunfiles.h
+
MantidQtMantidWidgets/MWRunFiles.h
MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp index c67673eb9a51..21fb45b4c6a1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp @@ -24,12 +24,14 @@ namespace CustomInterfaces IndirectCalibration::IndirectCalibration(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent), m_lastCalPlotFilename("") { + m_uiForm.setupUi(parent); + DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(); // CAL PROPERTY TREE m_propTrees["CalPropTree"] = new QtTreePropertyBrowser(); m_propTrees["CalPropTree"]->setFactoryForManager(m_dblManager, doubleEditorFactory); - m_uiForm.cal_treeCal->addWidget(m_propTrees["CalPropTree"]); + m_uiForm.propertiesCalibration->addWidget(m_propTrees["CalPropTree"]); // Cal Property Tree: Peak/Background m_properties["CalPeakMin"] = m_dblManager->addProperty("Peak Min"); @@ -47,7 +49,7 @@ namespace CustomInterfaces m_plots["CalPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); m_plots["CalPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_plots["CalPlot"]->setCanvasBackground(Qt::white); - m_uiForm.cal_plotCal->addWidget(m_plots["CalPlot"]); + m_uiForm.plotCalibration->addWidget(m_plots["CalPlot"]); // Cal plot range selectors m_rangeSelectors["CalPeak"] = new MantidWidgets::RangeSelector(m_plots["CalPlot"]); @@ -57,7 +59,7 @@ namespace CustomInterfaces // RES PROPERTY TREE m_propTrees["ResPropTree"] = new QtTreePropertyBrowser(); m_propTrees["ResPropTree"]->setFactoryForManager(m_dblManager, doubleEditorFactory); - m_uiForm.cal_treeRes->addWidget(m_propTrees["ResPropTree"]); + m_uiForm.loResolutionOptions->addWidget(m_propTrees["ResPropTree"]); // Res Property Tree: Spectra Selection m_properties["ResSpecMin"] = m_dblManager->addProperty("Spectra Min"); @@ -104,7 +106,7 @@ namespace CustomInterfaces m_plots["ResPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); m_plots["ResPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_plots["ResPlot"]->setCanvasBackground(Qt::white); - m_uiForm.cal_plotRes->addWidget(m_plots["ResPlot"]); + m_uiForm.plotResolution->addWidget(m_plots["ResPlot"]); // Res plot range selectors // Create ResBackground first so ResPeak is drawn above it @@ -114,11 +116,6 @@ namespace CustomInterfaces m_rangeSelectors["ResPeak"] = new MantidWidgets::RangeSelector(m_plots["ResPlot"], MantidQt::MantidWidgets::RangeSelector::XMINMAX, true, true); - // MISC UI - m_uiForm.cal_leIntensityScaleMultiplier->setValidator(m_valDbl); - m_uiForm.cal_leResScale->setValidator(m_valDbl); - m_uiForm.cal_valIntensityScaleMultiplier->setText(" "); - // SIGNAL/SLOT CONNECTIONS // Update instrument information when a new instrument config is selected connect(this, SIGNAL(newInstrumentConfiguration()), this, SLOT(setDefaultInstDetails())); @@ -137,27 +134,21 @@ namespace CustomInterfaces // Update range selctor positions when a value in the double manager changes connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(calUpdateRS(QtProperty*, double))); // Plot miniplots after a file has loaded - connect(m_uiForm.cal_leRunNo, SIGNAL(filesFound()), this, SLOT(calPlotRaw())); + connect(m_uiForm.leRunNo, SIGNAL(filesFound()), this, SLOT(calPlotRaw())); // Plot miniplots when the user clicks Plot Raw - connect(m_uiForm.cal_pbPlot, SIGNAL(clicked()), this, SLOT(calPlotRaw())); + connect(m_uiForm.pbPlotRaw, SIGNAL(clicked()), this, SLOT(calPlotRaw())); // Toggle RES file options when user toggles Create RES File checkbox - connect(m_uiForm.cal_ckRES, SIGNAL(toggled(bool)), this, SLOT(resCheck(bool))); - // Enable/disable RES scaling option when user toggles Scale RES checkbox - connect(m_uiForm.cal_ckResScale, SIGNAL(toggled(bool)), m_uiForm.cal_leResScale, SLOT(setEnabled(bool))); - // Enable/dosable scale factor option when user toggles Intensity Scale Factor checkbox - connect(m_uiForm.cal_ckIntensityScaleMultiplier, SIGNAL(toggled(bool)), this, SLOT(intensityScaleMultiplierCheck(bool))); - // Validate the value entered in scale factor option whenever it changes - connect(m_uiForm.cal_leIntensityScaleMultiplier, SIGNAL(textChanged(const QString &)), this, SLOT(calibValidateIntensity(const QString &))); + connect(m_uiForm.ckCreateResolution, SIGNAL(toggled(bool)), this, SLOT(resCheck(bool))); // Shows message on run buton when user is inputting a run number - connect(m_uiForm.cal_leRunNo, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); + connect(m_uiForm.leRunNo, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); // Shows message on run button when Mantid is finding the file for a given run number - connect(m_uiForm.cal_leRunNo, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); + connect(m_uiForm.leRunNo, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); // Reverts run button back to normal when file finding has finished - connect(m_uiForm.cal_leRunNo, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); + connect(m_uiForm.leRunNo, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); // Nudge resCheck to ensure res range selectors are only shown when Create RES file is checked - resCheck(m_uiForm.cal_ckRES->isChecked()); + resCheck(m_uiForm.ckCreateResolution->isChecked()); } //---------------------------------------------------------------------------------------------- @@ -176,8 +167,8 @@ namespace CustomInterfaces connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmsComplete(bool))); // Get properties - QString firstFile = m_uiForm.cal_leRunNo->getFirstFilename(); - QString filenames = m_uiForm.cal_leRunNo->getFilenames().join(","); + QString firstFile = m_uiForm.leRunNo->getFirstFilename(); + QString filenames = m_uiForm.leRunNo->getFilenames().join(","); auto instDetails = getInstrumentDetails(); QString instDetectorRange = instDetails["spectra-min"] + "," + instDetails["spectra-max"]; @@ -186,8 +177,8 @@ namespace CustomInterfaces QString backgroundRange = m_properties["CalBackMin"]->valueText() + "," + m_properties["CalBackMax"]->valueText(); QFileInfo firstFileInfo(firstFile); - QString outputWorkspaceNameStem = firstFileInfo.baseName() + "_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() - + m_uiForm.iicInstrumentConfiguration->getReflectionName(); + QString outputWorkspaceNameStem = "IRS"; //firstFileInfo.baseName() + "_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() +// + m_uiForm.iicInstrumentConfiguration->getReflectionName(); TODO QString calibrationWsName = outputWorkspaceNameStem + "_calib"; @@ -200,14 +191,12 @@ namespace CustomInterfaces calibrationAlg->setProperty("DetectorRange", instDetectorRange.toStdString()); calibrationAlg->setProperty("PeakRange", peakRange.toStdString()); calibrationAlg->setProperty("BackgroundRange", backgroundRange.toStdString()); - calibrationAlg->setProperty("Plot", m_uiForm.cal_ckPlotResult->isChecked()); + calibrationAlg->setProperty("Plot", m_uiForm.ckPlot->isChecked()); - if(m_uiForm.cal_ckIntensityScaleMultiplier->isChecked()) + if(m_uiForm.ckScale->isChecked()) { - QString scale = m_uiForm.cal_leIntensityScaleMultiplier->text(); - if(scale.isEmpty()) - scale = "1.0"; - calibrationAlg->setProperty("ScaleFactor", scale.toStdString()); + double scale = m_uiForm.spScale->value(); + calibrationAlg->setProperty("ScaleFactor", scale); } m_batchAlgoRunner->addAlgorithm(calibrationAlg); @@ -220,7 +209,7 @@ namespace CustomInterfaces inputFromCalProps["InputWorkspace"] = calibrationWsName.toStdString(); // Add save algorithm to queue if ticked - if( m_uiForm.cal_ckSave->isChecked() ) + if( m_uiForm.ckSave->isChecked() ) { IAlgorithm_sptr saveAlg = AlgorithmManager::Instance().create("SaveNexus", -1); saveAlg->initialize(); @@ -230,13 +219,13 @@ namespace CustomInterfaces } // Configure the resolution algorithm - if(m_uiForm.cal_ckRES->isChecked()) + if(m_uiForm.ckCreateResolution->isChecked()) { QString resolutionWsName = outputWorkspaceNameStem + "_res"; QString scaleFactor("1.0"); - if(m_uiForm.cal_ckResScale->isChecked() && !m_uiForm.cal_leResScale->text().isEmpty()) - scaleFactor = m_uiForm.cal_leResScale->text(); + if(m_uiForm.ckResolutionScale->isChecked() && !m_uiForm.spResolutionScale->text().isEmpty()) + scaleFactor = m_uiForm.spResolutionScale->text(); QString resDetectorRange = QString::number(m_dblManager->value(m_properties["ResSpecMin"])) + "," + QString::number(m_dblManager->value(m_properties["ResSpecMax"])); @@ -251,19 +240,20 @@ namespace CustomInterfaces Mantid::API::IAlgorithm_sptr resAlg = Mantid::API::AlgorithmManager::Instance().create("IndirectResolution", -1); resAlg->initialize(); + //TODO resAlg->setProperty("InputFiles", filenames.toStdString()); resAlg->setProperty("OutputWorkspace", resolutionWsName.toStdString()); - resAlg->setProperty("Instrument", m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); - resAlg->setProperty("Analyser", m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); - resAlg->setProperty("Reflection", m_uiForm.iicInstrumentConfiguration->getReflectionName().toStdString()); + resAlg->setProperty("Instrument", "IRIS"); //m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); + resAlg->setProperty("Analyser", "graphite"); //m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); + resAlg->setProperty("Reflection", "002"); //m_uiForm.iicInstrumentConfiguration->getReflectionName().toStdString()); resAlg->setProperty("RebinParam", rebinString.toStdString()); resAlg->setProperty("DetectorRange", resDetectorRange.toStdString()); resAlg->setProperty("BackgroundRange", background.toStdString()); - resAlg->setProperty("ScaleFactor", m_uiForm.cal_leIntensityScaleMultiplier->text().toDouble()); - resAlg->setProperty("Smooth", m_uiForm.cal_ckSmooth->isChecked()); - resAlg->setProperty("Verbose", m_uiForm.cal_ckVerbose->isChecked()); - resAlg->setProperty("Plot", m_uiForm.cal_ckPlotResult->isChecked()); - resAlg->setProperty("Save", m_uiForm.cal_ckSave->isChecked()); + resAlg->setProperty("ScaleFactor", m_uiForm.spScale->value()); + resAlg->setProperty("Smooth", m_uiForm.ckSmoothResolution->isChecked()); + resAlg->setProperty("Verbose", m_uiForm.ckVerbose->isChecked()); + resAlg->setProperty("Plot", m_uiForm.ckPlot->isChecked()); + resAlg->setProperty("Save", m_uiForm.ckSave->isChecked()); m_batchAlgoRunner->addAlgorithm(resAlg); @@ -279,12 +269,12 @@ namespace CustomInterfaces if(error) return; - QString firstFile = m_uiForm.cal_leRunNo->getFirstFilename(); + QString firstFile = m_uiForm.leRunNo->getFirstFilename(); QFileInfo firstFileInfo(firstFile); - QString calFileName = firstFileInfo.baseName() + "_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() + m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_calib.nxs"; + /* QString calFileName = firstFileInfo.baseName() + "_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() + m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_calib.nxs"; */ - m_uiForm.ind_calibFile->setFileTextWithSearch(calFileName); - m_uiForm.ckUseCalib->setChecked(true); + /* m_uiForm.ind_calibFile->setFileTextWithSearch(calFileName); */ + /* m_uiForm.ckUseCalib->setChecked(true); */ disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmsComplete(bool))); } @@ -293,7 +283,7 @@ namespace CustomInterfaces { MantidQt::CustomInterfaces::UserInputValidator uiv; - uiv.checkMWRunFilesIsValid("Run", m_uiForm.cal_leRunNo); + uiv.checkMWRunFilesIsValid("Run", m_uiForm.leRunNo); auto peakRange = std::make_pair(m_dblManager->value(m_properties["CalPeakMin"]), m_dblManager->value(m_properties["CalPeakMax"])); auto backRange = std::make_pair(m_dblManager->value(m_properties["CalBackMin"]), m_dblManager->value(m_properties["CalBackMax"])); @@ -302,7 +292,7 @@ namespace CustomInterfaces uiv.checkValidRange("Back Range", backRange); uiv.checkRangesDontOverlap(peakRange, backRange); - if ( m_uiForm.cal_ckRES->isChecked() ) + if ( m_uiForm.ckCreateResolution->isChecked() ) { auto backgroundRange = std::make_pair(m_dblManager->value(m_properties["ResStart"]), m_dblManager->value(m_properties["ResEnd"])); uiv.checkValidRange("Background", backgroundRange); @@ -314,17 +304,6 @@ namespace CustomInterfaces uiv.checkBins(eLow, eWidth, eHigh); } - if( m_uiForm.cal_ckIntensityScaleMultiplier->isChecked() - && m_uiForm.cal_leIntensityScaleMultiplier->text().isEmpty() ) - { - uiv.addErrorMessage("You must enter a scale for the calibration file"); - } - - if( m_uiForm.cal_ckResScale->isChecked() && m_uiForm.cal_leResScale->text().isEmpty() ) - { - uiv.addErrorMessage("You must enter a scale for the resolution file"); - } - QString error = uiv.generateErrorMessage(); if(error != "") @@ -362,7 +341,7 @@ namespace CustomInterfaces { setDefaultInstDetails(); - QString filename = m_uiForm.cal_leRunNo->getFirstFilename(); + QString filename = m_uiForm.leRunNo->getFirstFilename(); // Don't do anything if the file we would plot has not changed if(filename == m_lastCalPlotFilename) @@ -412,24 +391,25 @@ namespace CustomInterfaces */ void IndirectCalibration::calPlotEnergy() { - if ( ! m_uiForm.cal_leRunNo->isValid() ) + if ( ! m_uiForm.leRunNo->isValid() ) { emit showMessageBox("Run number not valid."); return; } - QString files = m_uiForm.cal_leRunNo->getFilenames().join(","); + QString files = m_uiForm.leRunNo->getFilenames().join(","); - QFileInfo fi(m_uiForm.cal_leRunNo->getFirstFilename()); + QFileInfo fi(m_uiForm.leRunNo->getFirstFilename()); QString detRange = QString::number(m_dblManager->value(m_properties["ResSpecMin"])) + "," + QString::number(m_dblManager->value(m_properties["ResSpecMax"])); + //TODO IAlgorithm_sptr reductionAlg = AlgorithmManager::Instance().create("InelasticIndirectReduction"); reductionAlg->initialize(); - reductionAlg->setProperty("Instrument", m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); - reductionAlg->setProperty("Analyser", m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); - reductionAlg->setProperty("Reflection", m_uiForm.iicInstrumentConfiguration->getReflectionName().toStdString()); + reductionAlg->setProperty("Instrument", "IRIS"); //m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); + reductionAlg->setProperty("Analyser", "graphite"); //m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); + reductionAlg->setProperty("Reflection", "002"); //m_uiForm.iicInstrumentConfiguration->getReflectionName().toStdString()); reductionAlg->setProperty("InputFiles", files.toStdString()); reductionAlg->setProperty("OutputWorkspace", "__IndirectCalibration_reduction"); reductionAlg->setProperty("DetectorRange", detRange.toStdString()); @@ -587,38 +567,8 @@ namespace CustomInterfaces m_rangeSelectors["ResBackground"]->setVisible(state); // Toggle scale and smooth options - m_uiForm.cal_ckResScale->setEnabled(state); - m_uiForm.cal_ckResScale->setChecked(false); - m_uiForm.cal_ckSmooth->setEnabled(state); - } - - /** - * Enables or disables the scale multiplier input box when - * the check box state changes - * - * @param state :: True to enable input, false to disable - */ - void IndirectCalibration::intensityScaleMultiplierCheck(bool state) - { - m_uiForm.cal_leIntensityScaleMultiplier->setEnabled(state); - } - - /** - * Hides/shows the required indicator of the scale multiplier - * input box - * - * @param text :: Text currently in box - */ - void IndirectCalibration::calibValidateIntensity(const QString & text) - { - if(!text.isEmpty()) - { - m_uiForm.cal_valIntensityScaleMultiplier->setText(" "); - } - else - { - m_uiForm.cal_valIntensityScaleMultiplier->setText("*"); - } + m_uiForm.ckResolutionScale->setEnabled(state); + m_uiForm.ckSmoothResolution->setEnabled(state); } /** @@ -635,7 +585,7 @@ namespace CustomInterfaces void IndirectCalibration::pbRunFinding() { emit updateRunButton(false, "Finding files...", "Searchig for data files for the run numbers entered..."); - m_uiForm.cal_leRunNo->setEnabled(false); + m_uiForm.leRunNo->setEnabled(false); } /** @@ -643,7 +593,7 @@ namespace CustomInterfaces */ void IndirectCalibration::pbRunFinished() { - if(!m_uiForm.cal_leRunNo->isValid()) + if(!m_uiForm.leRunNo->isValid()) { emit updateRunButton(false, "Invalid Run(s)", "Cannot find data files for some of the run numbers enetered."); } @@ -652,7 +602,7 @@ namespace CustomInterfaces emit updateRunButton(); } - m_uiForm.cal_leRunNo->setEnabled(true); + m_uiForm.leRunNo->setEnabled(true); } } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp index e55a58c742bf..0894b03e7a38 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp @@ -17,17 +17,10 @@ namespace CustomInterfaces IndirectConvertToEnergy::IndirectConvertToEnergy(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent), m_backgroundDialog(NULL), m_bgRemoval(false) { + m_uiForm.setupUi(parent); + // Add validators to UI form - m_uiForm.leScaleMultiplier->setValidator(m_valPosDbl); m_uiForm.leNoGroups->setValidator(m_valInt); - m_uiForm.leDetailedBalance->setValidator(m_valPosDbl); - - m_uiForm.leSpectraMin->setValidator(m_valInt); - m_uiForm.leSpectraMax->setValidator(m_valInt); - - m_uiForm.entryRebinLow->setValidator(m_valDbl); - m_uiForm.entryRebinWidth->setValidator(m_valDbl); - m_uiForm.entryRebinHigh->setValidator(m_valDbl); // SIGNAL/SLOT CONNECTIONS // Update instrument information when a new instrument config is selected @@ -35,40 +28,22 @@ namespace CustomInterfaces // Shows required mapping option UI widgets when a new mapping option is selected from drop down connect(m_uiForm.cbMappingOptions, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(mappingOptionSelected(const QString&))); // Shows background removal dialog when user clicks Background Removal - connect(m_uiForm.pbBack_2, SIGNAL(clicked()), this, SLOT(backgroundClicked())); + connect(m_uiForm.pbBackgroundRemoval, SIGNAL(clicked()), this, SLOT(backgroundClicked())); // Plots raw input data when user clicks Plot Time - connect(m_uiForm.pbPlotRaw, SIGNAL(clicked()), this, SLOT(plotRaw())); - // Enables/disables rebin options when user toggles Do Not Rebin checkbox - connect(m_uiForm.rebin_ckDNR, SIGNAL(toggled(bool)), this, SLOT(rebinEntryToggle(bool))); - // Enables/disables detail balance option when user toggle Detailed Balance checkbox - connect(m_uiForm.ckDetailedBalance, SIGNAL(toggled(bool)), this, SLOT(detailedBalanceCheck(bool))); - // Enables/disables scale multiply option when user toggles Scale checkbox - connect(m_uiForm.ckScaleMultiplier, SIGNAL(toggled(bool)), this, SLOT(scaleMultiplierCheck(bool))); + connect(m_uiForm.pbPlotTime, SIGNAL(clicked()), this, SLOT(plotRaw())); connect(m_uiForm.ind_calibFile, SIGNAL(fileTextChanged(const QString &)), this, SLOT(calibFileChanged(const QString &))); - // Enables/disables calibration file options when user toggles Use Calib File checkbox - connect(m_uiForm.ckUseCalib, SIGNAL(toggled(bool)), this, SLOT(useCalib(bool))); - // Displays correct UI widgets for selected rebin type when changed via Rebin Steps drop down - connect(m_uiForm.comboRebinType, SIGNAL(currentIndexChanged(int)), m_uiForm.swIndRebin, SLOT(setCurrentIndex(int))); // Shows message on run buton when user is inputting a run number connect(m_uiForm.ind_runFiles, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); // Shows message on run button when Mantid is finding the file for a given run number connect(m_uiForm.ind_runFiles, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); // Reverts run button back to normal when file finding has finished connect(m_uiForm.ind_runFiles, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); - // Perform validation when editing an option - connect(m_uiForm.leDetailedBalance, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab())); - connect(m_uiForm.leScaleMultiplier, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab())); - connect(m_uiForm.leSpectraMin, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab())); - connect(m_uiForm.leSpectraMax, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab())); - connect(m_uiForm.entryRebinLow, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab())); - connect(m_uiForm.entryRebinWidth, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab())); - connect(m_uiForm.entryRebinHigh, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab())); connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); // Update UI widgets to show default values mappingOptionSelected(m_uiForm.cbMappingOptions->currentText()); - rebinEntryToggle(m_uiForm.rebin_ckDNR->isChecked()); + rebinEntryToggle(m_uiForm.ckDoNotRebin->isChecked()); backgroundRemoval(); // Validate to remove invalid markers @@ -124,8 +99,8 @@ namespace CustomInterfaces } std::vector detectorRange; - detectorRange.push_back(m_uiForm.leSpectraMin->text().toInt()); - detectorRange.push_back(m_uiForm.leSpectraMax->text().toInt()); + detectorRange.push_back(m_uiForm.spSpectraMin->value()); + detectorRange.push_back(m_uiForm.spSpectraMax->value()); reductionAlg->setProperty("DetectorRange", detectorRange); if(m_bgRemoval) @@ -137,22 +112,22 @@ namespace CustomInterfaces reductionAlg->setProperty("BackgroundRange", backgroundRange); } - if(!m_uiForm.rebin_ckDNR->isChecked()) + if(!m_uiForm.ckDoNotRebin->isChecked()) { QString rebin; - if(m_uiForm.comboRebinType->currentIndex() == 0) - rebin = m_uiForm.entryRebinLow->text() + "," + m_uiForm.entryRebinWidth->text() + "," + m_uiForm.entryRebinHigh->text(); + if(m_uiForm.cbRebinType->currentIndex() == 0) + rebin = m_uiForm.spRebinLow->text() + "," + m_uiForm.spRebinWidth->text() + "," + m_uiForm.spRebinHigh->text(); else - rebin = m_uiForm.entryRebinString->text(); + rebin = m_uiForm.leRebinString->text(); reductionAlg->setProperty("RebinString", rebin.toStdString()); } if(m_uiForm.ckDetailedBalance->isChecked()) - reductionAlg->setProperty("DetailedBalance", m_uiForm.leDetailedBalance->text().toDouble()); + reductionAlg->setProperty("DetailedBalance", m_uiForm.spDetailedBalance->value()); if(m_uiForm.ckScaleMultiplier->isChecked()) - reductionAlg->setProperty("ScaleFactor", m_uiForm.leScaleMultiplier->text().toDouble()); + reductionAlg->setProperty("ScaleFactor", m_uiForm.spScaleMultiplier->value()); if(m_uiForm.cbMappingOptions->currentText() != "Default") { @@ -167,7 +142,7 @@ namespace CustomInterfaces reductionAlg->setProperty("OutputWorkspace", "IndirectEnergyTransfer_Workspaces"); // Plot Output options - switch(m_uiForm.ind_cbPlotOutput->currentIndex()) + switch(m_uiForm.cbPlotType->currentIndex()) { case 0: // "None" break; @@ -214,24 +189,20 @@ namespace CustomInterfaces { bool valid = true; - // run files input - if ( ! m_uiForm.ind_runFiles->isValid() ) - { + // Run files input + if(!m_uiForm.ind_runFiles->isValid()) valid = false; - } - // calib file input - if ( m_uiForm.ckUseCalib->isChecked() && !m_uiForm.ind_calibFile->isValid() ) - { + // Calibration file input + if(m_uiForm.ckUseCalib->isChecked() && !m_uiForm.ind_calibFile->isValid()) valid = false; - } - // mapping selection - if ( - ( m_uiForm.cbMappingOptions->currentText() == "Groups" && m_uiForm.leNoGroups->text() == "" ) - || - ( m_uiForm.cbMappingOptions->currentText() == "File" && ! m_uiForm.ind_mapFile->isValid() ) - ) + // Mapping selection + if( + (m_uiForm.cbMappingOptions->currentText() == "Groups" && m_uiForm.leNoGroups->text() == "") + || + (m_uiForm.cbMappingOptions->currentText() == "File" && ! m_uiForm.ind_mapFile->isValid()) + ) { valid = false; m_uiForm.valNoGroups->setText("*"); @@ -241,112 +212,6 @@ namespace CustomInterfaces m_uiForm.valNoGroups->setText(""); } - int dummyPos = 0; - - QString text = m_uiForm.leDetailedBalance->text(); - QValidator::State fieldState = m_uiForm.leDetailedBalance->validator()->validate(text, dummyPos); - - // detailed balance - if ( m_uiForm.ckDetailedBalance->isChecked() && fieldState != QValidator::Acceptable ) - { - valid = false; - m_uiForm.valDetailedBalance->setText("*"); - } - else - { - m_uiForm.valDetailedBalance->setText(""); - } - - int dummyPos2 = 0; - - // scale multiplier - QString scaleMultiplierText = m_uiForm.leScaleMultiplier->text(); - QValidator::State fieldState2 = m_uiForm.leScaleMultiplier->validator()->validate(scaleMultiplierText, dummyPos2); - - if ( m_uiForm.ckScaleMultiplier->isChecked() && fieldState2 != QValidator::Acceptable ) - { - valid = false; - m_uiForm.valScaleMultiplier->setText("*"); - } - else - { - m_uiForm.valScaleMultiplier->setText(""); - } - - // SpectraMin/SpectraMax - const QString specMin = m_uiForm.leSpectraMin->text(); - const QString specMax = m_uiForm.leSpectraMax->text(); - - if (specMin.isEmpty() || specMax.isEmpty() || - (specMin.toDouble() < 1 || specMax.toDouble() < 1) || - (specMin.toDouble() > specMax.toDouble())) - { - valid = false; - m_uiForm.valSpectraMin->setText("*"); - m_uiForm.valSpectraMax->setText("*"); - } - else - { - m_uiForm.valSpectraMin->setText(""); - m_uiForm.valSpectraMax->setText(""); - } - - if ( ! m_uiForm.rebin_ckDNR->isChecked() ) - { - if ( m_uiForm.comboRebinType->currentIndex() == 0 ) - { - if ( m_uiForm.entryRebinLow->text() == "" ) - { - valid = false; - m_uiForm.valELow->setText("*"); - } - else - { - m_uiForm.valELow->setText(""); - } - - if ( m_uiForm.entryRebinWidth->text() == "" ) - { - valid = false; - m_uiForm.valEWidth->setText("*"); - } - else - { - m_uiForm.valEWidth->setText(""); - } - - if ( m_uiForm.entryRebinHigh->text() == "" ) - { - valid = false; - m_uiForm.valEHigh->setText("*"); - } - else - { - m_uiForm.valEHigh->setText(""); - } - - if ( m_uiForm.entryRebinLow->text().toDouble() > m_uiForm.entryRebinHigh->text().toDouble() ) - { - valid = false; - m_uiForm.valELow->setText("*"); - m_uiForm.valEHigh->setText("*"); - } - } - else - { - if ( m_uiForm.entryRebinString->text() == "" ) - { - valid = false; - } - } - } - else - { - m_uiForm.valELow->setText(""); - m_uiForm.valEWidth->setText(""); - m_uiForm.valEHigh->setText(""); - } - return valid; } @@ -356,10 +221,6 @@ namespace CustomInterfaces */ void IndirectConvertToEnergy::setInstrumentDefault() { - m_uiForm.leSpectraMin->clear(); - m_uiForm.leSpectraMax->clear(); - m_uiForm.leEfixed->clear(); - std::map instDetails = getInstrumentDetails(); if(instDetails["spectra-min"].isEmpty() || instDetails["spectra-max"].isEmpty()) @@ -368,8 +229,8 @@ namespace CustomInterfaces return; } - m_uiForm.leSpectraMin->setText(instDetails["spectra-min"]); - m_uiForm.leSpectraMax->setText(instDetails["spectra-max"]); + m_uiForm.spSpectraMin->setValue(instDetails["spectra-min"].toInt()); + m_uiForm.spSpectraMax->setValue(instDetails["spectra-max"].toInt()); if(!instDetails["efixed-val"].isEmpty()) m_uiForm.leEfixed->setText(instDetails["efixed-val"]); @@ -379,28 +240,28 @@ namespace CustomInterfaces // Default rebinning parameters can be set in instrument parameter file if(!instDetails["rebin-default"].isEmpty()) { - m_uiForm.entryRebinString->setText(instDetails["rebin-default"]); - m_uiForm.rebin_ckDNR->setChecked(false); + m_uiForm.leRebinString->setText(instDetails["rebin-default"]); + m_uiForm.ckDoNotRebin->setChecked(false); QStringList rbp = instDetails["rebin-default"].split(",", QString::SkipEmptyParts); if ( rbp.size() == 3 ) { - m_uiForm.entryRebinLow->setText(rbp[0]); - m_uiForm.entryRebinWidth->setText(rbp[1]); - m_uiForm.entryRebinHigh->setText(rbp[2]); - m_uiForm.comboRebinType->setCurrentIndex(0); + m_uiForm.spRebinLow->setValue(rbp[0].toDouble()); + m_uiForm.spRebinWidth->setValue(rbp[1].toDouble()); + m_uiForm.spRebinHigh->setValue(rbp[2].toDouble()); + m_uiForm.cbRebinType->setCurrentIndex(0); } else { - m_uiForm.comboRebinType->setCurrentIndex(1); + m_uiForm.cbRebinType->setCurrentIndex(1); } } else { - m_uiForm.rebin_ckDNR->setChecked(true); - m_uiForm.entryRebinLow->setText(""); - m_uiForm.entryRebinWidth->setText(""); - m_uiForm.entryRebinHigh->setText(""); - m_uiForm.entryRebinString->setText(""); + m_uiForm.ckDoNotRebin->setChecked(true); + m_uiForm.spRebinLow->setValue(0.0); + m_uiForm.spRebinWidth->setValue(0.0); + m_uiForm.spRebinHigh->setValue(0.0); + m_uiForm.leRebinString->setText(""); } if(!instDetails["cm-1-convert-choice"].isEmpty()) @@ -412,7 +273,7 @@ namespace CustomInterfaces if(!instDetails["save-ascii-choice"].isEmpty()) { bool defaultOptions = instDetails["save-ascii-choice"] == "true"; - m_uiForm.save_ckAscii->setChecked(defaultOptions); + m_uiForm.ckSaveASCII->setChecked(defaultOptions); } } @@ -462,70 +323,9 @@ namespace CustomInterfaces m_bgRemoval = m_backgroundDialog->removeBackground(); if(m_bgRemoval) - m_uiForm.pbBack_2->setText("Background Removal (On)"); + m_uiForm.pbBackgroundRemoval->setText("Background Removal (On)"); else - m_uiForm.pbBack_2->setText("Background Removal (Off)"); - } - - /** - * This function will disable the necessary elements of the interface when the user selects "Do Not Rebin" - * and enable them again when this is de-selected. - * - * @param state :: whether the "Do Not Rebin" checkbox is checked - */ - void IndirectConvertToEnergy::rebinEntryToggle(bool state) - { - //Determine value for single rebin field - QString val; - if(state) - val = " "; - else - val = "*"; - - //Rebin mode selection - m_uiForm.comboRebinType->setEnabled(!state); - m_uiForm.labelRebinSteps->setEnabled(!state); - - //Single rebin text entry - m_uiForm.labelRebinLow->setEnabled( !state ); - m_uiForm.labelRebinWidth->setEnabled( !state ); - m_uiForm.labelRebinHigh->setEnabled( !state ); - m_uiForm.entryRebinLow->setEnabled( !state ); - m_uiForm.entryRebinWidth->setEnabled( !state ); - m_uiForm.entryRebinHigh->setEnabled( !state ); - - //Rebin required markers - m_uiForm.valELow->setEnabled(!state); - m_uiForm.valELow->setText(val); - m_uiForm.valEWidth->setEnabled(!state); - m_uiForm.valEWidth->setText(val); - m_uiForm.valEHigh->setEnabled(!state); - m_uiForm.valEHigh->setText(val); - - //Rebin string entry - m_uiForm.entryRebinString->setEnabled(!state); - m_uiForm.labelRebinString->setEnabled(!state); - } - - /** - * Disables/enables the relevant parts of the UI when user checks/unchecks the Detailed Balance - * ckDetailedBalance checkbox. - * @param state :: state of the checkbox - */ - void IndirectConvertToEnergy::detailedBalanceCheck(bool state) - { - m_uiForm.leDetailedBalance->setEnabled(state); - m_uiForm.lbDBKelvin->setEnabled(state); - } - - /** - * Disables/enables the relevant parts of the UI when user checks/unchecks the 'Multiplication Factor (Scale):' - * ckScaleMultiplier checkbox. - * @param state :: state of the checkbox - */ - void IndirectConvertToEnergy::scaleMultiplierCheck(bool state) - { - m_uiForm.leScaleMultiplier->setEnabled(state); + m_uiForm.pbBackgroundRemoval->setText("Background Removal (Off)"); } /** @@ -535,7 +335,7 @@ namespace CustomInterfaces */ QString IndirectConvertToEnergy::createMapFile(const QString& groupType) { - QString specRange = m_uiForm.leSpectraMin->text() + "," + m_uiForm.leSpectraMax->text(); + QString specRange = m_uiForm.spSpectraMin->text() + "," + m_uiForm.spSpectraMax->text(); if(groupType == "File") { @@ -579,17 +379,17 @@ namespace CustomInterfaces { std::vector fileFormats; - if ( m_uiForm.save_ckNexus->isChecked() ) + if ( m_uiForm.ckSaveNexus->isChecked() ) fileFormats.push_back("nxs"); - if ( m_uiForm.save_ckSPE->isChecked() ) + if ( m_uiForm.ckSaveSPE->isChecked() ) fileFormats.push_back("spe"); - if ( m_uiForm.save_ckNxSPE->isChecked() ) + if ( m_uiForm.ckSaveNXSPE->isChecked() ) fileFormats.push_back("nxspe"); - if ( m_uiForm.save_ckAscii->isChecked() ) + if ( m_uiForm.ckSaveASCII->isChecked() ) fileFormats.push_back("ascii"); - if ( m_uiForm.save_ckAclimax->isChecked() ) + if ( m_uiForm.ckSaveAclimax->isChecked() ) fileFormats.push_back("aclimax"); - if ( m_uiForm.save_ckDaveGrp->isChecked() ) + if ( m_uiForm.ckSaveDaveGrp->isChecked() ) fileFormats.push_back("davegrp"); return fileFormats; @@ -609,7 +409,7 @@ namespace CustomInterfaces } bool ok; - QString spectraRange = QInputDialog::getText(0, "Insert Spectra Ranges", "Range: ", QLineEdit::Normal, m_uiForm.leSpectraMin->text() +"-"+ m_uiForm.leSpectraMax->text(), &ok); + QString spectraRange = QInputDialog::getText(0, "Insert Spectra Ranges", "Range: ", QLineEdit::Normal, m_uiForm.spSpectraMin->text() +"-"+ m_uiForm.spSpectraMax->text(), &ok); if(!ok || spectraRange.isEmpty()) return; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp index 308bed8c099c..342600bd0f05 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp @@ -23,9 +23,11 @@ namespace CustomInterfaces IndirectDiagnostics::IndirectDiagnostics(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent), m_lastDiagFilename("") { + m_uiForm.setupUi(parent); + // Property Tree m_propTrees["SlicePropTree"] = new QtTreePropertyBrowser(); - m_uiForm.slice_properties->addWidget(m_propTrees["SlicePropTree"]); + m_uiForm.properties->addWidget(m_propTrees["SlicePropTree"]); // Editor Factories DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(); @@ -71,7 +73,7 @@ namespace CustomInterfaces m_plots["SlicePlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); m_plots["SlicePlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_plots["SlicePlot"]->setCanvasBackground(Qt::white); - m_uiForm.slice_plot->addWidget(m_plots["SlicePlot"]); + m_uiForm.plotRaw->addWidget(m_plots["SlicePlot"]); // Setup second range m_rangeSelectors["SliceBackground"]->setColour(Qt::darkGreen); // Dark green for background @@ -85,7 +87,7 @@ namespace CustomInterfaces m_plots["SlicePreviewPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); m_plots["SlicePreviewPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_plots["SlicePreviewPlot"]->setCanvasBackground(Qt::white); - m_uiForm.slice_plotPreview->addWidget(m_plots["SlicePreviewPlot"]); + m_uiForm.plotPreview->addWidget(m_plots["SlicePreviewPlot"]); m_plots["SlicePreviewPlot"]->replot(); // SIGNAL/SLOT CONNECTIONS @@ -102,23 +104,23 @@ namespace CustomInterfaces // Enable/disable second range options when checkbox is toggled connect(m_blnManager, SIGNAL(valueChanged(QtProperty*, bool)), this, SLOT(sliceTwoRanges(QtProperty*, bool))); // Enables/disables calibration file selection when user toggles Use Calibratin File checkbox - connect(m_uiForm.slice_ckUseCalib, SIGNAL(toggled(bool)), this, SLOT(sliceCalib(bool))); + connect(m_uiForm.ckUseCalibration, SIGNAL(toggled(bool)), this, SLOT(sliceCalib(bool))); // Plot slice miniplot when file has finished loading - connect(m_uiForm.slice_inputFile, SIGNAL(filesFound()), this, SLOT(slicePlotRaw())); + connect(m_uiForm.dsInputFiles, SIGNAL(filesFound()), this, SLOT(slicePlotRaw())); // Shows message on run buton when user is inputting a run number - connect(m_uiForm.slice_inputFile, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); + connect(m_uiForm.dsInputFiles, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); // Shows message on run button when Mantid is finding the file for a given run number - connect(m_uiForm.slice_inputFile, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); + connect(m_uiForm.dsInputFiles, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); // Reverts run button back to normal when file finding has finished - connect(m_uiForm.slice_inputFile, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); + connect(m_uiForm.dsInputFiles, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); // Update preview plot when slice algorithm completes connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(sliceAlgDone(bool))); // Set default UI state sliceTwoRanges(0, false); - m_uiForm.slice_ckUseCalib->setChecked(false); + m_uiForm.ckUseCalibration->setChecked(false); sliceCalib(false); } @@ -135,9 +137,9 @@ namespace CustomInterfaces void IndirectDiagnostics::run() { - QString suffix = "_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() - + m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_slice"; - QString filenames = m_uiForm.slice_inputFile->getFilenames().join(","); + QString suffix = "_slice"; //"_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() TODO + //+ m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_slice"; + QString filenames = m_uiForm.dsInputFiles->getFilenames().join(","); std::vector spectraRange; spectraRange.push_back(static_cast(m_dblManager->value(m_properties["SpecMin"]))); @@ -153,15 +155,15 @@ namespace CustomInterfaces sliceAlg->setProperty("InputFiles", filenames.toStdString()); sliceAlg->setProperty("SpectraRange", spectraRange); sliceAlg->setProperty("PeakRange", peakRange); - sliceAlg->setProperty("Verbose", m_uiForm.slice_ckVerbose->isChecked()); - sliceAlg->setProperty("Plot", m_uiForm.slice_ckPlot->isChecked()); - sliceAlg->setProperty("Save", m_uiForm.slice_ckSave->isChecked()); + sliceAlg->setProperty("Verbose", m_uiForm.ckVerbose->isChecked()); + sliceAlg->setProperty("Plot", m_uiForm.ckPlot->isChecked()); + sliceAlg->setProperty("Save", m_uiForm.ckSave->isChecked()); sliceAlg->setProperty("OutputNameSuffix", suffix.toStdString()); sliceAlg->setProperty("OutputWorkspace", "IndirectDiagnostics_Workspaces"); - if(m_uiForm.slice_ckUseCalib->isChecked()) + if(m_uiForm.ckUseCalibration->isChecked()) { - QString calibWsName = m_uiForm.slice_dsCalibFile->getCurrentDataName(); + QString calibWsName = m_uiForm.dsCalibration->getCurrentDataName(); sliceAlg->setProperty("CalibrationWorkspace", calibWsName.toStdString()); } @@ -181,9 +183,9 @@ namespace CustomInterfaces UserInputValidator uiv; // Check raw input - uiv.checkMWRunFilesIsValid("Input", m_uiForm.slice_inputFile); - if(m_uiForm.slice_ckUseCalib->isChecked()) - uiv.checkMWRunFilesIsValid("Calibration", m_uiForm.slice_inputFile); + uiv.checkMWRunFilesIsValid("Input", m_uiForm.dsInputFiles); + if(m_uiForm.ckUseCalibration->isChecked()) + uiv.checkMWRunFilesIsValid("Calibration", m_uiForm.dsInputFiles); // Check peak range auto rangeOne = std::make_pair(m_dblManager->value(m_properties["PeakStart"]), m_dblManager->value(m_properties["PeakEnd"])); @@ -239,7 +241,7 @@ namespace CustomInterfaces */ void IndirectDiagnostics::slicePlotRaw() { - QString filename = m_uiForm.slice_inputFile->getFirstFilename(); + QString filename = m_uiForm.dsInputFiles->getFirstFilename(); // Only update if we have a different file if(filename == m_lastDiagFilename) @@ -252,7 +254,7 @@ namespace CustomInterfaces setDefaultInstDetails(); - if ( m_uiForm.slice_inputFile->isValid() ) + if ( m_uiForm.dsInputFiles->isValid() ) { QFileInfo fi(filename); QString wsname = fi.baseName(); @@ -308,7 +310,7 @@ namespace CustomInterfaces */ void IndirectDiagnostics::sliceCalib(bool state) { - m_uiForm.slice_dsCalibFile->setEnabled(state); + m_uiForm.dsCalibration->setEnabled(state); } void IndirectDiagnostics::rangeSelectorDropped(double min, double max) @@ -346,9 +348,9 @@ namespace CustomInterfaces */ void IndirectDiagnostics::updatePreviewPlot() { - QString suffix = "_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() - + m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_slice"; - QString filenames = m_uiForm.slice_inputFile->getFilenames().join(","); + QString suffix = "_slice"; //"_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() + //+ m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_slice"; TODO + QString filenames = m_uiForm.dsInputFiles->getFilenames().join(","); std::vector spectraRange; spectraRange.push_back(static_cast(m_dblManager->value(m_properties["SpecMin"]))); @@ -364,15 +366,15 @@ namespace CustomInterfaces sliceAlg->setProperty("InputFiles", filenames.toStdString()); sliceAlg->setProperty("SpectraRange", spectraRange); sliceAlg->setProperty("PeakRange", peakRange); - sliceAlg->setProperty("Verbose", m_uiForm.slice_ckVerbose->isChecked()); + sliceAlg->setProperty("Verbose", m_uiForm.ckVerbose->isChecked()); sliceAlg->setProperty("Plot", false); sliceAlg->setProperty("Save", false); sliceAlg->setProperty("OutputNameSuffix", suffix.toStdString()); sliceAlg->setProperty("OutputWorkspace", "IndirectDiagnostics_Workspaces"); - if(m_uiForm.slice_ckUseCalib->isChecked()) + if(m_uiForm.ckUseCalibration->isChecked()) { - QString calibWsName = m_uiForm.slice_dsCalibFile->getCurrentDataName(); + QString calibWsName = m_uiForm.dsCalibration->getCurrentDataName(); sliceAlg->setProperty("CalibrationWorkspace", calibWsName.toStdString()); } @@ -399,7 +401,7 @@ namespace CustomInterfaces if(error) return; - QStringList filenames = m_uiForm.slice_inputFile->getFilenames(); + QStringList filenames = m_uiForm.dsInputFiles->getFilenames(); if(filenames.size() < 1) return; @@ -446,7 +448,7 @@ namespace CustomInterfaces void IndirectDiagnostics::pbRunFinding() { emit updateRunButton(false, "Finding files...", "Searchig for data files for the run numbers entered..."); - m_uiForm.slice_inputFile->setEnabled(false); + m_uiForm.dsInputFiles->setEnabled(false); } /** @@ -454,7 +456,7 @@ namespace CustomInterfaces */ void IndirectDiagnostics::pbRunFinished() { - if(!m_uiForm.slice_inputFile->isValid()) + if(!m_uiForm.dsInputFiles->isValid()) { emit updateRunButton(false, "Invalid Run(s)", "Cannot find data files for some of the run numbers enetered."); } @@ -463,7 +465,7 @@ namespace CustomInterfaces emit updateRunButton(); } - m_uiForm.slice_inputFile->setEnabled(true); + m_uiForm.dsInputFiles->setEnabled(true); } } // namespace CustomInterfaces From 45ec3b8ce85e5c3b6356dc886a5a987562e2c19a Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 14:03:45 +0000 Subject: [PATCH 068/130] Indirect interfaces almost back to normal Refs #10960 --- .../Indirect/IndirectCalibration.h | 2 +- .../Indirect/IndirectConvertToEnergy.h | 6 +- .../Indirect/IndirectConvertToEnergy.ui | 54 +++++++++++++---- .../Indirect/IndirectDataReduction.h | 2 +- .../Indirect/IndirectDataReduction.ui | 10 ---- .../Indirect/IndirectDataReductionTab.h | 27 +++++---- .../Indirect/IndirectDiagnostics.h | 2 +- .../Indirect/IndirectMoments.h | 2 +- .../Indirect/IndirectSqw.h | 2 +- .../Indirect/IndirectSymmetrise.h | 2 +- .../Indirect/IndirectTransmission.h | 2 +- .../src/Indirect/IndirectCalibration.cpp | 25 ++++---- .../src/Indirect/IndirectConvertToEnergy.cpp | 59 ++++++++----------- .../src/Indirect/IndirectDataReduction.cpp | 16 ++--- .../src/Indirect/IndirectDataReductionTab.cpp | 32 +++++----- .../src/Indirect/IndirectDiagnostics.cpp | 13 ++-- .../src/Indirect/IndirectMoments.cpp | 3 +- .../src/Indirect/IndirectSqw.cpp | 4 +- .../src/Indirect/IndirectSymmetrise.cpp | 4 +- .../src/Indirect/IndirectTransmission.cpp | 6 +- 20 files changed, 143 insertions(+), 130 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h index 074b21039483..c01b42bbd5d2 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h @@ -40,7 +40,7 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectCalibration(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectCalibration(IndirectDataReduction * idrUI, QWidget * parent = 0); virtual ~IndirectCalibration(); virtual void setup(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h index 80d0c7b11f5a..290f60918f96 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h @@ -40,7 +40,7 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectConvertToEnergy(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectConvertToEnergy(IndirectDataReduction * idrUI, QWidget * parent = 0); virtual ~IndirectConvertToEnergy(); virtual void setup(); @@ -53,11 +53,7 @@ namespace CustomInterfaces void mappingOptionSelected(const QString& groupType); ///< change ui to display appropriate options void backgroundClicked(); ///< handles showing and hiding m_backgroundDialog void backgroundRemoval(); ///< handles data from BG - void rebinEntryToggle(bool state); ///< handle checking/unchecking of "Do Not Rebin" - void detailedBalanceCheck(bool state); ///< handle checking/unchecking of "Detailed Balance" - void scaleMultiplierCheck(bool state); ///< handle checking/unchecking of "Scale: Multiply by" void plotRaw(); ///< plot raw data from instrument - void useCalib(bool state); ///< whether to use calib file void calibFileChanged(const QString & calib); ///< sets m_uiForm.ckUseCalib to appropriate value void pbRunEditing(); //< Called when a user starts to type / edit the runs to load. void pbRunFinding(); //< Called when the FileFinder starts finding the files. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui index a0dae0df83e2..331ecc2ec9d5 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui @@ -41,7 +41,7 @@ - + 0 @@ -57,7 +57,7 @@ - + false @@ -183,12 +183,12 @@ 0
- 0 + 2 - + - + 0 @@ -216,7 +216,7 @@ - + @@ -260,7 +260,7 @@ - +
@@ -519,6 +519,9 @@
+ + false + 0 @@ -567,6 +570,9 @@ + + false + -999.990000000000009 @@ -607,6 +613,9 @@ + + false + -999.990000000000009 @@ -647,6 +656,9 @@ + + false + -999.990000000000009 @@ -685,7 +697,11 @@ - + + + false + +
@@ -1001,7 +1017,7 @@ Later steps in the process (saving, renaming) will not be done. ckDoNotRebin toggled(bool) - lbRebinHigh + spRebinHigh setDisabled(bool) @@ -1009,8 +1025,24 @@ Later steps in the process (saving, renaming) will not be done. 371 - 465 - 406 + 527 + 405 + + + + + ckUseCalib + toggled(bool) + dsCalibrationFile + setEnabled(bool) + + + 441 + 98 + + + 159 + 86 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h index 5410445177de..bb3a724082a0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.h @@ -8,7 +8,6 @@ #include "MantidQtAPI/AlgorithmRunner.h" #include "MantidQtAPI/UserSubWindow.h" -#include "IndirectDataReductionTab.h" #include #include @@ -113,6 +112,7 @@ namespace MantidQt /// Set and show an instrument-specific widget virtual void closeEvent(QCloseEvent* close); + friend class IndirectDataReductionTab; /// The .ui form generated by Qt Designer Ui::IndirectDataReduction m_uiForm; /// Instrument the interface is currently set for. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui index 3beeaa0146fc..b92fbed2b04d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui @@ -218,21 +218,11 @@
- - MantidQt::MantidWidgets::MWRunFiles - QWidget -
MantidQtMantidWidgets/MWRunFiles.h
-
MantidQt::MantidWidgets::IndirectInstrumentConfig QComboBox
MantidQtMantidWidgets/IndirectInstrumentConfig.h
- - MantidQt::MantidWidgets::DataSelector - QWidget -
MantidQtMantidWidgets/DataSelector.h
-
twIDRTabs diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h index bd9af5f20f5c..876aa020bb57 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h @@ -8,8 +8,9 @@ #include "MantidQtAPI/BatchAlgorithmRunner.h" #include "MantidQtAPI/PythonRunner.h" #include "MantidQtAPI/QwtWorkspaceSpectrumData.h" -#include "IndirectDataReduction.h" +#include "MantidQtMantidWidgets/IndirectInstrumentConfig.h" #include "IndirectTab.h" +#include "IndirectDataReduction.h" #include "MantidQtMantidWidgets/RangeSelector.h" #include @@ -74,33 +75,33 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectDataReductionTab(Ui::IndirectDataReduction& uiForm, QObject * parent = 0); + IndirectDataReductionTab(IndirectDataReduction * idrUI, QObject * parent = 0); virtual ~IndirectDataReductionTab(); public slots: void runTab(); - protected: - Mantid::API::MatrixWorkspace_sptr loadInstrumentIfNotExist(std::string instrumentName, std::string analyser="", std::string reflection=""); - /// Function to get details about the instrumet from a given workspace - std::map getInstrumentDetails(); - - std::map getRangesFromInstrument(QString instName = "", QString analyser = "", QString reflection = ""); - - Ui::IndirectDataReduction m_uiForm; - signals: /// Update the Run button on the IDR main window void updateRunButton(bool enabled = true, QString message = "Run", QString tooltip = ""); /// Emitted when the instrument setup is changed void newInstrumentConfiguration(); - private: - bool m_tabRunning; + protected: + Mantid::API::MatrixWorkspace_sptr loadInstrumentIfNotExist(std::string instrumentName, std::string analyser="", std::string reflection=""); + /// Function to get details about the instrumet from a given workspace + std::map getInstrumentDetails(); + std::map getRangesFromInstrument(QString instName = "", QString analyser = "", QString reflection = ""); + /// Get the instrument config widget + MantidWidgets::IndirectInstrumentConfig *getInstrumentConfiguration(); private slots: void tabExecutionComplete(bool error); + private: + IndirectDataReduction *m_idrUI; + bool m_tabRunning; + }; } // namespace CustomInterfaces } // namespace Mantid diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h index d1f2defef108..5020695b6fe4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h @@ -58,7 +58,7 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectDiagnostics(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectDiagnostics(IndirectDataReduction * idrUI, QWidget * parent = 0); virtual ~IndirectDiagnostics(); virtual void setup(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h index 2c5f7c34429f..e991cbd87358 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.h @@ -43,7 +43,7 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectMoments(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectMoments(IndirectDataReduction * idrUI, QWidget * parent = 0); virtual ~IndirectMoments(); virtual void setup(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h index 88e70d90b3f1..a5780b1640ad 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.h @@ -40,7 +40,7 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectSqw(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectSqw(IndirectDataReduction * idrUI, QWidget * parent = 0); virtual ~IndirectSqw(); virtual void setup(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h index d2335ae0a0ad..777315639238 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSymmetrise.h @@ -59,7 +59,7 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectSymmetrise(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectSymmetrise(IndirectDataReduction * idrUI, QWidget * parent = 0); virtual ~IndirectSymmetrise(); virtual void setup(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h index bcd7539c34bd..c85568af87b7 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.h @@ -44,7 +44,7 @@ namespace CustomInterfaces Q_OBJECT public: - IndirectTransmission(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectTransmission(IndirectDataReduction * idrUI, QWidget * parent = 0); virtual ~IndirectTransmission(); virtual void setup(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp index 21fb45b4c6a1..cedeaa92d211 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectCalibration.cpp @@ -21,8 +21,9 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectCalibration::IndirectCalibration(Ui::IndirectDataReduction& uiForm, QWidget * parent) : - IndirectDataReductionTab(uiForm, parent), m_lastCalPlotFilename("") + IndirectCalibration::IndirectCalibration(IndirectDataReduction * idrUI, QWidget * parent) : + IndirectDataReductionTab(idrUI, parent), + m_lastCalPlotFilename("") { m_uiForm.setupUi(parent); @@ -177,8 +178,8 @@ namespace CustomInterfaces QString backgroundRange = m_properties["CalBackMin"]->valueText() + "," + m_properties["CalBackMax"]->valueText(); QFileInfo firstFileInfo(firstFile); - QString outputWorkspaceNameStem = "IRS"; //firstFileInfo.baseName() + "_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() -// + m_uiForm.iicInstrumentConfiguration->getReflectionName(); TODO + QString outputWorkspaceNameStem = firstFileInfo.baseName() + "_" + getInstrumentConfiguration()->getAnalyserName() + + getInstrumentConfiguration()->getReflectionName(); QString calibrationWsName = outputWorkspaceNameStem + "_calib"; @@ -240,12 +241,11 @@ namespace CustomInterfaces Mantid::API::IAlgorithm_sptr resAlg = Mantid::API::AlgorithmManager::Instance().create("IndirectResolution", -1); resAlg->initialize(); - //TODO resAlg->setProperty("InputFiles", filenames.toStdString()); resAlg->setProperty("OutputWorkspace", resolutionWsName.toStdString()); - resAlg->setProperty("Instrument", "IRIS"); //m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); - resAlg->setProperty("Analyser", "graphite"); //m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); - resAlg->setProperty("Reflection", "002"); //m_uiForm.iicInstrumentConfiguration->getReflectionName().toStdString()); + resAlg->setProperty("Instrument", getInstrumentConfiguration()->getInstrumentName().toStdString()); + resAlg->setProperty("Analyser", getInstrumentConfiguration()->getAnalyserName().toStdString()); + resAlg->setProperty("Reflection", getInstrumentConfiguration()->getReflectionName().toStdString()); resAlg->setProperty("RebinParam", rebinString.toStdString()); resAlg->setProperty("DetectorRange", resDetectorRange.toStdString()); resAlg->setProperty("BackgroundRange", background.toStdString()); @@ -402,14 +402,13 @@ namespace CustomInterfaces QFileInfo fi(m_uiForm.leRunNo->getFirstFilename()); QString detRange = QString::number(m_dblManager->value(m_properties["ResSpecMin"])) + "," - + QString::number(m_dblManager->value(m_properties["ResSpecMax"])); + + QString::number(m_dblManager->value(m_properties["ResSpecMax"])); - //TODO IAlgorithm_sptr reductionAlg = AlgorithmManager::Instance().create("InelasticIndirectReduction"); reductionAlg->initialize(); - reductionAlg->setProperty("Instrument", "IRIS"); //m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); - reductionAlg->setProperty("Analyser", "graphite"); //m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); - reductionAlg->setProperty("Reflection", "002"); //m_uiForm.iicInstrumentConfiguration->getReflectionName().toStdString()); + reductionAlg->setProperty("Instrument", getInstrumentConfiguration()->getInstrumentName().toStdString()); + reductionAlg->setProperty("Analyser", getInstrumentConfiguration()->getAnalyserName().toStdString()); + reductionAlg->setProperty("Reflection", getInstrumentConfiguration()->getReflectionName().toStdString()); reductionAlg->setProperty("InputFiles", files.toStdString()); reductionAlg->setProperty("OutputWorkspace", "__IndirectCalibration_reduction"); reductionAlg->setProperty("DetectorRange", detRange.toStdString()); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp index 0894b03e7a38..4a956cee6dcd 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp @@ -14,8 +14,9 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectConvertToEnergy::IndirectConvertToEnergy(Ui::IndirectDataReduction& uiForm, QWidget * parent) : - IndirectDataReductionTab(uiForm, parent), m_backgroundDialog(NULL), m_bgRemoval(false) + IndirectConvertToEnergy::IndirectConvertToEnergy(IndirectDataReduction * idrUI, QWidget * parent) : + IndirectDataReductionTab(idrUI, parent), + m_backgroundDialog(NULL), m_bgRemoval(false) { m_uiForm.setupUi(parent); @@ -31,19 +32,19 @@ namespace CustomInterfaces connect(m_uiForm.pbBackgroundRemoval, SIGNAL(clicked()), this, SLOT(backgroundClicked())); // Plots raw input data when user clicks Plot Time connect(m_uiForm.pbPlotTime, SIGNAL(clicked()), this, SLOT(plotRaw())); - connect(m_uiForm.ind_calibFile, SIGNAL(fileTextChanged(const QString &)), this, SLOT(calibFileChanged(const QString &))); + // Handles a calibration file being selected + connect(m_uiForm.dsCalibrationFile, SIGNAL(fileTextChanged(const QString &)), this, SLOT(calibFileChanged(const QString &))); // Shows message on run buton when user is inputting a run number - connect(m_uiForm.ind_runFiles, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); + connect(m_uiForm.dsRunFiles, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); // Shows message on run button when Mantid is finding the file for a given run number - connect(m_uiForm.ind_runFiles, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); + connect(m_uiForm.dsRunFiles, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); // Reverts run button back to normal when file finding has finished - connect(m_uiForm.ind_runFiles, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); + connect(m_uiForm.dsRunFiles, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); // Update UI widgets to show default values mappingOptionSelected(m_uiForm.cbMappingOptions->currentText()); - rebinEntryToggle(m_uiForm.ckDoNotRebin->isChecked()); backgroundRemoval(); // Validate to remove invalid markers @@ -59,8 +60,6 @@ namespace CustomInterfaces void IndirectConvertToEnergy::setup() { - detailedBalanceCheck(m_uiForm.ckDetailedBalance->isChecked()); - scaleMultiplierCheck(m_uiForm.ckScaleMultiplier->isChecked()); } void IndirectConvertToEnergy::run() @@ -71,11 +70,11 @@ namespace CustomInterfaces reductionAlg->initialize(); BatchAlgorithmRunner::AlgorithmRuntimeProps reductionRuntimeProps; - reductionAlg->setProperty("Instrument", m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); - reductionAlg->setProperty("Analyser", m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); - reductionAlg->setProperty("Reflection", m_uiForm.iicInstrumentConfiguration->getReflectionName().toStdString()); + reductionAlg->setProperty("Instrument", getInstrumentConfiguration()->getInstrumentName().toStdString()); + reductionAlg->setProperty("Analyser", getInstrumentConfiguration()->getAnalyserName().toStdString()); + reductionAlg->setProperty("Reflection", getInstrumentConfiguration()->getReflectionName().toStdString()); - QString files = m_uiForm.ind_runFiles->getFilenames().join(","); + QString files = m_uiForm.dsRunFiles->getFilenames().join(","); reductionAlg->setProperty("InputFiles", files.toStdString()); reductionAlg->setProperty("SumFiles", m_uiForm.ckSumFiles->isChecked()); @@ -84,7 +83,7 @@ namespace CustomInterfaces // If using a calibration file, load it if(m_uiForm.ckUseCalib->isChecked()) { - QString calibFilename = m_uiForm.ind_calibFile->getFirstFilename(); + QString calibFilename = m_uiForm.dsCalibrationFile->getFirstFilename(); QFileInfo fi(calibFilename); std::string calibWorkspaceName = fi.baseName().toStdString(); @@ -105,7 +104,7 @@ namespace CustomInterfaces if(m_bgRemoval) { - QPair background = m_backgroundDialog->getRange(); + QPair background = m_backgroundDialog->getRange(); std::vector backgroundRange; backgroundRange.push_back(background.first); backgroundRange.push_back(background.second); @@ -190,18 +189,18 @@ namespace CustomInterfaces bool valid = true; // Run files input - if(!m_uiForm.ind_runFiles->isValid()) + if(!m_uiForm.dsRunFiles->isValid()) valid = false; // Calibration file input - if(m_uiForm.ckUseCalib->isChecked() && !m_uiForm.ind_calibFile->isValid()) + if(m_uiForm.ckUseCalib->isChecked() && !m_uiForm.dsCalibrationFile->isValid()) valid = false; // Mapping selection if( (m_uiForm.cbMappingOptions->currentText() == "Groups" && m_uiForm.leNoGroups->text() == "") || - (m_uiForm.cbMappingOptions->currentText() == "File" && ! m_uiForm.ind_mapFile->isValid()) + (m_uiForm.cbMappingOptions->currentText() == "File" && ! m_uiForm.dsMapFile->isValid()) ) { valid = false; @@ -339,7 +338,7 @@ namespace CustomInterfaces if(groupType == "File") { - QString groupFile = m_uiForm.ind_mapFile->getFirstFilename(); + QString groupFile = m_uiForm.dsMapFile->getFirstFilename(); if(groupFile == "") { emit showMessageBox("You must enter a path to the .map file."); @@ -354,8 +353,8 @@ namespace CustomInterfaces groupingAlg->initialize(); groupingAlg->setProperty("FixedGroupCount", m_uiForm.leNoGroups->text().toInt()); - groupingAlg->setProperty("InstrumentName", m_uiForm.iicInstrumentConfiguration->getInstrumentName().toStdString()); - groupingAlg->setProperty("ComponentName", m_uiForm.iicInstrumentConfiguration->getAnalyserName().toStdString()); + groupingAlg->setProperty("InstrumentName", getInstrumentConfiguration()->getInstrumentName().toStdString()); + groupingAlg->setProperty("ComponentName", getInstrumentConfiguration()->getAnalyserName().toStdString()); groupingAlg->setProperty("OutputWorkspace", groupWS.toStdString()); m_batchAlgoRunner->addAlgorithm(groupingAlg); @@ -402,7 +401,7 @@ namespace CustomInterfaces { using MantidQt::API::BatchAlgorithmRunner; - if(!m_uiForm.ind_runFiles->isValid()) + if(!m_uiForm.dsRunFiles->isValid()) { emit showMessageBox("You must select a run file."); return; @@ -429,7 +428,7 @@ namespace CustomInterfaces else detectorRange.push_back(specList[1].toInt() + 1); - QString rawFile = m_uiForm.ind_runFiles->getFirstFilename(); + QString rawFile = m_uiForm.dsRunFiles->getFirstFilename(); QFileInfo rawFileInfo(rawFile); std::string name = rawFileInfo.baseName().toStdString(); @@ -496,7 +495,7 @@ namespace CustomInterfaces if(error) return; - QString rawFile = m_uiForm.ind_runFiles->getFirstFilename(); + QString rawFile = m_uiForm.dsRunFiles->getFirstFilename(); QFileInfo rawFileInfo(rawFile); std::string name = rawFileInfo.baseName().toStdString(); @@ -504,12 +503,6 @@ namespace CustomInterfaces m_pythonRunner.runPythonCode(QString::fromStdString(pyInput)); } - void IndirectConvertToEnergy::useCalib(bool state) - { - m_uiForm.ind_calibFile->isOptional(!state); - m_uiForm.ind_calibFile->setEnabled(state); - } - /** * Controls the ckUseCalib checkbox to automatically check it when a user inputs a file from clicking on 'browse'. * @param calib :: path to calib file @@ -536,7 +529,7 @@ namespace CustomInterfaces void IndirectConvertToEnergy::pbRunFinding() { emit updateRunButton(false, "Finding files...", "Searchig for data files for the run numbers entered..."); - m_uiForm.ind_runFiles->setEnabled(false); + m_uiForm.dsRunFiles->setEnabled(false); } /** @@ -544,7 +537,7 @@ namespace CustomInterfaces */ void IndirectConvertToEnergy::pbRunFinished() { - if(!m_uiForm.ind_runFiles->isValid()) + if(!m_uiForm.dsRunFiles->isValid()) { emit updateRunButton(false, "Invalid Run(s)", "Cannot find data files for some of the run numbers enetered."); } @@ -553,7 +546,7 @@ namespace CustomInterfaces emit updateRunButton(); } - m_uiForm.ind_runFiles->setEnabled(true); + m_uiForm.dsRunFiles->setEnabled(true); } } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp index 29bf45767c86..6467749deb29 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp @@ -10,6 +10,7 @@ #include "MantidQtAPI/ManageUserDirectories.h" #include "MantidQtCustomInterfaces/Indirect/IndirectCalibration.h" #include "MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectDataReductionTab.h" #include "MantidQtCustomInterfaces/Indirect/IndirectDiagnostics.h" #include "MantidQtCustomInterfaces/Indirect/IndirectMoments.h" #include "MantidQtCustomInterfaces/Indirect/IndirectSqw.h" @@ -135,14 +136,13 @@ void IndirectDataReduction::initLayout() updateRunButton(false, "Loading UI", "Initialising user interface components..."); // Create the tabs - //TODO - /* m_tabs["Energy Transfer"] = new IndirectConvertToEnergy(m_uiForm, m_uiForm.twIDRTabs->widget(0)); */ - /* m_tabs["Calibration"] = new IndirectCalibration(m_uiForm, m_uiForm.twIDRTabs->widget(1)); */ - /* m_tabs["Diagnostics"] = new IndirectDiagnostics(m_uiForm, m_uiForm.twIDRTabs->widget(2)); */ - /* m_tabs["Transmission"] = new IndirectTransmission(m_uiForm, m_uiForm.twIDRTabs->widget(3)); */ - /* m_tabs["Symmetrise"] = new IndirectSymmetrise(m_uiForm, m_uiForm.twIDRTabs->widget(4)); */ - /* m_tabs["S(Q, w)"] = new IndirectSqw(m_uiForm, m_uiForm.twIDRTabs->widget(5)); */ - /* m_tabs["Moments"] = new IndirectMoments(m_uiForm, m_uiForm.twIDRTabs->widget(6)); */ + m_tabs["Energy Transfer"] = new IndirectConvertToEnergy(this, m_uiForm.twIDRTabs->widget(0)); + m_tabs["Calibration"] = new IndirectCalibration(this, m_uiForm.twIDRTabs->widget(1)); + m_tabs["Diagnostics"] = new IndirectDiagnostics(this, m_uiForm.twIDRTabs->widget(2)); + m_tabs["Transmission"] = new IndirectTransmission(this, m_uiForm.twIDRTabs->widget(3)); + m_tabs["Symmetrise"] = new IndirectSymmetrise(this, m_uiForm.twIDRTabs->widget(4)); + m_tabs["S(Q, w)"] = new IndirectSqw(this, m_uiForm.twIDRTabs->widget(5)); + m_tabs["Moments"] = new IndirectMoments(this, m_uiForm.twIDRTabs->widget(6)); // Connect "?" (Help) Button connect(m_uiForm.pbHelp, SIGNAL(clicked()), this, SLOT(helpClicked())); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp index 714864136dcb..2f39547f7ed5 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp @@ -19,8 +19,8 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectDataReductionTab::IndirectDataReductionTab(Ui::IndirectDataReduction& uiForm, QObject* parent) : IndirectTab(parent), - m_uiForm(uiForm) + IndirectDataReductionTab::IndirectDataReductionTab(IndirectDataReduction *idrUI, QObject *parent) : + IndirectTab(parent), m_idrUI(idrUI) { connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(tabExecutionComplete(bool))); } @@ -75,12 +75,7 @@ namespace CustomInterfaces Mantid::API::MatrixWorkspace_sptr IndirectDataReductionTab::loadInstrumentIfNotExist(std::string instrumentName, std::string analyser, std::string reflection) { - IndirectDataReduction* parentIDR = dynamic_cast(m_parentWidget); - - if(parentIDR == NULL) - throw std::runtime_error("IndirectDataReductionTab must be a child of IndirectDataReduction"); - - return parentIDR->loadInstrumentIfNotExist(instrumentName, analyser, reflection); + return m_idrUI->loadInstrumentIfNotExist(instrumentName, analyser, reflection); } /** @@ -90,12 +85,17 @@ namespace CustomInterfaces */ std::map IndirectDataReductionTab::getInstrumentDetails() { - IndirectDataReduction* parentIDR = dynamic_cast(m_parentWidget); - - if(parentIDR == NULL) - throw std::runtime_error("IndirectDataReductionTab must be a child of IndirectDataReduction"); + return m_idrUI->getInstrumentDetails(); + } - return parentIDR->getInstrumentDetails(); + /** + * Returns a pointer to the instrument configuration widget common to all tabs. + * + * @return Instrument config widget + */ + MantidWidgets::IndirectInstrumentConfig *IndirectDataReductionTab::getInstrumentConfiguration() + { + return m_idrUI->m_uiForm.iicInstrumentConfiguration; } /** @@ -112,11 +112,11 @@ namespace CustomInterfaces { // Get any unset parameters if(instName.isEmpty()) - instName = m_uiForm.iicInstrumentConfiguration->getInstrumentName(); + instName = getInstrumentConfiguration()->getInstrumentName(); if(analyser.isEmpty()) - analyser = m_uiForm.iicInstrumentConfiguration->getAnalyserName(); + analyser = getInstrumentConfiguration()->getAnalyserName(); if(reflection.isEmpty()) - reflection = m_uiForm.iicInstrumentConfiguration->getReflectionName(); + reflection = getInstrumentConfiguration()->getReflectionName(); std::map ranges; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp index 342600bd0f05..5e18f4558c9a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiagnostics.cpp @@ -20,8 +20,9 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectDiagnostics::IndirectDiagnostics(Ui::IndirectDataReduction& uiForm, QWidget * parent) : - IndirectDataReductionTab(uiForm, parent), m_lastDiagFilename("") + IndirectDiagnostics::IndirectDiagnostics(IndirectDataReduction * idrUI, QWidget * parent) : + IndirectDataReductionTab(idrUI, parent), + m_lastDiagFilename("") { m_uiForm.setupUi(parent); @@ -137,8 +138,8 @@ namespace CustomInterfaces void IndirectDiagnostics::run() { - QString suffix = "_slice"; //"_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() TODO - //+ m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_slice"; + QString suffix = "_" + getInstrumentConfiguration()->getAnalyserName() + + getInstrumentConfiguration()->getReflectionName() + "_slice"; QString filenames = m_uiForm.dsInputFiles->getFilenames().join(","); std::vector spectraRange; @@ -348,8 +349,8 @@ namespace CustomInterfaces */ void IndirectDiagnostics::updatePreviewPlot() { - QString suffix = "_slice"; //"_" + m_uiForm.iicInstrumentConfiguration->getAnalyserName() - //+ m_uiForm.iicInstrumentConfiguration->getReflectionName() + "_slice"; TODO + QString suffix = getInstrumentConfiguration()->getAnalyserName() + + getInstrumentConfiguration()->getReflectionName() + "_slice"; QString filenames = m_uiForm.dsInputFiles->getFilenames().join(","); std::vector spectraRange; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp index 6db08399ca52..d0ba6815bd4c 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp @@ -15,7 +15,8 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectMoments::IndirectMoments(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent) + IndirectMoments::IndirectMoments(IndirectDataReduction * idrUI, QWidget * parent) : + IndirectDataReductionTab(idrUI, parent) { m_uiForm.setupUi(parent); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp index 403e3bd2b5af..9b6025664ace 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSqw.cpp @@ -14,8 +14,8 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectSqw::IndirectSqw(Ui::IndirectDataReduction& uiForm, QWidget * parent) : - IndirectDataReductionTab(uiForm, parent) + IndirectSqw::IndirectSqw(IndirectDataReduction * idrUI, QWidget * parent) : + IndirectDataReductionTab(idrUI, parent) { m_uiForm.setupUi(parent); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp index d0555deadabc..619022792b4e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSymmetrise.cpp @@ -21,8 +21,8 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectSymmetrise::IndirectSymmetrise(Ui::IndirectDataReduction& uiForm, QWidget * parent) : - IndirectDataReductionTab(uiForm, parent) + IndirectSymmetrise::IndirectSymmetrise(IndirectDataReduction * idrUI, QWidget * parent) : + IndirectDataReductionTab(idrUI, parent) { m_uiForm.setupUi(parent); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp index cd7a75987353..9fb077517a60 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTransmission.cpp @@ -12,8 +12,8 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectTransmission::IndirectTransmission(Ui::IndirectDataReduction& uiForm, QWidget * parent) : - IndirectDataReductionTab(uiForm, parent) + IndirectTransmission::IndirectTransmission(IndirectDataReduction * idrUI, QWidget * parent) : + IndirectDataReductionTab(idrUI, parent) { m_uiForm.setupUi(parent); @@ -64,7 +64,7 @@ namespace CustomInterfaces bool IndirectTransmission::validate() { // Check if we have an appropriate instrument - QString currentInst = "IRIS"; //m_uiForm.iicInstrumentConfiguration->getInstrumentName(); TODO + QString currentInst = getInstrumentConfiguration()->getInstrumentName(); if(currentInst != "IRIS" && currentInst != "OSIRIS") return false; From 6c59d0541881515dfda2c6ed0706132a27527a5c Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 14:17:25 +0000 Subject: [PATCH 069/130] Use data selector for calibration, add validation to spectra ranges Refs #10960 --- .../Indirect/IndirectConvertToEnergy.h | 1 - .../Indirect/IndirectConvertToEnergy.ui | 43 +++++++++++------- .../src/Indirect/IndirectConvertToEnergy.cpp | 44 ++++++------------- 3 files changed, 39 insertions(+), 49 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h index 290f60918f96..9add5f2451ac 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h @@ -54,7 +54,6 @@ namespace CustomInterfaces void backgroundClicked(); ///< handles showing and hiding m_backgroundDialog void backgroundRemoval(); ///< handles data from BG void plotRaw(); ///< plot raw data from instrument - void calibFileChanged(const QString & calib); ///< sets m_uiForm.ckUseCalib to appropriate value void pbRunEditing(); //< Called when a user starts to type / edit the runs to load. void pbRunFinding(); //< Called when the FileFinder starts finding the files. void pbRunFinished(); //< Called when the FileFinder has finished finding the files. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui index 331ecc2ec9d5..09e666b7d3a3 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui @@ -57,32 +57,27 @@
- + false - + 0 - 41 + 0 - - false - - - Calibration File + + true - + false - - true + + _calib - - - _calib.nxs - + + _calib.nxs @@ -346,6 +341,9 @@ 999.990000000000009 + + 10.000000000000000 + 300.000000000000000 @@ -372,6 +370,12 @@ 99.989999999999995 + + 0.100000000000000 + + + 1.000000000000000 + @@ -429,7 +433,7 @@ - 9999 + 0 @@ -456,7 +460,7 @@ - 9999 + 0 @@ -899,6 +903,11 @@ Later steps in the process (saving, renaming) will not be done. QWidget
MantidQtMantidWidgets/MWRunFiles.h
+ + MantidQt::MantidWidgets::DataSelector + QWidget +
MantidQtMantidWidgets/DataSelector.h
+
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp index 4a956cee6dcd..2886438849e8 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp @@ -32,8 +32,6 @@ namespace CustomInterfaces connect(m_uiForm.pbBackgroundRemoval, SIGNAL(clicked()), this, SLOT(backgroundClicked())); // Plots raw input data when user clicks Plot Time connect(m_uiForm.pbPlotTime, SIGNAL(clicked()), this, SLOT(plotRaw())); - // Handles a calibration file being selected - connect(m_uiForm.dsCalibrationFile, SIGNAL(fileTextChanged(const QString &)), this, SLOT(calibFileChanged(const QString &))); // Shows message on run buton when user is inputting a run number connect(m_uiForm.dsRunFiles, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); // Shows message on run button when Mantid is finding the file for a given run number @@ -68,7 +66,6 @@ namespace CustomInterfaces IAlgorithm_sptr reductionAlg = AlgorithmManager::Instance().create("InelasticIndirectReduction", -1); reductionAlg->initialize(); - BatchAlgorithmRunner::AlgorithmRuntimeProps reductionRuntimeProps; reductionAlg->setProperty("Instrument", getInstrumentConfiguration()->getInstrumentName().toStdString()); reductionAlg->setProperty("Analyser", getInstrumentConfiguration()->getAnalyserName().toStdString()); @@ -80,21 +77,10 @@ namespace CustomInterfaces reductionAlg->setProperty("SumFiles", m_uiForm.ckSumFiles->isChecked()); reductionAlg->setProperty("LoadLogs", m_uiForm.ckLoadLogs->isChecked()); - // If using a calibration file, load it if(m_uiForm.ckUseCalib->isChecked()) { - QString calibFilename = m_uiForm.dsCalibrationFile->getFirstFilename(); - - QFileInfo fi(calibFilename); - std::string calibWorkspaceName = fi.baseName().toStdString(); - - IAlgorithm_sptr calibLoadAlg = AlgorithmManager::Instance().create("LoadNexus", -1); - calibLoadAlg->initialize(); - calibLoadAlg->setProperty("Filename", calibFilename.toStdString()); - calibLoadAlg->setProperty("OutputWorkspace", calibWorkspaceName); - m_batchAlgoRunner->addAlgorithm(calibLoadAlg); - - reductionRuntimeProps["CalibrationWorkspace"] = calibWorkspaceName; + QString calibWorkspaceName = m_uiForm.dsCalibrationFile->getCurrentDataName(); + reductionAlg->setProperty("CalibrationWorkspace", calibWorkspaceName.toStdString()); } std::vector detectorRange; @@ -153,7 +139,7 @@ namespace CustomInterfaces break; } - m_batchAlgoRunner->addAlgorithm(reductionAlg, reductionRuntimeProps); + m_batchAlgoRunner->addAlgorithm(reductionAlg); m_batchAlgoRunner->executeBatchAsync(); // Set output workspace name for Python export @@ -228,8 +214,16 @@ namespace CustomInterfaces return; } - m_uiForm.spSpectraMin->setValue(instDetails["spectra-min"].toInt()); - m_uiForm.spSpectraMax->setValue(instDetails["spectra-max"].toInt()); + int specMin = instDetails["spectra-min"].toInt(); + int specMax = instDetails["spectra-max"].toInt(); + + m_uiForm.spSpectraMin->setMinimum(specMin); + m_uiForm.spSpectraMin->setMaximum(specMax); + m_uiForm.spSpectraMin->setValue(specMin); + + m_uiForm.spSpectraMax->setMinimum(specMin); + m_uiForm.spSpectraMax->setMaximum(specMax); + m_uiForm.spSpectraMax->setValue(specMax); if(!instDetails["efixed-val"].isEmpty()) m_uiForm.leEfixed->setText(instDetails["efixed-val"]); @@ -503,18 +497,6 @@ namespace CustomInterfaces m_pythonRunner.runPythonCode(QString::fromStdString(pyInput)); } - /** - * Controls the ckUseCalib checkbox to automatically check it when a user inputs a file from clicking on 'browse'. - * @param calib :: path to calib file - */ - void IndirectConvertToEnergy::calibFileChanged(const QString & calib) - { - if(calib.isEmpty()) - m_uiForm.ckUseCalib->setChecked(false); - else - m_uiForm.ckUseCalib->setChecked(true); - } - /** * Called when a user starts to type / edit the runs to load. */ From b9333dfcfbba6697f663d2c93267977b0e403c48 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 14:41:51 +0000 Subject: [PATCH 070/130] Fix size of IDR tabs Refs #10960 --- .../Indirect/IndirectDataReduction.ui | 511 +++++++++++------- .../Indirect/IndirectMoments.ui | 8 +- .../Indirect/IndirectSqw.ui | 15 +- .../Indirect/IndirectTransmission.ui | 10 +- .../src/Indirect/IndirectDataReduction.cpp | 14 +- 5 files changed, 358 insertions(+), 200 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui index b92fbed2b04d..a6027699db02 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui @@ -6,215 +6,348 @@ 0 0 - 650 - 700 + 700 + 500 Indirect Data Reduction - - - 9 - - - - - Instrument - - - - 1 + + + 9 + + + + + Instrument + + + 1 + + + + + + 0 + 0 + + + + + TOF Indirect Geometry Spectroscopy + + + + ISIS + + + false + + + false + + + + + + + + + + + 0 + 0 + + + + + + + 0 + + + + 14 + 14 + + + + + Energy Transfer + + + + + + true + + + + + 0 + 0 + 656 + 346 + + + + + + + + + + Calibration + + + + + + true + + + + + 0 + 0 + 96 + 26 + + + + + + + + + + Diagnostics + + + + + + true + + + + + 0 + 0 + 96 + 26 + + + + + + + + + + Transmission + + + + + + true + + + + + 0 + 0 + 96 + 26 + + + + + + + + + + Symmetrise + + + + + + true + + + + + 0 + 0 + 96 + 26 + + + + + + + + + + S(Q, w) + + + + + + true + + + + + 0 + 0 + 96 + 26 + + + + + + + + + + Moments + + + + + + true + + + + + 0 + 0 + 96 + 26 + + + + + + + + + + + - + - + 0 0 - - - TOF Indirect Geometry Spectroscopy - + + + 25 + 25 + + + + Open interface help page in your web browser. + + + ? + + + + + + + + 0 + 0 + - - ISIS + + + 25 + 40 + - - false + + Export a Python script for the algorithms run on this tab. - - false + + Py + + + + + + + Qt::Horizontal + + + + 30 + 20 + + + + + + + + + 0 + 0 + + + + + 180 + 16777215 + + + + Run conversion to energy process. + + + Run + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Manage Directories - - - - - - - 0 - 0 - - - - - - - 0 - - - - 14 - 14 - - - - - Energy Transfer - - - - - Calibration - - - - - Diagnostics - - - - - Transmission - - - - - Symmetrise - - - - - S(Q, w) - - - - - Moments - - - - - - - - - - - 0 - 0 - - - - - 25 - 25 - - - - Open interface help page in your web browser. - - - ? - - - - - - - - 0 - 0 - - - - - 25 - 40 - - - - Export a Python script for the algorithms run on this tab. - - - Py - - - - - - - Qt::Horizontal - - - - 30 - 20 - - - - - - - - - 0 - 0 - - - - - 180 - 16777215 - - - - Run conversion to energy process. - - - Run - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Manage Directories - - - - - - + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui index 3893e6d3254e..8be1b8826496 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectMoments.ui @@ -7,7 +7,7 @@ 0 0 444 - 288 + 398 @@ -103,6 +103,12 @@ + + + 0 + 200 + + Preview diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui index a2968dec9e2c..92b78e8c7e09 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSqw.ui @@ -6,7 +6,7 @@ 0 0 - 508 + 601 268 @@ -373,6 +373,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui index 4859b7f2151d..d2980679fa4d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTransmission.ui @@ -6,8 +6,8 @@ 0 0 - 469 - 227 + 514 + 360 @@ -93,6 +93,12 @@ + + + 0 + 200 + + Preview diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp index 6467749deb29..2b325270b69a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp @@ -136,13 +136,13 @@ void IndirectDataReduction::initLayout() updateRunButton(false, "Loading UI", "Initialising user interface components..."); // Create the tabs - m_tabs["Energy Transfer"] = new IndirectConvertToEnergy(this, m_uiForm.twIDRTabs->widget(0)); - m_tabs["Calibration"] = new IndirectCalibration(this, m_uiForm.twIDRTabs->widget(1)); - m_tabs["Diagnostics"] = new IndirectDiagnostics(this, m_uiForm.twIDRTabs->widget(2)); - m_tabs["Transmission"] = new IndirectTransmission(this, m_uiForm.twIDRTabs->widget(3)); - m_tabs["Symmetrise"] = new IndirectSymmetrise(this, m_uiForm.twIDRTabs->widget(4)); - m_tabs["S(Q, w)"] = new IndirectSqw(this, m_uiForm.twIDRTabs->widget(5)); - m_tabs["Moments"] = new IndirectMoments(this, m_uiForm.twIDRTabs->widget(6)); + m_tabs["Energy Transfer"] = new IndirectConvertToEnergy(this, m_uiForm.twIDRTabs->findChild("loEnergyTransfer")); + m_tabs["Calibration"] = new IndirectCalibration(this, m_uiForm.twIDRTabs->findChild("loCalibration")); + m_tabs["Diagnostics"] = new IndirectDiagnostics(this, m_uiForm.twIDRTabs->findChild("loDiagnostics")); + m_tabs["Transmission"] = new IndirectTransmission(this, m_uiForm.twIDRTabs->findChild("loTransmission")); + m_tabs["Symmetrise"] = new IndirectSymmetrise(this, m_uiForm.twIDRTabs->findChild("loSymmetrise")); + m_tabs["S(Q, w)"] = new IndirectSqw(this, m_uiForm.twIDRTabs->findChild("loSofQW")); + m_tabs["Moments"] = new IndirectMoments(this, m_uiForm.twIDRTabs->findChild("loMoments")); // Connect "?" (Help) Button connect(m_uiForm.pbHelp, SIGNAL(clicked()), this, SLOT(helpClicked())); From 05111e242d58a7f1158cfae871437aa0367ec5ef Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 15:29:09 +0000 Subject: [PATCH 071/130] Improve validation on IDR ET Refs #10960 --- .../Indirect/IndirectConvertToEnergy.h | 2 + .../Indirect/IndirectConvertToEnergy.ui | 502 ++++++++---------- .../src/Indirect/IndirectConvertToEnergy.cpp | 95 ++-- 3 files changed, 294 insertions(+), 305 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h index 9add5f2451ac..7775b123b27d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h @@ -45,6 +45,8 @@ namespace CustomInterfaces virtual void setup(); virtual void run(); + + public slots: virtual bool validate(); private slots: diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui index 09e666b7d3a3..febb43048cad 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui @@ -23,257 +23,195 @@ 0 - - 0 - - - - 0 - - - 0 - - - + + + - - - - - - - - 0 - 41 - - - - Run Files - - - true - - - - - - - false - - - - 0 - 0 - - - - true - - - false - - - _calib - - - _calib.nxs - - - - - - - - - - - Sum multiple files together. - - - Sum Files - - - - - - - Load Logs - - - - - - - Use calibration file to adjust for detector efficiency. - - - Use Calib File - - - - - - + + + + 0 + 41 + + + + Run Files + + + true + + - - - 6 + + + false + + + + 0 + 0 + + + + true + + + false + + + _calib + + + _calib.nxs + + + + + + + + + + + Sum multiple files together. + + Sum Files + + + + + + + Load Logs + + + + + + + Use calibration file to adjust for detector efficiency. + + + Use Calib File + + + + + + + + + + + 6 + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Grouping + + + cbMappingOptions + + + + + + + Select type of detector grouping to apply. + + + + Default + + + + + Individual + + + + + Groups + + + + + All + + + + + File + + + + + + + + 0 + + + 2 + + + - + - + 0 - 0 + 41 - - Qt::LeftToRight - - - Grouping + + false - - cbMappingOptions + + - - - - - - Select type of detector grouping to apply. + + false - - - Default - - - - - Individual - - - - - Groups - - - - - All - - - - - File - - - - - - - - 0 + + - - 2 + + + .map + - - - - - - - 0 - 41 - - - - false - - - - - - false - - - - - - - .map - - - - - - - - - - - - Number of Groups: - - - leNoGroups - - - - - - - Desired number of groups. - - - - - - - color: rgb(255, 0, 4) - - - * - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - + + + - - - Remove a range of background value. - + - Background Removal + Number of Groups: - + + + + Qt::Horizontal @@ -285,21 +223,49 @@ - - - - Plot raw time values. - - - Plot Time - - - - - - - + + + + + + + + + + + + Remove a range of background value. + + + Background Removal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Plot raw time values. + + + Plot Time + + + + @@ -350,7 +316,7 @@ - + Qt::Horizontal @@ -411,7 +377,7 @@ - + Qt::Horizontal @@ -438,7 +404,7 @@ - + Qt::Horizontal @@ -498,7 +464,7 @@ - + Qt::Horizontal @@ -549,7 +515,7 @@ 0 - + 0 @@ -558,7 +524,7 @@ 0 - + 6 @@ -568,7 +534,7 @@ - Low + Low: @@ -596,7 +562,7 @@ - + Qt::Horizontal @@ -611,7 +577,7 @@ - Width + Width: @@ -639,7 +605,7 @@ - + Qt::Horizontal @@ -654,7 +620,7 @@ - High + High: @@ -685,18 +651,12 @@ - - - - 0 - - - 0 - + + - Rebin String + Rebin String: @@ -707,6 +667,16 @@ + + + + color: rgb(255, 0, 4) + + + * + + + @@ -717,7 +687,7 @@ - + Output @@ -735,7 +705,7 @@ 0 - + @@ -744,7 +714,7 @@ - + Qt::Horizontal @@ -808,7 +778,7 @@ - + Qt::Horizontal @@ -823,7 +793,7 @@ - + diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp index 2886438849e8..af6a506e72ab 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp @@ -1,6 +1,7 @@ #include "MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h" #include "MantidQtCustomInterfaces/Background.h" +#include "MantidQtCustomInterfaces/UserInputValidator.h" #include #include @@ -20,9 +21,6 @@ namespace CustomInterfaces { m_uiForm.setupUi(parent); - // Add validators to UI form - m_uiForm.leNoGroups->setValidator(m_valInt); - // SIGNAL/SLOT CONNECTIONS // Update instrument information when a new instrument config is selected connect(this, SIGNAL(newInstrumentConfiguration()), this, SLOT(setInstrumentDefault())); @@ -32,15 +30,21 @@ namespace CustomInterfaces connect(m_uiForm.pbBackgroundRemoval, SIGNAL(clicked()), this, SLOT(backgroundClicked())); // Plots raw input data when user clicks Plot Time connect(m_uiForm.pbPlotTime, SIGNAL(clicked()), this, SLOT(plotRaw())); - // Shows message on run buton when user is inputting a run number + // Shows message on run button when user is inputting a run number connect(m_uiForm.dsRunFiles, SIGNAL(fileTextChanged(const QString &)), this, SLOT(pbRunEditing())); // Shows message on run button when Mantid is finding the file for a given run number connect(m_uiForm.dsRunFiles, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); // Reverts run button back to normal when file finding has finished connect(m_uiForm.dsRunFiles, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); - + // Handle algorithm completion connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); + // Re-validate when certain inputs are changed + connect(m_uiForm.spRebinLow, SIGNAL(valueChanged(double)), this, SLOT(validate())); + connect(m_uiForm.spRebinWidth, SIGNAL(valueChanged(double)), this, SLOT(validate())); + connect(m_uiForm.spRebinHigh, SIGNAL(valueChanged(double)), this, SLOT(validate())); + connect(m_uiForm.leRebinString, SIGNAL(textChanged(const QString &)), this, SLOT(validate())); + // Update UI widgets to show default values mappingOptionSelected(m_uiForm.cbMappingOptions->currentText()); backgroundRemoval(); @@ -56,10 +60,55 @@ namespace CustomInterfaces { } + void IndirectConvertToEnergy::setup() { } + + bool IndirectConvertToEnergy::validate() + { + UserInputValidator uiv; + + // Run files input + if(!m_uiForm.dsRunFiles->isValid()) + uiv.addErrorMessage("Run file range is invalid."); + + // Calibration file input + if(m_uiForm.ckUseCalib->isChecked() && !m_uiForm.dsCalibrationFile->isValid()) + uiv.addErrorMessage("Calibration file/workspace is invalid."); + + // Mapping file + if((m_uiForm.cbMappingOptions->currentText() == "File") && (!m_uiForm.dsMapFile->isValid())) + uiv.addErrorMessage("Mapping file is invalid."); + + // Rebinning + if(!m_uiForm.ckDoNotRebin->isChecked()) + { + if(m_uiForm.cbRebinType->currentText() == "Single") + { + bool rebinValid = !uiv.checkBins(m_uiForm.spRebinLow->value(), m_uiForm.spRebinWidth->value(), m_uiForm.spRebinHigh->value()); + m_uiForm.valRebinLow->setVisible(rebinValid); + m_uiForm.valRebinWidth->setVisible(rebinValid); + m_uiForm.valRebinHigh->setVisible(rebinValid); + } + else + { + uiv.checkFieldIsNotEmpty("Rebin string", m_uiForm.leRebinString, m_uiForm.valRebinString); + } + } + else + { + m_uiForm.valRebinLow->setVisible(false); + m_uiForm.valRebinWidth->setVisible(false); + m_uiForm.valRebinHigh->setVisible(false); + m_uiForm.valRebinString->setVisible(false); + } + + return uiv.isAllInputValid(); + } + + void IndirectConvertToEnergy::run() { using MantidQt::API::BatchAlgorithmRunner; @@ -141,11 +190,9 @@ namespace CustomInterfaces m_batchAlgoRunner->addAlgorithm(reductionAlg); m_batchAlgoRunner->executeBatchAsync(); - - // Set output workspace name for Python export - m_pythonExportWsName = "IndirectInergyTransfer_Workspaces"; } + /** * Handles completion of the algorithm. * @@ -170,36 +217,6 @@ namespace CustomInterfaces AnalysisDataService::Instance().remove("IndirectEnergyTransfer_Workspaces"); } - bool IndirectConvertToEnergy::validate() - { - bool valid = true; - - // Run files input - if(!m_uiForm.dsRunFiles->isValid()) - valid = false; - - // Calibration file input - if(m_uiForm.ckUseCalib->isChecked() && !m_uiForm.dsCalibrationFile->isValid()) - valid = false; - - // Mapping selection - if( - (m_uiForm.cbMappingOptions->currentText() == "Groups" && m_uiForm.leNoGroups->text() == "") - || - (m_uiForm.cbMappingOptions->currentText() == "File" && ! m_uiForm.dsMapFile->isValid()) - ) - { - valid = false; - m_uiForm.valNoGroups->setText("*"); - } - else - { - m_uiForm.valNoGroups->setText(""); - } - - return valid; - } - /** * Called when the instrument has changed, used to update default values. @@ -346,7 +363,7 @@ namespace CustomInterfaces IAlgorithm_sptr groupingAlg = AlgorithmManager::Instance().create("CreateGroupingWorkspace"); groupingAlg->initialize(); - groupingAlg->setProperty("FixedGroupCount", m_uiForm.leNoGroups->text().toInt()); + groupingAlg->setProperty("FixedGroupCount", m_uiForm.spNumberGroups->value()); groupingAlg->setProperty("InstrumentName", getInstrumentConfiguration()->getInstrumentName().toStdString()); groupingAlg->setProperty("ComponentName", getInstrumentConfiguration()->getAnalyserName().toStdString()); groupingAlg->setProperty("OutputWorkspace", groupWS.toStdString()); From 15c07d12ea69c23bacc9e42347cb7600f90d08b1 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Tue, 27 Jan 2015 15:48:57 +0000 Subject: [PATCH 072/130] Re #10958 Fixed separate/common monitor loading --- .../Direct/DirectEnergyConversion.py | 228 ++++-------------- .../scripts/Inelastic/Direct/RunDescriptor.py | 12 +- .../scripts/Inelastic/Direct/dgreduce.py | 8 +- .../test/DirectEnergyConversionTest.py | 2 +- Code/Mantid/scripts/test/RunDescriptorTest.py | 8 +- 5 files changed, 68 insertions(+), 190 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py index 757bdf5f34ed..48e42743375c 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py +++ b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py @@ -217,10 +217,10 @@ def diagnose(self, white,diag_sample=None,**kwargs): # Get the white beam vanadium integrals - whiteintegrals = self.do_white(white, None, None,None) # No grouping yet + whiteintegrals = self.do_white(white, None, None) # No grouping yet if self.second_white: second_white = self.second_white - other_whiteintegrals = self.do_white(PropertyManager.second_white, None, None,None) # No grouping yet + other_whiteintegrals = self.do_white(PropertyManager.second_white, None, None) # No grouping yet self.second_white = other_whiteintegrals # Get the background/total counts from the sample run if present @@ -429,7 +429,7 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, return deltaE_wkspace_sample - def do_white(self, run, spectra_masks=None, map_file=None,mon_number=None): + def do_white(self, run, spectra_masks=None, map_file=None): """ Create the workspace, which each spectra containing the correspondent white beam integral (single value) @@ -574,7 +574,7 @@ def remap(self, result_ws, spec_masks, map_file): return mtd[ws_name] #------------------------------------------------------------------------------- - def normalise(self, run, method, range_offset=0.0,mon_index=None): + def normalise(self, run, method, range_offset=0.0): """ Apply normalization using specified source """ @@ -593,14 +593,13 @@ def normalise(self, run, method, range_offset=0.0,mon_index=None): output = mtd[result_name] return output - method = method.lower() for case in common.switch(method): if case('monitor-1'): - method,old_ws_name = self._normalize_to_monitor1(run,old_ws_name, range_offset,mon_index) + method,old_ws_name = self._normalize_to_monitor1(run,old_ws_name, range_offset) break if case('monitor-2'): - method,old_ws_name = self._normalize_to_monitor2(run,old_ws_name, range_offset,mon_index) + method,old_ws_name = self._normalize_to_monitor2(run,old_ws_name, range_offset) break if case('current'): NormaliseByCurrent(InputWorkspace=old_ws_name,OutputWorkspace=old_ws_name) @@ -617,23 +616,22 @@ def normalise(self, run, method, range_offset=0.0,mon_index=None): run.synchronize_ws(output) return output # - def _normalize_to_monitor1(self,run,old_name,range_offset=0.0,mon_index=None): + def _normalize_to_monitor1(self,run,old_name,range_offset=0.0): """ Helper method implementing normalize_to_monitor1 """ - if not mon_index: - mon_index = int(self.mon1_norm_spec) # get monitor's workspace - mon_ws = run.get_monitors_ws(mon_index) + mon_ws = run.get_monitors_ws() if not mon_ws: # no monitors if self.__in_white_normalization: # we can normalize wb integrals by current separately as they often do not # have monitors - self.normalise(run,'current',range_offset,mon_index) + self.normalise(run,'current',range_offset) new_name = run.get_ws_name() return ('current',new_name) else: raise RuntimeError('Normalise by monitor-1:: Workspace {0} for run {1} does not have monitors in it'\ .format(run.get_ws_name(),run.__get__())) + range = self.norm_mon_integration_range range_min = float(range[0] + range_offset) range_max = float(range[1] + range_offset) @@ -641,27 +639,47 @@ def _normalize_to_monitor1(self,run,old_name,range_offset=0.0,mon_index=None): kwargs = {'NormFactorWS':'NormMon1_WS' + data_ws.getName()} else: kwargs = {} - NormaliseToMonitor(InputWorkspace=old_name,OutputWorkspace=old_name, MonitorWorkspace=mon_ws, MonitorID=mon_index, - IntegrationRangeMin=range_min, IntegrationRangeMax=range_max,IncludePartialBins=True,**kwargs) + separate_monitors = run.is_monws_separate() + mon_spect = self.prop_man.mon1_norm_spec + if separate_monitors: + kwargs['MonitorWorkspace'] = mon_ws + kwargs['MonitorWorkspaceIndex']= int(mon_ws.getIndexFromSpectrumNumber(int(mon_spect))) + else: + kwargs['MonitorSpectrum']= int(mon_spect) # shame TODO: change algorithm + + + NormaliseToMonitor(InputWorkspace=old_name,OutputWorkspace=old_name, IntegrationRangeMin=range_min, + IntegrationRangeMax=range_max,IncludePartialBins=True,**kwargs) return ('monitor-1',old_name) # - def _normalize_to_monitor2(self,run,old_name, range_offset=0.0,mon_index=None): + def _normalize_to_monitor2(self,run,old_name, range_offset=0.0): """ Helper method implementing normalize_to_monitor_2 """ - if not mon_index: - mon_index = int(self.mon2_norm_spec) - # get monitor's workspace - mon_ws = run.get_monitors_ws(mon_index) + mon_ws = run.get_monitors_ws() if not mon_ws: # no monitors if self.__in_white_normalization: # we can normalize wb integrals by current separately as they often do not # have monitors - self.normalise(run,'current',range_offset,mon_index) + self.normalise(run,'current',range_offset) new_name = run.get_ws_name() return ('current',new_name) else: raise RuntimeError('Normalize by monitor-2:: Workspace {0} for run {1} does not have monitors in it'\ .format(run.get_ws_name(),run.__get__())) + # + if self._debug_mode: + kwargs = {'NormFactorWS':'NormMon2_WS' + mon_ws.getName()} + else: + kwargs = {} + separate_monitors = run.is_monws_separate() + mon_spect = self.prop_man.mon2_norm_spec + mon_index = int(mon_ws.getIndexFromSpectrumNumber(mon_spect)) + if separate_monitors: + kwargs['MonitorWorkspace'] = mon_ws + kwargs['MonitorWorkspaceIndex'] = mon_index + else: + kwargs['MonitorSpectrum'] = mon_spect + #Find TOF range, correspondent to incident energy monitor peak if self._mon2_norm_time_range: range = self._mon2_norm_time_range @@ -675,24 +693,20 @@ def _normalize_to_monitor2(self,run,old_name, range_offset=0.0,mon_index=None): raise RuntimeError("Instrument have been shifted but no time range has been identified. Monitor-2 normalization can not be performed ") else: energy_rage = self.mon2_norm_energy_range - TOF_range = self.get_TOF_for_energies(mon_ws,energy_rage,[mon_index],self._debug_mode) + TOF_range = self.get_TOF_for_energies(mon_ws,energy_rage,[mon_spect],self._debug_mode) range_min = TOF_range[0] range_max = TOF_range[1] # - if self._debug_mode: - kwargs = {'NormFactorWS':'NormMon2_WS' + mon_ws.getName()} - else: - kwargs = {} # Normalize to monitor 2 - NormaliseToMonitor(InputWorkspace=old_name,OutputWorkspace=old_name, MonitorWorkspace=mon_ws, MonitorID=mon_index, - IntegrationRangeMin=range_min, IntegrationRangeMax=range_max,IncludePartialBins=True,**kwargs) + NormaliseToMonitor(InputWorkspace=old_name,OutputWorkspace=old_name,IntegrationRangeMin=range_min, + IntegrationRangeMax=range_max,IncludePartialBins=True,**kwargs) return ('monitor-2',old_name) #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # @staticmethod - def get_TOF_for_energies(workspace,energy_list,detID_list,debug_mode=False): + def get_TOF_for_energies(workspace,energy_list,specID_list,debug_mode=False): """ Method to find what TOF range corresponds to given energy range for given workspace and detectors. @@ -707,8 +721,8 @@ def get_TOF_for_energies(workspace,energy_list,detID_list,debug_mode=False): range_ws_name = '_TOF_range_ws' y = [1] * (len(energy_list) - 1) TOF_range = [] - for detID in detID_list: - ind = workspace.getIndexFromSpectrumNumber(detID) + for specID in specID_list: + ind = workspace.getIndexFromSpectrumNumber(specID) ExtractSingleSpectrum(InputWorkspace=workspace, OutputWorkspace=template_ws_name, WorkspaceIndex=ind) CreateWorkspace(OutputWorkspace=range_ws_name,NSpec = 1,DataX=energy_list,DataY=y,UnitX='Energy',ParentWorkspace=template_ws_name) range_ws = ConvertUnits(InputWorkspace=range_ws_name,OutputWorkspace=range_ws_name,Target='TOF',EMode='Elastic') @@ -719,7 +733,7 @@ def get_TOF_for_energies(workspace,energy_list,detID_list,debug_mode=False): DeleteWorkspace(template_ws_name) DeleteWorkspace(range_ws_name) # - if len(detID_list) == 1: + if len(specID_list) == 1: TOF_range = TOF_range[0] return TOF_range @@ -1100,150 +1114,8 @@ def _build_white_tag(self): # ------------------------------------------------------------------------------------------- def _do_mono_SNS(self, data_ws, result_name, ei_guess, white_run=None, map_file=None, spectra_masks=None, Tzero=None): - - raise NotImplementedError("Despite it may work, it have not been modified or verified and is probably wrong") - - # - # Special load monitor stuff. - propman = self.prop_man - if (propman.instr_name == "CNCS" or propman.instr_name == "HYSPEC"): - propman.fix_ei = True - ei_value = ei_guess - if (propman.instr_name == "HYSPEC"): - Tzero = 4.0 + 107.0 / (1 + math.pow((ei_value / 31.0),3.0)) - propman.log("Determined T0 of %s for HYSPEC" % str(Tzero)) - if (Tzero is None): - tzero = (0.1982 * (1 + ei_value) ** (-0.84098)) * 1000.0 - else: - tzero = Tzero - # apply T0 shift - ScaleX(InputWorkspace=data_ws,OutputWorkspace=result_name,Operation="Add",Factor=-tzero) - mon1_peak = 0.0 - elif (propman.instr_name == "ARCS" or propman.instr_name == "SEQUOIA"): - if 'Filename' in data_ws.getRun(): mono_run = data_ws.getRun()['Filename'].value - else: raise RuntimeError('Cannot load monitors for event reduction. Unable to determine Filename from mono workspace, it should have been added as a run log.') - - propman.log("mono_run = %s (%s)" % (mono_run,type(mono_run)),'debug') - - if mono_run.endswith("_event.nxs"): - monitor_ws = LoadNexusMonitors(Filename=mono_run) - elif mono_run.endswith("_event.dat"): - InfoFilename = mono_run.replace("_neutron_event.dat", "_runinfo.xml") - monitor_ws = LoadPreNexusMonitors(RunInfoFilename=InfoFilename) - - argi = {} - argi['Monitor1Spec'] = int(propman.ei_mon_spectra[0]) - argi['Monitor2Spec'] = int(propman.ei_mon_spectra[1]) - argi['EnergyEstimate'] = ei_guess - argi['FixEi'] = propman.fix_ei - if hasattr(self, 'ei_mon_peak_search_range'): - argi['PeakSearchRange'] = self.ei_mon_peak_search_range - - try: - ei_calc,firstmon_peak,firstmon_index,TzeroCalculated = \ - GetEi(InputWorkspace=monitor_ws,**argi) - except: - propman.log("Error in GetEi. Using entered values.") - #monitor_ws.getRun()['Ei'] = ei_value - ei_value = ei_guess - AddSampleLog(Workspace=monitor_ws,LogName= 'Ei',LogText= ei_value,LogType= "Number") - ei_calc = None - TzeroCalculated = Tzero - - # Set the tzero to be the calculated value - if (TzeroCalculated is None): - tzero = 0.0 - else: - tzero = TzeroCalculated - - # If we are fixing, then use the guess if given - if (propman.fix_ei): - ei_value = ei_guess - # If a Tzero has been entered, use it, if we are fixing. - if (Tzero is not None): - tzero = Tzero - else: - if (ei_calc is not None): - ei_value = ei_calc - else: - ei_value = ei_guess - - mon1_peak = 0.0 - # apply T0 shift - ScaleX(InputWorkspace=data_ws,OutputWorkspace= result_name,Operation="Add",Factor=-tzero) - else: - # Do ISIS stuff for Ei - # Both are these should be run properties really - ei_value, mon1_peak = self.get_ei(data_ws,monitor_ws, result_name, ei_guess) - self.prop_man.incident_energy = ei_value - - # As we've shifted the TOF so that mon1 is at t=0.0 we need to account - # for this in CalculateFlatBackground and normalization - bin_offset = -mon1_peak - - # For event mode, we are going to histogram in energy first, then go - # back to TOF - if propman.check_background == True: - # Extract the time range for the background determination before we - # throw it away - background_bins = "%s,%s,%s" % (propman.bkgd_range[0] + bin_offset, (propman.bkgd_range[1] - propman.bkgd_range[0]), propman.bkgd_range[1] + bin_offset) - Rebin(InputWorkspace=result_name,OutputWorkspace= "background_origin_ws",Params=background_bins) - - # Convert to Et - ConvertUnits(InputWorkspace=result_name,OutputWorkspace= "_tmp_energy_ws", Target="DeltaE",EMode="Direct", EFixed=ei_value) - RenameWorkspace(InputWorkspace="_tmp_energy_ws",OutputWorkspace= result_name) - # Histogram - Rebin(InputWorkspace=result_name,OutputWorkspace= "_tmp_rebin_ws",Params= propman.energy_bins, PreserveEvents=False) - RenameWorkspace(InputWorkspace="_tmp_rebin_ws",OutputWorkspace= result_name) - # Convert back to TOF - ConvertUnits(InputWorkspace=result_name,OutputWorkspace=result_name, Target="TOF",EMode="Direct", EFixed=ei_value) - - if propman.check_background == True: - # Remove the count rate seen in the regions of the histograms - # defined as the background regions, if the user defined such - # region - ConvertToDistribution(Workspace=result_name) - - CalculateFlatBackground(InputWorkspace="background_origin_ws",OutputWorkspace= "background_ws", - StartX= propman.bkgd_range[0] + bin_offset,EndX= propman.bkgd_range[1] + bin_offset, - WorkspaceIndexList= '',Mode= 'Mean',OutputMode= 'Return Background') - # Delete the raw data background region workspace - DeleteWorkspace("background_origin_ws") - # Convert to distribution to make it compatible with the data - # workspace (result_name). - ConvertToDistribution(Workspace="background_ws") - # Subtract the background - Minus(LHSWorkspace=result_name,RHSWorkspace= "background_ws",OutputWorkspace=result_name) - # Delete the determined background - DeleteWorkspace("background_ws") - - ConvertFromDistribution(Workspace=result_name) - - # Normalize using the chosen method - # This should be done as soon as possible after loading and usually - # happens at diag. Here just in case if diag was bypassed - norm_ws = self.normalise(mtd[result_name], propman.normalise_method, range_offset=bin_offset) - - - - # This next line will fail the SystemTests - #ConvertUnits(result_ws, result_ws, Target="DeltaE",EMode='Direct', - #EFixed=ei_value) - # But this one passes... - ConvertUnits(InputWorkspace=norm_ws,OutputWorkspace=result_name, Target="DeltaE",EMode='Direct') - propman.log("_do_mono: finished ConvertUnits for : " + result_name) - - - - if propman.energy_bins : - Rebin(InputWorkspace=result_name,OutputWorkspace=result_name,Params= propman.energy_bins,PreserveEvents=False) - - if propman.apply_detector_eff: - # Need to be in lambda for detector efficiency correction - ConvertUnits(InputWorkspace=result_name,OutputWorkspace= result_name, Target="Wavelength", EMode="Direct", EFixed=ei_value) - He3TubeEfficiency(InputWorkspace=result_name,OutputWorkspace=result_name) - ConvertUnits(InputWorkspace=result_name,OutputWorkspace= result_name, Target="DeltaE",EMode='Direct', EFixed=ei_value) - ############ + # does not work -- retrieve from repo and fix + raise NotImplementedError("Non currently implemented. Retrieve from repository if necessary") return #------------------------------------------------------------------------------- def _do_mono_ISIS(self, data_run, ei_guess, @@ -1335,7 +1207,7 @@ def _do_mono(self, run, ei_guess, ConvertToDistribution(Workspace=result_ws) # White beam correction if white_run is not None: - white_ws = self.do_white(white_run, spectra_masks, map_file,None) + white_ws = self.do_white(white_run, spectra_masks, map_file) result_ws /= white_ws DeleteWorkspace(white_ws) @@ -1343,7 +1215,7 @@ def _do_mono(self, run, ei_guess, result_ws *= prop_man.scale_factor return result_ws #------------------------------------------------------------------------------- - def _get_wb_inegrals(self,run,mon_number=None): + def _get_wb_inegrals(self,run): """ """ run = self.get_run_descriptor(run) white_ws = run.get_workspace() @@ -1376,7 +1248,7 @@ def _get_wb_inegrals(self,run,mon_number=None): # Normalize self.__in_white_normalization = True - white_ws = self.normalise(run, self.normalise_method,0.0,mon_number) + white_ws = self.normalise(run, self.normalise_method,0.0) self.__in_white_normalization = False new_ws_name = run.set_action_suffix('_norm_white') old_name = white_ws.name() diff --git a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py index a663a27f81d3..bc7e660969a2 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py +++ b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py @@ -372,8 +372,14 @@ def get_monitors_ws(self,monitor_ID = None): ws_index = mon_ws.getIndexFromSpectrumNumber(monitor_ID) except: # mon_ws = None - #else: #TODO: get list of monitors and verify that they are indeed in monitor workspace - + else: + mon_list = self._holder.get_used_monitors_list() + for monID in mon_list: + try: + ws_ind = mon_ws.getIndexFromSpectrumNumber(int(monID)) + except: + mon_ws = None + break return mon_ws #-------------------------------------------------------------------------------------------------------------------- def get_ws_name(self): @@ -412,7 +418,7 @@ def load_run(self,inst_name, calibration=None, force=False, load_mon_with_worksp else: # If it doesn't exists as a workspace assume we have to try and load a file data_file = self.find_file(None,filePath,fileExt,**kwargs) - if data_file[0:4] == 'ERROR': + if data_file.find('ERROR')>-1: raise IOError(data_file) if load_mon_with_workspace: diff --git a/Code/Mantid/scripts/Inelastic/Direct/dgreduce.py b/Code/Mantid/scripts/Inelastic/Direct/dgreduce.py index 532bb581e6f6..80b41f20c374 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/dgreduce.py +++ b/Code/Mantid/scripts/Inelastic/Direct/dgreduce.py @@ -15,7 +15,7 @@ #DRC=reload(DRC) def getReducer(): # needed on Linux to adhere to correct reference return - global Reducer; + global Reducer return Reducer def setup(instname=None,reload=False): @@ -33,7 +33,7 @@ def setup(instname=None,reload=False): if not (Reducer is None) : - old_name=Reducer.prop_man.instr_name; + old_name=Reducer.prop_man.instr_name if old_name.upper()[0:3] == instname.upper()[0:3] : if not reload : return # has been already defined @@ -140,11 +140,11 @@ def arb_units(wb_run,sample_run,ei_guess,rebin,map_file='default',monovan_run=No n,r=funcreturns.lhs_info('both') wksp_out=r[0] except: - wksp_out = Reducer.prop_man.get_sample_ws_name(); + wksp_out = Reducer.prop_man.get_sample_ws_name() # res = Reducer.convert_to_energy(wb_run,sample_run,ei_guess,rebin,map_file,monovan_run,second_wb,**kwargs) # - results_name = res.name(); + results_name = res.name() if results_name != wksp_out: RenameWorkspace(InputWorkspace=results_name,OutputWorkspace=wksp_out) diff --git a/Code/Mantid/scripts/test/DirectEnergyConversionTest.py b/Code/Mantid/scripts/test/DirectEnergyConversionTest.py index 7fae66489e9c..c9ed9ef01061 100644 --- a/Code/Mantid/scripts/test/DirectEnergyConversionTest.py +++ b/Code/Mantid/scripts/test/DirectEnergyConversionTest.py @@ -121,7 +121,7 @@ def test_do_white_wb(self) : tReducer = DirectEnergyConversion(wb_ws.getInstrument()) - white_ws = tReducer.do_white(wb_ws, None, None,None) + white_ws = tReducer.do_white(wb_ws, None, None) self.assertTrue(white_ws) diff --git a/Code/Mantid/scripts/test/RunDescriptorTest.py b/Code/Mantid/scripts/test/RunDescriptorTest.py index 19af98ad046f..dab75cac8ee8 100644 --- a/Code/Mantid/scripts/test/RunDescriptorTest.py +++ b/Code/Mantid/scripts/test/RunDescriptorTest.py @@ -125,8 +125,8 @@ def test_load_workspace(self): def test_copy_spectra2monitors(self): propman = self.prop_man run_ws = CreateSampleWorkspace( Function='Multiple Peaks', WorkspaceType = 'Event',NumBanks=1, BankPixelWidth=5, NumEvents=100) - run_ws_monitors = CreateSampleWorkspace( Function='Multiple Peaks', WorkspaceType = 'Histogram',NumBanks=1, BankPixelWidth=1, NumEvents=100) - self.assertEqual(run_ws_monitors.getNumberHistograms(),1) + run_ws_monitors = CreateSampleWorkspace( Function='Multiple Peaks', WorkspaceType = 'Histogram',NumBanks=2, BankPixelWidth=1, NumEvents=100) + self.assertEqual(run_ws_monitors.getNumberHistograms(),2) propman.monovan_run = run_ws @@ -134,8 +134,8 @@ def test_copy_spectra2monitors(self): mon_ws = PropertyManager.monovan_run.get_monitors_ws() self.assertTrue(isinstance(mon_ws, api.Workspace)) - self.assertEqual(mon_ws.getNumberHistograms(),2) - self.assertEqual(mon_ws.getIndexFromSpectrumNumber(3),1) + self.assertEqual(mon_ws.getNumberHistograms(),3) + self.assertEqual(mon_ws.getIndexFromSpectrumNumber(3),2) def test_ws_name(self): run_ws = CreateSampleWorkspace( Function='Multiple Peaks', NumBanks=1, BankPixelWidth=4, NumEvents=100) From 0bae28c8a5e532e073504de0e5ad9e87186e9683 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 16:10:54 +0000 Subject: [PATCH 073/130] Work in progress moving IDA Refs #10960 --- .../Indirect/ApplyCorr.h | 3 + .../Indirect/ApplyCorr.ui | 2 +- .../Indirect/CalcCorr.h | 3 + .../Indirect/CalcCorr.ui | 2 +- .../Indirect/ConvFit.h | 3 + .../Indirect/ConvFit.ui | 10 +- .../MantidQtCustomInterfaces/Indirect/Elwin.h | 3 + .../Indirect/Elwin.ui | 20 +- .../MantidQtCustomInterfaces/Indirect/Fury.h | 4 +- .../MantidQtCustomInterfaces/Indirect/Fury.ui | 4 +- .../Indirect/FuryFit.h | 2 + .../Indirect/FuryFit.ui | 38 +- .../Indirect/IDATab.h | 7 +- .../Indirect/IndirectDataAnalysis.ui | 2805 +---------------- .../Indirect/MSDFit.h | 2 + .../Indirect/MSDFit.ui | 2 +- .../src/Indirect/ApplyCorr.cpp | 125 +- .../src/Indirect/CalcCorr.cpp | 286 +- .../CustomInterfaces/src/Indirect/ConvFit.cpp | 267 +- .../CustomInterfaces/src/Indirect/Elwin.cpp | 48 +- .../CustomInterfaces/src/Indirect/Fury.cpp | 35 +- .../CustomInterfaces/src/Indirect/FuryFit.cpp | 93 +- .../CustomInterfaces/src/Indirect/IDATab.cpp | 32 +- .../CustomInterfaces/src/Indirect/MSDFit.cpp | 69 +- 24 files changed, 523 insertions(+), 3342 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h index 1a6f5ed49a67..72c27060220b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h @@ -2,6 +2,7 @@ #define MANTIDQTCUSTOMINTERFACESIDA_APPLYCORR_H_ #include "MantidAPI/MatrixWorkspace.h" +#include "ui_ApplyCorr.h" #include "IDATab.h" namespace MantidQt @@ -34,6 +35,8 @@ namespace IDA bool validateScaleInput(); ///< validate input for Scale option. /// ask the user if they wish to rebin the can bool requireCanRebin(); + + Ui::ApplyCorr m_uiForm; /// Pointer to the result workspace (for plotting) Mantid::API::MatrixWorkspace_sptr outputWs; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui index db8c395fa2fc..1d98b6799c64 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui @@ -345,7 +345,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h index 9845fa67d11b..106a4eeea1b9 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h @@ -1,6 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_CALCCORR_H_ #define MANTIDQTCUSTOMINTERFACESIDA_CALCCORR_H_ +#include "ui_CalcCorr.ui" #include "IDATab.h" namespace MantidQt @@ -30,8 +31,10 @@ namespace IDA void getBeamWidthFromWorkspace(const QString& wsname); private: + Ui::CalcCorr m_uiForm; QDoubleValidator * m_dblVal; QDoubleValidator * m_posDblVal; + }; } // namespace IDA } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui index bd1778cd8ed9..41eb7b5190f7 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui @@ -1050,7 +1050,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.h index c396eae1bee0..2d9edc4946e0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.h @@ -1,6 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_CONVFIT_H_ #define MANTIDQTCUSTOMINTERFACESIDA_CONVFIT_H_ +#include "ui_ConvFit.h" #include "IDATab.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/CompositeFunction.h" @@ -57,12 +58,14 @@ namespace IDA QString fitTypeString() const; QString backgroundString() const; + Ui::ConvFit m_uiForm; QtStringPropertyManager* m_stringManager; QtTreePropertyBrowser* m_cfTree; QMap m_fixedProps; boost::shared_ptr m_cfInputWS; QString m_cfInputWSName; bool m_confitResFileType; + }; } // namespace IDA } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui index 198b12c7f014..a6c07beef55f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui @@ -19,7 +19,7 @@ Input - + @@ -47,7 +47,7 @@ - + 0 @@ -77,7 +77,7 @@ - + 0 @@ -148,7 +148,7 @@ - + Background @@ -434,7 +434,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.h index 7e860508075e..117b6194e686 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.h @@ -1,6 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_ELWIN_H_ #define MANTIDQTCUSTOMINTERFACESIDA_ELWIN_H_ +#include "ui_Elwin.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidQtCustomInterfaces/Indirect/IDATab.h" @@ -37,6 +38,8 @@ namespace IDA private: void addSaveAlgorithm(QString workspaceName, QString filename=""); + + Ui::Elwin m_uiForm; QtTreePropertyBrowser* m_elwTree; }; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui index f03b188a0750..147dea816d51 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Elwin.ui @@ -21,7 +21,7 @@
- + 0 @@ -51,21 +51,21 @@ - + - + - + - + Preview file: - + 0 @@ -75,14 +75,14 @@ - + Spectrum: - + 0 @@ -91,7 +91,7 @@ - + @@ -183,7 +183,7 @@ MantidQt::MantidWidgets::MWRunFiles QWidget -
mantidqt::mantidwidgets::mwrunfiles.h
+
MantidQtMantidWidgets/MWRunFiles.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.h index 3de4cc766740..d67bcef60978 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.h @@ -1,6 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_FURY_H_ #define MANTIDQTCUSTOMINTERFACESIDA_FURY_H_ +#include "ui_Fury.h" #include "IDATab.h" namespace MantidQt @@ -29,8 +30,9 @@ namespace IDA void updateRS(QtProperty* prop, double val); void updatePropertyValues(QtProperty* prop, double val); void calculateBinning(); - + private: + Ui::Fury m_uiForm; QtTreePropertyBrowser* m_furTree; bool m_furyResFileType; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui index d9dc49b2230d..a9f91fc7f6fc 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/Fury.ui @@ -19,7 +19,7 @@ Input - + @@ -185,7 +185,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.h index c11edb0f0cba..94a6e1fa13d6 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.h @@ -1,6 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_FURYFIT_H_ #define MANTIDQTCUSTOMINTERFACESIDA_FURYFIT_H_ +#include "ui_FuryFit.h" #include "IDATab.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/MatrixWorkspace.h" @@ -61,6 +62,7 @@ namespace IDA QString fitTypeString() const; void constrainIntensities(Mantid::API::CompositeFunction_sptr func); + Ui::FuryFit m_uiForm; QtStringPropertyManager* m_stringManager; QtTreePropertyBrowser* m_ffTree; ///< FuryFit Property Browser QtDoublePropertyManager* m_ffRangeManager; ///< StartX and EndX for FuryFit diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui index d8b2d65731c1..df6577a0f9f1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/FuryFit.ui @@ -19,7 +19,7 @@ Input - + @@ -52,11 +52,11 @@ - + - + 0 @@ -69,7 +69,7 @@ - + 1 Exponential @@ -97,7 +97,7 @@ - + Plot Guess @@ -107,7 +107,7 @@ - + Constrain Intensities @@ -117,7 +117,7 @@ - + false @@ -129,26 +129,26 @@ - + - + - + - + Fit Single Spectrum - + Qt::Horizontal @@ -161,14 +161,14 @@ - + Sample - + color: rgb(255, 0, 0); @@ -182,14 +182,14 @@ - + Plot Spectrum: - + 0 @@ -219,7 +219,7 @@ - + 0 @@ -236,7 +236,7 @@ - + 0 @@ -345,7 +345,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h index 3349a0d61683..c1a1e2b4369f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h @@ -66,14 +66,9 @@ namespace IDA /// Function to run a string as python code void runPythonScript(const QString& pyInput); /// Check the binning between two workspaces match - bool checkWorkspaceBinningMatches(Mantid::API::MatrixWorkspace_const_sptr left, + bool checkWorkspaceBinningMatches(Mantid::API::MatrixWorkspace_const_sptr left, Mantid::API::MatrixWorkspace_const_sptr right); - /// Returns a handle to the UI form object stored in the IndirectDataAnalysis class. - Ui::IndirectDataAnalysis & uiForm(); - /// Returns a const handle to the UI form object stored in the IndirectDataAnalysis class. - const Ui::IndirectDataAnalysis & uiForm() const; - /// Returns a handle to the DoubleEditorFactory object stored in the IndirectDataAnalysis class. DoubleEditorFactory * doubleEditorFactory(); /// Returns a handle to the QtCheckBoxFactory object stored in the IndirectDataAnalysis class. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui index 7ce758a0ddd1..0f388f5847ed 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui @@ -6,8 +6,8 @@ 0 0 - 807 - 638 + 850 + 700
@@ -30,2740 +30,36 @@ Elwin - - - - - Input - - - - - - - 0 - 41 - - - - false - - - Input File - - - true - - - - _red.nxs - _sqw.nxs - - - - - - - - - - - - - - - - - - - - Preview file: - - - - - - - - 0 - 0 - - - - - - - - Spectrum: - - - - - - - 0 - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - SE log name: - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Output - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Result - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - -
MSD Fit - - - - - Input - - - - - - - 0 - 0 - - - - - _eq2 - - - - - _eq2.nxs - - - - false - - - - - - - - - - - - - - - - - - - - - - Fit Single Spectrum - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Sample - - - - - - - color: rgb(255, 0, 0); - - - Fit - - - - - - - - - - - Plot Spectrum: - - - - - - - 0 - - - 0 - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Spectra Range: - - - - - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - to - - - - - - - 0 - - - 0 - - - - - - - - - - - - - Output - - - - - - true - - - Verbose - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Result - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - Fury - - - - - Input - - - - - - - 0 - 0 - - - - Resolution - - - - - - - - 0 - 0 - - - - Sample - - - - - - - - 0 - 0 - - - - Plot Input - - - - _red - _sqw - - - - - _red.nxs - _sqw.nxs - - - - false - - - - - - - - 0 - 0 - - - - true - - - - _res - _red - _sqw - - - - - _res.nxs - _red.nxs - _sqw.nxs - - - - false - - - - - - - - - - - - - - - - - - - - Output - - - - - - true - - - Verbose - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Result - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - FuryFit - - - - - Input - - - - - - - 0 - 0 - - - - true - - - - _iqt - - - - - _iqt.nxs - - - - false - - - true - - - - - - - - - - - - - - - - - 0 - 0 - - - - Fit Type: - - - - - - - - 1 Exponential - - - - - 2 Exponentials - - - - - 1 Stretched Exponential - - - - - 1 Stretched Exponential and 1 Exponential - - - - - - - - - - - - Plot Guess - - - true - - - - - - - Constrain Intensities - - - true - - - - - - - false - - - Constrain Beta Over All Q - - - - - - - - - - - - - - - - - - - - - Fit Single Spectrum - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Sample - - - - - - - color: rgb(255, 0, 0); - - - Fit - - - - - - - - - - - Plot Spectrum: - - - - - - - 0 - - - 0 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Spectra Range: - - - - - - - 0 - - - 0 - - - - - - - to - - - - - - - 0 - - - 0 - - - - - - - - - - - - - Output - - - - - - Verbose - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Output: - - - - - - - - None - - - - - All - - - - - Intensity - - - - - Tau - - - - - Beta - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - - + ConvFit - - - - - Input - - - - - - - 0 - 0 - - - - Sample - - - - - - - - 0 - 0 - - - - Resolution - - - - - - - - 0 - 0 - - - - true - - - - _red - _sqw - - - - - _red.nxs - _sqw.nxs - .sqw - .red - - - - false - - - - - - - - 0 - 0 - - - - false - - - - _res - _red - _sqw - - - - - _res.nxs - _red.nxs - _sqw.nxs - - - - false - - - - - - - - - - - - - - - - - - Fit Type: - - - - - - - - Zero Lorentzians - - - - - One Lorentzian - - - - - Two Lorentzians - - - - - - - - - - - - Background - - - - - - - - Fixed Flat - - - - - Fit Flat - - - - - Fit Linear - - - - - - - - - - - - Temp. Correction - - - - - - - false - - - - 0 - 0 - - - - If set, applies the correction x*temp / 1-exp(x*temp) to the lorentzian before convolution. - - - - - - - - - - - Plot Guess - - - - - - - Tie Centres - - - - - - - - - - - - - - - - - - - - - - - Fit Single Spectrum - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Sample - - - - - - - color: rgb(255, 0, 0); - - - Fit - - - - - - - - - - - Plot Spectrum: - - - - - - - 0 - - - 0 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Spectra Range: - - - - - - - 0 - - - 0 - - - - - - - to - - - - - - - 0 - - - 0 - - - - - - - - - - - - - Output - - - - - - Verbose - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Plot Output: - - - - - - - - None - - - - - All - - - - - Amplitude - - - - - FWHM - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - - + Calculate Corrections - - - - - Input - - - - - - false - - - - 0 - 0 - - - - true - - - - _red - _sqw - - - - - _red.nxs - _sqw.nxs - - - - false - - - - - - - Use Can: - - - - - - - - 0 - 0 - - - - true - - - - _red - _sqw - - - - - _red.nxs - _sqw.nxs - - - - false - - - - - - - Input type: - - - - - - - - - - - 0 - 0 - - - - Shape Details - - - - - - - - - 0 - 0 - - - - Sample Shape: - - - - - - - - 0 - 0 - - - - - Flat - - - - - Cylinder - - - - - - - - Beam Width: - - - - - - - - - - - - - - - 0 - 0 - - - - Sample Angle: - - - - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - - - - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - 0 - 0 - - - - 1 - - - 0 - - - - - 0 - - - - - - - color: rgb(255, 0, 0); - - - * - - - - - - - false - - - - 0 - 0 - - - - - 9 - 24 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - false - - - - 0 - 0 - - - - - 9 - 24 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - false - - - - 0 - 0 - - - - - - - - - - - false - - - Can Back Thickness: - - - - - - - false - - - Can Front Thickness: - - - - - - - Thickness: - - - - - - - false - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - 0 - - - - - - - Radius 1: - - - - - - - Radius 2: - - - - - - - false - - - - - - - - - - color: rgb(255, 0, 0); - - - * - - - - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - 0 - 0 - - - - - - - - - - - false - - - - 0 - 0 - - - - - 9 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - false - - - Can Radius: - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - Sample Details - - - - - - - - - 0 - 0 - - - - Number Density: - - - - - - - - 0 - 0 - - - - Cross Sections From: - - - - - - - - 0 - 0 - - - - 0 - - - - - 0 - 0 - - - - - 0 - - - - - - - - - - - - - - Scattering cross-section: - - - - - - - - - - - - - - Absorption cross-section: - - - - - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - - - - 0 - 0 - - - - - 0 - - - - - - - - - - - - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - - - - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - - - - - - - - 0 - 0 - - - - - Input - - - - - Formula - - - - - - - - - - - - - true - - - - 0 - 0 - - - - Can Details - - - - - - - - - 0 - 0 - - - - Number Density: - - - - - - - - 0 - 0 - - - - Cross Sections From: - - - - - - - true - - - - 0 - 0 - - - - 0 - - - - true - - - - 0 - 0 - - - - - 0 - - - - - - - true - - - - 0 - 0 - - - - Scattering cross-section: - - - - - - - true - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - - - - - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - 0 - 0 - - - - Absorption cross-section: - - - - - - - - - - - 0 - 0 - - - - - 0 - - - - - - - - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - - - - - - true - - - - 0 - 0 - - - - color: rgb(255, 0, 0); - - - * - - - - - - - - - - - - - - - 0 - 0 - - - - - Input - - - - - Formula - - - - - - - - - - - - - - 0 - 0 - - - - Output Options - - - - - - - - true - - - Verbose - - - true - - - true - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - - 0 - 0 - - - - Plot Output - - - - - - - - None - - - - - Wavelength - - - - - Angle - - - - - Both - - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - Save Result - - - - - - - - - - + Apply Corrections - - - - - Input - - - - - - - - 0 - 0 - - - - true - - - - _red - _sqw - - - - - _red.nxs - _sqw.nxs - - - - false - - - - - - - - - - - - Options - - - - - - - - Geometry: - - - - - - - - Flat - - - - - Cylinder - - - - - - - - Use Can: - - - - - - - false - - - - 0 - 0 - - - - true - - - - _red - _sqw - - - - - _red.nxs - _sqw.nxs - - - - false - - - - - - - - - false - - - Scale Can By: - - - false - - - - - - - false - - - 1.0 - - - - - - - - - Use Corrections: - - - - - - - false - - - - 0 - 0 - - - - false - - - - _flt_abs - - - - - _flt_abs.nxs - - - - false - - - - - - - - - - - - - - Preview - - - - - - - - - - - Sample - - - - - - - color: rgb(255, 0, 0); - - - Can - - - - - - - color: rgb(0, 255, 0); - - - Corrected - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Spectrum: - - - - - - - - - - - - - - - Output Options - - - - - - - - true - - - Verbose - - - true - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Plot Output: - - - - - - - - None - - - - - Contour - - - - - Spectra - - - - - Both - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Result - - - - - - - - -
@@ -2864,98 +160,9 @@
- - - MantidQt::MantidWidgets::MWRunFiles - QWidget -
MantidQtMantidWidgets/MWRunFiles.h
-
- - MantidQt::MantidWidgets::WorkspaceSelector - QComboBox -
MantidQtMantidWidgets/WorkspaceSelector.h
-
- - MantidQt::MantidWidgets::DataSelector - QWidget -
MantidQtMantidWidgets/DataSelector.h
-
-
+ tabWidget - elwin_inputFile - leLogName - elwin_cbPreviewFile - elwin_spPreviewSpec - elwin_ckPlot - elwin_ckSave - msd_spPlotSpectrum - msd_spSpectraMin - msd_spSpectraMax - msd_ckVerbose - msd_ckPlot - msd_ckSave - fury_ckVerbose - fury_ckPlot - fury_ckSave - furyfit_dsSampleInput - furyfit_cbFitType - furyfit_ckConstrainIntensities - furyfit_ckPlotGuess - furyfit_ckConstrainBeta - furyfit_spPlotSpectrum - furyfit_spSpectraMin - furyfit_spSpectraMax - furyfit_pbSingle - furyfit_ckVerbose - furyfit_cbPlotOutput - furyfit_ckSaveSeq - confit_dsSampleInput - confit_dsResInput - confit_cbFitType - confit_cbBackground - confit_ckTempCorrection - confit_leTempCorrection - confit_ckPlotGuess - confit_ckTieCentres - confit_spPlotSpectrum - confit_spSpectraMin - confit_spSpectraMax - confit_pbSingle - confit_ckVerbose - confit_cbPlotOutput - confit_ckSaveSeq - absp_ckUseCan - absp_cbShape - absp_lets - absp_letc1 - absp_letc2 - absp_ler1 - absp_ler2 - absp_ler3 - absp_leavar - absp_lewidth - absp_lesamden - absp_cbSampleInputType - absp_lesamsigs - absp_lesamsiga - absp_leSampleFormula - absp_lecanden - absp_cbCanInputType - absp_lecansigs - absp_lecansiga - absp_leCanFormula - absp_ckVerbose - absp_cbPlotOutput - absp_ckSave - abscor_cbGeometry - abscor_ckUseCan - abscor_ckScaleMultiplier - abscor_leScaleMultiplier - abscor_ckUseCorrections - abscor_ckVerbose - abscor_cbPlotOutput - abscor_ckSave pbHelp pbRun pbManageDirs diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.h index bd23d836b3d4..9a107edf0509 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.h @@ -1,6 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_MSDFIT_H_ #define MANTIDQTCUSTOMINTERFACESIDA_MSDFIT_H_ +#include "ui_MSDFit.h" #include "IDATab.h" namespace MantidQt @@ -35,6 +36,7 @@ namespace IDA void updateRS(QtProperty* prop, double val); private: + Ui::MSDFit m_uiForm; QString m_currentWsName; QtTreePropertyBrowser* m_msdTree; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui index 084729eabb1b..942a71ebe321 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui @@ -255,7 +255,7 @@ MantidQt::MantidWidgets::DataSelector QWidget -
mantidqt::mantidwidgets::dataselector.h
+
MantidQtMantidWidgets/DataSelector.h
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp index 138fe1c3e9d9..a79f3ff98750 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp @@ -17,58 +17,27 @@ namespace CustomInterfaces { namespace IDA { - ApplyCorr::ApplyCorr(QWidget * parent) : + ApplyCorr::ApplyCorr(QWidget * parent) : IDATab(parent) { + m_uiForm.setupUi(parent); } void ApplyCorr::setup() { - connect(uiForm().abscor_ckUseCan, SIGNAL(toggled(bool)), uiForm().abscor_dsContainer, SLOT(setEnabled(bool))); - connect(uiForm().abscor_ckUseCan, SIGNAL(toggled(bool)), uiForm().abscor_ckScaleMultiplier, SLOT(setEnabled(bool))); - connect(uiForm().abscor_ckUseCan, SIGNAL(toggled(bool)), this, SLOT(scaleMultiplierCheck(bool))); - connect(uiForm().abscor_ckUseCorrections, SIGNAL(toggled(bool)), uiForm().abscor_dsCorrections, SLOT(setEnabled(bool))); - connect(uiForm().abscor_ckScaleMultiplier, SIGNAL(toggled(bool)), this, SLOT(scaleMultiplierCheck(bool))); - connect(uiForm().abscor_cbGeometry, SIGNAL(currentIndexChanged(int)), this, SLOT(handleGeometryChange(int))); - connect(uiForm().abscor_dsSample, SIGNAL(dataReady(const QString&)), this, SLOT(newData(const QString&))); - connect(uiForm().abscor_spPreviewSpec, SIGNAL(valueChanged(int)), this, SLOT(plotPreview(int))); - - // Create a validator for input box of the Scale option. - const double tolerance = 0.00001; // Tolerance chosen arbitrarily. - m_valPosDbl->setBottom(tolerance); - - // Apply the validator to the input box for the Scale option. - uiForm().abscor_leScaleMultiplier->setValidator(m_valPosDbl); + connect(m_uiForm.cbGeometry, SIGNAL(currentIndexChanged(int)), this, SLOT(handleGeometryChange(int))); + connect(m_uiForm.dsSample, SIGNAL(dataReady(const QString&)), this, SLOT(newData(const QString&))); + connect(m_uiForm.spPreviewSpec, SIGNAL(valueChanged(int)), this, SLOT(plotPreview(int))); // Create the plot m_plots["ApplyCorrPlot"] = new QwtPlot(m_parentWidget); m_plots["ApplyCorrPlot"]->setCanvasBackground(Qt::white); m_plots["ApplyCorrPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font()); m_plots["ApplyCorrPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font()); - uiForm().abscor_plotPreview->addWidget(m_plots["ApplyCorrPlot"]); + m_uiForm.plotPreview->addWidget(m_plots["ApplyCorrPlot"]); - uiForm().abscor_spPreviewSpec->setMinimum(0); - uiForm().abscor_spPreviewSpec->setMaximum(0); - } - - /** - * Disables/enables the relevant parts of the UI when user checks/unchecks the 'Scale: Multiply Container by' option - * abscor_ckScaleMultiplier checkbox. - * @param state :: state of the checkbox - */ - void ApplyCorr::scaleMultiplierCheck(bool state) - { - // Scale input should be disabled if we're not using a can - if(!uiForm().abscor_ckUseCan->isChecked()) - { - uiForm().abscor_leScaleMultiplier->setEnabled(false); - } - else - { - // Else it should be whatever the scale checkbox is - state = uiForm().abscor_ckScaleMultiplier->isChecked(); - uiForm().abscor_leScaleMultiplier->setEnabled(state); - } + m_uiForm.spPreviewSpec->setMinimum(0); + m_uiForm.spPreviewSpec->setMaximum(0); } /** @@ -85,7 +54,7 @@ namespace IDA plotMiniPlot(dataName, 0, "ApplyCorrPlot", "ApplyCorrSampleCurve"); MatrixWorkspace_const_sptr sampleWs = AnalysisDataService::Instance().retrieveWS(dataName.toStdString()); - uiForm().abscor_spPreviewSpec->setMaximum(static_cast(sampleWs->getNumberHistograms()) - 1); + m_uiForm.spPreviewSpec->setMaximum(static_cast(sampleWs->getNumberHistograms()) - 1); } bool ApplyCorr::validateScaleInput() @@ -94,10 +63,10 @@ namespace IDA int dummyPos = 0; // scale multiplier - QString scaleMultiplierText = uiForm().abscor_leScaleMultiplier->text(); - QValidator::State fieldState = uiForm().abscor_leScaleMultiplier->validator()->validate(scaleMultiplierText, dummyPos); + QString scaleMultiplierText = m_uiForm.spCanScale->text(); + QValidator::State fieldState = m_uiForm.spCanScale->validator()->validate(scaleMultiplierText, dummyPos); - if ( uiForm().abscor_ckScaleMultiplier->isChecked() && fieldState != QValidator::Acceptable ) + if ( m_uiForm.ckScaleMultiplier->isChecked() && fieldState != QValidator::Acceptable ) { valid = false; } @@ -112,7 +81,7 @@ namespace IDA return; } - QString geom = uiForm().abscor_cbGeometry->currentText(); + QString geom = m_uiForm.cbGeometry->currentText(); if ( geom == "Flat" ) { geom = "flt"; @@ -124,17 +93,17 @@ namespace IDA QString pyInput = "from IndirectDataAnalysis import abscorFeeder, loadNexus\n"; - QString sample = uiForm().abscor_dsSample->getCurrentDataName(); + QString sample = m_uiForm.dsSample->getCurrentDataName(); MatrixWorkspace_const_sptr sampleWs = AnalysisDataService::Instance().retrieveWS(sample.toStdString()); pyInput += "sample = '"+sample+"'\n"; pyInput += "rebin_can = False\n"; bool noContainer = false; - bool useCan = uiForm().abscor_ckUseCan->isChecked(); + bool useCan = m_uiForm.ckUseCan->isChecked(); if(useCan) { - QString container = uiForm().abscor_dsContainer->getCurrentDataName(); + QString container = m_uiForm.dsContainer->getCurrentDataName(); MatrixWorkspace_const_sptr canWs = AnalysisDataService::Instance().retrieveWS(container.toStdString()); if (!checkWorkspaceBinningMatches(sampleWs, canWs)) @@ -160,14 +129,14 @@ namespace IDA pyInput += "geom = '" + geom + "'\n"; - if( uiForm().abscor_ckUseCorrections->isChecked() ) + if( m_uiForm.ckUseCorrections->isChecked() ) { pyInput += "useCor = True\n"; - QString corrections = uiForm().abscor_dsCorrections->getCurrentDataName(); + QString corrections = m_uiForm.dsCorrections->getCurrentDataName(); if ( !Mantid::API::AnalysisDataService::Instance().doesExist(corrections.toStdString()) ) { pyInput += - "corrections = loadNexus(r'" + uiForm().abscor_dsCorrections->getFullFilePath() + "')\n"; + "corrections = loadNexus(r'" + m_uiForm.dsCorrections->getFullFilePath() + "')\n"; } else { @@ -187,29 +156,29 @@ namespace IDA return; } } - + QString ScalingFactor = "1.0\n"; QString ScaleOrNot = "False\n"; - pyInput += uiForm().abscor_ckScaleMultiplier->isChecked() ? "True\n" : "False\n"; + pyInput += m_uiForm.ckScaleMultiplier->isChecked() ? "True\n" : "False\n"; - if ( uiForm().abscor_ckScaleMultiplier->isChecked() ) + if ( m_uiForm.ckScaleMultiplier->isChecked() ) { - ScalingFactor = uiForm().abscor_leScaleMultiplier->text(); + ScalingFactor = m_uiForm.spCanScale->text(); ScaleOrNot = "True\n"; } pyInput += "scale = " + ScaleOrNot + "\n"; - pyInput += "scaleFactor = " + ScalingFactor + "\n"; + pyInput += "scaleFactor = " + ScalingFactor + "\n"; - if ( uiForm().abscor_ckVerbose->isChecked() ) pyInput += "verbose = True\n"; + if ( m_uiForm.ckVerbose->isChecked() ) pyInput += "verbose = True\n"; else pyInput += "verbose = False\n"; - if ( uiForm().abscor_ckSave->isChecked() ) pyInput += "save = True\n"; + if ( m_uiForm.ckSave->isChecked() ) pyInput += "save = True\n"; else pyInput += "save = False\n"; - QString plotResult = uiForm().abscor_cbPlotOutput->currentText(); + QString plotResult = m_uiForm.cbPlotOutput->currentText(); if ( plotResult == "Contour" ) { plotResult = "Contour"; @@ -222,14 +191,14 @@ namespace IDA { plotResult = "Both"; } - + pyInput += "plotResult = '" + plotResult + "'\n"; pyInput += "print abscorFeeder(sample, container, geom, useCor, corrections, Verbose=verbose, RebinCan=rebin_can, ScaleOrNotToScale=scale, factor=scaleFactor, Save=save, PlotResult=plotResult)\n"; QString pyOutput = runPythonCode(pyInput).trimmed(); outputWs = AnalysisDataService::Instance().retrieveWS(pyOutput.toStdString()); - plotPreview(uiForm().abscor_spPreviewSpec->value()); + plotPreview(m_uiForm.spPreviewSpec->value()); // Set the result workspace for Python script export m_pythonExportWsName = pyOutput.toStdString(); @@ -242,21 +211,21 @@ namespace IDA bool ApplyCorr::requireCanRebin() { QString message = "The sample and can energy ranges do not match, this is not recommended." - "\n\n Click OK to rebin the can to match the sample and continue or Cancel to abort applying corrections."; - QMessageBox::StandardButton reply = QMessageBox::warning(m_parentWidget, "Energy Ranges Do Not Match", - message, QMessageBox::Ok|QMessageBox::Cancel); + "\n\n Click OK to rebin the can to match the sample and continue or Cancel to abort applying corrections."; + QMessageBox::StandardButton reply = QMessageBox::warning(m_parentWidget, "Energy Ranges Do Not Match", + message, QMessageBox::Ok|QMessageBox::Cancel); return (reply == QMessageBox::Ok); } bool ApplyCorr::validate() { - bool useCan = uiForm().abscor_ckUseCan->isChecked(); + bool useCan = m_uiForm.ckUseCan->isChecked(); if(useCan) { - QString sample = uiForm().abscor_dsSample->getCurrentDataName(); + QString sample = m_uiForm.dsSample->getCurrentDataName(); QString sampleType = sample.right(sample.length() - sample.lastIndexOf("_")); - QString container = uiForm().abscor_dsContainer->getCurrentDataName(); + QString container = m_uiForm.dsContainer->getCurrentDataName(); QString containerType = container.right(container.length() - container.lastIndexOf("_")); g_log.debug() << "Sample type is: " << sampleType.toStdString() << std::endl; @@ -274,14 +243,14 @@ namespace IDA void ApplyCorr::loadSettings(const QSettings & settings) { - uiForm().abscor_dsCorrections->readSettings(settings.group()); - uiForm().abscor_dsContainer->readSettings(settings.group()); - uiForm().abscor_dsSample->readSettings(settings.group()); + m_uiForm.dsCorrections->readSettings(settings.group()); + m_uiForm.dsContainer->readSettings(settings.group()); + m_uiForm.dsSample->readSettings(settings.group()); } /** * Handles when the type of geometry changes - * + * * Updates the file extension to search for */ void ApplyCorr::handleGeometryChange(int index) @@ -292,18 +261,18 @@ namespace IDA case 0: // Geomtry is flat ext = "_flt_abs"; - uiForm().abscor_dsCorrections->setWSSuffixes(QStringList(ext)); - uiForm().abscor_dsCorrections->setFBSuffixes(QStringList(ext + ".nxs")); + m_uiForm.dsCorrections->setWSSuffixes(QStringList(ext)); + m_uiForm.dsCorrections->setFBSuffixes(QStringList(ext + ".nxs")); break; case 1: // Geomtry is cylinder ext = "_cyl_abs"; - uiForm().abscor_dsCorrections->setWSSuffixes(QStringList(ext)); - uiForm().abscor_dsCorrections->setFBSuffixes(QStringList(ext + ".nxs")); + m_uiForm.dsCorrections->setWSSuffixes(QStringList(ext)); + m_uiForm.dsCorrections->setFBSuffixes(QStringList(ext + ".nxs")); break; } } - + /** * Replots the preview plot. * @@ -311,10 +280,10 @@ namespace IDA */ void ApplyCorr::plotPreview(int specIndex) { - bool useCan = uiForm().abscor_ckUseCan->isChecked(); + bool useCan = m_uiForm.ckUseCan->isChecked(); // Plot sample - QString sample = uiForm().abscor_dsSample->getCurrentDataName(); + QString sample = m_uiForm.dsSample->getCurrentDataName(); if(AnalysisDataService::Instance().doesExist(sample.toStdString())) { MatrixWorkspace_const_sptr sampleWs = AnalysisDataService::Instance().retrieveWS(sample.toStdString()); @@ -331,7 +300,7 @@ namespace IDA // Plot can if(useCan) { - QString container = uiForm().abscor_dsContainer->getCurrentDataName(); + QString container = m_uiForm.dsContainer->getCurrentDataName(); MatrixWorkspace_const_sptr canWs = AnalysisDataService::Instance().retrieveWS(container.toStdString()); plotMiniPlot(canWs, specIndex, "ApplyCorrPlot", "CanCurve"); m_curves["CanCurve"]->setPen(QColor(Qt::red)); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp index ea58f2f06cb1..bb0e785d176a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp @@ -33,7 +33,7 @@ class QDoubleMultiRangeValidator : public QValidator * Returns Acceptable if the string input contains a double that is within at least one * of the ranges and is in the correct format. * - * Else returns Intermediate if input contains a double that is outside the ranges or is in + * Else returns Intermediate if input contains a double that is outside the ranges or is in * the wrong format; e.g. with too many digits after the decimal point or is empty. * * Else returns Invalid - i.e. the input is not a double. @@ -44,10 +44,10 @@ class QDoubleMultiRangeValidator : public QValidator virtual QValidator::State validate( QString & input, int & pos ) const { UNUSED_ARG(pos); - + if( m_ranges.empty() ) return Intermediate; - + bool acceptable = false; bool intermediate = false; @@ -95,9 +95,11 @@ namespace CustomInterfaces { namespace IDA { - CalcCorr::CalcCorr(QWidget * parent) : - IDATab(parent), m_dblVal(NULL), m_posDblVal(NULL) + CalcCorr::CalcCorr(QWidget * parent) : + IDATab(parent), m_dblVal(NULL), m_posDblVal(NULL) { + m_uiForm.setupUi(parent); + m_dblVal = new QDoubleValidator(this); m_posDblVal = new QDoubleValidator(this); m_posDblVal->setBottom(0.0); @@ -106,12 +108,12 @@ namespace IDA void CalcCorr::setup() { // set signals and slot connections for F2Py Absorption routine - connect(uiForm().absp_cbShape, SIGNAL(currentIndexChanged(int)), this, SLOT(shape(int))); - connect(uiForm().absp_ckUseCan, SIGNAL(toggled(bool)), this, SLOT(useCanChecked(bool))); - connect(uiForm().absp_letc1, SIGNAL(editingFinished()), this, SLOT(tcSync())); - connect(uiForm().absp_cbSampleInputType, SIGNAL(currentIndexChanged(int)), uiForm().absp_swSampleInputType, SLOT(setCurrentIndex(int))); - connect(uiForm().absp_cbCanInputType, SIGNAL(currentIndexChanged(int)), uiForm().absp_swCanInputType, SLOT(setCurrentIndex(int))); - connect(uiForm().absp_dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(getBeamWidthFromWorkspace(const QString&))); + connect(m_uiForm.cbShape, SIGNAL(currentIndexChanged(int)), this, SLOT(shape(int))); + connect(m_uiForm.ckUseCan, SIGNAL(toggled(bool)), this, SLOT(useCanChecked(bool))); + connect(m_uiForm.letc1, SIGNAL(editingFinished()), this, SLOT(tcSync())); + connect(m_uiForm.cbSampleInputType, SIGNAL(currentIndexChanged(int)), m_uiForm.swSampleInputType, SLOT(setCurrentIndex(int))); + connect(m_uiForm.cbCanInputType, SIGNAL(currentIndexChanged(int)), m_uiForm.swCanInputType, SLOT(setCurrentIndex(int))); + connect(m_uiForm.dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(getBeamWidthFromWorkspace(const QString&))); // Sort the fields into various lists. @@ -119,23 +121,23 @@ namespace IDA QList doubleFields; QList positiveDoubleFields; - positiveDoubleFields += uiForm().absp_lets; // Thickness - positiveDoubleFields += uiForm().absp_letc1; // Front Thickness - positiveDoubleFields += uiForm().absp_letc2; // Back Thickness - - positiveDoubleFields += uiForm().absp_ler1; // Radius 1 - positiveDoubleFields += uiForm().absp_ler2; // Radius 2 - positiveDoubleFields += uiForm().absp_ler3; // Radius 3 - - positiveDoubleFields += uiForm().absp_lewidth; // Beam Width - - positiveDoubleFields += uiForm().absp_lesamden; // Sample Number Density - positiveDoubleFields += uiForm().absp_lesamsigs; // Sample Scattering Cross-Section - positiveDoubleFields += uiForm().absp_lesamsiga; // Sample Absorption Cross-Section - - positiveDoubleFields += uiForm().absp_lecanden; // Can Number Density - positiveDoubleFields += uiForm().absp_lecansigs; // Can Scattering Cross-Section - positiveDoubleFields += uiForm().absp_lecansiga; // Can Absorption Cross-Section + positiveDoubleFields += m_uiForm.lets; // Thickness + positiveDoubleFields += m_uiForm.letc1; // Front Thickness + positiveDoubleFields += m_uiForm.letc2; // Back Thickness + + positiveDoubleFields += m_uiForm.ler1; // Radius 1 + positiveDoubleFields += m_uiForm.ler2; // Radius 2 + positiveDoubleFields += m_uiForm.ler3; // Radius 3 + + positiveDoubleFields += m_uiForm.lewidth; // Beam Width + + positiveDoubleFields += m_uiForm.lesamden; // Sample Number Density + positiveDoubleFields += m_uiForm.lesamsigs; // Sample Scattering Cross-Section + positiveDoubleFields += m_uiForm.lesamsiga; // Sample Absorption Cross-Section + + positiveDoubleFields += m_uiForm.lecanden; // Can Number Density + positiveDoubleFields += m_uiForm.lecansigs; // Can Scattering Cross-Section + positiveDoubleFields += m_uiForm.lecansiga; // Can Absorption Cross-Section // Set appropriate validators. foreach(QLineEdit * positiveDoubleField, positiveDoubleFields) @@ -149,113 +151,113 @@ namespace IDA angleRanges.insert(std::make_pair(-80, 80)); angleRanges.insert(std::make_pair(100, 180)); QDoubleMultiRangeValidator * angleValidator = new QDoubleMultiRangeValidator(angleRanges, this); - uiForm().absp_leavar->setValidator(angleValidator); // Can Angle to Beam + m_uiForm.leavar->setValidator(angleValidator); // Can Angle to Beam allFields = positiveDoubleFields; - allFields += uiForm().absp_leavar; + allFields += m_uiForm.leavar; QRegExp regex("[A-Za-z0-9\\-\\(\\)]*"); QValidator *formulaValidator = new QRegExpValidator(regex, this); - uiForm().absp_leSampleFormula->setValidator(formulaValidator); - uiForm().absp_leCanFormula->setValidator(formulaValidator); + m_uiForm.leSampleFormula->setValidator(formulaValidator); + m_uiForm.leCanFormula->setValidator(formulaValidator); // "Nudge" color of title of QGroupBox to change. - useCanChecked(uiForm().absp_ckUseCan->isChecked()); + useCanChecked(m_uiForm.ckUseCan->isChecked()); } void CalcCorr::run() { QString pyInput = "import IndirectAbsCor\n"; - + QString geom; QString size; - if ( uiForm().absp_cbShape->currentText() == "Flat" ) + if ( m_uiForm.cbShape->currentText() == "Flat" ) { geom = "flt"; - if ( uiForm().absp_ckUseCan->isChecked() ) + if ( m_uiForm.ckUseCan->isChecked() ) { - size = "[" + uiForm().absp_lets->text() + ", " + - uiForm().absp_letc1->text() + ", " + - uiForm().absp_letc2->text() + "]"; + size = "[" + m_uiForm.lets->text() + ", " + + m_uiForm.letc1->text() + ", " + + m_uiForm.letc2->text() + "]"; } else { - size = "[" + uiForm().absp_lets->text() + ", 0.0, 0.0]"; + size = "[" + m_uiForm.lets->text() + ", 0.0, 0.0]"; } } - else if ( uiForm().absp_cbShape->currentText() == "Cylinder" ) + else if ( m_uiForm.cbShape->currentText() == "Cylinder" ) { geom = "cyl"; // R3 only populated when using can. R4 is fixed to 0.0 - if ( uiForm().absp_ckUseCan->isChecked() ) + if ( m_uiForm.ckUseCan->isChecked() ) { - size = "[" + uiForm().absp_ler1->text() + ", " + - uiForm().absp_ler2->text() + ", " + - uiForm().absp_ler3->text() + ", 0.0 ]"; + size = "[" + m_uiForm.ler1->text() + ", " + + m_uiForm.ler2->text() + ", " + + m_uiForm.ler3->text() + ", 0.0 ]"; } else { - size = "[" + uiForm().absp_ler1->text() + ", " + - uiForm().absp_ler2->text() + ", 0.0, 0.0 ]"; + size = "[" + m_uiForm.ler1->text() + ", " + + m_uiForm.ler2->text() + ", 0.0, 0.0 ]"; } } //get beam width - QString width = uiForm().absp_lewidth->text(); + QString width = m_uiForm.lewidth->text(); if (width.isEmpty()) { width = "None"; } //get sample workspace. Load from if needed. - QString sampleWs = uiForm().absp_dsSampleInput->getCurrentDataName(); + QString sampleWs = m_uiForm.dsSampleInput->getCurrentDataName(); pyInput += "inputws = '" + sampleWs + "'\n"; //sample absorption and scattering x sections. - QString sampleScatteringXSec = uiForm().absp_lesamsigs->text(); - QString sampleAbsorptionXSec = uiForm().absp_lesamsiga->text(); + QString sampleScatteringXSec = m_uiForm.lesamsigs->text(); + QString sampleAbsorptionXSec = m_uiForm.lesamsiga->text(); if ( sampleScatteringXSec.isEmpty() ) { sampleScatteringXSec = "0.0"; } if ( sampleAbsorptionXSec.isEmpty() ) { sampleAbsorptionXSec = "0.0"; } //can and sample formulas - QString sampleFormula = uiForm().absp_leSampleFormula->text(); - QString canFormula = uiForm().absp_leCanFormula->text(); + QString sampleFormula = m_uiForm.leSampleFormula->text(); + QString canFormula = m_uiForm.leCanFormula->text(); - if ( sampleFormula.isEmpty() ) - { + if ( sampleFormula.isEmpty() ) + { sampleFormula = "None"; } - else + else { sampleFormula = "'" + sampleFormula + "'"; } - if ( canFormula.isEmpty() ) - { + if ( canFormula.isEmpty() ) + { canFormula = "None"; } - else + else { canFormula = "'" + canFormula + "'"; } //create python string to execute - if ( uiForm().absp_ckUseCan->isChecked() ) + if ( m_uiForm.ckUseCan->isChecked() ) { //get sample workspace. Load from if needed. - QString canWs = uiForm().absp_dsCanInput->getCurrentDataName(); + QString canWs = m_uiForm.dsCanInput->getCurrentDataName(); pyInput += "canws = '" + canWs + "'\n"; //can absoprtion and scattering x section. - QString canScatteringXSec = uiForm().absp_lecansigs->text(); - QString canAbsorptionXSec = uiForm().absp_lecansiga->text(); + QString canScatteringXSec = m_uiForm.lecansigs->text(); + QString canAbsorptionXSec = m_uiForm.lecansiga->text(); if ( canScatteringXSec.isEmpty() ) { canScatteringXSec = "0.0"; } if ( canAbsorptionXSec.isEmpty() ) { canAbsorptionXSec = "0.0"; } pyInput += "ncan = 2\n" - "density = [" + uiForm().absp_lesamden->text() + ", " + uiForm().absp_lecanden->text() + ", " + uiForm().absp_lecanden->text() + "]\n" + "density = [" + m_uiForm.lesamden->text() + ", " + m_uiForm.lecanden->text() + ", " + m_uiForm.lecanden->text() + "]\n" "sigs = [" + sampleScatteringXSec + "," + canScatteringXSec + "," + canScatteringXSec + "]\n" "siga = [" + sampleAbsorptionXSec + "," + canAbsorptionXSec + "," + canAbsorptionXSec + "]\n"; } @@ -263,25 +265,25 @@ namespace IDA { pyInput += "ncan = 1\n" - "density = [" + uiForm().absp_lesamden->text() + ", 0.0, 0.0 ]\n" + "density = [" + m_uiForm.lesamden->text() + ", 0.0, 0.0 ]\n" "sigs = [" + sampleScatteringXSec + ", 0.0, 0.0]\n" "siga = [" + sampleAbsorptionXSec + ", 0.0, 0.0]\n" "canws = None\n"; } //Output options - if ( uiForm().absp_ckVerbose->isChecked() ) pyInput += "verbose = True\n"; + if ( m_uiForm.ckVerbose->isChecked() ) pyInput += "verbose = True\n"; else pyInput += "verbose = False\n"; - if ( uiForm().absp_ckSave->isChecked() ) pyInput += "save = True\n"; + if ( m_uiForm.ckSave->isChecked() ) pyInput += "save = True\n"; else pyInput += "save = False\n"; pyInput += "geom = '" + geom + "'\n" "beam = " + width + "\n" "size = " + size + "\n" - "avar = " + uiForm().absp_leavar->text() + "\n" - "plotOpt = '" + uiForm().absp_cbPlotOutput->currentText() + "'\n" + "avar = " + m_uiForm.leavar->text() + "\n" + "plotOpt = '" + m_uiForm.cbPlotOutput->currentText() + "'\n" "sampleFormula = " + sampleFormula + "\n" "canFormula = " + canFormula + "\n" "print IndirectAbsCor.AbsRunFeeder(inputws, canws, geom, ncan, size, avar, density, beam, sampleFormula, canFormula, sigs, siga, plot_opt=plotOpt, save=save, verbose=verbose)\n"; @@ -295,17 +297,17 @@ namespace IDA bool CalcCorr::validate() { UserInputValidator uiv; - bool useCan = uiForm().absp_ckUseCan->isChecked(); + bool useCan = m_uiForm.ckUseCan->isChecked(); // Input files/workspaces - uiv.checkDataSelectorIsValid("Sample", uiForm().absp_dsSampleInput); + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSampleInput); if (useCan) { - uiv.checkDataSelectorIsValid("Can", uiForm().absp_dsCanInput); + uiv.checkDataSelectorIsValid("Can", m_uiForm.dsCanInput); - QString sample = uiForm().absp_dsSampleInput->getCurrentDataName(); + QString sample = m_uiForm.dsSampleInput->getCurrentDataName(); QString sampleType = sample.right(sample.length() - sample.lastIndexOf("_")); - QString container = uiForm().absp_dsCanInput->getCurrentDataName(); + QString container = m_uiForm.dsCanInput->getCurrentDataName(); QString containerType = container.right(container.length() - container.lastIndexOf("_")); g_log.debug() << "Sample type is: " << sampleType.toStdString() << std::endl; @@ -317,89 +319,89 @@ namespace IDA } } - uiv.checkFieldIsValid("Beam Width", uiForm().absp_lewidth, uiForm().absp_valWidth); + uiv.checkFieldIsValid("Beam Width", m_uiForm.lewidth, m_uiForm.valWidth); - if ( uiForm().absp_cbShape->currentText() == "Flat" ) + if ( m_uiForm.cbShape->currentText() == "Flat" ) { // Flat Geometry - uiv.checkFieldIsValid("Thickness", uiForm().absp_lets, uiForm().absp_valts); + uiv.checkFieldIsValid("Thickness", m_uiForm.lets, m_uiForm.valts); if ( useCan ) { - uiv.checkFieldIsValid("Front Thickness", uiForm().absp_letc1, uiForm().absp_valtc1); - uiv.checkFieldIsValid("Back Thickness", uiForm().absp_letc2, uiForm().absp_valtc2); + uiv.checkFieldIsValid("Front Thickness", m_uiForm.letc1, m_uiForm.valtc1); + uiv.checkFieldIsValid("Back Thickness", m_uiForm.letc2, m_uiForm.valtc2); } - uiv.checkFieldIsValid("Can Angle to Beam must be in the range [-180 to -100], [-80 to 80] or [100 to 180].", uiForm().absp_leavar, uiForm().absp_valAvar); + uiv.checkFieldIsValid("Can Angle to Beam must be in the range [-180 to -100], [-80 to 80] or [100 to 180].", m_uiForm.leavar, m_uiForm.valAvar); } - if ( uiForm().absp_cbShape->currentText() == "Cylinder" ) + if ( m_uiForm.cbShape->currentText() == "Cylinder" ) { // Cylinder geometry - uiv.checkFieldIsValid("Radius 1", uiForm().absp_ler1, uiForm().absp_valR1); - uiv.checkFieldIsValid("Radius 2", uiForm().absp_ler2, uiForm().absp_valR2); - - double radius1 = uiForm().absp_ler1->text().toDouble(); - double radius2 = uiForm().absp_ler2->text().toDouble(); + uiv.checkFieldIsValid("Radius 1", m_uiForm.ler1, m_uiForm.valR1); + uiv.checkFieldIsValid("Radius 2", m_uiForm.ler2, m_uiForm.valR2); + + double radius1 = m_uiForm.ler1->text().toDouble(); + double radius2 = m_uiForm.ler2->text().toDouble(); if( radius1 >= radius2 ) uiv.addErrorMessage("Radius 1 should be less than Radius 2."); // R3 only relevant when using can if ( useCan ) { - uiv.checkFieldIsValid("Radius 3", uiForm().absp_ler3, uiForm().absp_valR3); - - double radius3 = uiForm().absp_ler3->text().toDouble(); + uiv.checkFieldIsValid("Radius 3", m_uiForm.ler3, m_uiForm.valR3); + + double radius3 = m_uiForm.ler3->text().toDouble(); if( radius2 >= radius3 ) uiv.addErrorMessage("Radius 2 should be less than Radius 3."); } - uiv.checkFieldIsValid("Step Size", uiForm().absp_leavar, uiForm().absp_valAvar); + uiv.checkFieldIsValid("Step Size", m_uiForm.leavar, m_uiForm.valAvar); - double stepSize = uiForm().absp_leavar->text().toDouble(); + double stepSize = m_uiForm.leavar->text().toDouble(); if( stepSize >= (radius2 - radius1) ) uiv.addErrorMessage("Step size should be less than (Radius 2 - Radius 1)."); } // Sample details - uiv.checkFieldIsValid("Sample Number Density", uiForm().absp_lesamden, uiForm().absp_valSamden); + uiv.checkFieldIsValid("Sample Number Density", m_uiForm.lesamden, m_uiForm.valSamden); - switch(uiForm().absp_cbSampleInputType->currentIndex()) + switch(m_uiForm.cbSampleInputType->currentIndex()) { case 0: //using direct input - uiv.checkFieldIsValid("Sample Scattering Cross-Section", uiForm().absp_lesamsigs, uiForm().absp_valSamsigs); - uiv.checkFieldIsValid("Sample Absorption Cross-Section", uiForm().absp_lesamsiga, uiForm().absp_valSamsiga); + uiv.checkFieldIsValid("Sample Scattering Cross-Section", m_uiForm.lesamsigs, m_uiForm.valSamsigs); + uiv.checkFieldIsValid("Sample Absorption Cross-Section", m_uiForm.lesamsiga, m_uiForm.valSamsiga); break; case 1: //input using formula - uiv.checkFieldIsValid("Sample Formula", uiForm().absp_leSampleFormula, uiForm().absp_valSampleFormula); + uiv.checkFieldIsValid("Sample Formula", m_uiForm.leSampleFormula, m_uiForm.valSampleFormula); break; } // Can details (only test if "Use Can" is checked) - if ( uiForm().absp_ckUseCan->isChecked() ) + if ( m_uiForm.ckUseCan->isChecked() ) { - QString canFile = uiForm().absp_dsCanInput->getCurrentDataName(); + QString canFile = m_uiForm.dsCanInput->getCurrentDataName(); if(canFile.isEmpty()) { uiv.addErrorMessage("You must select a Sample file or workspace."); } - uiv.checkFieldIsValid("Can Number Density",uiForm().absp_lecanden,uiForm().absp_valCanden); + uiv.checkFieldIsValid("Can Number Density",m_uiForm.lecanden,m_uiForm.valCanden); - switch(uiForm().absp_cbCanInputType->currentIndex()) + switch(m_uiForm.cbCanInputType->currentIndex()) { case 0: // using direct input - uiv.checkFieldIsValid("Can Scattering Cross-Section", uiForm().absp_lecansigs, uiForm().absp_valCansigs); - uiv.checkFieldIsValid("Can Absorption Cross-Section", uiForm().absp_lecansiga, uiForm().absp_valCansiga); + uiv.checkFieldIsValid("Can Scattering Cross-Section", m_uiForm.lecansigs, m_uiForm.valCansigs); + uiv.checkFieldIsValid("Can Absorption Cross-Section", m_uiForm.lecansiga, m_uiForm.valCansiga); break; case 1: //input using formula - uiv.checkFieldIsValid("Can Formula", uiForm().absp_leCanFormula, uiForm().absp_valCanFormula); + uiv.checkFieldIsValid("Can Formula", m_uiForm.leCanFormula, m_uiForm.valCanFormula); break; } } @@ -412,79 +414,79 @@ namespace IDA void CalcCorr::loadSettings(const QSettings & settings) { - uiForm().absp_dsSampleInput->readSettings(settings.group()); - uiForm().absp_dsCanInput->readSettings(settings.group()); + m_uiForm.dsSampleInput->readSettings(settings.group()); + m_uiForm.dsCanInput->readSettings(settings.group()); } void CalcCorr::shape(int index) { - uiForm().absp_swShapeDetails->setCurrentIndex(index); + m_uiForm.swShapeDetails->setCurrentIndex(index); // Meaning of the "avar" variable changes depending on shape selection - if ( index == 0 ) { uiForm().absp_lbAvar->setText("Sample Angle:"); } - else if ( index == 1 ) { uiForm().absp_lbAvar->setText("Step Size:"); } + if ( index == 0 ) { m_uiForm.lbAvar->setText("Sample Angle:"); } + else if ( index == 1 ) { m_uiForm.lbAvar->setText("Step Size:"); } } void CalcCorr::useCanChecked(bool checked) { // Disable "Can Details" group and asterisks. - uiForm().absp_gbCan->setEnabled(checked); - uiForm().absp_valCanden->setVisible(checked); - uiForm().absp_lbtc1->setEnabled(checked); - uiForm().absp_lbtc2->setEnabled(checked); - uiForm().absp_letc1->setEnabled(checked); - uiForm().absp_letc2->setEnabled(checked); - uiForm().absp_lbR3->setEnabled(checked); - uiForm().absp_ler3->setEnabled(checked); - + m_uiForm.gbCan->setEnabled(checked); + m_uiForm.valCanden->setVisible(checked); + m_uiForm.lbtc1->setEnabled(checked); + m_uiForm.lbtc2->setEnabled(checked); + m_uiForm.letc1->setEnabled(checked); + m_uiForm.letc2->setEnabled(checked); + m_uiForm.lbR3->setEnabled(checked); + m_uiForm.ler3->setEnabled(checked); + QString value; (checked ? value = "*" : value = " "); - uiForm().absp_valCansigs->setText(value); - uiForm().absp_valCansiga->setText(value); - uiForm().absp_valCanFormula->setText(value); + m_uiForm.valCansigs->setText(value); + m_uiForm.valCansiga->setText(value); + m_uiForm.valCanFormula->setText(value); // Disable thickness fields/labels/asterisks. - uiForm().absp_valtc1->setText(value); - uiForm().absp_valtc2->setText(value); + m_uiForm.valtc1->setText(value); + m_uiForm.valtc2->setText(value); // // Disable R3 field/label/asterisk. - uiForm().absp_valR3->setText(value); - + m_uiForm.valR3->setText(value); + if (checked) - { + { UserInputValidator uiv; - uiv.checkFieldIsValid("",uiForm().absp_lecansigs, uiForm().absp_valCansigs); - uiv.checkFieldIsValid("",uiForm().absp_lecansiga, uiForm().absp_valCansiga); - uiv.checkFieldIsValid("",uiForm().absp_letc1, uiForm().absp_valtc1); - uiv.checkFieldIsValid("",uiForm().absp_letc2, uiForm().absp_valtc2); - uiv.checkFieldIsValid("",uiForm().absp_ler3, uiForm().absp_valR3); + uiv.checkFieldIsValid("",m_uiForm.lecansigs, m_uiForm.valCansigs); + uiv.checkFieldIsValid("",m_uiForm.lecansiga, m_uiForm.valCansiga); + uiv.checkFieldIsValid("",m_uiForm.letc1, m_uiForm.valtc1); + uiv.checkFieldIsValid("",m_uiForm.letc2, m_uiForm.valtc2); + uiv.checkFieldIsValid("",m_uiForm.ler3, m_uiForm.valR3); } - uiForm().absp_dsCanInput->setEnabled(checked); - + m_uiForm.dsCanInput->setEnabled(checked); + // Workaround for "disabling" title of the QGroupBox. QPalette palette; if(checked) palette.setColor( - QPalette::Disabled, + QPalette::Disabled, QPalette::WindowText, QApplication::palette().color(QPalette::Disabled, QPalette::WindowText)); else palette.setColor( - QPalette::Active, + QPalette::Active, QPalette::WindowText, QApplication::palette().color(QPalette::Active, QPalette::WindowText)); - uiForm().absp_gbCan->setPalette(palette); + m_uiForm.gbCan->setPalette(palette); } void CalcCorr::tcSync() { - if ( uiForm().absp_letc2->text() == "" ) + if ( m_uiForm.letc2->text() == "" ) { - QString val = uiForm().absp_letc1->text(); - uiForm().absp_letc2->setText(val); + QString val = m_uiForm.letc1->text(); + m_uiForm.letc2->setText(val); } } @@ -492,11 +494,11 @@ namespace IDA { using namespace Mantid::API; auto ws = AnalysisDataService::Instance().retrieveWS(wsname.toStdString()); - + if (!ws) { showMessageBox("Failed to find workspace " + wsname); - return; + return; } std::string paramName = "Workflow.beam-width"; @@ -504,11 +506,11 @@ namespace IDA if (instrument->hasParameter(paramName)) { std::string beamWidth = instrument->getStringParameter(paramName)[0]; - uiForm().absp_lewidth->setText(QString::fromUtf8(beamWidth.c_str())); + m_uiForm.lewidth->setText(QString::fromUtf8(beamWidth.c_str())); } else { - uiForm().absp_lewidth->setText(""); + m_uiForm.lewidth->setText(""); } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp index 897185cd9abc..086f9ce32913 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp @@ -34,6 +34,7 @@ namespace IDA m_cfInputWS(), m_cfInputWSName(), m_confitResFileType() { + m_uiForm.setupUi(parent); } void ConvFit::setup() @@ -43,7 +44,7 @@ namespace IDA // Create TreeProperty Widget m_cfTree = new QtTreePropertyBrowser(); - uiForm().confit_properties->addWidget(m_cfTree); + m_uiForm.properties->addWidget(m_cfTree); // add factories to managers m_cfTree->setFactoryForManager(m_blnManager, qtCheckBoxFactory()); @@ -54,12 +55,12 @@ namespace IDA m_plots["ConvFitPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font()); m_plots["ConvFitPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font()); m_plots["ConvFitPlot"]->setCanvasBackground(Qt::white); - uiForm().confit_plot->addWidget(m_plots["ConvFitPlot"]); + m_uiForm.plot->addWidget(m_plots["ConvFitPlot"]); // Create Range Selectors m_rangeSelectors["ConvFitRange"] = new MantidQt::MantidWidgets::RangeSelector(m_plots["ConvFitPlot"]); m_rangeSelectors["ConvFitBackRange"] = new MantidQt::MantidWidgets::RangeSelector(m_plots["ConvFitPlot"], - MantidQt::MantidWidgets::RangeSelector::YSINGLE); + MantidQt::MantidWidgets::RangeSelector::YSINGLE); m_rangeSelectors["ConvFitBackRange"]->setColour(Qt::darkGreen); m_rangeSelectors["ConvFitBackRange"]->setRange(0.0, 1.0); m_rangeSelectors["ConvFitHWHM"] = new MantidQt::MantidWidgets::RangeSelector(m_plots["ConvFitPlot"]); @@ -101,7 +102,7 @@ namespace IDA m_properties["Lorentzian1"] = createLorentzian("Lorentzian 1"); m_properties["Lorentzian2"] = createLorentzian("Lorentzian 2"); - uiForm().confit_leTempCorrection->setValidator(new QDoubleValidator(m_parentWidget)); + m_uiForm.leTempCorrection->setValidator(new QDoubleValidator(m_parentWidget)); // Connections connect(m_rangeSelectors["ConvFitRange"], SIGNAL(minValueChanged(double)), this, SLOT(minChanged(double))); @@ -112,34 +113,34 @@ namespace IDA connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateRS(QtProperty*, double))); connect(m_blnManager, SIGNAL(valueChanged(QtProperty*, bool)), this, SLOT(checkBoxUpdate(QtProperty*, bool))); connect(m_dblManager, SIGNAL(propertyChanged(QtProperty*)), this, SLOT(plotGuess(QtProperty*))); - connect(uiForm().confit_ckTempCorrection, SIGNAL(toggled(bool)), uiForm().confit_leTempCorrection, SLOT(setEnabled(bool))); + connect(m_uiForm.ckTempCorrection, SIGNAL(toggled(bool)), m_uiForm.leTempCorrection, SLOT(setEnabled(bool))); // Have FWHM Range linked to Fit Start/End Range connect(m_rangeSelectors["ConvFitRange"], SIGNAL(rangeChanged(double, double)), m_rangeSelectors["ConvFitHWHM"], SLOT(setRange(double, double))); m_rangeSelectors["ConvFitHWHM"]->setRange(-1.0,1.0); hwhmUpdateRS(0.02); - typeSelection(uiForm().confit_cbFitType->currentIndex()); - bgTypeSelection(uiForm().confit_cbBackground->currentIndex()); + typeSelection(m_uiForm.cbFitType->currentIndex()); + bgTypeSelection(m_uiForm.cbBackground->currentIndex()); // Replot input automatically when file / spec no changes - connect(uiForm().confit_spPlotSpectrum, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); - connect(uiForm().confit_dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(newDataLoaded(const QString&))); + connect(m_uiForm.spPlotSpectrum, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); + connect(m_uiForm.dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(newDataLoaded(const QString&))); - connect(uiForm().confit_spSpectraMin, SIGNAL(valueChanged(int)), this, SLOT(specMinChanged(int))); - connect(uiForm().confit_spSpectraMax, SIGNAL(valueChanged(int)), this, SLOT(specMaxChanged(int))); + connect(m_uiForm.spSpectraMin, SIGNAL(valueChanged(int)), this, SLOT(specMinChanged(int))); + connect(m_uiForm.spSpectraMax, SIGNAL(valueChanged(int)), this, SLOT(specMaxChanged(int))); - connect(uiForm().confit_cbFitType, SIGNAL(currentIndexChanged(int)), this, SLOT(typeSelection(int))); - connect(uiForm().confit_cbBackground, SIGNAL(currentIndexChanged(int)), this, SLOT(bgTypeSelection(int))); - connect(uiForm().confit_pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); + connect(m_uiForm.cbFitType, SIGNAL(currentIndexChanged(int)), this, SLOT(typeSelection(int))); + connect(m_uiForm.cbBackground, SIGNAL(currentIndexChanged(int)), this, SLOT(bgTypeSelection(int))); + connect(m_uiForm.pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); // Context menu m_cfTree->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_cfTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(fitContextMenu(const QPoint &))); // Tie - connect(uiForm().confit_cbFitType,SIGNAL(currentIndexChanged(QString)),SLOT(showTieCheckbox(QString))); - showTieCheckbox( uiForm().confit_cbFitType->currentText() ); + connect(m_uiForm.cbFitType,SIGNAL(currentIndexChanged(QString)),SLOT(showTieCheckbox(QString))); + showTieCheckbox( m_uiForm.cbFitType->currentText() ); } void ConvFit::run() @@ -158,15 +159,15 @@ namespace IDA g_log.error("No fit type defined"); } - bool useTies = uiForm().confit_ckTieCentres->isChecked(); + bool useTies = m_uiForm.ckTieCentres->isChecked(); QString ties = (useTies ? "True" : "False"); Mantid::API::CompositeFunction_sptr func = createFunction(useTies); std::string function = std::string(func->asString()); QString stX = m_properties["StartX"]->valueText(); QString enX = m_properties["EndX"]->valueText(); - QString specMin = uiForm().confit_spSpectraMin->text(); - QString specMax = uiForm().confit_spSpectraMax->text(); + QString specMin = m_uiForm.spSpectraMin->text(); + QString specMax = m_uiForm.spSpectraMax->text(); QString pyInput = "from IndirectDataAnalysis import confitSeq\n" @@ -174,20 +175,20 @@ namespace IDA "func = r'" + QString::fromStdString(function) + "'\n" "startx = " + stX + "\n" "endx = " + enX + "\n" - "plot = '" + uiForm().confit_cbPlotOutput->currentText() + "'\n" + "plot = '" + m_uiForm.cbPlotType->currentText() + "'\n" "ties = " + ties + "\n" "specMin = " + specMin + "\n" "specMax = " + specMax + "\n" - "save = " + (uiForm().confit_ckSaveSeq->isChecked() ? "True\n" : "False\n"); + "save = " + (m_uiForm.ckSaveSeq->isChecked() ? "True\n" : "False\n"); if ( m_blnManager->value(m_properties["Convolve"]) ) pyInput += "convolve = True\n"; else pyInput += "convolve = False\n"; - if ( uiForm().confit_ckVerbose->isChecked() ) pyInput += "verbose = True\n"; + if ( m_uiForm.ckVerbose->isChecked() ) pyInput += "verbose = True\n"; else pyInput += "verbose = False\n"; - QString temperature = uiForm().confit_leTempCorrection->text(); - bool useTempCorrection = (!temperature.isEmpty() && uiForm().confit_ckTempCorrection->isChecked()); + QString temperature = m_uiForm.leTempCorrection->text(); + bool useTempCorrection = (!temperature.isEmpty() && m_uiForm.ckTempCorrection->isChecked()); if ( useTempCorrection ) { pyInput += "temp=" + temperature + "\n"; @@ -219,15 +220,15 @@ namespace IDA UserInputValidator uiv; - uiv.checkDataSelectorIsValid("Sample", uiForm().confit_dsSampleInput); - uiv.checkDataSelectorIsValid("Resolution", uiForm().confit_dsResInput); + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSampleInput); + uiv.checkDataSelectorIsValid("Resolution", m_uiForm.dsResInput); auto range = std::make_pair(m_dblManager->value(m_properties["StartX"]), m_dblManager->value(m_properties["EndX"])); uiv.checkValidRange("Fitting Range", range); // Enforce the rule that at least one fit is needed; either a delta function, one or two lorentzian functions, // or both. (The resolution function must be convolved with a model.) - if ( uiForm().confit_cbFitType->currentIndex() == 0 && ! m_blnManager->value(m_properties["UseDeltaFunc"]) ) + if ( m_uiForm.cbFitType->currentIndex() == 0 && ! m_blnManager->value(m_properties["UseDeltaFunc"]) ) uiv.addErrorMessage("No fit function has been selected."); QString error = uiv.generateErrorMessage(); @@ -238,8 +239,8 @@ namespace IDA void ConvFit::loadSettings(const QSettings & settings) { - uiForm().confit_dsSampleInput->readSettings(settings.group()); - uiForm().confit_dsResInput->readSettings(settings.group()); + m_uiForm.dsSampleInput->readSettings(settings.group()); + m_uiForm.dsResInput->readSettings(settings.group()); } /** @@ -256,16 +257,16 @@ namespace IDA int maxSpecIndex = static_cast(m_cfInputWS->getNumberHistograms()) - 1; - uiForm().confit_spPlotSpectrum->setMaximum(maxSpecIndex); - uiForm().confit_spPlotSpectrum->setMinimum(0); - uiForm().confit_spPlotSpectrum->setValue(0); + m_uiForm.spPlotSpectrum->setMaximum(maxSpecIndex); + m_uiForm.spPlotSpectrum->setMinimum(0); + m_uiForm.spPlotSpectrum->setValue(0); - uiForm().confit_spSpectraMin->setMaximum(maxSpecIndex); - uiForm().confit_spSpectraMin->setMinimum(0); + m_uiForm.spSpectraMin->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMin->setMinimum(0); - uiForm().confit_spSpectraMax->setMaximum(maxSpecIndex); - uiForm().confit_spSpectraMax->setMinimum(0); - uiForm().confit_spSpectraMax->setValue(maxSpecIndex); + m_uiForm.spSpectraMax->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMax->setMinimum(0); + m_uiForm.spSpectraMax->setValue(maxSpecIndex); plotInput(); } @@ -323,14 +324,14 @@ namespace IDA * +-- Model (AT LEAST one delta function or one/two lorentzians.) * | * +-- DeltaFunction (yes/no) - * +-- ProductFunction - * | + * +-- ProductFunction + * | * +-- Lorentzian 1 (yes/no) - * +-- Temperature Correction (yes/no) - * +-- ProductFunction - * | + * +-- Temperature Correction (yes/no) + * +-- ProductFunction + * | * +-- Lorentzian 2 (yes/no) - * +-- Temperature Correction (yes/no) + * +-- Temperature Correction (yes/no) * * @param tieCentres :: whether to tie centres of the two lorentzians. * @@ -350,7 +351,7 @@ namespace IDA func = Mantid::API::FunctionFactory::Instance().createFunction("LinearBackground"); comp->addFunction(func); - const int bgType = uiForm().confit_cbBackground->currentIndex(); // 0 = Fixed Flat, 1 = Fit Flat, 2 = Fit all + const int bgType = m_uiForm.cbBackground->currentIndex(); // 0 = Fixed Flat, 1 = Fit Flat, 2 = Fit all if ( bgType == 0 || ! m_properties["BGA0"]->subProperties().isEmpty() ) { @@ -381,15 +382,15 @@ namespace IDA conv->addFunction(func); //add resolution file - if (uiForm().confit_dsResInput->isFileSelectorVisible()) + if (m_uiForm.dsResInput->isFileSelectorVisible()) { - std::string resfilename = uiForm().confit_dsResInput->getFullFilePath().toStdString(); + std::string resfilename = m_uiForm.dsResInput->getFullFilePath().toStdString(); Mantid::API::IFunction::Attribute attr(resfilename); func->setAttribute("FileName", attr); } else { - std::string resWorkspace = uiForm().confit_dsResInput->getCurrentDataName().toStdString(); + std::string resWorkspace = m_uiForm.dsResInput->getCurrentDataName().toStdString(); Mantid::API::IFunction::Attribute attr(resWorkspace); func->setAttribute("Workspace", attr); } @@ -406,9 +407,9 @@ namespace IDA if ( useDeltaFunc ) { func = Mantid::API::FunctionFactory::Instance().createFunction("DeltaFunction"); - index = model->addFunction(func); - std::string parName = createParName(index); - populateFunction(func, model, m_properties["DeltaFunction"], parName, false); + index = model->addFunction(func); + std::string parName = createParName(index); + populateFunction(func, model, m_properties["DeltaFunction"], parName, false); } // ------------------------------------------------------------ @@ -417,8 +418,8 @@ namespace IDA //create temperature correction function to multiply with the lorentzians Mantid::API::IFunction_sptr tempFunc; - QString temperature = uiForm().confit_leTempCorrection->text(); - bool useTempCorrection = (!temperature.isEmpty() && uiForm().confit_ckTempCorrection->isChecked()); + QString temperature = m_uiForm.leTempCorrection->text(); + bool useTempCorrection = (!temperature.isEmpty() && m_uiForm.ckTempCorrection->isChecked()); // ----------------------------------------------------- // --- Composite / Convolution / Model / Lorentzians --- @@ -426,7 +427,7 @@ namespace IDA std::string prefix1; std::string prefix2; - int fitTypeIndex = uiForm().confit_cbFitType->currentIndex(); + int fitTypeIndex = m_uiForm.cbFitType->currentIndex(); // Add 1st Lorentzian if(fitTypeIndex > 0) @@ -487,7 +488,7 @@ namespace IDA { //create temperature correction function to multiply with the lorentzians Mantid::API::IFunction_sptr tempFunc; - QString temperature = uiForm().confit_leTempCorrection->text(); + QString temperature = m_uiForm.leTempCorrection->text(); //create user function for the exponential correction // (x*temp) / 1-exp(-(x*temp)) @@ -511,7 +512,7 @@ namespace IDA try { Mantid::Geometry::Instrument_const_sptr inst = - AnalysisDataService::Instance().retrieveWS(workspaceName)->getInstrument(); + AnalysisDataService::Instance().retrieveWS(workspaceName)->getInstrument(); std::string analyser = inst->getStringParameter("analyser")[0]; std::string idfDirectory = Mantid::Kernel::ConfigService::Instance().getString("instrumentDefinition.directory"); @@ -582,10 +583,10 @@ namespace IDA { std::string propName = props[i]->propertyName().toStdString(); double propValue = props[i]->valueText().toDouble(); - if ( propValue ) - { - func->setParameter(propName, propValue); - } + if ( propValue ) + { + func->setParameter(propName, propValue); + } } } } @@ -606,14 +607,14 @@ namespace IDA if( m_blnManager->value(m_properties["UseDeltaFunc"]) ) fitType += "Delta"; - switch ( uiForm().confit_cbFitType->currentIndex() ) + switch ( m_uiForm.cbFitType->currentIndex() ) { - case 0: - break; - case 1: - fitType += "1L"; break; - case 2: - fitType += "2L"; break; + case 0: + break; + case 1: + fitType += "1L"; break; + case 2: + fitType += "2L"; break; } return fitType; @@ -630,16 +631,16 @@ namespace IDA */ QString ConvFit::backgroundString() const { - switch ( uiForm().confit_cbBackground->currentIndex() ) + switch ( m_uiForm.cbBackground->currentIndex() ) { - case 0: - return "FixF_s"; - case 1: - return "FitF_s"; - case 2: - return "FitL_s"; - default: - return ""; + case 0: + return "FixF_s"; + case 1: + return "FitF_s"; + case 2: + return "FitL_s"; + default: + return ""; } } @@ -650,18 +651,18 @@ namespace IDA switch ( index ) { - case 0: - m_rangeSelectors["ConvFitHWHM"]->setVisible(false); - break; - case 1: - m_cfTree->addProperty(m_properties["Lorentzian1"]); - m_rangeSelectors["ConvFitHWHM"]->setVisible(true); - break; - case 2: - m_cfTree->addProperty(m_properties["Lorentzian1"]); - m_cfTree->addProperty(m_properties["Lorentzian2"]); - m_rangeSelectors["ConvFitHWHM"]->setVisible(true); - break; + case 0: + m_rangeSelectors["ConvFitHWHM"]->setVisible(false); + break; + case 1: + m_cfTree->addProperty(m_properties["Lorentzian1"]); + m_rangeSelectors["ConvFitHWHM"]->setVisible(true); + break; + case 2: + m_cfTree->addProperty(m_properties["Lorentzian1"]); + m_cfTree->addProperty(m_properties["Lorentzian2"]); + m_rangeSelectors["ConvFitHWHM"]->setVisible(true); + break; } } @@ -687,17 +688,17 @@ namespace IDA return; } - const bool plotGuess = uiForm().confit_ckPlotGuess->isChecked(); - uiForm().confit_ckPlotGuess->setChecked(false); + const bool plotGuess = m_uiForm.ckPlotGuess->isChecked(); + m_uiForm.ckPlotGuess->setChecked(false); - int specNo = uiForm().confit_spPlotSpectrum->text().toInt(); + int specNo = m_uiForm.spPlotSpectrum->text().toInt(); plotMiniPlot(m_cfInputWS, specNo, "ConvFitPlot", "CFDataCurve"); try { const std::pair range = getCurveRange("CFDataCurve"); m_rangeSelectors["ConvFitRange"]->setRange(range.first, range.second); - uiForm().confit_ckPlotGuess->setChecked(plotGuess); + m_uiForm.ckPlotGuess->setChecked(plotGuess); } catch(std::invalid_argument & exc) { @@ -719,12 +720,12 @@ namespace IDA void ConvFit::plotGuess(QtProperty*) { - if ( ! uiForm().confit_ckPlotGuess->isChecked() || m_curves["CFDataCurve"] == NULL ) + if ( ! m_uiForm.ckPlotGuess->isChecked() || m_curves["CFDataCurve"] == NULL ) { return; } - bool tieCentres = (uiForm().confit_cbFitType->currentIndex() > 1); + bool tieCentres = (m_uiForm.cbFitType->currentIndex() > 1); Mantid::API::CompositeFunction_sptr function = createFunction(tieCentres); if ( m_cfInputWS == NULL ) @@ -786,9 +787,9 @@ namespace IDA return; } - uiForm().confit_ckPlotGuess->setChecked(false); + m_uiForm.ckPlotGuess->setChecked(false); - Mantid::API::CompositeFunction_sptr function = createFunction(uiForm().confit_ckTieCentres->isChecked()); + Mantid::API::CompositeFunction_sptr function = createFunction(m_uiForm.ckTieCentres->isChecked()); // get output name QString fitType = fitTypeString(); @@ -800,14 +801,14 @@ namespace IDA } QString outputNm = runPythonCode(QString("from IndirectCommon import getWSprefix\nprint getWSprefix('") + m_cfInputWSName + QString("')\n")).trimmed(); - outputNm += QString("conv_") + fitType + bgType + uiForm().confit_spPlotSpectrum->text(); + outputNm += QString("conv_") + fitType + bgType + m_uiForm.spPlotSpectrum->text(); std::string output = outputNm.toStdString(); Mantid::API::IAlgorithm_sptr alg = Mantid::API::AlgorithmManager::Instance().create("Fit"); alg->initialize(); alg->setPropertyValue("Function", function->asString()); alg->setPropertyValue("InputWorkspace", m_cfInputWSName.toStdString()); - alg->setProperty("WorkspaceIndex", uiForm().confit_spPlotSpectrum->text().toInt()); + alg->setProperty("WorkspaceIndex", m_uiForm.spPlotSpectrum->text().toInt()); alg->setProperty("StartX", m_dblManager->value(m_properties["StartX"])); alg->setProperty("EndX", m_dblManager->value(m_properties["EndX"])); alg->setProperty("Output", output); @@ -846,31 +847,31 @@ namespace IDA m_dblManager->setValue(m_properties["BGA0"], parameters["f0.A0"]); m_dblManager->setValue(m_properties["BGA1"], parameters["f0.A1"]); - int noLorentz = uiForm().confit_cbFitType->currentIndex(); + int noLorentz = m_uiForm.cbFitType->currentIndex(); int funcIndex = 0; - int subIndex = 0; + int subIndex = 0; - //check if we're using a temperature correction - if (uiForm().confit_ckTempCorrection->isChecked() && - !uiForm().confit_leTempCorrection->text().isEmpty()) - { - subIndex++; - } + //check if we're using a temperature correction + if (m_uiForm.ckTempCorrection->isChecked() && + !m_uiForm.leTempCorrection->text().isEmpty()) + { + subIndex++; + } - bool usingDeltaFunc = m_blnManager->value(m_properties["UseDeltaFunc"]); - bool usingCompositeFunc = ((usingDeltaFunc && noLorentz > 0) || noLorentz > 1); + bool usingDeltaFunc = m_blnManager->value(m_properties["UseDeltaFunc"]); + bool usingCompositeFunc = ((usingDeltaFunc && noLorentz > 0) || noLorentz > 1); QString prefBase = "f1.f1."; - if ( usingDeltaFunc ) + if ( usingDeltaFunc ) { QString key = prefBase; - if (usingCompositeFunc) - { - key += "f0."; - } + if (usingCompositeFunc) + { + key += "f0."; + } - key += "Height"; + key += "Height"; m_dblManager->setValue(m_properties["DeltaHeight"], parameters[key]); funcIndex++; @@ -879,16 +880,16 @@ namespace IDA if ( noLorentz > 0 ) { // One Lorentz - QString pref = prefBase; + QString pref = prefBase; - if ( usingCompositeFunc ) - { - pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + "."; - } - else - { - pref += "f" + QString::number(subIndex) + "."; - } + if ( usingCompositeFunc ) + { + pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + "."; + } + else + { + pref += "f" + QString::number(subIndex) + "."; + } m_dblManager->setValue(m_properties["Lorentzian 1.Amplitude"], parameters[pref+"Amplitude"]); m_dblManager->setValue(m_properties["Lorentzian 1.PeakCentre"], parameters[pref+"PeakCentre"]); @@ -899,8 +900,8 @@ namespace IDA if ( noLorentz > 1 ) { // Two Lorentz - QString pref = prefBase; - pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + "."; + QString pref = prefBase; + pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + "."; m_dblManager->setValue(m_properties["Lorentzian 2.Amplitude"], parameters[pref+"Amplitude"]); m_dblManager->setValue(m_properties["Lorentzian 2.PeakCentre"], parameters[pref+"PeakCentre"]); @@ -917,7 +918,7 @@ namespace IDA */ void ConvFit::specMinChanged(int value) { - uiForm().confit_spSpectraMax->setMinimum(value); + m_uiForm.spSpectraMax->setMinimum(value); } /** @@ -929,7 +930,7 @@ namespace IDA */ void ConvFit::specMaxChanged(int value) { - uiForm().confit_spSpectraMin->setMaximum(value); + m_uiForm.spSpectraMin->setMaximum(value); } void ConvFit::minChanged(double val) @@ -966,7 +967,7 @@ namespace IDA else if ( prop == m_properties["Lorentzian 1.FWHM"] ) { hwhmUpdateRS(val); } else if ( prop == m_properties["Lorentzian 1.PeakCentre"] ) { - hwhmUpdateRS(m_dblManager->value(m_properties["Lorentzian 1.FWHM"])); + hwhmUpdateRS(m_dblManager->value(m_properties["Lorentzian 1.FWHM"])); } } @@ -985,14 +986,14 @@ namespace IDA if ( checked ) { m_properties["DeltaFunction"]->addSubProperty(m_properties["DeltaHeight"]); - uiForm().confit_cbPlotOutput->addItem("Height"); - uiForm().confit_cbPlotOutput->addItem("EISF"); + m_uiForm.cbPlotType->addItem("Height"); + m_uiForm.cbPlotType->addItem("EISF"); } else { m_properties["DeltaFunction"]->removeSubProperty(m_properties["DeltaHeight"]); - uiForm().confit_cbPlotOutput->removeItem(uiForm().confit_cbPlotOutput->count()-1); - uiForm().confit_cbPlotOutput->removeItem(uiForm().confit_cbPlotOutput->count()-1); + m_uiForm.cbPlotType->removeItem(m_uiForm.cbPlotType->count()-1); + m_uiForm.cbPlotType->removeItem(m_uiForm.cbPlotType->count()-1); } } } @@ -1045,7 +1046,7 @@ namespace IDA // Determine what the property is. QtProperty* prop = item->property(); - QtProperty* fixedProp = m_stringManager->addProperty( prop->propertyName() ); + QtProperty* fixedProp = m_stringManager->addProperty( prop->propertyName() ); QtProperty* fprlbl = m_stringManager->addProperty("Fixed"); fixedProp->addSubProperty(fprlbl); m_stringManager->setValue(fixedProp, prop->valueText()); @@ -1078,7 +1079,7 @@ namespace IDA void ConvFit::showTieCheckbox(QString fitType) { - uiForm().confit_ckTieCentres->setVisible( fitType == "Two Lorentzians" ); + m_uiForm.ckTieCentres->setVisible( fitType == "Two Lorentzians" ); } } // namespace IDA diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp index ac1443964f09..38e487648b1f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp @@ -21,16 +21,18 @@ namespace CustomInterfaces { namespace IDA { - Elwin::Elwin(QWidget * parent) : IDATab(parent), + Elwin::Elwin(QWidget * parent) : + IDATab(parent), m_elwTree(NULL) { + m_uiForm.setupUi(parent); } void Elwin::setup() { // Create QtTreePropertyBrowser object m_elwTree = new QtTreePropertyBrowser(); - uiForm().elwin_properties->addWidget(m_elwTree); + m_uiForm.properties->addWidget(m_elwTree); // Editor Factories m_elwTree->setFactoryForManager(m_dblManager, doubleEditorFactory()); @@ -65,7 +67,7 @@ namespace IDA m_plots["ElwinPlot"] = new QwtPlot(m_parentWidget); m_plots["ElwinPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font()); m_plots["ElwinPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font()); - uiForm().elwin_plot->addWidget(m_plots["ElwinPlot"]); + m_uiForm.plot->addWidget(m_plots["ElwinPlot"]); m_plots["ElwinPlot"]->setCanvasBackground(Qt::white); // We always want one range selector... the second one can be controlled from // within the elwinTwoRanges(bool state) function @@ -86,9 +88,9 @@ namespace IDA connect(m_blnManager, SIGNAL(valueChanged(QtProperty*, bool)), this, SLOT(twoRanges(QtProperty*, bool))); twoRanges(m_properties["BackgroundSubtraction"], false); - connect(uiForm().elwin_inputFile, SIGNAL(filesFound()), this, SLOT(newInputFiles())); - connect(uiForm().elwin_cbPreviewFile, SIGNAL(currentIndexChanged(int)), this, SLOT(newPreviewFileSelected(int))); - connect(uiForm().elwin_spPreviewSpec, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); + connect(m_uiForm.dsInputFiles, SIGNAL(filesFound()), this, SLOT(newInputFiles())); + connect(m_uiForm.cbPreviewFile, SIGNAL(currentIndexChanged(int)), this, SLOT(newPreviewFileSelected(int))); + connect(m_uiForm.spPreviewSpec, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); // Set any default values m_dblManager->setValue(m_properties["IntegrationStart"], -0.02); @@ -100,7 +102,7 @@ namespace IDA void Elwin::run() { - QStringList inputFilenames = uiForm().elwin_inputFile->getFilenames(); + QStringList inputFilenames = m_uiForm.dsInputFiles->getFilenames(); inputFilenames.sort(); // Get workspace names @@ -144,13 +146,13 @@ namespace IDA IAlgorithm_sptr elwinMultAlg = AlgorithmManager::Instance().create("ElasticWindowMultiple"); elwinMultAlg->initialize(); - elwinMultAlg->setProperty("Plot", uiForm().elwin_ckPlot->isChecked()); + elwinMultAlg->setProperty("Plot", m_uiForm.ckPlot->isChecked()); elwinMultAlg->setProperty("OutputInQ", qWorkspace.toStdString()); elwinMultAlg->setProperty("OutputInQSquared", qSquaredWorkspace.toStdString()); elwinMultAlg->setProperty("OutputELF", elfWorkspace.toStdString()); - elwinMultAlg->setProperty("SampleEnvironmentLogName", uiForm().leLogName->text().toStdString()); + elwinMultAlg->setProperty("SampleEnvironmentLogName", m_uiForm.leLogName->text().toStdString()); elwinMultAlg->setProperty("Range1Start", m_dblManager->value(m_properties["IntegrationStart"])); elwinMultAlg->setProperty("Range1End", m_dblManager->value(m_properties["IntegrationEnd"])); @@ -172,7 +174,7 @@ namespace IDA m_batchAlgoRunner->addAlgorithm(elwinMultAlg, elwinInputProps); // Configure Save algorithms - if(uiForm().elwin_ckSave->isChecked()) + if(m_uiForm.ckSave->isChecked()) { addSaveAlgorithm(qWorkspace); addSaveAlgorithm(qSquaredWorkspace); @@ -216,7 +218,7 @@ namespace IDA { UserInputValidator uiv; - uiv.checkMWRunFilesIsValid("Input", uiForm().elwin_inputFile); + uiv.checkMWRunFilesIsValid("Input", m_uiForm.dsInputFiles); auto rangeOne = std::make_pair(m_dblManager->value(m_properties["IntegrationStart"]), m_dblManager->value(m_properties["IntegrationEnd"])); uiv.checkValidRange("Range One", rangeOne); @@ -237,7 +239,7 @@ namespace IDA void Elwin::loadSettings(const QSettings & settings) { - uiForm().elwin_inputFile->readSettings(settings.group()); + m_uiForm.dsInputFiles->readSettings(settings.group()); } void Elwin::setDefaultResolution(Mantid::API::MatrixWorkspace_const_sptr ws) @@ -274,7 +276,7 @@ namespace IDA logName = QString::fromStdString(log[0]); } - uiForm().leLogName->setText(logName); + m_uiForm.leLogName->setText(logName); } /** @@ -285,10 +287,10 @@ namespace IDA void Elwin::newInputFiles() { // Clear the existing list of files - uiForm().elwin_cbPreviewFile->clear(); + m_uiForm.cbPreviewFile->clear(); // Populate the combo box with the filenames - QStringList filenames = uiForm().elwin_inputFile->getFilenames(); + QStringList filenames = m_uiForm.dsInputFiles->getFilenames(); for(auto it = filenames.begin(); it != filenames.end(); ++it) { QString rawFilename = *it; @@ -296,11 +298,11 @@ namespace IDA QString sampleName = inputFileInfo.baseName(); // Add the item using the base filename as the display string and the raw filename as the data value - uiForm().elwin_cbPreviewFile->addItem(sampleName, rawFilename); + m_uiForm.cbPreviewFile->addItem(sampleName, rawFilename); } // Default to the first file - uiForm().elwin_cbPreviewFile->setCurrentIndex(0); + m_uiForm.cbPreviewFile->setCurrentIndex(0); } /** @@ -312,8 +314,8 @@ namespace IDA */ void Elwin::newPreviewFileSelected(int index) { - QString wsName = uiForm().elwin_cbPreviewFile->itemText(index); - QString filename = uiForm().elwin_cbPreviewFile->itemData(index).toString(); + QString wsName = m_uiForm.cbPreviewFile->itemText(index); + QString filename = m_uiForm.cbPreviewFile->itemData(index).toString(); // Ignore empty filenames (can happen when new files are loaded and the widget is being populated) if(filename.isEmpty()) @@ -328,8 +330,8 @@ namespace IDA auto ws = AnalysisDataService::Instance().retrieveWS(wsName.toStdString()); int numHist = static_cast(ws->getNumberHistograms()) - 1; - uiForm().elwin_spPreviewSpec->setMaximum(numHist); - uiForm().elwin_spPreviewSpec->setValue(0); + m_uiForm.spPreviewSpec->setMaximum(numHist); + m_uiForm.spPreviewSpec->setValue(0); plotInput(); } @@ -339,7 +341,7 @@ namespace IDA */ void Elwin::plotInput() { - QString wsName = uiForm().elwin_cbPreviewFile->currentText(); + QString wsName = m_uiForm.cbPreviewFile->currentText(); if(!AnalysisDataService::Instance().doesExist(wsName.toStdString())) { @@ -355,7 +357,7 @@ namespace IDA return; } - int specNo = uiForm().elwin_spPreviewSpec->value(); + int specNo = m_uiForm.spPreviewSpec->value(); setDefaultResolution(ws); setDefaultSampleLog(ws); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp index 6598db8fc9d4..a8302efe7d52 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp @@ -28,15 +28,16 @@ namespace IDA m_furTree(NULL), m_furyResFileType() { + m_uiForm.setupUi(parent); } void Fury::setup() { m_furTree = new QtTreePropertyBrowser(); - uiForm().fury_TreeSpace->addWidget(m_furTree); + m_uiForm.TreeSpace->addWidget(m_furTree); m_plots["FuryPlot"] = new QwtPlot(m_parentWidget); - uiForm().fury_PlotSpace->addWidget(m_plots["FuryPlot"]); + m_uiForm.PlotSpace->addWidget(m_plots["FuryPlot"]); m_plots["FuryPlot"]->setCanvasBackground(Qt::white); m_plots["FuryPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font()); m_plots["FuryPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font()); @@ -80,8 +81,8 @@ namespace IDA connect(m_rangeSelectors["FuryRange"], SIGNAL(selectionChangedLazy(double, double)), this, SLOT(rsRangeChangedLazy(double, double))); connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateRS(QtProperty*, double))); connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updatePropertyValues(QtProperty*, double))); - connect(uiForm().fury_dsInput, SIGNAL(dataReady(const QString&)), this, SLOT(plotInput(const QString&))); - connect(uiForm().fury_dsResInput, SIGNAL(dataReady(const QString&)), this, SLOT(calculateBinning())); + connect(m_uiForm.dsInput, SIGNAL(dataReady(const QString&)), this, SLOT(plotInput(const QString&))); + connect(m_uiForm.dsResInput, SIGNAL(dataReady(const QString&)), this, SLOT(calculateBinning())); } void Fury::run() @@ -90,16 +91,16 @@ namespace IDA calculateBinning(); - QString wsName = uiForm().fury_dsInput->getCurrentDataName(); - QString resName = uiForm().fury_dsResInput->getCurrentDataName(); + QString wsName = m_uiForm.dsInput->getCurrentDataName(); + QString resName = m_uiForm.dsResInput->getCurrentDataName(); double energyMin = m_dblManager->value(m_properties["ELow"]); double energyMax = m_dblManager->value(m_properties["EHigh"]); long numBins = static_cast(m_dblManager->value(m_properties["SampleBinning"])); - bool plot = uiForm().fury_ckPlot->isChecked(); - bool verbose = uiForm().fury_ckVerbose->isChecked(); - bool save = uiForm().fury_ckSave->isChecked(); + bool plot = m_uiForm.ckPlot->isChecked(); + bool verbose = m_uiForm.ckVerbose->isChecked(); + bool save = m_uiForm.ckSave->isChecked(); IAlgorithm_sptr furyAlg = AlgorithmManager::Instance().create("Fury", -1); furyAlg->initialize(); @@ -119,7 +120,7 @@ namespace IDA runAlgorithm(furyAlg); // Set the result workspace for Python script export - QString sampleName = uiForm().fury_dsInput->getCurrentDataName(); + QString sampleName = m_uiForm.dsInput->getCurrentDataName(); m_pythonExportWsName = sampleName.left(sampleName.lastIndexOf("_")).toStdString() + "_iqt"; } @@ -133,8 +134,8 @@ namespace IDA { UserInputValidator uiv; - uiv.checkDataSelectorIsValid("Sample", uiForm().fury_dsInput); - uiv.checkDataSelectorIsValid("Resolution", uiForm().fury_dsResInput); + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsInput); + uiv.checkDataSelectorIsValid("Resolution", m_uiForm.dsResInput); QString message = uiv.generateErrorMessage(); showMessageBox(message); @@ -189,8 +190,8 @@ namespace IDA disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updatePropertyValues(QtProperty*, double))); - QString wsName = uiForm().fury_dsInput->getCurrentDataName(); - QString resName = uiForm().fury_dsResInput->getCurrentDataName(); + QString wsName = m_uiForm.dsInput->getCurrentDataName(); + QString resName = m_uiForm.dsResInput->getCurrentDataName(); if(wsName.isEmpty() || resName.isEmpty()) return; @@ -200,7 +201,7 @@ namespace IDA if(numBins == 0) return; - bool verbose = uiForm().fury_ckVerbose->isChecked(); + bool verbose = m_uiForm.ckVerbose->isChecked(); IAlgorithm_sptr furyAlg = AlgorithmManager::Instance().create("Fury"); furyAlg->initialize(); @@ -243,8 +244,8 @@ namespace IDA void Fury::loadSettings(const QSettings & settings) { - uiForm().fury_dsInput->readSettings(settings.group()); - uiForm().fury_dsResInput->readSettings(settings.group()); + m_uiForm.dsInput->readSettings(settings.group()); + m_uiForm.dsResInput->readSettings(settings.group()); } void Fury::plotInput(const QString& wsname) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp index d9e3a568d019..2eac2ea214d9 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp @@ -37,6 +37,7 @@ namespace IDA m_ffInputWSName(), m_ties() { + m_uiForm.setupUi(parent); } void FuryFit::setup() @@ -44,13 +45,13 @@ namespace IDA m_stringManager = new QtStringPropertyManager(m_parentWidget); m_ffTree = new QtTreePropertyBrowser(m_parentWidget); - uiForm().furyfit_properties->addWidget(m_ffTree); + m_uiForm.properties->addWidget(m_ffTree); // Setup FuryFit Plot Window m_plots["FuryFitPlot"] = new QwtPlot(m_parentWidget); m_plots["FuryFitPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font()); m_plots["FuryFitPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font()); - uiForm().furyfit_vlPlot->addWidget(m_plots["FuryFitPlot"]); + m_uiForm.vlPlot->addWidget(m_plots["FuryFitPlot"]); m_plots["FuryFitPlot"]->setCanvasBackground(QColor(255,255,255)); m_rangeSelectors["FuryFitRange"] = new MantidQt::MantidWidgets::RangeSelector(m_plots["FuryFitPlot"]); @@ -99,22 +100,22 @@ namespace IDA m_dblManager->setMinimum(m_properties["StretchedExp.Intensity"], 0); m_dblManager->setMaximum(m_properties["StretchedExp.Intensity"], 1); - typeSelection(uiForm().furyfit_cbFitType->currentIndex()); + typeSelection(m_uiForm.cbFitType->currentIndex()); // Connect to PlotGuess checkbox connect(m_dblManager, SIGNAL(propertyChanged(QtProperty*)), this, SLOT(plotGuess(QtProperty*))); // Signal/slot ui connections - connect(uiForm().furyfit_dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(newDataLoaded(const QString&))); - connect(uiForm().furyfit_cbFitType, SIGNAL(currentIndexChanged(int)), this, SLOT(typeSelection(int))); - connect(uiForm().furyfit_pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); + connect(m_uiForm.dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(newDataLoaded(const QString&))); + connect(m_uiForm.cbFitType, SIGNAL(currentIndexChanged(int)), this, SLOT(typeSelection(int))); + connect(m_uiForm.pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); - connect(uiForm().furyfit_dsSampleInput, SIGNAL(filesFound()), this, SLOT(plotInput())); + connect(m_uiForm.dsSampleInput, SIGNAL(filesFound()), this, SLOT(plotInput())); - connect(uiForm().furyfit_spPlotSpectrum, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); + connect(m_uiForm.spPlotSpectrum, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); - connect(uiForm().furyfit_spSpectraMin, SIGNAL(valueChanged(int)), this, SLOT(specMinChanged(int))); - connect(uiForm().furyfit_spSpectraMax, SIGNAL(valueChanged(int)), this, SLOT(specMaxChanged(int))); + connect(m_uiForm.spSpectraMin, SIGNAL(valueChanged(int)), this, SLOT(specMinChanged(int))); + connect(m_uiForm.spSpectraMax, SIGNAL(valueChanged(int)), this, SLOT(specMaxChanged(int))); // Set a custom handler for the QTreePropertyBrowser's ContextMenu event m_ffTree->setContextMenuPolicy(Qt::CustomContextMenu); @@ -128,8 +129,8 @@ namespace IDA return; } - const bool constrainBeta = uiForm().furyfit_ckConstrainBeta->isChecked(); - const bool constrainIntens = uiForm().furyfit_ckConstrainIntensities->isChecked(); + const bool constrainBeta = m_uiForm.ckConstrainBeta->isChecked(); + const bool constrainIntens = m_uiForm.ckConstrainIntensities->isChecked(); CompositeFunction_sptr func = createFunction(); func->tie("f0.A1", "0"); @@ -142,8 +143,8 @@ namespace IDA std::string function = std::string(func->asString()); QString fitType = fitTypeString(); - QString specMin = uiForm().furyfit_spSpectraMin->text(); - QString specMax = uiForm().furyfit_spSpectraMax->text(); + QString specMin = m_uiForm.spSpectraMin->text(); + QString specMax = m_uiForm.spSpectraMax->text(); QString pyInput = "from IndirectDataAnalysis import furyfitSeq, furyfitMult\n" "input = '" + m_ffInputWSName + "'\n" @@ -151,7 +152,7 @@ namespace IDA "ftype = '" + fitTypeString() + "'\n" "startx = " + m_properties["StartX"]->valueText() + "\n" "endx = " + m_properties["EndX"]->valueText() + "\n" - "plot = '" + uiForm().furyfit_cbPlotOutput->currentText() + "'\n" + "plot = '" + m_uiForm.cbPlotOutput->currentText() + "'\n" "spec_min = " + specMin + "\n" "spec_max = " + specMax + "\n" "spec_max = None\n"; @@ -159,10 +160,10 @@ namespace IDA if (constrainIntens) pyInput += "constrain_intens = True \n"; else pyInput += "constrain_intens = False \n"; - if ( uiForm().furyfit_ckVerbose->isChecked() ) pyInput += "verbose = True\n"; + if ( m_uiForm.ckVerbose->isChecked() ) pyInput += "verbose = True\n"; else pyInput += "verbose = False\n"; - if ( uiForm().furyfit_ckSaveSeq->isChecked() ) pyInput += "save = True\n"; + if ( m_uiForm.ckSaveSeq->isChecked() ) pyInput += "save = True\n"; else pyInput += "save = False\n"; if( !constrainBeta ) @@ -186,7 +187,7 @@ namespace IDA { UserInputValidator uiv; - uiv.checkDataSelectorIsValid("Sample", uiForm().furyfit_dsSampleInput); + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSampleInput); auto range = std::make_pair(m_ffRangeManager->value(m_properties["StartX"]), m_ffRangeManager->value(m_properties["EndX"])); uiv.checkValidRange("Ranges", range); @@ -199,7 +200,7 @@ namespace IDA void FuryFit::loadSettings(const QSettings & settings) { - uiForm().furyfit_dsSampleInput->readSettings(settings.group()); + m_uiForm.dsSampleInput->readSettings(settings.group()); } /** @@ -216,16 +217,16 @@ namespace IDA int maxSpecIndex = static_cast(m_ffInputWS->getNumberHistograms()) - 1; - uiForm().furyfit_spPlotSpectrum->setMaximum(maxSpecIndex); - uiForm().furyfit_spPlotSpectrum->setMinimum(0); - uiForm().furyfit_spPlotSpectrum->setValue(0); + m_uiForm.spPlotSpectrum->setMaximum(maxSpecIndex); + m_uiForm.spPlotSpectrum->setMinimum(0); + m_uiForm.spPlotSpectrum->setValue(0); - uiForm().furyfit_spSpectraMin->setMaximum(maxSpecIndex); - uiForm().furyfit_spSpectraMin->setMinimum(0); + m_uiForm.spSpectraMin->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMin->setMinimum(0); - uiForm().furyfit_spSpectraMax->setMaximum(maxSpecIndex); - uiForm().furyfit_spSpectraMax->setMinimum(0); - uiForm().furyfit_spSpectraMax->setValue(maxSpecIndex); + m_uiForm.spSpectraMax->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMax->setMinimum(0); + m_uiForm.spSpectraMax->setValue(maxSpecIndex); plotInput(); } @@ -234,7 +235,7 @@ namespace IDA { CompositeFunction_sptr result( new CompositeFunction ); QString fname; - const int fitType = uiForm().furyfit_cbFitType->currentIndex(); + const int fitType = m_uiForm.cbFitType->currentIndex(); IFunction_sptr func = FunctionFactory::Instance().createFunction("LinearBackground"); func->setParameter("A0", m_ffRangeManager->value(m_properties["BackgroundA0"])); @@ -318,7 +319,7 @@ namespace IDA QString FuryFit::fitTypeString() const { - switch ( uiForm().furyfit_cbFitType->currentIndex() ) + switch ( m_uiForm.cbFitType->currentIndex() ) { case 0: return "1E_s"; @@ -342,10 +343,10 @@ namespace IDA m_ffTree->addProperty(m_properties["LinearBackground"]); //option should only be available with a single stretched exponential - uiForm().furyfit_ckConstrainBeta->setEnabled((index == 2)); - if (!uiForm().furyfit_ckConstrainBeta->isEnabled()) + m_uiForm.ckConstrainBeta->setEnabled((index == 2)); + if (!m_uiForm.ckConstrainBeta->isEnabled()) { - uiForm().furyfit_ckConstrainBeta->setChecked(false); + m_uiForm.ckConstrainBeta->setChecked(false); } switch ( index ) @@ -354,22 +355,22 @@ namespace IDA m_ffTree->addProperty(m_properties["Exponential1"]); //remove option to plot beta - uiForm().furyfit_cbPlotOutput->removeItem(4); + m_uiForm.cbPlotOutput->removeItem(4); break; case 1: m_ffTree->addProperty(m_properties["Exponential1"]); m_ffTree->addProperty(m_properties["Exponential2"]); //remove option to plot beta - uiForm().furyfit_cbPlotOutput->removeItem(4); + m_uiForm.cbPlotOutput->removeItem(4); break; case 2: m_ffTree->addProperty(m_properties["StretchedExp"]); //add option to plot beta - if(uiForm().furyfit_cbPlotOutput->count() == 4) + if(m_uiForm.cbPlotOutput->count() == 4) { - uiForm().furyfit_cbPlotOutput->addItem("Beta"); + m_uiForm.cbPlotOutput->addItem("Beta"); } break; @@ -378,9 +379,9 @@ namespace IDA m_ffTree->addProperty(m_properties["StretchedExp"]); //add option to plot beta - if(uiForm().furyfit_cbPlotOutput->count() == 4) + if(m_uiForm.cbPlotOutput->count() == 4) { - uiForm().furyfit_cbPlotOutput->addItem("Beta"); + m_uiForm.cbPlotOutput->addItem("Beta"); } break; @@ -397,7 +398,7 @@ namespace IDA return; } - int specNo = uiForm().furyfit_spPlotSpectrum->value(); + int specNo = m_uiForm.spPlotSpectrum->value(); plotMiniPlot(m_ffInputWS, specNo, "FuryFitPlot", "FF_DataCurve"); try @@ -448,7 +449,7 @@ namespace IDA */ void FuryFit::specMinChanged(int value) { - uiForm().furyfit_spSpectraMax->setMinimum(value); + m_uiForm.spSpectraMax->setMinimum(value); } /** @@ -460,7 +461,7 @@ namespace IDA */ void FuryFit::specMaxChanged(int value) { - uiForm().furyfit_spSpectraMin->setMaximum(value); + m_uiForm.spSpectraMin->setMaximum(value); } void FuryFit::xMinSelected(double val) @@ -514,7 +515,7 @@ namespace IDA std::string paramName = "f1.Intensity"; size_t index = func->parameterIndex(paramName); - switch ( uiForm().furyfit_cbFitType->currentIndex() ) + switch ( m_uiForm.cbFitType->currentIndex() ) { case 0: // 1 Exp case 2: // 1 Str @@ -553,8 +554,8 @@ namespace IDA // First create the function auto function = createFunction(); - const int fitType = uiForm().furyfit_cbFitType->currentIndex(); - if ( uiForm().furyfit_ckConstrainIntensities->isChecked() ) + const int fitType = m_uiForm.cbFitType->currentIndex(); + if ( m_uiForm.ckConstrainIntensities->isChecked() ) { switch ( fitType ) { @@ -581,7 +582,7 @@ namespace IDA QString pyInput = "from IndirectCommon import getWSprefix\nprint getWSprefix('%1')\n"; pyInput = pyInput.arg(m_ffInputWSName); QString outputNm = runPythonCode(pyInput).trimmed(); - outputNm += QString("fury_") + ftype + uiForm().furyfit_spPlotSpectrum->text(); + outputNm += QString("fury_") + ftype + m_uiForm.spPlotSpectrum->text(); std::string output = outputNm.toStdString(); // Create the Fit Algorithm @@ -589,7 +590,7 @@ namespace IDA alg->initialize(); alg->setPropertyValue("Function", function->asString()); alg->setPropertyValue("InputWorkspace", m_ffInputWSName.toStdString()); - alg->setProperty("WorkspaceIndex", uiForm().furyfit_spPlotSpectrum->text().toInt()); + alg->setProperty("WorkspaceIndex", m_uiForm.spPlotSpectrum->text().toInt()); alg->setProperty("StartX", m_ffRangeManager->value(m_properties["StartX"])); alg->setProperty("EndX", m_ffRangeManager->value(m_properties["EndX"])); alg->setProperty("Ties", m_ties.toStdString()); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp index 225408fc783d..f9e073c56f42 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp @@ -8,7 +8,7 @@ #include using namespace Mantid::API; - + namespace MantidQt { namespace CustomInterfaces @@ -46,7 +46,7 @@ namespace IDA * @returns a QString containing the URL of the Mantid Wiki web page for the tab. */ QString IDATab::tabHelpURL() - { + { return "http://www.mantidproject.org/IDA:" + helpURL(); } @@ -79,37 +79,21 @@ namespace IDA throw std::runtime_error("IDATab: One of the operands is an invalid MatrixWorkspace pointer"); } } - - /** - * @returns a handle to the UI form object stored in the IndirectDataAnalysis class. - */ - Ui::IndirectDataAnalysis & IDATab::uiForm() - { - return m_parent->m_uiForm; - } - - /** - * @returns a const handle to the UI form object stored in the IndirectDataAnalysis class. - */ - const Ui::IndirectDataAnalysis & IDATab::uiForm() const - { - return m_parent->m_uiForm; - } /** * @returns a handle to the DoubleEditorFactory object stored in the IndirectDataAnalysis class. */ - DoubleEditorFactory * IDATab::doubleEditorFactory() - { - return m_parent->m_dblEdFac; + DoubleEditorFactory * IDATab::doubleEditorFactory() + { + return m_parent->m_dblEdFac; } /** * @returns a handle to the QtCheckBoxFactory object stored in the IndirectDataAnalysis class. */ - QtCheckBoxFactory * IDATab::qtCheckBoxFactory() - { - return m_parent->m_blnEdFac; + QtCheckBoxFactory * IDATab::qtCheckBoxFactory() + { + return m_parent->m_blnEdFac; } } // namespace IDA diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp index fda5bdef0cfc..10bdfcdbfab1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp @@ -25,13 +25,14 @@ namespace IDA MSDFit::MSDFit(QWidget * parent) : IDATab(parent), m_currentWsName(""), m_msdTree(NULL) { + m_uiForm.setupUi(parent); } void MSDFit::setup() { // Tree Browser m_msdTree = new QtTreePropertyBrowser(); - uiForm().msd_properties->addWidget(m_msdTree); + m_uiForm.properties->addWidget(m_msdTree); m_msdTree->setFactoryForManager(m_dblManager, doubleEditorFactory()); @@ -44,7 +45,7 @@ namespace IDA m_msdTree->addProperty(m_properties["End"]); m_plots["MSDPlot"] = new QwtPlot(m_parentWidget); - uiForm().msd_plot->addWidget(m_plots["MSDPlot"]); + m_uiForm.plot->addWidget(m_plots["MSDPlot"]); // Cosmetics m_plots["MSDPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font()); @@ -57,12 +58,12 @@ namespace IDA connect(m_rangeSelectors["MSDRange"], SIGNAL(maxValueChanged(double)), this, SLOT(maxChanged(double))); connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateRS(QtProperty*, double))); - connect(uiForm().msd_dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(newDataLoaded(const QString&))); - connect(uiForm().msd_pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); - connect(uiForm().msd_spPlotSpectrum, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); + connect(m_uiForm.dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(newDataLoaded(const QString&))); + connect(m_uiForm.pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); + connect(m_uiForm.spPlotSpectrum, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); - connect(uiForm().msd_spSpectraMin, SIGNAL(valueChanged(int)), this, SLOT(specMinChanged(int))); - connect(uiForm().msd_spSpectraMax, SIGNAL(valueChanged(int)), this, SLOT(specMaxChanged(int))); + connect(m_uiForm.spSpectraMin, SIGNAL(valueChanged(int)), this, SLOT(specMinChanged(int))); + connect(m_uiForm.spSpectraMax, SIGNAL(valueChanged(int)), this, SLOT(specMaxChanged(int))); } void MSDFit::run() @@ -71,17 +72,17 @@ namespace IDA "from IndirectDataAnalysis import msdfit\n" "startX = " + QString::number(m_dblManager->value(m_properties["Start"])) +"\n" "endX = " + QString::number(m_dblManager->value(m_properties["End"])) +"\n" - "specMin = " + uiForm().msd_spSpectraMin->text() + "\n" - "specMax = " + uiForm().msd_spSpectraMax->text() + "\n" - "input = '" + uiForm().msd_dsSampleInput->getCurrentDataName() + "'\n"; + "specMin = " + m_uiForm.spSpectraMin->text() + "\n" + "specMax = " + m_uiForm.spSpectraMax->text() + "\n" + "input = '" + m_uiForm.dsSampleInput->getCurrentDataName() + "'\n"; - if ( uiForm().msd_ckVerbose->isChecked() ) pyInput += "verbose = True\n"; + if ( m_uiForm.ckVerbose->isChecked() ) pyInput += "verbose = True\n"; else pyInput += "verbose = False\n"; - if ( uiForm().msd_ckPlot->isChecked() ) pyInput += "plot = True\n"; + if ( m_uiForm.ckPlot->isChecked() ) pyInput += "plot = True\n"; else pyInput += "plot = False\n"; - if ( uiForm().msd_ckSave->isChecked() ) pyInput += "save = True\n"; + if ( m_uiForm.ckSave->isChecked() ) pyInput += "save = True\n"; else pyInput += "save = False\n"; pyInput += @@ -91,7 +92,7 @@ namespace IDA UNUSED_ARG(pyOutput); // Set the result workspace for Python script export - QString dataName = uiForm().msd_dsSampleInput->getCurrentDataName(); + QString dataName = m_uiForm.dsSampleInput->getCurrentDataName(); m_pythonExportWsName = dataName.left(dataName.lastIndexOf("_")).toStdString() + "_msd"; } @@ -104,11 +105,11 @@ namespace IDA "from IndirectDataAnalysis import msdfit\n" "startX = " + QString::number(m_dblManager->value(m_properties["Start"])) +"\n" "endX = " + QString::number(m_dblManager->value(m_properties["End"])) +"\n" - "specMin = " + uiForm().msd_spPlotSpectrum->text() + "\n" - "specMax = " + uiForm().msd_spPlotSpectrum->text() + "\n" - "input = '" + uiForm().msd_dsSampleInput->getCurrentDataName() + "'\n"; + "specMin = " + m_uiForm.spPlotSpectrum->text() + "\n" + "specMax = " + m_uiForm.spPlotSpectrum->text() + "\n" + "input = '" + m_uiForm.dsSampleInput->getCurrentDataName() + "'\n"; - if ( uiForm().msd_ckVerbose->isChecked() ) pyInput += "verbose = True\n"; + if ( m_uiForm.ckVerbose->isChecked() ) pyInput += "verbose = True\n"; else pyInput += "verbose = False\n"; pyInput += @@ -123,13 +124,13 @@ namespace IDA { UserInputValidator uiv; - uiv.checkDataSelectorIsValid("Sample input", uiForm().msd_dsSampleInput); + uiv.checkDataSelectorIsValid("Sample input", m_uiForm.dsSampleInput); auto range = std::make_pair(m_dblManager->value(m_properties["Start"]), m_dblManager->value(m_properties["End"])); uiv.checkValidRange("a range", range); - int specMin = uiForm().msd_spSpectraMin->value(); - int specMax = uiForm().msd_spSpectraMax->value(); + int specMin = m_uiForm.spSpectraMin->value(); + int specMax = m_uiForm.spSpectraMax->value(); auto specRange = std::make_pair(specMin, specMax+1); uiv.checkValidRange("spectrum range", specRange); @@ -141,7 +142,7 @@ namespace IDA void MSDFit::loadSettings(const QSettings & settings) { - uiForm().msd_dsSampleInput->readSettings(settings.group()); + m_uiForm.dsSampleInput->readSettings(settings.group()); } void MSDFit::plotFit(QString wsName) @@ -170,23 +171,23 @@ namespace IDA auto ws = Mantid::API::AnalysisDataService::Instance().retrieveWS(wsName.toStdString()); int maxSpecIndex = static_cast(ws->getNumberHistograms()) - 1; - uiForm().msd_spPlotSpectrum->setMaximum(maxSpecIndex); - uiForm().msd_spPlotSpectrum->setMinimum(0); - uiForm().msd_spPlotSpectrum->setValue(0); + m_uiForm.spPlotSpectrum->setMaximum(maxSpecIndex); + m_uiForm.spPlotSpectrum->setMinimum(0); + m_uiForm.spPlotSpectrum->setValue(0); - uiForm().msd_spSpectraMin->setMaximum(maxSpecIndex); - uiForm().msd_spSpectraMin->setMinimum(0); + m_uiForm.spSpectraMin->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMin->setMinimum(0); - uiForm().msd_spSpectraMax->setMaximum(maxSpecIndex); - uiForm().msd_spSpectraMax->setMinimum(0); - uiForm().msd_spSpectraMax->setValue(maxSpecIndex); + m_uiForm.spSpectraMax->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMax->setMinimum(0); + m_uiForm.spSpectraMax->setValue(maxSpecIndex); plotInput(); } void MSDFit::plotInput() { - QString wsname = uiForm().msd_dsSampleInput->getCurrentDataName(); + QString wsname = m_uiForm.dsSampleInput->getCurrentDataName(); if(!AnalysisDataService::Instance().doesExist(wsname.toStdString())) { @@ -196,7 +197,7 @@ namespace IDA auto ws = AnalysisDataService::Instance().retrieveWS(wsname.toStdString()); - int wsIndex = uiForm().msd_spPlotSpectrum->value(); + int wsIndex = m_uiForm.spPlotSpectrum->value(); plotMiniPlot(ws, wsIndex, "MSDPlot", "MSDDataCurve"); try @@ -228,7 +229,7 @@ namespace IDA */ void MSDFit::specMinChanged(int value) { - uiForm().msd_spSpectraMax->setMinimum(value); + m_uiForm.spSpectraMax->setMinimum(value); } /** @@ -240,7 +241,7 @@ namespace IDA */ void MSDFit::specMaxChanged(int value) { - uiForm().msd_spSpectraMin->setMaximum(value); + m_uiForm.spSpectraMin->setMaximum(value); } void MSDFit::minChanged(double val) From 17636e632a570be3bc4a1c0e570a0196e50e947e Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 27 Jan 2015 16:54:28 +0000 Subject: [PATCH 074/130] IDA tabs working as before Refs #10960 --- .../Indirect/ApplyCorr.h | 3 - .../Indirect/CalcCorr.h | 2 +- .../Indirect/CalcCorr.ui | 128 +++++++++--------- .../Indirect/IDATab.h | 9 +- .../Indirect/IndirectDataAnalysis.h | 9 +- .../Indirect/IndirectDataAnalysis.ui | 4 +- .../src/Indirect/ApplyCorr.cpp | 26 +--- .../CustomInterfaces/src/Indirect/ConvFit.cpp | 8 +- .../CustomInterfaces/src/Indirect/Elwin.cpp | 4 +- .../CustomInterfaces/src/Indirect/Fury.cpp | 16 +-- .../CustomInterfaces/src/Indirect/FuryFit.cpp | 20 +-- .../CustomInterfaces/src/Indirect/IDATab.cpp | 22 +-- .../src/Indirect/IndirectDataAnalysis.cpp | 35 ++--- .../CustomInterfaces/src/Indirect/MSDFit.cpp | 4 +- 14 files changed, 123 insertions(+), 167 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h index 72c27060220b..fd8ba18e9d18 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h @@ -32,7 +32,6 @@ namespace IDA virtual bool validate(); virtual void loadSettings(const QSettings & settings); virtual QString helpURL() {return "AbsCor";} - bool validateScaleInput(); ///< validate input for Scale option. /// ask the user if they wish to rebin the can bool requireCanRebin(); @@ -40,8 +39,6 @@ namespace IDA /// Pointer to the result workspace (for plotting) Mantid::API::MatrixWorkspace_sptr outputWs; - private slots: - void scaleMultiplierCheck(bool state); ///< handle checking/unchecking of "Scale: Multiply Container by" }; } // namespace IDA } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h index 106a4eeea1b9..9ec9d9802521 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h @@ -1,7 +1,7 @@ #ifndef MANTIDQTCUSTOMINTERFACESIDA_CALCCORR_H_ #define MANTIDQTCUSTOMINTERFACESIDA_CALCCORR_H_ -#include "ui_CalcCorr.ui" +#include "ui_CalcCorr.h" #include "IDATab.h" namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui index 41eb7b5190f7..2c0d0d831553 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui @@ -21,7 +21,7 @@ - + false @@ -52,14 +52,14 @@ - + Use Can: - + 0 @@ -111,7 +111,7 @@ - + 0 @@ -124,7 +124,7 @@ - + 0 @@ -144,21 +144,21 @@ - + Beam Width: - + - + 0 @@ -171,7 +171,7 @@ - + color: rgb(255, 0, 0); @@ -181,14 +181,14 @@ - + - + color: rgb(255, 0, 0); @@ -198,7 +198,7 @@ - + 0 @@ -211,7 +211,7 @@ 0 - + 0 @@ -219,7 +219,7 @@ - + color: rgb(255, 0, 0); @@ -229,7 +229,7 @@ - + false @@ -254,7 +254,7 @@ - + false @@ -279,7 +279,7 @@ - + false @@ -295,7 +295,7 @@ - + false @@ -305,7 +305,7 @@ - + false @@ -315,14 +315,14 @@ - + Thickness: - + false @@ -338,7 +338,7 @@ - + 0 @@ -354,29 +354,29 @@ - - + + 0 - + Radius 1: - + Radius 2: - + false @@ -386,7 +386,7 @@ - + color: rgb(255, 0, 0); @@ -396,7 +396,7 @@ - + color: rgb(255, 0, 0); @@ -406,7 +406,7 @@ - + 0 @@ -419,7 +419,7 @@ - + false @@ -444,7 +444,7 @@ - + false @@ -454,7 +454,7 @@ - + @@ -486,7 +486,7 @@ - + 0 @@ -512,7 +512,7 @@ - + 0 @@ -536,35 +536,35 @@ - + - + Scattering cross-section: - + - + Absorption cross-section: - + 0 @@ -580,7 +580,7 @@ - + 0 @@ -613,14 +613,14 @@ - + - + 0 @@ -642,7 +642,7 @@ - + 0 @@ -658,14 +658,14 @@ - + - + 0 @@ -707,7 +707,7 @@ - + 0 @@ -720,7 +720,7 @@ - + 0 @@ -733,7 +733,7 @@ - + true @@ -763,7 +763,7 @@ - + true @@ -779,7 +779,7 @@ - + true @@ -789,7 +789,7 @@ - + 0 @@ -811,14 +811,14 @@ - + - + 0 @@ -834,7 +834,7 @@ - + 0 @@ -864,10 +864,10 @@ - + - + 0 @@ -889,7 +889,7 @@ - + true @@ -908,14 +908,14 @@ - + - + 0 @@ -954,7 +954,7 @@ - + true @@ -983,7 +983,7 @@ - + 0 @@ -996,7 +996,7 @@ - + None @@ -1033,7 +1033,7 @@ - + Save Result diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h index c1a1e2b4369f..99034a419700 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h @@ -8,6 +8,7 @@ class QwtPlotCurve; class QwtPlot; +class QSettings; class QString; namespace MantidQt @@ -69,10 +70,10 @@ namespace IDA bool checkWorkspaceBinningMatches(Mantid::API::MatrixWorkspace_const_sptr left, Mantid::API::MatrixWorkspace_const_sptr right); - /// Returns a handle to the DoubleEditorFactory object stored in the IndirectDataAnalysis class. - DoubleEditorFactory * doubleEditorFactory(); - /// Returns a handle to the QtCheckBoxFactory object stored in the IndirectDataAnalysis class. - QtCheckBoxFactory * qtCheckBoxFactory(); + /// DoubleEditorFactory + DoubleEditorFactory* m_dblEdFac; + /// QtCheckBoxFactory + QtCheckBoxFactory* m_blnEdFac; protected slots: /// Slot that can be called when a user eidts an input. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h index c7233144d7e0..79115a03c214 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h @@ -36,10 +36,10 @@ namespace IDA // Number of decimal places in property browsers. static const unsigned int NUM_DECIMALS = 6; - + // Forward Declaration class IDATab; - + /** * The IndirectDataAnalysis class is the main class that handles the interface and controls * its tabs. @@ -94,11 +94,6 @@ namespace IDA /// Double validator QDoubleValidator* m_valDbl; - /// DoubleEditorFactory - DoubleEditorFactory* m_dblEdFac; - /// QtCheckBoxFactory - QtCheckBoxFactory* m_blnEdFac; - /// Change Observer for ConfigService (monitors user directories) Poco::NObserver m_changeObserver; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui index 0f388f5847ed..bd992c015b9e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui @@ -16,7 +16,7 @@ - + true @@ -162,7 +162,7 @@ - tabWidget + twIDATabs pbHelp pbRun pbManageDirs diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp index a79f3ff98750..fd36d64f8bd6 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp @@ -57,30 +57,8 @@ namespace IDA m_uiForm.spPreviewSpec->setMaximum(static_cast(sampleWs->getNumberHistograms()) - 1); } - bool ApplyCorr::validateScaleInput() - { - bool valid = true; - int dummyPos = 0; - - // scale multiplier - QString scaleMultiplierText = m_uiForm.spCanScale->text(); - QValidator::State fieldState = m_uiForm.spCanScale->validator()->validate(scaleMultiplierText, dummyPos); - - if ( m_uiForm.ckScaleMultiplier->isChecked() && fieldState != QValidator::Acceptable ) - { - valid = false; - } - - return valid; - } - void ApplyCorr::run() { - if ( ! validateScaleInput() ) - { - return; - } - QString geom = m_uiForm.cbGeometry->currentText(); if ( geom == "Flat" ) { @@ -160,9 +138,9 @@ namespace IDA QString ScalingFactor = "1.0\n"; QString ScaleOrNot = "False\n"; - pyInput += m_uiForm.ckScaleMultiplier->isChecked() ? "True\n" : "False\n"; + pyInput += m_uiForm.ckScaleCan->isChecked() ? "True\n" : "False\n"; - if ( m_uiForm.ckScaleMultiplier->isChecked() ) + if ( m_uiForm.ckScaleCan->isChecked() ) { ScalingFactor = m_uiForm.spCanScale->text(); ScaleOrNot = "True\n"; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp index 086f9ce32913..25b1fd357bc3 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp @@ -47,8 +47,8 @@ namespace IDA m_uiForm.properties->addWidget(m_cfTree); // add factories to managers - m_cfTree->setFactoryForManager(m_blnManager, qtCheckBoxFactory()); - m_cfTree->setFactoryForManager(m_dblManager, doubleEditorFactory()); + m_cfTree->setFactoryForManager(m_blnManager, m_blnEdFac); + m_cfTree->setFactoryForManager(m_dblManager, m_dblEdFac); // Create Plot Widget m_plots["ConvFitPlot"] = new QwtPlot(m_parentWidget); @@ -132,7 +132,7 @@ namespace IDA connect(m_uiForm.cbFitType, SIGNAL(currentIndexChanged(int)), this, SLOT(typeSelection(int))); connect(m_uiForm.cbBackground, SIGNAL(currentIndexChanged(int)), this, SLOT(bgTypeSelection(int))); - connect(m_uiForm.pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); + connect(m_uiForm.pbSingleFit, SIGNAL(clicked()), this, SLOT(singleFit())); // Context menu m_cfTree->setContextMenuPolicy(Qt::CustomContextMenu); @@ -179,7 +179,7 @@ namespace IDA "ties = " + ties + "\n" "specMin = " + specMin + "\n" "specMax = " + specMax + "\n" - "save = " + (m_uiForm.ckSaveSeq->isChecked() ? "True\n" : "False\n"); + "save = " + (m_uiForm.ckSave->isChecked() ? "True\n" : "False\n"); if ( m_blnManager->value(m_properties["Convolve"]) ) pyInput += "convolve = True\n"; else pyInput += "convolve = False\n"; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp index 38e487648b1f..d1d59ab7e27a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp @@ -35,8 +35,8 @@ namespace IDA m_uiForm.properties->addWidget(m_elwTree); // Editor Factories - m_elwTree->setFactoryForManager(m_dblManager, doubleEditorFactory()); - m_elwTree->setFactoryForManager(m_blnManager, qtCheckBoxFactory()); + m_elwTree->setFactoryForManager(m_dblManager, m_dblEdFac); + m_elwTree->setFactoryForManager(m_blnManager, m_blnEdFac); // Create Properties m_properties["IntegrationStart"] = m_dblManager->addProperty("Start"); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp index a8302efe7d52..21377a1f0488 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp @@ -34,10 +34,10 @@ namespace IDA void Fury::setup() { m_furTree = new QtTreePropertyBrowser(); - m_uiForm.TreeSpace->addWidget(m_furTree); + m_uiForm.properties->addWidget(m_furTree); m_plots["FuryPlot"] = new QwtPlot(m_parentWidget); - m_uiForm.PlotSpace->addWidget(m_plots["FuryPlot"]); + m_uiForm.plot->addWidget(m_plots["FuryPlot"]); m_plots["FuryPlot"]->setCanvasBackground(Qt::white); m_plots["FuryPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font()); m_plots["FuryPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font()); @@ -73,7 +73,7 @@ namespace IDA m_dblManager->setValue(m_properties["SampleBinning"], 10); - m_furTree->setFactoryForManager(m_dblManager, doubleEditorFactory()); + m_furTree->setFactoryForManager(m_dblManager, m_dblEdFac); m_rangeSelectors["FuryRange"] = new MantidQt::MantidWidgets::RangeSelector(m_plots["FuryPlot"]); @@ -82,7 +82,7 @@ namespace IDA connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateRS(QtProperty*, double))); connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updatePropertyValues(QtProperty*, double))); connect(m_uiForm.dsInput, SIGNAL(dataReady(const QString&)), this, SLOT(plotInput(const QString&))); - connect(m_uiForm.dsResInput, SIGNAL(dataReady(const QString&)), this, SLOT(calculateBinning())); + connect(m_uiForm.dsResolution, SIGNAL(dataReady(const QString&)), this, SLOT(calculateBinning())); } void Fury::run() @@ -92,7 +92,7 @@ namespace IDA calculateBinning(); QString wsName = m_uiForm.dsInput->getCurrentDataName(); - QString resName = m_uiForm.dsResInput->getCurrentDataName(); + QString resName = m_uiForm.dsResolution->getCurrentDataName(); double energyMin = m_dblManager->value(m_properties["ELow"]); double energyMax = m_dblManager->value(m_properties["EHigh"]); @@ -135,7 +135,7 @@ namespace IDA UserInputValidator uiv; uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsInput); - uiv.checkDataSelectorIsValid("Resolution", m_uiForm.dsResInput); + uiv.checkDataSelectorIsValid("Resolution", m_uiForm.dsResolution); QString message = uiv.generateErrorMessage(); showMessageBox(message); @@ -191,7 +191,7 @@ namespace IDA disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updatePropertyValues(QtProperty*, double))); QString wsName = m_uiForm.dsInput->getCurrentDataName(); - QString resName = m_uiForm.dsResInput->getCurrentDataName(); + QString resName = m_uiForm.dsResolution->getCurrentDataName(); if(wsName.isEmpty() || resName.isEmpty()) return; @@ -245,7 +245,7 @@ namespace IDA void Fury::loadSettings(const QSettings & settings) { m_uiForm.dsInput->readSettings(settings.group()); - m_uiForm.dsResInput->readSettings(settings.group()); + m_uiForm.dsResolution->readSettings(settings.group()); } void Fury::plotInput(const QString& wsname) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp index 2eac2ea214d9..4aff95b31597 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/FuryFit.cpp @@ -67,8 +67,8 @@ namespace IDA // setupTreePropertyBrowser m_ffRangeManager = new QtDoublePropertyManager(m_parentWidget); - m_ffTree->setFactoryForManager(m_dblManager, doubleEditorFactory()); - m_ffTree->setFactoryForManager(m_ffRangeManager, doubleEditorFactory()); + m_ffTree->setFactoryForManager(m_dblManager, m_dblEdFac); + m_ffTree->setFactoryForManager(m_ffRangeManager, m_dblEdFac); m_properties["StartX"] = m_ffRangeManager->addProperty("StartX"); m_ffRangeManager->setDecimals(m_properties["StartX"], NUM_DECIMALS); @@ -152,7 +152,7 @@ namespace IDA "ftype = '" + fitTypeString() + "'\n" "startx = " + m_properties["StartX"]->valueText() + "\n" "endx = " + m_properties["EndX"]->valueText() + "\n" - "plot = '" + m_uiForm.cbPlotOutput->currentText() + "'\n" + "plot = '" + m_uiForm.cbPlotType->currentText() + "'\n" "spec_min = " + specMin + "\n" "spec_max = " + specMax + "\n" "spec_max = None\n"; @@ -163,7 +163,7 @@ namespace IDA if ( m_uiForm.ckVerbose->isChecked() ) pyInput += "verbose = True\n"; else pyInput += "verbose = False\n"; - if ( m_uiForm.ckSaveSeq->isChecked() ) pyInput += "save = True\n"; + if ( m_uiForm.ckSave->isChecked() ) pyInput += "save = True\n"; else pyInput += "save = False\n"; if( !constrainBeta ) @@ -355,22 +355,22 @@ namespace IDA m_ffTree->addProperty(m_properties["Exponential1"]); //remove option to plot beta - m_uiForm.cbPlotOutput->removeItem(4); + m_uiForm.cbPlotType->removeItem(4); break; case 1: m_ffTree->addProperty(m_properties["Exponential1"]); m_ffTree->addProperty(m_properties["Exponential2"]); //remove option to plot beta - m_uiForm.cbPlotOutput->removeItem(4); + m_uiForm.cbPlotType->removeItem(4); break; case 2: m_ffTree->addProperty(m_properties["StretchedExp"]); //add option to plot beta - if(m_uiForm.cbPlotOutput->count() == 4) + if(m_uiForm.cbPlotType->count() == 4) { - m_uiForm.cbPlotOutput->addItem("Beta"); + m_uiForm.cbPlotType->addItem("Beta"); } break; @@ -379,9 +379,9 @@ namespace IDA m_ffTree->addProperty(m_properties["StretchedExp"]); //add option to plot beta - if(m_uiForm.cbPlotOutput->count() == 4) + if(m_uiForm.cbPlotType->count() == 4) { - m_uiForm.cbPlotOutput->addItem("Beta"); + m_uiForm.cbPlotType->addItem("Beta"); } break; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp index f9e073c56f42..0c7f9708497f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp @@ -5,6 +5,7 @@ #include #include +#include #include using namespace Mantid::API; @@ -21,9 +22,14 @@ namespace IDA * @param parent :: the parent widget (an IndirectDataAnalysis object). */ IDATab::IDATab(QWidget * parent) : IndirectTab(parent), + m_dblEdFac(NULL), m_blnEdFac(NULL), m_parent(NULL) { m_parent = dynamic_cast(parent); + + // Create Editor Factories + m_dblEdFac = new DoubleEditorFactory(this); + m_blnEdFac = new QtCheckBoxFactory(this); } /** @@ -80,22 +86,6 @@ namespace IDA } } - /** - * @returns a handle to the DoubleEditorFactory object stored in the IndirectDataAnalysis class. - */ - DoubleEditorFactory * IDATab::doubleEditorFactory() - { - return m_parent->m_dblEdFac; - } - - /** - * @returns a handle to the QtCheckBoxFactory object stored in the IndirectDataAnalysis class. - */ - QtCheckBoxFactory * IDATab::qtCheckBoxFactory() - { - return m_parent->m_blnEdFac; - } - } // namespace IDA } // namespace CustomInterfaces } // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp index c8debe579969..5a7f024d4d48 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp @@ -36,19 +36,20 @@ namespace IDA IndirectDataAnalysis::IndirectDataAnalysis(QWidget *parent) : UserSubWindow(parent), m_valInt(NULL), m_valDbl(NULL), - m_dblEdFac(NULL), m_blnEdFac(NULL), m_changeObserver(*this, &IndirectDataAnalysis::handleDirectoryChange) { + m_uiForm.setupUi(this); + // Allows us to get a handle on a tab using an enum, for example "m_tabs[ELWIN]". // All tabs MUST appear here to be shown in interface. // We make the assumption that each map key corresponds to the order in which the tabs appear. - m_tabs.insert(std::make_pair(ELWIN, new Elwin(this))); - m_tabs.insert(std::make_pair(MSD_FIT, new MSDFit(this))); - m_tabs.insert(std::make_pair(FURY, new Fury(this))); - m_tabs.insert(std::make_pair(FURY_FIT, new FuryFit(this))); - m_tabs.insert(std::make_pair(CONV_FIT, new ConvFit(this))); - m_tabs.insert(std::make_pair(CALC_CORR, new CalcCorr(this))); - m_tabs.insert(std::make_pair(APPLY_CORR, new ApplyCorr(this))); + m_tabs.insert(std::make_pair(ELWIN, new Elwin(m_uiForm.twIDATabs->widget(ELWIN)))); + m_tabs.insert(std::make_pair(MSD_FIT, new MSDFit(m_uiForm.twIDATabs->widget(MSD_FIT)))); + m_tabs.insert(std::make_pair(FURY, new Fury(m_uiForm.twIDATabs->widget(FURY)))); + m_tabs.insert(std::make_pair(FURY_FIT, new FuryFit(m_uiForm.twIDATabs->widget(FURY_FIT)))); + m_tabs.insert(std::make_pair(CONV_FIT, new ConvFit(m_uiForm.twIDATabs->widget(CONV_FIT)))); + m_tabs.insert(std::make_pair(CALC_CORR, new CalcCorr(m_uiForm.twIDATabs->widget(CALC_CORR)))); + m_tabs.insert(std::make_pair(APPLY_CORR, new ApplyCorr(m_uiForm.twIDATabs->widget(APPLY_CORR)))); } /** @@ -76,16 +77,10 @@ namespace IDA * Initialised the layout of the interface. MUST be called. */ void IndirectDataAnalysis::initLayout() - { - m_uiForm.setupUi(this); - + { // Connect Poco Notification Observer Mantid::Kernel::ConfigService::Instance().addObserver(m_changeObserver); - // Create Editor Factories - m_dblEdFac = new DoubleEditorFactory(this); - m_blnEdFac = new QtCheckBoxFactory(this); - // Set up all tabs for(auto tab = m_tabs.begin(); tab != m_tabs.end(); ++tab) { @@ -121,7 +116,7 @@ namespace IDA settings.beginGroup(settingsGroup + "ProcessedFiles"); settings.setValue("last_directory", saveDir); - + // Load each tab's settings. auto tab = m_tabs.begin(); for( ; tab != m_tabs.end(); ++tab ) @@ -135,7 +130,7 @@ namespace IDA */ void IndirectDataAnalysis::run() { - const unsigned int currentTab = m_uiForm.tabWidget->currentIndex(); + const unsigned int currentTab = m_uiForm.twIDATabs->currentIndex(); m_tabs[currentTab]->runTab(); } @@ -154,7 +149,7 @@ namespace IDA */ void IndirectDataAnalysis::help() { - unsigned int currentTab = m_uiForm.tabWidget->currentIndex(); + unsigned int currentTab = m_uiForm.twIDATabs->currentIndex(); QString url = m_tabs[currentTab]->tabHelpURL(); QDesktopServices::openUrl(QUrl(url)); } @@ -164,14 +159,14 @@ namespace IDA */ void IndirectDataAnalysis::exportTabPython() { - unsigned int currentTab = m_uiForm.tabWidget->currentIndex(); + unsigned int currentTab = m_uiForm.twIDATabs->currentIndex(); m_tabs[currentTab]->exportPythonScript(); } /** * Slot to wrap the protected showInformationBox method defined * in UserSubWindow and provide access to composed tabs. - * + * * @param message The message to display in the message box */ void IndirectDataAnalysis::showMessageBox(const QString& message) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp index 10bdfcdbfab1..364913ca92f8 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp @@ -34,7 +34,7 @@ namespace IDA m_msdTree = new QtTreePropertyBrowser(); m_uiForm.properties->addWidget(m_msdTree); - m_msdTree->setFactoryForManager(m_dblManager, doubleEditorFactory()); + m_msdTree->setFactoryForManager(m_dblManager, m_dblEdFac); m_properties["Start"] = m_dblManager->addProperty("StartX"); m_dblManager->setDecimals(m_properties["Start"], NUM_DECIMALS); @@ -59,7 +59,7 @@ namespace IDA connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateRS(QtProperty*, double))); connect(m_uiForm.dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(newDataLoaded(const QString&))); - connect(m_uiForm.pbSingle, SIGNAL(clicked()), this, SLOT(singleFit())); + connect(m_uiForm.pbSingleFit, SIGNAL(clicked()), this, SLOT(singleFit())); connect(m_uiForm.spPlotSpectrum, SIGNAL(valueChanged(int)), this, SLOT(plotInput())); connect(m_uiForm.spSpectraMin, SIGNAL(valueChanged(int)), this, SLOT(specMinChanged(int))); From 3c5c1ffd429884a722c14a10c6334c092752ffba Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Tue, 27 Jan 2015 17:38:25 +0000 Subject: [PATCH 075/130] Re #10958 Validate method in reduction wrapper --- .../scripts/Inelastic/Direct/DirectEnergyConversion.py | 3 ++- Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py index 48e42743375c..f928f49992ac 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py +++ b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py @@ -72,7 +72,7 @@ class DirectEnergyConversion(object): A detector calibration file must be specified if running the reduction with workspaces as input namely: - >>w2=cred.onvert_to_energy_transfer('wb_wksp','run_wksp',ei,rebin_params,mapfile,det_cal_file=cal_file + >>w2=cred.onvert_to_energy('wb_wksp','run_wksp',ei,rebin_params,mapfile,det_cal_file=cal_file ,diag_remove_zero=False,norm_method='current') @@ -790,6 +790,7 @@ def save_results(self, workspace, save_file=None, formats = None): def prop_man(self): """ Return property manager containing DirectEnergyConversion parameters """ return self._propMan + @prop_man.setter def prop_man(self,value): """ Assign new instance of direct property manager to provide DirectEnergyConversion parameters """ diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 8bc5e26af2dd..765fe2db7e1d 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -127,8 +127,9 @@ def validate_result(self,Error=1.e-3,ToleranceRelErr=True): self.def_main_properties() reduced = self.reduce() - result = CheckWorkspaceMatch(Workspace1=sample,Workspace2=reduced,Tolerance=Error,CheckSampe=False, - ChceckInstrument=False,ToleranceRelErr=ToleranceRelErr) + result = CheckWorkspacesMatch(Workspace1=sample,Workspace2=reduced, + Tolerance=Error,CheckSample=False, + CheckInstrument=False,ToleranceRelErr=ToleranceRelErr) self.wait_for_file = current_wait_state self._run_from_web = current_web_state From e16d365d483e2f6ee8d62c9b5d8479d1637c9ca2 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Tue, 27 Jan 2015 19:11:33 +0000 Subject: [PATCH 076/130] Re #10958 Fixed "Wait for file" mode --- .../Inelastic/Direct/ReductionWrapper.py | 43 +++++++++++++++---- .../scripts/Inelastic/Direct/RunDescriptor.py | 9 ++-- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 765fe2db7e1d..865f4d46854b 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -40,7 +40,21 @@ def __init__(self,instrumentName,web_var=None): self._wvs = ReductionWrapper.var_holder() # Initialize reduced for given instrument self.reducer = DirectEnergyConversion(instrumentName) + + self._validation_fname=None # + def get_validation_file_name(self,ReferenceFile=None): + """ function provides name of the file with mantid + workspace reduced earlier and which should be validated + against results of current reduction + + Should be overloaded to return real file name for particular + reduction + """ + if ReferenceFile: + self._validation_fname = ReferenceFile + return self._validation_fname + @property def wait_for_file(self): """ If this variable set to positive value, this value @@ -99,7 +113,7 @@ def get_validation_file_name(self): """ return None # - def validate_result(self,Error=1.e-3,ToleranceRelErr=True): + def validate_result(self,BuildSampleWSIfNotPresent=False,Error=1.e-3,ToleranceRelErr=True): """ Method validates results of the reduction against reference file provided by get_validation_file_name() method @@ -112,9 +126,12 @@ def validate_result(self,Error=1.e-3,ToleranceRelErr=True): validation_file = self.get_validation_file_name() if not validation_file: - return True,'No validation defined' - - sample = Load(validation_file) + Build_validation =True + if not BuildSampleWSIfNotPresent: + return True,'No validation defined' + else: + sample = Load(validation_file) + Build_validation = False # just in case, to be sure current_web_state = self._run_from_web @@ -125,9 +142,17 @@ def validate_result(self,Error=1.e-3,ToleranceRelErr=True): # self.def_advanced_properties() self.def_main_properties() + self.reducer.prop_man.save_format=None + reduced = self.reduce() - result = CheckWorkspacesMatch(Workspace1=sample,Workspace2=reduced, + if Build_validation: + result_name = self.reducer.prop_man.save_file_name + self.reducer.prop_man.log("*** Saving validation file with name: {0}.nxs".format(result_name),'notice') + SaveNexus(result,Filename=result_name+'.nxs') + return True,'Created validation file {0}.nxs'.format(result_name) + else: + result = CheckWorkspacesMatch(Workspace1=sample,Workspace2=reduced, Tolerance=Error,CheckSample=False, CheckInstrument=False,ToleranceRelErr=ToleranceRelErr) @@ -173,13 +198,13 @@ def reduce(self,input_file=None,output_directory=None): timeToWait = self._wait_for_file if timeToWait: - file = PropertyManager.sample_run.find_file() - while len(file)==0: + file = PropertyManager.sample_run.find_file(be_quet=True) + while file.find('ERROR:')>=0: file_hint,fext = PropertyManager.sample_run.file_hint() - self.reduced.prop_man.log("*** Waiting {0}sec for file {1} to appear on the data search path"\ + self.reducer.prop_man.log("*** Waiting {0} sec for file {1} to appear on the data search path"\ .format(timeToWait,file_hint),'notice') Pause(timeToWait) - file = PropertyManager.sample_run.find_file() + file = PropertyManager.sample_run.find_file(be_quet=True) ws = self.reducer.convert_to_energy(None,input_file) else: diff --git a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py index bc7e660969a2..1602f4665088 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py +++ b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py @@ -203,11 +203,14 @@ def set_file_ext(self,val): else: raise AttributeError('Source file extension can be only a string') - def file_hint(self,run_num_str,filePath=None,fileExt=None,**kwargs): + def file_hint(self,run_num_str=None,filePath=None,fileExt=None,**kwargs): """ procedure to provide run file guess name from run properties main purpose -- to support customized order of file extensions """ + if not run_num_str: + run_num_str = str(self.run_number()) + inst_name = RunDescriptor._holder.short_inst_name if 'file_hint' in kwargs: @@ -257,8 +260,8 @@ def find_file(self,run_num = None,filePath=None,fileExt=None,**kwargs): except RuntimeError: message = 'Cannot find file matching hint {0} on current search paths ' \ 'for instrument {1}'.format(file_hint,inst_name) - - RunDescriptor._logger(message,'warning') + if not ('be_quet' in kwargs): + RunDescriptor._logger(message,'warning') return 'ERROR:find_file: '+message #-------------------------------------------------------------------------------------------------------------------- @staticmethod From b432cf45d5f6bd81748734cbe8de9230cef90bfd Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 08:56:51 +0000 Subject: [PATCH 077/130] New background option, move grouping on IDR ET Refs #10960 --- .../Indirect/IndirectConvertToEnergy.h | 5 - .../Indirect/IndirectConvertToEnergy.ui | 384 +++++++++++------- .../src/Indirect/IndirectConvertToEnergy.cpp | 72 +--- 3 files changed, 251 insertions(+), 210 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h index 7775b123b27d..55e065000367 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.h @@ -53,8 +53,6 @@ namespace CustomInterfaces void algorithmComplete(bool error); void setInstrumentDefault(); ///< Sets default parameters for current instrument void mappingOptionSelected(const QString& groupType); ///< change ui to display appropriate options - void backgroundClicked(); ///< handles showing and hiding m_backgroundDialog - void backgroundRemoval(); ///< handles data from BG void plotRaw(); ///< plot raw data from instrument void pbRunEditing(); //< Called when a user starts to type / edit the runs to load. void pbRunFinding(); //< Called when the FileFinder starts finding the files. @@ -64,9 +62,6 @@ namespace CustomInterfaces private: Ui::IndirectConvertToEnergy m_uiForm; - Background *m_backgroundDialog; ///< background removal dialog - bool m_bgRemoval; ///< whether user has set values for BG removal - QString createMapFile(const QString& groupType); ///< create the mapping file with which to group results std::vector getSaveFormats(); ///< get a vector of save formats diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui index febb43048cad..c5be848f4b93 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectConvertToEnergy.ui @@ -6,8 +6,8 @@ 0 0 - 601 - 532 + 611 + 629 @@ -103,145 +103,8 @@ - - - - 6 - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - Grouping - - - cbMappingOptions - - - - - - - Select type of detector grouping to apply. - - - - Default - - - - - Individual - - - - - Groups - - - - - All - - - - - File - - - - - - - - 0 - - - 2 - - - - - - - - 0 - 41 - - - - false - - - - - - false - - - - - - - .map - - - - - - - - - - - - Number of Groups: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - Remove a range of background value. - - - Background Removal - - - @@ -270,6 +133,75 @@ + + + + Background Removal (ToF) + + + + + + Background Removal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Start: + + + + + + + false + + + uS + + + 999999 + + + + + + + End: + + + + + + + false + + + uS + + + 999999 + + + + + + @@ -686,6 +618,135 @@ + + + + Detector Grouping + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Mode: + + + cbGroupingOptions + + + + + + + Select type of detector grouping to apply. + + + + Default + + + + + Individual + + + + + Groups + + + + + All + + + + + File + + + + + + + + 0 + + + 2 + + + + + + + + 0 + 41 + + + + false + + + + + + false + + + + + + + .map + + + + + + + + + + + + Number of Groups: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + @@ -777,19 +838,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -1025,5 +1073,37 @@ Later steps in the process (saving, renaming) will not be done. + + ckBackgroundRemoval + toggled(bool) + spBackgroundStart + setEnabled(bool) + + + 96 + 237 + + + 476 + 238 + + + + + ckBackgroundRemoval + toggled(bool) + spBackgroundEnd + setEnabled(bool) + + + 96 + 237 + + + 554 + 238 + + +
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp index af6a506e72ab..5db4e63274cf 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp @@ -16,8 +16,7 @@ namespace CustomInterfaces /** Constructor */ IndirectConvertToEnergy::IndirectConvertToEnergy(IndirectDataReduction * idrUI, QWidget * parent) : - IndirectDataReductionTab(idrUI, parent), - m_backgroundDialog(NULL), m_bgRemoval(false) + IndirectDataReductionTab(idrUI, parent) { m_uiForm.setupUi(parent); @@ -25,9 +24,7 @@ namespace CustomInterfaces // Update instrument information when a new instrument config is selected connect(this, SIGNAL(newInstrumentConfiguration()), this, SLOT(setInstrumentDefault())); // Shows required mapping option UI widgets when a new mapping option is selected from drop down - connect(m_uiForm.cbMappingOptions, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(mappingOptionSelected(const QString&))); - // Shows background removal dialog when user clicks Background Removal - connect(m_uiForm.pbBackgroundRemoval, SIGNAL(clicked()), this, SLOT(backgroundClicked())); + connect(m_uiForm.cbGroupingOptions, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(mappingOptionSelected(const QString&))); // Plots raw input data when user clicks Plot Time connect(m_uiForm.pbPlotTime, SIGNAL(clicked()), this, SLOT(plotRaw())); // Shows message on run button when user is inputting a run number @@ -46,8 +43,7 @@ namespace CustomInterfaces connect(m_uiForm.leRebinString, SIGNAL(textChanged(const QString &)), this, SLOT(validate())); // Update UI widgets to show default values - mappingOptionSelected(m_uiForm.cbMappingOptions->currentText()); - backgroundRemoval(); + mappingOptionSelected(m_uiForm.cbGroupingOptions->currentText()); // Validate to remove invalid markers validateTab(); @@ -79,7 +75,7 @@ namespace CustomInterfaces uiv.addErrorMessage("Calibration file/workspace is invalid."); // Mapping file - if((m_uiForm.cbMappingOptions->currentText() == "File") && (!m_uiForm.dsMapFile->isValid())) + if((m_uiForm.cbGroupingOptions->currentText() == "File") && (!m_uiForm.dsMapFile->isValid())) uiv.addErrorMessage("Mapping file is invalid."); // Rebinning @@ -137,12 +133,11 @@ namespace CustomInterfaces detectorRange.push_back(m_uiForm.spSpectraMax->value()); reductionAlg->setProperty("DetectorRange", detectorRange); - if(m_bgRemoval) + if(m_uiForm.ckBackgroundRemoval->isChecked()) { - QPair background = m_backgroundDialog->getRange(); std::vector backgroundRange; - backgroundRange.push_back(background.first); - backgroundRange.push_back(background.second); + backgroundRange.push_back(m_uiForm.spBackgroundStart->value()); + backgroundRange.push_back(m_uiForm.spBackgroundEnd->value()); reductionAlg->setProperty("BackgroundRange", backgroundRange); } @@ -163,9 +158,9 @@ namespace CustomInterfaces if(m_uiForm.ckScaleMultiplier->isChecked()) reductionAlg->setProperty("ScaleFactor", m_uiForm.spScaleMultiplier->value()); - if(m_uiForm.cbMappingOptions->currentText() != "Default") + if(m_uiForm.cbGroupingOptions->currentText() != "Default") { - QString grouping = createMapFile(m_uiForm.cbMappingOptions->currentText()); + QString grouping = createMapFile(m_uiForm.cbGroupingOptions->currentText()); reductionAlg->setProperty("Grouping", grouping.toStdString()); } @@ -288,56 +283,25 @@ namespace CustomInterfaces } /** - * This function runs when the user makes a selection on the cbMappingOptions QComboBox. + * This function runs when the user makes a selection on the cbGroupingOptions QComboBox. * @param groupType :: Value of selection made by user. */ void IndirectConvertToEnergy::mappingOptionSelected(const QString& groupType) { if ( groupType == "File" ) { - m_uiForm.swMapping->setCurrentIndex(0); + m_uiForm.swGrouping->setCurrentIndex(0); } else if ( groupType == "Groups" ) { - m_uiForm.swMapping->setCurrentIndex(1); + m_uiForm.swGrouping->setCurrentIndex(1); } else if ( groupType == "All" || groupType == "Individual" || groupType == "Default" ) { - m_uiForm.swMapping->setCurrentIndex(2); + m_uiForm.swGrouping->setCurrentIndex(2); } } - /** - * This function is called when the user clicks on the Background Removal button. It - * displays the Background Removal dialog, initialising it if it hasn't been already. - */ - void IndirectConvertToEnergy::backgroundClicked() - { - if(!m_backgroundDialog) - { - m_backgroundDialog = new Background(m_parentWidget); - connect(m_backgroundDialog, SIGNAL(accepted()), this, SLOT(backgroundRemoval())); - connect(m_backgroundDialog, SIGNAL(rejected()), this, SLOT(backgroundRemoval())); - } - m_backgroundDialog->show(); - } - - /** - * Slot called when m_backgroundDialog is closed. Assesses whether user desires background removal. - * Can be called before m_backgroundDialog even exists, for the purposes of setting the button to - * it's initial (default) value. - */ - void IndirectConvertToEnergy::backgroundRemoval() - { - if(m_backgroundDialog != NULL) - m_bgRemoval = m_backgroundDialog->removeBackground(); - - if(m_bgRemoval) - m_uiForm.pbBackgroundRemoval->setText("Background Removal (On)"); - else - m_uiForm.pbBackgroundRemoval->setText("Background Removal (Off)"); - } - /** * This function creates the mapping/grouping file for the data analysis. * @param groupType :: Type of grouping (All, Group, Indiviual) @@ -454,16 +418,18 @@ namespace CustomInterfaces BatchAlgorithmRunner::AlgorithmRuntimeProps inputFromLoad; inputFromLoad["InputWorkspace"] = name; - if(m_bgRemoval) + if(m_uiForm.ckBackgroundRemoval->isChecked()) { - QPair range = m_backgroundDialog->getRange(); + std::vector range; + range.push_back(m_uiForm.spBackgroundStart->value()); + range.push_back(m_uiForm.spBackgroundEnd->value()); IAlgorithm_sptr calcBackAlg = AlgorithmManager::Instance().create("CalculateFlatBackground"); calcBackAlg->initialize(); calcBackAlg->setProperty("OutputWorkspace", name + "_bg"); calcBackAlg->setProperty("Mode", "Mean"); - calcBackAlg->setProperty("StartX", range.first); - calcBackAlg->setProperty("EndX", range.second); + calcBackAlg->setProperty("StartX", range[0]); + calcBackAlg->setProperty("EndX", range[1]); m_batchAlgoRunner->addAlgorithm(calcBackAlg, inputFromLoad); BatchAlgorithmRunner::AlgorithmRuntimeProps inputFromCalcBG; From 725fdc48b8fd17557d38dbd0dfca15100c1ab25c Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 09:10:41 +0000 Subject: [PATCH 078/130] Make plot raw use spectra ranges from ET tab Refs #10960 --- .../src/Indirect/IndirectConvertToEnergy.cpp | 33 ++++++------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp index 5db4e63274cf..4dc803fcd85e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectConvertToEnergy.cpp @@ -33,8 +33,6 @@ namespace CustomInterfaces connect(m_uiForm.dsRunFiles, SIGNAL(findingFiles()), this, SLOT(pbRunFinding())); // Reverts run button back to normal when file finding has finished connect(m_uiForm.dsRunFiles, SIGNAL(fileFindingFinished()), this, SLOT(pbRunFinished())); - // Handle algorithm completion - connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); // Re-validate when certain inputs are changed connect(m_uiForm.spRebinLow, SIGNAL(valueChanged(double)), this, SLOT(validate())); @@ -184,6 +182,9 @@ namespace CustomInterfaces } m_batchAlgoRunner->addAlgorithm(reductionAlg); + + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(plotRawComplete(bool))); m_batchAlgoRunner->executeBatchAsync(); } @@ -197,6 +198,8 @@ namespace CustomInterfaces */ void IndirectConvertToEnergy::algorithmComplete(bool error) { + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); + if(error) return; @@ -382,26 +385,9 @@ namespace CustomInterfaces return; } - bool ok; - QString spectraRange = QInputDialog::getText(0, "Insert Spectra Ranges", "Range: ", QLineEdit::Normal, m_uiForm.spSpectraMin->text() +"-"+ m_uiForm.spSpectraMax->text(), &ok); - - if(!ok || spectraRange.isEmpty()) - return; - - QStringList specList = spectraRange.split("-"); - if(specList.size() != 2) - { - emit showMessageBox("Invalid input. Must be of form -"); - return; - } - std::vector detectorRange; - detectorRange.push_back(specList[0].toInt()); - - if(specList.size() == 1) - detectorRange.push_back(specList[0].toInt() + 1); - else - detectorRange.push_back(specList[1].toInt() + 1); + detectorRange.push_back(m_uiForm.spSpectraMin->value()); + detectorRange.push_back(m_uiForm.spSpectraMax->value()); QString rawFile = m_uiForm.dsRunFiles->getFirstFilename(); QFileInfo rawFileInfo(rawFile); @@ -411,8 +397,8 @@ namespace CustomInterfaces loadAlg->initialize(); loadAlg->setProperty("Filename", rawFile.toStdString()); loadAlg->setProperty("OutputWorkspace", name); - loadAlg->setProperty("SpectrumMin", specList[0].toStdString()); - loadAlg->setProperty("SpectrumMax", specList[1].toStdString()); + loadAlg->setProperty("SpectrumMin", detectorRange[0]); + loadAlg->setProperty("SpectrumMax", detectorRange[1]); m_batchAlgoRunner->addAlgorithm(loadAlg); BatchAlgorithmRunner::AlgorithmRuntimeProps inputFromLoad; @@ -456,6 +442,7 @@ namespace CustomInterfaces m_batchAlgoRunner->addAlgorithm(rawGroupAlg, inputFromLoad); } + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(plotRawComplete(bool))); m_batchAlgoRunner->executeBatchAsync(); } From 8d5851427145246d575e2469ec0f83e403e76a04 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 09:25:01 +0000 Subject: [PATCH 079/130] Small change to IDA Apply Corr Refs #10960 --- .../Indirect/ApplyCorr.ui | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui index 1d98b6799c64..a5646f2b65a1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui @@ -7,7 +7,7 @@ 0 0 420 - 418 + 420 @@ -166,14 +166,31 @@ - - - false - - - 999.990000000000009 - - + + + + + false + + + 999.990000000000009 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + From c81a4bc639f8224c17f8284d99e1168a93ad0816 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 15:18:23 +0000 Subject: [PATCH 080/130] Handle all DoS types, handle plotting Refs #10298 --- .../CustomInterfaces/src/DensityOfStates.cpp | 73 +++++++++++++++---- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp index 1a92068d1c4e..12122ea727af 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp @@ -42,11 +42,18 @@ namespace MantidQt { UserInputValidator uiv; + // Ensure there are ions selected when using DensityOfStates sectrum with .phonon file + QString filename = m_uiForm.mwInputFile->getFirstFilename(); + QFileInfo fileInfo(filename); + bool canDoPartialDoS = fileInfo.suffix() == "phonon"; + QString specType = m_uiForm.cbSpectrumType->currentText(); auto items = m_uiForm.lwIons->selectedItems(); - if(specType == "DensityOfStates" && items.size() < 1) + + if(specType == "DensityOfStates" && canDoPartialDoS && items.size() < 1) uiv.addErrorMessage("Must select at least one ion for DensityOfStates."); + // Give error message when there are errors if(!uiv.isAllInputValid()) emit showMessageBox(uiv.generateErrorMessage()); @@ -64,9 +71,10 @@ namespace MantidQt QString filename = m_uiForm.mwInputFile->getFirstFilename(); QFileInfo inputFileInfo(filename); - m_outputWsName = inputFileInfo.baseName(); QString specType = m_uiForm.cbSpectrumType->currentText(); + m_outputWsName = inputFileInfo.baseName() + "_" + specType; + // Set common properties dosAlgo->setProperty("File", filename.toStdString()); dosAlgo->setProperty("OutputWorkspace", m_outputWsName.toStdString()); @@ -121,7 +129,8 @@ namespace MantidQt m_batchAlgoRunner->addAlgorithm(dosAlgo); - disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); + //TODO: Saving + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); m_batchAlgoRunner->executeBatchAsync(); } @@ -134,10 +143,19 @@ namespace MantidQt */ void DensityOfStates::dosAlgoComplete(bool error) { + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); + if(error) return; - //TODO: plotting/saving + // Handle spectra plotting + if(m_uiForm.ckPlot->isChecked()) + { + QString pyInput = "from mantidplot import plotSpectrum, plot2D\n" + "plotSpectrum('" + m_outputWsName + "', 0)\n"; + + runPythonCode(pyInput); + } } @@ -148,17 +166,38 @@ namespace MantidQt { QString filename = m_uiForm.mwInputFile->getFirstFilename(); - IAlgorithm_sptr ionTableAlgo = AlgorithmManager::Instance().create("DensityOfStates"); - ionTableAlgo->initialize(); - ionTableAlgo->setProperty("File", filename.toStdString()); - ionTableAlgo->setProperty("SpectrumType", "IonTable"); - ionTableAlgo->setProperty("OutputWorkspace", "__dos_ions"); + // Check if we have a .phonon file + QFileInfo fileInfo(filename); + bool canDoPartialDoS = fileInfo.suffix() == "phonon"; - m_batchAlgoRunner->addAlgorithm(ionTableAlgo); + // Need a .phonon file for ion contributions + if(canDoPartialDoS) + { + // Load the ion table to populate the list of ions + IAlgorithm_sptr ionTableAlgo = AlgorithmManager::Instance().create("DensityOfStates"); + ionTableAlgo->initialize(); + ionTableAlgo->setProperty("File", filename.toStdString()); + ionTableAlgo->setProperty("SpectrumType", "IonTable"); + ionTableAlgo->setProperty("OutputWorkspace", "__dos_ions"); - disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); - connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); - m_batchAlgoRunner->executeBatchAsync(); + m_batchAlgoRunner->addAlgorithm(ionTableAlgo); + + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); + m_batchAlgoRunner->executeBatchAsync(); + } + else + { + m_uiForm.lwIons->clear(); + m_uiForm.ckSumContributions->setChecked(false); + m_uiForm.ckCrossSectionScale->setChecked(false); + } + + // Enable partial DOS related optons when they can be used + m_uiForm.lwIons->setEnabled(canDoPartialDoS); + m_uiForm.pbSelectAllIons->setEnabled(canDoPartialDoS); + m_uiForm.pbDeselectAllIons->setEnabled(canDoPartialDoS); + m_uiForm.ckSumContributions->setEnabled(canDoPartialDoS); + m_uiForm.ckCrossSectionScale->setEnabled(canDoPartialDoS); } @@ -170,20 +209,28 @@ namespace MantidQt */ void DensityOfStates::ionLoadComplete(bool error) { + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); + if(error) g_log.error("Could not get a list of ions from .phonon file"); + // Get the list of ions from algorithm ITableWorkspace_sptr ionTable = AnalysisDataService::Instance().retrieveWS("__dos_ions"); Column_sptr ionColumn = ionTable->getColumn("Ion"); size_t numIons = ionColumn->size(); + // Remove old ions m_uiForm.lwIons->clear(); + // Add ions to list for(size_t ion = 0; ion < numIons; ion++) { const std::string ionName = ionColumn->cell(ion); m_uiForm.lwIons->addItem(QString::fromStdString(ionName)); } + + // Select all ions by default + m_uiForm.lwIons->selectAll(); } From 03e144cfad1593a4f0e0eda3206c7474845fd530 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 15:40:29 +0000 Subject: [PATCH 081/130] Support saving result to default save directory Refs #10298 --- .../CustomInterfaces/src/DensityOfStates.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp index 12122ea727af..7ba56cf3dad4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DensityOfStates.cpp @@ -6,6 +6,7 @@ #include using namespace Mantid::API; +using MantidQt::API::BatchAlgorithmRunner; namespace { @@ -129,7 +130,19 @@ namespace MantidQt m_batchAlgoRunner->addAlgorithm(dosAlgo); - //TODO: Saving + // Setup save algorithm if needed + if(m_uiForm.ckSave->isChecked()) + { + BatchAlgorithmRunner::AlgorithmRuntimeProps saveProps; + saveProps["InputWorkspace"] = m_outputWsName.toStdString(); + + QString filename = m_outputWsName + ".nxs"; + + IAlgorithm_sptr saveAlgo = AlgorithmManager::Instance().create("SaveNexusProcessed"); + saveAlgo->setProperty("Filename", filename.toStdString()); + + m_batchAlgoRunner->addAlgorithm(saveAlgo, saveProps); + } connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); m_batchAlgoRunner->executeBatchAsync(); From 9c9df1ccc4abb80aa6c1644a66b071b15b06a121 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 16:11:36 +0000 Subject: [PATCH 082/130] Update docs for changed widget names Refs #10960 --- .../Indirect/CalcCorr.ui | 2 +- .../Indirect/IndirectDataReduction.ui | 30 +++++++++---------- .../interfaces/Indirect_DataAnalysis.rst | 10 +++---- .../interfaces/Indirect_DataReduction.rst | 8 ++--- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui index 2c0d0d831553..40e32a150044 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui @@ -211,7 +211,7 @@ 0 - + 0 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui index a6027699db02..b06ef0ed8c1b 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataReduction.ui @@ -7,7 +7,7 @@ 0 0 700 - 500 + 600 @@ -89,8 +89,8 @@ 0 0 - 656 - 346 + 100 + 100 @@ -113,8 +113,8 @@ 0 0 - 96 - 26 + 100 + 100 @@ -137,8 +137,8 @@ 0 0 - 96 - 26 + 100 + 100 @@ -161,8 +161,8 @@ 0 0 - 96 - 26 + 100 + 100 @@ -185,8 +185,8 @@ 0 0 - 96 - 26 + 100 + 100 @@ -209,8 +209,8 @@ 0 0 - 96 - 26 + 100 + 100 @@ -233,8 +233,8 @@ 0 0 - 96 - 26 + 100 + 100 diff --git a/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst b/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst index ac3ce18e6e8e..2b86b909ba4e 100644 --- a/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst +++ b/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst @@ -341,7 +341,7 @@ Conv Fit -------- .. interface:: Data Analysis - :widget: tabConFit + :widget: tabConvFit Similarly to FuryFit, ConvFit provides a simplified interface for controlling various fitting functions (see the :ref:`Fit ` algorithm for more @@ -509,7 +509,7 @@ Calculate Corrections .. warning:: This interface is only available on Windows .. interface:: Data Analysis - :widget: tabAbsF2P + :widget: tabCalcCorr Calculates absorption corrections that could be applied to the data when given information about the sample (and optionally can) geometry. @@ -554,7 +554,7 @@ Flat #### .. interface:: Data Analysis - :widget: absp_pageFlat + :widget: pageFlat Thickness Thickness of sample (cm). @@ -572,7 +572,7 @@ Cylinder ######## .. interface:: Data Analysis - :widget: absp_pageCylinder + :widget: pageCylinder Radius 1 Sample radius 1 (cm). @@ -623,7 +623,7 @@ Apply Corrections ----------------- .. interface:: Data Analysis - :widget: tabApplyAbsorptionCorrections + :widget: tabApplyCorr The Apply Corrections tab applies the corrections calculated in the Calculate Corrections tab of the Indirect Data Analysis interface. diff --git a/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst b/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst index 26fd55d28313..dc077b5823af 100644 --- a/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst +++ b/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst @@ -153,7 +153,7 @@ Single ###### .. interface:: Data Reduction - :widget: pageRebinSingle + :widget: pgSingleRebin In this mode only a single binning range is defined as a range and width. @@ -161,7 +161,7 @@ Multiple ######## .. interface:: Data Reduction - :widget: pageRebinString + :widget: pgMultipleRebin In this mode multiple binning ranges can be defined using he rebin string syntax used by the :ref:`Rebin ` algorithm. @@ -237,7 +237,7 @@ Diagnostics ----------- .. interface:: Data Reduction - :widget: tabTimeSlice + :widget: tabDiagnostics This tab allows you to perform an integration on a raw file over a specified time of flight range, and is equivalent to the Slice functionality found in @@ -318,7 +318,7 @@ Symmetrise ---------- .. interface:: Data Reduction - :widget: tabSymmetrise + :widget: tabSymmertrise This tab allows you to take an asymmetric reduced file and symmetrise it about the Y axis. From 60972d78af7eb3661d16096d6c9cca6c33350a2e Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 16:20:15 +0000 Subject: [PATCH 083/130] Put CMakeLists back into alphabetical order Refs #10960 --- .../MantidQt/CustomInterfaces/CMakeLists.txt | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt index 3df927aabfdc..ed4dfcd6ea51 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt @@ -1,13 +1,13 @@ set ( SRC_FILES + src/DataComparison.cpp + src/DirectConvertToEnergy.cpp + src/Homer.cpp src/Indirect/ApplyCorr.cpp src/Indirect/CalcCorr.cpp src/Indirect/ConvFit.cpp - src/DataComparison.cpp - src/DirectConvertToEnergy.cpp src/Indirect/Elwin.cpp src/Indirect/Fury.cpp src/Indirect/FuryFit.cpp - src/Homer.cpp src/Indirect/IDATab.cpp src/Indirect/IndirectBayes.cpp src/Indirect/IndirectBayesTab.cpp @@ -33,6 +33,9 @@ set ( SRC_FILES src/Indirect/IndirectTransmissionCalc.cpp src/Indirect/JumpFit.cpp src/Indirect/MSDFit.cpp + src/Indirect/Quasi.cpp + src/Indirect/ResNorm.cpp + src/Indirect/Stretch.cpp src/MantidEV.cpp src/MantidEVWorker.cpp src/MultiDatasetFit.cpp @@ -55,19 +58,16 @@ set ( SRC_FILES src/QReflTableModel.cpp src/QtReflMainView.cpp src/QtReflOptionsDialog.cpp - src/Indirect/Quasi.cpp src/ReflCatalogSearcher.cpp src/ReflLegacyTransferStrategy.cpp src/ReflMainViewPresenter.cpp src/ReflSearchModel.cpp - src/Indirect/ResNorm.cpp src/SANSAddFiles.cpp src/SANSDiagnostics.cpp src/SANSEventSlicing.cpp src/SANSPlotSpecial.cpp src/SANSRunWindow.cpp src/StepScan.cpp - src/Indirect/Stretch.cpp src/UserInputValidator.cpp src/background.cpp src/deltaECalc.cpp @@ -75,18 +75,18 @@ set ( SRC_FILES # Include files aren't required, but this makes them appear in Visual Studio set ( INC_FILES - inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h inc/MantidQtCustomInterfaces/Background.h - inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h - inc/MantidQtCustomInterfaces/Indirect/ConvFit.h inc/MantidQtCustomInterfaces/DataComparison.h inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h inc/MantidQtCustomInterfaces/DllConfig.h + inc/MantidQtCustomInterfaces/Homer.h + inc/MantidQtCustomInterfaces/Indirect/IDATab.h + inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h + inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h + inc/MantidQtCustomInterfaces/Indirect/ConvFit.h inc/MantidQtCustomInterfaces/Indirect/Elwin.h inc/MantidQtCustomInterfaces/Indirect/Fury.h inc/MantidQtCustomInterfaces/Indirect/FuryFit.h - inc/MantidQtCustomInterfaces/Homer.h - inc/MantidQtCustomInterfaces/Indirect/IDATab.h inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.h inc/MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h @@ -109,10 +109,13 @@ set ( INC_FILES inc/MantidQtCustomInterfaces/Indirect/IndirectTools.h inc/MantidQtCustomInterfaces/Indirect/IndirectToolsTab.h inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h - inc/MantidQtCustomInterfaces/IReflPresenter.h - inc/MantidQtCustomInterfaces/IReflSearcher.h inc/MantidQtCustomInterfaces/Indirect/JumpFit.h inc/MantidQtCustomInterfaces/Indirect/MSDFit.h + inc/MantidQtCustomInterfaces/Indirect/Quasi.h + inc/MantidQtCustomInterfaces/Indirect/ResNorm.h + inc/MantidQtCustomInterfaces/Indirect/Stretch.h + inc/MantidQtCustomInterfaces/IReflPresenter.h + inc/MantidQtCustomInterfaces/IReflSearcher.h inc/MantidQtCustomInterfaces/MantidEV.h inc/MantidQtCustomInterfaces/MantidEVWorker.h inc/MantidQtCustomInterfaces/MultiDatasetFit.h @@ -146,15 +149,12 @@ set ( INC_FILES inc/MantidQtCustomInterfaces/QReflTableModel.h inc/MantidQtCustomInterfaces/QtReflMainView.h inc/MantidQtCustomInterfaces/QtReflOptionsDialog.h - inc/MantidQtCustomInterfaces/Indirect/Quasi.h - inc/MantidQtCustomInterfaces/Indirect/ResNorm.h inc/MantidQtCustomInterfaces/SANSAddFiles.h inc/MantidQtCustomInterfaces/SANSDiagnostics.h inc/MantidQtCustomInterfaces/SANSEventSlicing.h inc/MantidQtCustomInterfaces/SANSPlotSpecial.h inc/MantidQtCustomInterfaces/SANSRunWindow.h inc/MantidQtCustomInterfaces/StepScan.h - inc/MantidQtCustomInterfaces/Indirect/Stretch.h inc/MantidQtCustomInterfaces/Updateable.h inc/MantidQtCustomInterfaces/UserInputValidator.h inc/MantidQtCustomInterfaces/deltaECalc.h @@ -163,16 +163,16 @@ set ( INC_FILES set ( SRC_UNITY_IGNORE_FILES ) set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h + inc/MantidQtCustomInterfaces/DataComparison.h + inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h + inc/MantidQtCustomInterfaces/Homer.h + inc/MantidQtCustomInterfaces/Indirect/IDATab.h inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h inc/MantidQtCustomInterfaces/Indirect/ConvFit.h - inc/MantidQtCustomInterfaces/DataComparison.h - inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h inc/MantidQtCustomInterfaces/Indirect/Elwin.h inc/MantidQtCustomInterfaces/Indirect/Fury.h inc/MantidQtCustomInterfaces/Indirect/FuryFit.h - inc/MantidQtCustomInterfaces/Homer.h - inc/MantidQtCustomInterfaces/Indirect/IDATab.h inc/MantidQtCustomInterfaces/Indirect/IndirectBayes.h inc/MantidQtCustomInterfaces/Indirect/IndirectBayesTab.h inc/MantidQtCustomInterfaces/Indirect/IndirectCalibration.h @@ -197,6 +197,9 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h inc/MantidQtCustomInterfaces/Indirect/JumpFit.h inc/MantidQtCustomInterfaces/Indirect/MSDFit.h + inc/MantidQtCustomInterfaces/Indirect/Quasi.h + inc/MantidQtCustomInterfaces/Indirect/ResNorm.h + inc/MantidQtCustomInterfaces/Indirect/Stretch.h inc/MantidQtCustomInterfaces/MultiDatasetFit.h inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingPresenter.h inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h @@ -217,14 +220,11 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h inc/MantidQtCustomInterfaces/QReflTableModel.h inc/MantidQtCustomInterfaces/QtReflMainView.h inc/MantidQtCustomInterfaces/QtReflOptionsDialog.h - inc/MantidQtCustomInterfaces/Indirect/Quasi.h - inc/MantidQtCustomInterfaces/Indirect/ResNorm.h inc/MantidQtCustomInterfaces/SANSAddFiles.h inc/MantidQtCustomInterfaces/SANSPlotSpecial.h inc/MantidQtCustomInterfaces/SANSRunWindow.h inc/MantidQtCustomInterfaces/SANSEventSlicing.h inc/MantidQtCustomInterfaces/SANSDiagnostics.h - inc/MantidQtCustomInterfaces/Indirect/Stretch.h inc/MantidQtCustomInterfaces/MantidEV.h inc/MantidQtCustomInterfaces/StepScan.h ) From 99c0a1f7026b88702761a338c1a8d83a6c95fcb6 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 16:30:21 +0000 Subject: [PATCH 084/130] Minor update for Plot Time button Refs #10960 --- Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst b/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst index dc077b5823af..c4a8c609315a 100644 --- a/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst +++ b/Code/Mantid/docs/source/interfaces/Indirect_DataReduction.rst @@ -84,8 +84,8 @@ Background Removal Allows removal of a background given a time-of-flight range. Plot Time - Can be used to create a time plot of a specific spectra range (or single - spectrum). + When clicked create a time plot of the spectra range defined in the Spectra + Min and Spectra Max selectors. Detailed Balance Gives the option to perform an exponential correction on the data once it has From c6ac4476c2ee2f2f952925eb5cf9cb65b75329d4 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 28 Jan 2015 16:52:35 +0000 Subject: [PATCH 085/130] Add documentation for DensityOfStates tab Refs #10298 --- .../source/interfaces/Indirect_Simulation.rst | 77 ++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst b/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst index e7b0c148c2e3..78a12fd0e905 100644 --- a/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst +++ b/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst @@ -70,8 +70,8 @@ Sassena .. interface:: Simulation :widget: sassena -The Indirect Sassena interface is used to load simulations from the Sassena -software. +The Sassena interface is used to load simulations from the Sassena software. +This is done through the :ref:`LoadSassena ` algorithm. Options ~~~~~~~ @@ -93,4 +93,77 @@ Save Result If checked will save the loaded data as a NeXus file in the default save directory. +DensityOfStates +--------------- + +.. interface:: Simulation + :widget: dos + +The DensityOfStates interface is used to load CASTEP simulations using the +:ref:`DensityOfStates ` algorithm. It supports loading +full and partial densities of states, raman and IR spectroscopy. + +Options +~~~~~~~ + +The following options are common to each spectrun type: + +Spectrum Type + Selects the type of spectrum to extract from the file. + +Peak Shape + Selects the shape of peaks to fit over the intensities extracted from the + file. + +Peak Width + Sets the FWHM to which the fitted peaks should be broadened. + +Bin Width + Sets the histogram resolution for binning. + +Zero Threshold + Frequencies below this threshold will be ignored. + +Scale + Optionally apply scaling by a given fatcor to the output spectra. + +DensityOfStates +~~~~~~~~~~~~~~~ + +.. interface:: Simulation + :widget: pgDOS + +When loading a partial density of states (from a *.phonon* file) the following +additional options are available (note that they will be disabled when using a +*.castep* file): + +Ion List + Lists all the ions in a given file, individual ions can then be selected to be + included in a partial density of states. + +(De)Select All + Provides a quick method of selecting or deselecting all ions in the current + file. + +Sum Ion Contributions + If selected the contirbutions of each selected ion will be summed into a + single :ref:`MatrixWorkspace`, otherwise a :ref:`WorkspaceGroup` with a + :ref:`MatrixWorkspace` for each ion will be produced. + +Scale by cross sections + If selected the contribution for each ion will be multiplied by the given + scattering cross section. + +Raman +~~~~~ + +.. interface:: Simulation + :widget: pgRaman + +When loading a raman spectroscopy spectra the following additional options can +be used: + +Temperature + Temperature to use in Kelvin. + .. categories:: Interfaces Indirect From 58103f20c1cc541389b06345316c2be00e0b4cbc Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Wed, 28 Jan 2015 19:33:07 +0000 Subject: [PATCH 086/130] Re #10958 Separated sum_runs and sample_run This allows better separation of cases when runs are summed or considered one-by one --- .../Inelastic/Direct/NonIDF_Properties.py | 4 +- .../Inelastic/Direct/PropertiesDescriptors.py | 151 ++++++ .../scripts/Inelastic/Direct/RunDescriptor.py | 446 +++++++++--------- Code/Mantid/scripts/test/RunDescriptorTest.py | 16 +- 4 files changed, 387 insertions(+), 230 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py b/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py index af9f2faa01ca..8ce4780f711a 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py +++ b/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py @@ -48,7 +48,7 @@ def __init__(self,Instrument,run_workspace=None): # set up descriptors holder class reference RunDescriptor._holder = self RunDescriptor._logger = self.log - # Initiate class-level properties to defaults + # Initiate class-level properties to defaults (Each constructor clears class-level properties?) super(NonIDF_Properties,self).__setattr__('sample_run',None) super(NonIDF_Properties,self).__setattr__('wb_run',None) super(NonIDF_Properties,self).__setattr__('monovan_run',None) @@ -85,6 +85,8 @@ def __init__(self,Instrument,run_workspace=None): second_white = RunDescriptor("Second white beam currently unused in the workflow despite being referred to in Diagnostics. Should it be used for Monovan Diagnostics?") # _tmp_run = RunDescriptor("_TMP","Property used for storing intermediate run data during reduction") + # property responsible for summing runs + sum_runs = SumRuns(sample_run) #----------------------------------------------------------------------------------- def getDefaultParameterValue(self,par_name): """ method to get default parameter value, specified in IDF """ diff --git a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py index e7d187442200..e7c01df2fbc9 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py +++ b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py @@ -25,7 +25,158 @@ def dependencies(self): #----------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------- +#----------------------------------------------------------------------------------------- +class SumRuns(PropDescriptor): + """ Boolean property specifies if list of files provided as input for sample_run property + should be summed. + + It also specifies various auxiliary operations, defined for summing runs, so property + is deeply entangled with the sample_run property + """ + def __init__(self,sample_run_prop): + # internal reference to sample run property + self._sample_run = sample_run_prop + # class containing this property + self._holder = None + # + self._last_ind2sum = -1 + self._sum_runs = False + self._run_numbers =[] + self._file_guess =[] + self._fext =[] + + + # + def __get__(self,instance,holder_class): + if not self._holder: + self._holder = holder_class + + if instance is None: + return self + return self._sum_runs + # + def __set__(self,instance,value): + if not self._holder: + from PropertyManager import PropertyManager + self._holder = PropertyManager + + old_value = self._sum_runs + if isinstance(value,bool): + self._sum_runs = value + self._last_ind2sum = -1 + elif isinstance(value,int): + if value>0: + self._last_ind2sum = int(value)-1 + self._sum_runs = True + else: + self._last_ind2sum = -1 + self._sum_runs = False + else: + self._sum_runs = bool(value) + self._last_ind2sum = -1 + # + if old_value != self._sum_runs: + if len(self._run_numbers) > 0 and self._sum_runs: + # clear previous state of sample_run + ind = self.get_last_ind2sum() + self._sample_run.__set__(None,self._run_numbers[ind]) + # + def set_list2add(self,runs_to_add,fnames=None,fext=None): + """ Set run numbers to add together with possible file guess-es """ + if not isinstance(runs_to_add,list): + raise KeyError('Can only set list of run numbers to add') + runs = [] + for item in runs_to_add: + runs.append(int(item)) + self._run_numbers =runs + if fnames: + self._file_guess = fnames + if len(self._file_guess) != len(self._run_numbers): + self._file_guess = ['']*len(self._run_numbers) + + if fext: + self._fext = fext + if len(self._fext) != len(self._run_numbers): + self._fext = ['']*len(self._run_numbers) + # + def clear_sum(self): + """ clear all defined summation""" + # if last_to_sum is -1, sum all run list provided + self._last_ind2sum = -1 + self._sum_runs = False + self._run_numbers =[] + self._file_guess =[] + self._fext =[] + # + def get_last_ind2sum(self): + """ get last run number contributing to sum""" + if self._last_ind2sum > 0: + return self._last_ind2sum + else: + return len(self._run_numbers)-1 + # + def set_last_ind2sum(self,run_number): + """ check and set last number, contributing to summation + if this number is out of summation range, clear the summation + """ + run_number =int(run_number) + if run_number in self._run_numbers: + self._last_ind2sum = self._run_numbers.index(run_number) + else: + self.clear_sum() + # + def load_and_sum_runs(self,inst_name,monitors_with_ws): + + logger = lambda mess : (getattr(getattr(self,'_holder'),'log')(self._sample_run._holder,mess)) + logger("*** Summing multiple runs ****") + + num_to_load = len(self._run_numbers) + if self._last_ind2sum > 0 and self._last_ind2sum0: - self._run_ext = main_fext - else: - self._run_ext = None - - + main_fext = fext.lower() + self._run_number = int(run_num) + if instance.sum_runs: + RunDescriptor._PropMan.sum_runs.set_last_ind2sum(self._run_number) + + # + if len(main_fext) > 0: + self._run_ext = main_fext + else: # will be default file extension + self._run_ext = None + clear_fext = False elif isinstance(value,list): - if isinstance(instance.sum_runs,bool) and instance.sum_runs: - self._run_number = value[0] - self._runs_to_add=([""]*len(value),value,[""]*len(value)) - clear_add_list = False - elif(isinstance(instance.sum_runs,int) and instance.sum_runs>0): - num_2sum = instance.sum_runs - if num_2sum > len(value): - raise ValueError("Requested to sum {0} runs but provided the list of only {1} runs".format(num_2sum,len(value))) - sublist = value[0:num_2sum] - - self._run_number = value[0] - self._runs_to_add=([""]*num_2sum,sublist,[""]*num_2sum) - clear_add_list = False + self._bind_with_sum = True + RunDescriptor._PropMan.sum_runs.set_list2add(value) + if instance.sum_runs: + last_run_ind = RunDescriptor._PropMan.sum_runs.get_last_ind2sum() + self._run_number = value[last_run_ind] else: self._run_number = value[0] - clear_add_list = True - + clear_fext = True else: self._run_number = int(value) + clear_fext = True + if instance and instance.sum_runs: + RunDescriptor._PropMan.sum_runs.set_last_ind2sum(self._run_number) + - self._ws_cname = '' + self._ws_cname = '' self._ws_name = None - self._clear_old_ws(old_ws_name,None,clear_add_list) -#-------------------------------------------------------------------------------------------------------------------- + self._clear_old_ws(old_ws_name,None,clear_fext) +#-------------------------------------------------------------------------------------------------------------------- def run_number(self): """ Return run number regardless of workspace is loaded or not""" if self._ws_name and self._ws_name in mtd: @@ -124,17 +139,17 @@ def run_number(self): return ws.getRunNumber() else: return self._run_number -#-------------------------------------------------------------------------------------------------------------------- +#-------------------------------------------------------------------------------------------------------------------- def is_monws_separate(self): """ """ mon_ws = self.get_monitors_ws() - name = mon_ws.name() + name = mon_ws.name() if name.endswith('_monitors'): return True else: return False -#-------------------------------------------------------------------------------------------------------------------- +#-------------------------------------------------------------------------------------------------------------------- def set_action_suffix(self,suffix=None): """ method to set part of the workspace name, which indicate some action performed over this workspace @@ -153,7 +168,7 @@ def set_action_suffix(self,suffix=None): if suffix: self._ws_suffix = suffix else: # return to default - self._ws_suffix='' + self._ws_suffix = '' return self._build_ws_name() #-------------------------------------------------------------------------------------------------------------------- def synchronize_ws(self,workspace=None): @@ -166,7 +181,7 @@ def synchronize_ws(self,workspace=None): outside of a method visibility """ if not workspace: - workspace=mtd[self._ws_name] + workspace = mtd[self._ws_name] new_name = self._build_ws_name() old_name = workspace.name() @@ -175,14 +190,14 @@ def synchronize_ws(self,workspace=None): DeleteWorkspace(new_name) RenameWorkspace(InputWorkspace=old_name,OutputWorkspace=new_name) - old_mon_name = old_name+'_monitors' - new_mon_name = new_name+'_monitors' + old_mon_name = old_name + '_monitors' + new_mon_name = new_name + '_monitors' if new_mon_name in mtd: DeleteWorkspace(new_mon_name) if old_mon_name in mtd: RenameWorkspace(InputWorkspace=old_mon_name,OutputWorkspace=new_mon_name) self._ws_name = new_name -#-------------------------------------------------------------------------------------------------------------------- +#-------------------------------------------------------------------------------------------------------------------- def get_file_ext(self): """ Method returns current file extension for file to load workspace from e.g. .raw or .nxs extension @@ -202,67 +217,6 @@ def set_file_ext(self,val): self._run_ext = value else: raise AttributeError('Source file extension can be only a string') - - def file_hint(self,run_num_str=None,filePath=None,fileExt=None,**kwargs): - """ procedure to provide run file guess name from run properties - - main purpose -- to support customized order of file extensions - """ - if not run_num_str: - run_num_str = str(self.run_number()) - - - inst_name = RunDescriptor._holder.short_inst_name - if 'file_hint' in kwargs: - hint = kwargs['file_hint'] - fname,old_ext=os.path.splitext(hint) - if len(old_ext) == 0: - old_ext = self.get_file_ext() - else: - if fileExt: - old_ext = fileExt - else: - old_ext = self.get_file_ext() - - hint =inst_name + run_num_str + old_ext - if not filePath: - filePath = self._run_file_path - if os.path.exists(filePath): - hint = os.path.join(filePath,hint) - if os.path.exists(hint): - return hint,old_ext - else: - fp,hint=os.path.split(hint) - return hint,old_ext - -#-------------------------------------------------------------------------------------------------------------------- - def find_file(self,run_num = None,filePath=None,fileExt=None,**kwargs): - """Use Mantid to search for the given run. """ - - inst_name = RunDescriptor._holder.short_inst_name - if run_num: - run_num_str = str(run_num) - else: - run_num_str = str(self.run_number()) - # - file_hint,old_ext = self.file_hint(run_num_str,filePath,fileExt,**kwargs) - - try: - file = FileFinder.findRuns(file_hint)[0] - fname,fex=os.path.splitext(file) - self._run_ext = fex - if old_ext != fex: - message=' Cannot find run-file with extension {0}.\n'\ - ' Found file {1} instead'.format(old_ext,file) - RunDescriptor._logger(message,'notice') - self._run_file_path = os.path.dirname(fname) - return file - except RuntimeError: - message = 'Cannot find file matching hint {0} on current search paths ' \ - 'for instrument {1}'.format(file_hint,inst_name) - if not ('be_quet' in kwargs): - RunDescriptor._logger(message,'warning') - return 'ERROR:find_file: '+message #-------------------------------------------------------------------------------------------------------------------- @staticmethod def _check_claibration_source(): @@ -274,7 +228,7 @@ def _check_claibration_source(): else: use_workspace_calibration = True return use_workspace_calibration - +#-------------------------------------------------------------------------------------------------------------------- def get_workspace(self): """ Method returns workspace correspondent to current run number(s) and loads this workspace if it has not been loaded @@ -296,43 +250,16 @@ def get_workspace(self): else: if self._run_number: prefer_ws_calibration = self._check_claibration_source() - inst_name = RunDescriptor._holder.short_inst_name + inst_name = RunDescriptor._holder.short_inst_name calibration = RunDescriptor._holder.det_cal_file - if not self._runs_to_add: + if self._bind_with_sum and RunDescriptor._holder.sum_runs : # Sum runs + ws = RunDescriptor._PropMan.sum_runs.load_and_sum_runs(inst_name,RunDescriptor._holder.load_monitors_with_workspace) + else: # load current workspace ws = self.load_run(inst_name, calibration,False, RunDescriptor._holder.load_monitors_with_workspace,prefer_ws_calibration) - else: # Sum runs - file_guess,run_list,fext = self._runs_to_add - - RunDescriptor._logger("*** Summing multiple runs ****",'notice') - RunDescriptor._logger("*** Loading run N: {0} ".format(self._run_number),'notice') - mon_with_ws = RunDescriptor._holder.load_monitors_with_workspace - ws = self.load_run(inst_name, None,False,mon_with_ws,False,file_guess[0],fext[0]) - sum_ws_name = ws.name() - sum_mon_name = sum_ws_name+'_monitors' - - AddedRunNumbers = str(self.run_number()) - numTerms = len(run_list) - for ind,run_num in enumerate(run_list[1:]): - RunDescriptor._logger("*** Adding run N: {0} ".format(run_num),'notice') - - term_name = '{0}_ADDITIVE_#{1}/{2}'.format(inst_name,ind+2,numTerms)# - file_h = os.path.join(file_guess[ind+1],'{0}{1}{2}'.format(inst_name,run_num,fext[ind+1])) - - wsp = self.load_run(inst_name, None,False, mon_with_ws,False,file_hint=file_h,ws_name = term_name) - - wsp_name = wsp.name() - Plus(LHSWorkspace=sum_ws_name,RHSWorkspace=wsp_name,OutputWorkspace=sum_ws_name,ClearRHSWorkspace=True) - AddedRunNumbers+=',{0}'.format(run_num) - if not mon_with_ws: - Plus(LHSWorkspace=sum_mon_name,RHSWorkspace=wsp_name+'_monitors',OutputWorkspace=sum_mon_name,ClearRHSWorkspace=True) - RunDescriptor._logger("*** Summing multiple runs completed ****",'notice') - ws = mtd[sum_ws_name] - self.synchronize_ws(ws) - self.apply_calibration(ws,calibration,prefer_ws_calibration) - - AddSampleLog(Workspace=sum_ws_name,LogName = 'SumOfRuns:',LogText=AddedRunNumbers,LogType='String') + self.synchronize_ws(ws) + self.apply_calibration(ws,calibration,prefer_ws_calibration) return ws else: @@ -342,14 +269,14 @@ def get_ws_clone(self,clone_name='ws_clone'): """ Get unbounded clone of existing Run workspace """ ws = self.get_workspace() CloneWorkspace(InputWorkspace=ws,OutputWorkspace=clone_name) - mon_ws_name = self.get_ws_name()+'_monitors' + mon_ws_name = self.get_ws_name() + '_monitors' if mon_ws_name in mtd: - cl_mon_name = clone_name+'_monitors' + cl_mon_name = clone_name + '_monitors' CloneWorkspace(InputWorkspace=mon_ws_name,OutputWorkspace=cl_mon_name) return mtd[clone_name] #-------------------------------------------------------------------------------------------------------------------- - def get_monitors_ws(self,monitor_ID = None): + def get_monitors_ws(self,monitor_ID=None): """ get pointer to a workspace containing monitors. Explores different ways of finding monitor workspace in Mantid and returns the python pointer to the @@ -357,7 +284,7 @@ def get_monitors_ws(self,monitor_ID = None): """ data_ws = self.get_workspace() - monWS_name = self.get_ws_name()+'_monitors' + monWS_name = self.get_ws_name() + '_monitors' if monWS_name in mtd: mon_ws = mtd[monWS_name] monitors_separate = True @@ -365,15 +292,15 @@ def get_monitors_ws(self,monitor_ID = None): mon_ws = data_ws monitors_separate = False - spec_to_mon = RunDescriptor._holder.spectra_to_monitors_list + spec_to_mon = RunDescriptor._holder.spectra_to_monitors_list if monitors_separate and spec_to_mon : for specID in spec_to_mon: - mon_ws=self.copy_spectrum2monitors(data_ws,mon_ws,specID) + mon_ws = self.copy_spectrum2monitors(data_ws,mon_ws,specID) if monitor_ID: try: ws_index = mon_ws.getIndexFromSpectrumNumber(monitor_ID) - except: # + except: # mon_ws = None else: mon_list = self._holder.get_used_monitors_list() @@ -388,58 +315,130 @@ def get_monitors_ws(self,monitor_ID = None): def get_ws_name(self): """ return workspace name. If ws name is not defined, build it first and set up as the target ws name """ - if self._ws_name: if self._ws_name in mtd: return self._ws_name else: raise RuntimeError('Getting workspace name {0} for undefined workspace. Run get_workspace first'.format(self._ws_name)) - - self._ws_name = self._build_ws_name() return self._ws_name #-------------------------------------------------------------------------------------------------------------------- - def load_run(self,inst_name, calibration=None, force=False, load_mon_with_workspace=False,use_ws_calibration=True,\ + def file_hint(self,run_num_str=None,filePath=None,fileExt=None,**kwargs): + """ procedure to provide run file guess name from run properties + + main purpose -- to support customized order of file extensions + """ + if not run_num_str: + run_num_str = str(self.run_number()) + + + inst_name = RunDescriptor._holder.short_inst_name + if 'file_hint' in kwargs: + hint = kwargs['file_hint'] + fname,old_ext = os.path.splitext(hint) + if len(old_ext) == 0: + old_ext = self.get_file_ext() + else: + if fileExt: + old_ext = fileExt + else: + old_ext = self.get_file_ext() + + hint = inst_name + run_num_str + old_ext + if not filePath: + filePath = self._run_file_path + if os.path.exists(filePath): + hint = os.path.join(filePath,hint) + if os.path.exists(hint): + return hint,old_ext + else: + fp,hint = os.path.split(hint) + return hint,old_ext +#-------------------------------------------------------------------------------------------------------------------- + + def find_file(self,inst_name=None,run_num=None,filePath=None,fileExt=None,**kwargs): + """Use Mantid to search for the given run. """ + + if not inst_name: + inst_name = RunDescriptor._holder.short_inst_name + + if run_num: + run_num_str = str(run_num) + else: + run_num_str = str(self.run_number()) + # + file_hint,old_ext = self.file_hint(run_num_str,filePath,fileExt,**kwargs) + + try: + file = FileFinder.findRuns(file_hint)[0] + fname,fex = os.path.splitext(file) + self._run_ext = fex + if old_ext != fex: + message = ' Cannot find run-file with extension {0}.\n'\ + ' Found file {1} instead'.format(old_ext,file) + RunDescriptor._logger(message,'notice') + self._run_file_path = os.path.dirname(fname) + return file + except RuntimeError: + message = 'Cannot find file matching hint {0} on current search paths ' \ + 'for instrument {1}'.format(file_hint,inst_name) + if not ('be_quet' in kwargs): + RunDescriptor._logger(message,'warning') + return 'ERROR:find_file: ' + message +#-------------------------------------------------------------------------------------------------------------------- + + def load_file(self,inst_name,ws_name,run_number=None,load_mon_with_workspace=False,filePath=None,fileExt=None,**kwargs): + """ load run for the instrument name provided. If run_numner is None, look for the current run""" + + data_file = self.find_file(None,filePath,fileExt,**kwargs) + if data_file.find('ERROR') > -1: + self._ws_name = None + raise IOError(data_file) + + if load_mon_with_workspace: + mon_load_option = 'Include' + else: + mon_load_option = 'Separate' + # + try: # Hack: LoadEventNexus does not understand Separate at the moment and throws. + # And event loader always loads monitors separately + Load(Filename=data_file, OutputWorkspace=ws_name,LoadMonitors = mon_load_option) + except ValueError: + #mon_load_option =str(int(load_mon_with_workspace)) + Load(Filename=data_file, OutputWorkspace=ws_name,LoadMonitors = '1',MonitorsAsEvents='0') + + RunDescriptor._logger("Loaded {0}".format(data_file),'information') + + loaded_ws = mtd[ws_name] + + return loaded_ws +#-------------------------------------------------------------------------------------------------------------------- + + def load_run(self,inst_name, calibration=None, force=False, mon_load_option=False,use_ws_calibration=True,\ filePath=None,fileExt=None,**kwargs): - """Loads run into the given workspace. + """Loads run into workspace with name provided. - If force is true then the file is loaded regardless of whether its workspace exists already + If force is true then the file is loaded regardless of whether this workspace already exists """ - # If a workspace with this name exists, then assume it is to be used in place of a file + # If a workspace with this name exists, then assume it is to be used in + # place of a file if 'ws_name' in kwargs: ws_name = kwargs['ws_name'] + del kwargs['ws_name'] else: try: ws_name = self.get_ws_name() except RuntimeError: - self._ws_name=None + self._ws_name = None ws_name = self.get_ws_name() #----------------------------------- if ws_name in mtd and not(force): RunDescriptor._logger("{0} already loaded as workspace.".format(ws_name),'information') else: - # If it doesn't exists as a workspace assume we have to try and load a file - data_file = self.find_file(None,filePath,fileExt,**kwargs) - if data_file.find('ERROR')>-1: - raise IOError(data_file) - - if load_mon_with_workspace: - mon_load_option = 'Include' - else: - mon_load_option = 'Separate' - # - try: # Hack LoadEventNexus does not understand Separate at the moment and throws - Load(Filename=data_file, OutputWorkspace=ws_name,LoadMonitors = mon_load_option) - except ValueError: - #mon_load_option =str(int(load_mon_with_workspace)) - Load(Filename=data_file, OutputWorkspace=ws_name,LoadMonitors = '1') - - - RunDescriptor._logger("Loaded {0}".format(data_file),'information') - #end - - loaded_ws = mtd[ws_name] + # If it doesn't exists as a workspace assume we have to try and + # load a file + loaded_ws = self.load_file(inst_name,ws_name,None,mon_load_option,filePath,fileExt,**kwargs) ######## Now we have the workspace self.apply_calibration(loaded_ws,calibration,use_ws_calibration) return loaded_ws @@ -511,37 +510,32 @@ def copy_spectrum2monitors(data_ws,mon_ws,spectraID): # x_param = mon_ws.readX(0) - bins = [x_param[0],x_param[1]-x_param[0],x_param[-1]] + bins = [x_param[0],x_param[1] - x_param[0],x_param[-1]] ExtractSingleSpectrum(InputWorkspace=data_ws,OutputWorkspace='tmp_mon',WorkspaceIndex=ws_index) Rebin(InputWorkspace='tmp_mon',OutputWorkspace='tmp_mon',Params=bins,PreserveEvents='0') - # should be vice versa but Conjoin invalidate ws pointers and hopefully nothing could happen with workspace during conjoining + # should be vice versa but Conjoin invalidate ws pointers and hopefully + # nothing could happen with workspace during conjoining #AddSampleLog(Workspace=monWS,LogName=done_log_name,LogText=str(ws_index),LogType='Number') mon_ws_name = mon_ws.getName() ConjoinWorkspaces(InputWorkspace1=mon_ws,InputWorkspace2='tmp_mon') - mon_ws =mtd[mon_ws_name] + mon_ws = mtd[mon_ws_name] if 'tmp_mon' in mtd: DeleteWorkspace(WorkspaceName='tmp_mon') return mon_ws #-------------------------------------------------------------------------------------------------------------------- - def _sum_ext(self): - if self._runs_to_add: - sum_ext= "SumOf{0}".format(len(self._runs_to_add[1])) - else: - sum_ext = '' - return sum_ext - def _build_ws_name(self): - instr_name = self._instr_name() + instr_name = self._instr_name() - sum_ext = self._sum_ext() + sum_ext = RunDescriptor._PropMan.sum_runs.sum_ext() if self._run_number: - ws_name = '{0}{1}{2}{3:0>#6d}{4}{5}'.format(self._prop_name,instr_name,self._ws_cname,self._run_number,sum_ext,self._ws_suffix) + ws_name = '{0}{1}{2}{3:0>#6d}{4}{5}'.format(self._prop_name,instr_name,self._ws_cname,self._run_number,sum_ext,self._ws_suffix) else: ws_name = '{0}{1}{2}{3}'.format(self._prop_name,self._ws_cname,sum_ext,self._ws_suffix) return ws_name +#-------------------------------------------------------------------------------------------------------------------- @staticmethod def rremove(thestr, trailing): thelen = len(trailing) @@ -554,14 +548,14 @@ def _split_ws_name(self,ws_name): """ # Remove suffix name = self.rremove(ws_name,self._ws_suffix) - sumExt = self._sum_ext() - if len(sumExt)>0: + sumExt = RunDescriptor._PropMan.sum_runs.sum_ext() + if len(sumExt) > 0: name = self.rremove(ws_name,sumExt) # remove _prop_name: - name= name.replace(self._prop_name,'',1) + name = name.replace(self._prop_name,'',1) if self._run_number: - instr_name = self._instr_name() - name= name.replace(instr_name,'',1) + instr_name = self._instr_name() + name = name.replace(instr_name,'',1) self._ws_cname = filter(lambda c: not c.isdigit(), name) else: @@ -573,24 +567,22 @@ def _instr_name(self): instr_name = '_test_instrument' return instr_name - def _clear_old_ws(self,old_ws_name,new_name,clear_runs_to_add=True): + def _clear_old_ws(self,old_ws_name,new_name,clear_fext=False): """ helper method used in __set__. When new data (run or wod) """ if old_ws_name: if new_name != old_ws_name: if old_ws_name in mtd: DeleteWorkspace(old_ws_name) - old_mon_ws = old_ws_name+'_monitors' - if old_mon_ws in mtd: + old_mon_ws = old_ws_name + '_monitors' + if old_mon_ws in mtd: DeleteWorkspace(old_mon_ws) - - self._run_ext = None - self._run_file_path = '' - if clear_runs_to_add: - self._runs_to_add = None + if clear_fext: + self._run_ext = None + self._run_file_path = '' #------------------------------------------------------------------------------------------------------------------------------- -#------------------------------------------------------------------------------------------------------------------------------- +#------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------- class RunDescriptorDependent(RunDescriptor): """ Simple RunDescriptor class dependent on another RunDescriptor, @@ -601,7 +593,7 @@ class RunDescriptorDependent(RunDescriptor): def __init__(self,host_run,ws_preffix,DocString=None): RunDescriptor.__init__(self,ws_preffix,DocString) self._host = host_run - self._this_run_defined=False + self._this_run_defined = False def __get__(self,instance,owner=None): """ return dependent run number which is host run number if this one has not been set or this run number if it was""" @@ -609,7 +601,7 @@ def __get__(self,instance,owner=None): if instance is None: return self else: - return super(RunDescriptorDependent,self).__get__(instance) + return super(RunDescriptorDependent,self).__get__(instance,owner) else: return self._host.__get__(instance,owner) diff --git a/Code/Mantid/scripts/test/RunDescriptorTest.py b/Code/Mantid/scripts/test/RunDescriptorTest.py index dab75cac8ee8..3beb6515d8ca 100644 --- a/Code/Mantid/scripts/test/RunDescriptorTest.py +++ b/Code/Mantid/scripts/test/RunDescriptorTest.py @@ -180,16 +180,24 @@ def test_sum_runs(self): propman = self.prop_man propman.sample_run = [11001,11001] ws = PropertyManager.sample_run.get_workspace() + test_val1 = ws.dataY(3)[0] + test_val2 = ws.dataY(6)[100] + test_val3 = ws.dataY(50)[200] self.assertEqual(ws.name(),'SR_MAR011001') + self.assertEqual(ws.getNEvents(),2455286) - + #propman.sample_run = [11001,11001] propman.sum_runs = True - propman.sample_run = [11001,11001] ws = PropertyManager.sample_run.get_workspace() self.assertEqual(ws.name(),'SR_MAR011001SumOf2') ws_name = PropertyManager.sample_run.get_ws_name() self.assertEqual(ws.name(),ws_name) + self.assertEqual(2*test_val1, ws.dataY(3)[0]) + self.assertEqual(2*test_val2, ws.dataY(6)[100]) + self.assertEqual(2*test_val3, ws.dataY(50)[200]) + + propman.sample_run = "MAR11001.raw,11001.nxs,MAR11001.raw" self.assertFalse('SR_MAR011001SumOf2' in mtd) ws = PropertyManager.sample_run.get_workspace() @@ -197,6 +205,10 @@ def test_sum_runs(self): ws_name = PropertyManager.sample_run.get_ws_name() self.assertEqual(ws.name(),ws_name) + self.assertEqual(3*test_val1, ws.dataY(3)[0]) + self.assertEqual(3*test_val2, ws.dataY(6)[100]) + self.assertEqual(3*test_val3, ws.dataY(50)[200]) + propman.sum_runs = 2 propman.sample_run = "/home/my_path/MAR11001.raw,c:/somewhere/11001.nxs,MAR11001.raw" self.assertFalse('SR_MAR011001SumOf3' in mtd) From 08c98d0903a6b5f57aa48a9915282ad8eeeade2b Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Wed, 28 Jan 2015 20:31:25 +0000 Subject: [PATCH 087/130] Re #10958 Introducing run_list --- .../Inelastic/Direct/PropertiesDescriptors.py | 174 ++++++++++-------- .../scripts/Inelastic/Direct/RunDescriptor.py | 39 ++-- Code/Mantid/scripts/test/RunDescriptorTest.py | 68 ++++++- 3 files changed, 186 insertions(+), 95 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py index e7c01df2fbc9..7914295ad9b2 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py +++ b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py @@ -13,7 +13,8 @@ import os #----------------------------------------------------------------------------------------- -# Descriptors, providing overloads for complex properties in NonIDF_Properties class +# Descriptors, providing overloads for complex properties in NonIDF_Properties +# class #----------------------------------------------------------------------------------------- class PropDescriptor(object): """ Class provides common custom interface for property descriptors """ @@ -41,9 +42,9 @@ def __init__(self,sample_run_prop): # self._last_ind2sum = -1 self._sum_runs = False - self._run_numbers =[] - self._file_guess =[] - self._fext =[] + self._run_numbers = [] + self._file_guess = [] + self._fext = [] # @@ -65,8 +66,8 @@ def __set__(self,instance,value): self._sum_runs = value self._last_ind2sum = -1 elif isinstance(value,int): - if value>0: - self._last_ind2sum = int(value)-1 + if value > 0: + self._last_ind2sum = int(value) - 1 self._sum_runs = True else: self._last_ind2sum = -1 @@ -88,65 +89,74 @@ def set_list2add(self,runs_to_add,fnames=None,fext=None): runs = [] for item in runs_to_add: runs.append(int(item)) - self._run_numbers =runs + self._run_numbers = runs if fnames: self._file_guess = fnames if len(self._file_guess) != len(self._run_numbers): - self._file_guess = ['']*len(self._run_numbers) + self._file_guess = [''] * len(self._run_numbers) if fext: self._fext = fext if len(self._fext) != len(self._run_numbers): - self._fext = ['']*len(self._run_numbers) + self._fext = [''] * len(self._run_numbers) # def clear_sum(self): """ clear all defined summation""" # if last_to_sum is -1, sum all run list provided self._last_ind2sum = -1 self._sum_runs = False - self._run_numbers =[] - self._file_guess =[] - self._fext =[] + self._run_numbers = [] + self._file_guess = [] + self._fext = [] # def get_last_ind2sum(self): """ get last run number contributing to sum""" if self._last_ind2sum > 0: return self._last_ind2sum else: - return len(self._run_numbers)-1 + return len(self._run_numbers) - 1 # def set_last_ind2sum(self,run_number): """ check and set last number, contributing to summation if this number is out of summation range, clear the summation """ - run_number =int(run_number) + run_number = int(run_number) if run_number in self._run_numbers: - self._last_ind2sum = self._run_numbers.index(run_number) + self._last_ind2sum = self._run_numbers.index(run_number) + 1 + return self._last_ind2sum else: self.clear_sum() + return 0 + # + def get_run_list2sum(self): + """ get run numbers of the files to be summed together """ + num_to_load = len(self._run_numbers) + if self._last_ind2sum > 0 and self._last_ind2sum < num_to_load: + num_to_load = self._last_ind2sum + return self._run_numbers[:num_to_load] + # def load_and_sum_runs(self,inst_name,monitors_with_ws): logger = lambda mess : (getattr(getattr(self,'_holder'),'log')(self._sample_run._holder,mess)) logger("*** Summing multiple runs ****") - num_to_load = len(self._run_numbers) - if self._last_ind2sum > 0 and self._last_ind2sum1: + if len(en_list) > 1: rez = [] for en_str in en_list: val = float(en_str) rez.append(val) - self._incident_energy=rez + self._incident_energy = rez else: - self._incident_energy =float(value) + self._incident_energy = float(value) else: if isinstance(value,list): rez = [] for val in value: en_val = float(val) - if en_val<=0: + if en_val <= 0: raise KeyError("Incident energy has to be positive, but is: {0} ".format(en_val)) else: rez.append(en_val) @@ -216,23 +228,21 @@ def __set__(self,instance,value): else: raise KeyError("Incident energy have to be positive number of list of positive numbers. Got None") - # - inc_en= self._incident_energy + # + inc_en = self._incident_energy if isinstance(inc_en,list): for en in inc_en: - if en<= 0: - raise KeyError("Incident energy have to be positive number of list of positive numbers."+ - " For input argument {0} got negative value {1}".format(value,en)) + if en <= 0: + raise KeyError("Incident energy have to be positive number of list of positive numbers." + " For input argument {0} got negative value {1}".format(value,en)) else: - if inc_en<= 0: - raise KeyError("Incident energy have to be positive number of list of positive numbers."+ - " For value {0} got negative {1}".format(value,inc_en)) + if inc_en <= 0: + raise KeyError("Incident energy have to be positive number of list of positive numbers." + " For value {0} got negative {1}".format(value,inc_en)) # end IncidentEnergy #----------------------------------------------------------------------------------------- class EnergyBins(PropDescriptor): """ Property provides various energy bin possibilities """ def __init__(self): - self._energy_bins=None + self._energy_bins = None def __get__(self,instance,owner=None): """ binning range for the result of convertToenergy procedure or list of such ranges """ if instance is None: @@ -245,11 +255,11 @@ def __set__(self,instance,values): lst = str.split(values,',') nBlocks = len(lst) for i in xrange(0,nBlocks,3): - value = [float(lst[i]),float(lst[i+1]),float(lst[i+2])] + value = [float(lst[i]),float(lst[i + 1]),float(lst[i + 2])] else: value = values nBlocks = len(value) - if nBlocks%3 != 0: + if nBlocks % 3 != 0: raise KeyError("Energy_bin value has to be either list of n-blocks of 3 number each or string representation of this list with numbers separated by commas") else: value = None @@ -318,10 +328,10 @@ def check_ei_bin_consistent(ei,binning_range): if isinstance(ei,list): for en in ei: range = binning_range[en] - if range[2]>en: + if range[2] > en: return (False,'Max rebin range {0:f} exceeds incident energy {1:f}'.format(range[2],en)) else: - if binning_range[2]>ei: + if binning_range[2] > ei: return (False,'Max rebin range {0:f} exceeds incident energy {1:f}'.format(binning_range[2],ei)) return (True,'') @@ -340,7 +350,8 @@ def __set__(self,instance,value): #----------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------- -# Descriptors, providing overloads for some complex properties in PropertyManager +# Descriptors, providing overloads for some complex properties in +# PropertyManager #----------------------------------------------------------------------------------------- class mon2NormalizationEnergyRange(PropDescriptor): """ Energy range to integrate signal on monitor 2 when normalized by this monitor @@ -361,12 +372,12 @@ def __get__(self,instance,owner): """ Return actual energy range from internal relative range and incident energy """ if instance is None: return self - return [self._relative_range[0]*instance.incident_energy,self._relative_range[1]*instance.incident_energy] + return [self._relative_range[0] * instance.incident_energy,self._relative_range[1] * instance.incident_energy] def __set__(self,instance,val): """ set detector calibration file using various formats """ if isinstance(val,list): - self._relative_range=self._check_range(val,instance) + self._relative_range = self._check_range(val,instance) elif isinstance(val,str): val = self._parce_string2list(val) self.__set__(instance,val) @@ -379,18 +390,18 @@ def _check_range(self,val,instance): if len(val) != 2: raise KeyError('mon2_normalization_energy_range can be initialized by list of two values only. Got {0} values'.format(len(val))) val1 = float(val[0]) - if val1<0.1 or val1 > 0.9: + if val1 < 0.1 or val1 > 0.9: message = "Lower mon2_norm_energy_range describes lower limit of energy to integrate neutron signal after the chopper.\n"\ "The limit is defined as (this value)*incident_energy. Are you sure you want to set this_value to {0}?\n".format(val1) - if val1>1: + if val1 > 1: raise KeyError(message) else: instance.log(message,'warning') val2 = float(val[1]) - if val2<1.1 or val2 > 1.9: + if val2 < 1.1 or val2 > 1.9: message = "Upper mon2_norm_energy_range describes upper limit of energy to integrate neutron signal after the chopper.\n"\ "The limit is defined as (this value)*incident_energy. Are you sure you want to set this_value to {0}?\n".format(val2) - if val2<1: + if val2 < 1: raise KeyError(message) else: instance.log(message,'warning') @@ -400,7 +411,7 @@ def _check_range(self,val,instance): def _parce_string2list(self,val): """ method splits input string containing comma into list of strings""" value = val.strip('[]()') - val = value.split(',') + val = value.split(',') return val #----------------------------------------------------------------------------------------- @@ -448,27 +459,32 @@ def __set__(self,instance,val): if isinstance(val,int): - #if val in instance.all_run_numbers: TODO: retrieve workspace from run numbers + #if val in instance.all_run_numbers: TODO: retrieve workspace from + #run numbers file_hint = str(val) - file_name= FileFinder.findRuns(file_hint)[0] + file_name = FileFinder.findRuns(file_hint)[0] self._det_cal_file = file_name return raise NameError('Detector calibration file name can be a workspace name present in Mantid or string describing an file name') - #if Reducer.det_cal_file != None : - # if isinstance(Reducer.det_cal_file,str) and not Reducer.det_cal_file in mtd : # it is a file - # Reducer.log('Setting detector calibration file to '+Reducer.det_cal_file) + #if Reducer.det_cal_file != None : + # if isinstance(Reducer.det_cal_file,str) and not Reducer.det_cal_file + # in mtd : # it is a file + # Reducer.log('Setting detector calibration file to + # '+Reducer.det_cal_file) # else: - # Reducer.log('Setting detector calibration to {0}, which is probably a workspace '.format(str(Reducer.det_cal_file))) + # Reducer.log('Setting detector calibration to {0}, which is probably + # a workspace '.format(str(Reducer.det_cal_file))) #else: - # Reducer.log('Setting detector calibration to detector block info from '+str(sample_run)) + # Reducer.log('Setting detector calibration to detector block info from + # '+str(sample_run)) #end DetCalFile #----------------------------------------------------------------------------------------- class MapMaskFile(PropDescriptor): """ common method to wrap around an auxiliary file name """ def __init__(self,file_ext,doc_string=None): - self._file_name=None - self._file_ext =file_ext + self._file_name = None + self._file_ext = file_ext if not(doc_string is None): self.__doc__ = doc_string @@ -482,8 +498,8 @@ def __set__(self,instance,value): if value != None: fileName, fileExtension = os.path.splitext(value) if (not fileExtension): - value=value+self._file_ext - self._file_name=value + value = value + self._file_ext + self._file_name = value #end MapMaskFile #----------------------------------------------------------------------------------------- @@ -501,7 +517,7 @@ def __set__(self,instance,value): if value != None: fileName, fileExtension = os.path.splitext(value) if (not fileExtension): - value=value+'.msk' + value = value + '.msk' instance.hard_mask_file = value prop_helpers.ComplexProperty.__set__(self,instance.__dict__,[False,True]) else: @@ -533,7 +549,7 @@ def __set__(self,instance,value): hard_mask_file = None elif isinstance(value,bool) or isinstance(value,int): use_hard_mask_only = bool(value) - hard_mask_file= instance.hard_mask_file + hard_mask_file = instance.hard_mask_file elif isinstance(value,str): if value.lower() in ['true','yes']: use_hard_mask_only = True @@ -545,7 +561,8 @@ def __set__(self,instance,value): hard_mask_file = instance.hard_mask_file #end - # if no hard mask file is there and use_hard_mask_only is True, diagnostics should not run + # if no hard mask file is there and use_hard_mask_only is True, + # diagnostics should not run if use_hard_mask_only and hard_mask_file is None: run_diagnostics = False else: @@ -557,7 +574,6 @@ def __set__(self,instance,value): pass #end HardMaskOnly #----------------------------------------------------------------------------------------- - class MonovanIntegrationRange(prop_helpers.ComplexProperty): """ integration range for monochromatic vanadium @@ -567,10 +583,10 @@ class MonovanIntegrationRange(prop_helpers.ComplexProperty): """ def __init__(self,DepType=None): if DepType: - self._rel_range=False + self._rel_range = False prop_helpers.ComplexProperty.__init__(self,['monovan_lo_value','monovan_hi_value']) else: - self._rel_range=True + self._rel_range = True prop_helpers.ComplexProperty.__init__(self,['monovan_lo_frac','monovan_hi_frac']) pass @@ -593,9 +609,9 @@ def __get__(self,instance,type=None): if isinstance(ei,list): range = dict() for en in ei: - range[en] = [rel_range[0]*en,rel_range[1]*en] + range[en] = [rel_range[0] * en,rel_range[1] * en] else: - range = [rel_range[0]*ei,rel_range[1]*ei] + range = [rel_range[0] * ei,rel_range[1] * ei] return range else: # absolute range return prop_helpers.ComplexProperty.__get__(self,tDict) @@ -608,11 +624,11 @@ def __set__(self,instance,value): if value is None: if (not self._rel_range): self._rel_range = True - self._other_prop =['monovan_lo_frac','monovan_hi_frac'] + self._other_prop = ['monovan_lo_frac','monovan_hi_frac'] else: if self._rel_range: self._rel_range = False - self._other_prop =['monovan_lo_value','monovan_hi_value'] + self._other_prop = ['monovan_lo_value','monovan_hi_value'] if isinstance(value,str): values = value.split(',') @@ -626,7 +642,6 @@ def __set__(self,instance,value): prop_helpers.ComplexProperty.__set__(self,tDict,value) #end MonovanIntegrationRange #----------------------------------------------------------------------------------------- - class SpectraToMonitorsList(PropDescriptor): """ property describes list of spectra, used as monitors to estimate incident energy in a direct scattering experiment. @@ -666,17 +681,16 @@ def _convert_to_list(self,spectra_list): else: if isinstance(spectra_list,list): if len(spectra_list) == 0: - result=None + result = None else: - result=[] + result = [] for i in range(0,len(spectra_list)): result.append(int(spectra_list[i])) else: - result =[int(spectra_list)] + result = [int(spectra_list)] return result #end SpectraToMonitorsList #----------------------------------------------------------------------------------------- - class SaveFormat(PropDescriptor): # formats available for saving the data save_formats = ['spe','nxspe','nxs'] @@ -693,7 +707,7 @@ def __set__(self,instance,value): """ user can clear save formats by setting save_format=None or save_format = [] or save_format='' if empty string or empty list is provided as part of the list, all save_format-s set up earlier are cleared""" - # clear format by using None + # clear format by using None if value is None: self._save_format = set() return @@ -702,14 +716,14 @@ def __set__(self,instance,value): if isinstance(value,str): value = value.strip('[]().') subformats = value.split(',') - if len(subformats)>1: + if len(subformats) > 1: self.__set__(instance,subformats) return else: value = subformats[0] - if not(value in SaveFormat.save_formats): - instance.log("Trying to set saving in unknown format: \""+str(value)+"\" No saving will occur for this format") + if not(value in SaveFormat.save_formats): + instance.log("Trying to set saving in unknown format: \"" + str(value) + "\" No saving will occur for this format") return else: try: @@ -724,7 +738,6 @@ def __set__(self,instance,value): self._save_format.add(value) #end SaveFormat #----------------------------------------------------------------------------------------- - class DiagSpectra(PropDescriptor): """ class describes spectra list which should be used in diagnostics @@ -767,7 +780,6 @@ def _process_spectra_list(self,specta_sring): raise ValueError("Spectra For diagnostics can be a string inthe form (num1,num2);(num3,num4) etc. or None") #end class DiagSpectra #----------------------------------------------------------------------------------------- - class BackbgroundTestRange(PropDescriptor): """ The TOF range used in diagnostics to reject high background spectra. @@ -788,7 +800,7 @@ def __get__(self,instance,type=None): def __set__(self,instance,value): if value is None: - self._background_test_range = None + self._background_test_range = None return if isinstance(value,str): value = str.split(value,',') diff --git a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py index bbc37a65b354..b7b9e60b5a69 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py +++ b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py @@ -32,7 +32,7 @@ def __init__(self,prop_name,DocString=None): # other workspaces self._ws_cname = '' self._ws_suffix = '' - self._bind_with_sum=False + self._bind_to_sum = False # if not DocString is None: @@ -65,7 +65,7 @@ def __set__(self,instance,value): self._ws_name = None self._ws_cname = '' self._ws_suffix = '' - self._bind_with_sum = False + self._bind_to_sum = False self._clear_old_ws(old_ws_name,self._ws_name,clear_fext) RunDescriptor._PropMan.sum_runs.clear_sum() return @@ -79,7 +79,7 @@ def __set__(self,instance,value): self._split_ws_name(ws_name) self.synchronize_ws(value) self._clear_old_ws(old_ws_name,self._ws_name,clear_fext) - self._bind_with_sum = False + self._bind_to_sum = False RunDescriptor._PropMan.sum_runs.clear_sum() return #return @@ -94,17 +94,15 @@ def __set__(self,instance,value): if isinstance(run_num,list): RunDescriptor._PropMan.sum_runs.set_list2add(run_num,file_path,fext) - self._bind_with_sum = True + self._bind_to_sum = True if instance.sum_runs: last_run_ind = RunDescriptor._PropMan.sum_runs.get_last_ind2sum() main_fext = fext[last_run_ind].lower() self._run_file_path = file_path[last_run_ind].lower() else: + self.__set__(instance,run_num) self._run_file_path = file_path main_fext = fext.lower() - self._run_number = int(run_num) - if instance.sum_runs: - RunDescriptor._PropMan.sum_runs.set_last_ind2sum(self._run_number) # if len(main_fext) > 0: @@ -113,7 +111,10 @@ def __set__(self,instance,value): self._run_ext = None clear_fext = False elif isinstance(value,list): - self._bind_with_sum = True + if len(value) == 1: + self.__set__(instance,value[0]) + return + self._bind_to_sum = True RunDescriptor._PropMan.sum_runs.set_list2add(value) if instance.sum_runs: last_run_ind = RunDescriptor._PropMan.sum_runs.get_last_ind2sum() @@ -122,10 +123,13 @@ def __set__(self,instance,value): self._run_number = value[0] clear_fext = True else: - self._run_number = int(value) clear_fext = True + self._run_number = int(value) if instance and instance.sum_runs: - RunDescriptor._PropMan.sum_runs.set_last_ind2sum(self._run_number) + num2_sum = RunDescriptor._PropMan.sum_runs.set_last_ind2sum(self._run_number) + if num2_sum == 0: + self._bind_to_sum = False + instance.sum_runs = False self._ws_cname = '' @@ -148,7 +152,18 @@ def is_monws_separate(self): return True else: return False - +#-------------------------------------------------------------------------------------------------------------------- + def get_run_list(self): + """ Returns list of the files, assigned to current property """ + current_run = self.run_number() + if self._bind_to_sum: + runs = RunDescriptor._PropMan.sum_runs.get_runs() + if current_run in runs: + return runs + else: + return [current_run] + else: + return [current_run] #-------------------------------------------------------------------------------------------------------------------- def set_action_suffix(self,suffix=None): """ method to set part of the workspace name, which indicate some action performed over this workspace @@ -252,7 +267,7 @@ def get_workspace(self): prefer_ws_calibration = self._check_claibration_source() inst_name = RunDescriptor._holder.short_inst_name calibration = RunDescriptor._holder.det_cal_file - if self._bind_with_sum and RunDescriptor._holder.sum_runs : # Sum runs + if self._bind_to_sum and RunDescriptor._holder.sum_runs : # Sum runs ws = RunDescriptor._PropMan.sum_runs.load_and_sum_runs(inst_name,RunDescriptor._holder.load_monitors_with_workspace) else: # load current workspace ws = self.load_run(inst_name, calibration,False, RunDescriptor._holder.load_monitors_with_workspace,prefer_ws_calibration) diff --git a/Code/Mantid/scripts/test/RunDescriptorTest.py b/Code/Mantid/scripts/test/RunDescriptorTest.py index 3beb6515d8ca..7813453a5167 100644 --- a/Code/Mantid/scripts/test/RunDescriptorTest.py +++ b/Code/Mantid/scripts/test/RunDescriptorTest.py @@ -1,5 +1,5 @@ import os -#os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] +os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] from mantid.simpleapi import * from mantid import api import unittest @@ -227,6 +227,70 @@ def test_assign_fname(self): self.assertEqual(PropertyManager.sample_run.run_number(),11001) self.assertEqual(PropertyManager.sample_run._run_ext,'.raw') - + def test_get_run_list(self): + propman = PropertyManager('MAR') + propman.sample_run = [10204] + + self.assertEqual(propman.sample_run,10204) + runs = PropertyManager.sample_run.get_run_list() + self.assertEqual(len(runs),1) + self.assertEqual(runs[0],10204) + + propman.sample_run = [11230,10382,10009] + self.assertEqual(propman.sample_run,11230) + propman.sum_runs = True + propman.sample_run = [11231,10382,10010] + self.assertEqual(propman.sample_run,10010) + + sum_list = PropertyManager.sum_runs.get_run_list2sum() + self.assertEqual(len(sum_list),3) + + runs = PropertyManager.sample_run.get_run_list() + self.assertEqual(runs[0],sum_list[0]) + + propman.sample_run = 11231 + sum_list = PropertyManager.sum_runs.get_run_list2sum() + self.assertEqual(len(sum_list),1) + self.assertEqual(sum_list[0],11231) + self.assertEqual(propman.sample_run,11231) + + propman.sample_run = 10382 + sum_list = PropertyManager.sum_runs.get_run_list2sum() + self.assertEqual(len(sum_list),2) + self.assertEqual(sum_list[0],11231) + self.assertEqual(sum_list[1],10382) + self.assertEqual(propman.sample_run,10382) + runs = PropertyManager.sample_run.get_run_list() + self.assertEqual(len(runs),3) + + propman.sample_run = 10010 + sum_list = PropertyManager.sum_runs.get_run_list2sum() + self.assertEqual(len(sum_list),3) + self.assertEqual(sum_list[0],11231) + self.assertEqual(sum_list[1],10382) + self.assertEqual(sum_list[2],10010) + runs = PropertyManager.sample_run.get_run_list() + self.assertEqual(len(runs),3) + self.assertTrue(propman.sum_runs) + + + propman.sample_run = 10011 + sum_list = PropertyManager.sum_runs.get_run_list2sum() + self.assertEqual(len(sum_list),0) + + runs = PropertyManager.sample_run.get_run_list() + self.assertEqual(len(runs),1) + self.assertEqual(runs[0],10011) + self.assertFalse(propman.sum_runs) + + + + + + + + + + if __name__=="__main__": unittest.main() From 92179172f9213793ce2f5b0d4bc10dfc13958426 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Wed, 28 Jan 2015 20:33:12 +0000 Subject: [PATCH 088/130] Re #10958 Minor comments --- Code/Mantid/scripts/test/RunDescriptorTest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/scripts/test/RunDescriptorTest.py b/Code/Mantid/scripts/test/RunDescriptorTest.py index 7813453a5167..0df1874538ad 100644 --- a/Code/Mantid/scripts/test/RunDescriptorTest.py +++ b/Code/Mantid/scripts/test/RunDescriptorTest.py @@ -1,5 +1,5 @@ import os -os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] +#os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] from mantid.simpleapi import * from mantid import api import unittest From 56919cfbf951090578d0f617d66ce2feb9eaf262 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Wed, 28 Jan 2015 21:32:06 +0000 Subject: [PATCH 089/130] Re #10958 Bug in summation and better results validator --- .../Inelastic/Direct/PropertiesDescriptors.py | 1 - .../Inelastic/Direct/ReductionWrapper.py | 38 ++++++++++--------- .../scripts/Inelastic/Direct/RunDescriptor.py | 4 +- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py index 7914295ad9b2..8bee8dec3485 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py +++ b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py @@ -51,7 +51,6 @@ def __init__(self,sample_run_prop): def __get__(self,instance,holder_class): if not self._holder: self._holder = holder_class - if instance is None: return self return self._sum_runs diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 865f4d46854b..9781de9e3762 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -108,12 +108,12 @@ def save_web_variables(self,FileName=None): f.close() # - def get_validation_file_name(self): - """ Define file used as sample to ensure reduction validity - """ - return None -# - def validate_result(self,BuildSampleWSIfNotPresent=False,Error=1.e-3,ToleranceRelErr=True): +# + def validate_result(self,build_validation=False,Error=1.e-3,ToleranceRelErr=True): + """ Overload this using build_or_validate_result to have possibility to run or validate result """ + return True + + def build_or_validate_result(self,sample_run,validationFile,build_validation=False,Error=1.e-3,ToleranceRelErr=True): """ Method validates results of the reduction against reference file provided by get_validation_file_name() method @@ -124,14 +124,12 @@ def validate_result(self,BuildSampleWSIfNotPresent=False,Error=1.e-3,ToleranceRe equivalent to the workspace, stored in the reference file. """ - validation_file = self.get_validation_file_name() - if not validation_file: - Build_validation =True - if not BuildSampleWSIfNotPresent: - return True,'No validation defined' - else: - sample = Load(validation_file) - Build_validation = False + if not build_validation: + if validationFile: + sample = Load(validationFile) + else: + build_validation=True + # just in case, to be sure current_web_state = self._run_from_web @@ -142,12 +140,17 @@ def validate_result(self,BuildSampleWSIfNotPresent=False,Error=1.e-3,ToleranceRe # self.def_advanced_properties() self.def_main_properties() + # + self.reducer.sample_run = sample_run self.reducer.prop_man.save_format=None reduced = self.reduce() - if Build_validation: - result_name = self.reducer.prop_man.save_file_name + if build_validation: + if validationFile: + result_name = os.parh.splitext(validationFile)[0] + else: + result_name = self.reducer.prop_man.save_file_name self.reducer.prop_man.log("*** Saving validation file with name: {0}.nxs".format(result_name),'notice') SaveNexus(result,Filename=result_name+'.nxs') return True,'Created validation file {0}.nxs'.format(result_name) @@ -271,11 +274,12 @@ def iliad_wrapper(*args): input_file=None output_directory=None # add input file folder to data search directory if file has it - if input_file: + if input_file and isinstance(input_file,str): data_path = os.path.dirname(input_file) if len(data_path)>0: try: config.appendDataSearchDir(str(data_path)) + args[1] = os.path.basename(input_file) except: # if mantid is not available, this should ignore config pass if output_directory: diff --git a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py index b7b9e60b5a69..662a06824ce1 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py +++ b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py @@ -65,6 +65,8 @@ def __set__(self,instance,value): self._ws_name = None self._ws_cname = '' self._ws_suffix = '' + # only one RunDescriptor can be summed under current approach. + # To disentangle one run descriptor from another -- set up binding self._bind_to_sum = False self._clear_old_ws(old_ws_name,self._ws_name,clear_fext) RunDescriptor._PropMan.sum_runs.clear_sum() @@ -125,7 +127,7 @@ def __set__(self,instance,value): else: clear_fext = True self._run_number = int(value) - if instance and instance.sum_runs: + if self._bind_to_sum and instance and instance.sum_runs: num2_sum = RunDescriptor._PropMan.sum_runs.set_last_ind2sum(self._run_number) if num2_sum == 0: self._bind_to_sum = False From 314f3b0e873ddb7dd155ca35247506222e56fbff Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Wed, 28 Jan 2015 22:11:16 +0000 Subject: [PATCH 090/130] Re #10958 Minor pylint warnings --- .../Direct/DirectEnergyConversion.py | 422 +++++++++--------- 1 file changed, 211 insertions(+), 211 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py index f928f49992ac..2a9210324690 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py +++ b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py @@ -1,15 +1,13 @@ from mantid.simpleapi import * from mantid.kernel import funcreturns -from mantid import api from mantid import geometry import time as time -import glob,sys,os.path,math -import numpy as np +import os.path import copy -import CommonFunctions as common -import diagnostics +import Direct.CommonFunctions as common +import Direct.diagnostics as diagnostics from Direct.PropertyManager import PropertyManager from Direct.RunDescriptor import RunDescriptor from Direct.ReductionHelpers import extract_non_system_names @@ -22,14 +20,14 @@ def setup_reducer(inst_name,reload_instrument=False): """ try: return DirectEnergyConversion(inst_name,reload_instrument) - except RuntimeError, exc: + except RuntimeError: raise RuntimeError('Unknown instrument "%s" or wrong IDF file for this instrument, cannot continue' % inst_name) class DirectEnergyConversion(object): """ - Performs a convert to energy assuming the provided instrument is an direct inelastic geometry instruments - + Performs a convert to energy assuming the provided instrument is + an direct inelastic geometry instrument The class defines various methods to allow users to convert their files to Energy transfer @@ -56,10 +54,12 @@ class DirectEnergyConversion(object): energy_bins energy binning requested for resulting spe workspace. mapfile Mapfile -- if absent/'default' the defaults from IDF are used monovan_run If present will do the absolute units normalization. Number of additional parameters - specified in **kwargs is usually requested for this. If they are absent, program uses defaults, - but the defaults (e.g. sample_mass or sample_rmm ) are usually incorrect for a particular run. + specified in **kwargs is usually requested for this. If they are absent, + program uses defaults, but the defaults (e.g. sample_mass or sample_rmm ) + are usually incorrect for a particular run. arguments The dictionary containing additional keyword arguments. - The list of allowed additional arguments is defined in InstrName_Parameters.xml file, located in + The list of allowed additional arguments is defined in InstrName_Parameters.xml + file, located in: MantidPlot->View->Preferences->Mantid->Directories->Parameter Definitions Usage examples: @@ -78,162 +78,157 @@ class DirectEnergyConversion(object): All available keywords are provided in InstName_Parameters.xml file - Some samples are: - norm_method =[monitor-1],[monitor-2][Current] - background =False , True - fixei =False , True - save_format =['.spe'],['.nxspe'],'none' - detector_van_range =[20,40] in mev - - bkgd_range =[15000,19000] :integration range for background tests - - second_white - If provided an additional set of tests is performed on this. (default = None) - hardmaskPlus - A file specifying those spectra that should be masked without testing (default=None) - tiny - Minimum threshold for acceptance (default = 1e-10) - large - Maximum threshold for acceptance (default = 1e10) - bkgd_range - A list of two numbers indicating the background range (default=instrument defaults) - diag_van_median_rate_limit_lo - Lower bound defining outliers as fraction of median value (default = 0.01) - diag_van_median_rate_limit_hi - Upper bound defining outliers as fraction of median value (default = 100.) - diag_van_median_sigma_lo - Fraction of median to consider counting low for the white beam diag (default = 0.1) - diag_van_median_sigma_hi - Fraction of median to consider counting high for the white beam diag (default = 1.5) - diag_van_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the - difference with respect to the median value must also exceed this number of error bars (default=0.0) - diag_remove_zero - If true then zeroes in the vanadium data will count as failed (default = True) - diag_samp_samp_median_sigma_lo - Fraction of median to consider counting low for the white beam diag (default = 0) - diag_samp_samp_median_sigma_hi - Fraction of median to consider counting high for the white beam diag (default = 2.0) - diag_samp_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the - difference with respect to the median value must also exceed this number of error bars (default=3.3) - variation -The number of medians the ratio of the first/second white beam can deviate from + Some samples are: + norm_method =[monitor-1],[monitor-2][Current] + background =False , True + fixei =False , True + save_format =['.spe'],['.nxspe'],'none' + detector_van_range =[20,40] in mev + + bkgd_range =[15000,19000] :integration range for background tests + + second_white - If provided an additional set of tests is performed on this. + (default = None) + hardmaskPlus - A file specifying those spectra that should be masked + without testing (default=None) + tiny - Minimum threshold for acceptance (default = 1e-10) + large - Maximum threshold for acceptance (default = 1e10) + bkgd_range - A list of two numbers indicating the background range + (default=instrument defaults) + diag_van_median_rate_limit_lo - Lower bound defining outliers as fraction of median value (default = 0.01) + diag_van_median_rate_limit_hi - Upper bound defining outliers as fraction of median value (default = 100.) + diag_van_median_sigma_lo - Fraction of median to consider counting low for the white beam diag (default = 0.1) + diag_van_median_sigma_hi - Fraction of median to consider counting high for the white beam diag (default = 1.5) + diag_van_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the + difference with respect to the median value must also exceed this number of error bars (default=0.0) + diag_remove_zero - If true then zeroes in the vanadium data will count as failed (default = True) + diag_samp_samp_median_sigma_lo - Fraction of median to consider counting low for the white beam diag (default = 0) + diag_samp_samp_median_sigma_hi - Fraction of median to consider counting high for the white beam diag (default = 2.0) + diag_samp_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the + difference with respect to the median value must also exceed this number of + error bars (default=3.3) + variation - The number of medians the ratio of the first/second white beam can deviate from the average by (default=1.1) - bleed_test - If true then the CreatePSDBleedMask algorithm is run - bleed_maxrate - If the bleed test is on then this is the maximum framerate allowed in a tube - bleed_pixels - If the bleed test is on then this is the number of pixels ignored within the + bleed_test - If true then the CreatePSDBleedMask algorithm is run + bleed_maxrate - If the bleed test is on then this is the maximum framerate allowed in a tube + bleed_pixels - If the bleed test is on then this is the number of pixels ignored within the bleed test diagnostic - print_diag_results - If True then the results are printed to the screen + print_diag_results - If True then the results are printed to the screen - diag_remove_ero =True, False (default):Diag zero counts in background range - bleed=True , turn bleed correction on and off on by default for Merlin and LET + diag_remove_ero =True, False (default):Diag zero counts in background range + bleed=True , turn bleed correction on and off on by default for Merlin and LET - sum =True,False(default) , sum multiple files + sum =True,False(default) , sum multiple files - det_cal_file= a valid detector block file and path or a raw file. Setting this + det_cal_file= a valid detector block file and path or a raw file. Setting this will use the detector calibraion from the specified file NOT the input raw file - mask_run = RunNumber to use for diag instead of the input run number + mask_run = RunNumber to use for diag instead of the input run number - one2one =True, False :Reduction will not use a mapping file + one2one =True, False :Reduction will not use a mapping file - hardmaskPlus=Filename :load a hardmarkfile and apply together with diag mask + hardmaskPlus=Filename :load a hardmarkfile and apply together with diag mask - hardmaskOnly=Filename :load a hardmask and use as only mask - """ + hardmaskOnly=Filename :load a hardmask and use as only mask + """ #------------------------------------------------------------------------------- def diagnose(self, white,diag_sample=None,**kwargs): - """ - Run diagnostics on the provided workspaces. - - This method does some additional processing before moving on to the diagnostics: - 1) Computes the white beam integrals, converting to energy - 2) Computes the background integral using the instrument defined range - 3) Computes a total count from the sample - - These inputs are passed to the diagnostics functions - - Required inputs: - - white - A workspace, run number or filepath of a white beam run. A workspace is assumed to - have simple been loaded and nothing else. - - Optional inputs: - diag_sample - A workspace, run number or filepath of additional (sample) run used for diagnostics. - A workspace is assumed to have simple been loaded and nothing else. (default = None) - - second_white - If provided an additional set of tests is performed on this. (default = None) - hard_mask - A file specifying those spectra that should be masked without testing (default=None) - - # IDF-based diagnostics parameters: - tiny - Minimum threshold for acceptance (default = 1e-10) - huge - Maximum threshold for acceptance (default = 1e10) - background_test_range - A list of two numbers indicating the background range (default=instrument defaults) - van_out_lo - Lower bound defining outliers as fraction of median value (default = 0.01) - van_out_hi - Upper bound defining outliers as fraction of median value (default = 100.) - van_lo - Fraction of median to consider counting low for the white beam diag (default = 0.1) - van_hi - Fraction of median to consider counting high for the white beam diag (default = 1.5) - van_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the\n" - "difference with respect to the median value must also exceed this number of error bars (default=0.0) - samp_zero - If true then zeros in the vanadium data will count as failed (default = True) - samp_lo - Fraction of median to consider counting low for the white beam diag (default = 0) - samp_hi - Fraction of median to consider counting high for the white beam diag (default = 2.0) - samp_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the\n" - "difference with respect to the median value must also exceed this number of error bars (default=3.3) - variation - The number of medians the ratio of the first/second white beam can deviate from - the average by (default=1.1) - bleed_test - If true then the CreatePSDBleedMask algorithm is run - bleed_maxrate - If the bleed test is on then this is the maximum framerate allowed in a tube - bleed_pixels - If the bleed test is on then this is the number of pixels ignored within the - bleed test diagnostic - """ - lhs_names = funcreturns.lhs_info('names') - if len(lhs_names) > 0: - var_name = lhs_names[0] - else: - var_name = "diag_mask" - - # modify properties using input arguments - self.prop_man.set_input_parameters(**kwargs) - # obtain proper run descriptor in case it is not a run descriptor but - # something else - white = self.get_run_descriptor(white) - - # return all diagnostics parameters - diag_params = self.prop_man.get_diagnostics_parameters() - - - if self.use_hard_mask_only: - if mtd.doesExist('hard_mask_ws'): - diag_mask = mtd['hard_mask_ws'] - else: # build hard mask - # in this peculiar way we can obtain working mask which - # accounts for initial data grouping in the data file. - # SNS or 1 to 1 maps may probably avoid this stuff and can load - # masks directly - white_data = white.get_ws_clone('white_ws_clone') - #whitews_name = common.create_resultname(white, - #suffix='-white') - #if whitews_name in mtd: - # DeleteWorkspace(Workspace=whitews_name) - ## Load - #white_data,mon_ws = - #self.load_data(white,whitews_name,self._keep_wb_workspace) - - diag_mask = LoadMask(Instrument=self.instr_name,InputFile=self.hard_mask_file, - OutputWorkspace='hard_mask_ws') - MaskDetectors(Workspace=white_data, MaskedWorkspace=diag_mask) - DeleteWorkspace(diag_mask) - diag_mask,masked_list = ExtractMask(InputWorkspace=white_data) - DeleteWorkspace(Workspace='white_ws_clone') - - return diag_mask - - - # Get the white beam vanadium integrals - whiteintegrals = self.do_white(white, None, None) # No grouping yet - if self.second_white: - second_white = self.second_white - other_whiteintegrals = self.do_white(PropertyManager.second_white, None, None) # No grouping yet - self.second_white = other_whiteintegrals - - # Get the background/total counts from the sample run if present - if diag_sample: + """ run diagnostics on the provided workspaces. + + this method does some additional processing before moving on to the diagnostics: + 1) Computes the white beam integrals, converting to energy + 2) Computes the background integral using the instrument defined range + 3) Computes a total count from the sample + + these inputs are passed to the diagnostics functions + + required inputs: + + white - A workspace, run number or filepath of a white beam run. A workspace is assumed to + have simple been loaded and nothing else. + + optional inputs: + + diag_sample - A workspace, run number or filepath of additional (sample) run used for diagnostics. + A workspace is assumed to have simple been loaded and nothing else. (default = None) + + second_white - If provided an additional set of tests is performed on this. (default = None) + hard_mask - A file specifying those spectra that should be masked without testing (default=None) + + # IDF-based diagnostics parameters: + tiny - Minimum threshold for acceptance (default = 1e-10) + huge - Maximum threshold for acceptance (default = 1e10) + background_test_range - A list of two numbers indicating the background range (default=instrument defaults) + van_out_lo - Lower bound defining outliers as fraction of median value (default = 0.01) + van_out_hi - Upper bound defining outliers as fraction of median value (default = 100.) + van_lo - Fraction of median to consider counting low for the white beam diag (default = 0.1) + van_hi - Fraction of median to consider counting high for the white beam diag (default = 1.5) + van_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the\n" + "difference with respect to the median value must also exceed this number of error bars (default=0.0) + samp_zero - If true then zeros in the vanadium data will count as failed (default = True) + samp_lo - Fraction of median to consider counting low for the white beam diag (default = 0) + samp_hi - Fraction of median to consider counting high for the white beam diag (default = 2.0) + samp_sig - Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the\n" + "difference with respect to the median value must also exceed this number of error bars (default=3.3) + variation - The number of medians the ratio of the first/second white beam can deviate from + the average by (default=1.1) + bleed_test - If true then the CreatePSDBleedMask algorithm is run + bleed_maxrate - If the bleed test is on then this is the maximum framerate allowed in a tube + bleed_pixels - If the bleed test is on then this is the number of pixels ignored within the + bleed test diagnostic + """ + lhs_names = funcreturns.lhs_info('names') + if len(lhs_names) > 0: + var_name = lhs_names[0] + else: + var_name = "diag_mask" - diag_sample = self.get_run_descriptor(diag_sample) - # If the bleed test is requested then we need to pass in the - # sample_run as well - if self.bleed_test: - # initiate reference to reducer to be able to work with Run - # Descriptors - diagnostics.__Reducer__ = self - diag_params['sample_run'] = diag_sample + # modify properties using input arguments + self.prop_man.set_input_parameters(**kwargs) + # obtain proper run descriptor in case it is not a run descriptor but + # something else + white = self.get_run_descriptor(white) + + # return all diagnostics parameters + diag_params = self.prop_man.get_diagnostics_parameters() + + if self.use_hard_mask_only: + if mtd.doesExist('hard_mask_ws'): + diag_mask = mtd['hard_mask_ws'] + else: # build hard mask + # in this peculiar way we can obtain working mask which + # accounts for initial data grouping in the + # data file. SNS or 1 to 1 maps may probably avoid this + # stuff and can load masks directly + white_data = white.get_ws_clone('white_ws_clone') + + diag_mask = LoadMask(Instrument=self.instr_name,InputFile=self.hard_mask_file, + OutputWorkspace='hard_mask_ws') + MaskDetectors(Workspace=white_data, MaskedWorkspace=diag_mask) + DeleteWorkspace(diag_mask) + diag_mask,masked_list = ExtractMask(InputWorkspace=white_data) + DeleteWorkspace(Workspace='white_ws_clone') + + return diag_mask + + + # Get the white beam vanadium integrals + whiteintegrals = self.do_white(white, None, None) # No grouping yet + if self.second_white: + second_white = self.second_white + other_whiteintegrals = self.do_white(PropertyManager.second_white, None, None) # No grouping yet + self.second_white = other_whiteintegrals + + # Get the background/total counts from the sample run if present + if diag_sample: + diag_sample = self.get_run_descriptor(diag_sample) + # If the bleed test is requested then we need to pass in the + # sample_run as well + if self.bleed_test: + # initiate reference to reducer to be able to work with Run + # Descriptors + diagnostics.__Reducer__ = self + diag_params['sample_run'] = diag_sample # Set up the background integrals for diagnostic purposes result_ws = self.normalise(diag_sample, self.normalise_method) @@ -253,29 +248,29 @@ def diagnose(self, white,diag_sample=None,**kwargs): diag_params['background_int'] = background_int diag_params['sample_counts'] = total_counts - # Check how we should run diag - diag_spectra_blocks = self.diag_spectra - if diag_spectra_blocks is None: - # Do the whole lot at once - diagnostics.diagnose(whiteintegrals, **diag_params) - else: - for index, bank in enumerate(diag_spectra_blocks): - diag_params['start_index'] = bank[0] - 1 - diag_params['end_index'] = bank[1] - 1 - diagnostics.diagnose(whiteintegrals, **diag_params) - - if 'sample_counts' in diag_params: - DeleteWorkspace(Workspace='background_int') - DeleteWorkspace(Workspace='total_counts') - if 'second_white' in diag_params: - DeleteWorkspace(Workspace=diag_params['second_white']) + # Check how we should run diag + diag_spectra_blocks = self.diag_spectra + if diag_spectra_blocks is None: + # Do the whole lot at once + diagnostics.diagnose(whiteintegrals, **diag_params) + else: + for index, bank in enumerate(diag_spectra_blocks): + diag_params['start_index'] = bank[0] - 1 + diag_params['end_index'] = bank[1] - 1 + diagnostics.diagnose(whiteintegrals, **diag_params) + + if 'sample_counts' in diag_params: + DeleteWorkspace(Workspace='background_int') + DeleteWorkspace(Workspace='total_counts') + if 'second_white' in diag_params: + DeleteWorkspace(Workspace=diag_params['second_white']) # Extract a mask workspace - diag_mask, det_ids = ExtractMask(InputWorkspace=whiteintegrals,OutputWorkspace=var_name) + diag_mask, det_ids = ExtractMask(InputWorkspace=whiteintegrals,OutputWorkspace=var_name) - DeleteWorkspace(Workspace=whiteintegrals) - #TODO do we need this? - #self.spectra_masks = diag_mask - return diag_mask + DeleteWorkspace(Workspace=whiteintegrals) + #TODO do we need this? + #self.spectra_masks = diag_mask + return diag_mask #------------------------------------------------------------------------------- def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None,map_file=None, @@ -300,7 +295,7 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, # inform user on what parameters have changed from script or gui - # if monovan present, check if abs_norm_ parameters are set + # if monovan present, check if abs_norm_ parameters are set self.prop_man.log_changed_values('notice') prop_man = self.prop_man #process complex parameters @@ -361,7 +356,8 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, prop_man.log(' Applying sample run mask to mono van') else: if not self.use_hard_mask_only : # in this case the masking2 is different but points to the same workspace - # Should be better solution for that. + # Should be better + # solution for that. prop_man.log("======== Run diagnose for monochromatic vanadium run ===========",'notice') masking2 = self.diagnose(PropertyManager.wb_for_monovan_run,PropertyManager.monovan_run, @@ -488,7 +484,7 @@ def calculate_rotation(self,sample_wkspace,motor=None, offset=None): else: motor_rotation = float('nan') self.prop_man.psi = motor_rotation + motor_offset -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- def get_ei(self, data_run, ei_guess): """ Calculate incident energy of neutrons and the time of the of the @@ -524,7 +520,8 @@ def get_ei(self, data_run, ei_guess): self.incident_energy = ei if self.prop_man.normalise_method == 'monitor-2': # monitor-2 normalization ranges have to be identified before the - # instrument is shifted in case it is shifted to this monitor (usual case) + # instrument is shifted in case it is shifted to this monitor (usual + # case) #Find TOF range, correspondent to incident energy monitor peak energy_rage = self.mon2_norm_energy_range self._mon2_norm_time_range = self.get_TOF_for_energies(monitor_ws,energy_rage,[self.mon2_norm_spec],self._debug_mode) @@ -560,7 +557,7 @@ def get_ei(self, data_run, ei_guess): data_run.synchronize_ws(mtd[resultws_name]) return ei, mon1_peak -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- def remap(self, result_ws, spec_masks, map_file): """ Mask and group detectors based on input parameters @@ -642,10 +639,10 @@ def _normalize_to_monitor1(self,run,old_name,range_offset=0.0): separate_monitors = run.is_monws_separate() mon_spect = self.prop_man.mon1_norm_spec if separate_monitors: - kwargs['MonitorWorkspace'] = mon_ws - kwargs['MonitorWorkspaceIndex']= int(mon_ws.getIndexFromSpectrumNumber(int(mon_spect))) + kwargs['MonitorWorkspace'] = mon_ws + kwargs['MonitorWorkspaceIndex'] = int(mon_ws.getIndexFromSpectrumNumber(int(mon_spect))) else: - kwargs['MonitorSpectrum']= int(mon_spect) # shame TODO: change algorithm + kwargs['MonitorSpectrum'] = int(mon_spect) # shame TODO: change algorithm NormaliseToMonitor(InputWorkspace=old_name,OutputWorkspace=old_name, IntegrationRangeMin=range_min, @@ -675,10 +672,10 @@ def _normalize_to_monitor2(self,run,old_name, range_offset=0.0): mon_spect = self.prop_man.mon2_norm_spec mon_index = int(mon_ws.getIndexFromSpectrumNumber(mon_spect)) if separate_monitors: - kwargs['MonitorWorkspace'] = mon_ws - kwargs['MonitorWorkspaceIndex'] = mon_index + kwargs['MonitorWorkspace'] = mon_ws + kwargs['MonitorWorkspaceIndex'] = mon_index else: - kwargs['MonitorSpectrum'] = mon_spect + kwargs['MonitorSpectrum'] = mon_spect #Find TOF range, correspondent to incident energy monitor peak if self._mon2_norm_time_range: @@ -689,7 +686,8 @@ def _normalize_to_monitor2(self,run,old_name, range_offset=0.0): else: mon_ws_name = mon_ws.name() if mon_ws_name.find('_shifted') != -1: - # monitor-2 normalization ranges have to be identified before the instrument is shifted + # monitor-2 normalization ranges have to be identified before the + # instrument is shifted raise RuntimeError("Instrument have been shifted but no time range has been identified. Monitor-2 normalization can not be performed ") else: energy_rage = self.mon2_norm_energy_range @@ -738,20 +736,20 @@ def get_TOF_for_energies(workspace,energy_list,specID_list,debug_mode=False): return TOF_range - def save_results(self, workspace, save_file=None, formats = None): + def save_results(self, workspace, save_file=None, formats=None): """ Save the result workspace to the specified filename using the list of formats specified in formats. If formats is None then the default list is used """ if formats: # clear up existing save formats as one is defined in parameters - self.prop_man.save_format=None + self.prop_man.save_format = None self.prop_man.set_input_parameters_ignore_nan(save_file_name=save_file,save_format=formats) - #TODO: deal with this. This all should be incorporated in sample_run + #TODO: deal with this. This all should be incorporated in sample_run save_file = self.prop_man.save_file_name - formats = self.prop_man.save_format + formats = self.prop_man.save_format if save_file is None: save_file = workspace.getName() elif os.path.isdir(save_file): @@ -761,25 +759,25 @@ def save_results(self, workspace, save_file=None, formats = None): else: pass - prop_man =self.prop_man + prop_man = self.prop_man save_file,ext = os.path.splitext(save_file) - if len(ext)>1: + if len(ext) > 1: formats.add(ext[1:]) for file_format in formats: for case in common.switch(file_format): if case('nxspe'): - filename = save_file +'.nxspe' + filename = save_file + '.nxspe' SaveNXSPE(InputWorkspace=workspace,Filename= filename, KiOverKfScaling=prop_man.apply_kikf_correction,psi=prop_man.psi) break if case('spe'): - filename = save_file +'.spe' + filename = save_file + '.spe' SaveSPE(InputWorkspace=workspace,Filename= filename) break if case('nxs'): - filename = save_file +'.nxs' + filename = save_file + '.nxs' SaveNexus(InputWorkspace=workspace,Filename= filename) break if case(): # default, could also just omit condition or 'if True' @@ -829,7 +827,8 @@ def __init__(self, instr_name=None,reload_instrument=False): object.__setattr__(self,'_keep_wb_workspace',True) object.__setattr__(self,'_do_ISIS_reduction',True) object.__setattr__(self,'_spectra_masks',None) - # if normalized by monitor-2, range have to be established before shifting the instrument + # if normalized by monitor-2, range have to be established before + # shifting the instrument object.__setattr__(self,'_mon2_norm_time_range',None) object.__setattr__(self,'_debug_mode',False) @@ -870,19 +869,21 @@ def initialise(self, instr,reload_instrument=False): to be always set-up from a calling script """ # Internal properties and keys - self._keep_wb_workspace = True # for the time being. May be auto-calculated later but should it? + self._keep_wb_workspace = True # for the time being. May be auto-calculated later but should it? self._do_ISIS_reduction = True - # if normalized by monitor-2, range have to be established before shifting the instrument - self._mon2_norm_time_range=None + # if normalized by monitor-2, range have to be established before + # shifting the instrument + self._mon2_norm_time_range = None self._debug_mode = False self.spectra_masks = None # Instrument and default parameter setup - # formats available for saving. As the reducer has to have a method to process one of this, it is private property + # formats available for saving. As the reducer has to have a method to + # process one of this, it is private property if not hasattr(self,'_propMan') or self._propMan is None: if isinstance(instr,PropertyManager): - self._propMan = instr + self._propMan = instr else: self._propMan = PropertyManager(instr) else: @@ -899,10 +900,10 @@ def initialise(self, instr,reload_instrument=False): #end if # - def setup_instrument_properties(self, workspace = None,reload_instrument=False): + def setup_instrument_properties(self, workspace=None,reload_instrument=False): if workspace != None: instrument = workspace.getInstrument() - name = instrument.getName() + name = instrument.getName() if name != self.prop_man.instr_name: self.prop_man = PropertyManager(name,workspace) @@ -919,7 +920,7 @@ def get_run_descriptor(self,run): else: return run # -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- def apply_absolute_normalization(self,sample_ws,monovan_run=None,ei_guess=None,wb_mono=None): """ Function applies absolute normalization factor to the target workspace and calculates this factor if necessary @@ -967,7 +968,7 @@ def apply_absolute_normalization(self,sample_ws,monovan_run=None,ei_guess=None,w sample_ws = sample_ws / absnorm_factor return sample_ws -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- def get_abs_normalization_factor(self,deltaE_wkspaceName,ei_monovan): """get absolute normalization factor for monochromatic vanadium @@ -1104,8 +1105,8 @@ def get_abs_normalization_factor(self,deltaE_wkspaceName,ei_monovan): def _build_white_tag(self): """ build tag indicating wb-integration ranges """ - low,upp=self.wb_integr_range - white_tag='NormBy:{0}_IntergatedIn:{1:0>10.2f}:{2:0>10.2f}'.format(self.normalise_method,low,upp) + low,upp = self.wb_integr_range + white_tag = 'NormBy:{0}_IntergatedIn:{1:0>10.2f}:{2:0>10.2f}'.format(self.normalise_method,low,upp) return white_tag # ------------------------------------------------------------------------------------------- @@ -1277,7 +1278,6 @@ def _get_wb_inegrals(self,run): #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- - def get_failed_spectra_list_from_masks(masked_wksp): """Compile a list of spectra numbers that are marked as masked in the masking workspace @@ -1291,7 +1291,7 @@ def get_failed_spectra_list_from_masks(masked_wksp): if masked_wksp is None: return (failed_spectra,0) - masking_wksp,sp_list=ExtractMask(masked_wksp) + masking_wksp,sp_list = ExtractMask(masked_wksp) DeleteWorkspace(masking_wksp) n_spectra = len(sp_list) @@ -1299,6 +1299,6 @@ def get_failed_spectra_list_from_masks(masked_wksp): #----------------------------------------------------------------- -if __name__=="__main__": +if __name__ == "__main__": pass #unittest.main() \ No newline at end of file From 7d734cc700f5dd8633849b7eb57c03ae744ed272 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Wed, 28 Jan 2015 22:20:54 +0000 Subject: [PATCH 091/130] Re #10958 Pylint warnings --- .../Inelastic/Direct/PropertiesDescriptors.py | 61 +++++++++++-------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py index 8bee8dec3485..d30efdd65a72 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py +++ b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py @@ -1,16 +1,15 @@ -""" File contains collection of Descriptors used to define complex properties in NonIDF_Properties and PropertyManager classes """ +""" File contains collection of Descriptors used to define complex + properties in NonIDF_Properties and PropertyManager classes +""" +import os from mantid.simpleapi import * from mantid import api from mantid.simpleapi import * -from mantid import geometry from mantid import config -from mantid.kernel import funcreturns - -import ReductionHelpers as prop_helpers -import CommonFunctions as common -import os +import Direct.ReductionHelpers as prop_helpers +import Direct.CommonFunctions as common #----------------------------------------------------------------------------------------- # Descriptors, providing overloads for complex properties in NonIDF_Properties @@ -19,7 +18,7 @@ class PropDescriptor(object): """ Class provides common custom interface for property descriptors """ def dependencies(self): - """ returns the list of other properties names, this property depends on""" + """ Returns the list of other properties names, this property depends on""" return [] # end PropDescriptor @@ -57,7 +56,7 @@ def __get__(self,instance,holder_class): # def __set__(self,instance,value): if not self._holder: - from PropertyManager import PropertyManager + from Direct.PropertyManager import PropertyManager self._holder = PropertyManager old_value = self._sum_runs @@ -82,7 +81,7 @@ def __set__(self,instance,value): self._sample_run.__set__(None,self._run_numbers[ind]) # def set_list2add(self,runs_to_add,fnames=None,fext=None): - """ Set run numbers to add together with possible file guess-es """ + """Set run numbers to add together with possible file guess-es """ if not isinstance(runs_to_add,list): raise KeyError('Can only set list of run numbers to add') runs = [] @@ -100,7 +99,7 @@ def set_list2add(self,runs_to_add,fnames=None,fext=None): self._fext = [''] * len(self._run_numbers) # def clear_sum(self): - """ clear all defined summation""" + """Clear all defined summation""" # if last_to_sum is -1, sum all run list provided self._last_ind2sum = -1 self._sum_runs = False @@ -109,15 +108,15 @@ def clear_sum(self): self._fext = [] # def get_last_ind2sum(self): - """ get last run number contributing to sum""" + """Get last run number contributing to sum""" if self._last_ind2sum > 0: return self._last_ind2sum else: return len(self._run_numbers) - 1 # def set_last_ind2sum(self,run_number): - """ check and set last number, contributing to summation - if this number is out of summation range, clear the summation + """Check and set last number, contributing to summation + if this number is out of summation range, clear the summation """ run_number = int(run_number) if run_number in self._run_numbers: @@ -128,7 +127,7 @@ def set_last_ind2sum(self,run_number): return 0 # def get_run_list2sum(self): - """ get run numbers of the files to be summed together """ + """Get run numbers of the files to be summed together """ num_to_load = len(self._run_numbers) if self._last_ind2sum > 0 and self._last_ind2sum < num_to_load: num_to_load = self._last_ind2sum @@ -136,17 +135,22 @@ def get_run_list2sum(self): # def load_and_sum_runs(self,inst_name,monitors_with_ws): + """ Load multiple runs and sum them together """ - logger = lambda mess : (getattr(getattr(self,'_holder'),'log')(self._sample_run._holder,mess)) + logger = lambda mess : (getattr(getattr(self,'_holder'),'log')\ + (self._sample_run._holder,mess)) logger("*** Summing multiple runs ****") runs_to_load = self.get_run_list2sum() num_to_load = len(runs_to_load) - logger("*** Loading #{0}/{1}, run N: {2} ".format(1,num_to_load,self._run_numbers[0])) + logger("*** Loading #{0}/{1}, run N: {2} ".\ + format(1,num_to_load,self._run_numbers[0])) - file_h = os.path.join(self._file_guess[0],'{0}{1}{2}'.format(inst_name,runs_to_load[0],self._fext[0])) - ws = self._sample_run.load_file(inst_name,'Summ',False,monitors_with_ws,False,file_hint=file_h) + file_h = os.path.join(self._file_guess[0],'{0}{1}{2}'.\ + format(inst_name,runs_to_load[0],self._fext[0])) + ws = self._sample_run.load_file(inst_name,'Summ',False,monitors_with_ws, + False,file_hint=file_h) sum_ws_name = ws.name() sum_mon_name = sum_ws_name + '_monitors' @@ -154,26 +158,31 @@ def load_and_sum_runs(self,inst_name,monitors_with_ws): for ind,run_num in enumerate(runs_to_load[1:num_to_load]): - file_h = os.path.join(self._file_guess[ind + 1],'{0}{1}{2}'.format(inst_name,run_num,self._fext[ind + 1])) - logger("*** Adding #{0}/{1}, run N: {2} ".format(ind + 2,num_to_load,run_num)) + file_h = os.path.join(self._file_guess[ind + 1],'{0}{1}{2}'.\ + format(inst_name,run_num,self._fext[ind + 1])) + logger("*** Adding #{0}/{1}, run N: {2} ".\ + format(ind + 2,num_to_load,run_num)) term_name = '{0}_ADDITIVE_#{1}/{2}'.format(inst_name,ind + 2,num_to_load)# - wsp = self._sample_run.load_file(inst_name,term_name,False,monitors_with_ws,False,file_hint=file_h) + wsp = self._sample_run.load_file(inst_name,term_name,False, + monitors_with_ws,False,file_hint=file_h) wsp_name = wsp.name() wsp_mon_name = wsp_name + '_monitors' - Plus(LHSWorkspace=sum_ws_name,RHSWorkspace=wsp_name,OutputWorkspace=sum_ws_name,ClearRHSWorkspace=True) + Plus(LHSWorkspace=sum_ws_name,RHSWorkspace=wsp_name, + OutputWorkspace=sum_ws_name,ClearRHSWorkspace=True) AddedRunNumbers+=',{0}'.format(run_num) if not monitors_with_ws: - Plus(LHSWorkspace=sum_mon_name,RHSWorkspace=wsp_mon_name,OutputWorkspace=sum_mon_name,ClearRHSWorkspace=True) + Plus(LHSWorkspace=sum_mon_name,RHSWorkspace=wsp_mon_name, + OutputWorkspace=sum_mon_name,ClearRHSWorkspace=True) if wsp_name in mtd: DeleteWorkspace(wsp_name) if wsp_mon_name in mtd: DeleteWorkspace(wsp_mon_name) - logger("*** Summing multiple runs completed ****") - AddSampleLog(Workspace=sum_ws_name,LogName = 'SumOfRuns:',LogText=AddedRunNumbers,LogType='String') + AddSampleLog(Workspace=sum_ws_name,LogName = 'SumOfRuns:', + LogText=AddedRunNumbers,LogType='String') ws = mtd[sum_ws_name] return ws # From a562cd23699f5bebafab1859aafdd64f5e6b4ff1 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Thu, 29 Jan 2015 09:24:29 +0000 Subject: [PATCH 092/130] Re #10958 Fixing error caused by following pylint suggestions This pylint is not harmless at all --- .../Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py index d30efdd65a72..c43ee0faae2e 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py +++ b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py @@ -4,9 +4,8 @@ import os from mantid.simpleapi import * -from mantid import api -from mantid.simpleapi import * -from mantid import config +from mantid.kernel import funcreturns +from mantid import api,geometry,config import Direct.ReductionHelpers as prop_helpers import Direct.CommonFunctions as common From 7ca2f6388fe302a5e374f2492729df40014e4ff9 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Thu, 29 Jan 2015 10:49:25 +0000 Subject: [PATCH 093/130] Re #10958 Minor bugs in validate_result ReductionWrapper script --- Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py index 9781de9e3762..cfdd3b0d2b58 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py @@ -148,11 +148,11 @@ def build_or_validate_result(self,sample_run,validationFile,build_validation=Fal if build_validation: if validationFile: - result_name = os.parh.splitext(validationFile)[0] + result_name = os.path.splitext(validationFile)[0] else: result_name = self.reducer.prop_man.save_file_name self.reducer.prop_man.log("*** Saving validation file with name: {0}.nxs".format(result_name),'notice') - SaveNexus(result,Filename=result_name+'.nxs') + SaveNexus(reduced,Filename=result_name+'.nxs') return True,'Created validation file {0}.nxs'.format(result_name) else: result = CheckWorkspacesMatch(Workspace1=sample,Workspace2=reduced, From 9700712e123326bb87b2eaa8fbb798515a59dce7 Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Thu, 29 Jan 2015 14:15:50 +0000 Subject: [PATCH 094/130] Re #10958 Fixing errors, induced by pylint --- .../Direct/DirectEnergyConversion.py | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py index 2a9210324690..2f71fa72bdf6 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py +++ b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py @@ -230,23 +230,24 @@ def diagnose(self, white,diag_sample=None,**kwargs): diagnostics.__Reducer__ = self diag_params['sample_run'] = diag_sample - # Set up the background integrals for diagnostic purposes - result_ws = self.normalise(diag_sample, self.normalise_method) - - #>>> here result workspace is being processed -- not touching - #result ws - bkgd_range = self.background_test_range - background_int = Integration(result_ws, - RangeLower=bkgd_range[0],RangeUpper=bkgd_range[1], - IncludePartialBins=True) - total_counts = Integration(result_ws, IncludePartialBins=True) - background_int = ConvertUnits(background_int, Target="Energy",EMode='Elastic', AlignBins=0) - self.prop_man.log("Diagnose: finished convertUnits ",'information') - - background_int *= self.scale_factor - diagnostics.normalise_background(background_int, whiteintegrals, diag_params.get('second_white',None)) - diag_params['background_int'] = background_int - diag_params['sample_counts'] = total_counts + # Set up the background integrals for diagnostic purposes + result_ws = self.normalise(diag_sample, self.normalise_method) + + #>>> here result workspace is being processed -- not touching + #result ws + bkgd_range = self.background_test_range + background_int = Integration(result_ws, + RangeLower=bkgd_range[0],RangeUpper=bkgd_range[1], + IncludePartialBins=True) + total_counts = Integration(result_ws, IncludePartialBins=True) + background_int = ConvertUnits(background_int, Target="Energy",EMode='Elastic', AlignBins=0) + self.prop_man.log("Diagnose: finished convertUnits ",'information') + + background_int *= self.scale_factor + diagnostics.normalise_background(background_int, whiteintegrals, + diag_params.get('second_white',None)) + diag_params['background_int'] = background_int + diag_params['sample_counts'] = total_counts # Check how we should run diag diag_spectra_blocks = self.diag_spectra @@ -355,9 +356,9 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, if self.use_sam_msk_on_monovan == True: prop_man.log(' Applying sample run mask to mono van') else: - if not self.use_hard_mask_only : # in this case the masking2 is different but points to the same workspace - # Should be better - # solution for that. + if not self.use_hard_mask_only : # in this case the masking2 is different but + #points to the same workspace + # Should be better solution for that. prop_man.log("======== Run diagnose for monochromatic vanadium run ===========",'notice') masking2 = self.diagnose(PropertyManager.wb_for_monovan_run,PropertyManager.monovan_run, @@ -513,7 +514,8 @@ def get_ei(self, data_run, ei_guess): # Calculate the incident energy ei,mon1_peak,mon1_index,tzero = \ - GetEi(InputWorkspace=monitor_ws, Monitor1Spec=int(ei_mon_spectra[0]), Monitor2Spec=int(ei_mon_spectra[1]), + GetEi(InputWorkspace=monitor_ws, Monitor1Spec=int(ei_mon_spectra[0]), + Monitor2Spec=int(ei_mon_spectra[1]), EnergyEstimate=ei_guess,FixEi=fix_ei) # Store found incident energy in the class itself @@ -524,7 +526,8 @@ def get_ei(self, data_run, ei_guess): # case) #Find TOF range, correspondent to incident energy monitor peak energy_rage = self.mon2_norm_energy_range - self._mon2_norm_time_range = self.get_TOF_for_energies(monitor_ws,energy_rage,[self.mon2_norm_spec],self._debug_mode) + self._mon2_norm_time_range = self.get_TOF_for_energies(monitor_ws,energy_rage, + [self.mon2_norm_spec],self._debug_mode) #end if separate_monitors: # copy incident energy obtained on monitor workspace to detectors From 2755216cf2cdabee64fb7c7246a132f0ba09ee60 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Fri, 30 Jan 2015 10:24:54 +0000 Subject: [PATCH 095/130] Refs #10938 Refactor out pi --- .../API/src/IPowderDiffPeakFunction.cpp | 3 +-- .../Algorithms/src/RayTracerTester.cpp | 6 ++++-- .../test/CopyInstrumentParametersTest.h | 7 ++++--- .../Algorithms/test/CorrectFlightPathsTest.h | 11 ++++++----- .../Algorithms/test/ExportTimeSeriesLogTest.h | 12 +++++------- Code/Mantid/Framework/Algorithms/test/FFTTest.h | 4 ++-- .../Algorithms/test/GenerateEventsFilterTest.h | 12 +++++------- .../test/GetTimeSeriesLogInformationTest.h | 12 +++++------- .../Framework/Algorithms/test/RRFMuonTest.h | 8 ++++---- .../Framework/Algorithms/test/RealFFTTest.h | 11 +++++------ .../Framework/Algorithms/test/SassenaFFTTest.h | 5 +---- .../CurveFitting/src/Bk2BkExpConvPV.cpp | 6 +++--- .../src/NeutronBk2BkExpConvPVoigt.cpp | 4 +--- .../CurveFitting/src/ReflectivityMulf.cpp | 13 ++++++------- .../src/ThermalNeutronBk2BkExpConvPVoigt.cpp | 7 +++---- .../src/ThermalNeutronDtoTOFFunction.cpp | 6 ++---- .../CurveFitting/test/ExpDecayOscTest.h | 3 ++- .../Framework/CurveFitting/test/GausOscTest.h | 3 ++- .../test/ThermalNeutronDtoTOFFunctionTest.h | 3 ++- .../Framework/DataHandling/src/LoadILLSANS.cpp | 3 ++- Code/Mantid/Framework/Geometry/test/LineTest.h | 9 ++++----- Code/Mantid/Framework/Geometry/test/PlaneTest.h | 10 +++++----- Code/Mantid/Framework/Kernel/test/VMDTest.h | 3 ++- .../MDAlgorithms/test/WeightedMeanMDTest.h | 6 +++--- .../MantidMDEvents/ReflectometryTransformKiKf.h | 11 +++++------ .../MantidMDEvents/ReflectometryTransformP.h | 15 +++++++-------- .../MDEvents/test/ConvToMDEventsVSHistoTest.h | 13 +++++++------ .../Framework/MDEvents/test/MDGridBoxTest.h | 5 +++-- .../test/ReflectometryTransformKiKfTest.h | 11 +++++------ .../MDEvents/test/ReflectometryTransformPTest.h | 13 ++++++------- .../test/ReflectometryTransformQxQzTest.h | 17 ++++++++--------- .../MDEvents/test/UnitsConversionHelperTest.h | 11 ++++++----- Code/Mantid/Framework/Nexus/test/NexusAPITest.h | 3 ++- .../python/mantid/api/ExperimentInfoTest.py | 5 +++-- .../UserAlgorithms/Muon_ExpDecayOscTest.cpp | 2 +- Code/Mantid/MantidPlot/src/ArrowMarker.cpp | 6 ++---- Code/Mantid/MantidPlot/src/AxesDialog.cpp | 6 ++---- Code/Mantid/MantidPlot/src/importOPJ.cpp | 7 ++++--- .../TestingTools/cxxtest/sample/DeltaTest.h | 11 +++++------ Code/Mantid/scripts/Inelastic/IndirectMuscat.py | 2 +- .../Reflectometry/isis_reflectometry/quick.py | 3 +-- 41 files changed, 147 insertions(+), 161 deletions(-) diff --git a/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp b/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp index 1d2c19c68188..f230bf331106 100644 --- a/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp +++ b/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp @@ -10,7 +10,6 @@ #include const double IGNOREDCHANGE = 1.0E-9; -const double PI = 3.14159265358979323846264338327950288419716939937510582; namespace Mantid { namespace API { @@ -271,7 +270,7 @@ std::complex E1(std::complex z) { exp_e1 = exp_e1 * exp(-z); if (rz < 0.0 && fabs(imag(z)) < 1.0E-10) { std::complex u(0.0, 1.0); - exp_e1 = exp_e1 - (PI * u); + exp_e1 = exp_e1 - (M_PI * u); } } diff --git a/Code/Mantid/Framework/Algorithms/src/RayTracerTester.cpp b/Code/Mantid/Framework/Algorithms/src/RayTracerTester.cpp index a67e7cbc3164..6a390948b7a0 100644 --- a/Code/Mantid/Framework/Algorithms/src/RayTracerTester.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RayTracerTester.cpp @@ -6,6 +6,8 @@ #include "MantidKernel/System.h" #include "MantidKernel/V3D.h" +#include + using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::DataObjects; @@ -66,9 +68,9 @@ void RayTracerTester::exec() { Progress prog(this, 0.3, 1.0, NumAzimuth); for (int iaz = 0; iaz < NumAzimuth; iaz++) { prog.report(); - double az = double(iaz) * 3.14159 * 2.0 / double(NumAzimuth); + double az = double(iaz) * M_PI * 2.0 / double(NumAzimuth); for (int iz = 0; iz < NumZenith; iz++) { - double zen = double(iz) * 3.14159 * 1.0 / double(NumZenith); + double zen = double(iz) * M_PI / double(NumZenith); double x = cos(az); double z = sin(az); double y = cos(zen); diff --git a/Code/Mantid/Framework/Algorithms/test/CopyInstrumentParametersTest.h b/Code/Mantid/Framework/Algorithms/test/CopyInstrumentParametersTest.h index 6ba3a32b5df3..ea77c58c5d99 100644 --- a/Code/Mantid/Framework/Algorithms/test/CopyInstrumentParametersTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CopyInstrumentParametersTest.h @@ -19,6 +19,7 @@ #include "MantidGeometry/Instrument/Component.h" #include "MantidDataHandling/LoadEmptyInstrument.h" #include "MantidGeometry/Instrument/ComponentHelper.h" +#include #include @@ -227,7 +228,7 @@ class CopyInstrumentParametersTestPerformance : public CxxTest::TestSuite for(size_t i=0;igetDetector(static_cast(i+1)); - Geometry::ComponentHelper::moveComponent(*det, *pmap, V3D(sin(3.1415926*double(i)),cos(3.1415926*double(i/500)),7), Absolute ); + Geometry::ComponentHelper::moveComponent(*det, *pmap, V3D(sin(M_PI*double(i)),cos(M_PI*double(i/500)),7), Absolute ); } // Create output workspace with another parameterized instrument and put into data store @@ -285,8 +286,8 @@ class CopyInstrumentParametersTestPerformance : public CxxTest::TestSuite int id = deto1->getID(); V3D newPos1 = deto1->getPos(); TS_ASSERT_EQUALS( id, i+1); - TS_ASSERT_DELTA( newPos1.X() ,sin(3.1415926*double(i)), 0.0001); - TS_ASSERT_DELTA( newPos1.Y() ,cos(3.1415926*double(i/500)), 0.0001); + TS_ASSERT_DELTA( newPos1.X() ,sin(M_PI*double(i)), 0.0001); + TS_ASSERT_DELTA( newPos1.Y() ,cos(M_PI*double(i/500)), 0.0001); TS_ASSERT_DELTA( newPos1.Z() , 7, 1.e-6); } diff --git a/Code/Mantid/Framework/Algorithms/test/CorrectFlightPathsTest.h b/Code/Mantid/Framework/Algorithms/test/CorrectFlightPathsTest.h index 4a2ae6905dbd..096b493bb6a0 100644 --- a/Code/Mantid/Framework/Algorithms/test/CorrectFlightPathsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CorrectFlightPathsTest.h @@ -11,6 +11,7 @@ #include "MantidKernel/ArrayProperty.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/IAlgorithm.h" +#include using namespace Mantid::API; using namespace Mantid; @@ -46,13 +47,13 @@ class CorrectFlightPathsTest: public CxxTest::TestSuite { std::string outputWSName("test_output_ws"); std::vector L2(5, 5); - std::vector polar(5, (30. / 180.) * 3.1415926); + std::vector polar(5, (30. / 180.) * M_PI); polar[0] = 0; std::vector azimutal(5, 0); - azimutal[1] = (45. / 180.) * 3.1415936; - azimutal[2] = (90. / 180.) * 3.1415936; - azimutal[3] = (135. / 180.) * 3.1415936; - azimutal[4] = (180. / 180.) * 3.1415936; + azimutal[1] = (45. / 180.) * M_PI; + azimutal[2] = (90. / 180.) * M_PI; + azimutal[3] = (135. / 180.) * M_PI; + azimutal[4] = (180. / 180.) * M_PI; int numBins = 10; Mantid::API::MatrixWorkspace_sptr dataws = WorkspaceCreationHelper::createProcessedInelasticWS(L2, polar, diff --git a/Code/Mantid/Framework/Algorithms/test/ExportTimeSeriesLogTest.h b/Code/Mantid/Framework/Algorithms/test/ExportTimeSeriesLogTest.h index 3ed848f8536e..61d208065a9c 100644 --- a/Code/Mantid/Framework/Algorithms/test/ExportTimeSeriesLogTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ExportTimeSeriesLogTest.h @@ -4,8 +4,11 @@ #include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" +#include #include #include +#include +#include #include "MantidAlgorithms/ExportTimeSeriesLog.h" #include "MantidDataObjects/EventWorkspace.h" @@ -21,10 +24,6 @@ #include "MantidDataHandling/LoadInstrument.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/UnitFactory.h" -#include -#include -#include -#include using namespace Mantid; using namespace Mantid::Algorithms; @@ -164,7 +163,6 @@ class ExportTimeSeriesLogTest : public CxxTest::TestSuite DataObjects::EventWorkspace_sptr createEventWorkspace() { using namespace WorkspaceCreationHelper; - double PI = 3.14159265; // 1. Empty workspace DataObjects::EventWorkspace_sptr eventws = @@ -199,7 +197,7 @@ class ExportTimeSeriesLogTest : public CxxTest::TestSuite while (curtime_ns < runstoptime_ns) { Kernel::DateAndTime curtime(curtime_ns); - double value = sin(PI*static_cast(curtime_ns)/period*0.25); + double value = sin(M_PI*static_cast(curtime_ns)/period*0.25); sinlog->addValue(curtime, value); curtime_ns += pulsetime_ns/4; ++ numevents; @@ -214,7 +212,7 @@ class ExportTimeSeriesLogTest : public CxxTest::TestSuite while (curtime_ns < runstoptime_ns) { Kernel::DateAndTime curtime(curtime_ns); - double value = sin(2*PI*static_cast(curtime_ns)/period); + double value = sin(2*M_PI*static_cast(curtime_ns)/period); coslog->addValue(curtime, value); curtime_ns += pulsetime_ns*2; } diff --git a/Code/Mantid/Framework/Algorithms/test/FFTTest.h b/Code/Mantid/Framework/Algorithms/test/FFTTest.h index 3118944ce0af..977333897908 100644 --- a/Code/Mantid/Framework/Algorithms/test/FFTTest.h +++ b/Code/Mantid/Framework/Algorithms/test/FFTTest.h @@ -1,6 +1,7 @@ #ifndef FFT_TEST_H_ #define FFT_TEST_H_ +#include #include #include "MantidAlgorithms/FFT.h" @@ -20,7 +21,7 @@ class FFTTest : public CxxTest::TestSuite static FFTTest *createSuite() { return new FFTTest(); } static void destroySuite( FFTTest *suite ) { delete suite; } - FFTTest():dX(0.2),PI(3.1415926535897932384626433832795),h(sqrt(PI/3)),a(PI*PI/3) + FFTTest():dX(0.2),h(sqrt(M_PI/3)),a(M_PI*M_PI/3) { } ~FFTTest() @@ -446,7 +447,6 @@ class FFTTest : public CxxTest::TestSuite } const double dX; - const double PI; const double h; const double a; }; diff --git a/Code/Mantid/Framework/Algorithms/test/GenerateEventsFilterTest.h b/Code/Mantid/Framework/Algorithms/test/GenerateEventsFilterTest.h index 4c74cb468f78..33816f2d7cdf 100644 --- a/Code/Mantid/Framework/Algorithms/test/GenerateEventsFilterTest.h +++ b/Code/Mantid/Framework/Algorithms/test/GenerateEventsFilterTest.h @@ -4,8 +4,11 @@ #include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" +#include #include #include +#include +#include #include "MantidAlgorithms/GenerateEventsFilter.h" #include "MantidDataObjects/EventWorkspace.h" @@ -22,10 +25,6 @@ #include "MantidDataHandling/LoadInstrument.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/UnitFactory.h" -#include -#include -#include -#include using namespace Mantid; using namespace Mantid::Algorithms; @@ -413,7 +412,6 @@ class GenerateEventsFilterTest : public CxxTest::TestSuite DataObjects::EventWorkspace_sptr createEventWorkspace() { using namespace WorkspaceCreationHelper; - double PI = 3.14159265; // Empty workspace DataObjects::EventWorkspace_sptr eventws = @@ -447,7 +445,7 @@ class GenerateEventsFilterTest : public CxxTest::TestSuite while (curtime_ns < runstoptime_ns) { Kernel::DateAndTime curtime(curtime_ns); - double value = sin(PI*static_cast(curtime_ns)/period*0.25); + double value = sin(M_PI*static_cast(curtime_ns)/period*0.25); sinlog->addValue(curtime, value); curtime_ns += pulsetime_ns/4; } @@ -460,7 +458,7 @@ class GenerateEventsFilterTest : public CxxTest::TestSuite while (curtime_ns < runstoptime_ns) { Kernel::DateAndTime curtime(curtime_ns); - double value = sin(2*PI*static_cast(curtime_ns)/period); + double value = sin(2*M_PI*static_cast(curtime_ns)/period); coslog->addValue(curtime, value); curtime_ns += pulsetime_ns*2; } diff --git a/Code/Mantid/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h b/Code/Mantid/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h index 91a1ef729c99..71c87b15f76e 100644 --- a/Code/Mantid/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h +++ b/Code/Mantid/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h @@ -4,8 +4,11 @@ #include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" +#include #include #include +#include +#include #include "MantidAlgorithms/GetTimeSeriesLogInformation.h" #include "MantidDataObjects/EventWorkspace.h" @@ -21,10 +24,6 @@ #include "MantidDataHandling/LoadInstrument.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/UnitFactory.h" -#include -#include -#include -#include using namespace Mantid; using namespace Mantid::Algorithms; @@ -72,7 +71,6 @@ class GetTimeSeriesLogInformationTest : public CxxTest::TestSuite DataObjects::EventWorkspace_sptr createEventWorkspace() { using namespace WorkspaceCreationHelper; - double PI = 3.14159265; // 1. Empty workspace DataObjects::EventWorkspace_sptr eventws = @@ -108,7 +106,7 @@ class GetTimeSeriesLogInformationTest : public CxxTest::TestSuite while (curtime_ns < runstoptime_ns) { Kernel::DateAndTime curtime(curtime_ns); - double value = sin(PI*static_cast(curtime_ns)/period*0.25); + double value = sin(M_PI*static_cast(curtime_ns)/period*0.25); sinlog->addValue(curtime, value); curtime_ns += pulsetime_ns/4; } @@ -121,7 +119,7 @@ class GetTimeSeriesLogInformationTest : public CxxTest::TestSuite while (curtime_ns < runstoptime_ns) { Kernel::DateAndTime curtime(curtime_ns); - double value = sin(2*PI*static_cast(curtime_ns)/period); + double value = sin(2*M_PI*static_cast(curtime_ns)/period); coslog->addValue(curtime, value); curtime_ns += pulsetime_ns*2; } diff --git a/Code/Mantid/Framework/Algorithms/test/RRFMuonTest.h b/Code/Mantid/Framework/Algorithms/test/RRFMuonTest.h index 56694d3e9816..106e4288e9d4 100644 --- a/Code/Mantid/Framework/Algorithms/test/RRFMuonTest.h +++ b/Code/Mantid/Framework/Algorithms/test/RRFMuonTest.h @@ -5,6 +5,7 @@ #include "MantidAlgorithms/RRFMuon.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/Workspace.h" +#include #include #include @@ -104,16 +105,15 @@ class RRFMuonTest : public CxxTest::TestSuite MatrixWorkspace_sptr createDummyWorkspace() { int nBins = 300; - double pi = 3.14159; MatrixWorkspace_sptr ws = WorkspaceFactory::Instance().create("Workspace2D", 2, nBins+1, nBins); for (int i=0; i(nBins); ws->dataX(0)[i] = x; - ws->dataY(0)[i] = cos(2*pi*x); + ws->dataY(0)[i] = cos(2*M_PI*x); ws->dataX(1)[i] = x; - ws->dataY(1)[i] = sin(2*pi*x); + ws->dataY(1)[i] = sin(2*M_PI*x); } ws->dataX(0)[nBins] = nBins; @@ -124,4 +124,4 @@ class RRFMuonTest : public CxxTest::TestSuite }; -#endif /* MANTID_ALGORITHMS_RRFMUON_H_ */ \ No newline at end of file +#endif /* MANTID_ALGORITHMS_RRFMUON_H_ */ diff --git a/Code/Mantid/Framework/Algorithms/test/RealFFTTest.h b/Code/Mantid/Framework/Algorithms/test/RealFFTTest.h index 36a37b04427e..efa709a6cced 100644 --- a/Code/Mantid/Framework/Algorithms/test/RealFFTTest.h +++ b/Code/Mantid/Framework/Algorithms/test/RealFFTTest.h @@ -2,6 +2,7 @@ #define REALFFT_TEST_H_ #include +#include #include "MantidAlgorithms/FFT.h" #include "MantidAPI/AnalysisDataService.h" @@ -88,9 +89,8 @@ class RealFFTTest : public CxxTest::TestSuite const MantidVec& Yr = fWS->readY(0); const MantidVec& Yi = fWS->readY(1); - const double PI = 3.1415926535897932384626433832795; - double h = sqrt(PI/3); - double a = PI*PI/3; + double h = sqrt(M_PI/3); + double a = M_PI*M_PI/3; double dx = 1/(XX); for(int i=0;ireadY(0); const MantidVec& Yi = fWS->readY(1); - const double PI = 3.1415926535897932384626433832795; - double h = sqrt(PI/3); - double a = PI*PI/3; + double h = sqrt(M_PI/3); + double a = M_PI*M_PI/3; double dx = 1/(XX); for(int i=0;i +#include #TODO HARDCODED INSTRUMENT #include "MantidAlgorithms/SassenaFFT.h" #include "MantidKernel/UnitFactory.h" #include "MantidDataHandling/SaveAscii.h" #include "MantidAPI/FileProperty.h" #include "MantidKernel/PhysicalConstants.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - using namespace Mantid; class SassenaFFTTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp b/Code/Mantid/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp index 9060b3b3f137..d3ada55e8992 100644 --- a/Code/Mantid/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp @@ -1,9 +1,9 @@ #include "MantidCurveFitting/Bk2BkExpConvPV.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" +#include #include -#define PI 3.14159265358979323846264338327950288419716939937510582 using namespace Mantid::Kernel; using namespace Mantid::API; @@ -159,7 +159,7 @@ double Bk2BkExpConvPV::calOmega(double x, double eta, double N, double alpha, if (eta < 1.0E-8) { omega2 = 0.0; } else { - omega2 = 2 * N * eta / PI * (imag(exp(p) * E1(p)) + imag(exp(q) * E1(q))); + omega2 = 2 * N * eta / M_PI * (imag(exp(p) * E1(p)) + imag(exp(q) * E1(q))); } double omega = omega1 + omega2; @@ -206,7 +206,7 @@ std::complex Bk2BkExpConvPV::E1(std::complex z) const { e1 = e1 * exp(-z); if (rz < 0.0 && fabs(imag(z)) < 1.0E-10) { complex u(0.0, 1.0); - e1 = e1 - (PI * u); + e1 = e1 - (M_PI * u); } } diff --git a/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp b/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp index 3e72b763a696..63457f7f7097 100644 --- a/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp @@ -10,9 +10,7 @@ #include #include -const double PI = 3.14159265358979323846264338327950288419716939937510582; const double PEAKRANGE = 5.0; -const double TWO_OVER_PI = 2. / PI; const double NEG_DBL_MAX = -1. * DBL_MAX; using namespace std; @@ -466,7 +464,7 @@ double NeutronBk2BkExpConvPVoigt::calOmega(const double x, const double eta, std::complex q(-beta * x, beta * SQRT_H_5); double omega2a = imag(exp(p) * Mantid::API::E1(p)); double omega2b = imag(exp(q) * Mantid::API::E1(q)); - omega2 = -1.0 * N * eta * (omega2a + omega2b) * TWO_OVER_PI; + omega2 = -1.0 * N * eta * (omega2a + omega2b) * M_2_PI; g_log.debug() << "Exp(p) = " << exp(p) << ", Exp(q) = " << exp(q) << ".\n"; diff --git a/Code/Mantid/Framework/CurveFitting/src/ReflectivityMulf.cpp b/Code/Mantid/Framework/CurveFitting/src/ReflectivityMulf.cpp index 10534e76ea50..17ab832f7de3 100644 --- a/Code/Mantid/Framework/CurveFitting/src/ReflectivityMulf.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/ReflectivityMulf.cpp @@ -1,8 +1,7 @@ #include "MantidCurveFitting/ReflectivityMulf.h" #include "MantidAPI/FunctionFactory.h" #include - -#define PI 3.14159265358979323846264338327950288419716939937510582 +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -92,7 +91,7 @@ void ReflectivityMulf::function1D(double *out, const double *xValues, std::complex a321(0.0, 0.0); std::complex a322(0.0, 0.0); - double theta0 = coeff[0] * PI / 180.0; + double theta0 = coeff[0] * M_PI / 180.0; double scalefac = coeff[1]; rnbn[0] = coeff[2]; rnbn[m_nlayer + 1] = coeff[3]; @@ -130,11 +129,11 @@ void ReflectivityMulf::function1D(double *out, const double *xValues, // Could be parallelized at this point for (size_t j = 0; j < nData; ++j) { - double lambda = 4 * PI * sin(theta0) / xValues[j]; + double lambda = 4 * M_PI * sin(theta0) / xValues[j]; cy[j] = 0.0; double tl = lambda * lambda; - double tlc = 8.0 * PI * PI / tl; - double con = tl / (2.0 * PI); + double tlc = 8.0 * M_PI * M_PI / tl; + double con = tl / (2.0 * M_PI); for (k = 0; k < m_nlayer + 2; k++) { rnfn[k] = (1.0 - con * rnbn[k]); @@ -157,7 +156,7 @@ void ReflectivityMulf::function1D(double *out, const double *xValues, pfn[m_nlayer + 1] = sqrt(rnf - (rnf1 * ct0 * ct0)); for (int i = 1; i < m_nlayer + 1; i++) { - betan[i] = 2.0 * PI * dn[i] * pfn[i] / lambda; + betan[i] = 2.0 * M_PI * dn[i] * pfn[i] / lambda; } a111 = cr; diff --git a/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp b/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp index d32c814bbe8c..8201f593d913 100644 --- a/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp @@ -6,12 +6,11 @@ #include "MantidKernel/ConfigService.h" +#include #include #include -const double PI = 3.14159265358979323846264338327950288419716939937510582; const double PEAKRANGE = 5.0; -const double TWO_OVER_PI = 2. / PI; const double NEG_DBL_MAX = -1. * DBL_MAX; using namespace std; @@ -572,7 +571,7 @@ double ThermalNeutronBk2BkExpConvPVoigt::calOmega( std::complex q(-beta * x, beta * SQRT_H_5); double omega2a = imag(exp(p) * Mantid::API::E1(p)); double omega2b = imag(exp(q) * Mantid::API::E1(q)); - omega2 = -1.0 * N * eta * (omega2a + omega2b) * TWO_OVER_PI; + omega2 = -1.0 * N * eta * (omega2a + omega2b) * M_2_PI; } const double omega = omega1 + omega2; @@ -713,7 +712,7 @@ std::complex E1X(std::complex z) if (rz < 0.0 && fabs(imag(z)) < 1.0E-10 ) { complex u(0.0, 1.0); - exp_e1 = exp_e1 - (PI * u); + exp_e1 = exp_e1 - (M_PI * u); } } diff --git a/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp b/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp index 05ae65dd6509..71129f3425a6 100644 --- a/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp @@ -5,8 +5,6 @@ #include #include -#define PI 3.14159265358979323846264338327950288419716939937510 - using namespace Mantid::API; using namespace std; @@ -116,9 +114,9 @@ void ThermalNeutronDtoTOFFunction::functionDeriv1D(Jacobian *out, double deriv_zero = n; double deriv_zerot = (1 - n); double deriv_width = -(zero + dtt1 * x - zerot - dtt1t * x + dtt2t / x) * - exp(-u * u) / sqrt(PI) * (tcross - 1 / x); + exp(-u * u) / sqrt(M_PI) * (tcross - 1 / x); double deriv_tcross = -(zero + dtt1 * x - zerot - dtt1t * x + dtt2t / x) * - exp(-u * u) / sqrt(PI) * width; + exp(-u * u) / sqrt(M_PI) * width; // b) Set out->set(i, 0, deriv_dtt1); diff --git a/Code/Mantid/Framework/CurveFitting/test/ExpDecayOscTest.h b/Code/Mantid/Framework/CurveFitting/test/ExpDecayOscTest.h index cc7895353020..36a81b2acbef 100644 --- a/Code/Mantid/Framework/CurveFitting/test/ExpDecayOscTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/ExpDecayOscTest.h @@ -2,6 +2,7 @@ #define EXPDECAYOSCTEST_H_ #include +#include #include "MantidCurveFitting/ExpDecayOsc.h" #include "MantidCurveFitting/Fit.h" @@ -102,7 +103,7 @@ class ExpDecayOscTest : public CxxTest::TestSuite TS_ASSERT_DELTA( out->getParameter("A"), 5 ,0.01); TS_ASSERT_DELTA( out->getParameter("Lambda"), 1/3.0 ,0.01); TS_ASSERT_DELTA( out->getParameter("Frequency"), 1/8.0 ,0.01); // Period of 8 - TS_ASSERT_DELTA( out->getParameter("Phi"), 3.1415926536/4.0 ,0.01); // 45 degrees + TS_ASSERT_DELTA( out->getParameter("Phi"), M_PI_4 ,0.01); // 45 degrees // check it categories const std::vector categories = out->categories(); diff --git a/Code/Mantid/Framework/CurveFitting/test/GausOscTest.h b/Code/Mantid/Framework/CurveFitting/test/GausOscTest.h index 48d9ebff2df6..1df2d7a16c2e 100644 --- a/Code/Mantid/Framework/CurveFitting/test/GausOscTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/GausOscTest.h @@ -2,6 +2,7 @@ #define GAUSOSCTEST_H_ #include +#include #include "MantidCurveFitting/GausOsc.h" #include "MantidAPI/CompositeFunction.h" @@ -112,7 +113,7 @@ class GausOscTest : public CxxTest::TestSuite TS_ASSERT_DELTA( out->getParameter("A"), 128.7 ,0.9); TS_ASSERT_DELTA( out->getParameter("Sigma"), 0.35 ,0.005); TS_ASSERT_DELTA( out->getParameter("Frequency"), 1/8.0 ,0.01); // Period of 8 - TS_ASSERT_DELTA( out->getParameter("Phi"), 3.1415926536/4.0 ,0.01); // 45 degrees + TS_ASSERT_DELTA( out->getParameter("Phi"), M_PI_4 ,0.01); // 45 degrees // check its categories const std::vector categories = out->categories(); diff --git a/Code/Mantid/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h b/Code/Mantid/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h index e966ea06701b..e2c9c68b0c8e 100644 --- a/Code/Mantid/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h @@ -2,6 +2,7 @@ #define MANTID_CURVEFITTING_THERMALNEUTRONDTOTOFFUNCTIONTEST_H_ #include +#include #include #include #include @@ -75,7 +76,7 @@ class ThermalNeutronDtoTOFFunctionTest : public CxxTest::TestSuite for (double x = -10; x < 10; x+=0.01) { double a = erfc(x); - double da = -2*exp(-x*x)/sqrt(3.14159265); + double da = -2*exp(-x*x)/sqrt(M_PI); xvec.push_back(x); erfcy.push_back(a); derfc.push_back(da); diff --git a/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp b/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp index 3b6d12bde578..6c3b96b5807b 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp @@ -3,6 +3,7 @@ #include "MantidAPI/RegisterFileLoader.h" #include "MantidKernel/UnitFactory.h" +#include #include #include // std::accumulate @@ -585,7 +586,7 @@ void LoadILLSANS::loadMetaData(const NeXus::NXEntry &entry, */ double LoadILLSANS::calculateQ(const double lambda, const double twoTheta) const { - return (4 * 3.1415936 * std::sin(twoTheta * (3.1415936 / 180) / 2)) / + return (4 * M_PI * std::sin(twoTheta * (M_PI / 180) / 2)) / (lambda); } diff --git a/Code/Mantid/Framework/Geometry/test/LineTest.h b/Code/Mantid/Framework/Geometry/test/LineTest.h index 2b2d4fcf56ba..91c959dddad8 100644 --- a/Code/Mantid/Framework/Geometry/test/LineTest.h +++ b/Code/Mantid/Framework/Geometry/test/LineTest.h @@ -65,17 +65,16 @@ class LineTest: public CxxTest::TestSuite void makeMatrix(Matrix& A) const { - const double pi=3.141592653589793238462643383279502884197169399375 ; A.setMem(3,3); A[0][0]=1.0; A[1][0]=0.0; A[0][1]=0.0; A[0][2]=0.0; A[2][0]=0.0; - A[1][1]=cos(90.0*pi/180.0); - A[2][1]=-sin(90.0*pi/180.0); - A[1][2]=sin(90.0*pi/180.0); - A[2][2]=cos(90.0*pi/180.0); + A[1][1]=cos(90.0*M_PI/180.0); + A[2][1]=-sin(90.0*M_PI/180.0); + A[1][2]=sin(90.0*M_PI/180.0); + A[2][2]=cos(90.0*M_PI/180.0); return; } diff --git a/Code/Mantid/Framework/Geometry/test/PlaneTest.h b/Code/Mantid/Framework/Geometry/test/PlaneTest.h index d1de354bf22b..2ab7090221a5 100644 --- a/Code/Mantid/Framework/Geometry/test/PlaneTest.h +++ b/Code/Mantid/Framework/Geometry/test/PlaneTest.h @@ -2,6 +2,7 @@ #define MANTID_PLANETEST__ #include +#include #include "MantidKernel/V3D.h" #include "MantidGeometry/Surfaces/Quadratic.h" #include "MantidGeometry/Surfaces/Plane.h" @@ -138,17 +139,16 @@ public : void makeMatrix(Matrix& A) const { - const double pi=3.141592653589793238462643383279502884197169399375 ; A.setMem(3,3); A[0][0]=1.0; A[1][0]=0.0; A[0][1]=0.0; A[0][2]=0.0; A[2][0]=0.0; - A[1][1]=cos(90.0*pi/180.0); - A[2][1]=-sin(90.0*pi/180.0); - A[1][2]=sin(90.0*pi/180.0); - A[2][2]=cos(90.0*pi/180.0); + A[1][1]=cos(90.0*M_PI/180.0); + A[2][1]=-sin(90.0*M_PI/180.0); + A[1][2]=sin(90.0*M_PI/180.0); + A[2][2]=cos(90.0*M_PI/180.0); return; } diff --git a/Code/Mantid/Framework/Kernel/test/VMDTest.h b/Code/Mantid/Framework/Kernel/test/VMDTest.h index 4f6323da480d..7a5d4d4ef53d 100644 --- a/Code/Mantid/Framework/Kernel/test/VMDTest.h +++ b/Code/Mantid/Framework/Kernel/test/VMDTest.h @@ -4,6 +4,7 @@ #include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" +#include #include #include @@ -174,7 +175,7 @@ class VMDTest : public CxxTest::TestSuite { VMD a(1,0,0); VMD b(0,1,0); - TS_ASSERT_DELTA( a.angle(b), 3.1415926/2, 1e-4); + TS_ASSERT_DELTA( a.angle(b), M_PI_2, 1e-4); } void test_toString() diff --git a/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h index 44d77d9db22b..7ef1e56809f5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h @@ -4,6 +4,7 @@ #include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" +#include #include #include #include "MantidTestHelpers/MDEventsTestHelper.h" @@ -193,12 +194,11 @@ class WeightedMeanMDTest : public CxxTest::TestSuite { //Create some input data. Signal values as two offset sine waves. typedef std::vector VecDouble; - double pi = 3.14159; VecDouble s1, s2, e1, e2, x; double theta_shift=0.4; for(size_t i = 0; i < 40; ++i) { - double theta = 0.02 * double(i) * pi; + double theta = 0.02 * double(i) * M_PI; s1.push_back(std::sin(theta)); e1.push_back(std::sin(theta)); s2.push_back(std::sin(theta+theta_shift)); @@ -248,4 +248,4 @@ class WeightedMeanMDTest : public CxxTest::TestSuite }; -#endif /* MANTID_MDALGORITHMS_WEIGHTEDMEANMDTEST_H_ */ \ No newline at end of file +#endif /* MANTID_MDALGORITHMS_WEIGHTEDMEANMDTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformKiKf.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformKiKf.h index 088a39a39546..d33861ca56a7 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformKiKf.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformKiKf.h @@ -1,6 +1,8 @@ #ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKF_H_ #define MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKF_H_ +#include + #include "MantidKernel/System.h" #include "MantidKernel/ClassMacros.h" #include "MantidAPI/MatrixWorkspace.h" @@ -15,18 +17,15 @@ a theta value (in degrees) and a wavelength */ class CalculateReflectometryK { private: - double to_radians_factor; - double two_pi; double m_theta; public: CalculateReflectometryK(double theta) - : to_radians_factor(3.14159265 / 180), two_pi(6.28318531), - m_theta(theta) {} + : m_theta(theta) {} ~CalculateReflectometryK(){}; double execute(const double &wavelength) { - double wavenumber = two_pi / wavelength; - return wavenumber * sin(to_radians_factor * m_theta); + double wavenumber = 2 * M_PI / wavelength; + return wavenumber * sin(M_PI / 180.0 * m_theta); } }; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformP.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformP.h index dd1290cdb1a7..237b88e25d45 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformP.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformP.h @@ -1,6 +1,8 @@ #ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMP_H_ #define MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMP_H_ +#include + #include "MantidKernel/System.h" #include "MantidMDEvents/ReflectometryTransform.h" @@ -12,20 +14,17 @@ class CalculateReflectometryPBase: Base class for p-type transforms. */ class CalculateReflectometryPBase { protected: - const double to_radians_factor; - const double two_pi; double m_sinThetaInitial; double m_sinThetaFinal; - CalculateReflectometryPBase(const double &thetaIncident) - : to_radians_factor(3.14159265 / 180), two_pi(6.28318531) { - m_sinThetaInitial = sin(to_radians_factor * thetaIncident); + CalculateReflectometryPBase(const double &thetaIncident) { + m_sinThetaInitial = sin(M_PI / 180.0 * thetaIncident); } ~CalculateReflectometryPBase() {} public: void setThetaFinal(const double &thetaFinal) { - m_sinThetaFinal = sin(to_radians_factor * thetaFinal); + m_sinThetaFinal = sin(M_PI / 180.0 * thetaFinal); } }; @@ -38,7 +37,7 @@ class CalculateReflectometryDiffP : public CalculateReflectometryPBase { : CalculateReflectometryPBase(thetaInitial) {} ~CalculateReflectometryDiffP(){}; double execute(const double &wavelength) { - double wavenumber = two_pi / wavelength; + double wavenumber = 2 * M_PI / wavelength; double ki = wavenumber * m_sinThetaInitial; double kf = wavenumber * m_sinThetaFinal; return ki - kf; @@ -54,7 +53,7 @@ class CalculateReflectometrySumP : public CalculateReflectometryPBase { : CalculateReflectometryPBase(thetaInitial) {} ~CalculateReflectometrySumP(){}; double execute(const double &wavelength) { - double wavenumber = two_pi / wavelength; + double wavenumber = 2 * M_PI / wavelength; double ki = wavenumber * m_sinThetaInitial; double kf = wavenumber * m_sinThetaFinal; return ki + kf; diff --git a/Code/Mantid/Framework/MDEvents/test/ConvToMDEventsVSHistoTest.h b/Code/Mantid/Framework/MDEvents/test/ConvToMDEventsVSHistoTest.h index d77e4fada0f7..44ee71342358 100644 --- a/Code/Mantid/Framework/MDEvents/test/ConvToMDEventsVSHistoTest.h +++ b/Code/Mantid/Framework/MDEvents/test/ConvToMDEventsVSHistoTest.h @@ -2,6 +2,7 @@ #define CONVERT2_MDEVENTS_METHODS_TEST_H_ #include +#include #include "MantidKernel/UnitFactory.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -215,13 +216,13 @@ logProvider(100) API::FrameworkManager::Instance(); std::vector L2(5,5); - std::vector polar(5,(30./180.)*3.1415926); + std::vector polar(5,(30./180.)*M_PI); polar[0]=0; std::vector azimutal(5,0); - azimutal[1]=(45./180.)*3.1415936; - azimutal[2]=(90./180.)*3.1415936; - azimutal[3]=(135./180.)*3.1415936; - azimutal[4]=(180./180.)*3.1415936; + azimutal[1]=(45./180.)*M_PI; + azimutal[2]=(90./180.)*M_PI; + azimutal[3]=(135./180.)*M_PI; + azimutal[4]=(180./180.)*M_PI; int numBins=10; ws2D =WorkspaceCreationHelper::createProcessedInelasticWS(L2, polar, azimutal,numBins,-1,3,3); @@ -319,4 +320,4 @@ EventWorkspace_sptr convertToEvents(DataObjects::Workspace2D_const_sptr inWS) -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h b/Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h index 523dee6d13ff..455454dbb3dc 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h +++ b/Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1670,7 +1671,7 @@ class MDGridBoxTestPerformance : public CxxTest::TestSuite void test_sphereIntegrate_inTheMiddle() { coord_t center[3] = {2.5, 2.5, 2.5}; - do_test_sphereIntegrate(center, 1.0, (1e6/125)*(4.0*3.14159/3.0), 2000.0); + do_test_sphereIntegrate(center, 1.0, (1e6/125)*(4.0*M_PI/3.0), 2000.0); } /** Huge sphere containing all within */ @@ -1733,7 +1734,7 @@ class MDGridBoxTestPerformance : public CxxTest::TestSuite void test_sphereCentroid_inTheMiddle() { coord_t center[3] = {2.5, 2.5, 2.5}; - do_test_sphereCentroid(center, 1.0, (1e6/125)*(4.0*3.14159/3.0), 2000); + do_test_sphereCentroid(center, 1.0, (1e6/125)*(4.0*M_PI/3.0), 2000); } /** Huge sphere containing all within */ diff --git a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformKiKfTest.h b/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformKiKfTest.h index 96d0f2d06139..0623b8459d0d 100644 --- a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformKiKfTest.h +++ b/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformKiKfTest.h @@ -1,9 +1,8 @@ #ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKFTEST_H_ #define MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKFTEST_H_ -#define PI 3.14159265 - #include +#include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include @@ -103,11 +102,11 @@ class ReflectometryTransformKiKfTest : public CxxTest::TestSuite //Sine 90 = 1 CalculateReflectometryK B(90); - TS_ASSERT_DELTA(2*PI/wavelength, B.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(2*M_PI/wavelength, B.execute(wavelength), 0.0001); //Sine 270 = -1 CalculateReflectometryK C(270); - TS_ASSERT_DELTA(-2*PI/wavelength, C.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(-2*M_PI/wavelength, C.execute(wavelength), 0.0001); } void test_recalculate_k() @@ -115,10 +114,10 @@ class ReflectometryTransformKiKfTest : public CxxTest::TestSuite const double wavelength = 1; CalculateReflectometryK A(90); - TS_ASSERT_DELTA(2*PI/wavelength, A.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(2*M_PI/wavelength, A.execute(wavelength), 0.0001); //Now re-execute on the same calculation object. - TS_ASSERT_DELTA(PI/wavelength, A.execute(2*wavelength), 0.0001); + TS_ASSERT_DELTA(M_PI/wavelength, A.execute(2*wavelength), 0.0001); } diff --git a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformPTest.h b/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformPTest.h index e1a043d9507b..16869709c7c4 100644 --- a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformPTest.h +++ b/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformPTest.h @@ -1,9 +1,8 @@ #ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMPTEST_H_ #define MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMPTEST_H_ -#define PI 3.14159265 - #include +#include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include @@ -103,11 +102,11 @@ class ReflectometryTransformPTest : public CxxTest::TestSuite CalculateReflectometryDiffP B(90); B.setThetaFinal(0); - TS_ASSERT_DELTA(2*PI/wavelength, B.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(2*M_PI/wavelength, B.execute(wavelength), 0.0001); CalculateReflectometryDiffP C(0); C.setThetaFinal(90); - TS_ASSERT_DELTA(-2*PI/wavelength, C.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(-2*M_PI/wavelength, C.execute(wavelength), 0.0001); CalculateReflectometryDiffP D(90); D.setThetaFinal(90); @@ -124,15 +123,15 @@ class ReflectometryTransformPTest : public CxxTest::TestSuite CalculateReflectometrySumP B(90); B.setThetaFinal(0); - TS_ASSERT_DELTA(2*PI/wavelength, B.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(2*M_PI/wavelength, B.execute(wavelength), 0.0001); CalculateReflectometrySumP C(0); C.setThetaFinal(90); - TS_ASSERT_DELTA(2*PI/wavelength, C.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(2*M_PI/wavelength, C.execute(wavelength), 0.0001); CalculateReflectometrySumP D(90); D.setThetaFinal(90); - TS_ASSERT_DELTA(4*PI/wavelength, D.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(4*M_PI/wavelength, D.execute(wavelength), 0.0001); } }; diff --git a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformQxQzTest.h b/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformQxQzTest.h index 15dfe8f852fb..7447313ccaed 100644 --- a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformQxQzTest.h +++ b/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformQxQzTest.h @@ -1,9 +1,8 @@ #ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANFORMQXQZTEST_H_ #define MANTID_MDEVENTS_REFLECTOMETRYTRANFORMQXQZTEST_H_ -#define PI 3.14159265 - #include +#include #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include @@ -100,13 +99,13 @@ class ReflectometryTransformQxQzTest : public CxxTest::TestSuite void test_calculate_Qx() { - //Set up calculation so that it collapses down to 2*PI/wavelength by setting initial theta to PI/2 and final theta to zero + //Set up calculation so that it collapses down to 2*M_PI/wavelength by setting initial theta to M_PI/2 and final theta to zero CalculateReflectometryQx calculator(90); double qx; const double wavelength = 0.1; TS_ASSERT_THROWS_NOTHING(calculator.setThetaFinal(0)); TS_ASSERT_THROWS_NOTHING(qx = calculator.execute(wavelength)); - TS_ASSERT_DELTA(2*PI/wavelength, qx, 0.0001); + TS_ASSERT_DELTA(2*M_PI/wavelength, qx, 0.0001); } void test_recalculate_Qx() @@ -118,7 +117,7 @@ class ReflectometryTransformQxQzTest : public CxxTest::TestSuite //Now reset the final theta and should be able to re-execute calculator.setThetaFinal(90); - TS_ASSERT_DELTA(-2*PI/wavelength, calculator.execute(wavelength), 0.0001); + TS_ASSERT_DELTA(-2*M_PI/wavelength, calculator.execute(wavelength), 0.0001); } //---- End Tests for Qx Calculator ---- // @@ -127,13 +126,13 @@ class ReflectometryTransformQxQzTest : public CxxTest::TestSuite void test_calculate_Qz() { - //Set up calculation so that it collapses down to 2*PI/wavelength + //Set up calculation so that it collapses down to 2*M_PI/wavelength CalculateReflectometryQz calculator(0); double qx; const double wavelength = 0.1; TS_ASSERT_THROWS_NOTHING(calculator.setThetaFinal(90)); TS_ASSERT_THROWS_NOTHING(qx = calculator.execute(wavelength)); - TS_ASSERT_DELTA(2*PI/wavelength, qx, 0.0001); + TS_ASSERT_DELTA(2*M_PI/wavelength, qx, 0.0001); } void test_recalculate_Qz() @@ -141,11 +140,11 @@ class ReflectometryTransformQxQzTest : public CxxTest::TestSuite CalculateReflectometryQz calculator(90); calculator.setThetaFinal(90); const double wavelength = 0.1; - TS_ASSERT_DELTA(2*(2*PI/wavelength), calculator.execute(wavelength), 0.001); + TS_ASSERT_DELTA(2*(2*M_PI/wavelength), calculator.execute(wavelength), 0.001); //Now reset the final theta and should be able to re-execute calculator.setThetaFinal(0); - TS_ASSERT_DELTA(2*PI/wavelength, calculator.execute(wavelength), 0.001); + TS_ASSERT_DELTA(2*M_PI/wavelength, calculator.execute(wavelength), 0.001); } //---- End Tests for Qz Calculator ---- // diff --git a/Code/Mantid/Framework/MDEvents/test/UnitsConversionHelperTest.h b/Code/Mantid/Framework/MDEvents/test/UnitsConversionHelperTest.h index a7a12931329d..24bf81fb1035 100644 --- a/Code/Mantid/Framework/MDEvents/test/UnitsConversionHelperTest.h +++ b/Code/Mantid/Framework/MDEvents/test/UnitsConversionHelperTest.h @@ -2,6 +2,7 @@ #define CONVERT2_MDEVENTS_UNITS_CONVERSION_TEST_H_ #include +#include #include "MantidAPI/FrameworkManager.h" #include "MantidKernel/UnitFactory.h" @@ -257,13 +258,13 @@ class UnitsConversionHelperTest : public CxxTest::TestSuite API::FrameworkManager::Instance(); std::vector L2(5,5); - std::vector polar(5,(30./180.)*3.1415926); + std::vector polar(5,(30./180.)*M_PI); polar[0]=0; std::vector azimutal(5,0); - azimutal[1]=(45./180.)*3.1415936; - azimutal[2]=(90./180.)*3.1415936; - azimutal[3]=(135./180.)*3.1415936; - azimutal[4]=(180./180.)*3.1415936; + azimutal[1]=(45./180.)*M_PI; + azimutal[2]=(90./180.)*M_PI; + azimutal[3]=(135./180.)*M_PI; + azimutal[4]=(180./180.)*M_PI; int numBins=10; ws2D =WorkspaceCreationHelper::createProcessedInelasticWS(L2, polar, azimutal,numBins,-1,3,3); diff --git a/Code/Mantid/Framework/Nexus/test/NexusAPITest.h b/Code/Mantid/Framework/Nexus/test/NexusAPITest.h index 230aa42cc51f..29c836431c23 100644 --- a/Code/Mantid/Framework/Nexus/test/NexusAPITest.h +++ b/Code/Mantid/Framework/Nexus/test/NexusAPITest.h @@ -15,6 +15,7 @@ #include "MantidNexusCPP/NeXusFile.hpp" #include "MantidNexusCPP/NeXusException.hpp" +#include #include #include #include @@ -135,7 +136,7 @@ class NexusAPITest : public CxxTest::TestSuite // add some attributes file.putAttr("ch_attribute", "NeXus"); file.putAttr("i4_attribute", 42); - file.putAttr("r4_attribute", 3.14159265); + file.putAttr("r4_attribute", M_PI); // set up for creating a link NXlink link = file.getDataID(); diff --git a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/ExperimentInfoTest.py b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/ExperimentInfoTest.py index 7b69b5b74f63..121f0d60a15f 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/ExperimentInfoTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/ExperimentInfoTest.py @@ -6,6 +6,7 @@ from testhelpers import run_algorithm, WorkspaceCreationHelper from mantid.geometry import Instrument from mantid.api import Sample, Run +from math import pi class ExperimentInfoTest(unittest.TestCase): @@ -37,8 +38,8 @@ def test_get_energy_mode(self): # def test_set_and_get_efixed(self): # ws = WorkspaceCreationHelper.create2DWorkspaceWithFullInstrument(1, 5, False, False) -# ws.setEFixed(1, 3.1415) -# self.assertEquals(ws.getEFixed(1), 3.1415) +# ws.setEFixed(1, pi) +# self.assertEquals(ws.getEFixed(1), pi) if __name__ == '__main__': unittest.main() diff --git a/Code/Mantid/Framework/UserAlgorithms/Muon_ExpDecayOscTest.cpp b/Code/Mantid/Framework/UserAlgorithms/Muon_ExpDecayOscTest.cpp index 6c95e96754eb..e27dcbf2c7a5 100644 --- a/Code/Mantid/Framework/UserAlgorithms/Muon_ExpDecayOscTest.cpp +++ b/Code/Mantid/Framework/UserAlgorithms/Muon_ExpDecayOscTest.cpp @@ -29,7 +29,7 @@ void Muon_ExpDecayOscTest::functionLocal(double *out, const double *xValues, for (size_t i = 0; i < nData; i++) { out[i] = gA0 * exp(-gs * xValues[i]) * - cos(2 * 3.1415926536 * gf * xValues[i] + gphi); + cos(2 * M_PI * gf * xValues[i] + gphi); } } void Muon_ExpDecayOscTest::functionDeriv(const API::FunctionDomain &domain, diff --git a/Code/Mantid/MantidPlot/src/ArrowMarker.cpp b/Code/Mantid/MantidPlot/src/ArrowMarker.cpp index 7862d2716983..08b801321437 100644 --- a/Code/Mantid/MantidPlot/src/ArrowMarker.cpp +++ b/Code/Mantid/MantidPlot/src/ArrowMarker.cpp @@ -29,6 +29,8 @@ #include "ArrowMarker.h" #include "LineDialog.h" +#include + #include #include #include @@ -37,10 +39,6 @@ #include #include -#ifndef M_PI -#define M_PI 3.141592653589793238462643; -#endif - ArrowMarker::ArrowMarker(): d_start_arrow(false), d_end_arrow(true), diff --git a/Code/Mantid/MantidPlot/src/AxesDialog.cpp b/Code/Mantid/MantidPlot/src/AxesDialog.cpp index 68bce131f2e9..70b07044288a 100644 --- a/Code/Mantid/MantidPlot/src/AxesDialog.cpp +++ b/Code/Mantid/MantidPlot/src/AxesDialog.cpp @@ -42,6 +42,8 @@ Description : General plot options dialog #include "ScaleDraw.h" #include +#include + #include "MantidKernel/Logger.h" #include @@ -621,10 +623,6 @@ static const char* image7_data[] = { "32 32 4 1", "# c #000000", "b c #bfbfbf", "....#.#.#.#.#.#.#.#.#.#.#.#.....", "........#.....#.....#.....#.....", "................................" }; -#ifndef M_PI -#define M_PI 3.141592653589793238462643 -#endif - namespace { Mantid::Kernel::Logger g_log("AxisDialog"); diff --git a/Code/Mantid/MantidPlot/src/importOPJ.cpp b/Code/Mantid/MantidPlot/src/importOPJ.cpp index f6a1a6000456..b2119173399b 100644 --- a/Code/Mantid/MantidPlot/src/importOPJ.cpp +++ b/Code/Mantid/MantidPlot/src/importOPJ.cpp @@ -28,6 +28,8 @@ ***************************************************************************/ #include "importOPJ.h" +#include + #include #include #include @@ -538,7 +540,6 @@ bool ImportOPJ::importNotes(const OPJFile& opj) bool ImportOPJ::importGraphs(const OPJFile& opj) { - double pi=3.141592653589793; int visible_count=0; int tickTypeMap[]={0,3,1,2}; for (int g=0; g -#include +#include class DeltaTest : public CxxTest::TestSuite { - double _pi, _delta; + double _delta; public: void setUp() { - _pi = 3.1415926535; _delta = 0.0001; } void testSine() { TS_ASSERT_DELTA( sin(0.0), 0.0, _delta ); - TS_ASSERT_DELTA( sin(_pi / 6), 0.5, _delta ); - TS_ASSERT_DELTA( sin(_pi / 2), 1.0, _delta ); - TS_ASSERT_DELTA( sin(_pi), 0.0, _delta ); + TS_ASSERT_DELTA( sin(M_PI / 6), 0.5, _delta ); + TS_ASSERT_DELTA( sin(M_PI_2), 1.0, _delta ); + TS_ASSERT_DELTA( sin(M_PI), 0.0, _delta ); } }; diff --git a/Code/Mantid/scripts/Inelastic/IndirectMuscat.py b/Code/Mantid/scripts/Inelastic/IndirectMuscat.py index e9b7bc095ba2..e20601e39e48 100644 --- a/Code/Mantid/scripts/Inelastic/IndirectMuscat.py +++ b/Code/Mantid/scripts/Inelastic/IndirectMuscat.py @@ -34,7 +34,7 @@ def CalcW0(nq,dq,disp,coeff): return Q,w0,e0 def CalcSqw(q0,nw2,nel,dw,w0): - PKHT=1.0/3.14159265 + PKHT=1.0/math.pi xSqw = [] ySqw = [] eSqw = [] diff --git a/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py b/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py index 8103c7140e51..7034bf842664 100644 --- a/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py +++ b/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py @@ -189,10 +189,9 @@ def quick_explicit(run, i0_monitor_index, lambda_min, lambda_max, background_mi sample2detector=detLocation-sampleLocation # metres source=inst.getSource() beamPos = sampleLocation - source.getPos() - PI = 3.1415926535 theta = groupGet(str(_sample_ws),'samp','theta') if not theta: - theta = inst.getComponentByName(detector_component_name).getTwoTheta(sampleLocation, beamPos)*180.0/PI/2.0 + theta = inst.getComponentByName(detector_component_name).getTwoTheta(sampleLocation, beamPos)*180.0/math.pi/2.0 print "Det location: ", detLocation, "Calculated theta = ",theta if correct_positions: # detector is not in correct place # Get detector angle theta from NeXuS From dcd05ec21c7f4aceff7e2a39ac66b216f5a31fe2 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 2 Feb 2015 09:03:29 +0000 Subject: [PATCH 096/130] Put remaining Cmake files in order Refs #10960 --- Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt index ed4dfcd6ea51..72a5afa5d6e7 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt @@ -257,21 +257,21 @@ set ( UI_FILES inc/MantidQtCustomInterfaces/AddWorkspace.ui inc/MantidQtCustomInterfaces/Indirect/IndirectTransmissionCalc.ui inc/MantidQtCustomInterfaces/Indirect/JumpFit.ui inc/MantidQtCustomInterfaces/Indirect/MSDFit.ui + inc/MantidQtCustomInterfaces/Indirect/Quasi.ui + inc/MantidQtCustomInterfaces/Indirect/ResNorm.ui + inc/MantidQtCustomInterfaces/Indirect/Stretch.ui inc/MantidQtCustomInterfaces/MultiDatasetFit.ui inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.ui inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui inc/MantidQtCustomInterfaces/Muon/ALCInterface.ui inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.ui inc/MantidQtCustomInterfaces/Muon/MuonAnalysis.ui - inc/MantidQtCustomInterfaces/Indirect/Quasi.ui inc/MantidQtCustomInterfaces/ReflMainWidget.ui inc/MantidQtCustomInterfaces/ReflOptionsDialog.ui inc/MantidQtCustomInterfaces/ReflWindow.ui - inc/MantidQtCustomInterfaces/Indirect/ResNorm.ui inc/MantidQtCustomInterfaces/SANSPlotSpecial.ui inc/MantidQtCustomInterfaces/SANSRunWindow.ui inc/MantidQtCustomInterfaces/SANSEventSlicing.ui - inc/MantidQtCustomInterfaces/Indirect/Stretch.ui inc/MantidQtCustomInterfaces/MantidEV.ui inc/MantidQtCustomInterfaces/StepScan.ui inc/MantidQtCustomInterfaces/EditLocalParameterDialog.ui From e59f0ba6aca196ef0beef3a1bc3ad71a2dec2860 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Mon, 2 Feb 2015 13:54:32 +0000 Subject: [PATCH 097/130] Added if section for google analytics in online help. Refs #10992 --- Code/Mantid/docs/source/_templates/layout.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Code/Mantid/docs/source/_templates/layout.html b/Code/Mantid/docs/source/_templates/layout.html index 6f66bf7ba4d5..64c3d1967dd4 100644 --- a/Code/Mantid/docs/source/_templates/layout.html +++ b/Code/Mantid/docs/source/_templates/layout.html @@ -1,4 +1,20 @@ {% extends "!layout.html" %} +{% block extrahead %} {# Custom CSS overrides #} {% set bootswatch_css_custom = ['_static/custom.css'] %} + +{% if builder == "html" %} + +{% endif %} + +{% endblock %} From 4c1745dad80bfded0ea1326cb62dba3eca76f8ed Mon Sep 17 00:00:00 2001 From: Vickie Lynch Date: Mon, 2 Feb 2015 14:10:10 -0500 Subject: [PATCH 098/130] Refs #10634 progress bar and cancel button fixed --- .../Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index 7fa493bc29c0..e552502b9922 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -18,6 +18,7 @@ #include "MantidAPI/FunctionValues.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/IPeakFunction.h" +#include "MantidAPI/Progress.h" #include #include #include @@ -263,7 +264,14 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { // 5-10% speedup. Perhaps is should just be removed permanantly, but for // now it is commented out to avoid the seg faults. Refs #5533 // PRAGMA_OMP(parallel for schedule(dynamic, 10) ) - for (int i = 0; i < peakWS->getNumberPeaks(); ++i) { + // Initialize progress reporting + int nPeaks = peakWS->getNumberPeaks(); + Progress *m_progress = new Progress(this, 0., 1., nPeaks); + for (int i = 0; i < nPeaks; ++i) { + if (this->getCancel()) + break; // User cancellation + m_progress->report(); + // Get a direct ref to that peak. IPeak &p = peakWS->getPeak(i); From 8f95e9f1c7daad680f9879cb95aaba13d182fbef Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Tue, 3 Feb 2015 12:37:23 +0000 Subject: [PATCH 099/130] Update CONTRIBUTING.md --- CONTRIBUTING.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3665844e4a6e..3bcd94260295 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,14 +1,13 @@ -The [developer documentation](http://www.mantidproject.org/Category:Development) has information on how to participate in the mantid project as a developer. This document is meant to outline the steps for contributing to mantid without becomming a developer. +The [developer documentation](http://www.mantidproject.org/Category:Development) has information on how to participate in the mantid project as a developer. This document is meant to outline the steps for contributing to mantid without becomming a developer. We aspire to have similar guidelines as [github](https://github.com/blog/1943-how-to-write-the-perfect-pull-request). 1. [Fork](https://help.github.com/articles/fork-a-repo) the repository. 2. Make changes as you see fit. Please still follow the guidelines for [running the unit tests](http://www.mantidproject.org/Running_the_unit_tests) and the [build servers](http://www.mantidproject.org/The_automated_build_process). - 3. Before submitting pull requests email mantid-help@mantidproject.org, and a developer will set up a branch that you can submit pull requests to. - 4. Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch. + 3. (Optional) email mantid-help@mantidproject.org, and a developer will set up a branch that you can submit pull requests to. + 4. Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch. This is a start to the conversation. - -Hints to make the integration of your changes easy: +Hints to make the integration of your changes easy (and happen faster): - Keep your pull requests small +- Some comments are part of the build server infrastructure (e.g. 'test this please') - Don't forget your unit tests - All algorithms need documentation, don't forget the .rst file -- Contact us before creating the pull request - Don't take changes requests to change your code personally From fa0ab21b925822576b1f5c8bec89214eee4befc8 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Tue, 3 Feb 2015 12:53:53 +0000 Subject: [PATCH 100/130] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3bcd94260295..bbef34b52be1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,8 +2,8 @@ The [developer documentation](http://www.mantidproject.org/Category:Development) 1. [Fork](https://help.github.com/articles/fork-a-repo) the repository. 2. Make changes as you see fit. Please still follow the guidelines for [running the unit tests](http://www.mantidproject.org/Running_the_unit_tests) and the [build servers](http://www.mantidproject.org/The_automated_build_process). - 3. (Optional) email mantid-help@mantidproject.org, and a developer will set up a branch that you can submit pull requests to. 4. Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch. This is a start to the conversation. + 3. (Optional) email mantid-help@mantidproject.org requests to. Hints to make the integration of your changes easy (and happen faster): - Keep your pull requests small From 9adcd659bb23af6c3fef3a9c79b43bf09b2870c1 Mon Sep 17 00:00:00 2001 From: Anders Markvardsen Date: Tue, 3 Feb 2015 13:20:35 +0000 Subject: [PATCH 101/130] Ansto loader updates by David. Re #10926 --- .../inc/MantidDataHandling/LoadANSTOHelper.h | 15 ++- .../inc/MantidDataHandling/LoadBBY.h | 9 +- .../DataHandling/src/LoadANSTOHelper.cpp | 44 ++++--- .../Framework/DataHandling/src/LoadBBY.cpp | 110 +++++++++++++----- .../Framework/DataHandling/test/LoadBBYTest.h | 2 +- 5 files changed, 129 insertions(+), 51 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h index 29f0038b8d9c..77406b3a1141 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h @@ -52,19 +52,22 @@ class EventCounter { // fields std::vector &m_eventCounts; const std::vector &m_mask; + const std::vector &m_offsets; + const size_t m_stride; double m_tofMin; double m_tofMax; public: // construction - EventCounter(std::vector &eventCounts, const std::vector &mask); + EventCounter(std::vector &eventCounts, const std::vector &mask, + const std::vector &offsets, size_t stride); // properties double tofMin() const; double tofMax() const; // methods - void addEvent(size_t s, double tof); + void addEvent(size_t x, size_t y, double tof); }; class EventAssigner { @@ -72,14 +75,17 @@ class EventAssigner { // fields std::vector &m_eventVectors; const std::vector &m_mask; + const std::vector &m_offsets; + const size_t m_stride; public: // construction EventAssigner(std::vector &eventVectors, - const std::vector &mask); + const std::vector &mask, const std::vector &offsets, + size_t stride); // methods - void addEvent(size_t s, double tof); + void addEvent(size_t x, size_t y, double tof); }; class FastReadOnlyFile { @@ -184,6 +190,7 @@ class File { size_t read(void *dst, size_t size); int read_byte(); }; + } } } diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h index cf2ba8333f78..ca6c33693716 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h @@ -81,9 +81,12 @@ class DLLExport LoadBBY : public API::IFileLoader { static void loadEvents(API::Progress &prog, const char *progMsg, ANSTO::Tar::File &file, const double tofMinBoundary, const double tofMaxBoundary, Counter &counter); - static std::vector createMaskVector(const std::string &maskFilename, - bool &maskFileLoaded); + static std::vector createMaskVector(const std::string &filename, + bool &fileLoaded); + static std::vector createOffsetVector(const std::string &filename, + bool &fileLoaded); }; + } } -#endif // DATAHANDING_LOADBBY_H_ +#endif // DATAHANDING_LOADBBY_H_ \ No newline at end of file diff --git a/Code/Mantid/Framework/DataHandling/src/LoadANSTOHelper.cpp b/Code/Mantid/Framework/DataHandling/src/LoadANSTOHelper.cpp index 4b36e7abe05f..fbfb9d3848f3 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadANSTOHelper.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadANSTOHelper.cpp @@ -51,8 +51,10 @@ void ProgressTracker::complete() { // EventCounter EventCounter::EventCounter(std::vector &eventCounts, - const std::vector &mask) + const std::vector &mask, + const std::vector &offsets, size_t stride) : m_eventCounts(eventCounts), m_mask(mask), + m_offsets(offsets), m_stride(stride), m_tofMin(std::numeric_limits::max()), m_tofMax(std::numeric_limits::min()) {} double EventCounter::tofMin() const { @@ -61,24 +63,36 @@ double EventCounter::tofMin() const { double EventCounter::tofMax() const { return m_tofMin <= m_tofMax ? m_tofMax : 0.0; } -void EventCounter::addEvent(size_t s, double tof) { - if (m_mask[s]) { - if (m_tofMin > tof) - m_tofMin = tof; - if (m_tofMax < tof) - m_tofMax = tof; - - m_eventCounts[s]++; +void EventCounter::addEvent(size_t x, size_t y, double tof) { + size_t yNew = y + (size_t)m_offsets[x]; + if (yNew < m_stride) { + size_t s = m_stride * x + yNew; + + if (m_mask[s]) { + if (m_tofMin > tof) + m_tofMin = tof; + if (m_tofMax < tof) + m_tofMax = tof; + + m_eventCounts[s]++; + } } } // EventAssigner EventAssigner::EventAssigner(std::vector &eventVectors, - const std::vector &mask) - : m_eventVectors(eventVectors), m_mask(mask) {} -void EventAssigner::addEvent(size_t s, double tof) { - if (m_mask[s]) - m_eventVectors[s]->push_back(tof); + const std::vector &mask, + const std::vector &offsets, size_t stride) + : m_eventVectors(eventVectors), m_mask(mask), + m_offsets(offsets), m_stride(stride) {} +void EventAssigner::addEvent(size_t x, size_t y, double tof) { + size_t yNew = y + (size_t)m_offsets[x]; + if (yNew < m_stride) { + size_t s = m_stride * x + yNew; + + if (m_mask[s]) + m_eventVectors[s]->push_back(tof); + } } // FastReadOnlyFile @@ -292,4 +306,4 @@ int File::read_byte() { } } } // namespace -} // namespace +} // namespace \ No newline at end of file diff --git a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp index e1898943f6ff..243ff8b97e88 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp @@ -94,13 +94,20 @@ void LoadBBY::init() { new API::FileProperty("Filename", "", API::FileProperty::Load, exts), "The input filename of the stored data"); - // filter + // mask exts.clear(); exts.push_back(".xml"); declareProperty( new API::FileProperty("Mask", "", API::FileProperty::OptionalLoad, exts), "The input filename of the mask data"); + // offsets + exts.clear(); + exts.push_back(".csv"); + declareProperty( + new API::FileProperty("TubeOffsets", "", API::FileProperty::OptionalLoad, exts), + "The input filename of the tube offset data"); + declareProperty(new API::WorkspaceProperty( "OutputWorkspace", "", Kernel::Direction::Output)); @@ -149,10 +156,31 @@ void LoadBBY::exec() { if (!file.good()) return; - // Get the name of the mask file. + // load mask file bool maskFileLoaded = false; std::vector mask = createMaskVector(getPropertyValue("Mask"), maskFileLoaded); + + // load tube offsets + bool offsetFileLoaded = false; + std::vector offsets = createOffsetVector(getPropertyValue("TubeOffsets"), + offsetFileLoaded); + for (size_t x = 0; x != HISTO_BINS_X; x++) { + int offset = offsets[x]; + if (offset != 0) { + maskFileLoaded = true; + + size_t s0 = HISTO_BINS_Y * x; + if (offset > 0) { + for (int y = 0; y != offset; y++) + mask[s0 + (size_t)y] = false; + } + else { // if (offset < 0) + for (int y = HISTO_BINS_Y + offset; y != HISTO_BINS_Y; y++) + mask[s0 + (size_t)y] = false; + } + } + } size_t nBins = 1; double tofMinBoundary = getProperty("FilterByTofMin"); @@ -213,7 +241,7 @@ void LoadBBY::exec() { std::vector detIDs = instrument->getDetectorIDs(); // count total events per pixel to reserve necessary memory - ANSTO::EventCounter eventCounter(eventCounts, mask); + ANSTO::EventCounter eventCounter(eventCounts, mask, offsets, HISTO_BINS_Y); loadEvents(prog, "loading neutron counts", file, tofMinBoundary, tofMaxBoundary, eventCounter); @@ -237,15 +265,15 @@ void LoadBBY::exec() { } progTracker.complete(); - ANSTO::EventAssigner eventAssigner(eventVectors, mask); + ANSTO::EventAssigner eventAssigner(eventVectors, mask, offsets, + HISTO_BINS_Y); loadEvents(prog, "loading neutron events", file, tofMinBoundary, tofMaxBoundary, eventAssigner); Kernel::cow_ptr axis; MantidVec &xRef = axis.access(); xRef.resize(2, 0.0); - xRef[0] = std::max(0.0, eventCounter.tofMin() - - 1); // just to make sure the bins hold it all + xRef[0] = std::max(0.0, eventCounter.tofMin() - 1); // just to make sure the bins hold it all xRef[1] = eventCounter.tofMax() + 1; eventWS->setAllX(axis); @@ -401,19 +429,12 @@ Geometry::Instrument_sptr LoadBBY::createInstrument(ANSTO::Tar::File &tarFile) { // http://www.mantidproject.org/HowToDefineGeometricShape for details on // shapes in Mantid. std::string detXML = - "" - "" - "" - "" - "" - ""; + "" + "" + "" + "" + "" + ""; // Create a shape object which will be shared by all pixels. Geometry::Object_sptr pixelShape = @@ -505,6 +526,7 @@ void LoadBBY::loadEvents(API::Progress &prog, const char *progMsg, // uint v = 0; // 0 bits [ ] // uint w = 0; // 0 bits [ ] energy unsigned int dt = 0; + double tof = 0.0; if ((fileSize == 0) || !file.skip(128)) return; @@ -552,13 +574,14 @@ void LoadBBY::loadEvents(API::Progress &prog, const char *progMsg, state = 0; if ((x == 0) && (y == 0) && (dt == 0xFFFFFFFF)) { + tof = 0.0; } else if ((x >= HISTO_BINS_X) || (y >= HISTO_BINS_Y)) { } else { // conversion from 100 nanoseconds to 1 microsecond - double tof = dt * 0.1; + tof += ((int)dt) * 0.1; if ((tofMinBoundary <= tof) && (tof <= tofMaxBoundary)) - counter.addEvent(HISTO_BINS_Y * x + y, tof); + counter.addEvent(x, y, tof); } progTracker.update(file.selected_position()); @@ -567,11 +590,11 @@ void LoadBBY::loadEvents(API::Progress &prog, const char *progMsg, } // load mask file -std::vector LoadBBY::createMaskVector(const std::string &maskFilename, - bool &maskFileLoaded) { +std::vector LoadBBY::createMaskVector(const std::string &filename, + bool &fileLoaded) { std::vector result(HISTO_BINS_X * HISTO_BINS_Y, true); - std::ifstream input(maskFilename.c_str()); + std::ifstream input(filename.c_str()); if (input.good()) { std::string line; while (std::getline(input, line)) { @@ -612,14 +635,46 @@ std::vector LoadBBY::createMaskVector(const std::string &maskFilename, } } } - maskFileLoaded = true; + fileLoaded = true; } else { - maskFileLoaded = false; + fileLoaded = false; } return result; } +// load tube offset file +std::vector LoadBBY::createOffsetVector(const std::string &filename, + bool &fileLoaded) { + std::vector result(HISTO_BINS_X, 0); + + std::ifstream input(filename.c_str()); + if (input.good()) { + std::string line; + while (std::getline(input, line)) { + auto i1 = line.find_first_of(",;"); + if (i1 == std::string::npos) + continue; + + auto i2 = line.find_first_of(",;", i1 + 1); + if (i2 == std::string::npos) + i2 = line.size(); + + size_t index = boost::lexical_cast(line.substr(0, i1)); + int offset = boost::lexical_cast(line.substr(i1 + 1, line.size() - i1 - 1)); + + if (index < HISTO_BINS_X) + result[index] = offset; + } + fileLoaded = true; + } + else { + fileLoaded = false; + } + + return result; +} + // DetectorBankFactory BbyDetectorBankFactory::BbyDetectorBankFactory( Geometry::Instrument_sptr instrument, Geometry::Object_sptr pixelShape, @@ -654,6 +709,5 @@ void BbyDetectorBankFactory::createAndAssign(size_t startIndex, bank->rotate(rot); bank->translate(pos - center); } - -} // namespace } // namespace +} // namespace \ No newline at end of file diff --git a/Code/Mantid/Framework/DataHandling/test/LoadBBYTest.h b/Code/Mantid/Framework/DataHandling/test/LoadBBYTest.h index 97e07b725334..7cbd8461750b 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadBBYTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadBBYTest.h @@ -56,7 +56,7 @@ class LoadBBYTest : public CxxTest::TestSuite for (size_t i = 0; i < output->getNumberHistograms(); i++) sum += output->readY(i)[0]; sum *= 1.0e22; - TS_ASSERT_DELTA(sum / 1.0E27,0.9981,0.0001); + TS_ASSERT_DELTA(sum / 1.0E27,2.0,0.0001); } From 13a5b85c486f4ae140f7a9dfa2f23ec6ca524331 Mon Sep 17 00:00:00 2001 From: Vickie Lynch Date: Tue, 3 Feb 2015 10:03:21 -0500 Subject: [PATCH 102/130] Refs #10634 fix doc files --- Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp | 2 +- Code/Mantid/docs/source/algorithms/IntegratePeaksMD-v2.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index e552502b9922..c97a708f0d6b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -104,7 +104,7 @@ void IntegratePeaksMD2::init() { declareProperty("AdaptiveQRadius", false, "Default is false. If true, all input radii are multiplied " "by the magnitude of Q at the peak center so each peak has a " - "different integration radius."); + "different integration radius. Q includes the 2*pi factor."); declareProperty("Cylinder", false, "Default is sphere. Use next five parameters for cylinder."); diff --git a/Code/Mantid/docs/source/algorithms/IntegratePeaksMD-v2.rst b/Code/Mantid/docs/source/algorithms/IntegratePeaksMD-v2.rst index b6a6280204b8..704b3cf2ce53 100644 --- a/Code/Mantid/docs/source/algorithms/IntegratePeaksMD-v2.rst +++ b/Code/Mantid/docs/source/algorithms/IntegratePeaksMD-v2.rst @@ -71,7 +71,7 @@ background signal density in the shell to the volume of the peak: with the error squared on that value: -:math:`\sigma I_{bg}^2 = \frac{V_{peak}}{V_{shell}} \sigma I_{shell}^2` +:math:`\sigma I_{bg}^2 = (\frac{V_{peak}}{V_{shell}})^2 \sigma I_{shell}^2` This is applied to the integrated peak intensity :math:`I_{peak}` to give the corrected intensity :math:`I_{corr}`: From 55a15d91ca47f61b7dfc35cb4cc7ccb220701cc1 Mon Sep 17 00:00:00 2001 From: Anders Markvardsen Date: Tue, 3 Feb 2015 15:28:43 +0000 Subject: [PATCH 103/130] fix warning. re #10926 --- Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp index 243ff8b97e88..023f35c29d4a 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp @@ -176,8 +176,8 @@ void LoadBBY::exec() { mask[s0 + (size_t)y] = false; } else { // if (offset < 0) - for (int y = HISTO_BINS_Y + offset; y != HISTO_BINS_Y; y++) - mask[s0 + (size_t)y] = false; + for (size_t y = HISTO_BINS_Y + offset; y != HISTO_BINS_Y; y++) + mask[s0 + y] = false; } } } From 884b00ea847d2d3d0df05b0d59ba05d0975b4e10 Mon Sep 17 00:00:00 2001 From: Anders Markvardsen Date: Tue, 3 Feb 2015 15:56:14 +0000 Subject: [PATCH 104/130] fix warnings. re #10926 --- Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp index 023f35c29d4a..6794b27e1190 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp @@ -176,7 +176,7 @@ void LoadBBY::exec() { mask[s0 + (size_t)y] = false; } else { // if (offset < 0) - for (size_t y = HISTO_BINS_Y + offset; y != HISTO_BINS_Y; y++) + for (size_t y = static_cast(static_cast(HISTO_BINS_Y) + offset); y != HISTO_BINS_Y; y++) mask[s0 + y] = false; } } From 07d7d5e776c957c2ce3e21c551a3b1c158ee422f Mon Sep 17 00:00:00 2001 From: Marina Ganeva Date: Wed, 4 Feb 2015 07:53:32 +0100 Subject: [PATCH 105/130] TOFTOF and DNS instruments at MLZ are added to Facilities.xml --- Code/Mantid/instrument/Facilities.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Code/Mantid/instrument/Facilities.xml b/Code/Mantid/instrument/Facilities.xml index 3c440ee6e423..8c2cb5d8be27 100644 --- a/Code/Mantid/instrument/Facilities.xml +++ b/Code/Mantid/instrument/Facilities.xml @@ -606,6 +606,23 @@ + + + + Neutron Spectroscopy + Reactor Direct Geometry Spectroscopy + TOF Direct Geometry Spectroscopy + Neutron Diffraction + Single Crystal Diffraction + + + + Neutron Spectroscopy + Reactor Direct Geometry Spectroscopy + Time-of-flight spectroscopy + + + From 31bb7f1692dfea8e101cd9820ba0e657a50faeff Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Wed, 4 Feb 2015 09:31:57 +0000 Subject: [PATCH 106/130] Moving css declaration out of the extrahead section Refs #160 --- Code/Mantid/docs/source/_templates/layout.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Code/Mantid/docs/source/_templates/layout.html b/Code/Mantid/docs/source/_templates/layout.html index 64c3d1967dd4..3728141dd335 100644 --- a/Code/Mantid/docs/source/_templates/layout.html +++ b/Code/Mantid/docs/source/_templates/layout.html @@ -1,9 +1,6 @@ {% extends "!layout.html" %} {% block extrahead %} -{# Custom CSS overrides #} -{% set bootswatch_css_custom = ['_static/custom.css'] %} - {% if builder == "html" %} {% endif %} - {% endblock %} + +{# Custom CSS overrides #} +{% set bootswatch_css_custom = ['_static/custom.css'] %} From 5757560d2b75a40d234f54533376875c5d9bf9a6 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 4 Feb 2015 11:09:17 +0100 Subject: [PATCH 107/130] Refs #10263. Removing artifacts from merge conflicts resolution. --- .../Mantid/Framework/SINQ/CMakeLists.txt.orig | 171 -------- .../inc/MantidSINQ/PoldiFitPeaks1D.h.orig | 141 ------- .../SINQ/src/PoldiFitPeaks1D.cpp.orig | 390 ------------------ 3 files changed, 702 deletions(-) delete mode 100644 Code/Mantid/Framework/SINQ/CMakeLists.txt.orig delete mode 100644 Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h.orig delete mode 100644 Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp.orig diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt.orig b/Code/Mantid/Framework/SINQ/CMakeLists.txt.orig deleted file mode 100644 index bbd87de652c3..000000000000 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt.orig +++ /dev/null @@ -1,171 +0,0 @@ -set ( SRC_FILES - src/InvertMDDim.cpp - src/LoadFlexiNexus.cpp - src/MDHistoToWorkspace2D.cpp - src/PoldiAnalyseResiduals.cpp - src/PoldiAutoCorrelation5.cpp - src/PoldiCreatePeaksFromCell.cpp - src/PoldiFitPeaks1D.cpp -<<<<<<< HEAD - src/PoldiFitPeaks1D2.cpp -======= - src/PoldiFitPeaks2D.cpp - src/PoldiIndexKnownCompounds.cpp ->>>>>>> origin/master - src/PoldiLoadChopperSlits.cpp - src/PoldiLoadIPP.cpp - src/PoldiLoadLog.cpp - src/PoldiLoadSpectra.cpp - src/PoldiPeakDetection2.cpp - src/PoldiPeakSearch.cpp - src/PoldiPeakSummary.cpp - src/PoldiRemoveDeadWires.cpp - src/PoldiTruncateData.cpp - src/PoldiUtilities/MillerIndices.cpp - src/PoldiUtilities/PeakFunctionIntegrator.cpp - src/PoldiUtilities/Poldi2DFunction.cpp - src/PoldiUtilities/PoldiAutoCorrelationCore.cpp - src/PoldiUtilities/PoldiBasicChopper.cpp - src/PoldiUtilities/PoldiChopperFactory.cpp - src/PoldiUtilities/PoldiConversions.cpp - src/PoldiUtilities/PoldiDeadWireDecorator.cpp - src/PoldiUtilities/PoldiDetectorDecorator.cpp - src/PoldiUtilities/PoldiDetectorFactory.cpp - src/PoldiUtilities/PoldiDGrid.cpp - src/PoldiUtilities/PoldiHeliumDetector.cpp - src/PoldiUtilities/PoldiInstrumentAdapter.cpp - src/PoldiUtilities/PoldiPeak.cpp - src/PoldiUtilities/PoldiPeakCollection.cpp - src/PoldiUtilities/PoldiResidualCorrelationCore.cpp - src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp - src/PoldiUtilities/PoldiSourceSpectrum.cpp - src/PoldiUtilities/PoldiSpectrumLinearBackground.cpp - src/PoldiUtilities/PoldiTimeTransformer.cpp - src/PoldiUtilities/UncertainValue.cpp - src/ProjectMD.cpp - src/SINQHMListener.cpp - src/SINQTranspose3D.cpp - src/SliceMDHisto.cpp -) - -set ( INC_FILES - inc/MantidSINQ/DllConfig.h - inc/MantidSINQ/InvertMDDim.h - inc/MantidSINQ/LoadFlexiNexus.h - inc/MantidSINQ/MDHistoToWorkspace2D.h - inc/MantidSINQ/PoldiAnalyseResiduals.h - inc/MantidSINQ/PoldiAutoCorrelation5.h - inc/MantidSINQ/PoldiCreatePeaksFromCell.h - inc/MantidSINQ/PoldiFitPeaks1D.h -<<<<<<< HEAD - inc/MantidSINQ/PoldiFitPeaks1D2.h -======= - inc/MantidSINQ/PoldiFitPeaks2D.h - inc/MantidSINQ/PoldiIndexKnownCompounds.h ->>>>>>> origin/master - inc/MantidSINQ/PoldiLoadChopperSlits.h - inc/MantidSINQ/PoldiLoadIPP.h - inc/MantidSINQ/PoldiLoadLog.h - inc/MantidSINQ/PoldiLoadSpectra.h - inc/MantidSINQ/PoldiPeakDetection2.h - inc/MantidSINQ/PoldiPeakSearch.h - inc/MantidSINQ/PoldiPeakSummary.h - inc/MantidSINQ/PoldiRemoveDeadWires.h - inc/MantidSINQ/PoldiTruncateData.h - inc/MantidSINQ/PoldiUtilities/MillerIndices.h - inc/MantidSINQ/PoldiUtilities/MillerIndicesIO.h - inc/MantidSINQ/PoldiUtilities/PeakFunctionIntegrator.h - inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h - inc/MantidSINQ/PoldiUtilities/PoldiAbstractChopper.h - inc/MantidSINQ/PoldiUtilities/PoldiAbstractDetector.h - inc/MantidSINQ/PoldiUtilities/PoldiAutoCorrelationCore.h - inc/MantidSINQ/PoldiUtilities/PoldiBasicChopper.h - inc/MantidSINQ/PoldiUtilities/PoldiChopperFactory.h - inc/MantidSINQ/PoldiUtilities/PoldiConversions.h - inc/MantidSINQ/PoldiUtilities/PoldiDeadWireDecorator.h - inc/MantidSINQ/PoldiUtilities/PoldiDetectorDecorator.h - inc/MantidSINQ/PoldiUtilities/PoldiDetectorFactory.h - inc/MantidSINQ/PoldiUtilities/PoldiDGrid.h - inc/MantidSINQ/PoldiUtilities/PoldiHeliumDetector.h - inc/MantidSINQ/PoldiUtilities/PoldiInstrumentAdapter.h - inc/MantidSINQ/PoldiUtilities/PoldiMockInstrumentHelpers.h - inc/MantidSINQ/PoldiUtilities/PoldiPeak.h - inc/MantidSINQ/PoldiUtilities/PoldiPeakCollection.h - inc/MantidSINQ/PoldiUtilities/PoldiResidualCorrelationCore.h - inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h - inc/MantidSINQ/PoldiUtilities/PoldiSpectrumLinearBackground.h - inc/MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h - inc/MantidSINQ/PoldiUtilities/UncertainValue.h - inc/MantidSINQ/PoldiUtilities/UncertainValueIO.h - inc/MantidSINQ/ProjectMD.h - inc/MantidSINQ/SINQHMListener.h - inc/MantidSINQ/SINQTranspose3D.h - inc/MantidSINQ/SliceMDHisto.h -) - -set ( TEST_FILES - InvertMDDimTest.h - LoadFlexiNexusTest.h - MDHistoToWorkspace2DTest.h - MillerIndicesIOTest.h - MillerIndicesTest.h - PeakFunctionIntegratorTest.h - Poldi2DFunctionTest.h - PoldiAnalyseResidualsTest.h - PoldiAutoCorrelationCoreTest.h - PoldiBasicChopperTest.h - PoldiChopperFactoryTest.h - PoldiConversionsTest.h - PoldiCreatePeaksFromCellTest.h - PoldiDeadWireDecoratorTest.h - PoldiDetectorDecoratorTest.h - PoldiDGridTest.h - PoldiDetectorFactoryTest.h - PoldiDetectorTest.h - PoldiFitPeaks1DTest.h -<<<<<<< HEAD - PoldiFitPeaks1D2Test.h -======= - PoldiFitPeaks2DTest.h - PoldiIndexKnownCompoundsTest.h ->>>>>>> origin/master - PoldiInstrumentAdapterTest.h - PoldiPeakCollectionTest.h - PoldiPeakSearchTest.h - PoldiPeakSummaryTest.h - PoldiPeakTest.h - PoldiResidualCorrelationCoreTest.h - PoldiSourceSpectrumTest.h - PoldiSpectrumDomainFunctionTest.h - PoldiSpectrumLinearBackgroundTest.h - PoldiTimeTransformerTest.h - PoldiTruncateDataTest.h - ProjectMDTest.h - SliceMDHistoTest.h - UncertainValueIOTest.h - UncertainValueTest.h -) - - -# Add a precompiled header where they are supported -enable_precompiled_headers ( inc/MantidSINQ/PrecompiledHeader.h SRC_FILES ) -# Add the target for this directory -add_library ( SINQ ${SRC_FILES} ${INC_FILES} ) -# Set the name of the generated library -set_target_properties ( SINQ PROPERTIES OUTPUT_NAME MantidSINQ - COMPILE_DEFINITIONS "IN_MANTID_SINQ" ) -# Add to the 'Framework' group in VS -set_property ( TARGET SINQ PROPERTY FOLDER "MantidFramework" ) - -include_directories ( inc ../MDEvents/inc ) - -target_link_libraries ( SINQ ${MANTIDLIBS} MDEvents ) - -# Add the unit tests directory -add_subdirectory ( test ) - -########################################################################### -# Installation settings -########################################################################### - -install ( TARGETS SINQ ${SYSTEM_PACKAGE_TARGET} DESTINATION ${PLUGINS_DIR} ) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h.orig b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h.orig deleted file mode 100644 index b7865838a0f2..000000000000 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks1D.h.orig +++ /dev/null @@ -1,141 +0,0 @@ -#ifndef MANTID_SINQ_POLDIFITPEAKS1D_H_ -#define MANTID_SINQ_POLDIFITPEAKS1D_H_ - -#include "MantidKernel/System.h" -#include "MantidAPI/Algorithm.h" - -#include "MantidSINQ/DllConfig.h" -#include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h" -#include "MantidAPI/IPeakFunction.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidDataObjects/TableWorkspace.h" -#include "MantidAPI/TableRow.h" - -<<<<<<< HEAD -namespace Mantid -{ -namespace Poldi -{ - /** PoldiFitPeaks1D : - - PoldiFitPeaks1D fits multiple peaks to POLDI auto-correlation data. -======= -namespace Mantid { -namespace Poldi { - -/** PoldiFitPeaks1D : ->>>>>>> origin/master - - PoldiFitPeaks1D fits multiple peaks to POLDI auto-correlation data. - - @author Michael Wedel, Paul Scherrer Institut - SINQ - @date 17/03/2014 - - Copyright © 2014 PSI-MSS - - This file is part of Mantid. - - Mantid is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - Mantid is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -<<<<<<< HEAD - File change history is stored at: - Code Documentation is available at: - */ - class MANTID_SINQ_DLL PoldiFitPeaks1D : public API::Algorithm - { - public: - PoldiFitPeaks1D(); - virtual ~PoldiFitPeaks1D(); - - virtual const std::string name() const; - ///Summary of algorithms purpose - virtual const std::string summary() const {return "PoldiPeakFit1D fits peak profiles to POLDI auto-correlation data.";} -======= - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - File change history is stored at: - Code Documentation is available at: -*/ ->>>>>>> origin/master - -class MANTID_SINQ_DLL PoldiFitPeaks1D : public API::Algorithm { -public: - PoldiFitPeaks1D(); - virtual ~PoldiFitPeaks1D(); - -<<<<<<< HEAD - protected: - void setPeakFunction(const std::string &peakFunction); - PoldiPeakCollection_sptr getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const; - - API::IFunction_sptr getPeakProfile(const PoldiPeak_sptr &poldiPeak) const; - void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const API::IFunction_sptr &fittedFunction) const; - double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction) const; - - API::IAlgorithm_sptr getFitAlgorithm(const DataObjects::Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const API::IFunction_sptr &profile); -======= - virtual const std::string name() const; - /// Summary of algorithms purpose - virtual const std::string summary() const { - return "PoldiPeakFit1D fits peak profiles to POLDI auto-correlation data."; - } - - virtual int version() const; - virtual const std::string category() const; - -protected: - void setPeakFunction(std::string peakFunction); - PoldiPeakCollection_sptr - getInitializedPeakCollection(DataObjects::TableWorkspace_sptr peakTable); - - API::IFunction_sptr getPeakProfile(PoldiPeak_sptr poldiPeak); - void setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, - API::IFunction_sptr fittedFunction); - double getFwhmWidthRelation(API::IPeakFunction_sptr peakFunction); - - API::IAlgorithm_sptr - getFitAlgorithm(DataObjects::Workspace2D_sptr dataWorkspace, - PoldiPeak_sptr peak, API::IFunction_sptr profile); ->>>>>>> origin/master - - void addPeakFitCharacteristics(API::ITableWorkspace_sptr fitResult); - void initializeFitResultWorkspace(API::ITableWorkspace_sptr fitResult); - -<<<<<<< HEAD - double m_fwhmMultiples; -======= - void initializePeakResultWorkspace( - DataObjects::TableWorkspace_sptr peakResultWorkspace); - void storePeakResult(API::TableRow tableRow, PoldiPeak_sptr peak); - DataObjects::TableWorkspace_sptr - generateResultTable(PoldiPeakCollection_sptr peaks); - - PoldiPeakCollection_sptr m_peaks; - std::string m_profileTemplate; - API::IFunction_sptr m_backgroundTemplate; - std::string m_profileTies; ->>>>>>> origin/master - - DataObjects::TableWorkspace_sptr m_fitCharacteristics; - DataObjects::TableWorkspace_sptr m_peakResultOutput; - - double m_fwhmMultiples; - -private: - void init(); - void exec(); -}; - -} // namespace Poldi -} // namespace Mantid - -#endif /* MANTID_SINQ_POLDIFITPEAKS1D_H_ */ diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp.orig b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp.orig deleted file mode 100644 index 88b6d64d0041..000000000000 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks1D.cpp.orig +++ /dev/null @@ -1,390 +0,0 @@ -#include "MantidAPI/WorkspaceProperty.h" -#include "MantidAPI/WorkspaceFactory.h" -#include "MantidAPI/WorkspaceGroup.h" - -#include "MantidSINQ/PoldiFitPeaks1D.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidDataObjects/TableWorkspace.h" -#include "MantidAPI/FunctionFactory.h" -#include "MantidKernel/BoundedValidator.h" -#include "MantidKernel/ListValidator.h" -#include "MantidAPI/TableRow.h" - -#include "MantidSINQ/PoldiUtilities/UncertainValue.h" -#include "MantidSINQ/PoldiUtilities/UncertainValueIO.h" - -#include "MantidAPI/CompositeFunction.h" - -namespace Mantid { -namespace Poldi { - -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::DataObjects; -using namespace Mantid::CurveFitting; - -// Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(PoldiFitPeaks1D) - -PoldiFitPeaks1D::PoldiFitPeaks1D() - : m_peaks(), m_profileTemplate(), m_backgroundTemplate(), m_profileTies(), - m_fitCharacteristics(), m_peakResultOutput(), m_fwhmMultiples(1.0) {} - -<<<<<<< HEAD -PoldiFitPeaks1D::PoldiFitPeaks1D() : - m_peaks(), - m_profileTemplate(), - m_backgroundTemplate(), - m_profileTies(), - m_fwhmMultiples(1.0) -{ - -} - -PoldiFitPeaks1D::~PoldiFitPeaks1D() -{ -} - -======= -PoldiFitPeaks1D::~PoldiFitPeaks1D() {} ->>>>>>> origin/master - -/// Algorithm's name for identification. @see Algorithm::name -const std::string PoldiFitPeaks1D::name() const { return "PoldiFitPeaks1D"; } - -/// Algorithm's version for identification. @see Algorithm::version -int PoldiFitPeaks1D::version() const { return 1; } - -/// Algorithm's category for identification. @see Algorithm::category -const std::string PoldiFitPeaks1D::category() const { return "SINQ\\Poldi"; } - -<<<<<<< HEAD -void PoldiFitPeaks1D::init() -{ - declareProperty(new WorkspaceProperty("InputWorkspace","",Direction::Input), "An input workspace containing a POLDI auto-correlation spectrum."); - boost::shared_ptr > minFwhmPerDirection = boost::make_shared >(); - minFwhmPerDirection->setLower(2.0); - declareProperty("FwhmMultiples", 2.0, minFwhmPerDirection, "Each peak will be fitted using x times FWHM data in each direction.", Direction::Input); - - std::vector peakFunctions = FunctionFactory::Instance().getFunctionNames(); - boost::shared_ptr > peakFunctionNames(new ListValidator(peakFunctions)); - declareProperty("PeakFunction", "Gaussian", peakFunctionNames, "Peak function that will be fitted to all peaks.", Direction::Input); - - declareProperty(new WorkspaceProperty("PoldiPeakTable","",Direction::Input), "A table workspace containing POLDI peak data."); - - declareProperty(new WorkspaceProperty("OutputWorkspace","RefinedPeakTable",Direction::Output), "Output workspace with refined peak data."); - declareProperty(new WorkspaceProperty("FitPlotsWorkspace","FitPlots",Direction::Output), "Plots of all peak fits."); - - m_backgroundTemplate = FunctionFactory::Instance().createInitialized("name=UserFunction, Formula=A0 + A1*(x - x0)^2"); - m_profileTies = "f1.x0 = f0.PeakCentre"; -} - -void PoldiFitPeaks1D::setPeakFunction(const std::string &peakFunction) -{ - m_profileTemplate = peakFunction; -} - -PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const -{ - PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); - peakCollection->setProfileFunctionName(m_profileTemplate); -======= -void PoldiFitPeaks1D::init() { - declareProperty( - new WorkspaceProperty("InputWorkspace", "", - Direction::Input), - "An input workspace containing a POLDI auto-correlation spectrum."); - boost::shared_ptr> minFwhmPerDirection = - boost::make_shared>(); - minFwhmPerDirection->setLower(2.0); - declareProperty( - "FwhmMultiples", 2.0, minFwhmPerDirection, - "Each peak will be fitted using x times FWHM data in each direction.", - Direction::Input); - - std::vector peakFunctions = - FunctionFactory::Instance().getFunctionNames(); - boost::shared_ptr> peakFunctionNames( - new ListValidator(peakFunctions)); - declareProperty("PeakFunction", "Gaussian", peakFunctionNames, - "Peak function that will be fitted to all peaks.", - Direction::Input); - - declareProperty(new WorkspaceProperty("PoldiPeakTable", "", - Direction::Input), - "A table workspace containing POLDI peak data."); - - declareProperty(new WorkspaceProperty( - "OutputWorkspace", "RefinedPeakTable", Direction::Output), - "Output workspace with refined peak data."); - declareProperty(new WorkspaceProperty( - "ResultTableWorkspace", "ResultTable", Direction::Output), - "Fit results."); - declareProperty(new WorkspaceProperty( - "FitCharacteristicsWorkspace", "FitCharacteristics", - Direction::Output), - "Fit characteristics for each peak."); - declareProperty(new WorkspaceProperty( - "FitPlotsWorkspace", "FitPlots", Direction::Output), - "Plots of all peak fits."); - - m_backgroundTemplate = FunctionFactory::Instance().createInitialized( - "name=UserFunction, Formula=A0 + A1*(x - x0)^2"); - m_profileTies = "f1.x0 = f0.PeakCentre"; -} - -void PoldiFitPeaks1D::setPeakFunction(std::string peakFunction) { - m_profileTemplate = peakFunction; -} - -PoldiPeakCollection_sptr -PoldiFitPeaks1D::getInitializedPeakCollection(TableWorkspace_sptr peakTable) { - PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable)); - peakCollection->setProfileFunctionName(m_profileTemplate); ->>>>>>> origin/master - - return peakCollection; -} - -<<<<<<< HEAD -IFunction_sptr PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const { - IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast(FunctionFactory::Instance().createFunction(m_profileTemplate)); - clonedProfile->setCentre(poldiPeak->q()); - clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); - clonedProfile->setHeight(poldiPeak->intensity()); -======= -IFunction_sptr PoldiFitPeaks1D::getPeakProfile(PoldiPeak_sptr poldiPeak) { - IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast( - FunctionFactory::Instance().createFunction(m_profileTemplate)); - clonedProfile->setCentre(poldiPeak->q()); - clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ)); - clonedProfile->setHeight(poldiPeak->intensity()); ->>>>>>> origin/master - - IFunction_sptr clonedBackground = m_backgroundTemplate->clone(); - - CompositeFunction_sptr totalProfile(new CompositeFunction); - totalProfile->initialize(); - totalProfile->addFunction(clonedProfile); - totalProfile->addFunction(clonedBackground); - - if (!m_profileTies.empty()) { - totalProfile->addTies(m_profileTies); - } - - return totalProfile; -} - -<<<<<<< HEAD -void PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, const IFunction_sptr &fittedFunction) const -{ - CompositeFunction_sptr totalFunction = boost::dynamic_pointer_cast(fittedFunction); - - if(totalFunction) { - IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast(totalFunction->getFunction(0)); - - if(peakFunction) { - poldiPeak->setIntensity(UncertainValue(peakFunction->height(), peakFunction->getError(0))); - poldiPeak->setQ(UncertainValue(peakFunction->centre(), peakFunction->getError(1))); - poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), getFwhmWidthRelation(peakFunction) * peakFunction->getError(2))); - } -======= -void -PoldiFitPeaks1D::setValuesFromProfileFunction(PoldiPeak_sptr poldiPeak, - IFunction_sptr fittedFunction) { - CompositeFunction_sptr totalFunction = - boost::dynamic_pointer_cast(fittedFunction); - - if (totalFunction) { - IPeakFunction_sptr peakFunction = - boost::dynamic_pointer_cast( - totalFunction->getFunction(0)); - - if (peakFunction) { - poldiPeak->setIntensity( - UncertainValue(peakFunction->height(), peakFunction->getError(0))); - poldiPeak->setQ( - UncertainValue(peakFunction->centre(), peakFunction->getError(1))); - poldiPeak->setFwhm(UncertainValue(peakFunction->fwhm(), - getFwhmWidthRelation(peakFunction) * - peakFunction->getError(2))); ->>>>>>> origin/master - } - } -} - -<<<<<<< HEAD -double PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) const -{ - return peakFunction->fwhm() / peakFunction->getParameter(2); -======= -double PoldiFitPeaks1D::getFwhmWidthRelation(IPeakFunction_sptr peakFunction) { - return peakFunction->fwhm() / peakFunction->getParameter(2); ->>>>>>> origin/master -} - -void PoldiFitPeaks1D::exec() { - setPeakFunction(getProperty("PeakFunction")); - - // Number of points around the peak center to use for the fit - m_fwhmMultiples = getProperty("FwhmMultiples"); - - // try to construct PoldiPeakCollection from provided TableWorkspace - TableWorkspace_sptr poldiPeakTable = getProperty("PoldiPeakTable"); - m_peaks = getInitializedPeakCollection(poldiPeakTable); - -<<<<<<< HEAD - - g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; -======= - g_log.information() << "Peaks to fit: " << m_peaks->peakCount() << std::endl; ->>>>>>> origin/master - - Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace"); - -<<<<<<< HEAD - WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); -======= - m_fitCharacteristics = boost::dynamic_pointer_cast( - WorkspaceFactory::Instance().createTable()); - WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup); ->>>>>>> origin/master - - for (size_t i = 0; i < m_peaks->peakCount(); ++i) { - PoldiPeak_sptr currentPeak = m_peaks->peak(i); - IFunction_sptr currentProfile = getPeakProfile(currentPeak); - - IAlgorithm_sptr fit = - getFitAlgorithm(dataWorkspace, currentPeak, currentProfile); - - bool fitSuccess = fit->execute(); - -<<<<<<< HEAD - if(fitSuccess) { - setValuesFromProfileFunction(currentPeak, fit->getProperty("Function")); -======= - if (fitSuccess) { - setValuesFromProfileFunction(currentPeak, fit->getProperty("Function")); - addPeakFitCharacteristics(fit->getProperty("OutputParameters")); ->>>>>>> origin/master - - MatrixWorkspace_sptr fpg = fit->getProperty("OutputWorkspace"); - fitPlotGroup->addWorkspace(fpg); - } - } - -<<<<<<< HEAD - - setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("FitPlotsWorkspace", fitPlotGroup); -} - -IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace, const PoldiPeak_sptr &peak, const IFunction_sptr &profile) -{ - double width = peak->fwhm(); - double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples; - - std::pair xBorders(peak->q() - extent, peak->q() + extent); - - IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); - fitAlgorithm->setProperty("CreateOutput", true); - fitAlgorithm->setProperty("Output", "FitPeaks1D"); - fitAlgorithm->setProperty("CalcErrors", true); - fitAlgorithm->setProperty("Function", profile); - fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); - fitAlgorithm->setProperty("WorkspaceIndex", 0); - fitAlgorithm->setProperty("StartX", xBorders.first); - fitAlgorithm->setProperty("EndX", xBorders.second); - - return fitAlgorithm; -} - -======= - m_peakResultOutput = generateResultTable(m_peaks); - - setProperty("OutputWorkspace", m_peaks->asTableWorkspace()); - setProperty("FitCharacteristicsWorkspace", m_fitCharacteristics); - setProperty("ResultTableWorkspace", m_peakResultOutput); - setProperty("FitPlotsWorkspace", fitPlotGroup); -} - -IAlgorithm_sptr PoldiFitPeaks1D::getFitAlgorithm(Workspace2D_sptr dataWorkspace, - PoldiPeak_sptr peak, - IFunction_sptr profile) { - double width = peak->fwhm(); - double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples; - - std::pair xBorders(peak->q() - extent, peak->q() + extent); - - IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false); - fitAlgorithm->setProperty("CreateOutput", true); - fitAlgorithm->setProperty("Output", "FitPeaks1D"); - fitAlgorithm->setProperty("CalcErrors", true); - fitAlgorithm->setProperty("Function", profile); - fitAlgorithm->setProperty("InputWorkspace", dataWorkspace); - fitAlgorithm->setProperty("WorkspaceIndex", 0); - fitAlgorithm->setProperty("StartX", xBorders.first); - fitAlgorithm->setProperty("EndX", xBorders.second); - - return fitAlgorithm; -} - -void -PoldiFitPeaks1D::addPeakFitCharacteristics(ITableWorkspace_sptr fitResult) { - if (m_fitCharacteristics->columnCount() == 0) { - initializeFitResultWorkspace(fitResult); - } - - TableRow newRow = m_fitCharacteristics->appendRow(); - - for (size_t i = 0; i < fitResult->rowCount(); ++i) { - TableRow currentRow = fitResult->getRow(i); - - newRow << UncertainValueIO::toString( - UncertainValue(currentRow.Double(1), currentRow.Double(2))); - } -} - -void -PoldiFitPeaks1D::initializeFitResultWorkspace(ITableWorkspace_sptr fitResult) { - for (size_t i = 0; i < fitResult->rowCount(); ++i) { - TableRow currentRow = fitResult->getRow(i); - m_fitCharacteristics->addColumn("str", currentRow.cell(0)); - } -} - -void PoldiFitPeaks1D::initializePeakResultWorkspace( - TableWorkspace_sptr peakResultWorkspace) { - peakResultWorkspace->addColumn("str", "Q"); - peakResultWorkspace->addColumn("str", "d"); - peakResultWorkspace->addColumn("double", "deltaD/d *10^3"); - peakResultWorkspace->addColumn("str", "FWHM rel. *10^3"); - peakResultWorkspace->addColumn("str", "Intensity"); -} - -void PoldiFitPeaks1D::storePeakResult(TableRow tableRow, PoldiPeak_sptr peak) { - UncertainValue q = peak->q(); - UncertainValue d = peak->d(); - - tableRow << UncertainValueIO::toString(q) << UncertainValueIO::toString(d) - << d.error() / d.value() * 1e3 - << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3) - << UncertainValueIO::toString(peak->intensity()); -} - -TableWorkspace_sptr -PoldiFitPeaks1D::generateResultTable(PoldiPeakCollection_sptr peaks) { - TableWorkspace_sptr outputTable = boost::dynamic_pointer_cast( - WorkspaceFactory::Instance().createTable()); - initializePeakResultWorkspace(outputTable); - - for (size_t i = 0; i < peaks->peakCount(); ++i) { - storePeakResult(outputTable->appendRow(), peaks->peak(i)); - } - - return outputTable; -} - ->>>>>>> origin/master -} // namespace Poldi -} // namespace Mantid From 047b93c109a21f91a0136e4e446f064ed2448b66 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 4 Feb 2015 14:52:10 +0100 Subject: [PATCH 108/130] Refs #10263. Added documentation for PoldiFitPeaks1D-v2 --- .../source/algorithms/PoldiFitPeaks1D-v1.rst | 2 +- .../source/algorithms/PoldiFitPeaks1D-v2.rst | 47 ++++++++++++++++++ .../poldi_2_phases_theoretical_reference.nxs | Bin 0 -> 168200 bytes 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v2.rst create mode 100644 Test/AutoTestData/UsageData/poldi_2_phases_theoretical_reference.nxs diff --git a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst index 8f600749b57b..4b5c5eea469b 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v1.rst @@ -29,7 +29,7 @@ Usage .. include:: ../usagedata-note.txt -The following small usage example performs a peak fit on the sample data already used in :ref:`algm-PoldiAutoCorrelation` and :ref:`algm-PoldiPeakSearch`. After the fit, the plots can be viewed and +The following small usage example performs a peak fit on the sample data already used in :ref:`algm-PoldiAutoCorrelation` and :ref:`algm-PoldiPeakSearch`. After the fit, the plots can be viewed and used to visually judge the quality of the fits. .. testcode:: ExSiliconPeakFit diff --git a/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v2.rst b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v2.rst new file mode 100644 index 000000000000..9882ddde3fdf --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks1D-v2.rst @@ -0,0 +1,47 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +Version two of PoldiFitPeaks1D was introduced to solve problems with overlapping peaks. Instead of refining individual peaks, the algorithm defines a range of x-values around each peak. In a second step the algorithm checks whether neighboring ranges are overlapping and merges them if that's the case. The amount of overlap that should be tolerated by the algorithm can be changed through the parameter `AllowedOverlap`, where 0 means that ranges that overlap in any way should be merged, while with 1, they are not merged at all. Merged ranges then contain more than one peak, which are refined together. This way, reasonable results can also be obtained for overlapping peaks. + +Another thing that's different from version 1 of the algorithm is the background description. When peaks overlap, the description with a quadratic function is not particularly suitable. Instead, Chebyshev-polynomes of degrees 0, 1 and 2 are fitted and the best solution (with respect to quality of the fit) is selected automatically. + +Usage +----- + +.. include:: ../usagedata-note.txt + +The following usage example loads an example correlation spectrum that was calculated for a sample containing two compounds with very similar lattice parameters. + +.. testcode:: ExSiliconPeakFit2 + + # Load correlation spectrum + Load(Filename='poldi_2_phases_theoretical_reference.nxs', OutputWorkspace='correlation_spectrum') + + # Perform peak search + PoldiPeakSearch(InputWorkspace='correlation_spectrum', MinimumPeakSeparation=8, MaximumPeakNumber=12, MinimumPeakHeight=180, OutputWorkspace='peaks') + + # Fit peaks with proper overlap handling + PoldiFitPeaks1D(InputWorkspace='correlation_spectrum', FwhmMultiples=2, AllowedOverlap=0.1, PoldiPeakTable='peaks') + +Variation of the `AllowedOverlap`-parameter influences the quality of the fit at some point if it's too close to 1. Setting it to 1 makes the algorithm's behavior similar to that of version 1. + +.. testcode:: ExSiliconPeakFit2 + + # Load correlation spectrum + Load(Filename='poldi_2_phases_theoretical_reference.nxs', OutputWorkspace='correlation_spectrum') + + # Perform peak search + PoldiPeakSearch(InputWorkspace='correlation_spectrum', MinimumPeakSeparation=8, MaximumPeakNumber=9, MinimumPeakHeight=180, OutputWorkspace='peaks') + + # Too large allowed overlap, fits will have bad quality. + PoldiFitPeaks1D(InputWorkspace='correlation_spectrum', FwhmMultiples=2, AllowedOverlap=0.9, PoldiPeakTable='peaks') + +.. categories:: diff --git a/Test/AutoTestData/UsageData/poldi_2_phases_theoretical_reference.nxs b/Test/AutoTestData/UsageData/poldi_2_phases_theoretical_reference.nxs new file mode 100644 index 0000000000000000000000000000000000000000..7466e421e054bb0d2b1b8133f1ebd1d0900a4fc9 GIT binary patch literal 168200 zcmeFZ2SAg{(lAU>dPkacQBaYN(m^Q#B1KU_TBJlkAfXdFQWT^K2&gm>1r!01-a)F; zrS~cw5^CuA6O!mT=l*)nx%YeDTV7Ymw%OU;+1c5ddG>jNR1`0hlN=|(K?NcroFh0? zhe_-Y0uzWL@D7Wxd2Ib1Oad1Z2V&xMG&l|}4gvBH2Zs?;PKCkGfsZcm!8E*aT}cTC z35mszjWNw|?hv9=MA(8~@&73bs3=|1LQPl~Giwe^+=$^bOcuw+802Va255^?SD5vN6X*MkLfqi0&PQAOEnA zKgy4Ej378<3M4+X{J{I6{2)S0I2_2~=x}frme3=o!sLHN|J@Y8%8&P$Y5HJd3ygfg zo=c3v=!zmt{r7!9jNa$E08?vY2lOUE!l3p!iWRZ@KttET*v8fxyPa{gH8d4*k+m3h z#d&cAjTj5xh{?~QHq)>0LkeK!@E_^*XVwR$I$-Iop$h~#+Pfn2XuSkmfs4^laB- ze}fd7PmkhoV8(Li*v|)rmCq2mpTntOssriKi9=!`lkYM4c8p-ZgMp*^<9V%wuFzFR z$5{EzyMV@o#ixzQJ7DBG2HpR9qyV|0sxCjP;^1%uLL3DkHrBf8S2;|&s$XOghpOUb4wR0;&%yEAqxJ&&sO1+I6cH7?ASft!i38ch5@gO{ z545!hIv|^(=YYXzYiy6yQ5=Ex95%+b{2VusoggP=W9-Ob>A(TBM0RQ~$>CuJbW~N8 zv^3*$Hnw&GN*y-hb9A-ECQ*70rt}cP149{PJ0zu$L_+@O@Gu42*z)}b^zR}7qq;{D z!NwL0LXm<0kT$l~#+D$C{}&7ZiC?M{BF7OV!VzR{y#3yn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G8bn+8^|>Fw(tJZ*LV0B?=2UfVyiW}_HoCwnhDaGYwDMjsYPp&D#H z{+{h&gM<<;fXG4c<+}MBWp}i-cTpO(Q4X+s4 zw5B#l7xQQnjLWX^GpnT=<+;$aR(2AZY}M(^$tQY0krAy}tXst2Ym? zzlQVh%AUsQ!hEOua_7y%mECS0etpAvII-MDRFG=yHC^Z71?#Oglbwgp@3r*d@zwl2 zJT?Y)hj;bn;d>^;Io(wGAg-?udvc?VsPO@&r}{j+m7wJXR52~y4pGZaR548ux-`ec* zx0SFxSA&j^TECa1T>XZ-H2x+ z-RC%Nx4X~r{)YEC{?KP5Do8cRsn-In!!0+3TF6&a(93@zs3ZFg6Buhj;a^ zbB=n~`19-weVr5f@WG?*$zj`Hco0tH0j=T}51cVRo%;^^ydTRuz;su=cYL~g`1#3m zY<+k=^1w5;LAYPHh51e3XWhoLW|(ebJiGNAEGrpbCrmdn-p&g>rb0i##CDi^&uvcL zC7#>7;@vhr>h+_~FD`vg<8nQ0>9&67UC(UX?XG9;l#@&S=Qbk)Hll)5 zW3TCYJu~!vtIcGuXYTrdr4Ns<=Jm|j7}y=&)w`ala2$ng@IqhDg!Ayk>x`*451+Y9 z%)>WN=+CfU!==wR`~6en`87OGR6f`^U6}85U+%nl_^L-t7^@&T2lr}o;~kU(&T_8$l|1*_+;9$4Q!R2y17yuQ{ySR3x`>E5_naPpRR zPT%H6PgBP~9zMQzI3NMBq+2T$0t(9T;K(NbM(xRHiWi literal 0 HcmV?d00001 From 4f75f4caf0dea10970354315d6cbca40a34b61d1 Mon Sep 17 00:00:00 2001 From: Marina Ganeva Date: Wed, 4 Feb 2015 15:05:03 +0100 Subject: [PATCH 109/130] Changes to DarwinSetup.cmake have been removed. --- Code/Mantid/Build/CMake/DarwinSetup.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Mantid/Build/CMake/DarwinSetup.cmake b/Code/Mantid/Build/CMake/DarwinSetup.cmake index 52cd5df239c7..8e519bc7ecdc 100644 --- a/Code/Mantid/Build/CMake/DarwinSetup.cmake +++ b/Code/Mantid/Build/CMake/DarwinSetup.cmake @@ -43,7 +43,7 @@ message (STATUS "Operating System: Mac OS X ${OSX_VERSION} (${OSX_CODENAME})") ########################################################################### # Only use Third_Party for OS X older than Mavericks (10.9) -#if (OSX_VERSION VERSION_LESS 10.9) +if (OSX_VERSION VERSION_LESS 10.9) message ( STATUS "Using Third_Party.") set ( CMAKE_INCLUDE_PATH "${THIRD_PARTY}/include" ) @@ -51,9 +51,9 @@ message (STATUS "Operating System: Mac OS X ${OSX_VERSION} (${OSX_CODENAME})") set ( CMAKE_LIBRARY_PATH "${THIRD_PARTY}/lib/mac64" ) set ( BOOST_LIBRARYDIR "${THIRD_PARTY}/lib/mac64" ) -#else() -# message ( STATUS "OS X Mavericks - Not using Mantid Third_Party libraries.") -#endif() +else() + message ( STATUS "OS X Mavericks - Not using Mantid Third_Party libraries.") +endif() # Enable the use of the -isystem flag to mark headers in Third_Party as system headers set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") From 46ad7528dd5c759024c67b597acd295026bef4d2 Mon Sep 17 00:00:00 2001 From: Marina Ganeva Date: Wed, 4 Feb 2015 15:12:04 +0100 Subject: [PATCH 110/130] The case of Time-of-flight Spectroscopy is fixed for the TOFTOF instrument. --- Code/Mantid/instrument/Facilities.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/instrument/Facilities.xml b/Code/Mantid/instrument/Facilities.xml index 8c2cb5d8be27..108d06ac3954 100644 --- a/Code/Mantid/instrument/Facilities.xml +++ b/Code/Mantid/instrument/Facilities.xml @@ -619,7 +619,7 @@ Neutron Spectroscopy Reactor Direct Geometry Spectroscopy - Time-of-flight spectroscopy + Time-of-flight Spectroscopy From 49d3241a513a706f9f286522c6c3ec72941441ac Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Wed, 4 Feb 2015 14:22:51 +0000 Subject: [PATCH 111/130] Added link for DOI of referenced paper --- Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst index a18d605cc9f1..6a0384c4f825 100644 --- a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst +++ b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst @@ -47,8 +47,8 @@ The method used here is based upon work presented in the following two papers, although it does not yet fully implement all aspects discussed there (e.g. there's no multiple scattering and no concentric cylinders). -#. I.A. Blech & B.L. Averbach, *Multiple Scattering of Neutrons in - Vanadium and Copper*, Phys. Rev. **137 4A** (1965) A1113. +#. `I.A. Blech & B.L. Averbach, *Multiple Scattering of Neutrons in + Vanadium and Copper*, Phys. Rev. **137 4A** (1965) A1113 `_. #. A.K. Soper & P.A. Egelstaff, *Multiple Scattering and Attenuation of Neutrons in Concentric Cylinders*, NIM **178** (1980) 415. From cfb4016130eea79ce85f8fb7dd1d4561f17424bd Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Wed, 4 Feb 2015 14:24:52 +0000 Subject: [PATCH 112/130] Reformatting link --- Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst index 6a0384c4f825..fed30bab16e9 100644 --- a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst +++ b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst @@ -47,8 +47,9 @@ The method used here is based upon work presented in the following two papers, although it does not yet fully implement all aspects discussed there (e.g. there's no multiple scattering and no concentric cylinders). -#. `I.A. Blech & B.L. Averbach, *Multiple Scattering of Neutrons in - Vanadium and Copper*, Phys. Rev. **137 4A** (1965) A1113 `_. +#. I.A. Blech & B.L. Averbach, *Multiple Scattering of Neutrons in + Vanadium and Copper*, Phys. Rev. **137 4A** (1965) A1113 + `DOI/10.1103/PhysRev.137.A1113 `_. #. A.K. Soper & P.A. Egelstaff, *Multiple Scattering and Attenuation of Neutrons in Concentric Cylinders*, NIM **178** (1980) 415. From cb945faf5b75733db4c856dd679e3047ba9a36cb Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 4 Feb 2015 15:32:38 +0100 Subject: [PATCH 113/130] Remove TODO comment from SassenaFFTTest.h Removed an accidental comment that caused a compiler warning. --- Code/Mantid/Framework/Algorithms/test/SassenaFFTTest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/Algorithms/test/SassenaFFTTest.h b/Code/Mantid/Framework/Algorithms/test/SassenaFFTTest.h index f7cc36c4a6e6..12aab99bd661 100644 --- a/Code/Mantid/Framework/Algorithms/test/SassenaFFTTest.h +++ b/Code/Mantid/Framework/Algorithms/test/SassenaFFTTest.h @@ -2,7 +2,7 @@ #define MANTID_ALGORITHMS_SASSENAFFTTEST_H_ #include -#include #TODO HARDCODED INSTRUMENT +#include #include "MantidAlgorithms/SassenaFFT.h" #include "MantidKernel/UnitFactory.h" #include "MantidDataHandling/SaveAscii.h" From af6f086195f8546fa98a341295ffef8ef833969b Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Wed, 4 Feb 2015 16:11:32 +0000 Subject: [PATCH 114/130] Only check for F2Py is it is actually needed Refs #11009 --- Code/Mantid/scripts/Inelastic/IndirectAbsCor.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/IndirectAbsCor.py b/Code/Mantid/scripts/Inelastic/IndirectAbsCor.py index f0fcd6ae1ef8..6ef61c5e2228 100644 --- a/Code/Mantid/scripts/Inelastic/IndirectAbsCor.py +++ b/Code/Mantid/scripts/Inelastic/IndirectAbsCor.py @@ -2,10 +2,6 @@ ## Handle selection of .pyd files for absorption corrections import platform, sys from IndirectImport import * -if is_supported_f2py_platform(): - cylabs = import_f2py("cylabs") -else: - unsupported_message() from IndirectCommon import * from mantid.simpleapi import * @@ -139,6 +135,14 @@ def AbsRun(inputWS, geom, beam, ncan, size, density, sigs, siga, avar, Verbose, #initially set errors to zero eZero = np.zeros(nw) + # F2Py only needed for cylinder + if geom == 'cyl': + if is_supported_f2py_platform(): + cylabs = import_f2py("cylabs") + else: + unsupported_message() + return + for n in range(ndet): #geometry is flat if geom == 'flt': From 831a7e98d4bd8f0f98c2fb652d4ac9ff06017a17 Mon Sep 17 00:00:00 2001 From: Vickie Lynch Date: Wed, 4 Feb 2015 15:59:37 -0500 Subject: [PATCH 115/130] Refs #11007 add 2nd pass for integration --- .../MDEvents/src/IntegrateEllipsoids.cpp | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/Code/Mantid/Framework/MDEvents/src/IntegrateEllipsoids.cpp b/Code/Mantid/Framework/MDEvents/src/IntegrateEllipsoids.cpp index bee5b63cb61d..19b6ec91f76a 100644 --- a/Code/Mantid/Framework/MDEvents/src/IntegrateEllipsoids.cpp +++ b/Code/Mantid/Framework/MDEvents/src/IntegrateEllipsoids.cpp @@ -14,6 +14,7 @@ #include "MantidMDEvents/UnitsConversionHelper.h" #include "MantidMDEvents/Integrate3DEvents.h" #include "MantidMDEvents/IntegrateEllipsoids.h" +#include "MantidKernel/Statistics.h" using namespace Mantid::API; using namespace Mantid::Kernel; @@ -107,6 +108,15 @@ void IntegrateEllipsoids::init() { Direction::Output), "The output PeaksWorkspace will be a copy of the input PeaksWorkspace " "with the peaks' integrated intensities."); + + declareProperty("CutoffIsigI", EMPTY_DBL() , mustBePositive, + "Cuttoff for I/sig(i) when finding mean of half-length of " + "major radius in first pass when SpecifySize is false." + "Default is no second pass."); + + declareProperty("NumSigmas", 3, + "Number of sigmas to add to mean of half-length of " + "major radius for second pass when SpecifySize is false."); } //--------------------------------------------------------------------- @@ -133,6 +143,8 @@ void IntegrateEllipsoids::exec() { peak_ws = in_peak_ws->clone(); } double radius = getProperty("RegionRadius"); + int numSigmas = getProperty("NumSigmas"); + double cutoffIsigI = getProperty("CutoffIsigI"); bool specify_size = getProperty("SpecifySize"); double peak_radius = getProperty("PeakSize"); double back_inner_radius = getProperty("BackgroundInnerSize"); @@ -253,6 +265,7 @@ void IntegrateEllipsoids::exec() { double inti; double sigi; + std::vector r1,r2,r3; for (size_t i = 0; i < n_peaks; i++) { V3D hkl(peaks[i].getH(), peaks[i].getK(), peaks[i].getL()); if (Geometry::IndexingUtils::ValidIndex(hkl, 1.0)) { @@ -264,6 +277,12 @@ void IntegrateEllipsoids::exec() { peaks[i].setIntensity(inti); peaks[i].setSigmaIntensity(sigi); if (axes_radii.size() == 3) { + if (inti/sigi > cutoffIsigI && !specify_size) + { + r1.push_back(axes_radii[0]); + r2.push_back(axes_radii[1]); + r3.push_back(axes_radii[2]); + } g_log.notice() << "Radii of three axes of ellipsoid for integrating peak " << i << " = "; @@ -277,7 +296,60 @@ void IntegrateEllipsoids::exec() { peaks[i].setSigmaIntensity(0.0); } } + if (r1.size() > 1 && !specify_size) + { + Statistics stats = getStatistics(r1); + g_log.notice() << "r1: " + << " mean " << stats.mean + << " standard_deviation " << stats.standard_deviation + << " minimum " << stats.minimum + << " maximum " << stats.maximum + << " median " << stats.median << "\n"; + stats = getStatistics(r2); + g_log.notice() << "r2: " + << " mean " << stats.mean + << " standard_deviation " << stats.standard_deviation + << " minimum " << stats.minimum + << " maximum " << stats.maximum + << " median " << stats.median << "\n"; + stats = getStatistics(r3); + g_log.notice() << "r3: " + << " mean " << stats.mean + << " standard_deviation " << stats.standard_deviation + << " minimum " << stats.minimum + << " maximum " << stats.maximum + << " median " << stats.median << "\n"; + specify_size=true; + peak_radius = stats.mean + numSigmas * stats.standard_deviation; + back_inner_radius = peak_radius; + back_outer_radius = peak_radius * 1.25992105; // A factor of 2 ^ (1/3) will make the background + // shell volume equal to the peak region volume. + for (size_t i = 0; i < n_peaks; i++) { + V3D hkl(peaks[i].getH(), peaks[i].getK(), peaks[i].getL()); + if (Geometry::IndexingUtils::ValidIndex(hkl, 1.0)) { + V3D peak_q(peaks[i].getQLabFrame()); + std::vector axes_radii; + integrator.ellipseIntegrateEvents(peak_q, specify_size, peak_radius, + back_inner_radius, back_outer_radius, + axes_radii, inti, sigi); + peaks[i].setIntensity(inti); + peaks[i].setSigmaIntensity(sigi); + if (axes_radii.size() == 3) { + g_log.notice() + << "Radii of three axes of ellipsoid for integrating peak " << i + << " = "; + for (int i3 = 0; i3 < 3; i3++) { + g_log.notice() << axes_radii[i3] << " "; + } + g_log.notice() << std::endl; + } + } else { + peaks[i].setIntensity(0.0); + peaks[i].setSigmaIntensity(0.0); + } + } + } // This flag is used by the PeaksWorkspace to evaluate whether it has been // integrated. peak_ws->mutableRun().addProperty("PeaksIntegrated", 1, true); From b425cee3be0091bd207a06ab269b76584ff6a9af Mon Sep 17 00:00:00 2001 From: Owen Arnold Date: Thu, 5 Feb 2015 09:03:40 +0000 Subject: [PATCH 116/130] refs #11013. delete pointer. --- .../Mantid/Framework/DataObjects/test/PeakShapeSphericalTest.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/DataObjects/test/PeakShapeSphericalTest.h b/Code/Mantid/Framework/DataObjects/test/PeakShapeSphericalTest.h index 98385ae84954..05642406e4e7 100644 --- a/Code/Mantid/Framework/DataObjects/test/PeakShapeSphericalTest.h +++ b/Code/Mantid/Framework/DataObjects/test/PeakShapeSphericalTest.h @@ -96,7 +96,8 @@ class PeakShapeSphericalTest : public CxxTest::TestSuite { TS_ASSERT_EQUALS(a.algorithmName(), clone->algorithmName()); TS_ASSERT_EQUALS(a.algorithmVersion(), clone->algorithmVersion()); TS_ASSERT_DIFFERS(clone, &a); - } + delete clone; +} void test_toJSON() { const double radius = 2; From 5fec6be6643ddefdddbdc47abae60d26d208d2d0 Mon Sep 17 00:00:00 2001 From: Martyn Gigg Date: Thu, 5 Feb 2015 09:09:29 +0000 Subject: [PATCH 117/130] Create progress object on the stack Avoids having to delete the pointer --- Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index c97a708f0d6b..9b5867a2830a 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -266,11 +266,11 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { // PRAGMA_OMP(parallel for schedule(dynamic, 10) ) // Initialize progress reporting int nPeaks = peakWS->getNumberPeaks(); - Progress *m_progress = new Progress(this, 0., 1., nPeaks); + Progress progress(this, 0., 1., nPeaks); for (int i = 0; i < nPeaks; ++i) { if (this->getCancel()) break; // User cancellation - m_progress->report(); + progress.report(); // Get a direct ref to that peak. IPeak &p = peakWS->getPeak(i); From f51ae097e575c118c28069d83ff7ce9ec1bbded0 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Thu, 5 Feb 2015 09:15:59 +0000 Subject: [PATCH 118/130] Fix broken link in SaveAscii documentation --- Code/Mantid/docs/source/algorithms/SaveAscii-v2.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/docs/source/algorithms/SaveAscii-v2.rst b/Code/Mantid/docs/source/algorithms/SaveAscii-v2.rst index d81ef033833d..f66cbedd67c2 100644 --- a/Code/Mantid/docs/source/algorithms/SaveAscii-v2.rst +++ b/Code/Mantid/docs/source/algorithms/SaveAscii-v2.rst @@ -9,7 +9,7 @@ Description ----------- -The workspace data are stored in the file in columns: the first column contains the X-values, followed by pairs of Y and E values. Columns are separated by commas. The resulting file can normally be loaded into a workspace by the `LoadAscii2 `_ algorithm. +The workspace data are stored in the file in columns: the first column contains the X-values, followed by pairs of Y and E values. Columns are separated by commas. The resulting file can normally be loaded into a workspace by the :ref:`algm-LoadAscii` algorithm. Limitations ########### From 9c7cc5997b12e8017e4d828b0dec55e103b0b784 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Thu, 5 Feb 2015 09:16:28 +0000 Subject: [PATCH 119/130] Use UnitConversion methods in ConvertSpectrumAxis Refs #7862 --- .../Algorithms/src/ConvertSpectrumAxis2.cpp | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp index 888c49a7df18..e697859d12e9 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp @@ -3,6 +3,7 @@ //---------------------------------------------------------------------- #include "MantidAlgorithms/ConvertSpectrumAxis2.h" #include "MantidAPI/NumericAxis.h" +#include "MantidKernel/UnitConversion.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/WorkspaceValidators.h" #include "MantidAPI/Run.h" @@ -133,28 +134,19 @@ void ConvertSpectrumAxis2::createElasticQMap(const std::string &targetUnit) { else if (emodeStr == "Indirect") emode = 2; - // Get conversion factor from energy(meV) to wavelength(angstroms) - Kernel::Units::Energy energyUnit; - double wavelengthFactor(0.0), wavelengthPower(0.0); - energyUnit.quickConversion("Wavelength", wavelengthFactor, wavelengthPower); - for (size_t i = 0; i < m_nHist; i++) { IDetector_const_sptr detector = m_inputWS->getDetector(i); - double theta(0.0), efixed(0.0); + double twoTheta(0.0), efixed(0.0); if (!detector->isMonitor()) { - theta = m_inputWS->detectorTwoTheta(detector) / 2.0; + twoTheta = m_inputWS->detectorTwoTheta(detector) / 2.0; efixed = getEfixed(detector, m_inputWS, emode); // get efixed } else { - theta = 0.0; + twoTheta = 0.0; efixed = DBL_MIN; } - const double stheta = std::sin(theta); - - // Calculate the wavelength to allow it to be used to convert to elasticQ. - double wavelength = wavelengthFactor * std::pow(efixed, wavelengthPower); - // The MomentumTransfer value. - double elasticQInAngstroms = 4.0 * M_PI * stheta / wavelength; + // Convert to MomentumTransfer + double elasticQInAngstroms = Kernel::UnitConversion::run(twoTheta, efixed); if (targetUnit == "ElasticQ") { m_indexMap.insert(std::make_pair(elasticQInAngstroms, i)); From 476cca04bae06c51164d9ae6443377453dcd1680 Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Thu, 5 Feb 2015 09:37:26 +0000 Subject: [PATCH 120/130] fix includes after conflict merge, re #7523 --- Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index dcf86598228a..2c6f5e9efd36 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -13,6 +13,8 @@ #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/RebinnedOutput.h" #include "MantidDataObjects/PeaksWorkspace.h" +#include "MantidDataObjects/PeakNoShapeFactory.h" +#include "MantidDataObjects/PeakShapeSphericalFactory.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/DateAndTime.h" From c5a422119329bdfa72608f1e54b991bcb2dbafe5 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Thu, 5 Feb 2015 10:05:57 +0000 Subject: [PATCH 121/130] Correct a couple of include paths Refs #10298 --- .../inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h | 2 +- .../MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h index 1def23931327..92d33f5cbfb8 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h @@ -2,7 +2,7 @@ #define MANTIDQTCUSTOMINTERFACES_DENSITYOFSTATES_H_ #include "ui_DensityOfStates.h" -#include "MantidQtCustomInterfaces/IndirectSimulationTab.h" +#include "MantidQtCustomInterfaces/Indirect/IndirectSimulationTab.h" namespace MantidQt { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp index 7ba56cf3dad4..4700bbb5f125 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp @@ -1,4 +1,4 @@ -#include "MantidQtCustomInterfaces/DensityOfStates.h" +#include "MantidQtCustomInterfaces/Indirect/DensityOfStates.h" #include "MantidQtCustomInterfaces/UserInputValidator.h" From 86ba462ccfcde01882d13447ffa5b7faa11ee031 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 5 Feb 2015 18:45:24 +0100 Subject: [PATCH 122/130] Refs #11023. Added failing unit test for Kernel::Matrix --- Code/Mantid/Framework/Kernel/test/MatrixTest.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Code/Mantid/Framework/Kernel/test/MatrixTest.h b/Code/Mantid/Framework/Kernel/test/MatrixTest.h index 41334c83ca17..a7730079ac20 100644 --- a/Code/Mantid/Framework/Kernel/test/MatrixTest.h +++ b/Code/Mantid/Framework/Kernel/test/MatrixTest.h @@ -86,6 +86,17 @@ class MatrixTest: public CxxTest::TestSuite TS_ASSERT( A.equals(B, 0.15) ); } + void test_not_equal() + { + Matrix A(3, 3, true); + Matrix B(3, 3, true); + + A[0][0] = -1.0; + + TS_ASSERT(A != B); + TS_ASSERT(!(A == B)); + } + /** Check that we can swap rows and columns */ From 07c6e4f7f900127a94368059ea3605c28f5e02f7 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 5 Feb 2015 18:54:39 +0100 Subject: [PATCH 123/130] Refs #11023. Fix inequality operator. With this change, the previously failing test passes. --- Code/Mantid/Framework/Kernel/src/Matrix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/Kernel/src/Matrix.cpp b/Code/Mantid/Framework/Kernel/src/Matrix.cpp index 3fdcc87ef585..536f4bcfd424 100644 --- a/Code/Mantid/Framework/Kernel/src/Matrix.cpp +++ b/Code/Mantid/Framework/Kernel/src/Matrix.cpp @@ -435,7 +435,7 @@ Element by Element comparison @return false :: failure */ { - return (this->operator==(A)); + return !(this->operator==(A)); } template From 515e5bdc8c7da8d3a423ee1bed1c2510c8190f5f Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Thu, 5 Feb 2015 21:20:09 +0100 Subject: [PATCH 124/130] Refs #11022. Fixing PoldiAnalyseResiduals doctest --- .../docs/source/algorithms/PoldiAnalyseResiduals-v1.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst index e34169891782..3d29f8faa9a6 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiAnalyseResiduals-v1.rst @@ -40,7 +40,10 @@ The following example shows how to calculate the residuals following a fit perfo Version=1) # Fit peaks to original 2D data - fit_result_Si_2D = PoldiFitPeaks2D(data_Si, PoldiPeakWorkspace="peaks_Si_1D", MaximumIterations=100, RefinedPoldiPeakWorkspace="peaks_Si_2D") + fit_result_Si_2D = PoldiFitPeaks2D(data_Si, + PoldiPeakWorkspace="peaks_Si_1D", MaximumIterations=100, + RefinedPoldiPeakWorkspace="peaks_Si_2D", + Calculated1DSpectrum="fit_result_Si_1D") # Calculate residuals residuals_Si = PoldiAnalyseResiduals(MeasuredCountData=data_Si, FittedCountData="fit_result_Si_2D", MaxIterations=5) From fc411480fd18fd88e3393f803dbe8ee594172122 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 6 Feb 2015 11:57:38 +0000 Subject: [PATCH 125/130] Added warning for no intersection Refs #11031 --- Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp b/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp index debe89ca361d..e7b5eea75913 100644 --- a/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp +++ b/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp @@ -453,6 +453,10 @@ void MonteCarloAbsorption::initCaches() { m_numVolumeElements = m_blocks.size(); g_log.debug() << "Sample + container divided into " << m_numVolumeElements << " blocks."; + if (m_numVolumeElements == 0) { + g_log.error() << "No blocks intersect with the sample + container.\n"; + throw std::runtime_error("No intersection with sample + container."); + } if (m_numVolumeElements == numPossibleVolElements) g_log.debug("\n"); else From 6ad33f532a858cb69e441cc28812a1d1ff0ff85c Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 6 Feb 2015 12:20:36 +0000 Subject: [PATCH 126/130] Clean up logging output Refs #11031 --- .../Framework/Algorithms/src/MonteCarloAbsorption.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp b/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp index e7b5eea75913..9a9714963374 100644 --- a/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp +++ b/Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp @@ -452,14 +452,11 @@ void MonteCarloAbsorption::initCaches() { m_numVolumeElements = m_blocks.size(); g_log.debug() << "Sample + container divided into " << m_numVolumeElements - << " blocks."; + << " blocks.\n"; if (m_numVolumeElements == 0) { - g_log.error() << "No blocks intersect with the sample + container.\n"; throw std::runtime_error("No intersection with sample + container."); } - if (m_numVolumeElements == numPossibleVolElements) - g_log.debug("\n"); - else + if (m_numVolumeElements != numPossibleVolElements) g_log.debug() << " Skipped " << (numPossibleVolElements - m_numVolumeElements) << " blocks that do not intersect with the sample + container\n"; From 5a48e0ca006a3a241fd6c0feb4aad58d21cea940 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Fri, 6 Feb 2015 17:02:18 +0100 Subject: [PATCH 127/130] Refs #11035. Remove CurveFitting dependency from SINQ Refactored PoldiSpectrumConstantBackground to have FlatBackground as a class member instead of inheriting from it. --- Code/Mantid/Framework/SINQ/CMakeLists.txt | 4 +- .../PoldiSpectrumConstantBackground.h | 16 ++++- .../PoldiSpectrumConstantBackground.cpp | 60 ++++++++++++++++--- 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt b/Code/Mantid/Framework/SINQ/CMakeLists.txt index 138248b961a5..7f4f60465b93 100644 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/CMakeLists.txt @@ -153,9 +153,9 @@ set_target_properties ( SINQ PROPERTIES OUTPUT_NAME MantidSINQ # Add to the 'Framework' group in VS set_property ( TARGET SINQ PROPERTY FOLDER "MantidFramework" ) -include_directories ( inc ../MDEvents/inc ../CurveFitting/inc ) +include_directories ( inc ../MDEvents/inc ) -target_link_libraries ( SINQ ${MANTIDLIBS} MDEvents CurveFitting ) +target_link_libraries ( SINQ ${MANTIDLIBS} MDEvents ) # Add the unit tests directory add_subdirectory ( test ) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h index 2b444e0f654d..617070c2a1eb 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumConstantBackground.h @@ -2,7 +2,8 @@ #define MANTID_SINQ_POLDISPECTRUMCONSTANTBACKGROUND_H_ #include "MantidSINQ/DllConfig.h" -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidAPI/IFunction1D.h" +#include "MantidAPI/ParamFunction.h" #include "MantidSINQ/PoldiUtilities/IPoldiFunction1D.h" namespace Mantid { @@ -37,7 +38,8 @@ namespace Poldi { Code Documentation is available at: */ class MANTID_SINQ_DLL PoldiSpectrumConstantBackground - : public CurveFitting::FlatBackground, + : public API::ParamFunction, + public API::IFunction1D, public IPoldiFunction1D { public: PoldiSpectrumConstantBackground(); @@ -45,6 +47,10 @@ class MANTID_SINQ_DLL PoldiSpectrumConstantBackground virtual std::string name() const { return "PoldiSpectrumConstantBackground"; } + void function1D(double *out, const double *xValues, const size_t nData) const; + void functionDeriv1D(API::Jacobian *out, const double *xValues, + const size_t nData); + virtual void setWorkspace(boost::shared_ptr ws); size_t getTimeBinCount() const; @@ -52,8 +58,14 @@ class MANTID_SINQ_DLL PoldiSpectrumConstantBackground const API::FunctionDomain1D &domain, API::FunctionValues &values) const; + void setParameter(const std::string &name, const double &value, bool explicitlySet = true); + void setParameter(size_t i, const double &value, bool explicitlySet = true); + protected: + void init(); + size_t m_timeBinCount; + API::IFunction1D_sptr m_flatBackground; }; } // namespace Poldi diff --git a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp index 3473eb28eff5..a617fe4e7799 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumConstantBackground.cpp @@ -12,11 +12,29 @@ DECLARE_FUNCTION(PoldiSpectrumConstantBackground) /// Default constructor PoldiSpectrumConstantBackground::PoldiSpectrumConstantBackground() - : FlatBackground(), IPoldiFunction1D(), m_timeBinCount(0) {} + : IFunction1D(), IPoldiFunction1D(), m_timeBinCount(0), m_flatBackground() { +} /// Destructor PoldiSpectrumConstantBackground::~PoldiSpectrumConstantBackground() {} +void PoldiSpectrumConstantBackground::function1D(double *out, + const double *xValues, + const size_t nData) const { + + if (m_flatBackground) { + m_flatBackground->function1D(out, xValues, nData); + } +} + +void PoldiSpectrumConstantBackground::functionDeriv1D(Jacobian *out, + const double *xValues, + const size_t nData) { + if (m_flatBackground) { + m_flatBackground->functionDeriv1D(out, xValues, nData); + } +} + void PoldiSpectrumConstantBackground::setWorkspace( boost::shared_ptr ws) { MatrixWorkspace_const_sptr matrixWs = @@ -34,16 +52,40 @@ size_t PoldiSpectrumConstantBackground::getTimeBinCount() const { void PoldiSpectrumConstantBackground::poldiFunction1D( const std::vector &indices, const API::FunctionDomain1D &domain, API::FunctionValues &values) const { - double backgroundDetector = getParameter(0); - double wireCount = static_cast(indices.size()); - double distributionFactor = wireCount * static_cast(m_timeBinCount) / - static_cast(domain.size()); - double backgroundD = backgroundDetector * distributionFactor; - - for (size_t i = 0; i < values.size(); ++i) { - values.addToCalculated(i, backgroundD); + if (m_flatBackground) { + double backgroundDetector = m_flatBackground->getParameter(0); + double wireCount = static_cast(indices.size()); + double distributionFactor = wireCount * + static_cast(m_timeBinCount) / + static_cast(domain.size()); + double backgroundD = backgroundDetector * distributionFactor; + + for (size_t i = 0; i < values.size(); ++i) { + values.addToCalculated(i, backgroundD); + } } } +void PoldiSpectrumConstantBackground::setParameter(const std::string &name, + const double &value, + bool explicitlySet) { + ParamFunction::setParameter(name, value, explicitlySet); +} + +void PoldiSpectrumConstantBackground::setParameter(size_t i, + const double &value, + bool explicitlySet) { + if (m_flatBackground) { + m_flatBackground->setParameter(i, value, explicitlySet); + } +} + +void PoldiSpectrumConstantBackground::init() { + m_flatBackground = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction("FlatBackground")); + + declareParameter("A0"); +} + } // namespace SINQ } // namespace Mantid From 6ea32eb2f55decf42f9273674811cf0c99690ea3 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Fri, 6 Feb 2015 12:56:34 -0500 Subject: [PATCH 128/130] Adding reference to Soper paper --- Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst index fed30bab16e9..e1d05ef25d2d 100644 --- a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst +++ b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst @@ -49,9 +49,10 @@ there (e.g. there's no multiple scattering and no concentric cylinders). #. I.A. Blech & B.L. Averbach, *Multiple Scattering of Neutrons in Vanadium and Copper*, Phys. Rev. **137 4A** (1965) A1113 - `DOI/10.1103/PhysRev.137.A1113 `_. + `doi: 10.1103/PhysRev.137.A1113 `_ #. A.K. Soper & P.A. Egelstaff, *Multiple Scattering and Attenuation of Neutrons in Concentric Cylinders*, NIM **178** (1980) 415. + `doi: 10.1016/0029-554X(80)90820-4 `_ Usage ----- From ad6b8c1acae41da1c93543a91d98e8b4d4802d17 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Fri, 6 Feb 2015 13:00:14 -0500 Subject: [PATCH 129/130] Removed a character --- Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst index e1d05ef25d2d..65da7e3abcc5 100644 --- a/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst +++ b/Code/Mantid/docs/source/algorithms/CylinderAbsorption-v1.rst @@ -51,7 +51,7 @@ there (e.g. there's no multiple scattering and no concentric cylinders). Vanadium and Copper*, Phys. Rev. **137 4A** (1965) A1113 `doi: 10.1103/PhysRev.137.A1113 `_ #. A.K. Soper & P.A. Egelstaff, *Multiple Scattering and Attenuation of - Neutrons in Concentric Cylinders*, NIM **178** (1980) 415. + Neutrons in Concentric Cylinders*, NIM **178** (1980) 415 `doi: 10.1016/0029-554X(80)90820-4 `_ Usage From a14e349ed2b73a6cc109bedf4a05c9720086bbc6 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 9 Feb 2015 10:05:35 +0000 Subject: [PATCH 130/130] Fixed indentation, spelling error and Raman temp Refs #10298 --- .../WorkflowAlgorithms/DensityOfStates.py | 2 +- .../Indirect/DensityOfStates.h | 38 +- .../Indirect/DensityOfStates.ui | 2 +- .../Indirect/IndirectSimulation.h | 38 +- .../src/Indirect/DensityOfStates.cpp | 384 +++++++++--------- .../src/Indirect/IndirectSimulation.cpp | 90 ++-- .../source/interfaces/Indirect_Simulation.rst | 2 +- 7 files changed, 278 insertions(+), 278 deletions(-) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py index 3370a19e0cd3..ed313b04e543 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DensityOfStates.py @@ -35,7 +35,7 @@ def PyInit(self): self.declareProperty(name='BinWidth', defaultValue=1.0, doc='Set histogram resolution for binning (eV or cm**-1). Default is 1') - self.declareProperty(name='Temperature', defaultValue=300, + self.declareProperty(name='Temperature', defaultValue=300.0, doc='Temperature to use (in raman spectrum modelling). Default is 300') self.declareProperty(name='ZeroThreshold', defaultValue=3.0, diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h index 92d33f5cbfb8..f40d0db4e749 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.h @@ -6,37 +6,37 @@ namespace MantidQt { - namespace CustomInterfaces - { - class DLLExport DensityOfStates : public IndirectSimulationTab - { - Q_OBJECT +namespace CustomInterfaces +{ + class DLLExport DensityOfStates : public IndirectSimulationTab + { + Q_OBJECT - public: - DensityOfStates(QWidget * parent = 0); + public: + DensityOfStates(QWidget * parent = 0); - QString help() { return "DensityOfStates"; }; + QString help() { return "DensityOfStates"; }; void setup(); - bool validate(); - void run(); + bool validate(); + void run(); - /// Load default settings into the interface - void loadSettings(const QSettings& settings); + /// Load default settings into the interface + void loadSettings(const QSettings& settings); - private slots: - void dosAlgoComplete(bool error); + private slots: + void dosAlgoComplete(bool error); void handleFileChange(); void ionLoadComplete(bool error); - private: - /// The ui form - Ui::DensityOfStates m_uiForm; + private: + /// The ui form + Ui::DensityOfStates m_uiForm; /// Name of output workspace QString m_outputWsName; - }; - } // namespace CustomInterfaces + }; +} // namespace CustomInterfaces } // namespace MantidQt #endif //MANTIDQTCUSTOMINTERFACES_DENSITYOFSTATES_H_ diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.ui index 414659460424..ba7d4867d5ce 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/DensityOfStates.ui @@ -426,7 +426,7 @@ 1000.000000000000000 - 0.100000000000000 + 10.000000000000000 300.000000000000000 diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h index 58dbece0e91e..10a5d9ed028a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectSimulation.h @@ -13,11 +13,11 @@ namespace MantidQt { - namespace CustomInterfaces - { - /** +namespace CustomInterfaces +{ + /** This class defines the Indirect Simulation interface. It handles the creation of the interface window and - handles the interaction between the child tabs on the window. + handles the interaction between the child tabs on the window. @author Samuel Jackson, STFC @@ -42,19 +42,19 @@ namespace MantidQt Code Documentation is available at: */ - class DLLExport IndirectSimulation : public MantidQt::API::UserSubWindow - { - Q_OBJECT + class DLLExport IndirectSimulation : public MantidQt::API::UserSubWindow + { + Q_OBJECT - public: //public constants and enums + public: //public constants and enums /// Enumeration for the index of each tab - enum TabChoice - { - MOLDYN, + enum TabChoice + { + MOLDYN, SASSENA, DOS - }; + }; public: // public constructor, destructor and functions /// Default Constructor @@ -68,9 +68,9 @@ namespace MantidQt /// Setup tab UI virtual void initLayout(); - private slots: - /// Slot for clicking on the run button - void runClicked(); + private slots: + /// Slot for clicking on the run button + void runClicked(); /// Slot for clicking on the help button void helpClicked(); /// Slot for clicking on the manage directories button @@ -78,7 +78,7 @@ namespace MantidQt /// Slot showing a message box to the user void showMessageBox(const QString& message); - private: + private: /// Load default interface settings for each tab void loadSettings(); /// Called upon a close event. @@ -87,14 +87,14 @@ namespace MantidQt void handleDirectoryChange(Mantid::Kernel::ConfigValChangeNotification_ptr pNf); /// Map of tabs indexed by position on the window - std::map m_simulationTabs; + std::map m_simulationTabs; /// Change Observer for ConfigService (monitors user directories) Poco::NObserver m_changeObserver; ///Main interface window Ui::IndirectSimulation m_uiForm; - }; - } + }; +} } #endif diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp index 4700bbb5f125..9b77f0ea66ae 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/DensityOfStates.cpp @@ -16,247 +16,247 @@ namespace namespace MantidQt { - namespace CustomInterfaces - { - DensityOfStates::DensityOfStates(QWidget * parent) : - IndirectSimulationTab(parent) - { - m_uiForm.setupUi(parent); +namespace CustomInterfaces +{ + DensityOfStates::DensityOfStates(QWidget * parent) : + IndirectSimulationTab(parent) + { + m_uiForm.setupUi(parent); - connect(m_uiForm.mwInputFile, SIGNAL(filesFound()), this, SLOT(handleFileChange())); + connect(m_uiForm.mwInputFile, SIGNAL(filesFound()), this, SLOT(handleFileChange())); - m_uiForm.lwIons->setSelectionMode(QAbstractItemView::MultiSelection); - } + m_uiForm.lwIons->setSelectionMode(QAbstractItemView::MultiSelection); + } - void DensityOfStates::setup() - { - } + void DensityOfStates::setup() + { + } - /** - * Validate the form to check the program can be run. - * - * @return Whether the form was valid - */ - bool DensityOfStates::validate() - { - UserInputValidator uiv; + /** + * Validate the form to check the program can be run. + * + * @return Whether the form was valid + */ + bool DensityOfStates::validate() + { + UserInputValidator uiv; - // Ensure there are ions selected when using DensityOfStates sectrum with .phonon file - QString filename = m_uiForm.mwInputFile->getFirstFilename(); - QFileInfo fileInfo(filename); - bool canDoPartialDoS = fileInfo.suffix() == "phonon"; + // Ensure there are ions selected when using DensityOfStates sectrum with .phonon file + QString filename = m_uiForm.mwInputFile->getFirstFilename(); + QFileInfo fileInfo(filename); + bool canDoPartialDoS = fileInfo.suffix() == "phonon"; - QString specType = m_uiForm.cbSpectrumType->currentText(); - auto items = m_uiForm.lwIons->selectedItems(); + QString specType = m_uiForm.cbSpectrumType->currentText(); + auto items = m_uiForm.lwIons->selectedItems(); - if(specType == "DensityOfStates" && canDoPartialDoS && items.size() < 1) - uiv.addErrorMessage("Must select at least one ion for DensityOfStates."); + if(specType == "DensityOfStates" && canDoPartialDoS && items.size() < 1) + uiv.addErrorMessage("Must select at least one ion for DensityOfStates."); - // Give error message when there are errors - if(!uiv.isAllInputValid()) - emit showMessageBox(uiv.generateErrorMessage()); + // Give error message when there are errors + if(!uiv.isAllInputValid()) + emit showMessageBox(uiv.generateErrorMessage()); - return uiv.isAllInputValid(); - } + return uiv.isAllInputValid(); + } - /** - * Configures and executes the LoadSassena algorithm. - */ - void DensityOfStates::run() - { - // Get the DensityOfStates algorithm - IAlgorithm_sptr dosAlgo = AlgorithmManager::Instance().create("DensityOfStates"); + /** + * Configures and executes the LoadSassena algorithm. + */ + void DensityOfStates::run() + { + // Get the DensityOfStates algorithm + IAlgorithm_sptr dosAlgo = AlgorithmManager::Instance().create("DensityOfStates"); - QString filename = m_uiForm.mwInputFile->getFirstFilename(); - QFileInfo inputFileInfo(filename); - QString specType = m_uiForm.cbSpectrumType->currentText(); + QString filename = m_uiForm.mwInputFile->getFirstFilename(); + QFileInfo inputFileInfo(filename); + QString specType = m_uiForm.cbSpectrumType->currentText(); - m_outputWsName = inputFileInfo.baseName() + "_" + specType; + m_outputWsName = inputFileInfo.baseName() + "_" + specType; - // Set common properties - dosAlgo->setProperty("File", filename.toStdString()); - dosAlgo->setProperty("OutputWorkspace", m_outputWsName.toStdString()); + // Set common properties + dosAlgo->setProperty("File", filename.toStdString()); + dosAlgo->setProperty("OutputWorkspace", m_outputWsName.toStdString()); - QString peakShape = m_uiForm.cbPeakShape->currentText(); - dosAlgo->setProperty("Function", peakShape.toStdString()); + QString peakShape = m_uiForm.cbPeakShape->currentText(); + dosAlgo->setProperty("Function", peakShape.toStdString()); - double peakWidth = m_uiForm.spPeakWidth->value(); - dosAlgo->setProperty("PeakWidth", peakWidth); + double peakWidth = m_uiForm.spPeakWidth->value(); + dosAlgo->setProperty("PeakWidth", peakWidth); - double binWidth = m_uiForm.spBinWidth->value(); - dosAlgo->setProperty("BinWidth", binWidth); + double binWidth = m_uiForm.spBinWidth->value(); + dosAlgo->setProperty("BinWidth", binWidth); - double zeroThreshold = m_uiForm.spZeroThreshold->value(); - dosAlgo->setProperty("ZeroThreshold", zeroThreshold); + double zeroThreshold = m_uiForm.spZeroThreshold->value(); + dosAlgo->setProperty("ZeroThreshold", zeroThreshold); - bool scale = m_uiForm.ckScale->isChecked(); - double scaleFactor = m_uiForm.spScale->value(); - if(scale) - dosAlgo->setProperty("Scale", scaleFactor); + bool scale = m_uiForm.ckScale->isChecked(); + double scaleFactor = m_uiForm.spScale->value(); + if(scale) + dosAlgo->setProperty("Scale", scaleFactor); - // Set spectrum type specific properties - if(specType == "DensityOfStates") - { - dosAlgo->setProperty("SpectrumType", "DOS"); + // Set spectrum type specific properties + if(specType == "DensityOfStates") + { + dosAlgo->setProperty("SpectrumType", "DOS"); - bool crossSectionScale = m_uiForm.ckCrossSectionScale->isChecked(); - QString crossSectionScaleType = m_uiForm.cbCrossSectionScale->currentText(); - if(crossSectionScale) - dosAlgo->setProperty("ScaleByCrossSection", crossSectionScaleType.toStdString()); + bool crossSectionScale = m_uiForm.ckCrossSectionScale->isChecked(); + QString crossSectionScaleType = m_uiForm.cbCrossSectionScale->currentText(); + if(crossSectionScale) + dosAlgo->setProperty("ScaleByCrossSection", crossSectionScaleType.toStdString()); - bool sumContributions = m_uiForm.ckSumContributions->isChecked(); - dosAlgo->setProperty("SumContributions", sumContributions); + bool sumContributions = m_uiForm.ckSumContributions->isChecked(); + dosAlgo->setProperty("SumContributions", sumContributions); - std::vector selectedIons; - auto items = m_uiForm.lwIons->selectedItems(); - for(auto it = items.begin(); it != items.end(); ++it) - selectedIons.push_back((*it)->text().toStdString()); - dosAlgo->setProperty("Ions", selectedIons); - } - else if(specType == "IR") - { - dosAlgo->setProperty("SpectrumType", "IR_Active"); - } - else if(specType == "Raman") - { - dosAlgo->setProperty("SpectrumType", "Raman_Active"); + std::vector selectedIons; + auto items = m_uiForm.lwIons->selectedItems(); + for(auto it = items.begin(); it != items.end(); ++it) + selectedIons.push_back((*it)->text().toStdString()); + dosAlgo->setProperty("Ions", selectedIons); + } + else if(specType == "IR") + { + dosAlgo->setProperty("SpectrumType", "IR_Active"); + } + else if(specType == "Raman") + { + dosAlgo->setProperty("SpectrumType", "Raman_Active"); - double temperature = m_uiForm.spTemperature->value(); - dosAlgo->setProperty("Temperature", temperature); - } + double temperature = m_uiForm.spTemperature->value(); + dosAlgo->setProperty("Temperature", temperature); + } - m_batchAlgoRunner->addAlgorithm(dosAlgo); + m_batchAlgoRunner->addAlgorithm(dosAlgo); - // Setup save algorithm if needed - if(m_uiForm.ckSave->isChecked()) - { - BatchAlgorithmRunner::AlgorithmRuntimeProps saveProps; - saveProps["InputWorkspace"] = m_outputWsName.toStdString(); + // Setup save algorithm if needed + if(m_uiForm.ckSave->isChecked()) + { + BatchAlgorithmRunner::AlgorithmRuntimeProps saveProps; + saveProps["InputWorkspace"] = m_outputWsName.toStdString(); - QString filename = m_outputWsName + ".nxs"; + QString filename = m_outputWsName + ".nxs"; - IAlgorithm_sptr saveAlgo = AlgorithmManager::Instance().create("SaveNexusProcessed"); - saveAlgo->setProperty("Filename", filename.toStdString()); + IAlgorithm_sptr saveAlgo = AlgorithmManager::Instance().create("SaveNexusProcessed"); + saveAlgo->setProperty("Filename", filename.toStdString()); - m_batchAlgoRunner->addAlgorithm(saveAlgo, saveProps); - } + m_batchAlgoRunner->addAlgorithm(saveAlgo, saveProps); + } - connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); - m_batchAlgoRunner->executeBatchAsync(); - } + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); + m_batchAlgoRunner->executeBatchAsync(); + } - /** - * Handles completion of the DensityOfStates algorithm. - * - * @param error If the algorithm failed - */ - void DensityOfStates::dosAlgoComplete(bool error) - { - disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); + /** + * Handles completion of the DensityOfStates algorithm. + * + * @param error If the algorithm failed + */ + void DensityOfStates::dosAlgoComplete(bool error) + { + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(dosAlgoComplete(bool))); - if(error) - return; + if(error) + return; - // Handle spectra plotting - if(m_uiForm.ckPlot->isChecked()) - { - QString pyInput = "from mantidplot import plotSpectrum, plot2D\n" - "plotSpectrum('" + m_outputWsName + "', 0)\n"; + // Handle spectra plotting + if(m_uiForm.ckPlot->isChecked()) + { + QString pyInput = "from mantidplot import plotSpectrum, plot2D\n" + "plotSpectrum('" + m_outputWsName + "', 0)\n"; - runPythonCode(pyInput); - } + runPythonCode(pyInput); } + } - /** - * Handles a new file being selected by the browser. - */ - void DensityOfStates::handleFileChange() - { - QString filename = m_uiForm.mwInputFile->getFirstFilename(); - - // Check if we have a .phonon file - QFileInfo fileInfo(filename); - bool canDoPartialDoS = fileInfo.suffix() == "phonon"; - - // Need a .phonon file for ion contributions - if(canDoPartialDoS) - { - // Load the ion table to populate the list of ions - IAlgorithm_sptr ionTableAlgo = AlgorithmManager::Instance().create("DensityOfStates"); - ionTableAlgo->initialize(); - ionTableAlgo->setProperty("File", filename.toStdString()); - ionTableAlgo->setProperty("SpectrumType", "IonTable"); - ionTableAlgo->setProperty("OutputWorkspace", "__dos_ions"); - - m_batchAlgoRunner->addAlgorithm(ionTableAlgo); - - connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); - m_batchAlgoRunner->executeBatchAsync(); - } - else - { - m_uiForm.lwIons->clear(); - m_uiForm.ckSumContributions->setChecked(false); - m_uiForm.ckCrossSectionScale->setChecked(false); - } - - // Enable partial DOS related optons when they can be used - m_uiForm.lwIons->setEnabled(canDoPartialDoS); - m_uiForm.pbSelectAllIons->setEnabled(canDoPartialDoS); - m_uiForm.pbDeselectAllIons->setEnabled(canDoPartialDoS); - m_uiForm.ckSumContributions->setEnabled(canDoPartialDoS); - m_uiForm.ckCrossSectionScale->setEnabled(canDoPartialDoS); - } + /** + * Handles a new file being selected by the browser. + */ + void DensityOfStates::handleFileChange() + { + QString filename = m_uiForm.mwInputFile->getFirstFilename(); + // Check if we have a .phonon file + QFileInfo fileInfo(filename); + bool canDoPartialDoS = fileInfo.suffix() == "phonon"; - /** - * Handles the algorithm loading the list of ions in a file - * being completed. - * - * @param error If the algorithm failed - */ - void DensityOfStates::ionLoadComplete(bool error) + // Need a .phonon file for ion contributions + if(canDoPartialDoS) { - disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); - - if(error) - g_log.error("Could not get a list of ions from .phonon file"); + // Load the ion table to populate the list of ions + IAlgorithm_sptr ionTableAlgo = AlgorithmManager::Instance().create("DensityOfStates"); + ionTableAlgo->initialize(); + ionTableAlgo->setProperty("File", filename.toStdString()); + ionTableAlgo->setProperty("SpectrumType", "IonTable"); + ionTableAlgo->setProperty("OutputWorkspace", "__dos_ions"); - // Get the list of ions from algorithm - ITableWorkspace_sptr ionTable = AnalysisDataService::Instance().retrieveWS("__dos_ions"); - Column_sptr ionColumn = ionTable->getColumn("Ion"); - size_t numIons = ionColumn->size(); + m_batchAlgoRunner->addAlgorithm(ionTableAlgo); - // Remove old ions + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); + m_batchAlgoRunner->executeBatchAsync(); + } + else + { m_uiForm.lwIons->clear(); + m_uiForm.ckSumContributions->setChecked(false); + m_uiForm.ckCrossSectionScale->setChecked(false); + } - // Add ions to list - for(size_t ion = 0; ion < numIons; ion++) - { - const std::string ionName = ionColumn->cell(ion); - m_uiForm.lwIons->addItem(QString::fromStdString(ionName)); - } - - // Select all ions by default - m_uiForm.lwIons->selectAll(); + // Enable partial DOS related optons when they can be used + m_uiForm.lwIons->setEnabled(canDoPartialDoS); + m_uiForm.pbSelectAllIons->setEnabled(canDoPartialDoS); + m_uiForm.pbDeselectAllIons->setEnabled(canDoPartialDoS); + m_uiForm.ckSumContributions->setEnabled(canDoPartialDoS); + m_uiForm.ckCrossSectionScale->setEnabled(canDoPartialDoS); + } + + + /** + * Handles the algorithm loading the list of ions in a file + * being completed. + * + * @param error If the algorithm failed + */ + void DensityOfStates::ionLoadComplete(bool error) + { + disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(ionLoadComplete(bool))); + + if(error) + g_log.error("Could not get a list of ions from .phonon file"); + + // Get the list of ions from algorithm + ITableWorkspace_sptr ionTable = AnalysisDataService::Instance().retrieveWS("__dos_ions"); + Column_sptr ionColumn = ionTable->getColumn("Ion"); + size_t numIons = ionColumn->size(); + + // Remove old ions + m_uiForm.lwIons->clear(); + + // Add ions to list + for(size_t ion = 0; ion < numIons; ion++) + { + const std::string ionName = ionColumn->cell(ion); + m_uiForm.lwIons->addItem(QString::fromStdString(ionName)); } + // Select all ions by default + m_uiForm.lwIons->selectAll(); + } + - /** - * Set the data selectors to use the default save directory - * when browsing for input files. - * - * @param settings :: The settings to loading into the interface - */ - void DensityOfStates::loadSettings(const QSettings& settings) - { - m_uiForm.mwInputFile->readSettings(settings.group()); - } + /** + * Set the data selectors to use the default save directory + * when browsing for input files. + * + * @param settings :: The settings to loading into the interface + */ + void DensityOfStates::loadSettings(const QSettings& settings) + { + m_uiForm.mwInputFile->readSettings(settings.group()); + } - } // namespace CustomInterfaces +} // namespace CustomInterfaces } // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp index 7e4fa3aa2b80..d0e38f7b34a0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp @@ -21,7 +21,7 @@ namespace MantidQt using namespace MantidQt::CustomInterfaces; IndirectSimulation::IndirectSimulation(QWidget *parent) : UserSubWindow(parent), - m_changeObserver(*this, &IndirectSimulation::handleDirectoryChange) + m_changeObserver(*this, &IndirectSimulation::handleDirectoryChange) { } @@ -31,55 +31,55 @@ IndirectSimulation::~IndirectSimulation() void IndirectSimulation::initLayout() { - m_uiForm.setupUi(this); + m_uiForm.setupUi(this); // Connect Poco Notification Observer Mantid::Kernel::ConfigService::Instance().addObserver(m_changeObserver); - // Insert each tab into the interface on creation - m_simulationTabs.insert(std::make_pair(MOLDYN, new IndirectMolDyn(m_uiForm.IndirectSimulationTabs->widget(MOLDYN)))); - m_simulationTabs.insert(std::make_pair(SASSENA, new IndirectSassena(m_uiForm.IndirectSimulationTabs->widget(SASSENA)))); - m_simulationTabs.insert(std::make_pair(DOS, new DensityOfStates(m_uiForm.IndirectSimulationTabs->widget(DOS)))); - - // Connect each tab to the actions available in this GUI - std::map::iterator iter; - for (iter = m_simulationTabs.begin(); iter != m_simulationTabs.end(); ++iter) - { - connect(iter->second, SIGNAL(runAsPythonScript(const QString&, bool)), this, SIGNAL(runAsPythonScript(const QString&, bool))); - connect(iter->second, SIGNAL(showMessageBox(const QString&)), this, SLOT(showMessageBox(const QString&))); - } - - loadSettings(); - - // Connect statements for the buttons shared between all tabs on the Indirect Bayes interface - connect(m_uiForm.pbRun, SIGNAL(clicked()), this, SLOT(runClicked())); - connect(m_uiForm.pbHelp, SIGNAL(clicked()), this, SLOT(helpClicked())); - connect(m_uiForm.pbManageDirs, SIGNAL(clicked()), this, SLOT(manageUserDirectories())); -} + // Insert each tab into the interface on creation + m_simulationTabs.insert(std::make_pair(MOLDYN, new IndirectMolDyn(m_uiForm.IndirectSimulationTabs->widget(MOLDYN)))); + m_simulationTabs.insert(std::make_pair(SASSENA, new IndirectSassena(m_uiForm.IndirectSimulationTabs->widget(SASSENA)))); + m_simulationTabs.insert(std::make_pair(DOS, new DensityOfStates(m_uiForm.IndirectSimulationTabs->widget(DOS)))); - /** - * Handles closing the window. - * - * @param :: the detected close event - */ - void IndirectSimulation::closeEvent(QCloseEvent*) + // Connect each tab to the actions available in this GUI + std::map::iterator iter; + for (iter = m_simulationTabs.begin(); iter != m_simulationTabs.end(); ++iter) { - Mantid::Kernel::ConfigService::Instance().removeObserver(m_changeObserver); + connect(iter->second, SIGNAL(runAsPythonScript(const QString&, bool)), this, SIGNAL(runAsPythonScript(const QString&, bool))); + connect(iter->second, SIGNAL(showMessageBox(const QString&)), this, SLOT(showMessageBox(const QString&))); } - /** - * Handles a change in directory. - * - * @param pNf :: notification - */ - void IndirectSimulation::handleDirectoryChange(Mantid::Kernel::ConfigValChangeNotification_ptr pNf) + loadSettings(); + + // Connect statements for the buttons shared between all tabs on the Indirect Bayes interface + connect(m_uiForm.pbRun, SIGNAL(clicked()), this, SLOT(runClicked())); + connect(m_uiForm.pbHelp, SIGNAL(clicked()), this, SLOT(helpClicked())); + connect(m_uiForm.pbManageDirs, SIGNAL(clicked()), this, SLOT(manageUserDirectories())); +} + +/** + * Handles closing the window. + * + * @param :: the detected close event + */ +void IndirectSimulation::closeEvent(QCloseEvent*) +{ + Mantid::Kernel::ConfigService::Instance().removeObserver(m_changeObserver); +} + +/** + * Handles a change in directory. + * + * @param pNf :: notification + */ +void IndirectSimulation::handleDirectoryChange(Mantid::Kernel::ConfigValChangeNotification_ptr pNf) +{ + std::string key = pNf->key(); + if ( key == "defaultsave.directory" ) { - std::string key = pNf->key(); - if ( key == "defaultsave.directory" ) - { - loadSettings(); - } + loadSettings(); } +} /** * Load the setting for each tab on the interface. @@ -95,10 +95,10 @@ void IndirectSimulation::loadSettings() settings.beginGroup(settingsGroup + "ProcessedFiles"); settings.setValue("last_directory", saveDir); - std::map::iterator iter; - for (iter = m_simulationTabs.begin(); iter != m_simulationTabs.end(); ++iter) - { - iter->second->loadSettings(settings); + std::map::iterator iter; + for (iter = m_simulationTabs.begin(); iter != m_simulationTabs.end(); ++iter) + { + iter->second->loadSettings(settings); } settings.endGroup(); @@ -113,7 +113,7 @@ void IndirectSimulation::loadSettings() */ void IndirectSimulation::runClicked() { - int tabIndex = m_uiForm.IndirectSimulationTabs->currentIndex(); + int tabIndex = m_uiForm.IndirectSimulationTabs->currentIndex(); m_simulationTabs[tabIndex]->runTab(); } diff --git a/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst b/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst index 78a12fd0e905..153770602018 100644 --- a/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst +++ b/Code/Mantid/docs/source/interfaces/Indirect_Simulation.rst @@ -125,7 +125,7 @@ Zero Threshold Frequencies below this threshold will be ignored. Scale - Optionally apply scaling by a given fatcor to the output spectra. + Optionally apply scaling by a given factor to the output spectra. DensityOfStates ~~~~~~~~~~~~~~~