diff --git a/.gitignore b/.gitignore index 8f718aea18f8228889f4966d3e05d98422a63c57..5a12c9f6778a0f6d3d7e41243a29ccdc903a43d4 100644 --- a/.gitignore +++ b/.gitignore @@ -166,7 +166,7 @@ Desktop.ini .tags .tags_sorted_by_file -Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h +Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h # Make sure Third_Party doesn't get checked into the main repository diff --git a/Framework/API/inc/MantidAPI/AlgorithmProxy.h b/Framework/API/inc/MantidAPI/AlgorithmProxy.h index ef45cafbbf59b8bce4303063b7ae87fb6a73fa05..cc2c06272044a8d3aee5889ffdb1da9975de73aa 100644 --- a/Framework/API/inc/MantidAPI/AlgorithmProxy.h +++ b/Framework/API/inc/MantidAPI/AlgorithmProxy.h @@ -116,6 +116,8 @@ public: void setPropertyValue(const std::string &name, const std::string &value); /// Do something after a property was set void afterPropertySet(const std::string &); + /// Make m_properties point to the same PropertyManager as po. + void copyPropertiesFrom(const PropertyManagerOwner &po); //@} void cancel(); diff --git a/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h b/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h index 68c8250521e5bb0c2d476a682a009ac44c851898..f48837d236cb6925ef562a70ff597d62b28fc7db 100644 --- a/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h +++ b/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h @@ -52,7 +52,7 @@ private: /// Replacement version, -1 indicates latest int m_replacementVersion; /// The date that the algorithm was first deprecated. - std::string m_deprecatdDate; + std::string m_deprecatedDate; }; } // namespace API diff --git a/Framework/API/inc/MantidAPI/IFunction1D.h b/Framework/API/inc/MantidAPI/IFunction1D.h index 61f9ea1d1b7bc85ad7f934af6978782dfa420740..f40d2b454d6d8e75e3f252fc11caffee8d9a4249 100644 --- a/Framework/API/inc/MantidAPI/IFunction1D.h +++ b/Framework/API/inc/MantidAPI/IFunction1D.h @@ -12,9 +12,10 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { class Fit; } - +} namespace API { //---------------------------------------------------------------------- @@ -88,7 +89,7 @@ protected: static Kernel::Logger g_log; /// Making a friend - friend class CurveFitting::Fit; + friend class CurveFitting::Algorithms::Fit; }; typedef boost::shared_ptr<IFunction1D> IFunction1D_sptr; diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp index e95b083c084a4db9beba993a20643fbb9c1f1d85..860a17a3d66cb681fd368d2f87a4f69347f5af71 100644 --- a/Framework/API/src/Algorithm.cpp +++ b/Framework/API/src/Algorithm.cpp @@ -1278,11 +1278,13 @@ bool Algorithm::processGroups() { // ---------- Create all the output workspaces ---------------------------- for (size_t owp = 0; owp < m_pureOutputWorkspaceProps.size(); owp++) { Property *prop = dynamic_cast<Property *>(m_pureOutputWorkspaceProps[owp]); - WorkspaceGroup_sptr outWSGrp = WorkspaceGroup_sptr(new WorkspaceGroup()); - outGroups.push_back(outWSGrp); - // Put the GROUP in the ADS - AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp); - outWSGrp->observeADSNotifications(false); + if (prop) { + WorkspaceGroup_sptr outWSGrp = WorkspaceGroup_sptr(new WorkspaceGroup()); + outGroups.push_back(outWSGrp); + // Put the GROUP in the ADS + AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp); + outWSGrp->observeADSNotifications(false); + } } // Go through each entry in the input group(s) diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp index a400d76b3943ccaab4a31a82474c523b4be6f1b9..c1a77746b23d389a16f10c89c606aaa192430d24 100644 --- a/Framework/API/src/AlgorithmProxy.cpp +++ b/Framework/API/src/AlgorithmProxy.cpp @@ -218,6 +218,17 @@ void AlgorithmProxy::afterPropertySet(const std::string &name) { copyPropertiesFrom(*m_alg); } +/** + * Copy properties from another property manager + * Making sure that the concrete alg is kept in sync + * @param po :: The property manager to copy + */ +void AlgorithmProxy::copyPropertiesFrom(const PropertyManagerOwner &po) { + PropertyManagerOwner::copyPropertiesFrom(po); + createConcreteAlg(true); + m_alg->copyPropertiesFrom(*this); +} + //---------------------------------------------------------------------- // Private methods //---------------------------------------------------------------------- diff --git a/Framework/API/src/DeprecatedAlgorithm.cpp b/Framework/API/src/DeprecatedAlgorithm.cpp index 095b870de6dce2c5493b60e1b42277f86d52a730..804e2e0ca5c0caa89d57d3944d32415fcfd7f188 100644 --- a/Framework/API/src/DeprecatedAlgorithm.cpp +++ b/Framework/API/src/DeprecatedAlgorithm.cpp @@ -13,7 +13,7 @@ Kernel::Logger g_log("DeprecatedAlgorithm"); /// Does nothing other than make the compiler happy. DeprecatedAlgorithm::DeprecatedAlgorithm() - : m_replacementAlgorithm(), m_replacementVersion(-1), m_deprecatdDate() {} + : m_replacementAlgorithm(), m_replacementVersion(-1), m_deprecatedDate() {} /// Does nothing other than make the compiler happy. DeprecatedAlgorithm::~DeprecatedAlgorithm() {} @@ -37,7 +37,7 @@ void DeprecatedAlgorithm::useAlgorithm(const std::string &replacement, /// The date the algorithm was deprecated on void DeprecatedAlgorithm::deprecatedDate(const std::string &date) { - this->m_deprecatdDate = ""; + this->m_deprecatedDate = ""; if (date.empty()) { // TODO warn people that it wasn't set return; @@ -46,7 +46,7 @@ void DeprecatedAlgorithm::deprecatedDate(const std::string &date) { // TODO warn people that it wasn't set return; } - this->m_deprecatdDate = date; + this->m_deprecatedDate = date; } /// This merely prints the deprecation error for people to see. @@ -57,8 +57,8 @@ const std::string DeprecatedAlgorithm::deprecationMsg(const IAlgorithm *algo) { msg << "deprecated"; - if (!this->m_deprecatdDate.empty()) - msg << " (on " << this->m_deprecatdDate << ")"; + if (!this->m_deprecatedDate.empty()) + msg << " (on " << this->m_deprecatedDate << ")"; if (this->m_replacementAlgorithm.empty()) { msg << " and has no replacement."; diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp index 26a61864f6b9927aad85b761c5e985a894de8ce7..3ddd52bfdf0bbefe09fb0864bbf10fd4f1ba0e93 100644 --- a/Framework/API/src/ExperimentInfo.cpp +++ b/Framework/API/src/ExperimentInfo.cpp @@ -1149,7 +1149,7 @@ void ExperimentInfo::readParameterMap(const std::string ¶meterStr) { // if( comp_name == prev_name ) continue; this blocks reading in different // parameters of the same component. RNT // prev_name = comp_name; - const Geometry::IComponent *comp = 0; + const Geometry::IComponent *comp = NULL; if (comp_name.find("detID:") != std::string::npos) { int detID = atoi(comp_name.substr(6).c_str()); comp = instr->getDetector(detID).get(); @@ -1164,8 +1164,7 @@ void ExperimentInfo::readParameterMap(const std::string ¶meterStr) { continue; } } - if (!comp) - continue; + // create parameter's value as a sum of all tokens with index 3 or larger // this allow a parameter's value to contain ";" std::string paramValue = tokens[3]; diff --git a/Framework/API/src/FunctionFactory.cpp b/Framework/API/src/FunctionFactory.cpp index 5d2a0a1aad401f3cebf7326d1219a3edf99798c1..29a5ec54767c1b593c9cf2e3c028f262707968d6 100644 --- a/Framework/API/src/FunctionFactory.cpp +++ b/Framework/API/src/FunctionFactory.cpp @@ -192,6 +192,9 @@ CompositeFunction_sptr FunctionFactoryImpl::createComposite( inputError(expr.str()); } + if (!cfun) + inputError(expr.str()); + for (; it != terms.end(); ++it) { const Expression &term = it->bracketsRemoved(); IFunction_sptr fun; diff --git a/Framework/API/src/NumericAxis.cpp b/Framework/API/src/NumericAxis.cpp index 819ad1a5445b13c0a0415db954d2b2650bfe0d60..d609325a2397082f50219cfd5610807e58ae826c 100644 --- a/Framework/API/src/NumericAxis.cpp +++ b/Framework/API/src/NumericAxis.cpp @@ -191,9 +191,9 @@ std::string NumericAxis::label(const std::size_t &index) const { auto it = numberLabel.end() - 1; for (; it != numberLabel.begin(); --it) { if (*it == '0') { - numberLabel.erase(it); + it = numberLabel.erase(it); } else if (*it == '.') { - numberLabel.erase(it); + it = numberLabel.erase(it); break; } else { break; diff --git a/Framework/API/src/WorkspaceOpOverloads.cpp b/Framework/API/src/WorkspaceOpOverloads.cpp index cfd3595724a9d60b327e5565606e1b504442491d..f29bca1ca5fe27a3bd029a203c5169e2eb8c3897 100644 --- a/Framework/API/src/WorkspaceOpOverloads.cpp +++ b/Framework/API/src/WorkspaceOpOverloads.cpp @@ -5,11 +5,11 @@ #include "MantidAPI/Algorithm.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidKernel/Property.h" -#include "MantidKernel/Exception.h" +//#include "MantidKernel/Exception.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/IWorkspaceProperty.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidAPI/SpectraAxis.h" +//#include "MantidAPI/SpectraAxis.h" #include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidAPI/WorkspaceGroup_fwd.h" @@ -67,30 +67,20 @@ ResultType executeBinaryOperation(const std::string &algorithmName, alg->execute(); - if (alg->isExecuted()) { - // Get the output workspace property - if (child) { - return alg->getProperty("OutputWorkspace"); - } else { - API::Workspace_sptr result = - API::AnalysisDataService::Instance().retrieve( - alg->getPropertyValue("OutputWorkspace")); - return boost::dynamic_pointer_cast<typename ResultType::element_type>( - result); - } - } else { + if (!alg->isExecuted()) { std::string message = "Error while executing operation: " + algorithmName; throw std::runtime_error(message); } - throw Kernel::Exception::NotFoundError( - "Required output workspace property not found on Child Algorithm", - "OutputWorkspace"); - - // Horendous code inclusion to satisfy compilers that all code paths return a - // value - // in reality the above code should either throw or return successfully. - return ResultType(); + // Get the output workspace property + if (child) { + return alg->getProperty("OutputWorkspace"); + } else { + API::Workspace_sptr result = API::AnalysisDataService::Instance().retrieve( + alg->getPropertyValue("OutputWorkspace")); + return boost::dynamic_pointer_cast<typename ResultType::element_type>( + result); + } } template DLLExport MatrixWorkspace_sptr @@ -169,14 +159,12 @@ bool equals(const MatrixWorkspace_sptr lhs, const MatrixWorkspace_sptr rhs, // Rest: use default alg->execute(); - if (alg->isExecuted()) { - return (alg->getPropertyValue("Result") == "Success!"); - } else { + if (!alg->isExecuted()) { std::string message = "Error while executing operation: CheckWorkspacesMatch"; throw std::runtime_error(message); } - return false; + return (alg->getPropertyValue("Result") == "Success!"); } /** Creates a temporary single value workspace the error is set to zero @@ -512,17 +500,18 @@ bool WorkspaceHelpers::matchingBins(const MatrixWorkspace_const_sptr ws1, if (!step) step = 1; for (size_t i = step; i < numHist; i += step) { - const double firstWS = + const double firstWSLoop = std::accumulate(ws1->readX(i).begin(), ws1->readX(i).end(), 0.); - const double secondWS = + const double secondWSLoop = std::accumulate(ws2->readX(i).begin(), ws2->readX(i).end(), 0.); - if (std::abs(firstWS) < 1.0E-7 && std::abs(secondWS) < 1.0E-7) { + if (std::abs(firstWSLoop) < 1.0E-7 && std::abs(secondWSLoop) < 1.0E-7) { for (size_t j = 0; j < ws1->readX(i).size(); j++) { if (std::abs(ws1->readX(i)[j] - ws2->readX(i)[j]) > 1.0E-7) return false; } - } else if (std::abs(firstWS - secondWS) / - std::max<double>(std::abs(firstWS), std::abs(secondWS)) > + } else if (std::abs(firstWSLoop - secondWSLoop) / + std::max<double>(std::abs(firstWSLoop), + std::abs(secondWSLoop)) > 1.0E-7) return false; } diff --git a/Framework/API/test/AlgorithmProxyTest.h b/Framework/API/test/AlgorithmProxyTest.h index 8c50e2e0dcd53e09f3d9ce26df5d78dd7f952dd2..6e8cafd780007d1caedf0087baf6c4936736b8c6 100644 --- a/Framework/API/test/AlgorithmProxyTest.h +++ b/Framework/API/test/AlgorithmProxyTest.h @@ -212,6 +212,30 @@ public: } TS_ASSERT_EQUALS("InputWorkspace", alg->workspaceMethodInputProperty()); } + + void test_copyPropertiesFrom() { + IAlgorithm_sptr alg = + AlgorithmManager::Instance().create("ToyAlgorithmProxy"); + alg->initialize(); + alg->setPropertyValue("prop1", "string"); + alg->setPropertyValue("prop2", "1"); + IAlgorithm_sptr algCopy = + AlgorithmManager::Instance().create("ToyAlgorithmProxy"); + + auto algProxy = boost::dynamic_pointer_cast<AlgorithmProxy>(alg); + auto algCopyProxy = boost::dynamic_pointer_cast<AlgorithmProxy>(algCopy); + algCopyProxy->copyPropertiesFrom(*algProxy); + + int val = boost::lexical_cast<int>(algCopy->getPropertyValue("prop2")); + + TS_ASSERT_EQUALS(val, 1); + + // set another value and check the other value is unaffected + algCopy->setPropertyValue("prop1", "A difference"); + int val2 = boost::lexical_cast<int>(algCopy->getPropertyValue("prop2")); + + TS_ASSERT_EQUALS(val, val2); + } }; #endif /*ALGORITHMPROXYTEST_H_*/ diff --git a/Framework/Algorithms/src/AlignDetectors.cpp b/Framework/Algorithms/src/AlignDetectors.cpp index de941aea91cf913e25be29eb8cb537a740f617e7..b45eade446063828c8540bdce23008dce25026f6 100644 --- a/Framework/Algorithms/src/AlignDetectors.cpp +++ b/Framework/Algorithms/src/AlignDetectors.cpp @@ -151,7 +151,9 @@ const std::string AlignDetectors::summary() const { } /// (Empty) Constructor -AlignDetectors::AlignDetectors() { this->tofToDmap = NULL; } +AlignDetectors::AlignDetectors() : m_numberOfSpectra(0) { + this->tofToDmap = NULL; +} /// Destructor AlignDetectors::~AlignDetectors() { delete this->tofToDmap; } diff --git a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp index a6e0cb33adfc00ecba56d322c2c4855662b143b7..8a499988135764aab495cdd5a00cc597532619eb 100644 --- a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp +++ b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp @@ -168,6 +168,11 @@ void CorelliCrossCorrelate::exec() { // Determine period from chopper frequency. auto motorSpeed = dynamic_cast<TimeSeriesProperty<double> *>( inputWS->run().getProperty("BL9:Chop:Skf4:MotorSpeed")); + if (!motorSpeed) { + throw Exception::NotFoundError( + "Could not find a log value for the motor speed", + "BL9:Chop:Skf4:MotorSpeed"); + } double period = 1e9 / static_cast<double>(motorSpeed->timeAverageValue()); g_log.information() << "Frequency = " << 1e9 / period << "Hz Period = " << period << "ns\n"; diff --git a/Framework/Algorithms/src/CreateDummyCalFile.cpp b/Framework/Algorithms/src/CreateDummyCalFile.cpp index d7c9020aaf9ecfded65339768e765ff11d20f89b..a13e9ba5626e143f39053f6c44d5f3dea6f87ca6 100644 --- a/Framework/Algorithms/src/CreateDummyCalFile.cpp +++ b/Framework/Algorithms/src/CreateDummyCalFile.cpp @@ -111,7 +111,7 @@ void CreateDummyCalFile::exec() { std::string filename = getProperty("CalFilename"); // Plan to overwrite file, so do not check if it exists - bool overwrite = false; + const bool overwrite = false; int number = 0; Progress prog(this, 0.0, 0.8, assemblies.size()); diff --git a/Framework/Algorithms/src/FFT.cpp b/Framework/Algorithms/src/FFT.cpp index f8e6db3c74314b67a7c712256543b0733b55e805..1d6f94e2bf38fe60405370cd002df6453f65d240 100644 --- a/Framework/Algorithms/src/FFT.cpp +++ b/Framework/Algorithms/src/FFT.cpp @@ -172,7 +172,7 @@ void FFT::exec() { // centerShift == true means that the zero on the x axis is assumed to be in // the data centre // at point with index i = ySize/2. If shift == false the zero is at i = 0 - bool centerShift = true; + const bool centerShift = true; API::TextAxis *tAxis = new API::TextAxis(nOut); int iRe = 0; diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp index f5de226028bff2fb6f34e25ccc26c37f68d85f66..047bb0748a29536e74291b11089fd189ca149331 100644 --- a/Framework/Algorithms/src/FindPeakBackground.cpp +++ b/Framework/Algorithms/src/FindPeakBackground.cpp @@ -157,7 +157,7 @@ void FindPeakBackground::exec() { Statistics stats = getStatistics(maskedY); Ymean = stats.mean; Yvariance = stats.standard_deviation * stats.standard_deviation; - Ysigma = std::sqrt((moment4(maskedY, n - l0, Ymean) - + Ysigma = std::sqrt((moment4(maskedY, static_cast<size_t>(xn), Ymean) - (xn - 3.0) / (xn - 1.0) * Yvariance) / xn); MantidVec::const_iterator it = diff --git a/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp b/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp index 6b04c6163b6b0eb648f952a3611da0105d343efd..cd05823acf6c0f4b34c652dfc084c6bd9bd37545 100644 --- a/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp +++ b/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp @@ -19,7 +19,8 @@ DECLARE_ALGORITHM(MonitorEfficiencyCorUser) //---------------------------------------------------------------------------------------------- /** Constructor */ -MonitorEfficiencyCorUser::MonitorEfficiencyCorUser() {} +MonitorEfficiencyCorUser::MonitorEfficiencyCorUser() + : m_inputWS(), m_outputWS(), m_Ei(.0), m_monitorCounts(0) {} //---------------------------------------------------------------------------------------------- /** Destructor diff --git a/Framework/Algorithms/src/RemovePromptPulse.cpp b/Framework/Algorithms/src/RemovePromptPulse.cpp index ceaecb85d4746b238478623d474eab6efed925c3..a5f338a5942b2314618d3c8f065e6214de340a89 100644 --- a/Framework/Algorithms/src/RemovePromptPulse.cpp +++ b/Framework/Algorithms/src/RemovePromptPulse.cpp @@ -72,7 +72,7 @@ void getTofRange(MatrixWorkspace_const_sptr wksp, double &tmin, double &tmax) { DataObjects::EventWorkspace_const_sptr eventWksp = boost::dynamic_pointer_cast<const DataObjects::EventWorkspace>(wksp); - bool isEvent = false; + const bool isEvent = false; if (isEvent) { eventWksp->getEventXMinMax(tmin, tmax); } else { diff --git a/Framework/Crystal/src/FilterPeaks.cpp b/Framework/Crystal/src/FilterPeaks.cpp index 8e398c2b0de67a54cfba1205285caa2be5a0808c..f60acecea9586ca7449801c11b174ecdbefd7e16 100644 --- a/Framework/Crystal/src/FilterPeaks.cpp +++ b/Framework/Crystal/src/FilterPeaks.cpp @@ -98,6 +98,8 @@ void FilterPeaks::exec() { filterFunction = &intensity; else if (FilterVariable == "Signal/Noise") filterFunction = &SN; + else + throw std::invalid_argument("Unknown FilterVariable: " + FilterVariable); const double FilterValue = getProperty("FilterValue"); const std::string Operator = getProperty("Operator"); diff --git a/Framework/Crystal/src/LoadIsawSpectrum.cpp b/Framework/Crystal/src/LoadIsawSpectrum.cpp index 1020210a59d8f48c1c261685b9a4e787d7427f38..20e26e01cda8e944690d35d46093fef418e917bf 100644 --- a/Framework/Crystal/src/LoadIsawSpectrum.cpp +++ b/Framework/Crystal/src/LoadIsawSpectrum.cpp @@ -69,38 +69,24 @@ void LoadIsawSpectrum::exec() { std::vector<std::vector<double>> spectra; std::vector<std::vector<double>> time; int iSpec = 0; - if (iSpec == 1) { - while (!infile.eof()) // To get you all the lines. - { - // Set up sizes. (HEIGHT x WIDTH) - spectra.resize(a + 1); - getline(infile, STRING); // Saves the line in STRING. - infile >> spec[0] >> spec[1] >> spec[2] >> spec[3] >> spec[4] >> - spec[5] >> spec[6] >> spec[7] >> spec[8] >> spec[9] >> spec[10]; - for (int i = 0; i < 11; i++) - spectra[a].push_back(spec[i]); - a++; - } - } else { - for (int wi = 0; wi < 8; wi++) - getline(infile, STRING); // Saves the line in STRING. - while (!infile.eof()) // To get you all the lines. - { - time.resize(a + 1); - spectra.resize(a + 1); - getline(infile, STRING); // Saves the line in STRING. - if (infile.eof()) - break; - std::stringstream ss(STRING); - if (STRING.find("Bank") == std::string::npos) { - double time0, spectra0; - ss >> time0 >> spectra0; - time[a].push_back(time0); - spectra[a].push_back(spectra0); + for (int wi = 0; wi < 8; wi++) + getline(infile, STRING); // Saves the line in STRING. + while (!infile.eof()) // To get you all the lines. + { + time.resize(a + 1); + spectra.resize(a + 1); + getline(infile, STRING); // Saves the line in STRING. + if (infile.eof()) + break; + std::stringstream ss(STRING); + if (STRING.find("Bank") == std::string::npos) { + double time0, spectra0; + ss >> time0 >> spectra0; + time[a].push_back(time0); + spectra[a].push_back(spectra0); - } else { - a++; - } + } else { + a++; } } infile.close(); diff --git a/Framework/Crystal/src/SaveHKL.cpp b/Framework/Crystal/src/SaveHKL.cpp index 531893ebf5181eaacb538ee2eb25602000c59645..3129a148080f65782324bc85faa06dc5f2a05247 100644 --- a/Framework/Crystal/src/SaveHKL.cpp +++ b/Framework/Crystal/src/SaveHKL.cpp @@ -230,37 +230,23 @@ void SaveHKL::exec() { infile.open(spectraFile.c_str()); if (infile.is_open()) { size_t a = 0; - if (iSpec == 1) { - while (!infile.eof()) // To get you all the lines. - { - // Set up sizes. (HEIGHT x WIDTH) - spectra.resize(a + 1); - getline(infile, STRING); // Saves the line in STRING. - infile >> spec[0] >> spec[1] >> spec[2] >> spec[3] >> spec[4] >> - spec[5] >> spec[6] >> spec[7] >> spec[8] >> spec[9] >> spec[10]; - for (int i = 0; i < 11; i++) - spectra[a].push_back(spec[i]); + for (int wi = 0; wi < 8; wi++) + getline(infile, STRING); // Saves the line in STRING. + while (!infile.eof()) // To get you all the lines. + { + time.resize(a + 1); + spectra.resize(a + 1); + getline(infile, STRING); // Saves the line in STRING. + std::stringstream ss(STRING); + if (STRING.find("Bank") == std::string::npos) { + double time0, spectra0; + ss >> time0 >> spectra0; + time[a].push_back(time0); + spectra[a].push_back(spectra0); + + } else { a++; } - } else { - for (int wi = 0; wi < 8; wi++) - getline(infile, STRING); // Saves the line in STRING. - while (!infile.eof()) // To get you all the lines. - { - time.resize(a + 1); - spectra.resize(a + 1); - getline(infile, STRING); // Saves the line in STRING. - std::stringstream ss(STRING); - if (STRING.find("Bank") == std::string::npos) { - double time0, spectra0; - ss >> time0 >> spectra0; - time[a].push_back(time0); - spectra[a].push_back(spectra0); - - } else { - a++; - } - } } infile.close(); } diff --git a/Framework/CurveFitting/CMakeLists.txt b/Framework/CurveFitting/CMakeLists.txt index c7be58f1e72176eed23025ebda88c4a7e00aec8a..dfbff31c86c754d00670840aa2275393a8de0276 100644 --- a/Framework/CurveFitting/CMakeLists.txt +++ b/Framework/CurveFitting/CMakeLists.txt @@ -3,118 +3,119 @@ set ( SRC_FILES # src/SCDPanelErrors.cpp # src/ChebyshevPolynomialBackground.cpp #src/RefinePowderInstrumentParameters.cpp - src/Abragam.cpp + src/Algorithms/CalculateChiSquared.cpp + src/Algorithms/CalculateGammaBackground.cpp + src/Algorithms/CalculateMSVesuvio.cpp + src/Algorithms/ConvertToYSpace.cpp + src/Algorithms/ConvolveWorkspaces.cpp + src/Algorithms/EstimatePeakErrors.cpp + src/Algorithms/EvaluateFunction.cpp + src/Algorithms/Fit.cpp + src/Algorithms/Fit1D.cpp + src/Algorithms/FitPowderDiffPeaks.cpp + src/Algorithms/LeBailFit.cpp + src/Algorithms/LeBailFunction.cpp + src/Algorithms/NormaliseByPeakArea.cpp + src/Algorithms/PawleyFit.cpp + src/Algorithms/PlotPeakByLogValue.cpp + src/Algorithms/RefinePowderInstrumentParameters.cpp + src/Algorithms/RefinePowderInstrumentParameters3.cpp + src/Algorithms/SplineBackground.cpp + src/Algorithms/SplineInterpolation.cpp + src/Algorithms/SplineSmoothing.cpp src/AugmentedLagrangianOptimizer.cpp - src/BFGS_Minimizer.cpp - src/BSpline.cpp - src/BackToBackExponential.cpp - src/BackgroundFunction.cpp - src/BivariateNormal.cpp - src/Bk2BkExpConvPV.cpp - src/BoundaryConstraint.cpp - src/CalculateChiSquared.cpp - src/CalculateGammaBackground.cpp - src/CalculateMSVesuvio.cpp - src/ChebfunBase.cpp - src/Chebyshev.cpp - src/ComptonPeakProfile.cpp - src/ComptonProfile.cpp - src/ComptonScatteringCountRate.cpp - src/ConvertToYSpace.cpp - src/Convolution.cpp - src/ConvolveWorkspaces.cpp - src/CostFuncFitting.cpp - src/CostFuncLeastSquares.cpp - src/CostFuncRwp.cpp - src/CostFuncUnweightedLeastSquares.cpp - src/CubicSpline.cpp - src/DampingMinimizer.cpp - src/DeltaFunction.cpp - src/DerivMinimizer.cpp - src/DiffRotDiscreteCircle.cpp - src/DiffSphere.cpp - src/DynamicKuboToyabe.cpp - src/EndErfc.cpp - src/EstimatePeakErrors.cpp - src/EvaluateFunction.cpp - src/ExpDecay.cpp - src/ExpDecayMuon.cpp - src/ExpDecayOsc.cpp - src/FABADAMinimizer.cpp - src/FRConjugateGradientMinimizer.cpp - src/Fit.cpp - src/Fit1D.cpp + src/Constraints/BoundaryConstraint.cpp + src/CostFunctions/CostFuncFitting.cpp + src/CostFunctions/CostFuncLeastSquares.cpp + src/CostFunctions/CostFuncRwp.cpp + src/CostFunctions/CostFuncUnweightedLeastSquares.cpp src/FitMW.cpp - src/FitPowderDiffPeaks.cpp - src/FlatBackground.cpp - src/FullprofPolynomial.cpp + src/FuncMinimizers/BFGS_Minimizer.cpp + src/FuncMinimizers/DampingMinimizer.cpp + src/FuncMinimizers/DerivMinimizer.cpp + src/FuncMinimizers/FABADAMinimizer.cpp + src/FuncMinimizers/FRConjugateGradientMinimizer.cpp + src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp + src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp + src/FuncMinimizers/PRConjugateGradientMinimizer.cpp + src/FuncMinimizers/SimplexMinimizer.cpp + src/FuncMinimizers/SteepestDescentMinimizer.cpp src/FunctionDomain1DSpectrumCreator.cpp + src/Functions/Abragam.cpp + src/Functions/BSpline.cpp + src/Functions/BackToBackExponential.cpp + src/Functions/BackgroundFunction.cpp + src/Functions/BivariateNormal.cpp + src/Functions/Bk2BkExpConvPV.cpp + src/Functions/ChebfunBase.cpp + src/Functions/Chebyshev.cpp + src/Functions/ComptonPeakProfile.cpp + src/Functions/ComptonProfile.cpp + src/Functions/ComptonScatteringCountRate.cpp + src/Functions/Convolution.cpp + src/Functions/CubicSpline.cpp + src/Functions/DeltaFunction.cpp + src/Functions/DiffRotDiscreteCircle.cpp + src/Functions/DiffSphere.cpp + src/Functions/DynamicKuboToyabe.cpp + src/Functions/EndErfc.cpp + src/Functions/ExpDecay.cpp + src/Functions/ExpDecayMuon.cpp + src/Functions/ExpDecayOsc.cpp + src/Functions/FlatBackground.cpp + src/Functions/FullprofPolynomial.cpp + src/Functions/GausDecay.cpp + src/Functions/GausOsc.cpp + src/Functions/Gaussian.cpp + src/Functions/GaussianComptonProfile.cpp + src/Functions/GramCharlierComptonProfile.cpp + src/Functions/IkedaCarpenterPV.cpp + src/Functions/LinearBackground.cpp + src/Functions/LogNormal.cpp + src/Functions/Lorentzian.cpp + src/Functions/Lorentzian1D.cpp + src/Functions/MuonFInteraction.cpp + src/Functions/NeutronBk2BkExpConvPVoigt.cpp + src/Functions/PawleyFunction.cpp + src/Functions/PeakParameterFunction.cpp + src/Functions/Polynomial.cpp + src/Functions/ProcessBackground.cpp + src/Functions/ProductFunction.cpp + src/Functions/ProductLinearExp.cpp + src/Functions/ProductQuadraticExp.cpp + src/Functions/PseudoVoigt.cpp + src/Functions/Quadratic.cpp + src/Functions/ReflectivityMulf.cpp + src/Functions/Resolution.cpp + src/Functions/SimpleChebfun.cpp + src/Functions/StaticKuboToyabe.cpp + src/Functions/StaticKuboToyabeTimesExpDecay.cpp + src/Functions/StaticKuboToyabeTimesGausDecay.cpp + src/Functions/StretchExp.cpp + src/Functions/StretchExpMuon.cpp + src/Functions/TabulatedFunction.cpp + src/Functions/ThermalNeutronBk2BkExpAlpha.cpp + src/Functions/ThermalNeutronBk2BkExpBeta.cpp + src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp + src/Functions/ThermalNeutronBk2BkExpSigma.cpp + src/Functions/ThermalNeutronDtoTOFFunction.cpp + src/Functions/UserFunction.cpp + src/Functions/UserFunction1D.cpp + src/Functions/VesuvioResolution.cpp + src/Functions/Voigt.cpp src/GSLFunctions.cpp src/GSLMatrix.cpp src/GSLVector.cpp - src/GausDecay.cpp - src/GausOsc.cpp - src/Gaussian.cpp - src/GaussianComptonProfile.cpp - src/GramCharlierComptonProfile.cpp src/IFittingAlgorithm.cpp - src/IkedaCarpenterPV.cpp src/LatticeDomainCreator.cpp src/LatticeFunction.cpp - src/LeBailFit.cpp - src/LeBailFunction.cpp - src/LevenbergMarquardtMDMinimizer.cpp - src/LevenbergMarquardtMinimizer.cpp - src/LinearBackground.cpp - src/LogNormal.cpp - src/Lorentzian.cpp - src/Lorentzian1D.cpp src/MSVesuvioHelpers.cpp src/MultiDomainCreator.cpp - src/MuonFInteraction.cpp - src/NeutronBk2BkExpConvPVoigt.cpp - src/NormaliseByPeakArea.cpp - src/PRConjugateGradientMinimizer.cpp src/ParDomain.cpp src/ParameterEstimator.cpp - src/PawleyFit.cpp - src/PawleyFunction.cpp - src/PeakParameterFunction.cpp - src/PlotPeakByLogValue.cpp - src/Polynomial.cpp - src/ProcessBackground.cpp - src/ProductFunction.cpp - src/ProductLinearExp.cpp - src/ProductQuadraticExp.cpp - src/PseudoVoigt.cpp - src/Quadratic.cpp - src/RefinePowderInstrumentParameters3.cpp - src/ReflectivityMulf.cpp - src/Resolution.cpp src/SeqDomain.cpp src/SeqDomainSpectrumCreator.cpp - src/SimpleChebfun.cpp - src/SimplexMinimizer.cpp src/SpecialFunctionHelper.cpp - src/SplineBackground.cpp - src/SplineInterpolation.cpp - src/SplineSmoothing.cpp - src/StaticKuboToyabe.cpp - src/StaticKuboToyabeTimesExpDecay.cpp - src/StaticKuboToyabeTimesGausDecay.cpp - src/SteepestDescentMinimizer.cpp - src/StretchExp.cpp - src/StretchExpMuon.cpp - src/TabulatedFunction.cpp - src/ThermalNeutronBk2BkExpAlpha.cpp - src/ThermalNeutronBk2BkExpBeta.cpp - src/ThermalNeutronBk2BkExpConvPVoigt.cpp - src/ThermalNeutronBk2BkExpSigma.cpp - src/ThermalNeutronDtoTOFFunction.cpp - src/UserFunction.cpp - src/UserFunction1D.cpp - src/VesuvioResolution.cpp - src/Voigt.cpp ) set ( SRC_UNITY_IGNORE_FILES src/Fit1D.cpp src/GSLFunctions.cpp ) @@ -124,235 +125,237 @@ set ( INC_FILES # inc/MantidCurveFitting/SCDPanelErrors.h # inc/MantidCurveFitting/ChebyshevPolynomialBackground.h #inc/MantidCurveFitting/RefinePowderInstrumentParameters.h - inc/MantidCurveFitting/Abragam.h + inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h + inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h + inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h + inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h + inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h + inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h + inc/MantidCurveFitting/Algorithms/EvaluateFunction.h + inc/MantidCurveFitting/Algorithms/Fit.h + inc/MantidCurveFitting/Algorithms/Fit1D.h + inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h + inc/MantidCurveFitting/Algorithms/LeBailFit.h + inc/MantidCurveFitting/Algorithms/LeBailFunction.h + inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h + inc/MantidCurveFitting/Algorithms/PawleyFit.h + inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h + inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h + inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h + inc/MantidCurveFitting/Algorithms/SplineBackground.h + inc/MantidCurveFitting/Algorithms/SplineInterpolation.h + inc/MantidCurveFitting/Algorithms/SplineSmoothing.h inc/MantidCurveFitting/AugmentedLagrangianOptimizer.h - inc/MantidCurveFitting/BFGS_Minimizer.h - inc/MantidCurveFitting/BSpline.h - inc/MantidCurveFitting/BackToBackExponential.h - inc/MantidCurveFitting/BackgroundFunction.h - inc/MantidCurveFitting/BivariateNormal.h - inc/MantidCurveFitting/Bk2BkExpConvPV.h - inc/MantidCurveFitting/BoundaryConstraint.h - inc/MantidCurveFitting/CalculateChiSquared.h - inc/MantidCurveFitting/CalculateGammaBackground.h - inc/MantidCurveFitting/CalculateMSVesuvio.h - inc/MantidCurveFitting/ChebfunBase.h - inc/MantidCurveFitting/Chebyshev.h - inc/MantidCurveFitting/ComptonPeakProfile.h - inc/MantidCurveFitting/ComptonProfile.h - inc/MantidCurveFitting/ComptonScatteringCountRate.h - inc/MantidCurveFitting/ConvertToYSpace.h - inc/MantidCurveFitting/Convolution.h - inc/MantidCurveFitting/ConvolveWorkspaces.h - inc/MantidCurveFitting/CostFuncFitting.h - inc/MantidCurveFitting/CostFuncLeastSquares.h - inc/MantidCurveFitting/CostFuncRwp.h - inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h - inc/MantidCurveFitting/CubicSpline.h - inc/MantidCurveFitting/DampingMinimizer.h - inc/MantidCurveFitting/DeltaFunction.h - inc/MantidCurveFitting/DerivMinimizer.h - inc/MantidCurveFitting/DiffRotDiscreteCircle.h - inc/MantidCurveFitting/DiffSphere.h + inc/MantidCurveFitting/Constraints/BoundaryConstraint.h + inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h + inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h + inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h + inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h inc/MantidCurveFitting/DllConfig.h - inc/MantidCurveFitting/DynamicKuboToyabe.h - inc/MantidCurveFitting/EndErfc.h - inc/MantidCurveFitting/EstimatePeakErrors.h - inc/MantidCurveFitting/EvaluateFunction.h - inc/MantidCurveFitting/ExpDecay.h - inc/MantidCurveFitting/ExpDecayMuon.h - inc/MantidCurveFitting/ExpDecayOsc.h - inc/MantidCurveFitting/FABADAMinimizer.h - inc/MantidCurveFitting/FRConjugateGradientMinimizer.h - inc/MantidCurveFitting/Fit.h - inc/MantidCurveFitting/Fit1D.h inc/MantidCurveFitting/FitMW.h - inc/MantidCurveFitting/FitPowderDiffPeaks.h - inc/MantidCurveFitting/FlatBackground.h - inc/MantidCurveFitting/FullprofPolynomial.h + inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h + inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h inc/MantidCurveFitting/FunctionDomain1DSpectrumCreator.h + inc/MantidCurveFitting/Functions/Abragam.h + inc/MantidCurveFitting/Functions/BSpline.h + inc/MantidCurveFitting/Functions/BackToBackExponential.h + inc/MantidCurveFitting/Functions/BackgroundFunction.h + inc/MantidCurveFitting/Functions/BivariateNormal.h + inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h + inc/MantidCurveFitting/Functions/ChebfunBase.h + inc/MantidCurveFitting/Functions/Chebyshev.h + inc/MantidCurveFitting/Functions/ComptonPeakProfile.h + inc/MantidCurveFitting/Functions/ComptonProfile.h + inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h + inc/MantidCurveFitting/Functions/Convolution.h + inc/MantidCurveFitting/Functions/CubicSpline.h + inc/MantidCurveFitting/Functions/DeltaFunction.h + inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h + inc/MantidCurveFitting/Functions/DiffSphere.h + inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h + inc/MantidCurveFitting/Functions/EndErfc.h + inc/MantidCurveFitting/Functions/ExpDecay.h + inc/MantidCurveFitting/Functions/ExpDecayMuon.h + inc/MantidCurveFitting/Functions/ExpDecayOsc.h + inc/MantidCurveFitting/Functions/FlatBackground.h + inc/MantidCurveFitting/Functions/FullprofPolynomial.h + inc/MantidCurveFitting/Functions/GausDecay.h + inc/MantidCurveFitting/Functions/GausOsc.h + inc/MantidCurveFitting/Functions/Gaussian.h + inc/MantidCurveFitting/Functions/GaussianComptonProfile.h + inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h + inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h + inc/MantidCurveFitting/Functions/LinearBackground.h + inc/MantidCurveFitting/Functions/LogNormal.h + inc/MantidCurveFitting/Functions/Lorentzian.h + inc/MantidCurveFitting/Functions/Lorentzian1D.h + inc/MantidCurveFitting/Functions/MuonFInteraction.h + inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h + inc/MantidCurveFitting/Functions/PawleyFunction.h + inc/MantidCurveFitting/Functions/PeakParameterFunction.h + inc/MantidCurveFitting/Functions/Polynomial.h + inc/MantidCurveFitting/Functions/ProcessBackground.h + inc/MantidCurveFitting/Functions/ProductFunction.h + inc/MantidCurveFitting/Functions/ProductLinearExp.h + inc/MantidCurveFitting/Functions/ProductQuadraticExp.h + inc/MantidCurveFitting/Functions/PseudoVoigt.h + inc/MantidCurveFitting/Functions/Quadratic.h + inc/MantidCurveFitting/Functions/ReflectivityMulf.h + inc/MantidCurveFitting/Functions/Resolution.h + inc/MantidCurveFitting/Functions/SimpleChebfun.h + inc/MantidCurveFitting/Functions/StaticKuboToyabe.h + inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h + inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h + inc/MantidCurveFitting/Functions/StretchExp.h + inc/MantidCurveFitting/Functions/StretchExpMuon.h + inc/MantidCurveFitting/Functions/TabulatedFunction.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h + inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h + inc/MantidCurveFitting/Functions/UserFunction.h + inc/MantidCurveFitting/Functions/UserFunction1D.h + inc/MantidCurveFitting/Functions/VesuvioResolution.h + inc/MantidCurveFitting/Functions/Voigt.h inc/MantidCurveFitting/GSLFunctions.h inc/MantidCurveFitting/GSLJacobian.h inc/MantidCurveFitting/GSLMatrix.h inc/MantidCurveFitting/GSLVector.h - inc/MantidCurveFitting/GausDecay.h - inc/MantidCurveFitting/GausOsc.h - inc/MantidCurveFitting/Gaussian.h - inc/MantidCurveFitting/GaussianComptonProfile.h - inc/MantidCurveFitting/GramCharlierComptonProfile.h inc/MantidCurveFitting/HalfComplex.h inc/MantidCurveFitting/IFittingAlgorithm.h - inc/MantidCurveFitting/IkedaCarpenterPV.h inc/MantidCurveFitting/Jacobian.h inc/MantidCurveFitting/LatticeDomainCreator.h inc/MantidCurveFitting/LatticeFunction.h - inc/MantidCurveFitting/LeBailFit.h - inc/MantidCurveFitting/LeBailFunction.h - inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h - inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h - inc/MantidCurveFitting/LinearBackground.h - inc/MantidCurveFitting/LogNormal.h - inc/MantidCurveFitting/Lorentzian.h - inc/MantidCurveFitting/Lorentzian1D.h inc/MantidCurveFitting/MSVesuvioHelpers.h inc/MantidCurveFitting/MultiDomainCreator.h - inc/MantidCurveFitting/MuonFInteraction.h - inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h - inc/MantidCurveFitting/NormaliseByPeakArea.h - inc/MantidCurveFitting/PRConjugateGradientMinimizer.h inc/MantidCurveFitting/ParDomain.h inc/MantidCurveFitting/ParameterEstimator.h - inc/MantidCurveFitting/PawleyFit.h - inc/MantidCurveFitting/PawleyFunction.h - inc/MantidCurveFitting/PeakParameterFunction.h - inc/MantidCurveFitting/PlotPeakByLogValue.h - inc/MantidCurveFitting/Polynomial.h - inc/MantidCurveFitting/ProcessBackground.h - inc/MantidCurveFitting/ProductFunction.h - inc/MantidCurveFitting/ProductLinearExp.h - inc/MantidCurveFitting/ProductQuadraticExp.h - inc/MantidCurveFitting/PseudoVoigt.h - inc/MantidCurveFitting/Quadratic.h - inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h - inc/MantidCurveFitting/ReflectivityMulf.h - inc/MantidCurveFitting/Resolution.h inc/MantidCurveFitting/SeqDomain.h inc/MantidCurveFitting/SeqDomainSpectrumCreator.h - inc/MantidCurveFitting/SimpleChebfun.h - inc/MantidCurveFitting/SimplexMinimizer.h inc/MantidCurveFitting/SpecialFunctionSupport.h - inc/MantidCurveFitting/SplineBackground.h - inc/MantidCurveFitting/SplineInterpolation.h - inc/MantidCurveFitting/SplineSmoothing.h - inc/MantidCurveFitting/StaticKuboToyabe.h - inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h - inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h - inc/MantidCurveFitting/SteepestDescentMinimizer.h - inc/MantidCurveFitting/StretchExp.h - inc/MantidCurveFitting/StretchExpMuon.h - inc/MantidCurveFitting/TabulatedFunction.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h - inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h - inc/MantidCurveFitting/UserFunction.h - inc/MantidCurveFitting/UserFunction1D.h - inc/MantidCurveFitting/VesuvioResolution.h - inc/MantidCurveFitting/Voigt.h ) set ( TEST_FILES # ChebyshevPolynomialBackgroundTest.h # RefinePowderInstrumentParametersTest.h #SCDPanelErrorsTest.h - AbragamTest.h + Algorithms/CalculateChiSquaredTest.h + Algorithms/CalculateGammaBackgroundTest.h + Algorithms/CalculateMSVesuvioTest.h + Algorithms/ConvertToYSpaceTest.h + Algorithms/ConvolveWorkspacesTest.h + Algorithms/EstimatePeakErrorsTest.h + Algorithms/EvaluateFunctionTest.h + Algorithms/FitPowderDiffPeaksTest.h + Algorithms/FitTest.h + Algorithms/LeBailFitTest.h + Algorithms/LeBailFunctionTest.h + Algorithms/NormaliseByPeakAreaTest.h + Algorithms/PawleyFitTest.h + Algorithms/PlotPeakByLogValueTest.h + Algorithms/RefinePowderInstrumentParameters3Test.h + Algorithms/RefinePowderInstrumentParametersTest.h + Algorithms/SeqDomainSpectrumCreatorTest.h + Algorithms/SplineBackgroundTest.h + Algorithms/SplineInterpolationTest.h + Algorithms/SplineSmoothingTest.h AugmentedLagrangianOptimizerTest.h - BFGSTest.h - BSplineTest.h - BackToBackExponentialTest.h - BivariateNormalTest.h - Bk2BkExpConvPVTest.h - BoundaryConstraintTest.h - CalculateChiSquaredTest.h - CalculateGammaBackgroundTest.h - CalculateMSVesuvioTest.h - ChebfunBaseTest.h - ChebyshevTest.h CompositeFunctionTest.h - ComptonPeakProfileTest.h - ComptonProfileTest.h - ComptonScatteringCountRateTest.h - ConvertToYSpaceTest.h - ConvolutionTest.h - ConvolveWorkspacesTest.h - CostFuncUnweightedLeastSquaresTest.h - CubicSplineTest.h - DampingMinimizerTest.h - DeltaFunctionTest.h - DiffRotDiscreteCircleTest.h - DiffSphereTest.h - DynamicKuboToyabeTest.h - EndErfcTest.h - EstimatePeakErrorsTest.h - EvaluateFunctionTest.h - ExpDecayMuonTest.h - ExpDecayOscTest.h - ExpDecayTest.h - FABADAMinimizerTest.h - FRConjugateGradientTest.h + Constraints/BoundaryConstraintTest.h + CostFunctions/CostFuncUnweightedLeastSquaresTest.h + CostFunctions/LeastSquaresTest.h FitMWTest.h - FitPowderDiffPeaksTest.h - FitTest.h - FlatBackgroundTest.h - FullprofPolynomialTest.h + FuncMinimizers/BFGSTest.h + FuncMinimizers/DampingMinimizerTest.h + FuncMinimizers/FABADAMinimizerTest.h + FuncMinimizers/FRConjugateGradientTest.h + FuncMinimizers/LevenbergMarquardtMDTest.h + FuncMinimizers/LevenbergMarquardtTest.h + FuncMinimizers/PRConjugateGradientTest.h + FuncMinimizers/SimplexTest.h FunctionDomain1DSpectrumCreatorTest.h FunctionFactoryConstraintTest.h FunctionParameterDecoratorFitTest.h + Functions/AbragamTest.h + Functions/BSplineTest.h + Functions/BackToBackExponentialTest.h + Functions/BivariateNormalTest.h + Functions/Bk2BkExpConvPVTest.h + Functions/ChebfunBaseTest.h + Functions/ChebyshevTest.h + Functions/ComptonPeakProfileTest.h + Functions/ComptonProfileTest.h + Functions/ComptonScatteringCountRateTest.h + Functions/ConvolutionTest.h + Functions/CubicSplineTest.h + Functions/DeltaFunctionTest.h + Functions/DiffRotDiscreteCircleTest.h + Functions/DiffSphereTest.h + Functions/DynamicKuboToyabeTest.h + Functions/EndErfcTest.h + Functions/ExpDecayMuonTest.h + Functions/ExpDecayOscTest.h + Functions/ExpDecayTest.h + Functions/FlatBackgroundTest.h + Functions/FullprofPolynomialTest.h + Functions/GausDecayTest.h + Functions/GausOscTest.h + Functions/GaussianComptonProfileTest.h + Functions/GaussianTest.h + Functions/GramCharlierComptonProfileTest.h + Functions/IkedaCarpenterPVTest.h + Functions/LinearBackgroundTest.h + Functions/LogNormalTest.h + Functions/Lorentzian1DTest.h + Functions/LorentzianTest.h + Functions/MuonFInteractionTest.h + Functions/NeutronBk2BkExpConvPVoigtTest.h + Functions/PawleyFunctionTest.h + Functions/PeakParameterFunctionTest.h + Functions/PolynomialTest.h + Functions/ProcessBackgroundTest.h + Functions/ProductFunctionTest.h + Functions/ProductLinearExpTest.h + Functions/ProductQuadraticExpTest.h + Functions/PseudoVoigtTest.h + Functions/QuadraticTest.h + Functions/ReflectivityMulfTest.h + Functions/ResolutionTest.h + Functions/SimpleChebfunTest.h + Functions/StaticKuboToyabeTest.h + Functions/StaticKuboToyabeTimesExpDecayTest.h + Functions/StaticKuboToyabeTimesGausDecayTest.h + Functions/StretchExpMuonTest.h + Functions/StretchExpTest.h + Functions/TabulatedFunctionTest.h + Functions/ThermalNeutronBk2BkExpAlphaTest.h + Functions/ThermalNeutronBk2BkExpBetaTest.h + Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h + Functions/ThermalNeutronBk2BkExpSigmaTest.h + Functions/ThermalNeutronDtoTOFFunctionTest.h + Functions/UserFunction1DTest.h + Functions/UserFunctionTest.h + Functions/VesuvioResolutionTest.h + Functions/VoigtTest.h GSLMatrixTest.h GSLVectorTest.h - GausDecayTest.h - GausOscTest.h - GaussianComptonProfileTest.h - GaussianTest.h - GramCharlierComptonProfileTest.h IPeakFunctionCentreParameterNameTest.h IPeakFunctionIntensityTest.h - IkedaCarpenterPVTest.h LatticeDomainCreatorTest.h LatticeFunctionTest.h - LeBailFitTest.h - LeBailFunctionTest.h - LeastSquaresTest.h - LevenbergMarquardtMDTest.h - LevenbergMarquardtTest.h - LinearBackgroundTest.h - LogNormalTest.h - Lorentzian1DTest.h - LorentzianTest.h MultiDomainCreatorTest.h MultiDomainFunctionTest.h - MuonFInteractionTest.h - NeutronBk2BkExpConvPVoigtTest.h - NormaliseByPeakAreaTest.h - PRConjugateGradientTest.h ParameterEstimatorTest.h - PawleyFitTest.h - PawleyFunctionTest.h - PeakParameterFunctionTest.h - PlotPeakByLogValueTest.h - PolynomialTest.h - ProcessBackgroundTest.h - ProductFunctionTest.h - ProductLinearExpTest.h - ProductQuadraticExpTest.h - PseudoVoigtTest.h - QuadraticTest.h - RefinePowderInstrumentParameters3Test.h - ReflectivityMulfTest.h - ResolutionTest.h - SeqDomainSpectrumCreatorTest.h - SimpleChebfunTest.h - SimplexTest.h SpecialFunctionSupportTest.h - SplineBackgroundTest.h - SplineInterpolationTest.h - SplineSmoothingTest.h - StaticKuboToyabeTest.h - StaticKuboToyabeTimesExpDecayTest.h - StaticKuboToyabeTimesGausDecayTest.h - StretchExpMuonTest.h - StretchExpTest.h - TabulatedFunctionTest.h - ThermalNeutronBk2BkExpAlphaTest.h - ThermalNeutronBk2BkExpBetaTest.h - ThermalNeutronBk2BkExpConvPVoigtTest.h - ThermalNeutronBk2BkExpSigmaTest.h - ThermalNeutronDtoTOFFunctionTest.h - UserFunction1DTest.h - UserFunctionTest.h - VesuvioResolutionTest.h - VoigtTest.h ) if (COVERALLS) diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h index 34d50d67839be92218d2d149aad8272f7c9ce575..867ec832b324d9ad2353e516c3235fc791d48ed4 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @@ -51,6 +52,7 @@ private: std::vector<size_t> m_fixedParameters; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h similarity index 87% rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h index 4cf7ebc54a20af54e0396148ebdf74ccbca95d21..ac575bb8035a120fd8e0e3cc51739cd693b26f2d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h @@ -7,11 +7,14 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { +struct ResolutionParams; +} +namespace Algorithms { //--------------------------------------------------------------------------- // Forward declarations //--------------------------------------------------------------------------- struct DetectorParams; -struct ResolutionParams; /** @@ -75,17 +78,17 @@ private: void calculateBackgroundFromFoils(const size_t inputIndex, const size_t outputIndex); /// Compute expected background from single foil for spectrum at wsIndex - void calculateBackgroundSingleFoil(std::vector<double> &ctfoil, - const size_t wsIndex, - const FoilInfo &foilInfo, - const Kernel::V3D &detPos, - const DetectorParams &detPar, - const ResolutionParams &detRes); + void calculateBackgroundSingleFoil( + std::vector<double> &ctfoil, const size_t wsIndex, + const FoilInfo &foilInfo, const Kernel::V3D &detPos, + const DetectorParams &detPar, + const CurveFitting::Functions::ResolutionParams &detRes); /// Compute a TOF spectrum for the given inputs & spectrum - void calculateTofSpectrum(std::vector<double> &result, - std::vector<double> &tmpWork, const size_t wsIndex, - const DetectorParams &detpar, - const ResolutionParams &respar); + void + calculateTofSpectrum(std::vector<double> &result, + std::vector<double> &tmpWork, const size_t wsIndex, + const DetectorParams &detpar, + const CurveFitting::Functions::ResolutionParams &respar); /// Check and store appropriate input data void retrieveInputs(); @@ -133,6 +136,7 @@ private: API::Progress *m_progress; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h index 71b9767435f032f9d4564ec8ef53d4dd5ee160a6..96d84d452dadbbff40e58b32c09184768055420b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h @@ -9,16 +9,16 @@ namespace Mantid { namespace CurveFitting { -//----------------------------------------------------------------------------- -// CurveFitting forward declarations -//----------------------------------------------------------------------------- -struct DetectorParams; -struct ResolutionParams; namespace MSVesuvioHelper { class RandomNumberGenerator; struct Simulation; struct SimulationWithErrors; } +namespace Functions { +struct ResolutionParams; +} +namespace Algorithms { +struct DetectorParams; /** Calculates the multiple scattering & total scattering contributions @@ -88,12 +88,13 @@ private: void cacheInputs(); void calculateMS(const size_t wsIndex, API::ISpectrum &totalsc, API::ISpectrum &multsc) const; - void simulate(const DetectorParams &detpar, const ResolutionParams &respar, + void simulate(const DetectorParams &detpar, + const Functions::ResolutionParams &respar, MSVesuvioHelper::Simulation &simulCounts) const; void assignToOutput(const MSVesuvioHelper::SimulationWithErrors &avgCounts, API::ISpectrum &totalsc, API::ISpectrum &multsc) const; double calculateCounts(const DetectorParams &detpar, - const ResolutionParams &respar, + const Functions::ResolutionParams &respar, MSVesuvioHelper::Simulation &simulation) const; // single-event helpers @@ -116,7 +117,8 @@ private: const double e1res) const; // Member Variables - MSVesuvioHelper::RandomNumberGenerator *m_randgen; // random number generator + CurveFitting::MSVesuvioHelper::RandomNumberGenerator * + m_randgen; // random number generator size_t m_acrossIdx, m_upIdx, m_beamIdx; // indices of each direction Kernel::V3D m_beamDir; // Directional vector for beam @@ -136,6 +138,7 @@ private: API::MatrixWorkspace_sptr m_inputWS; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h index c548e60ad362f48487a0dfdb134dc85c73cfccdd..6ed4648408a367518609fab46670ec8d4c4dbe18 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h @@ -5,6 +5,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /// Simple data structure to store nominal detector values /// It avoids some functions taking a huge number of arguments @@ -101,6 +102,7 @@ private: API::MatrixWorkspace_sptr m_qOutputWS; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h index 30ad9f3f040bf284b2274e08dbd3753b665eff41..19fa08127b0e1a54c8fdd6a0a6594e1faba251ec 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h @@ -9,12 +9,13 @@ #include "MantidAPI/MatrixWorkspace_fwd.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/CubicSpline.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" #include "MantidAPI/ParamFunction.h" #include "MantidAPI/IFunction1D.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Convolution of two workspaces Copyright © 2012 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge @@ -65,6 +66,7 @@ private: API::Progress *prog; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h index fa886873c50b189aa5aab1cb5bc594f5b5a98c5b..c16a6b037959f973eed6c93204d73d11ed92ac45 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h @@ -5,6 +5,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { //--------------------------------------------------------------------------- /** @@ -44,6 +45,7 @@ private: void exec(); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h index 48bfd7abe57983d68d45b5c817c6361fb06313fa..55be4b63901ced996a404c85b2980f8702f52d29 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @@ -44,6 +45,7 @@ private: void execConcrete(); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Fit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Fit.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h index baaf264d06d012cfa0efda8169d7ae9181d28c68..20c76810d8a5affe143d42be189d9fd0b77ca9d6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Fit.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h @@ -20,6 +20,7 @@ class IFuncMinimizer; } namespace CurveFitting { +namespace Algorithms { /** A generic fitting algorithm. It fits a function to some data in a workspace. @@ -114,6 +115,7 @@ protected: void copyMinimizerOutput(const API::IFuncMinimizer &minimizer); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h index 132ce49ede9e9ea965ca0537a32b2925355d4b0c..9cfc546a20c3023fc0d609560b8d3eece550cf72 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Deprecation notice: instead of using this algorithm please use the Fit algorithm instead. @@ -140,6 +141,7 @@ protected: friend struct FitData; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h similarity index 77% rename from Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h index 1fe1d2551ebe75f32516f0077b138a6c153f8fc3..5436f304f29d3fd7a7076d4dcfca9dab48dd0b03 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h @@ -8,13 +8,14 @@ #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" #include "MantidGeometry/Crystal/UnitCell.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** FitPowderDiffPeaks : Fit peaks in powder diffraction pattern. @@ -88,7 +89,7 @@ private: void genPeaksFromTable(DataObjects::TableWorkspace_sptr peakparamws); /// Generate a peak - BackToBackExponential_sptr + Functions::BackToBackExponential_sptr genPeak(std::map<std::string, int> hklmap, std::map<std::string, double> parammap, std::map<std::string, std::string> bk2bk2braggmap, bool &good, @@ -114,62 +115,66 @@ private: void fitPeaksRobust(); /// Fit a single peak - bool fitPeak(BackToBackExponential_sptr peak, - BackgroundFunction_sptr background, double leftdev, + bool fitPeak(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr background, double leftdev, double rightdev, size_t m_wsIndex, double &chi2); //--------------------------------------------------------------------------- /// Fit single peak in robust mode (no hint) - bool fitSinglePeakRobust(BackToBackExponential_sptr peak, - BackgroundFunction_sptr background, double leftdev, - double rightdev, - std::map<std::string, double> rightpeakparammap, - double &finalchi2); + bool + fitSinglePeakRobust(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr backgroundfunction, + double leftdev, double rightdev, + std::map<std::string, double> rightpeakparammap, + double &finalchi2); /// Fit signle peak by Monte Carlo/simulated annealing - bool fitSinglePeakSimulatedAnnealing(BackToBackExponential_sptr peak, - std::vector<std::string> paramtodomc); + bool + fitSinglePeakSimulatedAnnealing(Functions::BackToBackExponential_sptr peak, + std::vector<std::string> paramtodomc); /// Fit peak with confidence of the centre - bool fitSinglePeakConfidentX(BackToBackExponential_sptr peak); + bool fitSinglePeakConfidentX(Functions::BackToBackExponential_sptr peak); /// Fit peak with trustful peak parameters - bool fitSinglePeakConfident(BackToBackExponential_sptr peak, - BackgroundFunction_sptr backgroundfunction, - double leftbound, double rightbound, double &chi2, - bool &annhilatedpeak); + bool + fitSinglePeakConfident(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr backgroundfunction, + double leftbound, double rightbound, double &chi2, + bool &annhilatedpeak); /// Fit peak with confident parameters bool fitSinglePeakConfidentY(DataObjects::Workspace2D_sptr dataws, - BackToBackExponential_sptr peak, + Functions::BackToBackExponential_sptr peak, double dampingfactor); /// Fit peaks with confidence in fwhm and etc. - bool fitOverlappedPeaks(std::vector<BackToBackExponential_sptr> peaks, - BackgroundFunction_sptr backgroundfunction, - double gfwhm); + bool + fitOverlappedPeaks(std::vector<Functions::BackToBackExponential_sptr> peaks, + Functions::BackgroundFunction_sptr backgroundfunction, + double gfwhm); /// Fit multiple (overlapped) peaks - bool doFitMultiplePeaks(DataObjects::Workspace2D_sptr dataws, size_t wsindex, - API::CompositeFunction_sptr peaksfunc, - std::vector<BackToBackExponential_sptr> peakfuncs, - std::vector<bool> &vecfitgood, - std::vector<double> &vecchi2s); + bool doFitMultiplePeaks( + DataObjects::Workspace2D_sptr dataws, size_t wsindex, + API::CompositeFunction_sptr peaksfunc, + std::vector<Functions::BackToBackExponential_sptr> peakfuncs, + std::vector<bool> &vecfitgood, std::vector<double> &vecchi2s); /// Use Le Bail method to estimate and set the peak heights - void estimatePeakHeightsLeBail(DataObjects::Workspace2D_sptr dataws, - size_t wsindex, - std::vector<BackToBackExponential_sptr> peaks); + void estimatePeakHeightsLeBail( + DataObjects::Workspace2D_sptr dataws, size_t wsindex, + std::vector<Functions::BackToBackExponential_sptr> peaks); /// Set constraints on a group of overlapped peaks for fitting - void - setOverlappedPeaksConstraints(std::vector<BackToBackExponential_sptr> peaks); + void setOverlappedPeaksConstraints( + std::vector<Functions::BackToBackExponential_sptr> peaks); /// Fit 1 peak by 1 minimizer of 1 call of minimzer (simple version) bool doFit1PeakSimple(DataObjects::Workspace2D_sptr dataws, size_t workspaceindex, - BackToBackExponential_sptr peakfunction, + Functions::BackToBackExponential_sptr peakfunction, std::string minimzername, size_t maxiteration, double &chi2); @@ -181,25 +186,26 @@ private: // string minimzername, size_t maxiteration, double &chi2); /// Fit single peak with background to raw data - bool doFit1PeakBackground(DataObjects::Workspace2D_sptr dataws, - size_t wsindex, BackToBackExponential_sptr peak, - BackgroundFunction_sptr backgroundfunction, - double &chi2); + bool + doFit1PeakBackground(DataObjects::Workspace2D_sptr dataws, size_t wsindex, + Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr backgroundfunction, + double &chi2); /// Fit 1 peak by using a sequential of minimizer bool doFit1PeakSequential(DataObjects::Workspace2D_sptr dataws, size_t workspaceindex, - BackToBackExponential_sptr peakfunction, + Functions::BackToBackExponential_sptr peakfunction, std::vector<std::string> minimzernames, std::vector<size_t> maxiterations, std::vector<double> dampfactors, double &chi2); /// Fit N overlapped peaks in a simple manner - bool doFitNPeaksSimple(DataObjects::Workspace2D_sptr dataws, size_t wsindex, - API::CompositeFunction_sptr peaksfunc, - std::vector<BackToBackExponential_sptr> peakfuncs, - std::string minimizername, size_t maxiteration, - double &chi2); + bool doFitNPeaksSimple( + DataObjects::Workspace2D_sptr dataws, size_t wsindex, + API::CompositeFunction_sptr peaksfunc, + std::vector<Functions::BackToBackExponential_sptr> peakfuncs, + std::string minimizername, size_t maxiteration, double &chi2); /// Store the function's parameter values to a map void storeFunctionParameters(API::IFunction_sptr function, @@ -241,15 +247,15 @@ private: // double leftbound, double rightbound); /// Estimate the range of a single peak - bool estimateSinglePeakRange(BackToBackExponential_sptr peak, - BackgroundFunction_sptr background, - BackToBackExponential_sptr rightpeak, + bool estimateSinglePeakRange(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr background, + Functions::BackToBackExponential_sptr rightpeak, double fwhm, bool ismostright, size_t m_wsIndex, double &chi2); /// Observe peak range with hint from right peak's properties - void observePeakRange(BackToBackExponential_sptr thispeak, - BackToBackExponential_sptr rightpeak, + void observePeakRange(Functions::BackToBackExponential_sptr thispeak, + Functions::BackToBackExponential_sptr rightpeak, double refpeakshift, double &peakleftbound, double &peakrightbound); @@ -266,17 +272,19 @@ private: /// Fit background function by removing the peak properly bool doFitBackground(DataObjects::Workspace2D_sptr dataws, - BackgroundFunction_sptr background, double leftpeakbound, - double rightpeakbound); + Functions::BackgroundFunction_sptr background, + double leftpeakbound, double rightpeakbound); /// Fit single peak without background - std::pair<bool, double> doFitPeak_Old(DataObjects::Workspace2D_sptr dataws, - BackToBackExponential_sptr peak, - double guessedfwhm, bool calchi2); + std::pair<bool, double> + doFitPeak_Old(DataObjects::Workspace2D_sptr dataws, + Functions::BackToBackExponential_sptr peak, double guessedfwhm, + bool calchi2); - std::pair<bool, double> doFitPeak(DataObjects::Workspace2D_sptr dataws, - BackToBackExponential_sptr peakfunction, - double guessedfwhm); + std::pair<bool, double> + doFitPeak(DataObjects::Workspace2D_sptr dataws, + Functions::BackToBackExponential_sptr peakfunction, + double guessedfwhm); /// Fit background-removed peak by Gaussian bool doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, size_t m_wsIndex, @@ -289,7 +297,7 @@ private: /// Calcualte the value of a single peak in a given range. void calculate1PeakGroup(std::vector<size_t> peakindexes, - BackgroundFunction_sptr background); + Functions::BackgroundFunction_sptr background); /// Parse the fitting result std::string parseFitResult(API::IAlgorithm_sptr fitalg, double &chi2, @@ -312,7 +320,7 @@ private: /// Plot a single peak to output vector void plotFunction(API::IFunction_sptr peakfunction, - BackgroundFunction_sptr background, + Functions::BackgroundFunction_sptr background, API::FunctionDomain1DVector domain); //----------------------------------------------------------------------------------------------- @@ -331,8 +339,9 @@ private: // CurveFitting::BackToBackExponential_sptr> m_peaksmap; /// Sorted vector for peaks. double = d_h, vector = (HKL), peak - std::vector<std::pair< - double, std::pair<std::vector<int>, BackToBackExponential_sptr>>> + std::vector< + std::pair<double, std::pair<std::vector<int>, + Functions::BackToBackExponential_sptr>>> m_vecPeakFunctions; /// Peak fitting information @@ -415,7 +424,7 @@ inline double linearInterpolateY(double x0, double xf, double y0, double yf, /// Estimate background for a pattern in a coarse mode void estimateBackgroundCoarse(DataObjects::Workspace2D_sptr dataws, - BackgroundFunction_sptr background, + Functions::BackgroundFunction_sptr background, size_t wsindexraw, size_t wsindexbkgd, size_t wsindexpeak); @@ -434,6 +443,7 @@ size_t findMaxValue(API::MatrixWorkspace_sptr dataws, size_t wsindex, /// Get function parameter name, value and etc information in string std::string getFunctionInfo(API::IFunction_sptr function); +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h index cd60219519794d3d0e53e12965233f4402904dfb..dd92a572da7db455acf9c7552bbc80132b9fb799 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h @@ -3,19 +3,20 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/LeBailFunction.h" +#include "MantidCurveFitting/Algorithms/LeBailFunction.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/MatrixWorkspace_fwd.h" -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidAPI/IFunction.h" #include <gsl/gsl_sf_erf.h> namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** LeBailFit : Algorithm to do Le Bail Fit. The workflow and architecture of this algorithm is different from LeBailFit, @@ -136,7 +137,7 @@ private: /// Examine whether the insturment parameter set to a peak can cause a valid /// set of peak profile of that peak bool examinInstrumentParameterValid( - CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr peak, double &d_h, + Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr peak, double &d_h, double &tof_h, std::string &errmsg); /// Set parameters to each peak @@ -161,14 +162,13 @@ private: /// Group peaks together void groupPeaks(std::vector<std::vector< - std::pair<double, CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr>>> & + std::pair<double, Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr>>> & peakgroupvec); /// Calcualate the peak heights of a group of overlapped peaks bool calculateGroupPeakIntensities( std::vector<std::pair< - double, CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr>> - peakgroup, + double, Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr>> peakgroup, API::MatrixWorkspace_sptr dataws, size_t wsindex, bool zerobackground, std::vector<double> &allpeaksvalues); @@ -343,7 +343,7 @@ private: -------------------------------*/ /// Background function - CurveFitting::BackgroundFunction_sptr m_backgroundFunction; + Functions::BackgroundFunction_sptr m_backgroundFunction; /// Function parameters updated by fit std::map<std::string, Parameter> @@ -474,6 +474,7 @@ void convertTableWorkspaceToMaps( std::vector<std::map<std::string, std::string>> strmaps, std::vector<std::map<std::string, double>> dblmaps); +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h index 3b46dfb4dd6b4312a2783cad39b6ece8344d76e7..656bdc5066bd66ef1a1f9d93a07be215c3e1447c 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h @@ -5,14 +5,17 @@ #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/MatrixWorkspace_fwd.h" #include "MantidAPI/IPowderDiffPeakFunction.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** LeBailFunction : LeBailFunction is to calculate peak intensities in a composite * function including neutron peak and background functions. + * Note: This is not a Mantid Fit Function, just a helper + * class to the algorithm @date 2013-04-26 : original LeBailFunction is not used by any other functions. And thus @@ -174,7 +177,7 @@ private: /// Composite functions for all peaks and background API::CompositeFunction_sptr m_compsiteFunction; /// Background function - BackgroundFunction_sptr m_background; + Functions::BackgroundFunction_sptr m_background; /// Parameters std::map<std::string, double> m_functionParameters; @@ -212,6 +215,7 @@ private: typedef boost::shared_ptr<LeBailFunction> LeBailFunction_sptr; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h index 56ae1b98d345e495576ea53cf04931ecaebae29d..4cfac079922ccc7d1b7579199dad4aae0f9fc293 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @@ -87,6 +88,7 @@ private: API::Progress *m_progress; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h similarity index 87% rename from Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h index c1c78b1044cd34e7e7a24c9d3277b1ae0b9098ba..7bddf3ec39884df67505bda3e8c5f800eda0ed2e 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h @@ -5,11 +5,12 @@ #include "MantidAPI/Algorithm.h" #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidAPI/TableRow.h" -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidKernel/Unit.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @class V3DFromHKLColumnExtractor @@ -76,18 +77,18 @@ public: protected: double getTransformedCenter(double d, const Kernel::Unit_sptr &unit) const; - void addHKLsToFunction(PawleyFunction_sptr &pawleyFn, + void addHKLsToFunction(Functions::PawleyFunction_sptr &pawleyFn, const API::ITableWorkspace_sptr &tableWs, const Kernel::Unit_sptr &unit, double startX, double endX) const; API::ITableWorkspace_sptr - getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const; - API::ITableWorkspace_sptr - getPeakParametersFromFunction(const PawleyFunction_sptr &pawleyFn) const; + getLatticeFromFunction(const Functions::PawleyFunction_sptr &pawleyFn) const; + API::ITableWorkspace_sptr getPeakParametersFromFunction( + const Functions::PawleyFunction_sptr &pawleyFn) const; API::IFunction_sptr - getCompositeFunction(const PawleyFunction_sptr &pawleyFn) const; + getCompositeFunction(const Functions::PawleyFunction_sptr &pawleyFn) const; void init(); void exec(); @@ -95,6 +96,7 @@ protected: Kernel::Unit_sptr m_dUnit; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h index 891f455c6e78482bd644cc1a74e8a563730eded7..0c0acc74d34543a09c5202729c92f1c91aebdfaf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Takes a workspace group and fits the same spectrum in all workspaces with @@ -119,6 +120,7 @@ private: std::map<std::string, std::vector<std::string>> m_minimizerWorkspaces; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h similarity index 88% rename from Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h index debe7054a8bbfc3ff26d11c0638cd687034fec87..9d3eeba57a4f02f257190c767a07f51f4f6f6df0 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h @@ -8,15 +8,16 @@ #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BackToBackExponential.h" -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" #include "MantidAPI/FunctionDomain.h" #include "MantidAPI/FunctionValues.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** RefinePowderInstrumentParameters : Algorithm to refine instrument geometry parameters only. @@ -151,43 +152,43 @@ private: //--------------- Class Variables ------------------- /// Output Workspace containing the dspacing ~ TOF peak positions - DataObjects::Workspace2D_sptr dataWS; + DataObjects::Workspace2D_sptr m_dataWS; /// Map for all peaks to fit individually - std::map<std::vector<int>, CurveFitting::BackToBackExponential_sptr> mPeaks; + std::map<std::vector<int>, Functions::BackToBackExponential_sptr> m_Peaks; /// Map for all peaks' error (fitted vs. experimental): [HKL]: Chi^2 - std::map<std::vector<int>, double> mPeakErrors; + std::map<std::vector<int>, double> m_PeakErrors; /// Map for function (instrument parameter) - std::map<std::string, double> mFuncParameters; + std::map<std::string, double> m_FuncParameters; /// Map to store the original (input) parameters - std::map<std::string, double> mOrigParameters; + std::map<std::string, double> m_OrigParameters; /// Peak function parameter names - std::vector<std::string> mPeakFunctionParameterNames; + std::vector<std::string> m_PeakFunctionParameterNames; /// N sets of the peak parameter values for the best N chi2 for MC. It is /// paired with mPeakFunctionParameterNames - std::vector<std::pair<double, std::vector<double>>> mBestMCParameters; + std::vector<std::pair<double, std::vector<double>>> m_BestMCParameters; /// N sets of the peak parameter values for the best N chi2 for MC. It is /// paired with mPeakFunctionParameterNames - std::vector<std::pair<double, std::vector<double>>> mBestFitParameters; + std::vector<std::pair<double, std::vector<double>>> m_BestFitParameters; /// N sets of the homemade chi2 and gsl chi2 - std::vector<std::pair<double, double>> mBestFitChi2s; + std::vector<std::pair<double, double>> m_BestFitChi2s; /// Best Chi2 ever - double mBestGSLChi2; + double m_BestGSLChi2; /// Minimum allowed sigma of a peak - double mMinSigma; + double m_MinSigma; /// Minimum number of fitted peaks for refinement - size_t mMinNumFittedPeaks; + size_t m_MinNumFittedPeaks; /// Maximum number of data stored - size_t mMaxNumberStoredParameters; + size_t m_MaxNumberStoredParameters; /// Modelling function - CurveFitting::ThermalNeutronDtoTOFFunction_sptr mFunction; + Functions::ThermalNeutronDtoTOFFunction_sptr m_Function; }; /** Formular for linear iterpolation: X = [(xf-x0)*Y - (xf*y0-x0*yf)]/(yf-y0) @@ -206,6 +207,7 @@ inline double linearInterpolateY(double x0, double xf, double y0, double yf, return y; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h index 3af13a083e66cdfd186c9115c029b3ade0b6a252..56875c6c88568c1c49d67c13d29018a34627fb3b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h @@ -8,12 +8,13 @@ #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" -#include "MantidCurveFitting/LeBailFit.h" -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/LeBailFit.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** RefinePowderInstrumentParameters3 : @@ -183,7 +184,7 @@ private: std::map<std::string, Parameter> m_profileParameters; /// My function for peak positions - ThermalNeutronDtoTOFFunction_sptr m_positionFunc; + Functions::ThermalNeutronDtoTOFFunction_sptr m_positionFunc; /// Damping factor double m_dampingFactor; @@ -226,6 +227,7 @@ double calculateFunctionChiSquare(const std::vector<double> &modelY, const std::vector<double> &dataY, const std::vector<double> &dataE); +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h index 53d877e613b3670c049e7683fa8f5c8c83114ca1..9aa91c96228c809036a56bac61cf5da9e9e01a36 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** SplineBackground @@ -61,6 +62,7 @@ private: void exec(); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h index b75259124c0cd45b1a657154a0b15d23a784cbe2..fbb797729d6c07784b7d6fa7efed53a4bfec8d2f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h @@ -3,10 +3,11 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/CubicSpline.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Takes two workspaces as input. One contain a set of points which define a spline, @@ -62,7 +63,7 @@ private: void exec(); /// CubicSpline member used to perform interpolation - boost::shared_ptr<CubicSpline> m_cspline; + boost::shared_ptr<Functions::CubicSpline> m_cspline; /// setup an output workspace using meta data from inws and taking a number of /// spectra @@ -91,6 +92,7 @@ private: int order) const; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h index 3c95fe4d0f927d458811de8854ffba1ab3ea2b70..ee17aa3dca0fb55f9ece30aee9b9fb5fc0cc8503 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h @@ -4,10 +4,11 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidCurveFitting/BSpline.h" +#include "MantidCurveFitting/Functions/BSpline.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Takes a 2D workspace and produces an output workspace containing a smoothed version of the data by selecting @@ -106,7 +107,7 @@ private: void performAdditionalFitting(API::MatrixWorkspace_sptr ws, const int row); /// CubicSpline member used to perform smoothing - boost::shared_ptr<BSpline> m_cspline; + boost::shared_ptr<Functions::BSpline> m_cspline; /// pointer to the input workspace API::MatrixWorkspace_sptr m_inputWorkspace; /// pointer to the input workspace converted to point data @@ -117,6 +118,7 @@ private: API::MatrixWorkspace_sptr m_outputWorkspace; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h index 2b3301fa8ea844eea8951a2583b47df936d45c83..ef798c50e1afbe87ad21d94ee77fdd088c0bfa47 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Constraints { //---------------------------------------------------------------------- // Forward Declaration //---------------------------------------------------------------------- @@ -142,6 +143,7 @@ private: double m_upperBound; }; +} // namespace Constraints } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h index 7bbc76c8bb8e07885624d8244efddb334a28d9d0..41cc8170906b0b63a589a46c417aa0fb4442a974 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** A semi-abstract class for a cost function for fitting functions. Implement val(), deriv(), and valAndDeriv() methods in a concrete class. @@ -100,6 +101,7 @@ protected: mutable bool m_dirtyHessian; /// dirty hessian flag }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h index ffef9d6666730776e3cc435975acfafa650cf799..2a38310ecf35d42be1781cc744f35b342ffdfbb6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** Cost function which allows positive peaks to be ignored and is suitable for e.g. fitting the background @@ -61,6 +62,7 @@ private: const std::string m_name; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h index be05dae8779b0db76f5cd7ba9060ae7850cb4e99..9478d2ab3be0dd7fc4ee4b47e5d147f139741c96 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include "MantidCurveFitting/GSLMatrix.h" #include "MantidCurveFitting/GSLVector.h" @@ -13,6 +13,7 @@ namespace CurveFitting { class SeqDomain; class ParDomain; +namespace CostFunctions { /** Cost function for least squares @author Anders Markvardsen, ISIS, RAL @@ -101,12 +102,13 @@ protected: mutable double m_pushedValue; mutable GSLVector m_pushedParams; - friend class SeqDomain; - friend class ParDomain; + friend class CurveFitting::SeqDomain; + friend class CurveFitting::ParDomain; double m_factor; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h index a58da7c674ccf477b2ff508921c8a133308e392d..4c5b04e99c27543c1150e0f06421ed9d57d418fb 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidCurveFitting/GSLMatrix.h" #include "MantidCurveFitting/GSLVector.h" @@ -16,6 +16,8 @@ namespace CurveFitting { class SeqDomain; class ParDomain; +namespace CostFunctions { + /** Cost function for Rwp = (sum_i (( obs_i - cal_i )/sigma_i)**2 ) / (sum_i (obs_i/sigma_i)**2) @@ -68,6 +70,7 @@ private: double calSqrtW(API::FunctionValues_sptr values) const; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h index 17fc016bb426d6e2c37c534c89f796124d3bb7a5..85f979e8876e3206414b27f2a3173d1c7f0f20bf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_COSTFUNCUNWEIGHTEDLEASTSQUARES_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** @class CostFuncUnweightedLeastSquares * @@ -53,6 +54,7 @@ protected: double getResidualVariance() const; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h index dbafd43e1a5452b7c3d9efdf9a74de52dbb6a3aa..137e3f2f08b1f4fd5f36f13a801eda26cb229bf1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -52,6 +53,7 @@ protected: static Kernel::Logger &g_log; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h similarity index 92% rename from Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h index 4c8be89a8f28e194246585da2ad52351ad28abb4..a09325d17a0556d65ff8fe3c8f925ccfd394c18d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h @@ -10,8 +10,10 @@ namespace Mantid { namespace CurveFitting { - +namespace CostFunctions { class CostFuncLeastSquares; +} // namespace CostFunctions +namespace FuncMinimisers { /** Implements a least squares minimization algorithm with damping. @@ -56,13 +58,13 @@ public: private: /// Pointer to the cost function. Must be the least squares. - boost::shared_ptr<CostFuncLeastSquares> m_leastSquares; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares; /// Relative tolerance. double m_relTol; /// The damping mu parameter in the Levenberg-Marquardt method. // double m_damping; }; - +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h index f894626253e6974c47a3a924af6c6d0923f3c67a..2da8b40ba41cf1e55c5a3a9fe27ba0822cc7e428 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** A wrapper around the GSL functions implementing a minimizer using derivatives. Concrete classes must implement the getGSLMinimizerType() method. @@ -94,6 +95,7 @@ private: void initGSLMMin(); }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h index 751e195e233676fd8a9f8be9af86c8a123189af1..c2c5b5ebfb75a997919a933003aff9b3beee60ea 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h @@ -10,7 +10,16 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { +/// Forward Declaration class CostFuncLeastSquares; +} +} +} + +namespace Mantid { +namespace CurveFitting { +namespace FuncMinimisers { /** FABADA : TODO: DESCRIPTION @@ -56,7 +65,7 @@ private: /// Pointer to the cost function. Must be the least squares. /// Intentar encontrar una manera de sacar aqui el numero de parametros que /// no sea necesaria la cost function - boost::shared_ptr<CostFuncLeastSquares> m_leastSquares; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares; /// The number of iterations done. size_t m_counter; /// @@ -88,6 +97,8 @@ private: /// Maximum number of iterations size_t m_max_iter; }; + +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h index cbe9ac8d9d7f1af2789f5a2aa0a1377a517d15ed..683b3a8c3b0521ab38b2be2e29d0831b84f844a3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Fletcher-Reeves flavour of the conjugate gradient algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -51,6 +52,7 @@ protected: virtual const gsl_multimin_fdfminimizer_type *getGSLMinimizerType(); }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h index 5d39606ed1f013a8041f9abb79ea943fe2c3f2c1..139b82aff0229675b5193519173860073e388008 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h @@ -10,9 +10,11 @@ namespace Mantid { namespace CurveFitting { - +namespace CostFunctions { class CostFuncLeastSquares; +} // namespace CostFunctions +namespace FuncMinimisers { /** Implementing Levenberg-Marquardt algorithm. Uses the normal system calculate the corrections to the parameters. Expects a cost function that can evaluate the value, the derivatives and the hessian matrix. @@ -57,7 +59,7 @@ public: private: /// Pointer to the cost function. Must be the least squares. - boost::shared_ptr<CostFuncLeastSquares> m_leastSquares; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares; /// The tau parameter in the Levenberg-Marquardt method. double m_tau; /// The damping mu parameter in the Levenberg-Marquardt method. @@ -71,6 +73,7 @@ private: std::vector<double> m_D; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h index a5af8ed98820db924555df0d58ef32974ad5c18c..e2c786adb32c18a7f1b32bb90f7d2813405df4c3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Levenberg-Marquardt by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -79,6 +80,7 @@ private: double m_relError; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h index 80d5feaf207f6260087c35404fed96b97c6de952..99f37e47c2b7f46d35eb3fb2e36c7b0b9040e846 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Polak-Ribiere flavour of the conjugate gradient algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -49,6 +50,7 @@ protected: virtual const gsl_multimin_fdfminimizer_type *getGSLMinimizerType(); }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h index 5ca099ae2b281a22b1d70aecade9fea5fb4a732f..14e637fd956804ea8580a0ebd7a6cc656b9c1942 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Simplex by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -87,6 +88,7 @@ private: gsl_multimin_function gslContainer; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h index 7e319e65c8427794ee1d1ee9eefac848983f0e82..a251a9eae3b7ec077233b9ce66b96812aead1e81 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing the steepest descent algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -51,6 +52,7 @@ protected: static Kernel::Logger &g_log; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h index 426c69d337e2ee0bc9964f7d04a401f4aca6fcaf..0bfcade021dcda28e4a3e875a4fcb048d8bc1c48 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Abragam fitting function for muon scientists @@ -64,6 +65,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h index a2a59dad6354494d31ddefa4cb73735db5244192..b45302749aaad9b49e7ca5082d9f4dbe64c7afc5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <boost/shared_ptr.hpp> #include <gsl/gsl_errno.h> @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** A wrapper around GSL functions implementing a B-spline. @@ -75,6 +76,7 @@ private: m_bsplineDerivWorkspace; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h index 103d8679b413e23627156e4151a577b52331b48b..83910c281dbe962f7dcfabaad1d381c90f90ffcf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide BackToBackExponential peak shape function interface to IPeakFunction. That is the function: @@ -87,6 +88,7 @@ protected: typedef boost::shared_ptr<BackToBackExponential> BackToBackExponential_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h index 46f9f2f25c32946dd9b517e80a2f24b58f67ecff..fc373fc1331bff0219d8f2d477db154ef6c9c97b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h @@ -13,6 +13,7 @@ class Parser; namespace Mantid { namespace CurveFitting { +namespace Functions { /** A background function. Functions that are intended to be used as backgrounds should inherit from this class to enable certain features. E.g. querying @@ -74,6 +75,7 @@ public: typedef boost::shared_ptr<BackgroundFunction> BackgroundFunction_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h index 5404e669d06fa3f1f9909bf8350dfd6d46f01481..59fd0db97239581ebaa53d4a3a430e70b2536390 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h @@ -4,15 +4,16 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/IFunctionMW.h" #include "MantidAPI/IFunction1D.h" #include "MantidAPI/ParamFunction.h" #include "MantidKernel/cow_ptr.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** * Provide peak shape function interface a Peak shape on one time slice of a @@ -176,6 +177,7 @@ protected: expCoeffxy; //<Other common values used in calculating values and //<derivatives }; +} // namespace Functions } } diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h index f7511c3810a8eda9e2cdd4fda957c04f9d581253..be7ed03f4ad95d00407a788af69241ca74bbe386 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Bk2BkExpConvPV : Peak profile as tback-to-back exponential convoluted with pseudo-Voigt. @@ -92,6 +93,7 @@ private: typedef boost::shared_ptr<Bk2BkExpConvPV> Bk2BkExpConvPV_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h index 37eafa709eb65aa33d783d805ca48f5ed320a53d..92dd84b3ddf1deda279dc2435e33092d12c71afa 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h @@ -1,8 +1,8 @@ #ifndef MANTID_CURVEFITTING_CHEBFUNBASE_H #define MANTID_CURVEFITTING_CHEBFUNBASE_H -#include "DllConfig.h" -#include "GSLMatrix.h" +#include "MantidCurveFitting/DllConfig.h" +#include "MantidCurveFitting/GSLMatrix.h" #include <boost/shared_ptr.hpp> #include <vector> @@ -15,6 +15,7 @@ class IFunction; } namespace CurveFitting { +namespace Functions { /// Type of the approximated function typedef std::function<double(double)> ChebfunFunctionType; @@ -213,6 +214,7 @@ boost::shared_ptr<ChebfunBase> ChebfunBase::bestFitAnyTolerance( return ChebfunBase_sptr(); } +} // namespace Functions } // CurveFitting } // Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h index 100a00197e1a218cf4d7016a7c45d16e38430f72..0b4209636d5883ea7112815e5e7d0e2369da0144 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h @@ -4,11 +4,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <valarray> namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements Chebyshev polynomial expansion. @@ -72,6 +73,7 @@ private: typedef boost::shared_ptr<Chebyshev> Chebyshev_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h index 22d9514f8f6749ea7e5a5d9d6153613673be7005..a3a8d2dfb1853fa9ef4fa58a698c0702fc809f7d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** This implements a resolution function for fitting a single mass in a compton scattering spectrum. The @@ -81,6 +82,7 @@ private: double m_hwhmLorentz; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h index c533219940a0172149577792504bae5ea9c88330..58f9e65ab1ff2aaad49b01da28636e012b8158dd 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h @@ -2,18 +2,21 @@ #define MANTID_CURVEFITTING_COMPTONPROFILE_H_ #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/MatrixWorkspace_fwd.h" #include "MantidAPI/ParamFunction.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { //--------------------------------------------------------------------------- // Forward declarations //--------------------------------------------------------------------------- struct DetectorParams; +} +namespace Functions { /** This class serves as a base-class for ComptonProfile type functions. @see GaussianComptonProfile, GramCharlierComptonProfile @@ -59,13 +62,14 @@ public: /// Pre-calculate the Y-space values with specified resolution parameters void cacheYSpaceValues(const std::vector<double> &tseconds, - const bool isHistogram, const DetectorParams &detpar, + const bool isHistogram, + const Algorithms::DetectorParams &detpar, const ResolutionParams &respar); /// Pre-calculate the Y-space values virtual void cacheYSpaceValues(const std::vector<double> &tseconds, const bool isHistogram, - const DetectorParams &detpar); + const Algorithms::DetectorParams &detpar); /// Turn off logger void disableLogging() { m_log.setEnabled(false); } ///@} @@ -133,6 +137,7 @@ protected: ///@} }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h index 1b3c42cfd9cf84997e60c8a747676fe23bfe542f..a34ee169656166cbcd099378c4ca6a7214c248cc 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h @@ -2,12 +2,13 @@ #define MANTID_CURVEFITTING_COMPTONSCATTERINGCOUNTRATE_H_ #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" #include "MantidKernel/ClassMacros.h" #include "MantidKernel/Matrix.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements a specialized function that encapsulates the combination of @@ -92,6 +93,7 @@ private: std::vector<double> m_dataErrorRatio; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h index 499d426d8bbcccc70ac5f21e8e8c68a572c651b9..b1e5791269a82fcdc5fbef17b757ab8b22b24a85 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Performes convolution of two functions. @@ -151,6 +152,7 @@ private: mutable std::vector<double> m_resolution; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h index 0ad0f34ccc00de17b46e5f28653f5e07a34d4ccc..3dbaa2c4dc2cbae2236fac99393de0856a271c1d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <boost/scoped_array.hpp> #include <gsl/gsl_errno.h> @@ -13,6 +13,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** A wrapper around GSL functions implementing cubic spline interpolation. @@ -117,6 +118,7 @@ private: typedef boost::shared_ptr<CubicSpline> CubicSpline_sptr; typedef const boost::shared_ptr<CubicSpline> CubicSpline_const_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h index 1f0b682f088492ab13765438ac147bfd7f53aecb..9f98b9cafbcffd02ce3fa9281323ae05918054c5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Delta function. Makes sence in Convolution only. @@ -78,6 +79,7 @@ protected: } }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h index 8b1c38f194acfe816aa5e15788132eb720c86413..0157a963217c46f6cc209ebef4c09d2e9e195b5d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** @author Jose Borreguero, NScD @date December 02 2013 @@ -125,6 +126,7 @@ private: boost::shared_ptr<InelasticDiffRotDiscreteCircle> m_inelastic; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h index 7db3b4e805332c1280f709fc4f2da9b277e82a66..b7eeb4b57e017333dd7ac416b11752691c7693f2 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h @@ -14,6 +14,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** @author Jose Borreguero, NScD @date 11/14/2011 @@ -172,6 +173,7 @@ private: m_inelastic; // inelastic intensity of the DiffSphere structure factor }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h index 7b24a53770f71e84d18c280f07f50843b2764987..9865dd6b967b0f8104c7d4c385ac8fe4a9265fb9 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Dynamic Kubo Toyabe function interface to IFunction1D for muon scientists. @@ -87,6 +88,7 @@ private: double m_minEps, m_maxEps; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h index 490ab7dba3c2a0c120b0f083e356e2437ebca4f7..1519739ca40c79dbaa5616264e928a7407fed088 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Errore function erfc()for calibrating the end of a tube. @@ -57,6 +58,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h index 60ccb117530cc9b2da7b49617b9eb27e012aa7e6..45732a7d1124801438877998d3b7e6b93e8df03a 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide exponential decay function: h*exp(-(x-c)/t) @@ -56,6 +57,7 @@ protected: const size_t nData); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h index b12e4e30a1224464520fb86898ae1df7dda76562..7a42e6a9aaf3058eda3bf8a9ab9877feb10150c4 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide exponential decay function: h*exp(-lambda.x) @@ -59,6 +60,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h index 9f896924044cb2578fda36b0e6a93e150e60d760..07d3ad4d03a47a66ed337c142a60e9cf21012683 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide oscillating exponential decay function: h*exp(-lambda.x)*(cos(2pi*f*x+phi)) @@ -61,6 +62,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h index 1de1aba3bd9ee7a9c61ee04dd1151e4e9381fa3b..cb1add3374562c945fe024946ec3079fdb382742 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h @@ -1,11 +1,12 @@ #ifndef MANTID_CURVEFITTING_FLATBACKGROUND_H_ #define MANTID_CURVEFITTING_FLATBACKGROUND_H_ -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidKernel/System.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** FlatBackground : TODO: DESCRIPTION @@ -47,6 +48,7 @@ private: void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h index 114437e08a4a6e6aee0465c1d92866fd9822b91e..8a5f52c3953d950f5b62cf7a0b981b4f84c2e7ad 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_FULLPROFPOLYNOMIAL_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** FullprofPolynomial : Polynomial background defined in Fullprof @@ -75,6 +76,7 @@ private: typedef boost::shared_ptr<FullprofPolynomial> FullprofPolynomial_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h index ac17d7122184a9f52292a9c78d746ff4437fde4f..053d65163a9f60a0e561be628579b227d1035913 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide gaussian decay function: A*exp(-(sigma.x)^2)) @@ -59,6 +60,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h index a80e5df087e7bc3e06fb5704268eab30bfc6731d..b54279a77ada4db8cfb55bbf53a1d1fe9b482049 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide gaussian decay function: A*exp(-(sigma.x)^2)) @@ -59,6 +60,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h index da8d2b4914c7e01e33c5ef83cd1e7e2944a40f29..c56f8618d54c3feca5e7bbc3937ae6456b771c58 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide gaussian peak shape function interface to IPeakFunction. I.e. the function: Height*exp(-0.5*((x-PeakCentre)/Sigma)^2). @@ -79,6 +80,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h index 4030a64cac4039f4307b3b07fd9ed045985d06dc..60c6ffe5f6266ade00fef84d9785ab66e12588ea 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_GAUSSIANCOMPTONPROFILE_H_ #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements a function to calculate the Compton profile of a nucleus using a @@ -64,6 +65,7 @@ private: const double amplitude) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h index bc8e1b4fd01d4ac647b5c2afd8812084adbd850b..14cbb33b841dfca79fb96e8da8705c1d25da2012 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_GRAMCHARLIERCOMPTONPROFILE_H_ #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements a function to calculate the Compton profile of a nucleus using a @@ -75,7 +76,8 @@ private: size_t wi, double startX, double endX); /// Pre-calculate the Y-space values void cacheYSpaceValues(const std::vector<double> &tseconds, - const bool isHistogram, const DetectorParams &detpar); + const bool isHistogram, + const Algorithms::DetectorParams &detpar); /// The active hermite coefficents std::vector<short> m_hermite; @@ -95,6 +97,7 @@ private: bool m_userFixedFSE; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h index ecb2f57bc9166e4d8232bfdd9bc90ef2208496eb..bc8cc43f3e66a697a9e61977a4b8c037736306bb 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Ikeda-Carpenter-pseudo-Voigt peak shape function interface to IPeakFunction. See wiki @@ -96,6 +97,7 @@ private: double &eta) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h index 3919c08b16233c0625e92ec5e7496e8280a9ce86..e8ba0edd4443cd9bf9277159cf528a001dd62fb9 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide linear function interface to IFunction. I.e. the function: A0+A1*x. @@ -61,6 +62,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h index 6816b53db955c049ce4ae2e8d83230f99e43eb47..90273384e73961fbff8ab34e0fea5f01e0bb5adf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Log Normal function: h*exp(-(log(x)-t)^2 / (2*b^2) )/x @@ -54,6 +55,7 @@ protected: const size_t nData); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h index b6b816d9d1fbd762e8d01d271bfa37ed305b06e3..132408dee74bf59f15c532d86ac917d00b2d32da 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide lorentzian peak shape function interface to IPeakFunction. I.e. the function: \f$ \frac{A}{\pi}( \Gamma/2((x-PeakCentre)^2+(\Gamma/2)^2) @@ -69,6 +70,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h index 66fb65e18476ca6e7ad6bb53eb9cd19e8b8b7bc0..6211f2d053b617abcf03f5084cc31ee7966ec979 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit1D.h" +#include "MantidCurveFitting/Algorithms/Fit1D.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Deprecation notice: instead of using this algorithm please use the Fit algorithm where the Function parameter of this algorithm is used @@ -50,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class DLLExport Lorentzian1D : public Fit1D { +class DLLExport Lorentzian1D : public Algorithms::Fit1D { public: /// Destructor virtual ~Lorentzian1D(){}; @@ -80,6 +81,7 @@ private: const double *xValues, const size_t nData); }; +} // namespace Functions } // namespace Algorithm } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h index 508ea9d2279cf4635302d25f6a90425c4bb7a156..f474266b5605ce12a87c96a79e392d5410ac75dc 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Muon F Interaction fitting function @@ -57,6 +58,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h index 93933ea8871a7327b1b0ceee740fc07591c25cc5..7ddc907fdabb05231397f386d2bff50dab3e7d54 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** NeutronBk2BkExpConvPVoigt : Back-to-back exponential function convoluted with pseudo-voigt @@ -128,6 +129,7 @@ private: mutable double m_N; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h index a9e3214fd494c581db6725e82b1b4c62cd5ca66d..a56373b31075af5abccf29966b2c68b123f557a1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h @@ -13,6 +13,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** @class PawleyParameterFunction @@ -173,6 +174,7 @@ protected: typedef boost::shared_ptr<PawleyFunction> PawleyFunction_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h index 22621031ef1242d457f5d30003eb08aeec097836..e0d34610fbf5f7bd3b948b584c0691614dc68058 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** PeakParameterFunction : @@ -62,6 +63,7 @@ protected: API::IPeakFunction_sptr m_peakFunction; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h index 94cfa29b53e326a109883a9d444bfd66183698fc..fcb944652788d7d91509eb50452853cf582f13ea 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h @@ -2,11 +2,12 @@ #define MANTID_CURVEFITTING_POLYNOMIAL_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { /** Polynomial : N-th polynomial background function. @@ -73,6 +74,7 @@ private: typedef boost::shared_ptr<Polynomial> Polynomial_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h index 3b9c09886fefe4018ceac089427213d4f95f24a2..e5b8e1dd27201ed2404d63fb88e4992e592dcea6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h @@ -3,7 +3,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidKernel/ArrayProperty.h" @@ -13,6 +13,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { class RemovePeaks { public: @@ -141,6 +142,7 @@ private: void fitBackgroundFunction(std::string bkgdfunctiontype); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h index 83ca1c3239d57117d8822d75ee2ed884e5f1adc7..cef21a282322ecfe74c8250d2db5ac344b69a72f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Allow user to create a fit function which is the product of two or more other fit functions. @@ -62,6 +63,7 @@ protected: virtual void init(){}; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h index b49be7f9b1dfbc992b354277ca51ef82959c2d33..2e54ad0d69c2253c092fe8008ab60508fb24dd51 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ProductLinearExp : Function that evauates the product of an exponential and linear function. @@ -49,6 +50,7 @@ protected: const size_t nData) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h index 257482ed18ecc744075382591895133bad6913d8..ac047a16d192d738949c4ad1af2bc1485e970f4f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ProductQuadraticExp : Function that evauates the product of an exponential and quadratic function. @@ -49,6 +50,7 @@ protected: const size_t nData) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h index 6c970c4b17c2b18b4f6ae5c6e8780428e36b3164..53a3f331d2bd26ced8e7eca0260cb55ed230009f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** PseudoVoigt @@ -71,6 +72,7 @@ protected: void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h index 0e1e6f08553667bcb36cc7f9f922da615d2d5cbd..41eb1812f44767733cd18005bc0c6b2a9147a8c1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide quadratic function interface to IFunction. I.e. the function: A0+A1*x+A2*x^2 @@ -60,6 +61,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h index 0ccf77e23f6d2639013ba29334afbcaa7794d71c..b1c6fb99b986b55055e602d648be001b8ab03b76 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ReflectivityMulf : Calculate the ReflectivityMulf from a simple layer model. @@ -59,6 +60,7 @@ private: typedef boost::shared_ptr<ReflectivityMulf> ReflectivityMulf_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h index fd7237629dd03edb73858578fc5fa931afc2ab55..bfb2f49bc06f0f68c352223eca731199f136b809 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/TabulatedFunction.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Resolution function. It is implemented in terms of TabulatedFunction but doesn't inherit form it. @@ -67,6 +68,7 @@ private: TabulatedFunction m_fun; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h index 5da29131ea0bbc5f41d67d8e7ef924dde747f6a2..e05bfbcd112c0541933de0e440b03217a2e6d67c 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_SIMPLECHEBFUN_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** SimpleChebfun : approximates smooth 1d functions and provides methods to manipulate them. @@ -94,6 +95,7 @@ private: bool m_badFit; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h index b959aa5ecf47e81356d1188da75598381b6fe764..b6beff8a18a795ef96eb64ab6cc427a7f5336910 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide static Kubo Toyabe fitting function @@ -57,6 +58,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h index 143973e3c742846f82b86e3963db8aa2314f8173..0ceebf0aa2ecec4259996780b29d09d45a8dc251 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** StaticKuboToyabeTimesExpDecay fitting function @@ -51,6 +52,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h index 0b4d63300dcb6c717fbc06db0986a5ace4c70838..6f9370af94cadbeff4d3fa1b48fd050e2d6901d3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** StaticKuboToyabeTimesGausDecay fitting function. @@ -51,6 +52,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h index 7f61f545b008744c2e7a173de94ea3ad86e473cc..43677513e130aeb2df4d37dcc7753d5f06b417f3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Streteched Exponential fitting function: h*exp(-(x/t)^b ) @@ -55,6 +56,7 @@ protected: const size_t nData); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h index 433965a34874a6ce489df33ee7a2d1317bd2711b..4816212d1a4a8840e2538c9e249c829f96f39e43 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h @@ -8,6 +8,7 @@ #include "MantidAPI/IFunction1D.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide stetch exponential function for Muon scientists @@ -52,6 +53,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h index 2fe8d9ae5d15127e1e7f3e2687d4dfe2a3b0fcc9..a4e4812efbeb5b7ca51bc888c8f604f1af4503da 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h @@ -19,6 +19,7 @@ class MatrixWorkspace; } namespace CurveFitting { +namespace Functions { /** A function which takes its values from a file or a workspace. The values atr @@ -124,6 +125,7 @@ private: mutable bool m_setupFinished; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h index a8b2aee386cb1ee75b40be77b19b5085fd089919..5ee5b6e50b500c5dfa5e7a0c9b76294195214587 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpAlpha : Function to calculate Alpha of Bk2Bk Exponential function from @@ -71,6 +72,7 @@ private: typedef boost::shared_ptr<ThermalNeutronBk2BkExpAlpha> ThermalNeutronBk2BkExpAlpha_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h index f88f29f5001131df88a7b0030389647467642562..31e1d7efd7975e0257a0fab7d6865f37a9225fa5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpBETA : Function to calculate Beta of Bk2Bk Exponential function from @@ -71,6 +72,7 @@ private: typedef boost::shared_ptr<ThermalNeutronBk2BkExpBeta> ThermalNeutronBk2BkExpBeta_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h index e36a938cb9b8f0b12cad3306ff2d0a6112d73ba2..267f3ab7819f647cbdf717fe422fcc9a1315e0a1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpConvPVoigt : Back-to-back exponential convoluted with pseudo Voigt for thermal neutron @@ -196,6 +197,7 @@ inline double calCubicDSpace(double a, int h, int k, int l) /// Integral for Gamma // std::complex<double> E1X(std::complex<double> z); +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h index c4534681d1b727069a4d88299628dae824655d1e..412ea0d44021b1cacac2edfdc884cf7a9b61e604 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpSIGMA : Function to calculate Sigma of Bk2Bk Exponential function from @@ -70,6 +71,7 @@ private: typedef boost::shared_ptr<ThermalNeutronBk2BkExpSigma> ThermalNeutronBk2BkExpSigma_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h index 0fef3abbf8c1175838de6a4166e51d3bc25ea1f2..8d0c4a2ed846b5bcd0b3636a287ceb33606ef2a5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h @@ -14,6 +14,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronDtoTOFFunction : TODO: DESCRIPTION @@ -98,6 +99,7 @@ inline double calThermalNeutronTOF(double dh, double dtt1, double dtt1t, return tof_h; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h index ca9c41550d92e490dab933ad1a5f55767af82f58..cd6e468fee151c7a2463f3e30729b01f0a54bcb3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h @@ -14,6 +14,7 @@ class Parser; namespace Mantid { namespace CurveFitting { +namespace Functions { /** A user defined function. @@ -95,6 +96,7 @@ private: static double *AddVariable(const char *varName, void *pufun); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h index 1c27d36a0a15df1a6b5f40eae0db12c9faefbef0..fefde7f6549aa277abcce768ea6d1d2a5f6d7a43 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h @@ -4,12 +4,13 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit1D.h" +#include "MantidCurveFitting/Algorithms/Fit1D.h" #include "MantidGeometry/muParser_Silent.h" #include <boost/shared_array.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { /** Deprecation notice: instead of using this algorithm please use the Fit algorithm where the Function parameter of this algorithm is used @@ -70,7 +71,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class UserFunction1D : public Fit1D { +class UserFunction1D : public Algorithms::Fit1D { public: /// Constructor UserFunction1D() @@ -121,6 +122,7 @@ private: boost::shared_array<double> m_tmp1; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h index 02f62fb838f4303c62d893c1d86b769f6dedb560..18576a11ca4f5a8cbb79c07d2bd034470e901cd3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h @@ -8,10 +8,13 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { //--------------------------------------------------------------------------- // Forward declarations //--------------------------------------------------------------------------- struct DetectorParams; +} +namespace Functions { //--------------------------------------------------------------------------- /// Simple data structure to store resolution parameter values @@ -81,7 +84,7 @@ public: setMatrixWorkspace(boost::shared_ptr<const API::MatrixWorkspace> workspace, size_t wi, double startX, double endX); /// Pre-calculate the resolution components values - void cacheResolutionComponents(const DetectorParams &detpar, + void cacheResolutionComponents(const Algorithms::DetectorParams &detpar, const ResolutionParams &respar); /// Turn off logger void disableLogging() { m_log.setEnabled(false); } @@ -118,6 +121,7 @@ private: ///@} }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h index 192bcb12d02833b47a6b2e1defb1d34e1f80c41f..780771239cdf771d7854ff0918fab2af18cf2ab4 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements an analytical approximation to the Voigt function. @@ -66,6 +67,7 @@ private: void setFwhm(const double value); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h index 259599a19010f6dc76c6e803aef871e5763c01d4..bde389d04c861786ba31393bf215c6d456523b21 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h @@ -7,7 +7,7 @@ #include <gsl/gsl_blas.h> #include "MantidAPI/IFunction.h" #include "MantidAPI/ICostFunction.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" namespace Mantid { namespace CurveFitting { @@ -85,7 +85,7 @@ public: /// Structure to contain least squares data and used by GSL struct GSL_FitData { /// Constructor - GSL_FitData(boost::shared_ptr<CostFuncLeastSquares> cf); + GSL_FitData(boost::shared_ptr<CostFunctions::CostFuncLeastSquares> cf); /// Destructor ~GSL_FitData(); /// number of points to be fitted (size of X, Y and sqrtWeightData arrays) @@ -94,14 +94,14 @@ struct GSL_FitData { size_t p; /// Pointer to the function API::IFunction_sptr function; - boost::shared_ptr<CostFuncLeastSquares> costFunction; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> costFunction; /// Initial function parameters gsl_vector *initFuncParams; /// Jacobi matrix interface JacobianImpl1 J; // this is presently commented out in the implementation - // gsl_matrix *holdCalculatedJacobian; ///< cache of the claculated jacobian + // gsl_matrix *holdCalculatedJacobian; ///< cache of the calculated jacobian }; int gsl_f(const gsl_vector *x, void *params, gsl_vector *f); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h b/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h index e9e35f7ac6e9d915984bba1aa8a17d91f7c10955..9add0ff7f666e5946222020673c31a24eb6c58d6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h @@ -241,6 +241,7 @@ inline GSLMatrixMult3 operator*(const GSLMatrixMult2 &mm, const Tr &m) { /// The << operator. Prints a matrix in rows. inline std::ostream &operator<<(std::ostream &ostr, const GSLMatrix &m) { + std::ios::fmtflags fflags(ostr.flags()); ostr << std::scientific << std::setprecision(6); for (size_t i = 0; i < m.size1(); ++i) { for (size_t j = 0; j < m.size2(); ++j) { @@ -248,6 +249,7 @@ inline std::ostream &operator<<(std::ostream &ostr, const GSLMatrix &m) { } ostr << std::endl; } + ostr.flags(fflags); return ostr; } diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h index dda2fcf1d8358f0e60023c855a4eb5080a758447..3c8886b0b648fe6475b0312904f2987fe694581e 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h @@ -4,7 +4,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/ILatticeFunction.h" -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" namespace Mantid { namespace CurveFitting { @@ -61,7 +61,7 @@ protected: void beforeDecoratedFunctionSet(const API::IFunction_sptr &fn); private: - PawleyParameterFunction_sptr m_cellParameters; + Functions::PawleyParameterFunction_sptr m_cellParameters; }; typedef boost::shared_ptr<LatticeFunction> LatticeFunction_sptr; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h b/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h deleted file mode 100644 index 506d7e7f047a3cc6dccba054d32ed6ec93e21e94..0000000000000000000000000000000000000000 --- a/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef MANTID_CURVEFITTING_MULTIBG_H_ -#define MANTID_CURVEFITTING_MULTIBG_H_ - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidAPI/CompositeFunction.h" -#include "MantidAPI/IFunctionMW.h" -#include "MantidAPI/MatrixWorkspace_fwd.h" - -#ifdef _WIN32 -#pragma warning(disable : 4250) -#endif - -namespace Mantid { - -namespace API { -class WorkspaceGroup; -} - -namespace CurveFitting { -/** A composite function. - - @author Roman Tolchenov, Tessella Support Services plc - @date 19/08/2011 - - Copyright © 2009 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge - National Laboratory & European Spallation Source - - 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 <http://www.gnu.org/licenses/>. - - File change history is stored at: <https://github.com/mantidproject/mantid>. - Code Documentation is available at: <http://doxygen.mantidproject.org> -*/ -class DLLExport MultiBG : public API::CompositeFunction { -public: - /// Default constructor - MultiBG() : API::CompositeFunction() {} - /// Destructor - virtual ~MultiBG(); - - /* Overriden methods */ - - using CompositeFunction::setWorkspace; - virtual void setWorkspace(boost::shared_ptr<const API::Workspace>) {} - /// Set the workspace - void setWorkspace(boost::shared_ptr<const API::Workspace> ws, bool copyData); - void setSlicing(const std::string &slicing); - virtual boost::shared_ptr<const API::Workspace> getWorkspace() const { - return m_spectra[0].first; - } - /// Returns the function's name - std::string name() const { return "MultiBG"; } - /// Returns the function's category - virtual const std::string category() const { return "Background"; } - - virtual void function(API::FunctionDomain &) const {} - - /// Returns the size of the fitted data (number of double values returned by - /// the function) - virtual size_t dataSize() const { return m_data.size(); } - /// Returns a reference to the fitted data. These data are taken from the - /// workspace set by setWorkspace() method. - virtual const double *getData() const { return &m_data[0]; } - virtual const double *getWeights() const { return &m_weights[0]; } - /// Function you want to fit to. - void function(double *out) const; - /// Derivatives of function with respect to active parameters - void functionDeriv(API::Jacobian *out); - void functionDeriv(API::FunctionDomain &domain, API::Jacobian &jacobian) { - API::IFunction::functionDeriv(domain, jacobian); - } - -protected: - boost::shared_ptr<API::WorkspaceGroup> createCalculatedWorkspaceGroup( - const std::vector<double> &sd = std::vector<double>()); - - boost::shared_ptr<const API::MatrixWorkspace> m_workspace; - - /// to collect different workspaces found in child functions - std::vector<std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t>> - m_spectra; - /// to store function indices to workspaces: m_funIndex[i] gives vector of - /// indexes of m_spectra for function i - std::vector<std::vector<size_t>> m_funIndex; - /// the data vector which is a composition of all fitted spectra - std::vector<double> m_data; - /// the vector of fitting weights, one for each value in m_data - std::vector<double> m_weights; - /// offsets of particular workspaces in the m_data and m_weights arrays - std::vector<size_t> m_offset; -}; - -} // namespace CurveFitting -} // namespace Mantid - -#endif /*MANTID_CURVEFITTING_MULTIBG_H_*/ diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h b/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h index bda5ec1da7cc7a89ee1a20eeb634b7eca1a483a7..c695e7c06bdb07dae06f7888c0898215e8318819 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h @@ -43,12 +43,13 @@ public: virtual void getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, API::FunctionValues_sptr &values) const; /// Calculate the value of a least squares cost function - virtual void leastSquaresVal(const CostFuncLeastSquares &leastSquares); + virtual void + leastSquaresVal(const CostFunctions::CostFuncLeastSquares &leastSquares); /// Calculate the value, first and second derivatives of a least squares cost /// function - virtual void - leastSquaresValDerivHessian(const CostFuncLeastSquares &leastSquares, - bool evalDeriv, bool evalHessian); + virtual void leastSquaresValDerivHessian( + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, + bool evalHessian); }; } // namespace CurveFitting diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h index 5e451efdf3324c3b6d47fd4e9a35f32f9550336f..7066b276f113f0883a8e7dc08376f473dfead9ec 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h @@ -8,8 +8,8 @@ #include "MantidAPI/FunctionDomain.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/IDomainCreator.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/CostFuncRwp.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h" #include <stdexcept> #include <vector> @@ -57,16 +57,17 @@ public: /// Add new domain creator void addCreator(API::IDomainCreator_sptr creator); /// Calculate the value of a least squares cost function - virtual void leastSquaresVal(const CostFuncLeastSquares &leastSquares); + virtual void + leastSquaresVal(const CostFunctions::CostFuncLeastSquares &leastSquares); /// Calculate the value, first and second derivatives of a least squares cost /// function - virtual void - leastSquaresValDerivHessian(const CostFuncLeastSquares &leastSquares, - bool evalDeriv, bool evalHessian); + virtual void leastSquaresValDerivHessian( + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, + bool evalHessian); /// Calculate the value of a Rwp cost function - void rwpVal(const CostFuncRwp &rwp); + void rwpVal(const CostFunctions::CostFuncRwp &rwp); /// Calculate the value, first and second derivatives of a RWP cost function - void rwpValDerivHessian(const CostFuncRwp &rwp, bool evalDeriv, + void rwpValDerivHessian(const CostFunctions::CostFuncRwp &rwp, bool evalDeriv, bool evalHessian); /// Create an instance of SeqDomain in one of two forms: either SeqDomain for diff --git a/Framework/CurveFitting/src/CalculateChiSquared.cpp b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp similarity index 98% rename from Framework/CurveFitting/src/CalculateChiSquared.cpp rename to Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp index 0f65e00127775c1c352363f77ef26f0476887d81..17104a9e4b23dd8223a42f8cc5647bc397ee9d10 100644 --- a/Framework/CurveFitting/src/CalculateChiSquared.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp @@ -1,16 +1,18 @@ -#include "MantidCurveFitting/CalculateChiSquared.h" +#include "MantidCurveFitting/Algorithms/CalculateChiSquared.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/Column.h" #include "MantidAPI/TableRow.h" -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" #include "MantidCurveFitting/GSLJacobian.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { -using namespace Mantid::Kernel; -using namespace Mantid::API; +using namespace Kernel; +using namespace API; +using namespace Functions; // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(CalculateChiSquared) @@ -651,5 +653,6 @@ void CalculateChiSquared::refixParameters() { } } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CalculateGammaBackground.cpp b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp similarity index 95% rename from Framework/CurveFitting/src/CalculateGammaBackground.cpp rename to Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp index d4dfeb2503d74d64dcf47b5655128fc95fc281c3..a6281e12576ea6a561de2189adf28c38e98ac59f 100644 --- a/Framework/CurveFitting/src/CalculateGammaBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp @@ -1,7 +1,7 @@ -#include "MantidCurveFitting/CalculateGammaBackground.h" -#include "MantidCurveFitting/ComptonProfile.h" -#include "MantidCurveFitting/ConvertToYSpace.h" -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Algorithms/CalculateGammaBackground.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FunctionProperty.h" @@ -16,8 +16,12 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; +using namespace CurveFitting; +using namespace CurveFitting::Functions; +using namespace BOOST_FUNCTION_STD_NS; using namespace std; // Subscription @@ -227,8 +231,9 @@ void CalculateGammaBackground::calculateSpectrumFromDetector( // -- Setup detector & resolution parameters -- DetectorParams detPar = ConvertToYSpace::getDetectorParameters(m_inputWS, inputIndex); - ResolutionParams detRes = - VesuvioResolution::getResolutionParameters(m_inputWS, inputIndex); + CurveFitting::Functions::ResolutionParams detRes = + CurveFitting::Functions::VesuvioResolution::getResolutionParameters( + m_inputWS, inputIndex); // Compute a time of flight spectrum convolved with a Voigt resolution // function for each mass @@ -254,8 +259,9 @@ void CalculateGammaBackground::calculateBackgroundFromFoils( // -- Setup detector & resolution parameters -- DetectorParams detPar = ConvertToYSpace::getDetectorParameters(m_inputWS, inputIndex); - ResolutionParams detRes = - VesuvioResolution::getResolutionParameters(m_inputWS, inputIndex); + CurveFitting::Functions::ResolutionParams detRes = + CurveFitting::Functions::VesuvioResolution::getResolutionParameters( + m_inputWS, inputIndex); const size_t nxvalues = m_backgroundWS->blocksize(); std::vector<double> foilSpectrum(nxvalues); @@ -320,7 +326,7 @@ void CalculateGammaBackground::calculateBackgroundSingleFoil( // Structs to hold geometry & resolution information DetectorParams foilPar = detPar; // copy foilPar.t0 = 0.0; - ResolutionParams foilRes = detRes; // copy + CurveFitting::Functions::ResolutionParams foilRes = detRes; // copy foilRes.dEnGauss = foilInfo.gaussWidth; foilRes.dEnLorentz = foilInfo.lorentzWidth; @@ -388,8 +394,9 @@ void CalculateGammaBackground::calculateTofSpectrum( FunctionFactory::Instance().createInitialized(m_profileFunction)); for (size_t i = 0; i < m_npeaks; ++i) { - auto profile = boost::dynamic_pointer_cast<ComptonProfile>( - profileFunction->getFunction(i)); + auto profile = + boost::dynamic_pointer_cast<CurveFitting::Functions::ComptonProfile>( + profileFunction->getFunction(i)); profile->disableLogging(); profile->setUpForFit(); profile->cacheYSpaceValues(tseconds, false, detpar, respar); @@ -422,8 +429,9 @@ void CalculateGammaBackground::retrieveInputs() { boost::dynamic_pointer_cast<CompositeFunction>(profileFunction)) { m_npeaks = composite->nFunctions(); for (size_t i = 0; i < m_npeaks; ++i) { - auto single = boost::dynamic_pointer_cast<ComptonProfile>( - composite->getFunction(i)); + auto single = + boost::dynamic_pointer_cast<CurveFitting::Functions::ComptonProfile>( + composite->getFunction(i)); if (!single) { throw std::invalid_argument("Invalid function. Composite must contain " "only ComptonProfile functions"); @@ -595,5 +603,6 @@ std::pair<double, double> CalculateGammaBackground::calculateThetaRange( return std::make_pair(theta - dtheta, theta + dtheta); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CalculateMSVesuvio.cpp b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp similarity index 96% rename from Framework/CurveFitting/src/CalculateMSVesuvio.cpp rename to Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp index 1b9aea72dde7c708db9ec294cd7861830a9b50c6..c34d6b66b7caf69f416a7fb04af6a6f341c9a881 100644 --- a/Framework/CurveFitting/src/CalculateMSVesuvio.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp @@ -1,11 +1,11 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/CalculateMSVesuvio.h" +#include "MantidCurveFitting/Algorithms/CalculateMSVesuvio.h" // Use helpers for storing detector/resolution parameters -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidCurveFitting/MSVesuvioHelpers.h" -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "MantidAPI/SampleShapeValidator.h" #include "MantidAPI/WorkspaceValidators.h" @@ -25,8 +25,11 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; +using namespace CurveFitting; +using namespace CurveFitting::Functions; using Geometry::Link; using Geometry::ParameterMap; using Geometry::Track; @@ -137,7 +140,8 @@ void CalculateMSVesuvio::exec() { MatrixWorkspace_sptr multsc = WorkspaceFactory::Instance().create(m_inputWS); // Initialize random number generator - m_randgen = new MSVesuvioHelper::RandomNumberGenerator(getProperty("Seed")); + m_randgen = new CurveFitting::MSVesuvioHelper::RandomNumberGenerator( + getProperty("Seed")); // Setup progress const size_t nhist = m_inputWS->getNumberHistograms(); @@ -319,11 +323,11 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex, DetectorParams detpar = ConvertToYSpace::getDetectorParameters(m_inputWS, wsIndex); detpar.t0 *= 1e6; // t0 in microseconds here - ResolutionParams respar = - VesuvioResolution::getResolutionParameters(m_inputWS, wsIndex); + Functions::ResolutionParams respar = + Functions::VesuvioResolution::getResolutionParameters(m_inputWS, wsIndex); // Final counts averaged over all simulations - MSVesuvioHelper::SimulationAggregator accumulator(m_nruns); + CurveFitting::MSVesuvioHelper::SimulationAggregator accumulator(m_nruns); for (size_t i = 0; i < m_nruns; ++i) { m_progress->report("MS calculation: idx=" + boost::lexical_cast<std::string>(wsIndex) + ", run=" + @@ -338,7 +342,8 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex, } // Average over all runs and assign to output workspaces - MSVesuvioHelper::SimulationWithErrors avgCounts = accumulator.average(); + CurveFitting::MSVesuvioHelper::SimulationWithErrors avgCounts = + accumulator.average(); avgCounts.normalise(); assignToOutput(avgCounts, totalsc, multsc); } @@ -354,7 +359,7 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex, */ void CalculateMSVesuvio::simulate( const DetectorParams &detpar, const ResolutionParams &respar, - MSVesuvioHelper::Simulation &simulCounts) const { + CurveFitting::MSVesuvioHelper::Simulation &simulCounts) const { for (size_t i = 0; i < m_nevents; ++i) { calculateCounts(detpar, respar, simulCounts); } @@ -369,7 +374,7 @@ void CalculateMSVesuvio::simulate( * scattering contribution */ void CalculateMSVesuvio::assignToOutput( - const MSVesuvioHelper::SimulationWithErrors &avgCounts, + const CurveFitting::MSVesuvioHelper::SimulationWithErrors &avgCounts, API::ISpectrum &totalsc, API::ISpectrum &multsc) const { // Sum up all multiple scatter events auto &msscatY = multsc.dataY(); @@ -404,7 +409,7 @@ void CalculateMSVesuvio::assignToOutput( */ double CalculateMSVesuvio::calculateCounts( const DetectorParams &detpar, const ResolutionParams &respar, - MSVesuvioHelper::Simulation &simulation) const { + CurveFitting::MSVesuvioHelper::Simulation &simulation) const { double weightSum(0.0); // moderator coord in lab frame @@ -785,13 +790,14 @@ double CalculateMSVesuvio::generateE1(const double angle, const double e1nom, const double randv = m_randgen->flat(); if (e1nom < 5000.0) { if (angle > 90.0) - return MSVesuvioHelper::finalEnergyAuDD(randv); + return CurveFitting::MSVesuvioHelper::finalEnergyAuDD(randv); else - return MSVesuvioHelper::finalEnergyAuYap(randv); + return CurveFitting::MSVesuvioHelper::finalEnergyAuYap(randv); } else { - return MSVesuvioHelper::finalEnergyUranium(randv); + return CurveFitting::MSVesuvioHelper::finalEnergyUranium(randv); } } } // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ConvertToYSpace.cpp b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp similarity index 98% rename from Framework/CurveFitting/src/ConvertToYSpace.cpp rename to Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp index e7c099c6f5d44cb04c4c958dc3115f5c79776928..1124ff0504e39bf341dc6e2d45f958ec507eeda8 100644 --- a/Framework/CurveFitting/src/ConvertToYSpace.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/WorkspaceValidators.h" #include "MantidGeometry/Instrument/DetectorGroup.h" @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ConvertToYSpace) @@ -299,5 +300,6 @@ void ConvertToYSpace::cacheInstrumentGeometry() { m_samplePos = sample->getPos(); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ConvolveWorkspaces.cpp b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp similarity index 92% rename from Framework/CurveFitting/src/ConvolveWorkspaces.cpp rename to Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp index c8bc4034617b52b04c993398b9051a33012d4ca1..860d527201a1ef0c1501070ca0fb35f7b680b631 100644 --- a/Framework/CurveFitting/src/ConvolveWorkspaces.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp @@ -1,9 +1,9 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ConvolveWorkspaces.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/TabulatedFunction.h" +#include "MantidCurveFitting/Algorithms/ConvolveWorkspaces.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" #include <sstream> #include <gsl/gsl_errno.h> #include <gsl/gsl_fft_real.h> @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ConvolveWorkspaces) @@ -25,6 +26,7 @@ using namespace Kernel; using namespace API; using namespace DataObjects; using namespace Geometry; +using namespace Functions; void ConvolveWorkspaces::init() { declareProperty( @@ -96,4 +98,5 @@ void ConvolveWorkspaces::exec() { } } // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/EstimatePeakErrors.cpp b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp similarity index 97% rename from Framework/CurveFitting/src/EstimatePeakErrors.cpp rename to Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp index f9f0903ea3654a519c2d13286627ca44b6275f50..3990ef3fbabf9c2d809877eac4c9ca43622d12b0 100644 --- a/Framework/CurveFitting/src/EstimatePeakErrors.cpp +++ b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp @@ -1,6 +1,6 @@ -#include "MantidCurveFitting/EstimatePeakErrors.h" +#include "MantidCurveFitting/Algorithms/EstimatePeakErrors.h" #include "MantidCurveFitting/GSLMatrix.h" -#include "MantidCurveFitting/PeakParameterFunction.h" +#include "MantidCurveFitting/Functions/PeakParameterFunction.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FunctionProperty.h" @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; using namespace std; @@ -164,5 +165,6 @@ void EstimatePeakErrors::exec() { setProperty("OutputWorkspace", results); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/EvaluateFunction.cpp b/Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp similarity index 94% rename from Framework/CurveFitting/src/EvaluateFunction.cpp rename to Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp index d5c5e9e7099de52de4bcca1fd6203f2ed22cc061..9e072bd88875299e3e259ac3f7b024717c91d27e 100644 --- a/Framework/CurveFitting/src/EvaluateFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp @@ -1,7 +1,8 @@ -#include "MantidCurveFitting/EvaluateFunction.h" +#include "MantidCurveFitting/Algorithms/EvaluateFunction.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace Mantid::Kernel; using namespace Mantid::API; @@ -55,5 +56,6 @@ void EvaluateFunction::execConcrete() { setProperty("OutputWorkspace", outputWS); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Fit.cpp b/Framework/CurveFitting/src/Algorithms/Fit.cpp similarity index 97% rename from Framework/CurveFitting/src/Fit.cpp rename to Framework/CurveFitting/src/Algorithms/Fit.cpp index c37debe935c3074b8cce0224b27cff1c2ae5a4a2..b10b66a8a918dca32327fc32d80a04a0136e399e 100644 --- a/Framework/CurveFitting/src/Fit.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -18,6 +18,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(Fit) @@ -63,7 +64,7 @@ void Fit::initConcrete() { API::CostFunctionFactory::Instance().getKeys(); // select only CostFuncFitting variety for (auto it = costFuncOptions.begin(); it != costFuncOptions.end(); ++it) { - auto costFunc = boost::dynamic_pointer_cast<CostFuncFitting>( + auto costFunc = boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( API::CostFunctionFactory::Instance().create(*it)); if (!costFunc) { *it = ""; @@ -152,8 +153,8 @@ void Fit::execConcrete() { const size_t maxIterations = static_cast<size_t>(intMaxIterations); // get the cost function which must be a CostFuncFitting - boost::shared_ptr<CostFuncFitting> costFunc = - boost::dynamic_pointer_cast<CostFuncFitting>( + boost::shared_ptr<CostFunctions::CostFuncFitting> costFunc = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( API::CostFunctionFactory::Instance().create( getPropertyValue("CostFunction"))); @@ -362,5 +363,6 @@ void Fit::execConcrete() { progress(1.0); } -} // namespace Algorithm +} // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Fit1D.cpp b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp similarity index 99% rename from Framework/CurveFitting/src/Fit1D.cpp rename to Framework/CurveFitting/src/Algorithms/Fit1D.cpp index d6db35e872a292e107331397fa707c1a23b3e5bd..3f3db8ff573c4ba24d9da29b069138b950125401 100644 --- a/Framework/CurveFitting/src/Fit1D.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit1D.h" +#include "MantidCurveFitting/Algorithms/Fit1D.h" #include <sstream> #include <numeric> #include <cmath> @@ -20,6 +20,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace Kernel; using API::WorkspaceProperty; @@ -776,5 +777,6 @@ FitData::FitData(Fit1D *fit, const std::string &fixed) J.m_map[i] = -1; } -} // namespace Algorithm +} // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp similarity index 99% rename from Framework/CurveFitting/src/FitPowderDiffPeaks.cpp rename to Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index e24430a6d96c91e439b21d0938cc7e25b45582ab..87801460543315e7aaccd4501e43e74facf27e8f 100644 --- a/Framework/CurveFitting/src/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/FitPowderDiffPeaks.h" +#include "MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h" #include "MantidKernel/ListValidator.h" #include "MantidKernel/ArrayProperty.h" @@ -16,16 +16,16 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/TextAxis.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/BackToBackExponential.h" -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" -#include "MantidCurveFitting/DampingMinimizer.h" -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/split.hpp> @@ -50,11 +50,14 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::DataObjects; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(FitPowderDiffPeaks) @@ -590,7 +593,7 @@ void FitPowderDiffPeaks::observePeakRange(BackToBackExponential_sptr thispeak, * Assumption: * 1. peak must be in the range of [input peak center - leftdev, + rightdev] * - * Prerequisit: + * Prerequisites: * ---- NONE! * * Algorithms: @@ -1853,10 +1856,9 @@ bool FitPowderDiffPeaks::doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, // b) Constraint double centerleftend = in_center - leftfwhm * 0.5; double centerrightend = in_center + rightfwhm * 0.5; - CurveFitting::BoundaryConstraint *centerbound = - new CurveFitting::BoundaryConstraint(gaussianpeak.get(), "PeakCentre", - centerleftend, centerrightend, - false); + Constraints::BoundaryConstraint *centerbound = + new Constraints::BoundaryConstraint(gaussianpeak.get(), "PeakCentre", + centerleftend, centerrightend, false); gaussianpeak->addConstraint(centerbound); // 3. Fit @@ -2019,7 +2021,6 @@ bool FitPowderDiffPeaks::doFitMultiplePeaks( // 1. Fit peaks intensities first const size_t numpeaks = peakfuncs.size(); map<string, double> peaksfuncparams; - bool evergood = true; // a) Set up fit/fix vector<string> peakparnames = peakfuncs[0]->getParameterNames(); @@ -2043,7 +2044,7 @@ bool FitPowderDiffPeaks::doFitMultiplePeaks( double chi2; bool fitgood = doFitNPeaksSimple(dataws, wsindex, peaksfunc, peakfuncs, "Levenberg-MarquardtMD", 1000, chi2); - evergood = evergood || fitgood; + bool evergood = fitgood; // c) Process result if (!fitgood) { @@ -2811,7 +2812,7 @@ FitPowderDiffPeaks::genPeak(map<string, int> hklmap, map<string, string> bk2bk2braggmap, bool &good, vector<int> &hkl, double &d_h) { // Generate a peak function - CurveFitting::BackToBackExponential newpeak; + BackToBackExponential newpeak; newpeak.initialize(); BackToBackExponential_sptr newpeakptr = boost::make_shared<BackToBackExponential>(newpeak); @@ -3447,5 +3448,6 @@ size_t findMaxValue(MatrixWorkspace_sptr dataws, size_t wsindex, return imax; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp similarity index 99% rename from Framework/CurveFitting/src/LeBailFit.cpp rename to Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 9996f8049856bb1e88c279037da696b41d2c2f57..21d6e9af3d6c32ae3b6a07aa2cd14487ad0aac60 100644 --- a/Framework/CurveFitting/src/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -4,15 +4,15 @@ * COMMIT NOTES */ -#include "MantidCurveFitting/LeBailFit.h" +#include "MantidCurveFitting/Algorithms/LeBailFit.h" #include "MantidKernel/ListValidator.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/VisibleWhenProperty.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidAPI/TextAxis.h" #include <boost/algorithm/string.hpp> @@ -43,6 +43,7 @@ using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { const Rfactor badR(DBL_MAX, DBL_MAX); @@ -340,7 +341,7 @@ void LeBailFit::exec() { case FIT: // LeBail Fit g_log.notice() << "Function: Do LeBail Fit ==> Monte Carlo.\n"; - + // fall through case MONTECARLO: // Monte carlo Le Bail refinement g_log.notice("Function: Do LeBail Fit By Monte Carlo Random Walk."); @@ -2691,5 +2692,6 @@ void writeRfactorsToFile(vector<double> vecX, vector<Rfactor> vecR, return; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp similarity index 99% rename from Framework/CurveFitting/src/LeBailFunction.cpp rename to Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp index bed2bfd968fe5c19504ed0b82621c91502ef595e..0d9ee16925a41aaa4efb24ce3524080ca49365b9 100644 --- a/Framework/CurveFitting/src/LeBailFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp @@ -1,9 +1,9 @@ #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/LeBailFunction.h" +#include "MantidCurveFitting/Algorithms/LeBailFunction.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include <sstream> @@ -18,6 +18,7 @@ const double NEG_DBL_MAX(-1. * DBL_MAX); namespace Mantid { namespace CurveFitting { +namespace Algorithms { namespace { const double PEAKRANGECONSTANT = 5.0; @@ -894,7 +895,8 @@ void LeBailFunction::addBackgroundFunction( // Create background function from factory auto background = FunctionFactory::Instance().createFunction(backgroundtype); - m_background = boost::dynamic_pointer_cast<BackgroundFunction>(background); + m_background = + boost::dynamic_pointer_cast<Functions::BackgroundFunction>(background); // Set order and initialize m_background->setAttributeValue("n", static_cast<int>(order)); @@ -946,7 +948,7 @@ void LeBailFunction::setFitProfileParameter(string paramname, double minvalue, std::stringstream parss; parss << "f0." << paramname; string parnamef0 = parss.str(); - CurveFitting::BoundaryConstraint *bc = new BoundaryConstraint( + Constraints::BoundaryConstraint *bc = new Constraints::BoundaryConstraint( m_compsiteFunction.get(), parnamef0, minvalue, maxvalue); m_compsiteFunction->addConstraint(bc); @@ -1153,4 +1155,5 @@ double LeBailFunction::getPeakMaximumValue(std::vector<int> hkl, } } // namespace Mantid +} // namespace Algorithms } // namespace CurveFitting diff --git a/Framework/CurveFitting/src/NormaliseByPeakArea.cpp b/Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp similarity index 99% rename from Framework/CurveFitting/src/NormaliseByPeakArea.cpp rename to Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp index f3a7522bbfac8b7f93e12d9980b70f9c502b4814..780f0feb4261bf251d0c137fae577124e818ec44 100644 --- a/Framework/CurveFitting/src/NormaliseByPeakArea.cpp +++ b/Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/NormaliseByPeakArea.h" +#include "MantidCurveFitting/Algorithms/NormaliseByPeakArea.h" #include "MantidAPI/IFunction.h" #include "MantidAPI/FunctionFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /// Starting value of peak position in y-space for fit double PEAK_POS_GUESS = -0.1; @@ -381,5 +382,6 @@ void NormaliseByPeakArea::symmetriseYSpace() { } } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PawleyFit.cpp b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp similarity index 94% rename from Framework/CurveFitting/src/PawleyFit.cpp rename to Framework/CurveFitting/src/Algorithms/PawleyFit.cpp index 19cfd18fd2cbb7d9e1c079d6d2aa2c33ddde2979..22b87ff3efafd815630d8527b13152414abfe9cc 100644 --- a/Framework/CurveFitting/src/PawleyFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp @@ -1,7 +1,7 @@ -#include "MantidCurveFitting/PawleyFit.h" +#include "MantidCurveFitting/Algorithms/PawleyFit.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/TableRow.h" @@ -14,6 +14,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; @@ -62,7 +63,7 @@ double PawleyFit::getTransformedCenter(double d, const Unit_sptr &unit) const { * @param startX :: Lowest allowed x-value for reflection position. * @param endX :: Highest allowed x-value for reflection position. */ -void PawleyFit::addHKLsToFunction(PawleyFunction_sptr &pawleyFn, +void PawleyFit::addHKLsToFunction(Functions::PawleyFunction_sptr &pawleyFn, const ITableWorkspace_sptr &tableWs, const Unit_sptr &unit, double startX, double endX) const { @@ -105,8 +106,8 @@ void PawleyFit::addHKLsToFunction(PawleyFunction_sptr &pawleyFn, /// Creates a table containing the cell parameters stored in the supplied /// function. -ITableWorkspace_sptr -PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const { +ITableWorkspace_sptr PawleyFit::getLatticeFromFunction( + const Functions::PawleyFunction_sptr &pawleyFn) const { if (!pawleyFn) { throw std::invalid_argument( "Cannot extract lattice parameters from null function."); @@ -119,7 +120,7 @@ PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const { latticeParameterTable->addColumn("double", "Value"); latticeParameterTable->addColumn("double", "Error"); - PawleyParameterFunction_sptr parameters = + Functions::PawleyParameterFunction_sptr parameters = pawleyFn->getPawleyParameterFunction(); for (size_t i = 0; i < parameters->nParams(); ++i) { @@ -133,7 +134,7 @@ PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const { /// Extracts all profile parameters from the supplied function. ITableWorkspace_sptr PawleyFit::getPeakParametersFromFunction( - const PawleyFunction_sptr &pawleyFn) const { + const Functions::PawleyFunction_sptr &pawleyFn) const { if (!pawleyFn) { throw std::invalid_argument( "Cannot extract peak parameters from null function."); @@ -167,8 +168,8 @@ ITableWorkspace_sptr PawleyFit::getPeakParametersFromFunction( /// Returns a composite function consisting of the Pawley function and Chebyshev /// background if enabled in the algorithm. -IFunction_sptr -PawleyFit::getCompositeFunction(const PawleyFunction_sptr &pawleyFn) const { +IFunction_sptr PawleyFit::getCompositeFunction( + const Functions::PawleyFunction_sptr &pawleyFn) const { CompositeFunction_sptr composite = boost::make_shared<CompositeFunction>(); composite->addFunction(pawleyFn); @@ -271,8 +272,9 @@ void PawleyFit::init() { /// Execution of algorithm. void PawleyFit::exec() { // Setup PawleyFunction with cell from input parameters - PawleyFunction_sptr pawleyFn = boost::dynamic_pointer_cast<PawleyFunction>( - FunctionFactory::Instance().createFunction("PawleyFunction")); + Functions::PawleyFunction_sptr pawleyFn = + boost::dynamic_pointer_cast<Functions::PawleyFunction>( + FunctionFactory::Instance().createFunction("PawleyFunction")); g_log.information() << "Setting up Pawley function..." << std::endl; std::string profileFunction = getProperty("PeakProfileFunction"); @@ -286,7 +288,7 @@ void PawleyFit::exec() { << std::endl; pawleyFn->setUnitCell(getProperty("InitialCell")); - PawleyParameterFunction_sptr pawleyParameterFunction = + Functions::PawleyParameterFunction_sptr pawleyParameterFunction = pawleyFn->getPawleyParameterFunction(); g_log.information() << " Initial unit cell: " @@ -416,5 +418,6 @@ V3D V3DFromHKLColumnExtractor::getHKLFromString( return hkl; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp similarity index 99% rename from Framework/CurveFitting/src/PlotPeakByLogValue.cpp rename to Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index 152331bab772848b2fb6d7efc2446d16b335564e..1478d845126c02fd1f1acc413dd612f3e9d521e8 100644 --- a/Framework/CurveFitting/src/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -10,7 +10,7 @@ #include <boost/lexical_cast.hpp> #include <boost/algorithm/string/replace.hpp> -#include "MantidCurveFitting/PlotPeakByLogValue.h" +#include "MantidCurveFitting/Algorithms/PlotPeakByLogValue.h" #include "MantidAPI/IFuncMinimizer.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -35,6 +35,7 @@ Mantid::Kernel::Logger g_log("PlotPeakByLogValue"); namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace Kernel; using namespace API; @@ -618,5 +619,6 @@ PlotPeakByLogValue::getMinimizerString(const std::string &wsName, return format; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp similarity index 82% rename from Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp rename to Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index f47bdf5eac157d3ebd042ce8bcabb098e9374eca..80d4fdec61c340ed49b564399931f1824e76dc26 100644 --- a/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/RefinePowderInstrumentParameters.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h" #include "MantidKernel/ListValidator.h" #include "MantidKernel/ArrayProperty.h" @@ -14,11 +14,11 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/TextAxis.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/Gaussian.h" #include "MantidGeometry/Crystal/UnitCell.h" @@ -33,18 +33,24 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::DataObjects; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(RefinePowderInstrumentParameters) //---------------------------------------------------------------------------------------------- /** Constructor */ -RefinePowderInstrumentParameters::RefinePowderInstrumentParameters() {} +RefinePowderInstrumentParameters::RefinePowderInstrumentParameters() + : m_BestGSLChi2(0.0), m_MinSigma(0.0), m_MinNumFittedPeaks(0), + m_MaxNumberStoredParameters(0) {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -141,7 +147,7 @@ void RefinePowderInstrumentParameters::exec() { DataObjects::TableWorkspace_sptr parameterWS = this->getProperty("InstrumentParameterWorkspace"); - mMinSigma = getProperty("MinSigma"); + m_MinSigma = getProperty("MinSigma"); int tempint = getProperty("MinNumberFittedPeaks"); if (tempint <= 1) { @@ -149,13 +155,13 @@ void RefinePowderInstrumentParameters::exec() { << " is too small. " << endl; throw std::invalid_argument("Input MinNumberFittedPeaks is too small."); } - mMinNumFittedPeaks = static_cast<size_t>(tempint); + m_MinNumFittedPeaks = static_cast<size_t>(tempint); tempint = getProperty("NumberBestFitRecorded"); if (tempint <= 0) throw runtime_error( "Input NumberBestFitRecorded cannot be less and equal to 0. "); - mMaxNumberStoredParameters = static_cast<size_t>(tempint); + m_MaxNumberStoredParameters = static_cast<size_t>(tempint); string algoption = getProperty("RefinementAlgorithm"); if (algoption.compare("DirectFit") == 0) @@ -168,14 +174,14 @@ void RefinePowderInstrumentParameters::exec() { // 2. Parse input table workspace genPeaksFromTable(peakWS); - importParametersFromTable(parameterWS, mFuncParameters); - mOrigParameters = mFuncParameters; + importParametersFromTable(parameterWS, m_FuncParameters); + m_OrigParameters = m_FuncParameters; // 3. Generate a cener workspace as function of d-spacing. bool usemc = false; if (refinealgorithm == MonteCarlo) usemc = true; - genPeakCentersWorkspace(usemc, mMaxNumberStoredParameters); + genPeakCentersWorkspace(usemc, m_MaxNumberStoredParameters); // 4. Fit instrument geometry function stringstream errss; @@ -204,7 +210,7 @@ void RefinePowderInstrumentParameters::exec() { } // 5. Set output workspace - this->setProperty("OutputWorkspace", dataWS); + this->setProperty("OutputWorkspace", m_dataWS); // 6. Output new instrument parameters DataObjects::TableWorkspace_sptr fitparamws = @@ -223,18 +229,17 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { << endl; // 1. Initialize the fitting function - CurveFitting::ThermalNeutronDtoTOFFunction rawfunc; - mFunction = - boost::make_shared<CurveFitting::ThermalNeutronDtoTOFFunction>(rawfunc); - mFunction->initialize(); + ThermalNeutronDtoTOFFunction rawfunc; + m_Function = boost::make_shared<ThermalNeutronDtoTOFFunction>(rawfunc); + m_Function->initialize(); - API::FunctionDomain1DVector domain(dataWS->readX(1)); + API::FunctionDomain1DVector domain(m_dataWS->readX(1)); API::FunctionValues values(domain); - const MantidVec &rawY = dataWS->readY(0); - const MantidVec &rawE = dataWS->readE(0); + const MantidVec &rawY = m_dataWS->readY(0); + const MantidVec &rawE = m_dataWS->readE(0); // 2. Set up parameters values - std::vector<std::string> funparamnames = mFunction->getParameterNames(); + std::vector<std::string> funparamnames = m_Function->getParameterNames(); std::vector<std::string> paramtofit = getProperty("ParametersToFit"); std::sort(paramtofit.begin(), paramtofit.end()); @@ -244,22 +249,22 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { std::map<std::string, double>::iterator paramiter; for (size_t i = 0; i < funparamnames.size(); ++i) { string parname = funparamnames[i]; - paramiter = mFuncParameters.find(parname); - if (paramiter == mFuncParameters.end()) { + paramiter = m_FuncParameters.find(parname); + if (paramiter == m_FuncParameters.end()) { // Not found and thus skip continue; } double parvalue = paramiter->second; - mFunction->setParameter(parname, parvalue); + m_Function->setParameter(parname, parvalue); msgss << setw(10) << parname << " = " << parvalue << endl; } cout << msgss.str(); // 2b. Calculate the statistic of the starting values - double gslchi2 = calculateFunctionStatistic(mFunction, dataWS, 0); + double gslchi2 = calculateFunctionStatistic(m_Function, m_dataWS, 0); double homchi2 = - calculateD2TOFFunction(mFunction, domain, values, rawY, rawE); + calculateD2TOFFunction(m_Function, domain, values, rawY, rawE); cout << "Fit Starting Value: Chi^2 (GSL) = " << gslchi2 << ", Chi2^2 (Home) = " << homchi2 << endl; @@ -271,9 +276,9 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { vsiter = std::find(paramtofit.begin(), paramtofit.end(), parname); if (vsiter == paramtofit.end()) - mFunction->fix(i); + m_Function->fix(i); else - mFunction->unfix(i); + m_Function->unfix(i); } // 4. Select minimizer. Use Simplex for more than 1 parameters to fit. @@ -285,13 +290,13 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { g_log.information() << "Fit use minizer: " << minimizer << endl; // 5. Create and setup fit algorithm - g_log.information() << "Fit instrument geometry: " << mFunction->asString() + g_log.information() << "Fit instrument geometry: " << m_Function->asString() << std::endl; stringstream outss; - for (size_t i = 0; i < dataWS->readX(0).size(); ++i) - outss << dataWS->readX(0)[i] << "\t\t" << dataWS->readY(0)[i] << "\t\t" - << dataWS->readE(0)[i] << endl; + for (size_t i = 0; i < m_dataWS->readX(0).size(); ++i) + outss << m_dataWS->readX(0)[i] << "\t\t" << m_dataWS->readY(0)[i] << "\t\t" + << m_dataWS->readE(0)[i] << endl; cout << "Input Peak Position Workspace To Fit: " << endl << outss.str() << endl; @@ -299,8 +304,8 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { fitalg->initialize(); fitalg->setProperty("Function", - boost::dynamic_pointer_cast<API::IFunction>(mFunction)); - fitalg->setProperty("InputWorkspace", dataWS); + boost::dynamic_pointer_cast<API::IFunction>(m_Function)); + fitalg->setProperty("InputWorkspace", m_dataWS); fitalg->setProperty("WorkspaceIndex", 0); fitalg->setProperty("Minimizer", minimizer); fitalg->setProperty("CostFunction", "Least squares"); @@ -323,31 +328,31 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { API::IFunction_sptr fitfunc = fitalg->getProperty("Function"); // 4. Set the output data (model and diff) - mFunction->function(domain, values); + m_Function->function(domain, values); for (size_t i = 0; i < domain.size(); ++i) { - dataWS->dataY(1)[i] = values[i]; - dataWS->dataY(2)[i] = dataWS->readY(0)[i] - values[i]; + m_dataWS->dataY(1)[i] = values[i]; + m_dataWS->dataY(2)[i] = m_dataWS->readY(0)[i] - values[i]; } double selfchi2 = - calculateD2TOFFunction(mFunction, domain, values, rawY, rawE); + calculateD2TOFFunction(m_Function, domain, values, rawY, rawE); cout << "Homemade Chi^2 = " << selfchi2 << endl; // 5. Update fitted parameters for (size_t i = 0; i < funparamnames.size(); ++i) { std::string parname = funparamnames[i]; double parvalue = fitfunc->getParameter(parname); - mFuncParameters[parname] = parvalue; + m_FuncParameters[parname] = parvalue; } // 6. Pretty screen output stringstream dbss; dbss << "************ Fit Parameter Result *************" << std::endl; - for (paramiter = mFuncParameters.begin(); paramiter != mFuncParameters.end(); - ++paramiter) { + for (paramiter = m_FuncParameters.begin(); + paramiter != m_FuncParameters.end(); ++paramiter) { std::string parname = paramiter->first; - double inpparvalue = mOrigParameters[parname]; + double inpparvalue = m_OrigParameters[parname]; double parvalue = paramiter->second; dbss << setw(20) << parname << " = " << setw(15) << setprecision(6) << parvalue << "\t\tFrom " << setw(15) << setprecision(6) @@ -359,18 +364,18 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { // 7. Play with Zscore: template<typename TYPE> // std::vector<double> getZscore(const std::vector<TYPE>& data, const bool // sorted=false); - vector<double> z0 = Kernel::getZscore(dataWS->readY(0)); - vector<double> z1 = Kernel::getZscore(dataWS->readY(1)); - vector<double> z2 = Kernel::getZscore(dataWS->readY(2)); + vector<double> z0 = Kernel::getZscore(m_dataWS->readY(0)); + vector<double> z1 = Kernel::getZscore(m_dataWS->readY(1)); + vector<double> z2 = Kernel::getZscore(m_dataWS->readY(2)); stringstream zss; zss << setw(20) << "d_h" << setw(20) << "Z DataY" << setw(20) << "Z ModelY" << setw(20) << "Z DiffY" << setw(20) << "DiffY" << endl; for (size_t i = 0; i < z0.size(); ++i) { - double d_h = dataWS->readX(0)[i]; + double d_h = m_dataWS->readX(0)[i]; double zdatay = z0[i]; double zmodely = z1[i]; double zdiffy = z2[i]; - double diffy = dataWS->readY(2)[i]; + double diffy = m_dataWS->readY(2)[i]; zss << setw(20) << d_h << setw(20) << zdatay << setw(20) << zmodely << setw(20) << zdiffy << setw(20) << diffy << endl; } @@ -389,7 +394,7 @@ bool RefinePowderInstrumentParameters::fitFunction(IFunction_sptr func, fitalg->setProperty("Function", boost::dynamic_pointer_cast<API::IFunction>(func)); - fitalg->setProperty("InputWorkspace", dataWS); + fitalg->setProperty("InputWorkspace", m_dataWS); fitalg->setProperty("WorkspaceIndex", 0); fitalg->setProperty("Minimizer", "Simplex"); fitalg->setProperty("CostFunction", "Least squares"); @@ -459,19 +464,20 @@ double RefinePowderInstrumentParameters::calculateFunctionStatistic( void RefinePowderInstrumentParameters::refineInstrumentParametersMC( TableWorkspace_sptr parameterWS, bool fit2) { // 1. Get function's parameter names - getD2TOFFuncParamNames(mPeakFunctionParameterNames); + getD2TOFFuncParamNames(m_PeakFunctionParameterNames); // 2. Parse parameter (table) workspace vector<double> stepsizes, lowerbounds, upperbounds; - importMonteCarloParametersFromTable(parameterWS, mPeakFunctionParameterNames, + importMonteCarloParametersFromTable(parameterWS, m_PeakFunctionParameterNames, stepsizes, lowerbounds, upperbounds); stringstream dbss; - for (size_t i = 0; i < mPeakFunctionParameterNames.size(); ++i) { - dbss << setw(20) << mPeakFunctionParameterNames[i] << ": Min = " << setw(15) - << setprecision(6) << lowerbounds[i] << ", Max = " << setw(15) - << setprecision(6) << upperbounds[i] << ", Step Size = " << setw(15) - << setprecision(6) << stepsizes[i] << endl; + for (size_t i = 0; i < m_PeakFunctionParameterNames.size(); ++i) { + dbss << setw(20) << m_PeakFunctionParameterNames[i] + << ": Min = " << setw(15) << setprecision(6) << lowerbounds[i] + << ", Max = " << setw(15) << setprecision(6) << upperbounds[i] + << ", Step Size = " << setw(15) << setprecision(6) << stepsizes[i] + << endl; } g_log.notice() << "Monte Carlo Parameters: " << endl << dbss.str(); @@ -491,33 +497,33 @@ void RefinePowderInstrumentParameters::refineInstrumentParametersMC( double stepsizescalefactor = 1.1; // 5. Monte Carlo simulation - doParameterSpaceRandomWalk(mPeakFunctionParameterNames, lowerbounds, + doParameterSpaceRandomWalk(m_PeakFunctionParameterNames, lowerbounds, upperbounds, stepsizes, maxsteps, stepsizescalefactor, fit2); // 6. Record the result - const MantidVec &X = dataWS->readX(0); - const MantidVec &Y = dataWS->readY(0); - const MantidVec &E = dataWS->readE(0); + const MantidVec &X = m_dataWS->readX(0); + const MantidVec &Y = m_dataWS->readY(0); + const MantidVec &E = m_dataWS->readE(0); FunctionDomain1DVector domain(X); FunctionValues values(domain); - for (size_t i = 0; i < mBestFitParameters.size(); ++i) { + for (size_t i = 0; i < m_BestFitParameters.size(); ++i) { // a. Set the function with the - for (size_t j = 0; j < mPeakFunctionParameterNames.size(); ++j) { - mFunction->setParameter(mPeakFunctionParameterNames[j], - mBestFitParameters[i].second[j]); + for (size_t j = 0; j < m_PeakFunctionParameterNames.size(); ++j) { + m_Function->setParameter(m_PeakFunctionParameterNames[j], + m_BestFitParameters[i].second[j]); } // b. Calculate - calculateD2TOFFunction(mFunction, domain, values, Y, E); + calculateD2TOFFunction(m_Function, domain, values, Y, E); vector<double> vec_n; - calculateThermalNeutronSpecial(mFunction, X, vec_n); + calculateThermalNeutronSpecial(m_Function, X, vec_n); // c. Put the data to output workspace - MantidVec &newY = dataWS->dataY(3 * i + 1); - MantidVec &newD = dataWS->dataY(3 * i + 2); - MantidVec &newN = dataWS->dataY(3 * i + 3); + MantidVec &newY = m_dataWS->dataY(3 * i + 1); + MantidVec &newD = m_dataWS->dataY(3 * i + 2); + MantidVec &newN = m_dataWS->dataY(3 * i + 3); for (size_t j = 0; j < newY.size(); ++j) { newY[j] = values[j]; newD[j] = Y[j] - values[j]; @@ -545,30 +551,30 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( << setw(20) << "Upper Boundary" << setw(20) << "Step Size" << endl; for (size_t i = 0; i < parnames.size(); ++i) inpinfo << setw(20) << parnames[i] << setw(20) << - mFuncParameters[parnames[i]] + m_FuncParameters[parnames[i]] << setw(20) << lowerbounds[i] << setw(20) << upperbounds[i] << setw(20) << stepsizes[i] << endl; cout << inpinfo.str(); ------------*/ - // 1. Set up starting values, esp. to mFunction + // 1. Set up starting values, esp. to m_Function size_t numparameters = parnames.size(); vector<double> paramvalues; for (size_t i = 0; i < numparameters; ++i) { string parname = parnames[i]; - double parvalue = mFuncParameters[parname]; + double parvalue = m_FuncParameters[parname]; paramvalues.push_back(parvalue); - mFunction->setParameter(parname, parvalue); + m_Function->setParameter(parname, parvalue); } // Calcualte the function's initial statistic - mBestGSLChi2 = calculateFunctionStatistic(mFunction, dataWS, 0); - cout << "Function with starting values has Chi2 = " << mBestGSLChi2 + m_BestGSLChi2 = calculateFunctionStatistic(m_Function, m_dataWS, 0); + cout << "Function with starting values has Chi2 = " << m_BestGSLChi2 << " (GSL L.M) " << endl; - const MantidVec &X = dataWS->readX(0); - const MantidVec &rawY = dataWS->readY(0); - const MantidVec &rawE = dataWS->readE(0); + const MantidVec &X = m_dataWS->readX(0); + const MantidVec &rawY = m_dataWS->readY(0); + const MantidVec &rawE = m_dataWS->readE(0); FunctionDomain1DVector domain(X); FunctionValues values(domain); @@ -620,7 +626,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( // 4. Do MC loops double curchi2 = - calculateD2TOFFunction(mFunction, domain, values, rawY, rawE); + calculateD2TOFFunction(m_Function, domain, values, rawY, rawE); g_log.notice() << "Monte Carlo Random Walk Starting Chi^2 = " << curchi2 << endl; @@ -653,7 +659,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( } try { - mFunction->setParameter(parnames[paramindex], newvalue); + m_Function->setParameter(parnames[paramindex], newvalue); } catch (runtime_error &) { stringstream errss; errss << "New Value = " << newvalue @@ -666,13 +672,13 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( // b. Calcualte the new double newchi2 = - calculateD2TOFFunction(mFunction, domain, values, rawY, rawE); + calculateD2TOFFunction(m_Function, domain, values, rawY, rawE); // Optionally fit if (fit2) { // i. Copy the parameters for (size_t i = 0; i < numparameters; ++i) { - double parvalue = mFunction->getParameter(i); + double parvalue = m_Function->getParameter(i); func4fit->setParameter(i, parvalue); } @@ -685,8 +691,8 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( double homchi2 = calculateD2TOFFunction(func4fit, domain, values, rawY, rawE); - if (gslchi2 < mBestGSLChi2) - mBestGSLChi2 = gslchi2; + if (gslchi2 < m_BestGSLChi2) + m_BestGSLChi2 = gslchi2; // iv. Archive vector<double> newparvalues; @@ -694,15 +700,15 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( double parvalue = func4fit->getParameter(i); newparvalues.push_back(parvalue); } - mBestFitParameters.push_back(make_pair(homchi2, newparvalues)); - mBestFitChi2s.push_back(make_pair(homchi2, gslchi2)); + m_BestFitParameters.push_back(make_pair(homchi2, newparvalues)); + m_BestFitChi2s.push_back(make_pair(homchi2, gslchi2)); // v. Sort and keep in size - sort(mBestFitParameters.begin(), mBestFitParameters.end()); - sort(mBestFitChi2s.begin(), mBestFitChi2s.end()); - if (mBestFitParameters.size() > mMaxNumberStoredParameters) { - mBestFitParameters.pop_back(); - mBestFitChi2s.pop_back(); + sort(m_BestFitParameters.begin(), m_BestFitParameters.end()); + sort(m_BestFitChi2s.begin(), m_BestFitChi2s.end()); + if (m_BestFitParameters.size() > m_MaxNumberStoredParameters) { + m_BestFitParameters.pop_back(); + m_BestFitChi2s.pop_back(); } // cout << "\tHomemade Chi^2 = " << homchi2 << endl; @@ -749,12 +755,12 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( // ii. Add the new values to vector vector<double> parametervalues = paramvalues; - mBestMCParameters.push_back(make_pair(newchi2, parametervalues)); + m_BestMCParameters.push_back(make_pair(newchi2, parametervalues)); // iii. Sort and delete the last if necessary - sort(mBestMCParameters.begin(), mBestMCParameters.end()); - if (mBestMCParameters.size() > mMaxNumberStoredParameters) - mBestMCParameters.pop_back(); + sort(m_BestMCParameters.begin(), m_BestMCParameters.end()); + if (m_BestMCParameters.size() > m_MaxNumberStoredParameters) + m_BestMCParameters.pop_back(); // iv. Update chi2 and ... curchi2 = newchi2; @@ -770,24 +776,24 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( // 3. Debug output stringstream mcresult; - mcresult << "Monte Carlo Result for " << mBestMCParameters.size() + mcresult << "Monte Carlo Result for " << m_BestMCParameters.size() << " Best Results" << endl; mcresult << "Number of acceptance = " << numacceptance << ", out of " << maxsteps << " MC steps." << "Accept ratio = " << static_cast<double>(numacceptance) / static_cast<double>(maxsteps) << endl; - mcresult << "Best " << mBestMCParameters.size() + mcresult << "Best " << m_BestMCParameters.size() << " Monte Carlo (no fit) results: " << endl; - for (size_t i = 0; i < mBestMCParameters.size(); ++i) { - mcresult << setw(3) << i << ": Chi^2 = " << mBestMCParameters[i].first + for (size_t i = 0; i < m_BestMCParameters.size(); ++i) { + mcresult << setw(3) << i << ": Chi^2 = " << m_BestMCParameters[i].first << endl; } - mcresult << "Best " << mBestMCParameters.size() - << " fitting results. Best Chi^2 = " << mBestGSLChi2 << endl; - for (size_t i = 0; i < mBestFitParameters.size(); ++i) { - mcresult << setw(3) << i << ": Chi^2 = " << mBestFitParameters[i].first - << ", GSL Chi^2 = " << mBestFitChi2s[i].second << endl; + mcresult << "Best " << m_BestMCParameters.size() + << " fitting results. Best Chi^2 = " << m_BestGSLChi2 << endl; + for (size_t i = 0; i < m_BestFitParameters.size(); ++i) { + mcresult << setw(3) << i << ": Chi^2 = " << m_BestFitParameters[i].first + << ", GSL Chi^2 = " << m_BestFitChi2s[i].second << endl; } g_log.notice() << mcresult.str(); @@ -802,11 +808,11 @@ void RefinePowderInstrumentParameters::getD2TOFFuncParamNames( parnames.clear(); // 2. Get the parameter names from function - CurveFitting::ThermalNeutronDtoTOFFunction d2toffunc; + ThermalNeutronDtoTOFFunction d2toffunc; d2toffunc.initialize(); std::vector<std::string> funparamnames = d2toffunc.getParameterNames(); - mFunction = boost::make_shared<ThermalNeutronDtoTOFFunction>(d2toffunc); + m_Function = boost::make_shared<ThermalNeutronDtoTOFFunction>(d2toffunc); // 3. Copy parnames = funparamnames; @@ -821,14 +827,14 @@ double RefinePowderInstrumentParameters::calculateD2TOFFunction( const MantidVec &rawY, const MantidVec &rawE) { // 1. Check validity if (!func) { - throw std::runtime_error("mFunction has not been initialized!"); + throw std::runtime_error("m_Function has not been initialized!"); } else { /* - vector<string> parnames = mFunction->getParameterNames(); + vector<string> parnames = m_Function->getParameterNames(); for (size_t i = 0; i < parnames.size(); ++i) { cout << "DBx1125 " << parnames[i] << " = " << - mFunction->getParameter(parnames[i]) << endl; + m_Function->getParameter(parnames[i]) << endl; } */ ; @@ -858,7 +864,7 @@ double RefinePowderInstrumentParameters::calculateD2TOFFunction( //------------------------------- Processing Inputs //---------------------------------------- /** Genearte peaks from input workspace - * Peaks are stored in a map. (HKL) is the key + * m_Peaks are stored in a map. (HKL) is the key */ void RefinePowderInstrumentParameters::genPeaksFromTable( DataObjects::TableWorkspace_sptr peakparamws) { @@ -870,7 +876,7 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( "Invalid input table workspace for peak parameters"); } - mPeaks.clear(); + m_Peaks.clear(); // 2. Parse table workspace rows to generate peaks vector<string> colnames = peakparamws->getColumnNames(); @@ -878,7 +884,7 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( for (size_t ir = 0; ir < numrows; ++ir) { // a) Generate peak - CurveFitting::BackToBackExponential newpeak; + BackToBackExponential newpeak; newpeak.initialize(); // b) Parse parameters @@ -929,20 +935,20 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( newpeak.setParameter("I", height); // d) Make to share pointer and set to instance data structure (map) - CurveFitting::BackToBackExponential_sptr newpeakptr = - boost::make_shared<CurveFitting::BackToBackExponential>(newpeak); + BackToBackExponential_sptr newpeakptr = + boost::make_shared<BackToBackExponential>(newpeak); std::vector<int> hkl; hkl.push_back(h); hkl.push_back(k); hkl.push_back(l); - mPeaks.insert(std::make_pair(hkl, newpeakptr)); + m_Peaks.insert(std::make_pair(hkl, newpeakptr)); - mPeakErrors.insert(make_pair(hkl, chi2)); + m_PeakErrors.insert(make_pair(hkl, chi2)); - g_log.information() << "[GeneratePeaks] Peak " << ir << " HKL = [" << hkl[0] - << ", " << hkl[1] << ", " << hkl[2] + g_log.information() << "[Generatem_Peaks] Peak " << ir << " HKL = [" + << hkl[0] << ", " << hkl[1] << ", " << hkl[2] << "], Input Center = " << setw(10) << setprecision(6) << newpeak.centre() << endl; @@ -1115,17 +1121,17 @@ hkl, double lattice) /** Calcualte value n for thermal neutron peak profile */ void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial( - IFunction_sptr mFunction, vector<double> vec_d, vector<double> &vec_n) { - if (mFunction->name().compare("ThermalNeutronDtoTOFFunction") != 0) { - g_log.warning() << "Function (" << mFunction->name() + IFunction_sptr m_Function, vector<double> vec_d, vector<double> &vec_n) { + if (m_Function->name().compare("ThermalNeutronDtoTOFFunction") != 0) { + g_log.warning() << "Function (" << m_Function->name() << " is not ThermalNeutronDtoTOFFunction. And it is not " "required to calculate n." << endl; for (size_t i = 0; i < vec_d.size(); ++i) vec_n.push_back(0); } - double width = mFunction->getParameter("Width"); - double tcross = mFunction->getParameter("Tcross"); + double width = m_Function->getParameter("Width"); + double tcross = m_Function->getParameter("Tcross"); for (size_t i = 0; i < vec_d.size(); ++i) { double dh = vec_d[i]; @@ -1146,7 +1152,7 @@ void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial( void RefinePowderInstrumentParameters::genPeakCentersWorkspace( bool montecarlo, size_t numbestfit) { // 1. Collect values in a vector for sorting - double lattice = mFuncParameters["LatticeConstant"]; + double lattice = m_FuncParameters["LatticeConstant"]; if (lattice < 1.0E-5) { std::stringstream errmsg; errmsg << "Input Lattice constant = " << lattice @@ -1167,19 +1173,18 @@ void RefinePowderInstrumentParameters::genPeakCentersWorkspace( throw runtime_error(errss.str()); } - std::map<std::vector<int>, CurveFitting::BackToBackExponential_sptr>::iterator - peakiter; + std::map<std::vector<int>, BackToBackExponential_sptr>::iterator peakiter; std::vector<std::pair<double, std::pair<double, double>>> peakcenters; // d_h [TOF_h, CHI2] Geometry::UnitCell unitcell(lattice, lattice, lattice, 90.0, 90.0, 90.0); - for (peakiter = mPeaks.begin(); peakiter != mPeaks.end(); ++peakiter) { + for (peakiter = m_Peaks.begin(); peakiter != m_Peaks.end(); ++peakiter) { vector<int> hkl = peakiter->first; BackToBackExponential_sptr peak = peakiter->second; double sigma = peak->getParameter("S"); - if (sigma < mMinSigma) { + if (sigma < m_MinSigma) { g_log.information() << "Peak (" << hkl[0] << ", " << hkl[1] << ", " << hkl[2] << ") has unphysically small Sigma = " << sigma @@ -1220,18 +1225,18 @@ void RefinePowderInstrumentParameters::genPeakCentersWorkspace( nspec = 1 + 3; } - dataWS = boost::dynamic_pointer_cast<DataObjects::Workspace2D>( + m_dataWS = boost::dynamic_pointer_cast<DataObjects::Workspace2D>( API::WorkspaceFactory::Instance().create("Workspace2D", nspec, size, size)); - dataWS->getAxis(0)->setUnit("dSpacing"); + m_dataWS->getAxis(0)->setUnit("dSpacing"); // 4. Put data to output workspace for (size_t i = 0; i < peakcenters.size(); ++i) { for (size_t j = 0; j < nspec; ++j) { - dataWS->dataX(j)[i] = peakcenters[i].first; + m_dataWS->dataX(j)[i] = peakcenters[i].first; } - dataWS->dataY(0)[i] = peakcenters[i].second.first; - dataWS->dataE(0)[i] = peakcenters[i].second.second; + m_dataWS->dataY(0)[i] = peakcenters[i].second.first; + m_dataWS->dataE(0)[i] = peakcenters[i].second.second; } return; @@ -1248,18 +1253,18 @@ RefinePowderInstrumentParameters::genMCResultTable() { tablews->addColumn("double", "Chi2"); tablews->addColumn("double", "GSLChi2"); - for (size_t i = 0; i < mPeakFunctionParameterNames.size(); ++i) { - tablews->addColumn("double", mPeakFunctionParameterNames[i]); + for (size_t i = 0; i < m_PeakFunctionParameterNames.size(); ++i) { + tablews->addColumn("double", m_PeakFunctionParameterNames[i]); } // 2. Put values in - for (size_t ib = 0; ib < mBestFitParameters.size(); ++ib) { + for (size_t ib = 0; ib < m_BestFitParameters.size(); ++ib) { TableRow newrow = tablews->appendRow(); - double chi2 = mBestFitParameters[ib].first; - double gslchi2 = mBestFitChi2s[ib].second; + double chi2 = m_BestFitParameters[ib].first; + double gslchi2 = m_BestFitChi2s[ib].second; newrow << chi2 << gslchi2; - for (size_t ip = 0; ip < mPeakFunctionParameterNames.size(); ++ip) { - double tempdbl = mBestFitParameters[ib].second[ip]; + for (size_t ip = 0; ip < m_PeakFunctionParameterNames.size(); ++ip) { + double tempdbl = m_BestFitParameters[ib].second[ip]; newrow << tempdbl; } } // ENDFOR 1 Best Answer @@ -1288,7 +1293,7 @@ RefinePowderInstrumentParameters::genOutputInstrumentParameterTable() { std::map<std::string, double>::iterator pariter; - for (pariter = mFuncParameters.begin(); pariter != mFuncParameters.end(); + for (pariter = m_FuncParameters.begin(); pariter != m_FuncParameters.end(); ++pariter) { API::TableRow newrow = newtablews->appendRow(); std::string parname = pariter->first; @@ -1299,5 +1304,6 @@ RefinePowderInstrumentParameters::genOutputInstrumentParameterTable() { return newtablews; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp similarity index 99% rename from Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp rename to Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index b2f339bc14ef4a88622e1565a4df50765cee08ee..a5c35c1f331d71bca31643d8fc85b77d7bf7b2fd 100644 --- a/Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/RefinePowderInstrumentParameters3.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h" #include "MantidAPI/Axis.h" #include "MantidAPI/TextAxis.h" @@ -7,12 +7,14 @@ using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; using namespace Mantid::Kernel; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(RefinePowderInstrumentParameters3) @@ -1266,8 +1268,9 @@ void RefinePowderInstrumentParameters3::setFunctionParameterFitSetups( double upperbound = param.maxvalue; if (lowerbound >= -DBL_MAX * 0.1 || upperbound <= DBL_MAX * 0.1) { // If there is a boundary - BoundaryConstraint *bc = new BoundaryConstraint( - function.get(), parname, lowerbound, upperbound, false); + Constraints::BoundaryConstraint *bc = + new Constraints::BoundaryConstraint( + function.get(), parname, lowerbound, upperbound, false); function->addConstraint(bc); } } else { @@ -1428,5 +1431,6 @@ void restoreFunctionParameterValue( return; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SplineBackground.cpp b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp similarity index 96% rename from Framework/CurveFitting/src/SplineBackground.cpp rename to Framework/CurveFitting/src/Algorithms/SplineBackground.cpp index d3eddbab62067a8297f96e73f2911bfccfe6eab8..a19fa51061060d39206dd760f8a1d8db453d9fb0 100644 --- a/Framework/CurveFitting/src/SplineBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/SplineBackground.h" +#include "MantidCurveFitting/Algorithms/SplineBackground.h" #include <gsl/gsl_bspline.h> #include <gsl/gsl_multifit.h> #include <gsl/gsl_statistics.h> @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(SplineBackground) @@ -65,8 +66,7 @@ void SplineBackground::exec() { bool isMasked = inWS->hasMaskedBins(spec); std::vector<int> masked(Y.size()); if (isMasked) { - for (API::MatrixWorkspace::MaskList::const_iterator it = - inWS->maskedBins(spec).begin(); + for (auto it = inWS->maskedBins(spec).begin(); it != inWS->maskedBins(spec).end(); ++it) masked[it->first] = 1; n -= static_cast<int>(inWS->maskedBins(spec).size()); @@ -170,5 +170,6 @@ void SplineBackground::exec() { setProperty("OutputWorkspace", outWS); } -} // namespace Algorithm +} // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SplineInterpolation.cpp b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp similarity index 98% rename from Framework/CurveFitting/src/SplineInterpolation.cpp rename to Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp index 63731d8bd084bc41f9eda55f90669c0b41b494d1..9d1a1bc531c9d0dc3c765ddf3a904e1bf1955a7c 100644 --- a/Framework/CurveFitting/src/SplineInterpolation.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp @@ -2,16 +2,18 @@ #include "MantidAPI/NumericAxis.h" #include "MantidAPI/Progress.h" #include "MantidKernel/BoundedValidator.h" -#include "MantidCurveFitting/SplineInterpolation.h" +#include "MantidCurveFitting/Algorithms/SplineInterpolation.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(SplineInterpolation) using namespace API; using namespace Kernel; +using Functions::CubicSpline; //---------------------------------------------------------------------------------------------- /** Constructor @@ -253,5 +255,6 @@ void SplineInterpolation::calculateSpline( m_cspline->function1D(yValues, xValues, nData); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SplineSmoothing.cpp b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp similarity index 99% rename from Framework/CurveFitting/src/SplineSmoothing.cpp rename to Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp index 9cac9523f02913279baf3857de8585df1cf1611f..87fcfb16e36bfd4af6e18a84ed51b9c459f27e3c 100644 --- a/Framework/CurveFitting/src/SplineSmoothing.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp @@ -4,19 +4,20 @@ #include "MantidAPI/TextAxis.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidKernel/BoundedValidator.h" -#include "MantidCurveFitting/SplineSmoothing.h" +#include "MantidCurveFitting/Algorithms/SplineSmoothing.h" #include <algorithm> namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(SplineSmoothing) using namespace API; using namespace Kernel; - +using Functions::BSpline; //---------------------------------------------------------------------------------------------- /** Constructor */ @@ -370,5 +371,6 @@ void SplineSmoothing::selectSmoothingPoints( } } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BoundaryConstraint.cpp b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp similarity index 98% rename from Framework/CurveFitting/src/BoundaryConstraint.cpp rename to Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp index 6ecbe020e781f48f2adbc63862c2ddb45fd067e5..86f3f52be2a7fe4549198c0a4926b5a0c3d1074a 100644 --- a/Framework/CurveFitting/src/BoundaryConstraint.cpp +++ b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidAPI/Expression.h" #include "MantidAPI/ConstraintFactory.h" #include "MantidKernel/Logger.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Constraints { namespace { /// static logger Kernel::Logger g_log("BoundaryConstraint"); @@ -247,5 +248,6 @@ std::string BoundaryConstraint::asString() const { return ostr.str(); } +} // namespace Constraints } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncFitting.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp similarity index 98% rename from Framework/CurveFitting/src/CostFuncFitting.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp index 425bdcce324e7fcf858aa95d24c5aa0bd21f2b8f..021e2ed4db9b86a3b5f85a87cd5350288186c49d 100644 --- a/Framework/CurveFitting/src/CostFuncFitting.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include "MantidCurveFitting/GSLJacobian.h" #include "MantidAPI/IConstraint.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** * Constructor. @@ -202,5 +203,6 @@ void CostFuncFitting::calTransformationMatrixNumerically(GSLMatrix &tm) { } } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp similarity index 95% rename from Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp index 6e6b404b1b2fd4fb680e0cf6c92e0babd2f2617f..8f5d5ecbb2e835d9b04494c915715a60ba097158 100644 --- a/Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp @@ -1,13 +1,14 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncIgnorePosPeaks.h" +#include "MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h" #include "MantidKernel/PhysicalConstants.h" #include <cmath> #include <gsl/gsl_sf_erf.h> namespace Mantid { namespace CurveFitting { +namespace CostFunctions { DECLARE_COSTFUNCTION(CostFuncIgnorePosPeaks, Ignore positive peaks) @@ -73,5 +74,6 @@ void CostFuncIgnorePosPeaks::deriv(const double *yData, } } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncLeastSquares.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp similarity index 98% rename from Framework/CurveFitting/src/CostFuncLeastSquares.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp index f0ada5744ed566b685c54fcba4fd7d3decfcb637..025968c21b954c5bac4f0754a974669bcc9f462e 100644 --- a/Framework/CurveFitting/src/CostFuncLeastSquares.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidCurveFitting/SeqDomain.h" #include "MantidAPI/IConstraint.h" @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { namespace { /// static logger Kernel::Logger g_log("CostFuncLeastSquares"); @@ -436,5 +437,6 @@ void CostFuncLeastSquares::calActiveCovarianceMatrix(GSLMatrix &covar, } } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncRwp.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp similarity index 94% rename from Framework/CurveFitting/src/CostFuncRwp.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp index 0bd327fd7ea90312d76e38fc29e53f60dc16b137..17e783d9f7e438c9366c6d3fc3ffe700703e3872 100644 --- a/Framework/CurveFitting/src/CostFuncRwp.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncRwp.h" +#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidCurveFitting/SeqDomain.h" #include "MantidAPI/IConstraint.h" @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { DECLARE_COSTFUNCTION(CostFuncRwp, Rwp) @@ -63,5 +64,6 @@ double CostFuncRwp::calSqrtW(API::FunctionValues_sptr values) const { return sqrt(weight); } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp similarity index 95% rename from Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp index 278e5c6b9bd3421817651ed8d8565c14bece862a..c7eadd62b70a84e434abd1ab4eacc719f584a558 100644 --- a/Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp @@ -1,10 +1,11 @@ -#include "MantidCurveFitting/CostFuncUnweightedLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h" #include "MantidKernel/Logger.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace CostFunctions { namespace { /// static logger @@ -79,5 +80,6 @@ double CostFuncUnweightedLeastSquares::getResidualVariance() const { return residualVariance; } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FitMW.cpp b/Framework/CurveFitting/src/FitMW.cpp index d98e9dc7f3719d3111503175281cd3cd0d12242a..730110936f4ad63ae1821bdd9fe2d7c4e1cd6d15 100644 --- a/Framework/CurveFitting/src/FitMW.cpp +++ b/Framework/CurveFitting/src/FitMW.cpp @@ -2,7 +2,7 @@ //---------------------------------------------------------------------- #include "MantidCurveFitting/FitMW.h" #include "MantidCurveFitting/SeqDomain.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidCurveFitting/ParameterEstimator.h" #include "MantidAPI/CompositeFunction.h" @@ -449,7 +449,7 @@ void FitMW::appendCompositeFunctionMembers( // if function is a Convolution then output of convolved model's mebers may be // required if (m_convolutionCompositeMembers && - boost::dynamic_pointer_cast<CurveFitting::Convolution>(function)) { + boost::dynamic_pointer_cast<Functions::Convolution>(function)) { appendConvolvedCompositeFunctionMembers(functionList, function); } else { const auto compositeFn = @@ -486,8 +486,8 @@ void FitMW::appendCompositeFunctionMembers( void FitMW::appendConvolvedCompositeFunctionMembers( std::list<API::IFunction_sptr> &functionList, const API::IFunction_sptr &function) const { - boost::shared_ptr<CurveFitting::Convolution> convolution = - boost::dynamic_pointer_cast<CurveFitting::Convolution>(function); + boost::shared_ptr<Functions::Convolution> convolution = + boost::dynamic_pointer_cast<Functions::Convolution>(function); const auto compositeFn = boost::dynamic_pointer_cast<API::CompositeFunction>( convolution->getFunction(1)); @@ -498,8 +498,8 @@ void FitMW::appendConvolvedCompositeFunctionMembers( const size_t nlocals = compositeFn->nFunctions(); for (size_t i = 0; i < nlocals; ++i) { auto localFunction = compositeFn->getFunction(i); - boost::shared_ptr<CurveFitting::Convolution> localConvolution = - boost::make_shared<CurveFitting::Convolution>(); + boost::shared_ptr<Functions::Convolution> localConvolution = + boost::make_shared<Functions::Convolution>(); localConvolution->addFunction(resolution); localConvolution->addFunction(localFunction); functionList.insert(functionList.end(), localConvolution); diff --git a/Framework/CurveFitting/src/BFGS_Minimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp similarity index 85% rename from Framework/CurveFitting/src/BFGS_Minimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp index 8feb486fce889ac7784d01cbfe6a74a1032e0499..40b817c1028cc4f3d818e529859f37a7352fd00d 100644 --- a/Framework/CurveFitting/src/BFGS_Minimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { /// static logger object Kernel::Logger g_log("BFGS_Minimizer"); @@ -23,5 +24,6 @@ const gsl_multimin_fdfminimizer_type *BFGS_Minimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_vector_bfgs2; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DampingMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp similarity index 91% rename from Framework/CurveFitting/src/DampingMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp index 01e3169ebba8d9a0d3587a6d30143796d1de82f0..08114e04a546b699b4f359ba826924cf850a1917 100644 --- a/Framework/CurveFitting/src/DampingMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DampingMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -17,6 +17,8 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { + namespace { /// static logger Kernel::Logger g_log("DampingMinimizer"); @@ -32,7 +34,9 @@ DampingMinimizer::DampingMinimizer(double relTol) /// Initialize minimizer, i.e. pass a function to minimize. void DampingMinimizer::initialize(API::ICostFunction_sptr function, size_t) { - m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function); + m_leastSquares = + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + function); if (!m_leastSquares) { throw std::invalid_argument("Damping minimizer works only with least " "squares. Different function was given."); @@ -121,5 +125,6 @@ double DampingMinimizer::costFunctionVal() { return m_leastSquares->val(); } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DerivMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp similarity index 88% rename from Framework/CurveFitting/src/DerivMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp index 57cbc5a122fcbce37b30629977b8cc9c6dcc0dc0..5f54e75d6d7bea7407b1156cb3d8d035f05e59e1 100644 --- a/Framework/CurveFitting/src/DerivMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp @@ -1,11 +1,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DerivMinimizer.h" -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Used by the GSL to calculate the cost function. * @param x :: Vector with parameters @@ -17,8 +18,9 @@ double DerivMinimizer::fun(const gsl_vector *x, void *params) { for (size_t i = 0; i < n; ++i) { minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); } - boost::shared_ptr<CostFuncFitting> fitting = - boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction); + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); if (fitting) { fitting->getFittingFunction()->applyTies(); } @@ -36,8 +38,9 @@ void DerivMinimizer::dfun(const gsl_vector *x, void *params, gsl_vector *g) { for (size_t i = 0; i < n; ++i) { minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); } - boost::shared_ptr<CostFuncFitting> fitting = - boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction); + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); if (fitting) { fitting->getFittingFunction()->applyTies(); } @@ -61,8 +64,9 @@ void DerivMinimizer::fundfun(const gsl_vector *x, void *params, double *f, for (size_t i = 0; i < n; ++i) { minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); } - boost::shared_ptr<CostFuncFitting> fitting = - boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction); + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); if (fitting) { fitting->getFittingFunction()->applyTies(); } @@ -173,5 +177,6 @@ void DerivMinimizer::setStopGradient(const double value) { double DerivMinimizer::costFunctionVal() { return m_gslSolver->f; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FABADAMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp similarity index 97% rename from Framework/CurveFitting/src/FABADAMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp index f6c47ccff74677882e6f1b74ca874124be32baa0..fcdedf14c5017e8603999ccc7f97b1b8076febef 100644 --- a/Framework/CurveFitting/src/FABADAMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp @@ -1,6 +1,6 @@ -#include "MantidCurveFitting/FABADAMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting//Constraints/BoundaryConstraint.h" #include <stdio.h> #include <stdlib.h> @@ -30,6 +30,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { // static logger object @@ -91,7 +92,9 @@ FABADAMinimizer::~FABADAMinimizer() {} void FABADAMinimizer::initialize(API::ICostFunction_sptr function, size_t maxIterations) { - m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function); + m_leastSquares = + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + function); if (!m_leastSquares) { throw std::invalid_argument( "FABADA works only with least squares. Different function was given."); @@ -120,7 +123,8 @@ void FABADAMinimizer::initialize(API::ICostFunction_sptr function, m_bound.push_back(false); API::IConstraint *iconstr = fun->getConstraint(i); if (iconstr) { - BoundaryConstraint *bcon = dynamic_cast<BoundaryConstraint *>(iconstr); + Constraints::BoundaryConstraint *bcon = + dynamic_cast<Constraints::BoundaryConstraint *>(iconstr); if (bcon) { m_bound[i] = true; if (bcon->hasLower()) { @@ -640,5 +644,6 @@ void FABADAMinimizer::finalize() { } } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp similarity index 86% rename from Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp index a06a974c52ff6db48b0532bf76cab1c32bb2fd2e..d609f35a7cf2132a0a4c5b2aa81388d8cefb17d5 100644 --- a/Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/FRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { /// static logger Kernel::Logger g_log("FRConjugateGradientMinimizer"); @@ -28,5 +29,6 @@ FRConjugateGradientMinimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_conjugate_fr; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp similarity index 96% rename from Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp index 78c90dca7c807df0c1c6f18caedc0d2817164fa1..74fe28e69cdf447d7ba99f833fca8083f359adb5 100644 --- a/Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -16,6 +16,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { /// static logger object Kernel::Logger g_log("LevenbergMarquardMD"); @@ -39,7 +40,9 @@ LevenbergMarquardtMDMinimizer::LevenbergMarquardtMDMinimizer() /// Initialize minimizer, i.e. pass a function to minimize. void LevenbergMarquardtMDMinimizer::initialize(API::ICostFunction_sptr function, size_t) { - m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function); + m_leastSquares = + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + function); if (!m_leastSquares) { throw std::invalid_argument("Levenberg-Marquardt minimizer works only with " "least squares. Different function was given."); @@ -286,5 +289,6 @@ double LevenbergMarquardtMDMinimizer::costFunctionVal() { return m_leastSquares->val(); } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp similarity index 93% rename from Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp index 19bfbdc7c06d05379ce612f5cc73f35144e46564..df84cfc9f62124e1817e6b462e96fb64a59a7842 100644 --- a/Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LevenbergMarquardtMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -16,6 +16,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { // Get a reference to the logger Kernel::Logger g_log("LevenbergMarquardtMinimizer"); @@ -40,7 +41,8 @@ void LevenbergMarquardtMinimizer::initialize( API::ICostFunction_sptr costFunction, size_t) { // set-up GSL container to be used with GSL simplex algorithm auto leastSquares = - boost::dynamic_pointer_cast<CostFuncLeastSquares>(costFunction); + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + costFunction); if (leastSquares) { m_data = new GSL_FitData(leastSquares); } else { @@ -140,5 +142,6 @@ void LevenbergMarquardtMinimizer::calCovarianceMatrix(double epsrel, gsl_multifit_covar(m_gslSolver->J, epsrel, covar); } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp similarity index 85% rename from Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp index ae9d3adaa6fb0e7841e23f563c88b6027a88685a..e208d427551e7e3ce76b176607ea017300396127 100644 --- a/Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/PRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { // clang-format off ///@cond nodoc @@ -24,5 +25,6 @@ PRConjugateGradientMinimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_conjugate_pr; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e9399ae13f134ee944285d188a5e406dc5698645 --- /dev/null +++ b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp @@ -0,0 +1,124 @@ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" + +#include "MantidAPI/FuncMinimizerFactory.h" + +#include "MantidKernel/Logger.h" + +namespace Mantid { +namespace CurveFitting { +namespace FuncMinimisers { +namespace { +/// static logger +Kernel::Logger g_log("SimplexMinimizer"); +} + +DECLARE_FUNCMINIMIZER(SimplexMinimizer, Simplex) + +/** Calculating cost function +* +* @param x :: Input function arguments +* @param params :: Pointer to a SimplexMinimizer +* @return Value of the cost function +*/ +double SimplexMinimizer::fun(const gsl_vector *x, void *params) { + SimplexMinimizer &minimizer = *static_cast<SimplexMinimizer *>(params); + // update function parameters + if (x->data) { + for (size_t i = 0; i < minimizer.m_costFunction->nParams(); ++i) { + minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); + } + } + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); + if (fitting) { + fitting->getFittingFunction()->applyTies(); + } + return minimizer.m_costFunction->val(); +} + +SimplexMinimizer::SimplexMinimizer(const double epsabs) + : m_epsabs(epsabs), m_costFunction(), m_size(1.0), m_simplexStepSize(NULL), + m_startGuess(NULL), m_gslSolver(NULL) { + gslContainer.f = NULL; + gslContainer.n = -1; + gslContainer.params = NULL; +} + +void SimplexMinimizer::initialize(API::ICostFunction_sptr function, size_t) { + m_costFunction = function; + + const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex; + + size_t np = function->nParams(); + // step size for simplex + m_simplexStepSize = gsl_vector_alloc(np); + gsl_vector_set_all(m_simplexStepSize, m_size); + + // setup simplex container + gslContainer.n = np; + gslContainer.f = &fun; + gslContainer.params = this; + + // fill in parameter values + m_startGuess = gsl_vector_alloc(np); + for (size_t i = 0; i < np; ++i) { + gsl_vector_set(m_startGuess, i, function->getParameter(i)); + } + + // setup minimizer + m_gslSolver = gsl_multimin_fminimizer_alloc(T, np); + gsl_multimin_fminimizer_set(m_gslSolver, &gslContainer, m_startGuess, + m_simplexStepSize); +} + +/** + * Do one iteration. + * @return :: true if iterations to be continued, false if they can stop + */ +bool SimplexMinimizer::iterate(size_t) { + int status = gsl_multimin_fminimizer_iterate(m_gslSolver); + if (status) { + m_errorString = gsl_strerror(status); + return false; + } + double size = gsl_multimin_fminimizer_size(m_gslSolver); + status = gsl_multimin_test_size(size, m_epsabs); + if (status != GSL_CONTINUE) { + m_errorString = gsl_strerror(status); + return false; + } + return true; +} + +/// resets the size +void SimplexMinimizer::resetSize(const double &size) { + m_size = size; + clearMemory(); + initialize(m_costFunction); +} + +SimplexMinimizer::~SimplexMinimizer() { clearMemory(); } + +/// clear memory +void SimplexMinimizer::clearMemory() { + if (m_simplexStepSize) { + gsl_vector_free(m_simplexStepSize); + } + if (m_startGuess) { + gsl_vector_free(m_startGuess); + } + if (m_gslSolver) { + gsl_multimin_fminimizer_free(m_gslSolver); + } +} + +double SimplexMinimizer::costFunctionVal() { return m_gslSolver->fval; } + +} // namespace FuncMinimisers +} // namespace CurveFitting +} // namespace Mantid diff --git a/Framework/CurveFitting/src/SteepestDescentMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp similarity index 85% rename from Framework/CurveFitting/src/SteepestDescentMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp index be4c4380ab191ba7a3db2150ca0a14c39a179e1b..810d63841a68ab2b02ff4f0630cbcc574bfb259d 100644 --- a/Framework/CurveFitting/src/SteepestDescentMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/SteepestDescentMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,8 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { + namespace { // Get a reference to the logger Kernel::Logger g_log("SteepestDescentMinimizer"); @@ -24,5 +26,6 @@ SteepestDescentMinimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_steepest_descent; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Abragam.cpp b/Framework/CurveFitting/src/Functions/Abragam.cpp similarity index 93% rename from Framework/CurveFitting/src/Abragam.cpp rename to Framework/CurveFitting/src/Functions/Abragam.cpp index cd24227e3143a73979c2fca010074c8d4ea831dc..40ff74e9b61da1d1896de518896c4d6c8f5cf25a 100644 --- a/Framework/CurveFitting/src/Abragam.cpp +++ b/Framework/CurveFitting/src/Functions/Abragam.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Abragam.h" +#include "MantidCurveFitting/Functions/Abragam.h" #include "MantidAPI//FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Abragam) @@ -61,5 +65,6 @@ void Abragam::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BSpline.cpp b/Framework/CurveFitting/src/Functions/BSpline.cpp similarity index 98% rename from Framework/CurveFitting/src/BSpline.cpp rename to Framework/CurveFitting/src/Functions/BSpline.cpp index 787672bc570ab733dbe80a12c44a3384c6b0468a..670a7c8614abc0934bf5e909fe48b46bdcc26b4e 100644 --- a/Framework/CurveFitting/src/BSpline.cpp +++ b/Framework/CurveFitting/src/Functions/BSpline.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BSpline.h" +#include "MantidCurveFitting/Functions/BSpline.h" #include "MantidCurveFitting/GSLVector.h" #include "MantidCurveFitting/GSLMatrix.h" #include "MantidAPI/FunctionFactory.h" @@ -10,7 +10,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; + using namespace Kernel; + using namespace API; DECLARE_FUNCTION(BSpline) @@ -250,5 +255,6 @@ void BSpline::getGSLBreakPoints(std::vector<double> &bp) const { } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BackToBackExponential.cpp b/Framework/CurveFitting/src/Functions/BackToBackExponential.cpp similarity index 96% rename from Framework/CurveFitting/src/BackToBackExponential.cpp rename to Framework/CurveFitting/src/Functions/BackToBackExponential.cpp index 0c623c678de5444a75316e156d2abd584412dbf5..64a5d5aae6a6237bd4a293c78107fc7e4e7c5363 100644 --- a/Framework/CurveFitting/src/BackToBackExponential.cpp +++ b/Framework/CurveFitting/src/Functions/BackToBackExponential.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_sf_erf.h> @@ -12,8 +12,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(BackToBackExponential) @@ -144,5 +148,6 @@ double BackToBackExponential::expWidth() const { return M_LN2 * (a + b) / (a * b); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BackgroundFunction.cpp b/Framework/CurveFitting/src/Functions/BackgroundFunction.cpp similarity index 78% rename from Framework/CurveFitting/src/BackgroundFunction.cpp rename to Framework/CurveFitting/src/Functions/BackgroundFunction.cpp index a7d79bd6fe4109e9f58967b399e725ff16f25302..1b243cda6edc5f52619fe15152aab68edb443053 100644 --- a/Framework/CurveFitting/src/BackgroundFunction.cpp +++ b/Framework/CurveFitting/src/Functions/BackgroundFunction.cpp @@ -1,12 +1,16 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; void BackgroundFunction::fit(const std::vector<double> &X, @@ -15,5 +19,6 @@ void BackgroundFunction::fit(const std::vector<double> &X, (void)Y; // Avoid compiler warning } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BivariateNormal.cpp b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp similarity index 98% rename from Framework/CurveFitting/src/BivariateNormal.cpp rename to Framework/CurveFitting/src/Functions/BivariateNormal.cpp index d48ab8555eaea9ff6adf1d9cd15e72e9d496f628..59918f5e1e5e65171378450762c01892f3c9d5f4 100644 --- a/Framework/CurveFitting/src/BivariateNormal.cpp +++ b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp @@ -1,5 +1,5 @@ -#include "MantidCurveFitting/BivariateNormal.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/BivariateNormal.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/PhysicalConstants.h" #include "MantidAPI/ParameterTie.h" @@ -17,6 +17,10 @@ using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; namespace { /// static logger @@ -679,5 +683,6 @@ double BivariateNormal::initCoeff(const MantidVec &D, const MantidVec &X, return penalty; } +} // namespace Functions } // namespace curveFitting } // namespaceMantid diff --git a/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp b/Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp similarity index 98% rename from Framework/CurveFitting/src/Bk2BkExpConvPV.cpp rename to Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp index 7052c100cf82ebd824ef254c3b1495f466d269af..d3f4fcb35aae249b2971879a6f362d0066251462 100644 --- a/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp +++ b/Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp @@ -1,18 +1,22 @@ #include <cmath> -#include "MantidCurveFitting/Bk2BkExpConvPV.h" +#include "MantidCurveFitting/Functions/Bk2BkExpConvPV.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_sf_erf.h> using namespace Mantid::Kernel; + using namespace Mantid::API; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger Kernel::Logger g_log("Bk2BkExpConvPV"); @@ -250,4 +254,5 @@ void Bk2BkExpConvPV::calHandEta(double sigma2, double gamma, double &H, } } // namespace Mantid +} // namespace Functions } // namespace CurveFitting diff --git a/Framework/CurveFitting/src/ChebfunBase.cpp b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp similarity index 99% rename from Framework/CurveFitting/src/ChebfunBase.cpp rename to Framework/CurveFitting/src/Functions/ChebfunBase.cpp index 3a1844b95636baf0adf96fa6b8e88bec092e97a4..4f25c57ba462bd4071272fba1c2ba8f17684dc99 100644 --- a/Framework/CurveFitting/src/ChebfunBase.cpp +++ b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" #include "MantidAPI/IFunction1D.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -19,6 +19,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Set the comparison tolerance. const double ChebfunBase::g_tolerance = 1e-15; @@ -297,6 +300,7 @@ ChebfunBase::evalVector(const std::vector<double> &x, */ void ChebfunBase::derivative(const std::vector<double> &a, std::vector<double> &aout) const { + using namespace std::placeholders; if (a.size() != m_x.size()) { throw std::invalid_argument( @@ -331,6 +335,7 @@ void ChebfunBase::derivative(const std::vector<double> &a, */ ChebfunBase_sptr ChebfunBase::integral(const std::vector<double> &a, std::vector<double> &aout) const { + using namespace std::placeholders; if (a.size() != m_x.size()) { throw std::invalid_argument( @@ -926,5 +931,6 @@ ChebfunBase::smooth(const std::vector<double> &xvalues, return y; } +} // Functions } // CurveFitting } // Mantid diff --git a/Framework/CurveFitting/src/Chebyshev.cpp b/Framework/CurveFitting/src/Functions/Chebyshev.cpp similarity index 95% rename from Framework/CurveFitting/src/Chebyshev.cpp rename to Framework/CurveFitting/src/Functions/Chebyshev.cpp index 7da4e1d0b8837453722a2f6952a7becc1c442e98..9395ced590de45f8a22db3d0d092e5b816334a0f 100644 --- a/Framework/CurveFitting/src/Chebyshev.cpp +++ b/Framework/CurveFitting/src/Functions/Chebyshev.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Chebyshev.h" +#include "MantidCurveFitting/Functions/Chebyshev.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> @@ -9,8 +9,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Chebyshev) @@ -99,5 +103,6 @@ void Chebyshev::setAttribute(const std::string &attName, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ComptonPeakProfile.cpp b/Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp similarity index 96% rename from Framework/CurveFitting/src/ComptonPeakProfile.cpp rename to Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp index 89aaaab815f4d755a8cf390ded7d15b7c16083cd..c10c9bf5a8906fc1f6c2e66630ab2079cee8bb44 100644 --- a/Framework/CurveFitting/src/ComptonPeakProfile.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp @@ -1,14 +1,17 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/ComptonPeakProfile.h" -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/ComptonPeakProfile.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting::Algorithms; DECLARE_FUNCTION(ComptonPeakProfile) @@ -82,6 +85,7 @@ void ComptonPeakProfile::function1D(double *out, const double *xValues, */ void ComptonPeakProfile::setUpForFit() { // Voigt & Gaussian + using namespace Mantid::API; m_gauss = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction("Gaussian")); @@ -165,5 +169,6 @@ void ComptonPeakProfile::setAttribute(const std::string &name, m_voigtCutOff = value.asDouble(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ComptonProfile.cpp b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp similarity index 94% rename from Framework/CurveFitting/src/ComptonProfile.cpp rename to Framework/CurveFitting/src/Functions/ComptonProfile.cpp index b7d2ede6cb7e7a10737f3f58823e84be996deceb..f93325fcd70707d6667bbe5d1e0bfab7c89e5a2c 100644 --- a/Framework/CurveFitting/src/ComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp @@ -1,13 +1,17 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/ComptonProfile.h" -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_poly.h> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace CurveFitting::Algorithms; namespace { ///@cond @@ -24,6 +28,7 @@ ComptonProfile::ComptonProfile() : API::ParamFunction(), API::IFunction1D(), m_log("ComptonProfile"), m_wsIndex(0), m_mass(0.0), m_voigt(), m_resolutionFunction(), m_yspace(), m_modQ(), m_e0() { + using namespace Mantid::API; m_resolutionFunction = boost::dynamic_pointer_cast<VesuvioResolution>( FunctionFactory::Instance().createFunction("VesuvioResolution")); @@ -53,6 +58,7 @@ void ComptonProfile::function1D(double *out, const double *xValues, * Creates the internal caches */ void ComptonProfile::setUpForFit() { + using namespace Mantid::API; m_voigt = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction("Voigt")); @@ -92,7 +98,7 @@ void ComptonProfile::setMatrixWorkspace( m_resolutionFunction->setAttributeValue("Mass", m_mass); m_resolutionFunction->setMatrixWorkspace(workspace, wsIndex, startX, endX); - DetectorParams detpar = + Algorithms::DetectorParams detpar = ConvertToYSpace::getDetectorParameters(workspace, m_wsIndex); this->cacheYSpaceValues(workspace->readX(m_wsIndex), workspace->isHistogramData(), detpar); @@ -100,7 +106,7 @@ void ComptonProfile::setMatrixWorkspace( void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds, const bool isHistogram, - const DetectorParams &detpar, + const Algorithms::DetectorParams &detpar, const ResolutionParams &respar) { m_resolutionFunction->cacheResolutionComponents(detpar, respar); this->cacheYSpaceValues(tseconds, isHistogram, detpar); @@ -111,9 +117,9 @@ void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds, * @param isHistogram True if histogram tof values have been passed in * @param detpar Structure containing detector parameters */ -void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds, - const bool isHistogram, - const DetectorParams &detpar) { +void ComptonProfile::cacheYSpaceValues( + const std::vector<double> &tseconds, const bool isHistogram, + const Algorithms::DetectorParams &detpar) { // ------ Fixed coefficients related to resolution & Y-space transforms // ------------------ const double mevToK = PhysicalConstants::E_mev_toNeutronWavenumberSq; @@ -235,5 +241,6 @@ void ComptonProfile::voigtApproxDiff(std::vector<double> &voigtDiff, 2.0 * std::pow(epsilon, 3))); // divided by (2eps^3) } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp similarity index 99% rename from Framework/CurveFitting/src/ComptonScatteringCountRate.cpp rename to Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp index 67051c8d3166b3db68469c9919495d4f958e1e87..fa9ed893cb00c3a6785ce0b2285aafa9fe457461 100644 --- a/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ComptonScatteringCountRate.h" +#include "MantidCurveFitting/Functions/ComptonScatteringCountRate.h" #include "MantidCurveFitting/AugmentedLagrangianOptimizer.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" @@ -10,6 +10,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using Kernel::Logger; namespace { @@ -445,5 +448,6 @@ void ComptonScatteringCountRate::createEqualityCM(const size_t nmasses) { } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Convolution.cpp b/Framework/CurveFitting/src/Functions/Convolution.cpp similarity index 98% rename from Framework/CurveFitting/src/Convolution.cpp rename to Framework/CurveFitting/src/Functions/Convolution.cpp index db1f62ad49f2d0a9f2f960e59b4b507e5f3e0472..00ed29d4c139058504875f9b573db92e8002d028 100644 --- a/Framework/CurveFitting/src/Convolution.cpp +++ b/Framework/CurveFitting/src/Functions/Convolution.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/DeltaFunction.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/DeltaFunction.h" #include "MantidAPI/IFunction1D.h" #include "MantidAPI/FunctionFactory.h" @@ -20,8 +20,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Convolution) @@ -297,5 +301,6 @@ void Convolution::refreshResolution() const { m_resolution.clear(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CubicSpline.cpp b/Framework/CurveFitting/src/Functions/CubicSpline.cpp similarity index 98% rename from Framework/CurveFitting/src/CubicSpline.cpp rename to Framework/CurveFitting/src/Functions/CubicSpline.cpp index b955d04215d02d904e00193dfd0cddfeba7079f4..d13cb126fdd0971edc5a8a2b9f08aa8b925b32c5 100644 --- a/Framework/CurveFitting/src/CubicSpline.cpp +++ b/Framework/CurveFitting/src/Functions/CubicSpline.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CubicSpline.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" #include "MantidAPI/FunctionFactory.h" #include "MantidKernel/Logger.h" @@ -12,12 +12,16 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger Kernel::Logger g_log("CubicSpline"); } using namespace Kernel; + using namespace API; DECLARE_FUNCTION(CubicSpline) @@ -358,5 +362,6 @@ void CubicSpline::reallocGSLObjects(const int n) { * */ CubicSpline::~CubicSpline() {} +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DeltaFunction.cpp b/Framework/CurveFitting/src/Functions/DeltaFunction.cpp similarity index 87% rename from Framework/CurveFitting/src/DeltaFunction.cpp rename to Framework/CurveFitting/src/Functions/DeltaFunction.cpp index 883e0ed542810809d9c777fe98c4c5b15392dcf1..aa26ab1c786ff2f8747568353edd6f4078923b67 100644 --- a/Framework/CurveFitting/src/DeltaFunction.cpp +++ b/Framework/CurveFitting/src/Functions/DeltaFunction.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DeltaFunction.h" +#include "MantidCurveFitting/Functions/DeltaFunction.h" #include "MantidAPI/FunctionFactory.h" #include <algorithm> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(DeltaFunction) @@ -32,5 +36,6 @@ void DeltaFunction::functionDeriv1D(Jacobian *out, const double *xValues, std::runtime_error("Cannot compute derivative of a delta function"); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp similarity index 97% rename from Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp rename to Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp index ceb07007e2621508b37ecb0b0dcc4e22bce68a79..f295573909e3ba7653a4aad0a806f57f97d95496 100644 --- a/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp +++ b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp @@ -1,12 +1,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DiffRotDiscreteCircle.h" +#include "MantidCurveFitting/Functions/DiffRotDiscreteCircle.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ParameterTie.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidGeometry/IDetector.h" #include "MantidKernel/Exception.h" #include "MantidKernel/UnitConversion.h" @@ -20,8 +20,13 @@ Mantid::Kernel::Logger g_log("DiffSphere"); namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; using namespace API; + using namespace Geometry; DECLARE_FUNCTION(ElasticDiffRotDiscreteCircle) @@ -247,5 +252,6 @@ void DiffRotDiscreteCircle::init() { applyTies(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DiffSphere.cpp b/Framework/CurveFitting/src/Functions/DiffSphere.cpp similarity index 98% rename from Framework/CurveFitting/src/DiffSphere.cpp rename to Framework/CurveFitting/src/Functions/DiffSphere.cpp index bf7d4a803090902fc2df9b2c8675326f61196db4..19519493021e0af64a1816b461d1d68332fdbaa8 100644 --- a/Framework/CurveFitting/src/DiffSphere.cpp +++ b/Framework/CurveFitting/src/Functions/DiffSphere.cpp @@ -1,12 +1,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DiffSphere.h" +#include "MantidCurveFitting/Functions/DiffSphere.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ParameterTie.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidGeometry/IDetector.h" #include "MantidKernel/Exception.h" #include "MantidKernel/UnitConversion.h" @@ -22,9 +22,15 @@ Mantid::Kernel::Logger g_log("DiffSphere"); namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; using namespace API; + using namespace Geometry; + using namespace Kernel; DECLARE_FUNCTION(ElasticDiffSphere) @@ -351,5 +357,6 @@ void DiffSphere::init() { applyTies(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DynamicKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp similarity index 98% rename from Framework/CurveFitting/src/DynamicKuboToyabe.cpp rename to Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp index e62d0ba82c49eb9694c16d02874baf371cb0b1c5..e90d834562d8ce0768ab38f196a97d142b2686e8 100644 --- a/Framework/CurveFitting/src/DynamicKuboToyabe.cpp +++ b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DynamicKuboToyabe.h" +#include "MantidCurveFitting/Functions/DynamicKuboToyabe.h" #include "MantidAPI/Jacobian.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" @@ -9,8 +9,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(DynamicKuboToyabe) @@ -375,5 +379,6 @@ bool DynamicKuboToyabe::hasAttribute(const std::string &attName) const { return attName == "BinWidth"; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/EndErfc.cpp b/Framework/CurveFitting/src/Functions/EndErfc.cpp similarity index 91% rename from Framework/CurveFitting/src/EndErfc.cpp rename to Framework/CurveFitting/src/Functions/EndErfc.cpp index 7d5de37a67dd28340214068459843a2f09d31b99..ed8101f7d9a15b3a8c392225b17af219009fcc88 100644 --- a/Framework/CurveFitting/src/EndErfc.cpp +++ b/Framework/CurveFitting/src/Functions/EndErfc.cpp @@ -1,15 +1,19 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/EndErfc.h" +#include "MantidCurveFitting/Functions/EndErfc.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> #include <gsl/gsl_sf_erf.h> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(EndErfc) @@ -51,5 +55,6 @@ void EndErfc::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ExpDecay.cpp b/Framework/CurveFitting/src/Functions/ExpDecay.cpp similarity index 90% rename from Framework/CurveFitting/src/ExpDecay.cpp rename to Framework/CurveFitting/src/Functions/ExpDecay.cpp index c5d92311a04e1c729ccb877ec42cf047f9a2d070..3f26962c469291157c260c23e1c1c15ea63bf4c9 100644 --- a/Framework/CurveFitting/src/ExpDecay.cpp +++ b/Framework/CurveFitting/src/Functions/ExpDecay.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ExpDecay) @@ -41,5 +45,6 @@ void ExpDecay::functionDeriv1D(Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ExpDecayMuon.cpp b/Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp similarity index 90% rename from Framework/CurveFitting/src/ExpDecayMuon.cpp rename to Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp index 2f0867e8c10b8111da7e4de914c9bcc43a18d802..748b7ed6bae725f0eeb5eb5127f2fa88c28986da 100644 --- a/Framework/CurveFitting/src/ExpDecayMuon.cpp +++ b/Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ExpDecayMuon.h" +#include "MantidCurveFitting/Functions/ExpDecayMuon.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ExpDecayMuon) @@ -41,5 +45,6 @@ void ExpDecayMuon::functionDeriv1D(Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ExpDecayOsc.cpp b/Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp similarity index 94% rename from Framework/CurveFitting/src/ExpDecayOsc.cpp rename to Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp index f3d677feee5204237636b8284c4446584b5164e0..53713374e6a8df68779401578a7d827b97810047 100644 --- a/Framework/CurveFitting/src/ExpDecayOsc.cpp +++ b/Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ExpDecayOsc.h" +#include "MantidCurveFitting/Functions/ExpDecayOsc.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ExpDecayOsc) @@ -68,5 +72,6 @@ void ExpDecayOsc::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FlatBackground.cpp b/Framework/CurveFitting/src/Functions/FlatBackground.cpp similarity index 92% rename from Framework/CurveFitting/src/FlatBackground.cpp rename to Framework/CurveFitting/src/Functions/FlatBackground.cpp index d1fc5c08ad6a7e1051cf4124ec6cf58256f21a3b..e73d11ecb56b9cefc4505bb0ebcafdd6689f3f31 100644 --- a/Framework/CurveFitting/src/FlatBackground.cpp +++ b/Framework/CurveFitting/src/Functions/FlatBackground.cpp @@ -1,12 +1,16 @@ -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" #include "MantidAPI/FunctionFactory.h" #include "MantidKernel/System.h" using namespace Mantid::Kernel; + using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(FlatBackground) //---------------------------------------------------------------------------------------------- @@ -60,4 +64,5 @@ void FlatBackground::functionDeriv1D(API::Jacobian *out, const double *xValues, } } // namespace Mantid +} // namespace Functions } // namespace CurveFitting diff --git a/Framework/CurveFitting/src/FullprofPolynomial.cpp b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp similarity index 97% rename from Framework/CurveFitting/src/FullprofPolynomial.cpp rename to Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp index c11007ea6c0ff153321d028c68eee5b9edd990b4..0c694afb8b925a73e6614f2758d64f771725237f 100644 --- a/Framework/CurveFitting/src/FullprofPolynomial.cpp +++ b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp @@ -1,9 +1,12 @@ -#include "MantidCurveFitting/FullprofPolynomial.h" +#include "MantidCurveFitting/Functions/FullprofPolynomial.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(FullprofPolynomial) @@ -161,5 +164,6 @@ bool FullprofPolynomial::hasAttribute(const std::string &attName) const { return has; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GausDecay.cpp b/Framework/CurveFitting/src/Functions/GausDecay.cpp similarity index 91% rename from Framework/CurveFitting/src/GausDecay.cpp rename to Framework/CurveFitting/src/Functions/GausDecay.cpp index 1497dbd6af7153865b61fb19ed45d4b0fc69f204..62e7fa7b723c6c9d88c9175bdd8a271d0a88c962 100644 --- a/Framework/CurveFitting/src/GausDecay.cpp +++ b/Framework/CurveFitting/src/Functions/GausDecay.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/GausDecay.h" +#include "MantidCurveFitting/Functions/GausDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(GausDecay) @@ -51,5 +55,6 @@ void GausDecay::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GausOsc.cpp b/Framework/CurveFitting/src/Functions/GausOsc.cpp similarity index 94% rename from Framework/CurveFitting/src/GausOsc.cpp rename to Framework/CurveFitting/src/Functions/GausOsc.cpp index fbf341f190a4665c037e4d8cdc935aed2ffbdac1..54b17aec67d9e64e675c0d28e4054c6f908aebb9 100644 --- a/Framework/CurveFitting/src/GausOsc.cpp +++ b/Framework/CurveFitting/src/Functions/GausOsc.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/GausOsc.h" +#include "MantidCurveFitting/Functions/GausOsc.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(GausOsc) @@ -69,5 +73,6 @@ void GausOsc::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Gaussian.cpp b/Framework/CurveFitting/src/Functions/Gaussian.cpp similarity index 94% rename from Framework/CurveFitting/src/Gaussian.cpp rename to Framework/CurveFitting/src/Functions/Gaussian.cpp index 886d31e3f3ef9c0abe4a87030d2e5f2621668f2e..eeacee84e14d13cca2f551c7fb8dd0a864134e12 100644 --- a/Framework/CurveFitting/src/Gaussian.cpp +++ b/Framework/CurveFitting/src/Functions/Gaussian.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/Gaussian.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> @@ -9,8 +9,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Gaussian) @@ -69,5 +73,6 @@ double Gaussian::activeParameter(size_t i) const { return getParameter(i); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GaussianComptonProfile.cpp b/Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp similarity index 96% rename from Framework/CurveFitting/src/GaussianComptonProfile.cpp rename to Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp index 3cc941c99647c2c51097a6c5f2f81326a2611cc0..23af0e475ee0caf438272c175d588066b1cb2111 100644 --- a/Framework/CurveFitting/src/GaussianComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp @@ -1,13 +1,16 @@ //------------------------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------------------------ -#include "MantidCurveFitting/GaussianComptonProfile.h" +#include "MantidCurveFitting/Functions/GaussianComptonProfile.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(GaussianComptonProfile) const char *WIDTH_PARAM = "Width"; @@ -112,5 +115,6 @@ void GaussianComptonProfile::massProfile(double *result, const size_t nData, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp similarity index 98% rename from Framework/CurveFitting/src/GramCharlierComptonProfile.cpp rename to Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp index 7003021e27ecf3f23f1e331fb07d307eb1c9db38..dcefc759c3041571c04728526393f096af35dbae 100644 --- a/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------------------------ -#include "MantidCurveFitting/GramCharlierComptonProfile.h" +#include "MantidCurveFitting/Functions/GramCharlierComptonProfile.h" #include "MantidAPI/FunctionFactory.h" #include "MantidKernel/Math/Distributions/HermitePolynomials.h" @@ -14,6 +14,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Register into factory DECLARE_FUNCTION(GramCharlierComptonProfile) @@ -247,6 +250,7 @@ size_t GramCharlierComptonProfile::fillConstraintMatrix( void GramCharlierComptonProfile::massProfile(double *result, const size_t nData) const { UNUSED_ARG(nData); + using namespace Mantid::Kernel; // Hermite expansion (only even terms) + FSE term @@ -275,6 +279,7 @@ void GramCharlierComptonProfile::massProfile(double *result, */ void GramCharlierComptonProfile::addMassProfile( double *result, const unsigned int npoly) const { + using namespace Mantid::Kernel; const double amp(1.0), wg(getParameter(WIDTH_PARAM)); @@ -300,6 +305,7 @@ void GramCharlierComptonProfile::addMassProfile( */ void GramCharlierComptonProfile::addFSETerm(std::vector<double> &lhs) const { assert(static_cast<size_t>(NFINE_Y) == lhs.size()); + using namespace Mantid::Kernel; const double amp(1.0), wg(getParameter(WIDTH_PARAM)); @@ -362,7 +368,7 @@ void GramCharlierComptonProfile::setMatrixWorkspace( */ void GramCharlierComptonProfile::cacheYSpaceValues( const std::vector<double> &tseconds, const bool isHistogram, - const DetectorParams &detpar) { + const Algorithms::DetectorParams &detpar) { ComptonProfile::cacheYSpaceValues(tseconds, isHistogram, detpar); // base-class calculations @@ -438,5 +444,6 @@ void GramCharlierComptonProfile::cacheYSpaceValues( // vector } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/IkedaCarpenterPV.cpp b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp similarity index 97% rename from Framework/CurveFitting/src/IkedaCarpenterPV.cpp rename to Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp index 527a9c39698081e58d8acc3d322ee20b35585697..519f78976bd762d60dcdab2afc56eedbceba0123 100644 --- a/Framework/CurveFitting/src/IkedaCarpenterPV.cpp +++ b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/IkedaCarpenterPV.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/IkedaCarpenterPV.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidCurveFitting/SpecialFunctionSupport.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/FunctionFactory.h" @@ -21,6 +21,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger @@ -28,8 +31,11 @@ Kernel::Logger g_log("IkedaCarpenterPV"); } using namespace Kernel; -using namespace SpecialFunctionSupport; + +using namespace CurveFitting::SpecialFunctionSupport; + using namespace Geometry; +using namespace Constraints; DECLARE_FUNCTION(IkedaCarpenterPV) @@ -366,5 +372,6 @@ void IkedaCarpenterPV::functionDeriv(const API::FunctionDomain &domain, calNumericalDeriv(domain, jacobian); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LinearBackground.cpp b/Framework/CurveFitting/src/Functions/LinearBackground.cpp similarity index 94% rename from Framework/CurveFitting/src/LinearBackground.cpp rename to Framework/CurveFitting/src/Functions/LinearBackground.cpp index 5961d95a20ed370a835d6464e891ba1d56d27db1..de365f0d88caddcebecc73905b980b9156f64983 100644 --- a/Framework/CurveFitting/src/LinearBackground.cpp +++ b/Framework/CurveFitting/src/Functions/LinearBackground.cpp @@ -1,13 +1,17 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LinearBackground.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(LinearBackground) @@ -79,5 +83,6 @@ void LinearBackground::fit(const std::vector<double> &X, setParameter("A1", a1); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LogNormal.cpp b/Framework/CurveFitting/src/Functions/LogNormal.cpp similarity index 95% rename from Framework/CurveFitting/src/LogNormal.cpp rename to Framework/CurveFitting/src/Functions/LogNormal.cpp index e7cba5f58ea4f41da6946e3452617b53bfd48fbf..85e24ebfcf8ecd2a6705f68c61793754a6851b91 100644 --- a/Framework/CurveFitting/src/LogNormal.cpp +++ b/Framework/CurveFitting/src/Functions/LogNormal.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LogNormal.h" +#include "MantidCurveFitting/Functions/LogNormal.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(LogNormal) @@ -78,5 +82,6 @@ void LogNormal::functionDeriv1D(API::Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Lorentzian.cpp b/Framework/CurveFitting/src/Functions/Lorentzian.cpp similarity index 94% rename from Framework/CurveFitting/src/Lorentzian.cpp rename to Framework/CurveFitting/src/Functions/Lorentzian.cpp index 8d58c9a3915b9d7bd87d8d9da9be2a6f5ae70be0..0b5d4b534624e37d6e81d22b099809d16d1ac346 100644 --- a/Framework/CurveFitting/src/Lorentzian.cpp +++ b/Framework/CurveFitting/src/Functions/Lorentzian.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Lorentzian) @@ -75,5 +79,6 @@ void Lorentzian::functionDerivLocal(Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Lorentzian1D.cpp b/Framework/CurveFitting/src/Functions/Lorentzian1D.cpp similarity index 95% rename from Framework/CurveFitting/src/Lorentzian1D.cpp rename to Framework/CurveFitting/src/Functions/Lorentzian1D.cpp index 763d9a92ed152d2f081d9dfb6ae8bdfe627b537f..1c19669665cef0be1ff816dc5d58c0074c2a8465 100644 --- a/Framework/CurveFitting/src/Lorentzian1D.cpp +++ b/Framework/CurveFitting/src/Functions/Lorentzian1D.cpp @@ -1,13 +1,16 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Lorentzian1D.h" +#include "MantidCurveFitting/Functions/Lorentzian1D.h" #include <gsl/gsl_sf_erf.h> #include <gsl/gsl_multifit_nlin.h> #include "MantidKernel/BoundedValidator.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using API::Jacobian; // Register the class into the algorithm factory @@ -69,5 +72,6 @@ void Lorentzian1D::functionDeriv(const double *in, Jacobian *out, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/MuonFInteraction.cpp b/Framework/CurveFitting/src/Functions/MuonFInteraction.cpp similarity index 90% rename from Framework/CurveFitting/src/MuonFInteraction.cpp rename to Framework/CurveFitting/src/Functions/MuonFInteraction.cpp index a11f82c92ae02a68df3adeb7030eeeed61e72b4b..4fcb0672c65bf56ee6691a3b0880d4d2f23fcba0 100644 --- a/Framework/CurveFitting/src/MuonFInteraction.cpp +++ b/Framework/CurveFitting/src/Functions/MuonFInteraction.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/MuonFInteraction.h" +#include "MantidCurveFitting/Functions/MuonFInteraction.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(MuonFInteraction) @@ -40,5 +44,6 @@ void MuonFInteraction::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp similarity index 99% rename from Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp rename to Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp index 9f4d315690da912d41a074727fa5cb012015d8a3..c451d8d528adedf27626917dd0b574be8fffcbda 100644 --- a/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/ParamFunction.h" #include "MantidKernel/EmptyValues.h" @@ -17,6 +17,9 @@ using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger Kernel::Logger g_log("NeutronBk2BkExpConvPV"); @@ -504,5 +507,6 @@ double NeutronBk2BkExpConvPVoigt::calOmega(const double x, const double eta, return omega; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PawleyFunction.cpp b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp similarity index 98% rename from Framework/CurveFitting/src/PawleyFunction.cpp rename to Framework/CurveFitting/src/Functions/PawleyFunction.cpp index ab4c06fb473da7c04457368a46baeed882992d86..2f4231d00f45460479cb798489372750eca5f56c 100644 --- a/Framework/CurveFitting/src/PawleyFunction.cpp +++ b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp @@ -1,9 +1,9 @@ -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidKernel/UnitConversion.h" #include "MantidKernel/UnitFactory.h" @@ -13,11 +13,17 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; DECLARE_FUNCTION(PawleyParameterFunction) using namespace API; + using namespace Geometry; + using namespace Kernel; /// Constructor @@ -572,5 +578,6 @@ void PawleyFunction::beforeDecoratedFunctionSet(const API::IFunction_sptr &fn) { } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PeakParameterFunction.cpp b/Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp similarity index 93% rename from Framework/CurveFitting/src/PeakParameterFunction.cpp rename to Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp index 068e7d5440dcf0f2e3dae8b5ff1cc009a4d61274..5991f2ad484d034df9434b38cb1a7a29329fc232 100644 --- a/Framework/CurveFitting/src/PeakParameterFunction.cpp +++ b/Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp @@ -1,9 +1,12 @@ -#include "MantidCurveFitting/PeakParameterFunction.h" +#include "MantidCurveFitting/Functions/PeakParameterFunction.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace API; @@ -59,5 +62,6 @@ void PeakParameterFunction::beforeDecoratedFunctionSet( m_peakFunction = peakFunction; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Polynomial.cpp b/Framework/CurveFitting/src/Functions/Polynomial.cpp similarity index 97% rename from Framework/CurveFitting/src/Polynomial.cpp rename to Framework/CurveFitting/src/Functions/Polynomial.cpp index d6b20c93df577952f06af3527ebccffd30c9a685..800902e4ffabba0586b272a7f9cf0ef3145609f5 100644 --- a/Framework/CurveFitting/src/Polynomial.cpp +++ b/Framework/CurveFitting/src/Functions/Polynomial.cpp @@ -1,14 +1,18 @@ -#include "MantidCurveFitting/Polynomial.h" +#include "MantidCurveFitting/Functions/Polynomial.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> using namespace Mantid::Kernel; + using namespace Mantid::API; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(Polynomial) @@ -154,5 +158,6 @@ bool Polynomial::hasAttribute(const std::string &attName) const { return attName == "n"; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp similarity index 98% rename from Framework/CurveFitting/src/ProcessBackground.cpp rename to Framework/CurveFitting/src/Functions/ProcessBackground.cpp index d6bd7e43f1a3cf57dab73270076e1b83b6994019..3df0c026c17f7f09df892405a48b89137f95b329 100644 --- a/Framework/CurveFitting/src/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ProcessBackground.h" +#include "MantidCurveFitting/Functions/ProcessBackground.h" #include "MantidAPI/WorkspaceProperty.h" #include "MantidKernel/Property.h" #include "MantidKernel/ListValidator.h" @@ -6,8 +6,8 @@ #include "MantidKernel/VisibleWhenProperty.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/Chebyshev.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/Chebyshev.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidGeometry/Crystal/IPeak.h" #include "MantidAPI/TableRow.h" @@ -17,15 +17,22 @@ #include <boost/algorithm/string/split.hpp> using namespace Mantid; + using namespace Mantid::API; + using namespace Mantid::Kernel; + using namespace Mantid::DataObjects; + using namespace Mantid::CurveFitting; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_ALGORITHM(ProcessBackground) @@ -677,17 +684,16 @@ ProcessBackground::autoBackgroundSelection(Workspace2D_sptr bkgdWS) { */ BackgroundFunction_sptr ProcessBackground::createBackgroundFunction(const string backgroundtype) { - CurveFitting::BackgroundFunction_sptr bkgdfunction; + Functions::BackgroundFunction_sptr bkgdfunction; if (backgroundtype.compare("Polynomial") == 0) { - bkgdfunction = - boost::dynamic_pointer_cast<CurveFitting::BackgroundFunction>( - boost::make_shared<CurveFitting::Polynomial>()); + bkgdfunction = boost::dynamic_pointer_cast<Functions::BackgroundFunction>( + boost::make_shared<Functions::Polynomial>()); bkgdfunction->initialize(); } else if (backgroundtype.compare("Chebyshev") == 0) { - Chebyshev_sptr cheby = boost::make_shared<CurveFitting::Chebyshev>(); + Chebyshev_sptr cheby = boost::make_shared<Functions::Chebyshev>(); bkgdfunction = - boost::dynamic_pointer_cast<CurveFitting::BackgroundFunction>(cheby); + boost::dynamic_pointer_cast<Functions::BackgroundFunction>(cheby); bkgdfunction->initialize(); g_log.debug() << "[D] Chebyshev is set to range " << m_lowerBound << ", " @@ -1099,5 +1105,6 @@ size_t RemovePeaks::excludePeaks(vector<double> v_inX, vector<bool> &v_useX, return count; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProductFunction.cpp b/Framework/CurveFitting/src/Functions/ProductFunction.cpp similarity index 89% rename from Framework/CurveFitting/src/ProductFunction.cpp rename to Framework/CurveFitting/src/Functions/ProductFunction.cpp index 91152ccf885dd482e7f781cf3cbcec49e4986bcc..777e29e20fc2a09b9f1d455a5bb99d526e919aea 100644 --- a/Framework/CurveFitting/src/ProductFunction.cpp +++ b/Framework/CurveFitting/src/Functions/ProductFunction.cpp @@ -1,11 +1,14 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ProductFunction) @@ -34,5 +37,6 @@ void ProductFunction::functionDeriv(const API::FunctionDomain &domain, calNumericalDeriv(domain, jacobian); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProductLinearExp.cpp b/Framework/CurveFitting/src/Functions/ProductLinearExp.cpp similarity index 87% rename from Framework/CurveFitting/src/ProductLinearExp.cpp rename to Framework/CurveFitting/src/Functions/ProductLinearExp.cpp index 58079f6a9cdb9d39ad19d0ba3fd67d8c58684e75..c4d3758b8240479f579389db207affbd0c0f8e6b 100644 --- a/Framework/CurveFitting/src/ProductLinearExp.cpp +++ b/Framework/CurveFitting/src/Functions/ProductLinearExp.cpp @@ -1,13 +1,17 @@ -#include "MantidCurveFitting/ProductLinearExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductLinearExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ProductLinearExp) @@ -72,5 +76,6 @@ void ProductLinearExp::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProductQuadraticExp.cpp b/Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp similarity index 88% rename from Framework/CurveFitting/src/ProductQuadraticExp.cpp rename to Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp index 0d6dc24cd0997d06bbf9c44605ec95e1da170f69..5bd2458173bcdc84d300630334c6142f09eb4f04 100644 --- a/Framework/CurveFitting/src/ProductQuadraticExp.cpp +++ b/Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp @@ -1,11 +1,14 @@ -#include "MantidCurveFitting/ProductQuadraticExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/Quadratic.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductQuadraticExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/Quadratic.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ProductQuadraticExp) @@ -73,5 +76,6 @@ void ProductQuadraticExp::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PseudoVoigt.cpp b/Framework/CurveFitting/src/Functions/PseudoVoigt.cpp similarity index 92% rename from Framework/CurveFitting/src/PseudoVoigt.cpp rename to Framework/CurveFitting/src/Functions/PseudoVoigt.cpp index a492df6add6514a4888fc8eb88b80719fd5c99dd..a0ce2def8134e7420663297cd75c8fb529bc7b94 100644 --- a/Framework/CurveFitting/src/PseudoVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/PseudoVoigt.cpp @@ -1,11 +1,15 @@ -#include "MantidCurveFitting/PseudoVoigt.h" +#include "MantidCurveFitting/Functions/PseudoVoigt.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; using namespace API; @@ -83,5 +87,6 @@ void PseudoVoigt::init() { addConstraint(mixingConstraint); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Quadratic.cpp b/Framework/CurveFitting/src/Functions/Quadratic.cpp similarity index 92% rename from Framework/CurveFitting/src/Quadratic.cpp rename to Framework/CurveFitting/src/Functions/Quadratic.cpp index 0b364ce4a2319cdc0d2b4ef5feb11aad2f1e9963..cb6a2b6f6613a13494efed79a674bedcd94fe056 100644 --- a/Framework/CurveFitting/src/Quadratic.cpp +++ b/Framework/CurveFitting/src/Functions/Quadratic.cpp @@ -1,13 +1,17 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Quadratic.h" +#include "MantidCurveFitting/Functions/Quadratic.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Quadratic) @@ -53,5 +57,6 @@ void Quadratic::functionDeriv1D(API::Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ReflectivityMulf.cpp b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp similarity index 98% rename from Framework/CurveFitting/src/ReflectivityMulf.cpp rename to Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp index 17ab832f7de39c76e1e7bc4e17654844dbce9667..4d84564dd5a0ab38d2ccec35b20b363cbc60dcda 100644 --- a/Framework/CurveFitting/src/ReflectivityMulf.cpp +++ b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp @@ -1,15 +1,19 @@ -#include "MantidCurveFitting/ReflectivityMulf.h" +#include "MantidCurveFitting/Functions/ReflectivityMulf.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> #include <cmath> using namespace Mantid::Kernel; + using namespace Mantid::API; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ReflectivityMulf) @@ -292,5 +296,6 @@ void ReflectivityMulf::setAttribute(const std::string &attName, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Resolution.cpp b/Framework/CurveFitting/src/Functions/Resolution.cpp similarity index 90% rename from Framework/CurveFitting/src/Resolution.cpp rename to Framework/CurveFitting/src/Functions/Resolution.cpp index 75319dbcb07e8d3e5c43e859a30e364208b6798e..fad3353dbfd1de98e2d4d5f84bfd156a5ab1a35f 100644 --- a/Framework/CurveFitting/src/Resolution.cpp +++ b/Framework/CurveFitting/src/Functions/Resolution.cpp @@ -1,13 +1,17 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Resolution.h" +#include "MantidCurveFitting/Functions/Resolution.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Resolution) @@ -43,5 +47,6 @@ bool Resolution::hasAttribute(const std::string &attName) const { return m_fun.hasAttribute(attName); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SimpleChebfun.cpp b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp similarity index 97% rename from Framework/CurveFitting/src/SimpleChebfun.cpp rename to Framework/CurveFitting/src/Functions/SimpleChebfun.cpp index 9416aaaae314a59def2b0c4b00c2ae95d413ad59..1cc4ce08e3f2f9ed010d08128465edda590161cc 100644 --- a/Framework/CurveFitting/src/SimpleChebfun.cpp +++ b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp @@ -1,10 +1,13 @@ -#include "MantidCurveFitting/SimpleChebfun.h" +#include "MantidCurveFitting/Functions/SimpleChebfun.h" #include "MantidAPI/IFunction.h" #include <boost/make_shared.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; //---------------------------------------------------------------------------------------------- /// Constructs a SimpleChebfun that approximates a function with a polynomial of @@ -163,5 +166,6 @@ SimpleChebfun &SimpleChebfun::operator+=(ChebfunFunctionType fun) { return *this; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StaticKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp similarity index 87% rename from Framework/CurveFitting/src/StaticKuboToyabe.cpp rename to Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp index 6d96804846ab9f92aa37aa5a8261ced40e400b91..9875e375005a0643d38d89ebbdf44a2fc5a286dc 100644 --- a/Framework/CurveFitting/src/StaticKuboToyabe.cpp +++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/StaticKuboToyabe.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabe.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StaticKuboToyabe) @@ -30,5 +34,6 @@ void StaticKuboToyabe::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp similarity index 87% rename from Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp rename to Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp index 8ee826d6dbc1de68b6903e508f3db0124516c15b..33e328757063e52ecbc75829779ec16f6e1dd310 100644 --- a/Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp +++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp @@ -1,11 +1,15 @@ -#include "MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StaticKuboToyabeTimesExpDecay) @@ -34,5 +38,6 @@ void StaticKuboToyabeTimesExpDecay::function1D(double *out, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp similarity index 88% rename from Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp rename to Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp index 50a84ee40c92b50a38917037d2c481a1a111b102..3fd2c5394f95286b21697564df093db0039f9d92 100644 --- a/Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp +++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp @@ -1,10 +1,15 @@ -#include "MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; + using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StaticKuboToyabeTimesGausDecay) @@ -36,5 +41,6 @@ void StaticKuboToyabeTimesGausDecay::function1D(double *out, A * (exp(-(x2 * D2) / 2) * (1 - x2 * D2) * C1 + C2) * exp(-S2 * x2); } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StretchExp.cpp b/Framework/CurveFitting/src/Functions/StretchExp.cpp similarity index 94% rename from Framework/CurveFitting/src/StretchExp.cpp rename to Framework/CurveFitting/src/Functions/StretchExp.cpp index 51064e2b85c9a6d5b9071afb15bdcb9a8fce9822..41a8cf8b7ff734787fbe4260de9cf4400ed4d1e5 100644 --- a/Framework/CurveFitting/src/StretchExp.cpp +++ b/Framework/CurveFitting/src/Functions/StretchExp.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/StretchExp.h" +#include "MantidCurveFitting/Functions/StretchExp.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StretchExp) @@ -71,5 +75,6 @@ void StretchExp::functionDeriv1D(API::Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StretchExpMuon.cpp b/Framework/CurveFitting/src/Functions/StretchExpMuon.cpp similarity index 88% rename from Framework/CurveFitting/src/StretchExpMuon.cpp rename to Framework/CurveFitting/src/Functions/StretchExpMuon.cpp index 3c14c8fead5e209b6a6de41a690dfa819079e125..c88d045de580b32c08f6eb0341d26784da9fdf76 100644 --- a/Framework/CurveFitting/src/StretchExpMuon.cpp +++ b/Framework/CurveFitting/src/Functions/StretchExpMuon.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/StretchExpMuon.h" +#include "MantidCurveFitting/Functions/StretchExpMuon.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StretchExpMuon) @@ -31,5 +35,6 @@ void StretchExpMuon::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/TabulatedFunction.cpp b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp similarity index 98% rename from Framework/CurveFitting/src/TabulatedFunction.cpp rename to Framework/CurveFitting/src/Functions/TabulatedFunction.cpp index 10f9e8168a8779989e05a736b8c56b3b8108c6e1..d0efc13940ae2ce8c316fbd2d6445b2839293b20 100644 --- a/Framework/CurveFitting/src/TabulatedFunction.cpp +++ b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/TabulatedFunction.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" #include "MantidKernel/FileValidator.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/FunctionFactory.h" @@ -14,7 +14,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; + using namespace Kernel; + using namespace API; namespace { @@ -276,5 +281,6 @@ void TabulatedFunction::setupData() const { m_setupFinished = true; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp similarity index 94% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp index 9eff40af37195f5aa5a285dbcbedf0709fbc9d90..464c73e7fb34fa7da4c8d0724e10434e2a6cb249 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" @@ -6,12 +6,18 @@ #include <cmath> using namespace std; + using namespace Mantid; + using namespace Mantid::API; + using namespace Mantid::CurveFitting; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ThermalNeutronBk2BkExpAlpha) @@ -80,5 +86,6 @@ double ThermalNeutronBk2BkExpAlpha::corefunction(double dh, double width, return alpha; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp similarity index 94% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp index ae1170803594d1666b7d81497f488802e5e5c85f..92901743be4ceca7e440dbd811db471ffd153962 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" @@ -6,12 +6,18 @@ #include <cmath> using namespace std; + using namespace Mantid; + using namespace Mantid::CurveFitting; + using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ThermalNeutronBk2BkExpBeta) @@ -79,5 +85,6 @@ double ThermalNeutronBk2BkExpBeta::corefunction(double dh, double width, return beta; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp similarity index 99% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp index 521becfcc478059efe73a2c0aca2a8c645108d6c..8ee59b58177ad3525a2615c6ef4ec8fcd8b8703a 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/ParamFunction.h" #include "MantidKernel/EmptyValues.h" @@ -14,11 +14,16 @@ const double PEAKRANGE = 5.0; const double NEG_DBL_MAX = -1. * DBL_MAX; using namespace std; + using namespace Mantid; + using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static reference to the logger Kernel::Logger g_log("ThermalNeutronBk2BkExpConvPV"); @@ -774,5 +779,6 @@ void ThermalNeutronBk2BkExpConvPVoigt::setPeakRadius(const int& r) } */ +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp similarity index 94% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp index ed8f0af7b195223ea9093587e5bdbf6a29fbca31..51c0370b5cffa8752f75d08b2e7ac51f259e3f71 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" @@ -6,12 +6,18 @@ #include <cmath> using namespace std; + using namespace Mantid; + using namespace Mantid::API; + using namespace Mantid::CurveFitting; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ThermalNeutronBk2BkExpSigma) @@ -77,5 +83,6 @@ double ThermalNeutronBk2BkExpSigma::corefunction(double dh, double sig0sq, return sigma; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp similarity index 96% rename from Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp index 8566384197fe62b9422f94a5b9fd39defa2090fc..4d3bb672a2df48ce85ad78f6c9e1cdaa5100d454 100644 --- a/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionDomain1D.h" @@ -6,10 +6,14 @@ #include <cmath> using namespace Mantid::API; + using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; //---------------------------------------------------------------------------------------------- DECLARE_FUNCTION(ThermalNeutronDtoTOFFunction) @@ -140,5 +144,6 @@ void ThermalNeutronDtoTOFFunction::functionDerivLocal(API::Jacobian *, "ThermalNeutronDtoTOFFunction."); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/UserFunction.cpp b/Framework/CurveFitting/src/Functions/UserFunction.cpp similarity index 95% rename from Framework/CurveFitting/src/UserFunction.cpp rename to Framework/CurveFitting/src/Functions/UserFunction.cpp index b367c452958f8775f7e667120a214977ed01357e..45ec9fc62f46b77425f2af1f312576146f0c507d 100644 --- a/Framework/CurveFitting/src/UserFunction.cpp +++ b/Framework/CurveFitting/src/Functions/UserFunction.cpp @@ -1,18 +1,22 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionFactory.h" #include <boost/tokenizer.hpp> #include "MantidGeometry/muParser_Silent.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Register the class into the function factory DECLARE_FUNCTION(UserFunction) using namespace Kernel; + using namespace API; /// Constructor @@ -113,5 +117,6 @@ void UserFunction::functionDeriv(const API::FunctionDomain &domain, calNumericalDeriv(domain, jacobian); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/UserFunction1D.cpp b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp similarity index 97% rename from Framework/CurveFitting/src/UserFunction1D.cpp rename to Framework/CurveFitting/src/Functions/UserFunction1D.cpp index 5164c2322bb93304a9703a2856c7d883296f1697..0c0ee89a9d0c1c6e2befac956b6146109db7825b 100644 --- a/Framework/CurveFitting/src/UserFunction1D.cpp +++ b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp @@ -1,18 +1,22 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/UserFunction1D.h" +#include "MantidCurveFitting/Functions/UserFunction1D.h" #include "MantidKernel/UnitFactory.h" #include "MantidKernel/MandatoryValidator.h" #include <boost/tokenizer.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Register the class into the algorithm factory DECLARE_ALGORITHM(UserFunction1D) using namespace Kernel; + using namespace API; /** Static callback function used by MuParser to initialize variables implicitly @@ -155,5 +159,6 @@ void UserFunction1D::functionDeriv(const double *in, Jacobian *out, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/VesuvioResolution.cpp b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp similarity index 96% rename from Framework/CurveFitting/src/VesuvioResolution.cpp rename to Framework/CurveFitting/src/Functions/VesuvioResolution.cpp index d850ed0f223861674134ac23aa1fa84bb5a6bd82..44c6b1e458ef1142f49b68f0f61080fca750fe4e 100644 --- a/Framework/CurveFitting/src/VesuvioResolution.cpp +++ b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp @@ -1,13 +1,18 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/VesuvioResolution.h" -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_poly.h> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace Mantid; +using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; namespace { ///@cond const char *MASS_NAME = "Mass"; @@ -78,6 +83,7 @@ std::string VesuvioResolution::name() const { return "VesuvioResolution"; } */ void VesuvioResolution::setUpForFit() { // Voigt + using namespace Mantid::API; m_voigt = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction("Voigt")); @@ -108,7 +114,7 @@ void VesuvioResolution::setMatrixWorkspace( * @param respar Structure containing resolution parameters */ void VesuvioResolution::cacheResolutionComponents( - const DetectorParams &detpar, const ResolutionParams &respar) { + const Algorithms::DetectorParams &detpar, const ResolutionParams &respar) { // geometry double theta = detpar.theta; // cache for frequent access double hwhmLorentzE = respar.dEnLorentz; @@ -253,5 +259,6 @@ void VesuvioResolution::voigtApprox(std::vector<double> &voigt, std::bind2nd(std::multiplies<double>(), norm)); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Voigt.cpp b/Framework/CurveFitting/src/Functions/Voigt.cpp similarity index 97% rename from Framework/CurveFitting/src/Voigt.cpp rename to Framework/CurveFitting/src/Functions/Voigt.cpp index 9e006da4d314d97a44efe6c8f7f5bcc3b4b0a90a..73ce3f49f9979c516ecceedd0af016ee7b69eaf5 100644 --- a/Framework/CurveFitting/src/Voigt.cpp +++ b/Framework/CurveFitting/src/Functions/Voigt.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------------------------- // Includes //---------------------------------------------------------------------------------------------- -#include "MantidCurveFitting/Voigt.h" +#include "MantidCurveFitting/Functions/Voigt.h" #include "MantidAPI/FunctionFactory.h" @@ -9,6 +9,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(Voigt) namespace { @@ -165,5 +168,6 @@ void Voigt::setFwhm(const double value) { this->setParameter(GAUSSIAN_FWHM, 0.5 * value); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GSLFunctions.cpp b/Framework/CurveFitting/src/GSLFunctions.cpp index d5c4445dcc00a0821742647014922c1ea3c7c16d..2ebd26b9ec65f05f028b43dc61b5a802e7a51600 100644 --- a/Framework/CurveFitting/src/GSLFunctions.cpp +++ b/Framework/CurveFitting/src/GSLFunctions.cpp @@ -126,7 +126,7 @@ int gsl_df(const gsl_vector *x, void *params, gsl_matrix *J) { // functionDeriv() return derivatives of calculated data values. Need to // convert this values into - // derivatives of calculated-observed devided by error values used by GSL + // derivatives of calculated-observed divided by error values used by GSL auto values = boost::dynamic_pointer_cast<API::FunctionValues>( p->costFunction->getValues()); if (!values) { @@ -159,7 +159,8 @@ int gsl_fdf(const gsl_vector *x, void *params, gsl_vector *f, gsl_matrix *J) { * Constructor. Creates declared -> active index map * @param cf :: ICostFunction */ -GSL_FitData::GSL_FitData(boost::shared_ptr<CostFuncLeastSquares> cf) +GSL_FitData::GSL_FitData( + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> cf) : function(cf->getFittingFunction()), costFunction(cf) { gsl_set_error_handler_off(); // number of active parameters diff --git a/Framework/CurveFitting/src/GSLVector.cpp b/Framework/CurveFitting/src/GSLVector.cpp index 6c7c341cf7d4f0f9f158ba91e7ebffe771a3cce0..cdbc2a12db0e7f571b5a8703754af69f1805cfd1 100644 --- a/Framework/CurveFitting/src/GSLVector.cpp +++ b/Framework/CurveFitting/src/GSLVector.cpp @@ -157,10 +157,12 @@ double GSLVector::dot(const GSLVector &v) const { /// The << operator. std::ostream &operator<<(std::ostream &ostr, const GSLVector &v) { + std::ios::fmtflags fflags(ostr.flags()); ostr << std::scientific << std::setprecision(6); for (size_t j = 0; j < v.size(); ++j) { ostr << std::setw(13) << v[j] << ' '; } + ostr.flags(fflags); return ostr; } diff --git a/Framework/CurveFitting/src/LatticeDomainCreator.cpp b/Framework/CurveFitting/src/LatticeDomainCreator.cpp index 69901d090985206b121217ff3a25cc940bff389d..db2ebe4bde9fca3df9b46c7a12805e94876df8e1 100644 --- a/Framework/CurveFitting/src/LatticeDomainCreator.cpp +++ b/Framework/CurveFitting/src/LatticeDomainCreator.cpp @@ -9,7 +9,7 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Peak.h" -#include "MantidCurveFitting/PawleyFit.h" +#include "MantidCurveFitting/Algorithms/PawleyFit.h" namespace Mantid { namespace CurveFitting { @@ -17,6 +17,7 @@ namespace CurveFitting { using namespace API; using namespace Kernel; using namespace DataObjects; +using namespace CurveFitting::Algorithms; /// Constructor LatticeDomainCreator::LatticeDomainCreator( diff --git a/Framework/CurveFitting/src/LatticeFunction.cpp b/Framework/CurveFitting/src/LatticeFunction.cpp index 895327b1d97f18dcb4252531b56b780828c0a84b..0fd29c73d2762d3ef7ee2772847997eee024d4b3 100644 --- a/Framework/CurveFitting/src/LatticeFunction.cpp +++ b/Framework/CurveFitting/src/LatticeFunction.cpp @@ -62,8 +62,8 @@ void LatticeFunction::init() { /// Checks that the decorated function is a PawleyParameterFunction. void LatticeFunction::beforeDecoratedFunctionSet(const IFunction_sptr &fn) { - PawleyParameterFunction_sptr paramFn = - boost::dynamic_pointer_cast<PawleyParameterFunction>(fn); + Functions::PawleyParameterFunction_sptr paramFn = + boost::dynamic_pointer_cast<Functions::PawleyParameterFunction>(fn); if (!paramFn) { throw std::invalid_argument( diff --git a/Framework/CurveFitting/src/MultiBG.cpp b/Framework/CurveFitting/src/MultiBG.cpp deleted file mode 100644 index d0cc9705068359f16f2b8232816514899a2ea14c..0000000000000000000000000000000000000000 --- a/Framework/CurveFitting/src/MultiBG.cpp +++ /dev/null @@ -1,306 +0,0 @@ -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidCurveFitting/MultiBG.h" -#include "MantidAPI/IFunctionMW.h" -#include "MantidAPI/Expression.h" -#include "MantidAPI/AnalysisDataService.h" -#include "MantidAPI/WorkspaceGroup.h" -#include "MantidAPI/FunctionFactory.h" - -#include <boost/lambda/lambda.hpp> -#include <boost/lexical_cast.hpp> - -#include <sstream> -#include <algorithm> -#include <iterator> -#include <float.h> - -using namespace boost::lambda; - -namespace Mantid { -namespace CurveFitting { - -DECLARE_FUNCTION(MultiBG) - -/** A Jacobian for individual functions - */ -class PartialJacobian : public API::Jacobian { - API::Jacobian *m_J; ///< pointer to the overall Jacobian - size_t m_iY0; ///< data array offset in the overall Jacobian for a particular - /// function - size_t m_iP0; ///< parameter offset in the overall Jacobian for a particular - /// function - size_t m_iaP0; ///< offset in the active Jacobian for a particular function -public: - /** Constructor - * @param J :: A pointer to the overall Jacobian - * @param iY0 :: Data array offset index (declared) for a particular function - * @param iP0 :: The parameter index (declared) offset for a particular - * function - * @param iap0 :: The active parameter index (declared) offset for a - * particular function - */ - PartialJacobian(API::Jacobian *J, size_t iY0, size_t iP0, size_t iap0) - : m_J(J), m_iY0(iY0), m_iP0(iP0), m_iaP0(iap0) {} - /** - * Overridden Jacobian::set(...). - * @param iY :: The index of the data point - * @param iP :: The parameter index of an individual function. - * @param value :: The derivative value - */ - void set(size_t iY, size_t iP, double value) { - m_J->set(m_iY0 + iY, m_iP0 + iP, value); - } - /** - * Overridden Jacobian::get(...). - * @param iY :: The index of the data point - * @param iP :: The parameter index of an individual function. - */ - double get(size_t iY, size_t iP) { return m_J->get(m_iY0 + iY, m_iP0 + iP); } - /** Add number to all iY (data) Jacobian elements for a given iP (parameter) - * @param value :: Value to add - * @param iActiveP :: The index of an active parameter. - */ - virtual void addNumberToColumn(const double &value, const size_t &iActiveP) { - m_J->addNumberToColumn(value, m_iaP0 + iActiveP); - } -}; - -/// Destructor -MultiBG::~MultiBG() {} - -/** - * Function you want to fit to. - */ -void MultiBG::function(double *out) const { - std::vector<double> tmpOut(dataSize()); - std::fill_n(out, dataSize(), 0); - for (size_t i = 0; i < nFunctions(); i++) { - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(i)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - size_t nWS = m_funIndex[i].size(); - for (size_t k = 0; k < nWS; ++k) { - size_t j = m_funIndex[i][k]; - fun->setWorkspace(m_spectra[k].first, - "WorkspaceIndex=" + boost::lexical_cast<std::string>( - m_spectra[j].second), - false); - // std::cerr << i << ' ' << k << " Function " << fun->name() << " ws " << - // fun->getWorkspace()->getName() << " wi " - // << dynamic_cast<Mantid::API::IFunctionMW*>(fun)->getWorkspaceIndex() - // << std::endl; - double *out1 = out + m_offset[j]; - double *tmp1 = &tmpOut[0] + m_offset[j]; - size_t nData = 0; - if (j < m_offset.size() - 1) - nData = m_offset[j + 1] - m_offset[j]; - else - nData = dataSize() - m_offset[j]; - if (i == 0) { - fun->function(out1); - } else { - fun->function(tmp1); - std::transform(out1, out1 + nData, tmp1, out1, std::plus<double>()); - } - } - } - // std::cerr << "Function:\n"; - // for(size_t i = 0; i<nParams();++i) - //{ - // std::cerr << getParameter(i) << ' ' ; - //} - // std::cerr << std::endl; - // std::for_each(out,out+m_dataSize,std::cerr << _1 << '\n'); - // std::cerr << std::endl; -} - -void MultiBG::functionDeriv(API::Jacobian *out) { - // it is possible that out is NULL - if (!out) - return; - for (size_t i = 0; i < nFunctions(); i++) { - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(i)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - size_t nWS = m_funIndex[i].size(); - for (size_t k = 0; k < nWS; ++k) { - size_t j = m_funIndex[i][k]; - fun->setWorkspace(m_spectra[k].first, - "WorkspaceIndex=" + boost::lexical_cast<std::string>( - m_spectra[j].second), - false); - PartialJacobian J(out, m_offset[j], paramOffset(i), activeOffset(i)); - fun->functionDeriv(&J); - } - } -} - -void MultiBG::setWorkspace(boost::shared_ptr<const API::Workspace> ws, bool) { - boost::shared_ptr<const API::MatrixWorkspace> mws = - boost::dynamic_pointer_cast<const API::MatrixWorkspace>(ws); - if (ws && !mws) { - throw std::invalid_argument( - "Workspace in MultiBG has a wrong type (not a MatrixWorkspace)"); - } - m_workspace = mws; -} -/** - * Sets workspaces to member functions. Constructs the data set for fitting. - * @param slicing :: A map between member functions and workspaces or empty - * string. Format: - * "f0,Workspace0,i0;f1,Workspace1,i1;f2,Workspace2,i2;..." - */ -void MultiBG::setSlicing(const std::string &slicing) { - boost::shared_ptr<const API::MatrixWorkspace> mws = m_workspace; - - m_funIndex.resize(nFunctions()); - - if (!slicing.empty()) { - Mantid::API::Expression expr; - expr.parse(slicing); - // expr can be treated as a list even if it has only 1 term - expr.toList(";"); - for (size_t i = 0; i < expr.size(); ++i) { - const Mantid::API::Expression &e = expr[i]; - if (e.name() != "," || e.size() != 3) { - // slicing has a wrong format - ignore it - break; - } - try { - std::string wsName = e[1].name(); - Mantid::API::MatrixWorkspace_sptr ws = - boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>( - Mantid::API::AnalysisDataService::Instance().retrieve(wsName)); - - size_t iFun = boost::lexical_cast<size_t>(e[0].name().substr(1)); - size_t wi = boost::lexical_cast<size_t>(e[2].name()); - if (iFun >= nFunctions()) { - throw std::invalid_argument("MultiBG::setWorkspace: function " + - e[0].name() + " not found"); - } - std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t> - spectrum = std::make_pair(ws, wi); - m_funIndex[iFun].push_back(m_spectra.size()); - m_spectra.push_back(spectrum); - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(iFun)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - fun->setWorkspace(ws, "WorkspaceIndex=" + e[2].name(), false); - } catch (...) { - break; - } - } - } - - // examine the member functions and fill in the m_funIndex array - for (size_t iFun = 0; iFun < nFunctions(); iFun++) { - API::IFunctionMW *fun = dynamic_cast<API::IFunctionMW *>(getFunction(iFun)); - if (!fun) { - throw std::runtime_error("MultiBG works with IFunctionMW only"); - } - if (fun->getWorkspace()) { - boost::shared_ptr<const API::MatrixWorkspace> iws = - fun->getMatrixWorkspace(); - std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t> - spectrum = std::make_pair(iws, fun->getWorkspaceIndex()); - std::vector<std::pair<boost::shared_ptr<const API::MatrixWorkspace>, - size_t>>::iterator it = - std::find(m_spectra.begin(), m_spectra.end(), spectrum); - size_t i; - if (it == m_spectra.end()) { - i = m_spectra.size(); - m_spectra.push_back(spectrum); - } else { - i = size_t(std::distance(it, m_spectra.begin())); - } - m_funIndex[iFun].push_back(i); - // fun->setWorkspace(boost::static_pointer_cast<const - // API::Workspace>(iws),slicing,false); - } - } - - // setWorkspace can be called by GUI when the function had not been properly - // initialized - if (m_spectra.empty()) { - return; - } - - // make functions without set workspace fit to all workspaces - for (size_t iFun = 0; iFun < nFunctions(); iFun++) { - std::vector<size_t> &index = m_funIndex[iFun]; - if (index.empty()) { - index.resize(m_spectra.size()); - int i = 0; - std::for_each(index.begin(), index.end(), _1 = var(i)++); - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(iFun)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - fun->setWorkspace(m_spectra[0].first, - "WorkspaceIndex=" + boost::lexical_cast<std::string>( - m_spectra[0].second), - false); - } - } - - // set dimensions and calculate ws's contribution to m_dataSize - // IFunctionMW::setWorkspace(ws,slicing,false); - // add other workspaces - m_offset.resize(m_spectra.size(), 0); - size_t nData = 0; - for (size_t i = 0; i < m_spectra.size(); ++i) { - mws = m_spectra[i].first; - size_t n = mws->blocksize(); - m_offset[i] = nData; - nData += static_cast<int>(n); - } - - m_data.resize(nData); - m_weights.resize(nData); - - //... fill in the data and the weights ... - - for (size_t i = 0; i < m_spectra.size(); ++i) { - mws = m_spectra[i].first; - size_t wi = m_spectra[i].second; - const Mantid::MantidVec &Y = mws->readY(wi); - const Mantid::MantidVec &E = mws->readE(wi); - size_t j0 = m_offset[i]; - for (size_t j = 0; j < Y.size(); ++j) { - m_data[j0 + j] = Y[j]; - double err = E[j]; - m_weights[j0 + j] = err != 0.0 ? 1. / err : 1.0; - } - } - - // std::cerr << "Workspace:\n"; - // std::for_each(&m_data[0],&m_data[0]+m_dataSize,std::cerr << _1 << '\n'); -} - -/** - * Creates a workspace containing values calculated with this function. It takes - * a workspace and ws index - * of a spectrum which this function may have been fitted to. The output - * contains the original spectrum - * (wi = 0), the calculated values (ws = 1), and the difference between them (ws - * = 2). - * @param sd :: optional standard deviations of the parameters for calculating - * the error bars - * @return created workspase - */ -boost::shared_ptr<API::WorkspaceGroup> -MultiBG::createCalculatedWorkspaceGroup(const std::vector<double> &sd) { - UNUSED_ARG(sd) - return boost::shared_ptr<API::WorkspaceGroup>(); -} -} // namespace API -} // namespace Mantid diff --git a/Framework/CurveFitting/src/ParDomain.cpp b/Framework/CurveFitting/src/ParDomain.cpp index 7cd4fdfe9e2f07b684cc16b4edcb6b9df9145177..01a76765f051c38b7e694348961519a5dc7639d4 100644 --- a/Framework/CurveFitting/src/ParDomain.cpp +++ b/Framework/CurveFitting/src/ParDomain.cpp @@ -28,7 +28,8 @@ void ParDomain::getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, * Calculate the value of a least squares cost function * @param leastSquares :: The least squares cost func to calculate the value for */ -void ParDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { +void ParDomain::leastSquaresVal( + const CostFunctions::CostFuncLeastSquares &leastSquares) { const int n = static_cast<int>(getNDomains()); PARALLEL_FOR_NO_WSP_CHECK() for (int i = 0; i < n; ++i) { @@ -54,7 +55,7 @@ void ParDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { * @param evalHessian :: Flag to evaluate the Hessian (second derivatives) */ void ParDomain::leastSquaresValDerivHessian( - const CostFuncLeastSquares &leastSquares, bool evalDeriv, + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, bool evalHessian) { const int n = static_cast<int>(getNDomains()); PARALLEL_SET_DYNAMIC(0); diff --git a/Framework/CurveFitting/src/ParameterEstimator.cpp b/Framework/CurveFitting/src/ParameterEstimator.cpp index b06ef9bf59e96e5ecb51b54e67e221a14b95be9a..93c46fd68fbb9ae0690fbf296458a5f3bb20b7c4 100644 --- a/Framework/CurveFitting/src/ParameterEstimator.cpp +++ b/Framework/CurveFitting/src/ParameterEstimator.cpp @@ -1,5 +1,5 @@ #include "MantidCurveFitting/ParameterEstimator.h" -#include "MantidCurveFitting/SimpleChebfun.h" +#include "MantidCurveFitting/Functions/SimpleChebfun.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FunctionDomain1D.h" @@ -13,6 +13,8 @@ namespace Mantid { namespace CurveFitting { namespace ParameterEstimator { +using namespace Functions; + /// The logger. Kernel::Logger g_log("ParameterEstimator"); diff --git a/Framework/CurveFitting/src/SeqDomain.cpp b/Framework/CurveFitting/src/SeqDomain.cpp index a36e808948d556a6e366f88551bcdf8fffe2d645..8a704c1745664d0961b48088642ba0fdffc410e6 100644 --- a/Framework/CurveFitting/src/SeqDomain.cpp +++ b/Framework/CurveFitting/src/SeqDomain.cpp @@ -68,7 +68,8 @@ SeqDomain *SeqDomain::create(API::IDomainCreator::DomainType type) { * Calculate the value of a least squares cost function * @param leastSquares :: The least squares cost func to calculate the value for */ -void SeqDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { +void SeqDomain::leastSquaresVal( + const CostFunctions::CostFuncLeastSquares &leastSquares) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; const size_t n = getNDomains(); @@ -87,7 +88,7 @@ void SeqDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { * Calculate the value of a least squares cost function * @param rwp :: The RWP cost func to calculate the value for */ -void SeqDomain::rwpVal(const CostFuncRwp &rwp) { +void SeqDomain::rwpVal(const CostFunctions::CostFuncRwp &rwp) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; const size_t n = getNDomains(); @@ -109,7 +110,7 @@ void SeqDomain::rwpVal(const CostFuncRwp &rwp) { * @param evalHessian :: Flag to evaluate the Hessian (second derivatives) */ void SeqDomain::leastSquaresValDerivHessian( - const CostFuncLeastSquares &leastSquares, bool evalDeriv, + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, bool evalHessian) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; @@ -131,8 +132,8 @@ void SeqDomain::leastSquaresValDerivHessian( * @param evalDeriv :: Flag to evaluate the first derivatives * @param evalHessian :: Flag to evaluate the Hessian (second derivatives) */ -void SeqDomain::rwpValDerivHessian(const CostFuncRwp &rwp, bool evalDeriv, - bool evalHessian) { +void SeqDomain::rwpValDerivHessian(const CostFunctions::CostFuncRwp &rwp, + bool evalDeriv, bool evalHessian) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; const size_t n = getNDomains(); diff --git a/Framework/CurveFitting/test/CalculateChiSquaredTest.h b/Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h similarity index 99% rename from Framework/CurveFitting/test/CalculateChiSquaredTest.h rename to Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h index 39fb96307a24056335df98216d80fd5641bf899b..fb29bda4b80738fd99f9a2d89838ab547850f606 100644 --- a/Framework/CurveFitting/test/CalculateChiSquaredTest.h +++ b/Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CalculateChiSquared.h" +#include "MantidCurveFitting/Algorithms/CalculateChiSquared.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionValues.h" @@ -16,7 +16,7 @@ #include <boost/math/special_functions/fpclassify.hpp> #include <limits> -using Mantid::CurveFitting::CalculateChiSquared; +using Mantid::CurveFitting::Algorithms::CalculateChiSquared; using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h b/Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h similarity index 98% rename from Framework/CurveFitting/test/CalculateGammaBackgroundTest.h rename to Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h index d5d7dbf487ae5e8493ce8aba1bb577456be3b310..502479b5f363c09a4312cdab88c88b92e233be80 100644 --- a/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h +++ b/Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CalculateGammaBackground.h" -#include "ComptonProfileTestHelpers.h" +#include "MantidCurveFitting/Algorithms/CalculateGammaBackground.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::CalculateGammaBackground; +using Mantid::CurveFitting::Algorithms::CalculateGammaBackground; class CalculateGammaBackgroundTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/CalculateMSVesuvioTest.h b/Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h similarity index 98% rename from Framework/CurveFitting/test/CalculateMSVesuvioTest.h rename to Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h index 33f7f30b77a0252c38d2c692e8a529ea52de9d9f..f6eefbb0e35fd18579c0e7b04b0cc30398b88512 100644 --- a/Framework/CurveFitting/test/CalculateMSVesuvioTest.h +++ b/Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h @@ -5,7 +5,7 @@ #include "boost/version.hpp" -#include "MantidCurveFitting/CalculateMSVesuvio.h" +#include "MantidCurveFitting/Algorithms/CalculateMSVesuvio.h" #include "MantidGeometry/Instrument/Goniometer.h" #include "MantidGeometry/Instrument/Detector.h" #include "MantidGeometry/Objects/ShapeFactory.h" @@ -13,9 +13,9 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "ComptonProfileTestHelpers.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::CalculateMSVesuvio; +using Mantid::CurveFitting::Algorithms::CalculateMSVesuvio; class CalculateMSVesuvioTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/ConvertToYSpaceTest.h b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h similarity index 96% rename from Framework/CurveFitting/test/ConvertToYSpaceTest.h rename to Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h index a3fed78b8baaa7c85c3ea0b918de70b4c4cc7fa3..839a9202dcdaa6ca483a5d439f97522d1dba0471 100644 --- a/Framework/CurveFitting/test/ConvertToYSpaceTest.h +++ b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ConvertToYSpace.h" -#include "ComptonProfileTestHelpers.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::ConvertToYSpace; +using Mantid::CurveFitting::Algorithms::ConvertToYSpace; class ConvertToYSpaceTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/ConvolveWorkspacesTest.h b/Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h similarity index 92% rename from Framework/CurveFitting/test/ConvolveWorkspacesTest.h rename to Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h index 0e748fa7ad2ea2d13e197185366269ced7bc6c73..fe9dc90f597485b84dc5257466b1ec3f8a180aed 100644 --- a/Framework/CurveFitting/test/ConvolveWorkspacesTest.h +++ b/Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h @@ -5,8 +5,8 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AnalysisDataService.h" -#include "MantidCurveFitting/ConvolveWorkspaces.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/ConvolveWorkspaces.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/TableRow.h" @@ -15,12 +15,13 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/FakeObjects.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/Gaussian.h" using namespace Mantid; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; class ConvolveWorkspacesTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/EstimatePeakErrorsTest.h b/Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h similarity index 98% rename from Framework/CurveFitting/test/EstimatePeakErrorsTest.h rename to Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h index 3ea8b1328cfa5098cdffdc2af7219645d00b2a4f..04baa92e562d387740477077d681853d54945792 100644 --- a/Framework/CurveFitting/test/EstimatePeakErrorsTest.h +++ b/Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/EstimatePeakErrors.h" +#include "MantidCurveFitting/Algorithms/EstimatePeakErrors.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/AnalysisDataService.h" @@ -19,6 +19,7 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; using namespace WorkspaceCreationHelper; class EstimatePeakErrorsTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/EvaluateFunctionTest.h b/Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h similarity index 98% rename from Framework/CurveFitting/test/EvaluateFunctionTest.h rename to Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h index 22e8a5aac0777d3003c7215b26ff7a1eb1f1f18f..cf8b80f4d991cbd76fe4a197c039c5eea0e15e6f 100644 --- a/Framework/CurveFitting/test/EvaluateFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/EvaluateFunction.h" +#include "MantidCurveFitting/Algorithms/EvaluateFunction.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FunctionFactory.h" @@ -15,7 +15,7 @@ #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/EmptyValues.h" -using Mantid::CurveFitting::EvaluateFunction; +using Mantid::CurveFitting::Algorithms::EvaluateFunction; using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/CurveFitting/test/FitPowderDiffPeaksTest.h b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h similarity index 99% rename from Framework/CurveFitting/test/FitPowderDiffPeaksTest.h rename to Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h index ffc3aa2b5be75b21602fda724cfd7ee954fd182e..2eea28afa5bc7c29710dadd82f362ece62d132fb 100644 --- a/Framework/CurveFitting/test/FitPowderDiffPeaksTest.h +++ b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FitPowderDiffPeaks.h" +#include "MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h" #include "MantidDataHandling/LoadAscii.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidDataObjects/Workspace2D.h" @@ -11,7 +11,7 @@ #include "MantidAPI/TableRow.h" #include <fstream> -using Mantid::CurveFitting::FitPowderDiffPeaks; +using Mantid::CurveFitting::Algorithms::FitPowderDiffPeaks; using namespace std; using namespace Mantid; @@ -32,7 +32,7 @@ public: /** Test init */ void test_Init() { - CurveFitting::FitPowderDiffPeaks alg; + Algorithms::FitPowderDiffPeaks alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); diff --git a/Framework/CurveFitting/test/FitTest.h b/Framework/CurveFitting/test/Algorithms/FitTest.h similarity index 98% rename from Framework/CurveFitting/test/FitTest.h rename to Framework/CurveFitting/test/Algorithms/FitTest.h index d4ce164b49008fd56dfc082016524bab1e9a7743..94b27088b284b5188b077158fe2d7ab871c110f7 100644 --- a/Framework/CurveFitting/test/FitTest.h +++ b/Framework/CurveFitting/test/Algorithms/FitTest.h @@ -7,11 +7,12 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/IFuncMinimizer.h" #include "MantidAPI/FuncMinimizerFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "FitTestHelpers.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::API; namespace { diff --git a/Framework/CurveFitting/test/FitTestHelpers.h b/Framework/CurveFitting/test/Algorithms/FitTestHelpers.h similarity index 100% rename from Framework/CurveFitting/test/FitTestHelpers.h rename to Framework/CurveFitting/test/Algorithms/FitTestHelpers.h diff --git a/Framework/CurveFitting/test/LeBailFitTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h similarity index 99% rename from Framework/CurveFitting/test/LeBailFitTest.h rename to Framework/CurveFitting/test/Algorithms/LeBailFitTest.h index 0a680a21882ea35e5dd8b40b6be94e28635dc523..363ef9c91010ca6812518c889f784cbca4f3f335 100644 --- a/Framework/CurveFitting/test/LeBailFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h @@ -5,7 +5,7 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include "MantidCurveFitting/LeBailFit.h" +#include "MantidCurveFitting/Algorithms/LeBailFit.h" #include "MantidDataHandling/LoadAscii.h" #include <fstream> @@ -28,7 +28,7 @@ using namespace WorkspaceCreationHelper; using namespace std; -using Mantid::CurveFitting::LeBailFit; +using Mantid::CurveFitting::Algorithms::LeBailFit; class LeBailFitTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h similarity index 99% rename from Framework/CurveFitting/test/LeBailFunctionTest.h rename to Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h index c4f22cd43abfd1af0e8d693dfe58b3d07a6968f8..3c0fbdc897d010019117c62fe14533fb34c997a9 100644 --- a/Framework/CurveFitting/test/LeBailFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h @@ -7,10 +7,11 @@ #include "MantidKernel/System.h" #include <fstream> -#include "MantidCurveFitting/LeBailFunction.h" +#include "MantidCurveFitting/Algorithms/LeBailFunction.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::API; using namespace std; diff --git a/Framework/CurveFitting/test/NormaliseByPeakAreaTest.h b/Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h similarity index 98% rename from Framework/CurveFitting/test/NormaliseByPeakAreaTest.h rename to Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h index 42e26ed2efc5fbadba4d4a247a2dcb7b48351e0d..30d27a5a9b32834fae81aba7fc65f4d3fd6e56a3 100644 --- a/Framework/CurveFitting/test/NormaliseByPeakAreaTest.h +++ b/Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/NormaliseByPeakArea.h" -#include "ComptonProfileTestHelpers.h" +#include "MantidCurveFitting/Algorithms/NormaliseByPeakArea.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::NormaliseByPeakArea; +using Mantid::CurveFitting::Algorithms::NormaliseByPeakArea; class NormaliseByPeakAreaTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/PawleyFitTest.h b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h similarity index 98% rename from Framework/CurveFitting/test/PawleyFitTest.h rename to Framework/CurveFitting/test/Algorithms/PawleyFitTest.h index 3c99605f3d889689ca20cd3a8f375a4c09f0a93f..1766df896cd2ddba7d2486f7210f2496a25dd0fd 100644 --- a/Framework/CurveFitting/test/PawleyFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PawleyFit.h" +#include "MantidCurveFitting/Algorithms/PawleyFit.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/TableRow.h" @@ -11,8 +11,8 @@ #include "MantidKernel/V3D.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -using Mantid::CurveFitting::PawleyFit; -using Mantid::CurveFitting::V3DFromHKLColumnExtractor; +using Mantid::CurveFitting::Algorithms::PawleyFit; +using Mantid::CurveFitting::Algorithms::V3DFromHKLColumnExtractor; using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Framework/CurveFitting/test/PlotPeakByLogValueTest.h b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h similarity index 99% rename from Framework/CurveFitting/test/PlotPeakByLogValueTest.h rename to Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h index 03947a4ae12f68f9ef830eeab19346b35e5fa4f7..9fb02f3eff1711f19136fd8add1b58a3658e50b4 100644 --- a/Framework/CurveFitting/test/PlotPeakByLogValueTest.h +++ b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PlotPeakByLogValue.h" +#include "MantidCurveFitting/Algorithms/PlotPeakByLogValue.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" @@ -26,6 +26,7 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; typedef Mantid::DataObjects::Workspace2D_sptr WS_type; typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type; diff --git a/Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h similarity index 99% rename from Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h rename to Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h index a77678e9ebccb2dae4462d4d8d0611b4fc1c4f26..dedf1a1c02d6251cc27152f26dde9d4820c39563 100644 --- a/Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/RefinePowderInstrumentParameters3.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -12,7 +12,7 @@ #include <fstream> -using Mantid::CurveFitting::RefinePowderInstrumentParameters3; +using Mantid::CurveFitting::Algorithms::RefinePowderInstrumentParameters3; using namespace Mantid; using namespace Mantid::DataObjects; diff --git a/Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h similarity index 98% rename from Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h rename to Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index 421e4728d18724aff5a18509d3079997d7af5c81..fccdacb20db30175b3a3fa7c457b9ca9d9cbff43 100644 --- a/Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -3,14 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/RefinePowderInstrumentParameters.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" #include <fstream> -using Mantid::CurveFitting::RefinePowderInstrumentParameters; +using Mantid::CurveFitting::Algorithms::RefinePowderInstrumentParameters; using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; @@ -153,7 +153,7 @@ public: geomparamws); // 2. Set up algorithm parameters - CurveFitting::RefinePowderInstrumentParameters alg; + RefinePowderInstrumentParameters alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); @@ -236,7 +236,7 @@ public: geomparamws); // 2. Set up algorithm parameters - CurveFitting::RefinePowderInstrumentParameters alg; + RefinePowderInstrumentParameters alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); diff --git a/Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h similarity index 99% rename from Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h rename to Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h index 4cf5c605467e89f40040a1d00da1b3cea7d9b196..077ca4fd6b7d0e7eaf1743731055c1fa0de27f03 100644 --- a/Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h +++ b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h @@ -10,7 +10,7 @@ #include "MantidAPI/IFunction1DSpectrum.h" #include "MantidAPI/ParamFunction.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/FunctionFactory.h" @@ -20,6 +20,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; class SeqDomainSpectrumCreatorTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/SplineBackgroundTest.h b/Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h similarity index 96% rename from Framework/CurveFitting/test/SplineBackgroundTest.h rename to Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h index 935ed917426390465f5b952deb4f385aba20c967..4608bff0880d02351a3143f238691427d8a7896f 100644 --- a/Framework/CurveFitting/test/SplineBackgroundTest.h +++ b/Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h @@ -2,7 +2,7 @@ #define SPLINEBACKGROUNDTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SplineBackground.h" +#include "MantidCurveFitting/Algorithms/SplineBackground.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/MatrixWorkspace.h" diff --git a/Framework/CurveFitting/test/SplineInterpolationTest.h b/Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h similarity index 97% rename from Framework/CurveFitting/test/SplineInterpolationTest.h rename to Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h index 43b5adc90e74c081932edbe431ce6a50dcd11081..e55dc97c987ca523d7b8ac445a20e1c9ea1e0f2e 100644 --- a/Framework/CurveFitting/test/SplineInterpolationTest.h +++ b/Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h @@ -3,12 +3,12 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SplineInterpolation.h" +#include "MantidCurveFitting/Algorithms/SplineInterpolation.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/NumericAxis.h" #include "MantidAPI/TextAxis.h" -using Mantid::CurveFitting::SplineInterpolation; +using Mantid::CurveFitting::Algorithms::SplineInterpolation; using namespace Mantid::API; class SplineInterpolationTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/SplineSmoothingTest.h b/Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h similarity index 96% rename from Framework/CurveFitting/test/SplineSmoothingTest.h rename to Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h index cc28ba8c4361c88f6d91c53231d3120d033fdc9b..bc88af1750e9c0de3be3a6940fd5c9667859b100 100644 --- a/Framework/CurveFitting/test/SplineSmoothingTest.h +++ b/Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h @@ -4,9 +4,9 @@ #include <cxxtest/TestSuite.h> #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidCurveFitting/SplineSmoothing.h" +#include "MantidCurveFitting/Algorithms/SplineSmoothing.h" -using Mantid::CurveFitting::SplineSmoothing; +using Mantid::CurveFitting::Algorithms::SplineSmoothing; class SplineSmoothingTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/CompositeFunctionTest.h b/Framework/CurveFitting/test/CompositeFunctionTest.h index 9ee2946430933592a048a59e1f179eee728fcb8a..62a5cc3a1e5a15205b4504fafbb040b3f1543b75 100644 --- a/Framework/CurveFitting/test/CompositeFunctionTest.h +++ b/Framework/CurveFitting/test/CompositeFunctionTest.h @@ -5,7 +5,7 @@ #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" @@ -13,12 +13,12 @@ #include "MantidKernel/ConfigService.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidCurveFitting/SimplexMinimizer.h" -#include "MantidCurveFitting/BFGS_Minimizer.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidCurveFitting/GSLJacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -28,6 +28,10 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; typedef Mantid::DataObjects::Workspace2D_sptr WS_type; typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type; diff --git a/Framework/CurveFitting/test/BoundaryConstraintTest.h b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h similarity index 95% rename from Framework/CurveFitting/test/BoundaryConstraintTest.h rename to Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h index e23d1847af1eadd572844b8ece762178eb6588c5..6e340def5735e36eb437735f2ef22b333dbe501e 100644 --- a/Framework/CurveFitting/test/BoundaryConstraintTest.h +++ b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -15,6 +15,8 @@ using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; class BoundaryConstraintTest : public CxxTest::TestSuite { public: @@ -39,7 +41,7 @@ public: TS_ASSERT(bc.hasUpper()); BoundaryConstraint bc2; - ; + bc2.reset(&gaus, 2); bc2.setBounds(10, 20); diff --git a/Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h b/Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h similarity index 95% rename from Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h rename to Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h index 7604eac76910549eb1946377693e565aed930d03..6b79954f49eac2fdc6c250fb04dec93e158ad58b 100644 --- a/Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h +++ b/Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h @@ -5,11 +5,11 @@ #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/CostFuncUnweightedLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h" #include <boost/make_shared.hpp> -using Mantid::CurveFitting::CostFuncUnweightedLeastSquares; +using Mantid::CurveFitting::CostFunctions::CostFuncUnweightedLeastSquares; using namespace Mantid::API; class CostFuncUnweightedLeastSquaresTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/LeastSquaresTest.h b/Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h similarity index 94% rename from Framework/CurveFitting/test/LeastSquaresTest.h rename to Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h index 3f49a8cb1103c33ff00f0a512d4b4bd3f1a26417..425d34058f918ca2c14b4cd84a90a9fe86ded20b 100644 --- a/Framework/CurveFitting/test/LeastSquaresTest.h +++ b/Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h @@ -3,24 +3,27 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/CostFuncRwp.h" -#include "MantidCurveFitting/SimplexMinimizer.h" -#include "MantidCurveFitting/BFGS_Minimizer.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h" +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include <gsl/gsl_blas.h> #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class LeastSquaresTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/FitMWTest.h b/Framework/CurveFitting/test/FitMWTest.h index 78782f80d0678cdc1fd95ae41b4ca82ae54c3d68..00f938a976097564634c962ab59e1d74bf45e6a0 100644 --- a/Framework/CurveFitting/test/FitMWTest.h +++ b/Framework/CurveFitting/test/FitMWTest.h @@ -5,13 +5,13 @@ #include "MantidTestHelpers/FakeObjects.h" #include "MantidCurveFitting/FitMW.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidCurveFitting/SeqDomain.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Polynomial.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Polynomial.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FrameworkManager.h" @@ -29,6 +29,8 @@ using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class FitMWTest : public CxxTest::TestSuite { @@ -51,7 +53,7 @@ public: fun->setParameter("Height", 1.); fun->setParameter("Lifetime", 1.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setProperty("Function", fun); @@ -159,7 +161,7 @@ public: fun->setParameter("Height", 1.); fun->setParameter("Lifetime", 1.); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setProperty("Function", fun); diff --git a/Framework/CurveFitting/test/BFGSTest.h b/Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h similarity index 94% rename from Framework/CurveFitting/test/BFGSTest.h rename to Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h index f0c03cb3e3792a1e600f9eaacdb761c0d10fcacf..0343e6677710560c70b4180980c6f01dfda4cbb2 100644 --- a/Framework/CurveFitting/test/BFGSTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class BFGSTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/DampingMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h similarity index 95% rename from Framework/CurveFitting/test/DampingMinimizerTest.h rename to Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h index 61ce4aa560fc51076541d6c0ea00f39367759c01..1e8d08c13f590156ab50f463a09e6ea4e3714271 100644 --- a/Framework/CurveFitting/test/DampingMinimizerTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h @@ -3,17 +3,21 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/DampingMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class DampingMinimizerTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/FABADAMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h similarity index 94% rename from Framework/CurveFitting/test/FABADAMinimizerTest.h rename to Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h index 29b304014ebc1c720151f74adc0cfdae6d961be1..73f6508f42790dfc83079c5dcf4796ff14c0bf6b 100644 --- a/Framework/CurveFitting/test/FABADAMinimizerTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h @@ -3,20 +3,22 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FABADAMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/AlgorithmManager.h" -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include "MantidKernel/PropertyManager.h" #include "MantidTestHelpers/FakeObjects.h" #include "MantidKernel/Exception.h" -using Mantid::CurveFitting::FABADAMinimizer; +using Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer; using namespace Mantid::API; using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; class FABADAMinimizerTest : public CxxTest::TestSuite { public: @@ -34,7 +36,7 @@ public: fun->setParameter("Height", 8.); fun->setParameter("Lifetime", 1.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setRethrows(true); @@ -143,7 +145,7 @@ public: fun->setParameter("Height", 1.); fun->setParameter("Lifetime", 1.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setRethrows(true); diff --git a/Framework/CurveFitting/test/FRConjugateGradientTest.h b/Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h similarity index 94% rename from Framework/CurveFitting/test/FRConjugateGradientTest.h rename to Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h index 34028a02dd1213cb225a4deb8173f35f9de845e1..12629afb2dbd101ef72e3d9cbea61a74c1c13698 100644 --- a/Framework/CurveFitting/test/FRConjugateGradientTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class FRConjugateGradientTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/LevenbergMarquardtMDTest.h b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h similarity index 95% rename from Framework/CurveFitting/test/LevenbergMarquardtMDTest.h rename to Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h index 93ae0e5dd0a8c4fbe019e61fd35211a07ad5aadd..edaeec639e087ddf475094d1d23c41b66cccb0ea 100644 --- a/Framework/CurveFitting/test/LevenbergMarquardtMDTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h @@ -3,17 +3,21 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class LevenbergMarquardtMDTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/LevenbergMarquardtTest.h b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h similarity index 95% rename from Framework/CurveFitting/test/LevenbergMarquardtTest.h rename to Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h index 30a690d98b9fd530976cf180cb1616a2461c7a0b..359712feb5f798bacd3398eb7e15d1193dac7f58 100644 --- a/Framework/CurveFitting/test/LevenbergMarquardtTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h @@ -3,17 +3,21 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/LevenbergMarquardtMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class LevenbergMarquardtTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/PRConjugateGradientTest.h b/Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h similarity index 94% rename from Framework/CurveFitting/test/PRConjugateGradientTest.h rename to Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h index b5a8a910e1492319ec72a65f5f6d2d8a0e7d2cdd..6f250d93aa4a3ff039555979831aac6ca411556b 100644 --- a/Framework/CurveFitting/test/PRConjugateGradientTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class PRConjugateGradientTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/SimplexTest.h b/Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h similarity index 93% rename from Framework/CurveFitting/test/SimplexTest.h rename to Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h index 95811e161315ccb4ef59c832762cc5b792392a31..6edf55ccb183f24d904837fcf25fcd9021132fc0 100644 --- a/Framework/CurveFitting/test/SimplexTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SimplexMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class SimplexTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h b/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h index c7f60ebf936da427adc02bfe5a1b4a01c6b27288..699b840af67808e1503a8155ce93469c96282a33 100644 --- a/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h +++ b/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h @@ -9,13 +9,14 @@ #include "MantidAPI/FunctionParameterDecorator.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include <boost/make_shared.hpp> using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; class FunctionParameterDecoratorFitTest; diff --git a/Framework/CurveFitting/test/AbragamTest.h b/Framework/CurveFitting/test/Functions/AbragamTest.h similarity index 91% rename from Framework/CurveFitting/test/AbragamTest.h rename to Framework/CurveFitting/test/Functions/AbragamTest.h index 342eb7360e7b6942a94cd021848e1f6d4e67c333..387926477b7d2f73b443265d2ce80dfafbcd571c 100644 --- a/Framework/CurveFitting/test/AbragamTest.h +++ b/Framework/CurveFitting/test/Functions/AbragamTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Abragam.h" +#include "MantidCurveFitting/Functions/Abragam.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class AbragamTest : public CxxTest::TestSuite { @@ -54,7 +56,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/BSplineTest.h b/Framework/CurveFitting/test/Functions/BSplineTest.h similarity index 96% rename from Framework/CurveFitting/test/BSplineTest.h rename to Framework/CurveFitting/test/Functions/BSplineTest.h index b71c15a4ae356f0c2b8cc7afba484930f1b84e53..a504230e745db1cdc97040a74e634ad084a9351a 100644 --- a/Framework/CurveFitting/test/BSplineTest.h +++ b/Framework/CurveFitting/test/Functions/BSplineTest.h @@ -1,10 +1,10 @@ #ifndef BSPLINETEST_H_ #define BSPLINETEST_H_ -#include "MantidCurveFitting/BSpline.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/Functions/BSpline.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/FunctionFactory.h" @@ -15,6 +15,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::CostFunctions; class BSplineTest : public CxxTest::TestSuite { public: @@ -344,7 +346,7 @@ private: boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares); costFun->setFittingFunction(bsp, domain, values); - LevenbergMarquardtMDMinimizer s; + FuncMinimisers::LevenbergMarquardtMDMinimizer s; s.initialize(costFun); TS_ASSERT(s.minimize()); return costFun->val(); diff --git a/Framework/CurveFitting/test/BackToBackExponentialTest.h b/Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h similarity index 97% rename from Framework/CurveFitting/test/BackToBackExponentialTest.h rename to Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h index bd30cef1e0906c2d5374fcd99603e57df1b73c4e..764131715ec7f1abb6e84a8ea97b90920846d6a7 100644 --- a/Framework/CurveFitting/test/BackToBackExponentialTest.h +++ b/Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h @@ -3,13 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include <cmath> -using Mantid::CurveFitting::BackToBackExponential; +using Mantid::CurveFitting::Functions::BackToBackExponential; namespace { /** diff --git a/Framework/CurveFitting/test/BivariateNormalTest.h b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h similarity index 98% rename from Framework/CurveFitting/test/BivariateNormalTest.h rename to Framework/CurveFitting/test/Functions/BivariateNormalTest.h index 9645cd95927d825c4400c83f291f898497ae93a9..c169d9787aa554cdd55bc0a05c1333a376ec90a9 100644 --- a/Framework/CurveFitting/test/BivariateNormalTest.h +++ b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h @@ -9,7 +9,7 @@ #define BIVARIATENORMALTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BivariateNormal.h" +#include "MantidCurveFitting/Functions/BivariateNormal.h" #include "MantidKernel/Matrix.h" #include "MantidAPI/Jacobian.h" #include "MantidAPI/WorkspaceFactory.h" @@ -31,6 +31,7 @@ using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; /** * Used for testing only */ diff --git a/Framework/CurveFitting/test/Bk2BkExpConvPVTest.h b/Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h similarity index 96% rename from Framework/CurveFitting/test/Bk2BkExpConvPVTest.h rename to Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h index 46cb015c0f921e2af7a4bcf3accee7348be2bafb..95fe716309da8ae2f705171fdcb9efde9d0f810e 100644 --- a/Framework/CurveFitting/test/Bk2BkExpConvPVTest.h +++ b/Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h @@ -6,13 +6,15 @@ #include "MantidKernel/System.h" #include <fstream> -#include "MantidCurveFitting/Bk2BkExpConvPV.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Bk2BkExpConvPV.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class Bk2BkExpConvPVTest : public CxxTest::TestSuite { @@ -156,7 +158,7 @@ public: << std::endl; // 3. Set fit - Fit fitalg; + Algorithms::Fit fitalg; fitalg.initialize(); TS_ASSERT(fitalg.isInitialized()); diff --git a/Framework/CurveFitting/test/ChebfunBaseTest.h b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h similarity index 98% rename from Framework/CurveFitting/test/ChebfunBaseTest.h rename to Framework/CurveFitting/test/Functions/ChebfunBaseTest.h index 0d2a8fb5fefc059bcf34a1f666c8419caaaba3ed..175fa53033dff71443d3260d7d825f4f89c94d51 100644 --- a/Framework/CurveFitting/test/ChebfunBaseTest.h +++ b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h @@ -3,12 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" #include <cmath> using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; double Sin(double x) { return sin(x); } double MinusSin(double x) { return -sin(x); } diff --git a/Framework/CurveFitting/test/ChebyshevTest.h b/Framework/CurveFitting/test/Functions/ChebyshevTest.h similarity index 94% rename from Framework/CurveFitting/test/ChebyshevTest.h rename to Framework/CurveFitting/test/Functions/ChebyshevTest.h index 7cad35f6467b458528ae24878517dd66a89ad8c8..2602cc30011f506b35969d80ec4fbc5d25a0265a 100644 --- a/Framework/CurveFitting/test/ChebyshevTest.h +++ b/Framework/CurveFitting/test/Functions/ChebyshevTest.h @@ -3,8 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Chebyshev.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Chebyshev.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AnalysisDataService.h" @@ -14,6 +14,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; class ChebyshevTest : public CxxTest::TestSuite { public: @@ -59,7 +61,7 @@ public: Chebyshev cheb; cheb.setAttributeValue("n", 3); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", cheb.asString()); @@ -116,7 +118,7 @@ public: cheb.setAttributeValue("StartX", -10.0); cheb.setAttributeValue("EndX", 10.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", cheb.asString()); diff --git a/Framework/CurveFitting/test/ComptonPeakProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h similarity index 95% rename from Framework/CurveFitting/test/ComptonPeakProfileTest.h rename to Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h index b66b087aa802c527caca4a6d8e1fd330d5e621b6..1d5a8488d99c3a143fd1ed5df9d99c4d97e3a7e6 100644 --- a/Framework/CurveFitting/test/ComptonPeakProfileTest.h +++ b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ComptonPeakProfile.h" +#include "MantidCurveFitting/Functions/ComptonPeakProfile.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::ComptonPeakProfile; +using Mantid::CurveFitting::Functions::ComptonPeakProfile; class ComptonPeakProfileTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/ComptonProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h similarity index 95% rename from Framework/CurveFitting/test/ComptonProfileTest.h rename to Framework/CurveFitting/test/Functions/ComptonProfileTest.h index f1a33b8d848929d5101ef39af333cc2e05d9e482..2d21d6981cac2ea1c2bdd06f2e744938371e4cf7 100644 --- a/Framework/CurveFitting/test/ComptonProfileTest.h +++ b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" #include <boost/make_shared.hpp> -using Mantid::CurveFitting::ComptonProfile; +using Mantid::CurveFitting::Functions::ComptonProfile; class ComptonProfileTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/ComptonProfileTestHelpers.h b/Framework/CurveFitting/test/Functions/ComptonProfileTestHelpers.h similarity index 100% rename from Framework/CurveFitting/test/ComptonProfileTestHelpers.h rename to Framework/CurveFitting/test/Functions/ComptonProfileTestHelpers.h diff --git a/Framework/CurveFitting/test/ComptonScatteringCountRateTest.h b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h similarity index 97% rename from Framework/CurveFitting/test/ComptonScatteringCountRateTest.h rename to Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h index 714776b1bef083fc29139c04106ce15933024a16..a9fe90bd3babc3a60a9d8cf51350bd93db538fe3 100644 --- a/Framework/CurveFitting/test/ComptonScatteringCountRateTest.h +++ b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h @@ -2,9 +2,12 @@ #define MANTID_CURVEFITTING_COMPTONSCATTERINGCOUNTRATETEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ComptonScatteringCountRate.h" +#include "MantidCurveFitting/Functions/ComptonScatteringCountRate.h" #include "ComptonProfileTestHelpers.h" +using Mantid::CurveFitting::Functions::ComptonScatteringCountRate; +using Mantid::CurveFitting::Functions::ComptonProfile; + class ComptonScatteringCountRateTest : public CxxTest::TestSuite { public: // This pair of boilerplate methods prevent the suite being created statically @@ -209,7 +212,7 @@ public: private: /// A simple working object to use for the testing /// Provides a canned answer of 1 for the massProfile - class ComptonProfileStub : public Mantid::CurveFitting::ComptonProfile { + class ComptonProfileStub : public ComptonProfile { public: ComptonProfileStub() : ComptonProfile() { declareParameter("Width", 1.0); @@ -289,7 +292,7 @@ private: return func; } - boost::shared_ptr<Mantid::CurveFitting::ComptonScatteringCountRate> + boost::shared_ptr<ComptonScatteringCountRate> createFunctionNoBackground(const bool useTwoIntensityFuncAsFirst = false) { boost::shared_ptr<ComptonProfileStub> func1; if (useTwoIntensityFuncAsFirst) { @@ -310,7 +313,6 @@ private: func2->setParameter("Width", 10.0); func2->setParameter("Intensity", 3.0); - using Mantid::CurveFitting::ComptonScatteringCountRate; auto profile = boost::make_shared<ComptonScatteringCountRate>(); profile->initialize(); profile->addFunction(func1); @@ -321,7 +323,6 @@ private: } Mantid::API::IFunction_sptr createFunction() { - using Mantid::CurveFitting::ComptonScatteringCountRate; auto profile = boost::make_shared<ComptonScatteringCountRate>(); profile->initialize(); diff --git a/Framework/CurveFitting/test/ConvolutionTest.h b/Framework/CurveFitting/test/Functions/ConvolutionTest.h similarity index 98% rename from Framework/CurveFitting/test/ConvolutionTest.h rename to Framework/CurveFitting/test/Functions/ConvolutionTest.h index 222e87689568f9c6e3885b24b2b446fcb3c727d6..21c97b9b390e28361bbb123333158d45c82abf6d 100644 --- a/Framework/CurveFitting/test/ConvolutionTest.h +++ b/Framework/CurveFitting/test/Functions/ConvolutionTest.h @@ -5,8 +5,8 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AnalysisDataService.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/IPeakFunction.h" @@ -21,6 +21,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; typedef Mantid::DataObjects::Workspace2D_sptr WS_type; typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type; @@ -406,7 +408,7 @@ public: conv->setParameter("f1.h", 1); conv->setParameter("f1.w", 1); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", conv->asString()); @@ -424,7 +426,7 @@ public: 0.1, fabs(out->getParameter("f1.w") - conv->getParameter("f1.w"))); conv->setAttributeValue("FixResolution", false); - Fit fit1; + Algorithms::Fit fit1; fit1.initialize(); fit1.setProperty("Function", boost::dynamic_pointer_cast<IFunction>(conv)); fit1.setProperty("InputWorkspace", data); diff --git a/Framework/CurveFitting/test/CubicSplineTest.h b/Framework/CurveFitting/test/Functions/CubicSplineTest.h similarity index 97% rename from Framework/CurveFitting/test/CubicSplineTest.h rename to Framework/CurveFitting/test/Functions/CubicSplineTest.h index f9a21e89591d04d0afa1c2943e88446a098a47e0..f90d200345fe5ffece9b81c38ba57583f84135e9 100644 --- a/Framework/CurveFitting/test/CubicSplineTest.h +++ b/Framework/CurveFitting/test/Functions/CubicSplineTest.h @@ -5,8 +5,8 @@ #include <cmath> #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CubicSpline.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AnalysisDataService.h" @@ -16,6 +16,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; class CubicSplineTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/DeltaFunctionTest.h b/Framework/CurveFitting/test/Functions/DeltaFunctionTest.h similarity index 93% rename from Framework/CurveFitting/test/DeltaFunctionTest.h rename to Framework/CurveFitting/test/Functions/DeltaFunctionTest.h index d6ff22def118eb83ee4bd09828903e1cc5e7ebf6..b7fabe94be69f939f9593a29ee64bf745353847f 100644 --- a/Framework/CurveFitting/test/DeltaFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/DeltaFunctionTest.h @@ -2,10 +2,10 @@ #define DELTAFUNCTIONTEST_H #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" -#include "MantidCurveFitting/DeltaFunction.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/DeltaFunction.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -13,6 +13,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; // same class as ConvolutionTest_Gauss in ConvolutionTest.h class DeltaFunctionTest_Gauss : public IPeakFunction { diff --git a/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h b/Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h similarity index 94% rename from Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h rename to Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h index b6ffb6e4c0ff751c700ef445c3a6cb72a15f52d6..4b8df7d7a42592fafb9a381ecd27f535e01e3fdb 100644 --- a/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h +++ b/Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h @@ -3,10 +3,10 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AlgorithmFactory.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/DiffRotDiscreteCircle.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/DiffRotDiscreteCircle.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -18,6 +18,10 @@ #include <boost/random/uniform_real.hpp> #include <boost/shared_ptr.hpp> +using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; + class DiffRotDiscreteCircleTest : public CxxTest::TestSuite { public: @@ -34,8 +38,7 @@ public: const double w0 = random_value(-1.0, 1.0); const double h = random_value(1.0, 1000.0); const double fwhm = random_value(1.0, 100.0); - boost::shared_ptr<Mantid::CurveFitting::Gaussian> resolution( - new Mantid::CurveFitting::Gaussian()); + boost::shared_ptr<Gaussian> resolution(new Gaussian()); resolution->initialize(); // declare parameters resolution->setCentre(w0); resolution->setHeight(h); @@ -47,16 +50,15 @@ public: const double r = random_value(0.3, 9.8); const double Q = 0.9; const int N = 6; - boost::shared_ptr<Mantid::CurveFitting::ElasticDiffRotDiscreteCircle> - structure_factor( - new Mantid::CurveFitting::ElasticDiffRotDiscreteCircle()); + boost::shared_ptr<ElasticDiffRotDiscreteCircle> structure_factor( + new ElasticDiffRotDiscreteCircle()); structure_factor->setParameter("Height", I); structure_factor->setParameter("Radius", r); structure_factor->setAttributeValue("Q", Q); structure_factor->setAttributeValue("N", N); // initialize the convolution function - Mantid::CurveFitting::Convolution conv; + Convolution conv; conv.addFunction(resolution); conv.addFunction(structure_factor); @@ -124,7 +126,7 @@ public: "9,Intensity=2.9,Radius=2.3,Decay=0.468"; // Do a fit with no iterations - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", funtion_string); @@ -172,7 +174,7 @@ public: const double tao = 0.45; const double Q = 0.7; const int N = 4; - Mantid::CurveFitting::DiffRotDiscreteCircle func; + DiffRotDiscreteCircle func; func.init(); func.setParameter("f1.Intensity", I); func.setParameter("f1.Radius", R); @@ -181,8 +183,7 @@ public: func.setAttributeValue("N", N); // check values where correctly initialized - auto ids = boost::dynamic_pointer_cast< - Mantid::CurveFitting::InelasticDiffRotDiscreteCircle>( + auto ids = boost::dynamic_pointer_cast<InelasticDiffRotDiscreteCircle>( func.getFunction(1)); TS_ASSERT_EQUALS(ids->getParameter("Intensity"), I); TS_ASSERT_EQUALS(ids->getParameter("Radius"), R); @@ -192,8 +193,7 @@ public: // check the ties were applied correctly func.applyTies(); // elastic parameters are tied to inelastic parameters - auto eds = boost::dynamic_pointer_cast< - Mantid::CurveFitting::ElasticDiffRotDiscreteCircle>( + auto eds = boost::dynamic_pointer_cast<ElasticDiffRotDiscreteCircle>( func.getFunction(0)); TS_ASSERT_EQUALS(eds->getParameter("Height"), I); TS_ASSERT_EQUALS(eds->getParameter("Radius"), R); @@ -207,15 +207,14 @@ public: const double tao = 0.45; // This should set parameters of the inelastic part - Mantid::CurveFitting::DiffRotDiscreteCircle func; + DiffRotDiscreteCircle func; func.init(); func.setParameter("Intensity", I); func.setParameter("Radius", R); func.setParameter("Decay", tao); // check the parameter of the inelastic part - auto ifunc = boost::dynamic_pointer_cast< - Mantid::CurveFitting::InelasticDiffRotDiscreteCircle>( + auto ifunc = boost::dynamic_pointer_cast<InelasticDiffRotDiscreteCircle>( func.getFunction(1)); TS_ASSERT_EQUALS(ifunc->getParameter("Intensity"), I); TS_ASSERT_EQUALS(ifunc->getParameter("Radius"), R); @@ -223,8 +222,7 @@ public: // check the parameters of the elastic part func.applyTies(); // elastic parameters are tied to inelastic parameters - auto efunc = boost::dynamic_pointer_cast< - Mantid::CurveFitting::ElasticDiffRotDiscreteCircle>( + auto efunc = boost::dynamic_pointer_cast<ElasticDiffRotDiscreteCircle>( func.getFunction(0)); TS_ASSERT_EQUALS(efunc->getParameter("Height"), I); TS_ASSERT_EQUALS(efunc->getParameter("Radius"), R); @@ -244,7 +242,7 @@ public: "Radius=1.567,Decay=7.567))"; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", funtion_string); @@ -277,8 +275,7 @@ public: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(fitalg_function); Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0); TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), 0.0, 0.00001); // allow for a small percent variation @@ -342,7 +339,7 @@ private: << ",Shift=" << S << ")"; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", function_stream.str()); @@ -384,8 +381,7 @@ private: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(fitalg_function); Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0); TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), 0.0, 0.00001); // allow for a small percent variation @@ -525,7 +521,7 @@ private: // create a data workspace using a Fit algorithm Mantid::DataObjects::Workspace2D_sptr - generateWorkspaceFromFitAlgorithm(Mantid::CurveFitting::Fit &fitalg) { + generateWorkspaceFromFitAlgorithm(Algorithms::Fit &fitalg) { using namespace Mantid::Kernel; using namespace Mantid::Geometry; diff --git a/Framework/CurveFitting/test/DiffSphereTest.h b/Framework/CurveFitting/test/Functions/DiffSphereTest.h similarity index 94% rename from Framework/CurveFitting/test/DiffSphereTest.h rename to Framework/CurveFitting/test/Functions/DiffSphereTest.h index 17d2e95afd9b115fcab90a1a311baa33d63013ab..06807332917f92d65dcc128bff337207ef34e7fa 100644 --- a/Framework/CurveFitting/test/DiffSphereTest.h +++ b/Framework/CurveFitting/test/Functions/DiffSphereTest.h @@ -10,17 +10,21 @@ // Include local copy of Valgrind header to avoid creating a dependency #include "valgrind.h" -#include "MantidCurveFitting/DiffSphere.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/DiffSphere.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AlgorithmFactory.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" #include "MantidTestHelpers/ComponentCreationHelper.h" +using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; + class DiffSphereTest : public CxxTest::TestSuite { public: bool skipTests() { @@ -42,7 +46,7 @@ public: "Sigma=0.002);name=ElasticDiffSphere,Q=0.5,Height=47.014,Radius=3.567)"; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", funtion_string); @@ -82,8 +86,7 @@ public: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(fitalg_function); Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0); TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), 0.0, 0.00001); // allow for a small percent variation @@ -132,16 +135,15 @@ public: // of the 99 coefficients to break down // initialize the elastic part - boost::shared_ptr<Mantid::CurveFitting::ElasticDiffSphere> elastic_part( - new Mantid::CurveFitting::ElasticDiffSphere()); + boost::shared_ptr<ElasticDiffSphere> elastic_part(new ElasticDiffSphere()); elastic_part->setParameter("Height", I); elastic_part->setParameter("Radius", R); elastic_part->setAttributeValue("Q", Q); elastic_part->init(); // initialize the inelastic part - boost::shared_ptr<Mantid::CurveFitting::InelasticDiffSphere> inelastic_part( - new Mantid::CurveFitting::InelasticDiffSphere()); + boost::shared_ptr<InelasticDiffSphere> inelastic_part( + new InelasticDiffSphere()); inelastic_part->setParameter("Intensity", I); inelastic_part->setParameter("Radius", R); inelastic_part->setParameter("Diffusion", D); @@ -185,7 +187,7 @@ public: const double Q(0.5); // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); std::ostringstream funtion_stream; @@ -205,18 +207,15 @@ public: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); // main function fitalg_function->initialize(); - auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); // cast to Convolution + auto fitalg_conv = boost::dynamic_pointer_cast<Convolution>( + fitalg_function); // cast to Convolution fitalg_function = fitalg_conv->getFunction(1); // DiffSphere auto fitalg_structure_factor = - boost::dynamic_pointer_cast<Mantid::CurveFitting::DiffSphere>( - fitalg_function); + boost::dynamic_pointer_cast<DiffSphere>(fitalg_function); fitalg_function = fitalg_structure_factor->getFunction(0); auto fitalg_elastic = - boost::dynamic_pointer_cast<Mantid::CurveFitting::ElasticDiffSphere>( - fitalg_function); + boost::dynamic_pointer_cast<ElasticDiffSphere>(fitalg_function); TS_ASSERT_DELTA(fitalg_elastic->getParameter("Height"), I_0, std::numeric_limits<double>::epsilon()); TS_ASSERT_DELTA(fitalg_elastic->getParameter("Radius"), R_0, @@ -229,8 +228,7 @@ public: fitalg_function = fitalg_structure_factor->getFunction(1); auto fitalg_inelastic = - boost::dynamic_pointer_cast<Mantid::CurveFitting::InelasticDiffSphere>( - fitalg_function); + boost::dynamic_pointer_cast<InelasticDiffSphere>(fitalg_function); TS_ASSERT_DELTA(fitalg_inelastic->getParameter("Intensity"), I_0, std::numeric_limits<double>::epsilon()); TS_ASSERT_DELTA(fitalg_inelastic->getParameter("Radius"), R_0, @@ -331,7 +329,7 @@ private: simQ = 0.20092; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); std::ostringstream funtion_stream; @@ -398,8 +396,7 @@ private: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(fitalg_function); Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0); TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), S, @@ -457,7 +454,7 @@ private: // create a data workspace using a Fit algorithm Mantid::DataObjects::Workspace2D_sptr - generateWorkspaceFromFitAlgorithm(Mantid::CurveFitting::Fit &fitalg) { + generateWorkspaceFromFitAlgorithm(Algorithms::Fit &fitalg) { using namespace Mantid::Kernel; using namespace Mantid::Geometry; diff --git a/Framework/CurveFitting/test/DynamicKuboToyabeTest.h b/Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h similarity index 95% rename from Framework/CurveFitting/test/DynamicKuboToyabeTest.h rename to Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h index cb987b5fc70802662484bb4c949f927c2b696a77..dd533ab427dc806cd9709c3986360e37ded82496 100644 --- a/Framework/CurveFitting/test/DynamicKuboToyabeTest.h +++ b/Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h @@ -3,14 +3,15 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/DynamicKuboToyabe.h" -#include "MantidCurveFitting/StaticKuboToyabe.h" +#include "MantidCurveFitting/Functions/DynamicKuboToyabe.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabe.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; class DynamicKuboToyabeTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/EndErfcTest.h b/Framework/CurveFitting/test/Functions/EndErfcTest.h similarity index 92% rename from Framework/CurveFitting/test/EndErfcTest.h rename to Framework/CurveFitting/test/Functions/EndErfcTest.h index 8e2ba2f3485752e855f833486be3d5dc079979b5..dc03dd49687bc3504fa6fede22461e39bd487145 100644 --- a/Framework/CurveFitting/test/EndErfcTest.h +++ b/Framework/CurveFitting/test/Functions/EndErfcTest.h @@ -3,11 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/EndErfc.h" -#include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/EndErfc.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -16,6 +13,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class EndErfcTest : public CxxTest::TestSuite { @@ -41,7 +40,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ExpDecayMuonTest.h b/Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h similarity index 89% rename from Framework/CurveFitting/test/ExpDecayMuonTest.h rename to Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h index bf17e5d9a7728820700c5cccac72a17cf1b66225..02a079776da1b8fc1632ca1ddc4e09cd632bcaff 100644 --- a/Framework/CurveFitting/test/ExpDecayMuonTest.h +++ b/Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ExpDecayMuon.h" +#include "MantidCurveFitting/Functions/ExpDecayMuon.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -16,6 +16,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class ExpDecayMuonTest : public CxxTest::TestSuite { @@ -48,7 +50,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ExpDecayOscTest.h b/Framework/CurveFitting/test/Functions/ExpDecayOscTest.h similarity index 90% rename from Framework/CurveFitting/test/ExpDecayOscTest.h rename to Framework/CurveFitting/test/Functions/ExpDecayOscTest.h index 865c28d2c1c9811aae3c25d04b01e35ed13e8975..9c91b5e7dccd6734f9deb754062e9da48fcc81a9 100644 --- a/Framework/CurveFitting/test/ExpDecayOscTest.h +++ b/Framework/CurveFitting/test/Functions/ExpDecayOscTest.h @@ -4,9 +4,9 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "MantidCurveFitting/ExpDecayOsc.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/ExpDecayOsc.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -14,6 +14,9 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; using namespace Mantid::DataObjects; class ExpDecayOscTest : public CxxTest::TestSuite { @@ -48,7 +51,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ExpDecayTest.h b/Framework/CurveFitting/test/Functions/ExpDecayTest.h similarity index 90% rename from Framework/CurveFitting/test/ExpDecayTest.h rename to Framework/CurveFitting/test/Functions/ExpDecayTest.h index fbfa2c5a556b69117e0bf3163c16e4b3285a5738..149edd05e1a5ba33f31244e8764be4b53a4c5692 100644 --- a/Framework/CurveFitting/test/ExpDecayTest.h +++ b/Framework/CurveFitting/test/Functions/ExpDecayTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class ExpDecayTest : public CxxTest::TestSuite { @@ -51,7 +53,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/FlatBackgroundTest.h b/Framework/CurveFitting/test/Functions/FlatBackgroundTest.h similarity index 92% rename from Framework/CurveFitting/test/FlatBackgroundTest.h rename to Framework/CurveFitting/test/Functions/FlatBackgroundTest.h index bc0dd6bbe920f081dfd366d54a2a61c04448c220..821dfed7a8478416ac589cca32e44d24e2e87dba 100644 --- a/Framework/CurveFitting/test/FlatBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/FlatBackgroundTest.h @@ -5,10 +5,11 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class FlatBackgroundTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/FullprofPolynomialTest.h b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h similarity index 92% rename from Framework/CurveFitting/test/FullprofPolynomialTest.h rename to Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h index 2ecf9c6d841e358fb2ebab5aaf284bcc245302e2..42b9226a157d35194382d641ca202f57561deb76 100644 --- a/Framework/CurveFitting/test/FullprofPolynomialTest.h +++ b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h @@ -3,17 +3,19 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FullprofPolynomial.h" +#include "MantidCurveFitting/Functions/FullprofPolynomial.h" #include "MantidAPI/IFunction.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" -using Mantid::CurveFitting::FullprofPolynomial; +using Mantid::CurveFitting::Functions::FullprofPolynomial; using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; using namespace Mantid::Kernel; @@ -87,7 +89,7 @@ public: tofbkgd->setParameter("A3", 0.0); // Set up fit - CurveFitting::Fit fitalg; + CurveFitting::Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); diff --git a/Framework/CurveFitting/test/GausDecayTest.h b/Framework/CurveFitting/test/Functions/GausDecayTest.h similarity index 90% rename from Framework/CurveFitting/test/GausDecayTest.h rename to Framework/CurveFitting/test/Functions/GausDecayTest.h index d3a087a5a047ce48be4856fa3eb57ce798df056f..3771d22c694d4c4438d2c3681fb7435e5dc634ac 100644 --- a/Framework/CurveFitting/test/GausDecayTest.h +++ b/Framework/CurveFitting/test/Functions/GausDecayTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/GausDecay.h" +#include "MantidCurveFitting/Functions/GausDecay.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -21,6 +21,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; @@ -52,7 +54,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/GausOscTest.h b/Framework/CurveFitting/test/Functions/GausOscTest.h similarity index 91% rename from Framework/CurveFitting/test/GausOscTest.h rename to Framework/CurveFitting/test/Functions/GausOscTest.h index 434cf9ba475c4eb988b4c6239aeedc90c829b9b3..0e31dc9c702bb0f9a5499f3a7ffcceaf22dd8d86 100644 --- a/Framework/CurveFitting/test/GausOscTest.h +++ b/Framework/CurveFitting/test/Functions/GausOscTest.h @@ -4,11 +4,11 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "MantidCurveFitting/GausOsc.h" +#include "MantidCurveFitting/Functions/GausOsc.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -22,6 +22,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; @@ -57,7 +59,7 @@ public: void testAgainstMockData() // Parts of test disabled because it does not give // result like that obtained in mantidplot. { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/GaussianComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h similarity index 94% rename from Framework/CurveFitting/test/GaussianComptonProfileTest.h rename to Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h index 546dd4a9de2cb7c9d032fbff41062962064a02c6..dfec3f0af151f71660962a523f453ec815eb1a96 100644 --- a/Framework/CurveFitting/test/GaussianComptonProfileTest.h +++ b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h @@ -2,12 +2,13 @@ #define MANTID_CURVEFITTING_GAUSSIANCOMPTONPROFILETEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/GaussianComptonProfile.h" +#include "MantidCurveFitting/Functions/GaussianComptonProfile.h" #include "MantidAPI/FunctionDomain1D.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::GaussianComptonProfile; +using Mantid::CurveFitting::Functions::GaussianComptonProfile; +using Mantid::CurveFitting::Functions::ComptonProfile; class GaussianComptonProfileTest : public CxxTest::TestSuite { public: @@ -40,8 +41,7 @@ public: } void test_Function_Has_One_Intensity_Coefficient() { - boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile = - createFunction(); + boost::shared_ptr<ComptonProfile> profile = createFunction(); auto intensityIndices = profile->intensityParameterIndices(); TS_ASSERT_EQUALS(1, intensityIndices.size()); diff --git a/Framework/CurveFitting/test/GaussianTest.h b/Framework/CurveFitting/test/Functions/GaussianTest.h similarity index 95% rename from Framework/CurveFitting/test/GaussianTest.h rename to Framework/CurveFitting/test/Functions/GaussianTest.h index 91492c50f5ab2aa2bd0da295408e010fec8d0561..079292914546c5b19922438bcc98aab4ab79b476 100644 --- a/Framework/CurveFitting/test/GaussianTest.h +++ b/Framework/CurveFitting/test/Functions/GaussianTest.h @@ -3,11 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/InstrumentDataService.h" @@ -23,14 +22,19 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; @@ -201,7 +205,7 @@ public: costFun->setFittingFunction(fnWithBk, domain, values); // TS_ASSERT_EQUALS(costFun->nParams(),3); - LevenbergMarquardtMDMinimizer s; + FuncMinimisers::LevenbergMarquardtMDMinimizer s; s.initialize(costFun); TS_ASSERT(s.minimize()); @@ -236,7 +240,7 @@ public: TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D)); // Initialise algorithm - Fit alg; + Algorithms::Fit alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); @@ -305,7 +309,7 @@ public: Mantid::MantidVec &e = ws2D->dataE(0); // error values of counts getMockData(y, e); - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); @@ -358,7 +362,7 @@ public: // put this workspace in the data service TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D)); - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); @@ -424,7 +428,7 @@ public: ConfigService::Instance().getString("curvefitting.peakRadius"); ConfigService::Instance().setString("curvefitting.peakRadius", "5"); - Fit alg; + Algorithms::Fit alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); diff --git a/Framework/CurveFitting/test/GramCharlierComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h similarity index 94% rename from Framework/CurveFitting/test/GramCharlierComptonProfileTest.h rename to Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h index 8220bfd74ed2e60ec30d4ada2ee6b3282141622a..905278a19172c6d03ee6b237f972058c2da5d16a 100644 --- a/Framework/CurveFitting/test/GramCharlierComptonProfileTest.h +++ b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h @@ -2,11 +2,12 @@ #define MANTID_CURVEFITTING_GRAMCHARLIERCOMPTONPROFILETEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/GramCharlierComptonProfile.h" +#include "MantidCurveFitting/Functions/GramCharlierComptonProfile.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::GramCharlierComptonProfile; +using Mantid::CurveFitting::Functions::ComptonProfile; +using Mantid::CurveFitting::Functions::GramCharlierComptonProfile; class GramCharlierComptonProfileTest : public CxxTest::TestSuite { public: @@ -58,8 +59,7 @@ public: void test_Function_Returns_Same_Number_Intensity_Coefficents_As_Active_Hermite_Coefficients_If_KFSE_Is_Fixed() { - boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile = - createFunction(); + boost::shared_ptr<ComptonProfile> profile = createFunction(); profile->setAttributeValue("HermiteCoeffs", "1 0 1"); // turn on C_0 & C_4 profile->fix(profile->parameterIndex("FSECoeff")); @@ -69,8 +69,7 @@ public: void test_Function_Returns_Same_Number_Intensity_Coefficents_As_Active_Hermite_Coefficients_Plus_One_If_KFSE_Is_Free() { - boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile = - createFunction(); + boost::shared_ptr<ComptonProfile> profile = createFunction(); profile->setAttributeValue("HermiteCoeffs", "1 0 1"); // turn on C_0 & C_4 auto intensityIndices = profile->intensityParameterIndices(); diff --git a/Framework/CurveFitting/test/IkedaCarpenterPVTest.h b/Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h similarity index 96% rename from Framework/CurveFitting/test/IkedaCarpenterPVTest.h rename to Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h index 53cc7b2f7d9a362e1915efffd4cfeb308c8be2b9..df2182987c94074e520b9ee41fedffc68bff08f7 100644 --- a/Framework/CurveFitting/test/IkedaCarpenterPVTest.h +++ b/Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h @@ -3,8 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/IkedaCarpenterPV.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/IkedaCarpenterPV.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/ConfigService.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -102,6 +102,7 @@ public: void testAgainstMockData() { using namespace Mantid::API; using namespace Mantid::CurveFitting; + using namespace Mantid::CurveFitting::Functions; /** * Changing compiler on OS X has yet again caused this (and only this) test to @@ -172,6 +173,7 @@ public: void test_Against_Data_In_DeltaE() { using namespace Mantid::API; using namespace Mantid::CurveFitting; + using namespace Mantid::CurveFitting::Functions; #if !(defined __APPLE__) @@ -253,6 +255,7 @@ private: Mantid::API::IAlgorithm_sptr runFit(const std::string &wsName) { using namespace Mantid::API; using namespace Mantid::CurveFitting; + using namespace Mantid::CurveFitting::Functions; // set up fitting function and pass to Fit IkedaCarpenterPV icpv; @@ -265,7 +268,7 @@ private: icpv.tie("Kappa", "46.025921"); icpv.setParameter("X0", 45.0); - auto alg = boost::shared_ptr<IAlgorithm>(new Fit); + auto alg = boost::shared_ptr<IAlgorithm>(new Algorithms::Fit); alg->initialize(); alg->setPropertyValue("Function", icpv.asString()); // Set general Fit parameters diff --git a/Framework/CurveFitting/test/LinearBackgroundTest.h b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h similarity index 92% rename from Framework/CurveFitting/test/LinearBackgroundTest.h rename to Framework/CurveFitting/test/Functions/LinearBackgroundTest.h index f281f018e0533813b77359d129e0e5b63497cba0..03f2d8341c2adbb05608afa567f854141bc8298d 100644 --- a/Framework/CurveFitting/test/LinearBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/LinearBackground.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -17,8 +17,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using Mantid::CurveFitting::LinearBackground; -using Mantid::CurveFitting::Fit; +using Mantid::CurveFitting::Functions::LinearBackground; +using Mantid::CurveFitting::Algorithms::Fit; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; diff --git a/Framework/CurveFitting/test/LogNormalTest.h b/Framework/CurveFitting/test/Functions/LogNormalTest.h similarity index 92% rename from Framework/CurveFitting/test/LogNormalTest.h rename to Framework/CurveFitting/test/Functions/LogNormalTest.h index b6ca2231c59266dcc8b9538d6c5b43c1a7c7ca69..d4391f687f2020a2aab3d304feae0ad7e181ec74 100644 --- a/Framework/CurveFitting/test/LogNormalTest.h +++ b/Framework/CurveFitting/test/Functions/LogNormalTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/LogNormal.h" +#include "MantidCurveFitting/Functions/LogNormal.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class LogNormalTest : public CxxTest::TestSuite { @@ -54,7 +56,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/Lorentzian1DTest.h b/Framework/CurveFitting/test/Functions/Lorentzian1DTest.h similarity index 96% rename from Framework/CurveFitting/test/Lorentzian1DTest.h rename to Framework/CurveFitting/test/Functions/Lorentzian1DTest.h index 10d4d940f1751a5491e9528d421f16d347c75714..d56d87abe45f2cf3e6dd7bb6b2719c5e6b4f8a67 100644 --- a/Framework/CurveFitting/test/Lorentzian1DTest.h +++ b/Framework/CurveFitting/test/Functions/Lorentzian1DTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Lorentzian1D.h" +#include "MantidCurveFitting/Functions/Lorentzian1D.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -12,7 +12,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using Mantid::CurveFitting::Lorentzian1D; +using Mantid::CurveFitting::Functions::Lorentzian1D; using namespace Mantid::DataObjects; class Lorentzian1DTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/LorentzianTest.h b/Framework/CurveFitting/test/Functions/LorentzianTest.h similarity index 87% rename from Framework/CurveFitting/test/LorentzianTest.h rename to Framework/CurveFitting/test/Functions/LorentzianTest.h index f4fa3ef83c727c495bf6ba4650de053a2a6859c3..50f9bc895d555bd215ed6dd191b9d617e2718612 100644 --- a/Framework/CurveFitting/test/LorentzianTest.h +++ b/Framework/CurveFitting/test/Functions/LorentzianTest.h @@ -3,12 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include <boost/make_shared.hpp> +using Mantid::CurveFitting::Functions::Lorentzian; class LorentzianTest : public CxxTest::TestSuite { public: @@ -41,7 +42,7 @@ public: } void test_categories() { - Mantid::CurveFitting::Lorentzian forCat; + Lorentzian forCat; const std::vector<std::string> categories = forCat.categories(); TS_ASSERT(categories.size() == 1); TS_ASSERT(categories[0] == "Peak"); @@ -49,7 +50,7 @@ public: void test_FWHM() { double hwhm = 0.5; - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setParameter("Amplitude", 1.0); lor.setParameter("PeakCentre", 0.0); @@ -63,7 +64,7 @@ public: } void test_height() { - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setHeight(2.0); lor.setCentre(3.0); @@ -78,7 +79,7 @@ public: } void test_height_zero_width() { - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setHeight(2.0); lor.setCentre(3.0); @@ -96,7 +97,7 @@ public: } void testIntensity() { - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setHeight(2.0); lor.setCentre(3.0); @@ -110,15 +111,15 @@ public: } private: - class TestableLorentzian : public Mantid::CurveFitting::Lorentzian { + class TestableLorentzian : public Lorentzian { public: void functionLocal(double *out, const double *xValues, const size_t nData) const { - Mantid::CurveFitting::Lorentzian::functionLocal(out, xValues, nData); + Lorentzian::functionLocal(out, xValues, nData); } void functionDerivLocal(Mantid::API::Jacobian *out, const double *xValues, const size_t nData) { - Mantid::CurveFitting::Lorentzian::functionDerivLocal(out, xValues, nData); + Lorentzian::functionDerivLocal(out, xValues, nData); } }; diff --git a/Framework/CurveFitting/test/MuonFInteractionTest.h b/Framework/CurveFitting/test/Functions/MuonFInteractionTest.h similarity index 93% rename from Framework/CurveFitting/test/MuonFInteractionTest.h rename to Framework/CurveFitting/test/Functions/MuonFInteractionTest.h index b9b5b3b7d968869e05b05e394344826c27ed76c4..a03d49a13135f5697a6f46e2ca9d2a8a2c067e89 100644 --- a/Framework/CurveFitting/test/MuonFInteractionTest.h +++ b/Framework/CurveFitting/test/Functions/MuonFInteractionTest.h @@ -3,11 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/MuonFInteraction.h" -#include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/MuonFInteraction.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +16,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class MuonFInteractionTest : public CxxTest::TestSuite { @@ -54,7 +53,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h similarity index 99% rename from Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h rename to Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h index 946ebe697dc0713f9887fa454ad16d3ad3f90294..ad44379ead2f7307b6fff1d56f2bda5df4561ac5 100644 --- a/Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h" using namespace std; -using Mantid::CurveFitting::NeutronBk2BkExpConvPVoigt; +using Mantid::CurveFitting::Functions::NeutronBk2BkExpConvPVoigt; class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/PawleyFunctionTest.h b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h similarity index 99% rename from Framework/CurveFitting/test/PawleyFunctionTest.h rename to Framework/CurveFitting/test/Functions/PawleyFunctionTest.h index 141f4d008e4764a8fdbb892a25f23da0b1f51422..f746d52c86d2c82aa215978eafe8cb2ea0257b04 100644 --- a/Framework/CurveFitting/test/PawleyFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidGeometry/Crystal/PointGroup.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FunctionFactory.h" @@ -11,6 +11,7 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Kernel; diff --git a/Framework/CurveFitting/test/PeakParameterFunctionTest.h b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h similarity index 97% rename from Framework/CurveFitting/test/PeakParameterFunctionTest.h rename to Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h index 4f5bb3317308e6f871d5c0f994b693b99be1c5d3..80cf00d80492ae098d07649a3cf5b8c882d8aca7 100644 --- a/Framework/CurveFitting/test/PeakParameterFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PeakParameterFunction.h" +#include "MantidCurveFitting/Functions/PeakParameterFunction.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionFactory.h" @@ -13,6 +13,7 @@ #include "MantidCurveFitting/Jacobian.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class PeakParameterFunctionTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/PolynomialTest.h b/Framework/CurveFitting/test/Functions/PolynomialTest.h similarity index 92% rename from Framework/CurveFitting/test/PolynomialTest.h rename to Framework/CurveFitting/test/Functions/PolynomialTest.h index c33a5e183567d675eb3ad72a41be6b0052334813..13d0461f676997d8bc7ccc44f69831644154cb02 100644 --- a/Framework/CurveFitting/test/PolynomialTest.h +++ b/Framework/CurveFitting/test/Functions/PolynomialTest.h @@ -3,15 +3,16 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Polynomial.h" +#include "MantidCurveFitting/Functions/Polynomial.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" -using Mantid::CurveFitting::Polynomial; +using Mantid::CurveFitting::Functions::Polynomial; using namespace Mantid; using namespace API; using namespace Kernel; +using namespace Mantid::CurveFitting::Algorithms; class PolynomialTest : public CxxTest::TestSuite { public: @@ -45,7 +46,7 @@ public: // put this workspace in the data service TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D)); - CurveFitting::Fit alg2; + CurveFitting::Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ProcessBackgroundTest.h b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h similarity index 99% rename from Framework/CurveFitting/test/ProcessBackgroundTest.h rename to Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h index 393ef4b2ceb904fc8a169e8317b46abcf277693b..9ad20b34455b34d2f8d1d236501ce8af4c42ae4d 100644 --- a/Framework/CurveFitting/test/ProcessBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProcessBackground.h" +#include "MantidCurveFitting/Functions/ProcessBackground.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/WorkspaceFactory.h" @@ -11,7 +11,7 @@ #include <fstream> -using Mantid::CurveFitting::ProcessBackground; +using Mantid::CurveFitting::Functions::ProcessBackground; using namespace Mantid; using namespace Mantid::API; using namespace Kernel; diff --git a/Framework/CurveFitting/test/ProductFunctionTest.h b/Framework/CurveFitting/test/Functions/ProductFunctionTest.h similarity index 94% rename from Framework/CurveFitting/test/ProductFunctionTest.h rename to Framework/CurveFitting/test/Functions/ProductFunctionTest.h index 48cb11dc1fea7b8bde2140d39d630e177960b956..a34711c1d98af800f1f0c991ade79c0a39b44026 100644 --- a/Framework/CurveFitting/test/ProductFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/ProductFunctionTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProductFunction.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" +#include "MantidCurveFitting/Functions/Gaussian.h" #include "MantidCurveFitting/Jacobian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" @@ -19,6 +19,9 @@ #include "MantidAPI/FunctionValues.h" typedef Mantid::DataObjects::Workspace2D_sptr WS_type; +using Mantid::CurveFitting::Functions::ProductFunction; +using Mantid::CurveFitting::Functions::Gaussian; +using Mantid::CurveFitting::Algorithms::Fit; class ProductFunctionMWTest_Gauss : public Mantid::API::IPeakFunction { public: @@ -99,7 +102,7 @@ DECLARE_FUNCTION(ProductFunctionMWTest_Linear) class ProductFunctionTest : public CxxTest::TestSuite { public: void testFunction() { - Mantid::CurveFitting::ProductFunction prodF; + ProductFunction prodF; Mantid::API::IFunction_sptr gauss1(new ProductFunctionMWTest_Gauss); gauss1->setParameter(0, 1.1); @@ -154,8 +157,7 @@ public: prodF.asString()); TS_ASSERT(fun); - Mantid::CurveFitting::ProductFunction *prodF1 = - dynamic_cast<Mantid::CurveFitting::ProductFunction *>(fun.get()); + ProductFunction *prodF1 = dynamic_cast<ProductFunction *>(fun.get()); TS_ASSERT(prodF1); TS_ASSERT_EQUALS(prodF1->nFunctions(), 4); @@ -182,12 +184,12 @@ public: } void testProductFunction() { - Mantid::CurveFitting::ProductFunction prodF; + ProductFunction prodF; double c1 = 1.0; double h1 = 3.0; double s1 = 0.5; - Mantid::API::IFunction_sptr f0(new Mantid::CurveFitting::Gaussian); + Mantid::API::IFunction_sptr f0(new Gaussian); f0->initialize(); f0->setParameter("PeakCentre", c1); f0->setParameter("Height", h1); @@ -208,7 +210,7 @@ public: double c2 = 2; double h2 = 10.0; double s2 = 0.5; - Mantid::API::IFunction_sptr f1(new Mantid::CurveFitting::Gaussian); + Mantid::API::IFunction_sptr f1(new Gaussian); f1->initialize(); f1->setParameter("PeakCentre", c2); f1->setParameter("Height", h2); @@ -249,7 +251,7 @@ public: Mantid::API::AnalysisDataService::Instance().add(wsName, ws); - Mantid::CurveFitting::Fit fit; + Mantid::CurveFitting::Algorithms::Fit fit; fit.initialize(); f0->tie("PeakCentre", "1.0"); @@ -284,14 +286,14 @@ public: } void testForCategories() { - Mantid::CurveFitting::ProductFunction forCat; + ProductFunction forCat; const std::vector<std::string> categories = forCat.categories(); TS_ASSERT(categories.size() == 1); TS_ASSERT(categories[0] == "General"); } void testDerivatives() { - Mantid::CurveFitting::ProductFunction prodF; + ProductFunction prodF; Mantid::API::IFunction_sptr linear1(new ProductFunctionMWTest_Linear); linear1->setParameter(0, 1.0); diff --git a/Framework/CurveFitting/test/ProductLinearExpTest.h b/Framework/CurveFitting/test/Functions/ProductLinearExpTest.h similarity index 96% rename from Framework/CurveFitting/test/ProductLinearExpTest.h rename to Framework/CurveFitting/test/Functions/ProductLinearExpTest.h index 99cb313f5f6ebbfd17f9a148b1d9250e945652fc..a198b826c7ae86af588c6f966874bde85024b175 100644 --- a/Framework/CurveFitting/test/ProductLinearExpTest.h +++ b/Framework/CurveFitting/test/Functions/ProductLinearExpTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProductLinearExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductLinearExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -16,6 +16,7 @@ #include <boost/make_shared.hpp> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class ProductLinearExpTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/ProductQuadraticExpTest.h b/Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h similarity index 96% rename from Framework/CurveFitting/test/ProductQuadraticExpTest.h rename to Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h index 51604e1a486f1b734ac181257475df8c162fdb91..c6c4385de3e644ddc19eb57c44e70fa1ed07c65a 100644 --- a/Framework/CurveFitting/test/ProductQuadraticExpTest.h +++ b/Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProductQuadraticExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/Quadratic.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductQuadraticExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/Quadratic.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -16,6 +16,7 @@ #include <boost/make_shared.hpp> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class ProductQuadraticExpTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/PseudoVoigtTest.h b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h similarity index 98% rename from Framework/CurveFitting/test/PseudoVoigtTest.h rename to Framework/CurveFitting/test/Functions/PseudoVoigtTest.h index 53a4d256f16cf76d0714a5b84ee8f5d9f0c548ef..fd94bc3955f8d97674c3d4a57dc417ba80c34dab 100644 --- a/Framework/CurveFitting/test/PseudoVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h @@ -3,13 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PseudoVoigt.h" +#include "MantidCurveFitting/Functions/PseudoVoigt.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidCurveFitting/Jacobian.h" #include <boost/make_shared.hpp> -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -17,6 +17,7 @@ #include "MantidKernel/MersenneTwister.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; using namespace Mantid::DataObjects; diff --git a/Framework/CurveFitting/test/QuadraticTest.h b/Framework/CurveFitting/test/Functions/QuadraticTest.h similarity index 92% rename from Framework/CurveFitting/test/QuadraticTest.h rename to Framework/CurveFitting/test/Functions/QuadraticTest.h index 110a2f079bbd45b51546c5fddc2e384197dc4ce8..293b34a479a774bb824a08c6e21c509b25d17a39 100644 --- a/Framework/CurveFitting/test/QuadraticTest.h +++ b/Framework/CurveFitting/test/Functions/QuadraticTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Quadratic.h" +#include "MantidCurveFitting/Functions/Quadratic.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -17,8 +17,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using Mantid::CurveFitting::Quadratic; -using Mantid::CurveFitting::Fit; +using Mantid::CurveFitting::Functions::Quadratic; +using Mantid::CurveFitting::Algorithms::Fit; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; diff --git a/Framework/CurveFitting/test/ReflectivityMulfTest.h b/Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h similarity index 96% rename from Framework/CurveFitting/test/ReflectivityMulfTest.h rename to Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h index 7c045ddccc3a764e0a3126bfa990e485fb6cee90..b32cfb9c05f1a3aa4c7e65b45a632af23e3b5853 100644 --- a/Framework/CurveFitting/test/ReflectivityMulfTest.h +++ b/Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ReflectivityMulf.h" +#include "MantidCurveFitting/Functions/ReflectivityMulf.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; class ReflectivityMulfTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/ResolutionTest.h b/Framework/CurveFitting/test/Functions/ResolutionTest.h similarity index 96% rename from Framework/CurveFitting/test/ResolutionTest.h rename to Framework/CurveFitting/test/Functions/ResolutionTest.h index 5dfdd646bdea04ae81665ad2bee4fabb533325a4..7ac7e7a642c912f6a0cd301f390f0908b776dedb 100644 --- a/Framework/CurveFitting/test/ResolutionTest.h +++ b/Framework/CurveFitting/test/Functions/ResolutionTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Resolution.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/Resolution.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/FunctionFactory.h" #include <Poco/File.h> @@ -13,6 +13,7 @@ #include <fstream> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class ResolutionTest_Gauss : public IPeakFunction { @@ -169,7 +170,7 @@ public: conv.addFunction(res); conv.addFunction(gauss); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", conv.asString()); fit.setPropertyValue("InputWorkspace", "ResolutionTest_WS"); diff --git a/Framework/CurveFitting/test/SimpleChebfunTest.h b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h similarity index 98% rename from Framework/CurveFitting/test/SimpleChebfunTest.h rename to Framework/CurveFitting/test/Functions/SimpleChebfunTest.h index 7d13981bb5581d93df5691dcdcf992a64f561550..c512c001280461964ebd0b5a38694aae74a7d6e9 100644 --- a/Framework/CurveFitting/test/SimpleChebfunTest.h +++ b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h @@ -3,12 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SimpleChebfun.h" +#include "MantidCurveFitting/Functions/SimpleChebfun.h" #include <cmath> using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; namespace { double Sin(double x) { return sin(x); } diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h similarity index 91% rename from Framework/CurveFitting/test/StaticKuboToyabeTest.h rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h index 6d188da076a69e7035b6f2e9c8dd7ad74e085c03..75aabd12039f6c9253ca7a6683e7352c39939be0 100644 --- a/Framework/CurveFitting/test/StaticKuboToyabeTest.h +++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StaticKuboToyabe.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabe.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class StaticKuboToyabeTest : public CxxTest::TestSuite { @@ -50,7 +51,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h similarity index 91% rename from Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h index 1546f743eefec9d8b70eae292361d17d15c34f32..41872069e5d1ce649428af575ca217ba8050f801 100644 --- a/Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h +++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h @@ -3,16 +3,18 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" -using Mantid::CurveFitting::StaticKuboToyabeTimesExpDecay; +using Mantid::CurveFitting::Functions::StaticKuboToyabeTimesExpDecay; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StaticKuboToyabeTimesExpDecayTest : public CxxTest::TestSuite { @@ -69,7 +71,7 @@ public: } void test_AgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h similarity index 91% rename from Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h index e49a1065582563e8098f0e810c661b1418d0b023..f257182091434c6f21ab1bac0b9c17afa3e90b29 100644 --- a/Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h +++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h @@ -3,15 +3,17 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" -using Mantid::CurveFitting::StaticKuboToyabeTimesGausDecay; +using Mantid::CurveFitting::Functions::StaticKuboToyabeTimesGausDecay; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StaticKuboToyabeTimesGausDecayTest : public CxxTest::TestSuite { @@ -68,7 +70,7 @@ public: } void test_AgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StretchExpMuonTest.h b/Framework/CurveFitting/test/Functions/StretchExpMuonTest.h similarity index 91% rename from Framework/CurveFitting/test/StretchExpMuonTest.h rename to Framework/CurveFitting/test/Functions/StretchExpMuonTest.h index dcf022beceeabfaa68bd7539a38575e69929b90b..8bbbfb9041cd005233bdd865d79009bcdcb0f444 100644 --- a/Framework/CurveFitting/test/StretchExpMuonTest.h +++ b/Framework/CurveFitting/test/Functions/StretchExpMuonTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StretchExpMuon.h" +#include "MantidCurveFitting/Functions/StretchExpMuon.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StretchExpMuonTest : public CxxTest::TestSuite { @@ -54,7 +56,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StretchExpTest.h b/Framework/CurveFitting/test/Functions/StretchExpTest.h similarity index 93% rename from Framework/CurveFitting/test/StretchExpTest.h rename to Framework/CurveFitting/test/Functions/StretchExpTest.h index 8ad7fbd15465389bc445b84126dcbe845ee15314..a17208356f7b9261d4ab4551706426a3fe683297 100644 --- a/Framework/CurveFitting/test/StretchExpTest.h +++ b/Framework/CurveFitting/test/Functions/StretchExpTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StretchExp.h" +#include "MantidCurveFitting/Functions/StretchExp.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -21,6 +21,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StretchExpTest_Jacobian : public Mantid::API::Jacobian { @@ -65,7 +67,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/TabulatedFunctionTest.h b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h similarity index 98% rename from Framework/CurveFitting/test/TabulatedFunctionTest.h rename to Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h index f243adc77658f580826be8c15e34342bf1fbb2ad..1937f365c1cab0b8a9f5d3f4a557868d3c3ed357 100644 --- a/Framework/CurveFitting/test/TabulatedFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h @@ -3,8 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/TabulatedFunction.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain.h" #include "MantidAPI/AlgorithmFactory.h" @@ -19,6 +19,7 @@ #include <fstream> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; namespace { diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h similarity index 90% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h index 93179e749256588a67025dc326afb4959f9e1955..5a61091389e989eee6469986bb54e6cccf5bc672 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h" using namespace Mantid; -using Mantid::CurveFitting::ThermalNeutronBk2BkExpAlpha; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpAlpha; class ThermalNeutronBk2BkExpAlphaTest : public CxxTest::TestSuite { public: @@ -36,7 +36,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronBk2BkExpAlpha function; + ThermalNeutronBk2BkExpAlpha function; function.initialize(); function.setParameter("Alph0", 4.026); diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h similarity index 90% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h index 226e9229d10ac60170f0eb72ae3c26767133d927..978370be21897feafe65708f61d40d7e7a0b7a24 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h" using namespace Mantid; -using Mantid::CurveFitting::ThermalNeutronBk2BkExpBeta; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpBeta; class ThermalNeutronBk2BkExpBetaTest : public CxxTest::TestSuite { public: @@ -36,7 +36,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronBk2BkExpBeta function; + ThermalNeutronBk2BkExpBeta function; function.initialize(); function.setParameter("Beta0", 3.489); diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h similarity index 99% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h index 0be6d35d56e5ee0d15c12d432c080c335aaf0964..ee593a2d2fbb7f09ae2663dc081eba4d765c95b4 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h @@ -5,12 +5,12 @@ #include <fstream> #include <cmath> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" using namespace Mantid; using namespace Kernel; using namespace std; -using Mantid::CurveFitting::ThermalNeutronBk2BkExpConvPVoigt; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpConvPVoigt; class ThermalNeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite { public: @@ -137,7 +137,7 @@ public: generateData(vecX, vecY, vecE); // 1. Create peak - CurveFitting::ThermalNeutronBk2BkExpConvPVoigt peak; + ThermalNeutronBk2BkExpConvPVoigt peak; peak.initialize(); peak.setMillerIndex(1, 1, 1); diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h similarity index 89% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h index 3e861dafcbdd461b342e18e1a692e2c113528995..cdc782f28503b2189db8142fda18c6ed8420b43e 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h" -using Mantid::CurveFitting::ThermalNeutronBk2BkExpSigma; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpSigma; using namespace Mantid; class ThermalNeutronBk2BkExpSigmaTest : public CxxTest::TestSuite { @@ -36,7 +36,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronBk2BkExpSigma function; + ThermalNeutronBk2BkExpSigma function; function.initialize(); function.setParameter("Sig2", sqrt(11.380)); diff --git a/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h similarity index 95% rename from Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h index e24ea0b0262732010a508f4e85abeb1dacfa30d8..ef8adbfa43e6989e178c00b1fc2908887de122dc 100644 --- a/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h @@ -6,11 +6,11 @@ #include <math.h> #include <fstream> -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -using Mantid::CurveFitting::ThermalNeutronDtoTOFFunction; +using Mantid::CurveFitting::Functions::ThermalNeutronDtoTOFFunction; using namespace Mantid; using namespace Mantid::API; @@ -44,7 +44,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronDtoTOFFunction function; + ThermalNeutronDtoTOFFunction function; function.initialize(); function.setParameter("Dtt1", 22777.1); diff --git a/Framework/CurveFitting/test/UserFunction1DTest.h b/Framework/CurveFitting/test/Functions/UserFunction1DTest.h similarity index 96% rename from Framework/CurveFitting/test/UserFunction1DTest.h rename to Framework/CurveFitting/test/Functions/UserFunction1DTest.h index 43abd49d3c90739abf922eac37866fa98c5f0ecb..8ea1cd7792cca9458adabe1b2842ce987f6e0ac9 100644 --- a/Framework/CurveFitting/test/UserFunction1DTest.h +++ b/Framework/CurveFitting/test/Functions/UserFunction1DTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/UserFunction1D.h" +#include "MantidCurveFitting/Functions/UserFunction1D.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FrameworkManager.h" #include "MantidDataObjects/Workspace2D.h" @@ -11,6 +11,7 @@ #include "MantidAPI/ITableWorkspace.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class UserFunction1DTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/UserFunctionTest.h b/Framework/CurveFitting/test/Functions/UserFunctionTest.h similarity index 95% rename from Framework/CurveFitting/test/UserFunctionTest.h rename to Framework/CurveFitting/test/Functions/UserFunctionTest.h index 7355f7120938957f2b0057217199df9962db4214..b527257a1754fe4503333ffb399c9b3db34eafe7 100644 --- a/Framework/CurveFitting/test/UserFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/UserFunctionTest.h @@ -3,11 +3,12 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class UserFunctionTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/VesuvioResolutionTest.h b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h similarity index 96% rename from Framework/CurveFitting/test/VesuvioResolutionTest.h rename to Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h index 2e0fe33a435ea860f9d78d19a367bdbe1ecc6ade..8488b55e50588cf4734bf3b03463c4c3dd374660 100644 --- a/Framework/CurveFitting/test/VesuvioResolutionTest.h +++ b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h @@ -2,11 +2,11 @@ #define MANTID_CURVEFITTING_VESUVIORESOLUTIONTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::VesuvioResolution; +using Mantid::CurveFitting::Functions::VesuvioResolution; class VesuvioResolutionTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/VoigtTest.h b/Framework/CurveFitting/test/Functions/VoigtTest.h similarity index 98% rename from Framework/CurveFitting/test/VoigtTest.h rename to Framework/CurveFitting/test/Functions/VoigtTest.h index 769a77f2d4b6c5e9f70cb825bbf23d2553d9add5..74c76e0aa518baa8c9d7ed76c45d70b2b04ea523 100644 --- a/Framework/CurveFitting/test/VoigtTest.h +++ b/Framework/CurveFitting/test/Functions/VoigtTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Voigt.h" +#include "MantidCurveFitting/Functions/Voigt.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -12,7 +12,7 @@ #include <boost/scoped_ptr.hpp> #include <boost/make_shared.hpp> -using Mantid::CurveFitting::Voigt; +using Mantid::CurveFitting::Functions::Voigt; using Mantid::API::IFunction; class VoigtTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/valgrind.h b/Framework/CurveFitting/test/Functions/valgrind.h similarity index 100% rename from Framework/CurveFitting/test/valgrind.h rename to Framework/CurveFitting/test/Functions/valgrind.h diff --git a/Framework/CurveFitting/test/MultiDomainCreatorTest.h b/Framework/CurveFitting/test/MultiDomainCreatorTest.h index 96f3dbab2de5fe35887c085723e248f5d63407bd..1694bf0d114b7a05bd639b8defe1c3786fc4461d 100644 --- a/Framework/CurveFitting/test/MultiDomainCreatorTest.h +++ b/Framework/CurveFitting/test/MultiDomainCreatorTest.h @@ -12,7 +12,7 @@ #include "MantidAPI/ParamFunction.h" #include "MantidCurveFitting/MultiDomainCreator.h" #include "MantidCurveFitting/FitMW.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidKernel/PropertyManager.h" #include "MantidTestHelpers/FakeObjects.h" @@ -24,6 +24,7 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; class MultiDomainCreatorTest_Fun : public IFunction1D, public ParamFunction { public: diff --git a/Framework/CurveFitting/test/MultiDomainFunctionTest.h b/Framework/CurveFitting/test/MultiDomainFunctionTest.h index afc12650780ca6f0e630e1e0a5dae6083a6d3a1f..b379b210af6f1737273136468e9e6e052958e2f0 100644 --- a/Framework/CurveFitting/test/MultiDomainFunctionTest.h +++ b/Framework/CurveFitting/test/MultiDomainFunctionTest.h @@ -9,9 +9,9 @@ #include "MantidAPI/ParamFunction.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidTestHelpers/FakeObjects.h" @@ -22,6 +22,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Algorithms; class MultiDomainFunctionTest_Function : public virtual IFunction1D, public virtual ParamFunction { @@ -161,7 +163,7 @@ public: costFun->setFittingFunction(multi, domain, values); TS_ASSERT_EQUALS(costFun->nParams(), 6); - LevenbergMarquardtMDMinimizer s; + FuncMinimisers::LevenbergMarquardtMDMinimizer s; s.initialize(costFun); TS_ASSERT(s.minimize()); @@ -185,7 +187,7 @@ public: multi->getFunction(2)->setParameter("A", 0); multi->getFunction(2)->setParameter("B", 0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setProperty("Function", boost::dynamic_pointer_cast<IFunction>(multi)); fit.setProperty("InputWorkspace", ws1); diff --git a/Framework/CurveFitting/test/SpecialFunctionSupportTest.h b/Framework/CurveFitting/test/SpecialFunctionSupportTest.h index 4117c204942f384dd9403e591a2232cd5aeee87f..60cef0c51dcc6e96a18cd04a3ae6d78e49cb90e0 100644 --- a/Framework/CurveFitting/test/SpecialFunctionSupportTest.h +++ b/Framework/CurveFitting/test/SpecialFunctionSupportTest.h @@ -5,7 +5,7 @@ #include <complex> #include "MantidCurveFitting/SpecialFunctionSupport.h" -#include "MantidCurveFitting/Lorentzian1D.h" +#include "MantidCurveFitting/Functions/Lorentzian1D.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h index 44e695b5bcd1d3a08be0c73641950774822fbbb9..cf495c009be312933a224018d34b0deb1079edab 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h @@ -5,6 +5,7 @@ // Includes //---------------------------------------------------------------------- #include "MantidAPI/IFileLoader.h" +#include "MantidAPI/DeprecatedAlgorithm.h" namespace Mantid { namespace DataHandling { @@ -45,7 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class DLLExport LoadAscii : public API::IFileLoader<Kernel::FileDescriptor> { +class DLLExport LoadAscii : public API::IFileLoader<Kernel::FileDescriptor>, + public API::DeprecatedAlgorithm { public: /// Default constructor LoadAscii(); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h index c3f14b233810c5a14e3082ea5bc88725df2ef0ed..328be8a18896d921be8e0a25bd1c6ff8f0185c86 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h @@ -5,6 +5,7 @@ #include <string> #include <vector> #include "MantidAPI/IFileLoader.h" +#include "MantidAPI/DeprecatedAlgorithm.h" #include "MantidKernel/BinaryFile.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/Events.h" @@ -88,7 +89,8 @@ struct Pulse { #pragma pack(pop) class DLLExport LoadEventPreNexus - : public API::IFileLoader<Kernel::FileDescriptor> { + : public API::IFileLoader<Kernel::FileDescriptor>, + public API::DeprecatedAlgorithm { public: /// Constructor LoadEventPreNexus(); diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 060f54bee77e172c5cfa3da87e6294c5f0aea2c2..4bfba12fc4a42003b33a2c65d620b6507a154fe0 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -353,7 +353,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, } // check we don't have an index that is too high for the workspace size_t maxIn = static_cast<size_t>(workspace->getNumberHistograms() - 1); - std::vector<size_t>::const_iterator it = m_GroupSpecInds[0].begin(); + auto it = m_GroupSpecInds[0].begin(); for (; it != m_GroupSpecInds[0].end(); ++it) { if (*it > maxIn) { g_log.error() << "Spectra index " << *it @@ -375,7 +375,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, // up date unUsedSpec, this is used to find duplicates and when the user has // set KeepUngroupedSpectra - std::vector<size_t>::const_iterator index = m_GroupSpecInds[0].begin(); + auto index = m_GroupSpecInds[0].begin(); for (; index != m_GroupSpecInds[0].end(); ++index) { // the vector<int> m_GroupSpecInds[0] must not index contain // numbers that don't exist in the workspaace diff --git a/Framework/DataHandling/src/LoadAscii.cpp b/Framework/DataHandling/src/LoadAscii.cpp index 747bd5422b98555db8ceb6e6bff37a5245f66abe..74dda663af566b72c71ca5209a90493ddff03af7 100644 --- a/Framework/DataHandling/src/LoadAscii.cpp +++ b/Framework/DataHandling/src/LoadAscii.cpp @@ -24,7 +24,9 @@ using namespace Kernel; using namespace API; /// Empty constructor -LoadAscii::LoadAscii() : m_columnSep(), m_separatorIndex() {} +LoadAscii::LoadAscii() : m_columnSep(), m_separatorIndex() { + this->useAlgorithm("LoadAscii", 2); +} /** * Return the confidence with with this algorithm can load the file diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 43f73c8f10abe5c91fba36406380bfab82c5570c..e6687146f3fab3f327e3d18c3213dddf8b786999 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -84,7 +84,9 @@ LoadEventPreNexus::LoadEventPreNexus() num_good_events(0), num_error_events(0), num_ignored_events(0), first_event(0), max_events(0), using_mapping_file(false), loadOnlySomeSpectra(false), spectraLoadMap(), longest_tof(0), - shortest_tof(0), parallelProcessing(false) {} + shortest_tof(0), parallelProcessing(false) { + this->useAlgorithm("LoadEventPreNexus", 2); +} LoadEventPreNexus::~LoadEventPreNexus() { delete this->eventfile; } diff --git a/Framework/DataHandling/src/SaveDiffCal.cpp b/Framework/DataHandling/src/SaveDiffCal.cpp index 66259ba0ad274d6856f16180cc48240a99e183ca..96c2cbe07747c32a9b817a67505126fa137752eb 100644 --- a/Framework/DataHandling/src/SaveDiffCal.cpp +++ b/Framework/DataHandling/src/SaveDiffCal.cpp @@ -30,7 +30,8 @@ DECLARE_ALGORITHM(SaveDiffCal) //---------------------------------------------------------------------------------------------- /** Constructor */ -SaveDiffCal::SaveDiffCal() {} +SaveDiffCal::SaveDiffCal() + : m_numValues(0), m_calibrationWS(), m_detidToIndex() {} //---------------------------------------------------------------------------------------------- /** Destructor diff --git a/Framework/DataHandling/src/SaveGSS.cpp b/Framework/DataHandling/src/SaveGSS.cpp index 460f326f800f6ccb0538b63aa49f9b59740bf633..3eaa53e20d4f04437f076959ffe3e940e1c2f0d8 100644 --- a/Framework/DataHandling/src/SaveGSS.cpp +++ b/Framework/DataHandling/src/SaveGSS.cpp @@ -410,6 +410,7 @@ void writeLogValue(std::ostream &os, const Run &runinfo, void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os, double primaryflightpath) const { const Run &runinfo = inputWS->run(); + std::ios::fmtflags fflags(os.flags()); // Run number if (format.compare(SLOG) == 0) { @@ -483,6 +484,8 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os, os << "\n"; } + os.flags(fflags); + return; } @@ -491,10 +494,12 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os, */ inline void writeBankLine(std::stringstream &out, const std::string &bintype, const int banknum, const size_t datasize) { + std::ios::fmtflags fflags(out.flags()); out << "BANK " << std::fixed << std::setprecision(0) << banknum // First bank should be 1 for GSAS; this can be changed << std::fixed << " " << datasize << std::fixed << " " << datasize << std::fixed << " " << bintype; + out.flags(fflags); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h b/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h index 2656b0085f6924d57618e626b151cacf0d9d1508..7256f47e3bbb7c5b3a8a1936b742f8c057749b9f 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h +++ b/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h @@ -22,7 +22,8 @@ public: /** Constructor */ - CalculateReflectometryQxQz() : m_dirQx(0.0), m_dirQz(0.0) {} + CalculateReflectometryQxQz() + : m_cos_theta_i(0.0), m_sin_theta_i(0.0), m_dirQx(0.0), m_dirQz(0.0) {} /** Setter for the incident theta value require for the calculation. Internally diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc index d03eb54542a77ee0bdd2b9cd5f04adcf3020215a..4de121711232aa6c6a24fd477c7118097ca62778 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc @@ -40,10 +40,10 @@ namespace DataObjects { */ TMDE(MDGridBox)::MDGridBox( BoxController *const bc, const uint32_t depth, - const std::vector< - Mantid::Geometry::MDDimensionExtents<coord_t>> &extentsVector) - : MDBoxBase<MDE, nd>(bc, depth, UNDEF_SIZET, extentsVector), - numBoxes(0), m_Children(), diagonalSquared(0.f), nPoints(0) { + const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> & + extentsVector) + : MDBoxBase<MDE, nd>(bc, depth, UNDEF_SIZET, extentsVector), numBoxes(0), + m_Children(), diagonalSquared(0.f), nPoints(0) { initGridBox(); } @@ -55,8 +55,8 @@ TMDE(MDGridBox)::MDGridBox( */ TMDE(MDGridBox)::MDGridBox( boost::shared_ptr<API::BoxController> &bc, const uint32_t depth, - const std::vector< - Mantid::Geometry::MDDimensionExtents<coord_t>> &extentsVector) + const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> & + extentsVector) : MDBoxBase<MDE, nd>(bc.get(), depth, UNDEF_SIZET, extentsVector), numBoxes(0), m_Children(), diagonalSquared(0.f), nPoints(0) { initGridBox(); @@ -68,17 +68,16 @@ template <typename MDE, size_t nd> size_t MDGridBox<MDE, nd>::initGridBox() { "MDGridBox::ctor(): No BoxController specified in box."); // How many is it split? - // If we are at the top level and we have a specific top level split, then set it. - boost::optional<std::vector<size_t>> splitTopInto = this->m_BoxController->getSplitTopInto(); - if (this->getDepth() == 0 && splitTopInto) - { + // If we are at the top level and we have a specific top level split, then set + // it. + boost::optional<std::vector<size_t>> splitTopInto = + this->m_BoxController->getSplitTopInto(); + if (this->getDepth() == 0 && splitTopInto) { for (size_t d = 0; d < nd; d++) split[d] = splitTopInto.get()[d]; - } - else - { - for (size_t d = 0; d < nd; d++) - split[d] = this->m_BoxController->getSplitInto(d); + } else { + for (size_t d = 0; d < nd; d++) + split[d] = this->m_BoxController->getSplitInto(d); } // Compute sizes etc. @@ -94,10 +93,9 @@ template <typename MDE, size_t nd> size_t MDGridBox<MDE, nd>::initGridBox() { * @param box :: MDBox containing the events to split */ TMDE(MDGridBox)::MDGridBox(MDBox<MDE, nd> *box) - : MDBoxBase<MDE, nd>(*box, box->getBoxController()), split(), - splitCumul(), m_SubBoxSize(), numBoxes(0), m_Children(), - diagonalSquared(0.f), nPoints(0) -{ + : MDBoxBase<MDE, nd>(*box, box->getBoxController()), split(), splitCumul(), + m_SubBoxSize(), numBoxes(0), m_Children(), diagonalSquared(0.f), + nPoints(0) { size_t totalSize = initGridBox(); double ChildVol(1); @@ -188,10 +186,10 @@ void MDGridBox<MDE, nd>::fillBoxShell(const size_t tot, */ TMDE(MDGridBox)::MDGridBox(const MDGridBox<MDE, nd> &other, Mantid::API::BoxController *const otherBC) - : MDBoxBase<MDE, nd>(other, otherBC), numBoxes(other.numBoxes), m_Children(), - diagonalSquared(other.diagonalSquared), nPoints(other.nPoints) { - for (size_t d = 0; d < nd; d++) - { + : MDBoxBase<MDE, nd>(other, otherBC), numBoxes(other.numBoxes), + m_Children(), diagonalSquared(other.diagonalSquared), + nPoints(other.nPoints) { + for (size_t d = 0; d < nd; d++) { split[d] = other.split[d]; splitCumul[d] = other.splitCumul[d]; m_SubBoxSize[d] = other.m_SubBoxSize[d]; @@ -415,7 +413,7 @@ TMDE(std::vector<MDE> *MDGridBox)::getEventsCopy() { */ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes, size_t maxDepth, bool leafOnly) { - //Add this box, unless we only want the leaves + // Add this box, unless we only want the leaves if (!leafOnly) outBoxes.push_back(this); @@ -1465,8 +1463,9 @@ TMDE(void MDGridBox)::integrateCylinder( coord_t out[nd]; radiusTransform.apply(boxCenter, out); if (out[0] < std::sqrt(diagonalSquared * 0.72 + radius * radius) && - std::fabs(out[1]) < - std::sqrt(diagonalSquared * 0.72 + 0.25 * length * length)) { + (nd >= 1 && + std::fabs(out[1]) < + std::sqrt(diagonalSquared * 0.72 + 0.25 * length * length))) { // If the center is closer than the size of the box, then it MIGHT be // touching. // (We multiply by 0.72 (about sqrt(2)) to look for half the diagonal). diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index efb6e74c71354d9c2d6207883c39d49a6e1e95f2..8dfbd6d9421904169c2016b3f5f11279c626469a 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -548,6 +548,7 @@ EventList &EventList::operator-=(const EventList &more_events) { minusHelper(this->weightedEvents, more_events.weightedEventsNoTime); break; } + break; case WEIGHTED_NOTIME: switch (more_events.getEventType()) { @@ -561,6 +562,7 @@ EventList &EventList::operator-=(const EventList &more_events) { minusHelper(this->weightedEventsNoTime, more_events.weightedEventsNoTime); break; } + break; } // No guaranteed order diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp index b3d7e129cc927636043721605c3517a80c4892a8..f8ffb4af0964c3be9a10fbfb6884363a31dc4dd4 100644 --- a/Framework/DataObjects/src/PeakColumn.cpp +++ b/Framework/DataObjects/src/PeakColumn.cpp @@ -134,6 +134,7 @@ const std::type_info &PeakColumn::get_pointer_type_info() const { void PeakColumn::print(size_t index, std::ostream &s) const { Peak &peak = m_peaks[index]; + std::ios::fmtflags fflags(s.flags()); if (m_name == "RunNumber") s << peak.getRunNumber(); else if (m_name == "DetID") @@ -152,6 +153,7 @@ void PeakColumn::print(size_t index, std::ostream &s) const { s << std::fixed << std::setprecision(m_hklPrec) << peak.getL(); } else s << peak.getValueByColName(m_name); + s.flags(fflags); } //------------------------------------------------------------------------------------- diff --git a/Framework/Geometry/src/Crystal/ScalarUtils.cpp b/Framework/Geometry/src/Crystal/ScalarUtils.cpp index 096cbabf474a832b4b82a10cd92da237707671aa..e92b977edef531ba35d5a1092e8df1dc1ffe07e4 100644 --- a/Framework/Geometry/src/Crystal/ScalarUtils.cpp +++ b/Framework/Geometry/src/Crystal/ScalarUtils.cpp @@ -229,7 +229,7 @@ ConventionalCell ScalarUtils::GetCellForForm(const DblMatrix &UB, if (allowPermutations) { double angle_tolerance = 2.0; double length_factor = 1.05; - UB_list = GetRelatedUBs(UB, angle_tolerance, length_factor); + UB_list = GetRelatedUBs(UB, length_factor, angle_tolerance); } else { // Get exact form requested and not permutations UB_list.push_back(UB); diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index cdc50169d55ad5ab98597068d3a5a4ced1b04ddb..f4c9afef815111745fea386715ae9a79b4d531ea 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -1554,7 +1554,15 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE, increment = atoi((pIDElem->getAttribute("step")).c_str()); // check the start end and increment values are sensible - if (((endID - startID) / increment) < 0) { + if (0 == increment) { + std::stringstream ss; + ss << "The step element cannot be zero, found step: " << increment; + + throw Kernel::Exception::InstrumentDefinitionError(ss.str(), + filename); + } + int numSteps = (endID - startID) / increment; + if (numSteps < 0) { std::stringstream ss; ss << "The start, end, and step elements do not allow a single id " "in the idlist entry - "; @@ -1565,7 +1573,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE, filename); } - idList.vec.reserve((endID - startID) / increment); + idList.vec.reserve(numSteps); for (int i = startID; i != endID + increment; i += increment) { idList.vec.push_back(i); } @@ -2301,7 +2309,9 @@ void InstrumentDefinitionParser::createNeutronicInstrument() { mapTypeNameToShape.find(shapeName); if (shapeIt != mapTypeNameToShape.end()) { // Change the shape on the current component to the one requested - dynamic_cast<ObjComponent *>(it->first)->setShape(shapeIt->second); + auto objCmpt = dynamic_cast<ObjComponent *>(it->first); + if (objCmpt) + objCmpt->setShape(shapeIt->second); } else { throw Exception::InstrumentDefinitionError( "Requested type " + shapeName + " not defined in IDF"); diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp index 0788103182bd08ed8d4202180f43ed171f722ee3..75c5fb5fe2be6d8d76bc081899ffbf8b4e10774a 100644 --- a/Framework/Geometry/src/Math/Acomp.cpp +++ b/Framework/Geometry/src/Math/Acomp.cpp @@ -366,7 +366,8 @@ Assumes that the component is sorted and inserts appropiately. for (acp = AX.Comp.begin(); acp != AX.Comp.end(); ++acp) { std::vector<Acomp>::iterator cpt; cpt = std::lower_bound(Comp.begin(), Comp.end(), *acp); - if (cpt == Comp.end() || *cpt != *aup) // Only insert if new + if (cpt == Comp.end() || + (AX.Units.end() != aup && *cpt != *aup)) // Only insert if new Comp.insert(cpt, *acp); } return; @@ -981,6 +982,9 @@ It is set on exit (to the EPI) break; } + if (PIactive.end() == px) + continue; + EPI.push_back(PIform[*px]); // remove all minterm that the EPI covered for (ddx = DNFactive.begin(); ddx != DNFactive.end(); ++ddx) diff --git a/Framework/ICat/src/GSoap/stdsoap2.cpp b/Framework/ICat/src/GSoap/stdsoap2.cpp index ec26daa1e2e5e4ba9c1137565e6c2f1d5d763e28..7a966fb7a437dd7c1b35655b223446dc0506e1f8 100644 --- a/Framework/ICat/src/GSoap/stdsoap2.cpp +++ b/Framework/ICat/src/GSoap/stdsoap2.cpp @@ -2386,7 +2386,7 @@ int SOAP_FMAC2 soap_resolve(struct soap *soap) { "location=%p level=%u,%u id='%s'\n", ip->type, p, ip->level, fp->level, ip->id)); while (ip->level < k) { - void **q = (void **)soap_malloc(soap, sizeof(q)); + void **q = (void **)soap_malloc(soap, sizeof(*q)); if (!q) return soap->error; *q = p; @@ -8188,9 +8188,11 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p, void *s, **r = &ip->link; q = (void **)ip->link; while (q) { - *r = (void *)soap_malloc(soap, sizeof(void *)); - if (!*r) + void **tmp = (void **)soap_malloc(soap, sizeof(void *)); + if (!tmp) return NULL; + *r = (void *)tmp; + s = *q; *q = *r; r = (void **)*r; @@ -10040,7 +10042,7 @@ int SOAP_FMAC2 soap_element_start_end_out(struct soap *soap, const char *tag) { if (soap->mode & SOAP_XML_CANONICAL) { struct soap_nlist *np; for (tp = soap->attributes; tp; tp = tp->next) { - if (tp->visible && tp->name) + if (tp->visible && tp->name[0]) soap_utilize_ns(soap, tp->name); } for (np = soap->nlist; np; np = np->next) { @@ -11048,7 +11050,7 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) { soap->arraySize[sizeof(soap->arrayType) - 1] = '\0'; soap->arrayType[sizeof(soap->arrayType) - 1] = '\0'; } else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) - strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); + strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset) - 1); else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:position")) soap->position = soap_getposition(tp->value, soap->positions); else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:root")) diff --git a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h index 7a095862e9ce2aad426bcb01da21b7910b545aa2..ada32918cb12d35a2b41a9359cce28e8c18ca112 100644 --- a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h +++ b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h @@ -65,7 +65,9 @@ public: void setPropertyOrdinal(const int &index, const std::string &value); /// Make m_properties point to the same PropertyManager as po. - void copyPropertiesFrom(const PropertyManagerOwner &po) { *this = po; } + virtual void copyPropertiesFrom(const PropertyManagerOwner &po) { + *this = po; + } bool existsProperty(const std::string &name) const; bool validateProperties() const; diff --git a/Framework/Kernel/src/DateValidator.cpp b/Framework/Kernel/src/DateValidator.cpp index 2ff99628903731dcf38e75d971c67852a1f8c550..5362fb247e217211a577736781841c1057ccacfe 100644 --- a/Framework/Kernel/src/DateValidator.cpp +++ b/Framework/Kernel/src/DateValidator.cpp @@ -28,6 +28,9 @@ struct tm getTimeValue(const std::string &sDate, std::string &error) { timeinfo.tm_wday = 0; timeinfo.tm_yday = 0; timeinfo.tm_isdst = -1; +#ifndef _WIN32 + timeinfo.tm_gmtoff = 0; +#endif std::basic_string<char>::size_type index, off = 0; int day, month, year; diff --git a/Framework/Kernel/src/Matrix.cpp b/Framework/Kernel/src/Matrix.cpp index f4e1adc13197297776e06c33da66c50614498298..014284f04c4da6b769c33f2d1157cb0390e3f336 100644 --- a/Framework/Kernel/src/Matrix.cpp +++ b/Framework/Kernel/src/Matrix.cpp @@ -158,17 +158,20 @@ Matrix<T>::Matrix(const Matrix<T> &A, const size_t nrow, const size_t ncol) throw Kernel::Exception::IndexError(ncol, A.ny, "Matrix::Constructor without col"); setMem(nx, ny); - size_t iR(0); - for (size_t i = 0; i <= nx; i++) { - if (i != nrow) { - size_t jR(0); - for (size_t j = 0; j <= ny; j++) { - if (j != ncol) { - V[iR][jR] = A.V[i][j]; - jR++; + if (V) { + size_t iR(0); + for (size_t i = 0; i <= nx; i++) { + if (i != nrow) { + size_t jR(0); + for (size_t j = 0; j <= ny; j++) { + if (j != ncol) { + + V[iR][jR] = A.V[i][j]; + jR++; + } } + iR++; } - iR++; } } } diff --git a/Framework/LiveData/src/ADARA/ADARAParser.cpp b/Framework/LiveData/src/ADARA/ADARAParser.cpp index 8fe1652ecb61c1985e1538b85869fc1c8d029b3f..1fe48e4b00b4755d3c0e3a73e5c25c8caf289e86 100644 --- a/Framework/LiveData/src/ADARA/ADARAParser.cpp +++ b/Framework/LiveData/src/ADARA/ADARAParser.cpp @@ -9,7 +9,7 @@ using namespace ADARA; Parser::Parser(unsigned int initial_buffer_size, unsigned int max_pkt_size) : m_size(initial_buffer_size), m_max_size(max_pkt_size), m_len(0), - m_restart_offset(0), m_oversize_len(0) { + m_restart_offset(0), m_oversize_len(0), m_oversize_offset(0) { m_buffer = new uint8_t[initial_buffer_size]; m_discarded_packets.clear(); } diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h index 2d2b6398fcbc13ef8930008df57da0b01eb015e7..d5a3c71fc66da3866275f0cd6a87bf0c4b5050e5 100644 --- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h +++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h @@ -127,10 +127,10 @@ private: double detectorQ(std::vector<Kernel::V3D> E1Vec, const Mantid::Kernel::V3D QLabFrame, std::vector<double> &r); // Private data members - PeakQMap peak_qs; // hashtable with peak Q-vectors - EventListMap event_lists; // hashtable with lists of events for each peak - Kernel::DblMatrix UBinv; // matrix mapping from Q to h,k,l - double radius; // size of sphere to use for events around a peak + PeakQMap m_peak_qs; // hashtable with peak Q-vectors + EventListMap m_event_lists; // hashtable with lists of events for each peak + Kernel::DblMatrix m_UBinv; // matrix mapping from Q to h,k,l + double m_radius; // size of sphere to use for events around a peak }; } // namespace MDAlgorithms diff --git a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp index 67c0bd24fdb7f2e62820baa3acc1a485a48fe3c2..5bb6cc662e53abe742bfb355143983a89573ce5d 100644 --- a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp @@ -24,7 +24,8 @@ DECLARE_ALGORITHM(ConvertCWSDExpToMomentum) /** Constructor */ ConvertCWSDExpToMomentum::ConvertCWSDExpToMomentum() - : m_iColFilename(2), m_iColStartDetID(3), m_setQRange(true) {} + : m_iColFilename(2), m_iColStartDetID(3), m_setQRange(true), + m_isBaseName(false) {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -201,13 +202,15 @@ void ConvertCWSDExpToMomentum::addMDEvents(bool usevirtual) { // Check whether to add / or \ to m_dataDir std::string sep(""); if (m_dataDir.size() > 0) { - // Determine system - bool isWindows(false); +// Determine system #if _WIN64 - isWindows = true; -#elif _WIND32 - isWindows = true; + const bool isWindows = true; +#elif _WIN32 + const bool isWindows = true; +#else + const bool isWindows = false; #endif + if (isWindows && *m_dataDir.rbegin() != '\\') { sep = "\\"; } else if (!isWindows && *m_dataDir.rbegin() != '/') diff --git a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp index 1431b38ae0e1e338d1d4035d2b67584c9cba4ff4..fe2dfbcc3e23ed987c6f0bb5d042c46f8b37ded7 100644 --- a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp +++ b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp @@ -353,40 +353,54 @@ void ConvertToReflectometryQ::exec() { TableWorkspace_sptr vertexes = boost::make_shared<Mantid::DataObjects::TableWorkspace>(); - + Progress transSelectionProg(this, 0.0, 0.1, 2); if (outputAsMDWorkspace) { + transSelectionProg.report("Choosing Transformation"); if (transMethod == centerTransform()) { auto outputMDWS = transform->executeMD(inputWs, bc); + Progress transPerformProg(this, 0.1, 0.7, 5); + transPerformProg.report("Performed transformation"); // Copy ExperimentInfo (instrument, run, sample) to the output WS ExperimentInfo_sptr ei(inputWs->cloneExperimentInfo()); outputMDWS->addExperimentInfo(ei); outputWS = outputMDWS; } else if (transMethod == normPolyTransform()) { + Progress transPerformProg(this, 0.1, 0.7, 5); const bool dumpVertexes = this->getProperty("DumpVertexes"); auto vertexesTable = vertexes; // perform the normalised polygon transformation + transPerformProg.report("Performing Transformation"); auto normPolyTrans = transform->executeNormPoly( inputWs, vertexesTable, dumpVertexes, outputDimensions); // copy any experiment info from input workspace normPolyTrans->copyExperimentInfoFrom(inputWs.get()); // produce MDHistoWorkspace from normPolyTrans workspace. + Progress outputToMDProg(this, 0.7, 0.75, 10); auto outputMDWS = transform->executeMDNormPoly(normPolyTrans); ExperimentInfo_sptr ei(normPolyTrans->cloneExperimentInfo()); outputMDWS->addExperimentInfo(ei); outputWS = outputMDWS; + outputToMDProg.report("Successfully output to MD"); } else { throw std::runtime_error("Unknown rebinning method: " + transMethod); } } else if (transMethod == normPolyTransform()) { + transSelectionProg.report("Choosing Transformation"); + Progress transPerformProg(this, 0.1, 0.7, 5); const bool dumpVertexes = this->getProperty("DumpVertexes"); auto vertexesTable = vertexes; // perform the normalised polygon transformation + transPerformProg.report("Performing Transformation"); auto output2DWS = transform->executeNormPoly( inputWs, vertexesTable, dumpVertexes, outputDimensions); // copy any experiment info from input workspace output2DWS->copyExperimentInfoFrom(inputWs.get()); outputWS = output2DWS; + transPerformProg.report("Transformation Complete"); } else if (transMethod == centerTransform()) { + transSelectionProg.report("Choosing Transformation"); + Progress transPerformProg(this, 0.1, 0.7, 5); + transPerformProg.report("Performing Transformation"); auto output2DWS = transform->execute(inputWs); output2DWS->copyExperimentInfoFrom(inputWs.get()); outputWS = output2DWS; @@ -397,6 +411,8 @@ void ConvertToReflectometryQ::exec() { // Execute the transform and bind to the output. setProperty("OutputWorkspace", outputWS); setProperty("OutputVertexes", vertexes); + Progress setPropertyProg(this, 0.8, 1.0, 2); + setPropertyProg.report("Success"); } } // namespace Mantid diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp index 1e94707a155f447cab458f8d4b2e3528fef25294..ba70dd4bedd2239fcf40c699cdac43d92045abe3 100644 --- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -215,12 +215,15 @@ FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) { boost::shared_ptr<DataObjects::Peak> p; if (dimType == QLAB) { // Build using the Q-lab-frame constructor - p = boost::shared_ptr<DataObjects::Peak>(new Peak(inst, Q)); + p = boost::make_shared<Peak>(inst, Q); // Save gonio matrix for later p->setGoniometerMatrix(m_goniometer); } else if (dimType == QSAMPLE) { // Build using the Q-sample-frame constructor - p = boost::shared_ptr<DataObjects::Peak>(new Peak(inst, Q, m_goniometer)); + p = boost::make_shared<Peak>(inst, Q, m_goniometer); + } else { + throw std::invalid_argument( + "Cannot Integrate peaks unless the dimension is QLAB or QSAMPLE"); } try { // Look for a detector diff --git a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp index 9bb7c6d1a1723019e115ccda352ef3039a6dccee..8aab04ee8dbf02e05f695e30c90b2100fb472a3a 100644 --- a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp @@ -266,7 +266,13 @@ void ImportMDEventWorkspace::exec() { m_nDimensions + 4; // signal, error, run_no, detector_no m_IsFullDataObjects = (nActualColumns == columnsForFullEvents); - m_nDataObjects = posDiffMDEvent / nActualColumns; + if (0 == nActualColumns) { + m_nDataObjects = 0; + g_log.warning() << "The number of actual columns found in the file " + "(exlcuding comments) is zero" << std::endl; + } else { + m_nDataObjects = posDiffMDEvent / nActualColumns; + } // Get the min and max extents in each dimension. std::vector<double> extentMins(m_nDimensions); diff --git a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp index f3db57b5fd7b3652e27e4bf5187cbf8311c872e5..372e9b1ad95a59e2852b7522d4b4e3602fc6a41b 100644 --- a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp +++ b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp @@ -35,14 +35,14 @@ using Mantid::Kernel::V3D; Integrate3DEvents::Integrate3DEvents( std::vector<std::pair<double, V3D>> const &peak_q_list, DblMatrix const &UBinv, double radius) { - this->UBinv = UBinv; - this->radius = radius; + m_UBinv = UBinv; + m_radius = radius; int64_t hkl_key; for (size_t it = 0; it != peak_q_list.size(); ++it) { hkl_key = getHklKey(peak_q_list[it].second); if (hkl_key != 0) // only save if hkl != (0,0,0) - peak_qs[hkl_key] = peak_q_list[it].second; + m_peak_qs[hkl_key] = peak_q_list[it].second; } } @@ -124,7 +124,12 @@ Integrate3DEvents::ellipseIntegrateEvents( return boost::make_shared<NoShape>(); } - std::vector<std::pair<double, V3D>> &some_events = event_lists[hkl_key]; + auto pos = m_event_lists.find(hkl_key); + if (m_event_lists.end() == pos) + return boost::make_shared<NoShape>(); + ; + + std::vector<std::pair<double, V3D>> &some_events = pos->second; if (some_events.size() < 3) // if there are not enough events to { // find covariance matrix, return @@ -132,14 +137,14 @@ Integrate3DEvents::ellipseIntegrateEvents( } DblMatrix cov_matrix(3, 3); - makeCovarianceMatrix(some_events, cov_matrix, radius); + makeCovarianceMatrix(some_events, cov_matrix, m_radius); std::vector<V3D> eigen_vectors; getEigenVectors(cov_matrix, eigen_vectors); std::vector<double> sigmas; for (int i = 0; i < 3; i++) { - sigmas.push_back(stdDev(some_events, eigen_vectors[i], radius)); + sigmas.push_back(stdDev(some_events, eigen_vectors[i], m_radius)); } bool invalid_peak = false; @@ -392,7 +397,7 @@ int64_t Integrate3DEvents::getHklKey2(V3D const &hkl) { * @param q_vector The q_vector to be mapped to h,k,l */ int64_t Integrate3DEvents::getHklKey(V3D const &q_vector) { - V3D hkl = UBinv * q_vector; + V3D hkl = m_UBinv * q_vector; int h = boost::math::iround<double>(hkl[0]); int k = boost::math::iround<double>(hkl[1]); int l = boost::math::iround<double>(hkl[2]); @@ -424,15 +429,15 @@ void Integrate3DEvents::addEvent(std::pair<double, V3D> event_Q, if (hkl_key == 0) // don't keep events associated with 0,0,0 return; - auto peak_it = peak_qs.find(hkl_key); - if (peak_it != peak_qs.end()) { + auto peak_it = m_peak_qs.find(hkl_key); + if (peak_it != m_peak_qs.end()) { if (!peak_it->second.nullVector()) { if (hkl_integ) - event_Q.second = event_Q.second - UBinv * peak_it->second; + event_Q.second = event_Q.second - m_UBinv * peak_it->second; else event_Q.second = event_Q.second - peak_it->second; - if (event_Q.second.norm() < radius) { - event_lists[hkl_key].push_back(event_Q); + if (event_Q.second.norm() < m_radius) { + m_event_lists[hkl_key].push_back(event_Q); } } } @@ -511,8 +516,8 @@ PeakShapeEllipsoid_const_sptr Integrate3DEvents::ellipseIntegrateEvents( // if necessary restrict the background ellipsoid // to lie within the specified sphere, and adjust // the other sizes, proportionally - if (r3 * max_sigma > radius) { - r3 = radius / max_sigma; + if (r3 * max_sigma > m_radius) { + r3 = m_radius / max_sigma; r1 = r3 * 0.79370053f; // This value for r1 and r2 makes the background r2 = r1; // shell volume equal to the peak region volume. } diff --git a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp index 711de48f4bf03d29ae298d0aaebf6c47f0f01693..1468a6001c3194cd40433439827f19207efa27ae 100644 --- a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp +++ b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp @@ -386,6 +386,10 @@ void IntegrateMDHistoWorkspace::exec() { // Create a thread-local input iterator. boost::scoped_ptr<MDHistoWorkspaceIterator> inIterator( dynamic_cast<MDHistoWorkspaceIterator *>(inWS->createIterator())); + if (!inIterator) { + throw std::runtime_error( + "Could not convert IMDIterator to a MDHistoWorkspaceIterator"); + } /* We jump to the iterator position which is closest in the model diff --git a/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py b/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py index e587a1bfdef0c883ffd6d29d8e7955c34d6b0dfe..477cf69705777a9ce74bfb877129a6023557327e 100644 --- a/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py +++ b/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py @@ -132,6 +132,20 @@ class LoadVesuvio(LoadEmptyVesuvio): else: self._exec_single_foil_state_mode() +#---------------------------------------------------------------------------------------- + + def validateInputs(self): + issues = {} + + # Validtae run number ranges + run_str = self.getProperty(RUN_PROP).value + if "-" in run_str: + lower, upper = run_str.split("-") + if upper < lower: + issues[RUN_PROP] = "Range must be in format lower-upper" + + return issues + #---------------------------------------------------------------------------------------- def _exec_difference_mode(self): @@ -346,24 +360,42 @@ class LoadVesuvio(LoadEmptyVesuvio): if index == 0: out_name, out_mon = SUMMED_WS, SUMMED_MON else: - out_name, out_mon = SUMMED_WS+'tmp', SUMMED_MON + 'tmp' + out_name, out_mon = SUMMED_WS + 'tmp', SUMMED_MON + 'tmp' + # Load data - ms.LoadRaw(Filename=run, SpectrumList=spectra, - OutputWorkspace=out_name, LoadMonitors='Exclude',EnableLogging=_LOGGING_) - ms.LoadRaw(Filename=run,SpectrumList=self._mon_spectra, - OutputWorkspace=out_mon,EnableLogging=_LOGGING_) - if index > 0: # sum - ms.Plus(LHSWorkspace=SUMMED_WS, RHSWorkspace=out_name, - OutputWorkspace=SUMMED_WS,EnableLogging=_LOGGING_) - ms.Plus(LHSWorkspace=SUMMED_MON, RHSWorkspace=out_mon, - OutputWorkspace=SUMMED_MON,EnableLogging=_LOGGING_) - ms.DeleteWorkspace(out_name,EnableLogging=_LOGGING_) - ms.DeleteWorkspace(out_mon,EnableLogging=_LOGGING_) - - ms.CropWorkspace(Inputworkspace= SUMMED_WS, OutputWorkspace= SUMMED_WS, - XMax=self._tof_max,EnableLogging=_LOGGING_) - ms.CropWorkspace(Inputworkspace= SUMMED_MON, OutputWorkspace= SUMMED_MON, - XMax=self._mon_tof_max, EnableLogging=_LOGGING_) + ms.LoadRaw(Filename=run, + SpectrumList=spectra, + OutputWorkspace=out_name, + LoadMonitors='Exclude', + EnableLogging=_LOGGING_) + ms.LoadRaw(Filename=run, + SpectrumList=self._mon_spectra, + OutputWorkspace=out_mon, + EnableLogging=_LOGGING_) + + # Sum + if index > 0: + ms.Plus(LHSWorkspace=SUMMED_WS, + RHSWorkspace=out_name, + OutputWorkspace=SUMMED_WS, + EnableLogging=_LOGGING_) + ms.Plus(LHSWorkspace=SUMMED_MON, + RHSWorkspace=out_mon, + OutputWorkspace=SUMMED_MON, + EnableLogging=_LOGGING_) + + ms.DeleteWorkspace(out_name, EnableLogging=_LOGGING_) + ms.DeleteWorkspace(out_mon, EnableLogging=_LOGGING_) + + ms.CropWorkspace(Inputworkspace= SUMMED_WS, + OutputWorkspace=SUMMED_WS, + XMax=self._tof_max, + EnableLogging=_LOGGING_) + ms.CropWorkspace(Inputworkspace= SUMMED_MON, + OutputWorkspace=SUMMED_MON, + XMax=self._mon_tof_max, + EnableLogging=_LOGGING_) + return mtd[SUMMED_WS], mtd[SUMMED_MON] #---------------------------------------------------------------------------------------- @@ -375,9 +407,9 @@ class LoadVesuvio(LoadEmptyVesuvio): run_str = self.getProperty(RUN_PROP).value # Load is not doing the right thing when summing. The numbers don't look correct if "-" in run_str: - lower,upper = run_str.split("-") + lower, upper = run_str.split("-") # Range goes lower to up-1 but we want to include the last number - runs = range(int(lower),int(upper)+1) + runs = range(int(lower), int(upper)+1) elif "," in run_str: runs = run_str.split(",") diff --git a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py index f52fad8cdc115c57000329048628b138798af648..7bc6cc433707c03185ec1ec1402151f124a6de45 100644 --- a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py +++ b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,unused-variable +#pylint: disable=no-init,unused-variable,invalid-name,bare-except from mantid.api import * from mantid.kernel import * @@ -76,30 +76,47 @@ class SavePlot1DAsJson(PythonAlgorithm): return def _serialize(self, workspace, plotname): - wname = plotname or workspace.getName() + pname = plotname or workspace.getName() # init dictionary ishist = workspace.isHistogramData() plottype = "histogram" if ishist else "point" - serialized = {"type": plottype} - # helper - label = lambda axis: "%s (%s)" % ( - axis.getUnit().caption(), - axis.getUnit().symbol() or 1, + serialized = dict( + type = plottype, + data = dict(), ) # loop over spectra for i in range(workspace.getNumberHistograms()): - k = "%s%s" % (wname, i) - value = dict( - x=list(workspace.readX(i)), - y=list(workspace.readY(i)), - e=list(workspace.readE(i)), - xlabel=label(workspace.getAxis(0)), - ylabel=label(workspace.getAxis(1)), - title="long title of %s" % k, - ) - serialized[k] = value + spectrum_no = workspace.getSpectrum(i).getSpectrumNo() + # Why do we need label? + # label = "%s_spectrum_%d" % (pname, spectrum_no) + # labels.append(label) + # or title? + # title = "%s - spectrum %d" % (workspace.getTitle(), spectrum_no) + arr = [ + list(workspace.readX(i)), + list(workspace.readY(i)), + list(workspace.readE(i)), + ] + serialized['data'][spectrum_no] = arr continue - return serialized + # axes + # .. helper + label = lambda axis: axis.getUnit().caption() + def unit(axis): + s = axis.getUnit().symbol() + try: + return s.latex() + except: + return '%s' % s + axes = dict( + xlabel=label(workspace.getAxis(0)), + ylabel=label(workspace.getAxis(1)), + xunit = unit(workspace.getAxis(0)), + # yunit = unit(workspace.getAxis(1)), + yunit = workspace.YUnitLabel(), + ) + serialized['axes'] = axes + return {pname: serialized} # Register algorithm with Mantid diff --git a/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py b/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py new file mode 100644 index 0000000000000000000000000000000000000000..c7c6f387adb444ff9c0b0ded8ac87c33c0f3bd99 --- /dev/null +++ b/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py @@ -0,0 +1,70 @@ +from mantid.api import PythonAlgorithm, AlgorithmFactory, WorkspaceProperty # , WorkspaceUnitValidator +from mantid.kernel import Direction +import mantid.simpleapi as api + + +class TOFTOFCropWorkspace(PythonAlgorithm): + """ Crop empty time channels + """ + def __init__(self): + PythonAlgorithm.__init__(self) + + def category(self): + """ Return category + """ + return "PythonAlgorithms\\MLZ\\TOFTOF;Utility" + + def name(self): + """ Return summary + """ + return "TOFTOFCropWorkspace" + + def summary(self): + return "Crop empty time channels." + + def PyInit(self): + """ Declare properties + """ + # better would be to use the validator, but it fails if WorkspaceGroup is given as an input + # self.declareProperty(WorkspaceProperty("InputWorkspace", "", direction=Direction.Input, + # validator=WorkspaceUnitValidator('TOF')), + # doc="Input workspace.") + self.declareProperty(WorkspaceProperty("InputWorkspace", "", direction=Direction.Input), + doc="Input workspace.") + self.declareProperty(WorkspaceProperty("OutputWorkspace", "", direction=Direction.Output), + doc="Name of the workspace that will contain the results") + return + + def validateInputs(self): + issues = dict() + input_workspace = self.getProperty("InputWorkspace").value + + xunit = input_workspace.getAxis(0).getUnit().unitID() + if xunit != 'TOF': + issues['InputWorkspace'] = "X axis units must be TOF. " + + # check for required properties + run = input_workspace.getRun() + if not run.hasProperty('channel_width'): + issues['InputWorkspace'] = "Input workpsace must have sample log channel_width." + if not run.hasProperty('full_channels'): + issues['InputWorkspace'] = "Input workpsace must have sample log full_channels." + + return issues + + def PyExec(self): + """ Main execution body + """ + inputws = self.getProperty("InputWorkspace").value + outputws = self.getProperty("OutputWorkspace").value + + run = inputws.getRun() + channel_width = float(run.getLogData('channel_width').value) + full_channels = float(run.getLogData('full_channels').value) + + outputws = api.CropWorkspace(inputws, XMin=0., XMax=full_channels*channel_width, OutputWorkspace=outputws) + self.setProperty("OutputWorkspace", outputws) + + +# Register algorithm with Mantid. +AlgorithmFactory.subscribe(TOFTOFCropWorkspace) diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt index c12c040cddbff6f851d86f23bfa144fc0bbeb73f..512bbcf54bb99005c226817590357887ddf922e3 100644 --- a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt +++ b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt @@ -75,6 +75,7 @@ set ( TEST_PY_FILES UpdatePeakParameterTableValueTest.py SANSSubtractTest.py TimeSliceTest.py + TOFTOFCropWorkspaceTest.py TOFTOFMergeRunsTest.py TOSCABankCorrectionTest.py TransformToIqtTest.py diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py index 6e8c6100e3f2d764c4aa5a8b6c5bdb8961b02cbc..62f8c938fa13402e41580886bc0c61f632ad58d6 100644 --- a/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py +++ b/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py @@ -1,4 +1,4 @@ -#pylint: disable=invalid-name,too-many-public-methods +#pylint: disable=invalid-name,too-many-public-methods,too-many-arguments import unittest import numpy as np import mantid.simpleapi as api @@ -9,13 +9,13 @@ from mantid.api import AnalysisDataService import os, json -class SaveVulcanGSSTest(unittest.TestCase): +class SavePlot1DAsJsonTest(unittest.TestCase): def test_save_one_curve(self): """ Test to Save one curve """ - datawsname = "TestOneCurve" - E, I, err = self._createOneCurve(datawsname) + datawsname = "constant energy cut" + E, I, err = self._createOneQCurve(datawsname) # Execute out_path = "tempout_curve.json" @@ -26,11 +26,9 @@ class SaveVulcanGSSTest(unittest.TestCase): # executed? self.assertTrue(alg_test.isExecuted()) # Verify .... - d = json.load(open(out_path)) - d0 = d[datawsname+'0'] # plots are numbered - np.testing.assert_array_equal(d0['x'], E) - np.testing.assert_array_equal(d0['y'], I) - np.testing.assert_array_equal(d0['e'], err) + d = json.load(open(out_path))[datawsname] + self.assertEqual(d['type'], 'point') + self._checkData(d, E, I, err) # Delete the output file os.remove(out_path) return @@ -51,11 +49,8 @@ class SaveVulcanGSSTest(unittest.TestCase): # Executed? self.assertTrue(alg_test.isExecuted()) # Verify .... - d = json.load(open(out_path)) - d0 = d[datawsname+'0'] # plots are numbered - np.testing.assert_array_equal(d0['x'], E) - np.testing.assert_array_equal(d0['y'], I) - np.testing.assert_array_equal(d0['e'], err) + d = json.load(open(out_path))[datawsname] + self._checkData(d, E, I, err) # test overwrite alg_test = run_algorithm( "SavePlot1DAsJson", @@ -80,14 +75,9 @@ class SaveVulcanGSSTest(unittest.TestCase): # executed? self.assertTrue(alg_test.isExecuted()) # Verify .... - d = json.load(open(out_path)) - d0 = d[datawsname+'0'] # plots are numbered - np.testing.assert_array_equal(d0['x'], E) - np.testing.assert_array_equal(d0['y'], I) - np.testing.assert_array_equal(d0['e'], err) - d1 = d[datawsname+'1'] # - np.testing.assert_array_equal(d1['y'], I2) - np.testing.assert_array_equal(d1['e'], err2) + d = json.load(open(out_path))[datawsname] + self._checkData(d, E, I, err) + self._checkData(d, E, I2, err2, ID="2") # Delete the output file os.remove(out_path) return @@ -97,6 +87,7 @@ class SaveVulcanGSSTest(unittest.TestCase): """ Test to Save one curve with a name specified by client """ datawsname = "TestOneCurve" + plotname = "myplot" E, I, err = self._createOneCurve(datawsname) # Execute out_path = "tempout_curve_withname.json" @@ -104,36 +95,55 @@ class SaveVulcanGSSTest(unittest.TestCase): "SavePlot1DAsJson", InputWorkspace = datawsname, JsonFilename = out_path, - PlotName = "myplot") + PlotName = plotname) # executed? self.assertTrue(alg_test.isExecuted()) # Verify .... - d = json.load(open(out_path)) - plotname = "myplot" - d0 = d[plotname+'0'] # plots are numbered - np.testing.assert_array_equal(d0['x'], E) - np.testing.assert_array_equal(d0['y'], I) - np.testing.assert_array_equal(d0['e'], err) + d = json.load(open(out_path))[plotname] + self._checkData(d, E, I, err) # Delete the output file os.remove(out_path) return + def _checkData(self, s, E, I, err, ID="1"): + d0 = s["data"][ID] + np.testing.assert_array_equal(d0[0], E) + np.testing.assert_array_equal(d0[1], I) + np.testing.assert_array_equal(d0[2], err) + return + + def _createOneCurve(self, datawsname): """ Create data workspace """ - E = np.arange(-50, 50, 1.0) + E = np.arange(-50, 50, 10.0) I = 1000 * np.exp(-E**2/10**2) err = I ** .5 # create workspace dataws = api.CreateWorkspace( DataX = E, DataY = I, DataE = err, NSpec = 1, - UnitX = "Energy(meV)") + UnitX = "Energy") # Add to data service AnalysisDataService.addOrReplace(datawsname, dataws) return E, I, err + def _createOneQCurve(self, datawsname): + """ Create data workspace + """ + Q = np.arange(0, 13, 1.0) + I = 1000 * np.exp(-Q**2/10**2) + err = I ** .5 + # create workspace + dataws = api.CreateWorkspace( + DataX = Q, DataY = I, DataE = err, NSpec = 1, + UnitX = "Momentum") + # Add to data service + AnalysisDataService.addOrReplace(datawsname, dataws) + return Q, I, err + + def _createOneHistogram(self, datawsname): """ Create data workspace """ diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py new file mode 100644 index 0000000000000000000000000000000000000000..14651813e297fe91d44d8e8006bfc41db7655bbb --- /dev/null +++ b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py @@ -0,0 +1,59 @@ +import unittest +from mantid.simpleapi import Load, DeleteWorkspace, GroupWorkspaces, TOFTOFCropWorkspace +from testhelpers import run_algorithm +from mantid.api import AnalysisDataService + + +class TOFTOFCropWorkspaceTest(unittest.TestCase): + + _input_ws = None + _cropped_ws = None + + def setUp(self): + input_ws = Load(Filename="TOFTOFTestdata.nxs") + self._input_ws = input_ws + + def test_basicrun(self): + OutputWorkspaceName = "cropped_ws" + alg_test = run_algorithm("TOFTOFCropWorkspace", + InputWorkspace=self._input_ws, + OutputWorkspace=OutputWorkspaceName) + self.assertTrue(alg_test.isExecuted()) + self._cropped_ws = AnalysisDataService.retrieve(OutputWorkspaceName) + + run = self._cropped_ws.getRun() + # check existence of required entries in logs + self.assertTrue('full_channels' in run.keys()) + self.assertTrue('channel_width' in run.keys()) + # check their values + full_channels = float(run.getLogData('full_channels').value) + channel_width = float(run.getLogData('channel_width').value) + self.assertTrue(full_channels > 0.) + self.assertTrue(channel_width > 0.) + # check unit horizontal axis + self.assertEqual(self._cropped_ws.getAxis(0).getUnit().unitID(), 'TOF') + # check length of cropped ws + self.assertEqual(len(self._cropped_ws.readX(0)), int(full_channels)) + + def test_inputgroup(self): + group = GroupWorkspaces([self._input_ws]) + OutputWorkspaceName = "cropped_ws" + alg_test = run_algorithm("TOFTOFCropWorkspace", + InputWorkspace=group, + OutputWorkspace=OutputWorkspaceName) + self.assertTrue(alg_test.isExecuted()) + + def test_invalid_xunits(self): + self._input_ws.getAxis(0).setUnit('Wavelength') + OutputWorkspaceName = "cropped_ws" + self.assertRaises(RuntimeError, TOFTOFCropWorkspace, InputWorkspace=self._input_ws, + OutputWorkspace=OutputWorkspaceName) + + def cleanUp(self): + if AnalysisDataService.doesExist(self._input_ws): + DeleteWorkspace(self._input_ws) + if AnalysisDataService.doesExist(self._cropped_ws): + DeleteWorkspace(self._cropped_ws) + +if __name__ == "__main__": + unittest.main() diff --git a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h index 973c128b27ba685ec33b4abfe7b79f178da2f9a5..1a7c1005d68692eb07359cc90d0ad0731cadf8ed 100644 --- a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h +++ b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h @@ -6,6 +6,7 @@ #include "MantidAPI/Algorithm.h" #include "MantidAPI/IFunction.h" #include "MantidAPI/IPeakFunction.h" +#include "MantidGeometry/Crystal/PointGroup.h" #include "MantidKernel/Matrix.h" @@ -104,6 +105,9 @@ protected: getFunctionPawley(std::string profileFunctionName, const PoldiPeakCollection_sptr &peakCollection); + std::string getCrystalSystemFromPointGroup( + const Geometry::PointGroup_sptr &pointGroup) const; + std::string getRefinedStartingCell(const std::string &initialCell, const std::string &crystalSystem, diff --git a/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 5ace6536c53526aaddd76b1e7faec2a84e5e7b44..dc9755d28fbc0efb9ba8f4463e93b03d0c66e3dc 100644 --- a/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -546,8 +546,7 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley( "peaks do not have point group."); } - std::string crystalSystem = - getCrystalSystemAsString(pointGroup->crystalSystem()); + std::string crystalSystem = getCrystalSystemFromPointGroup(pointGroup); pawleyFunction->setCrystalSystem(crystalSystem); UnitCell cell = peakCollection->unitCell(); @@ -575,6 +574,35 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley( return mdFunction; } +/** + * Returns the crystal system for the specified point group + * + * This function simply uses Geometry::getCrystalSystemAsString(), except when + * the crystal system is trigonal but the point group uses hexagonal axes. In + * that case this function returns the string for PointGroup::Hexagonal. + * + * @param pointGroup :: The point group for which to find the crystal system + * @return The crystal system for the point group + */ +std::string PoldiFitPeaks2D::getCrystalSystemFromPointGroup( + const PointGroup_sptr &pointGroup) const { + if (!pointGroup) { + throw std::invalid_argument( + "Cannot return crystal system for null PointGroup."); + } + + PointGroup::CrystalSystem crystalSystem = pointGroup->crystalSystem(); + + if (crystalSystem == PointGroup::Trigonal) { + if (pointGroup->getCoordinateSystem() == + Group::CoordinateSystem::Hexagonal) { + return getCrystalSystemAsString(PointGroup::Hexagonal); + } + } + + return getCrystalSystemAsString(crystalSystem); +} + /** * Tries to refine the initial cell using the supplied peaks * diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp index 4a3ec4167a2bcbb4b2ea8d71ff9529c35d134574..48b5317b0eacdd7fdf4cc32a6cb5af86b2223ca7 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp @@ -385,6 +385,18 @@ UncertainValue PoldiAutoCorrelationCore::getCMessAndCSigma( case 2: { int middleIndex = cleanIndex((locator.icmin + 1), m_timeBinCount); + if (middleIndex < 0) { + m_logger.warning() << "Inconsistency foun while calculating correlation " + "intensity and error for d-value: " + << boost::lexical_cast<std::string>(dValue) + << ", with detector index: " + << boost::lexical_cast<std::string>(index) + << ", got middle index: " + << boost::lexical_cast<std::string>(middleIndex) + << ", ignoring it." << std::endl; + break; + } + double counts = getCounts(locator.detectorElement, middleIndex); double normCounts = getNormCounts(locator.detectorElement, middleIndex); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp index 02f23178125755897c583659e66ec70e8ca6ed16..665b2f1eefa67af58661bb36d0e4c8d86b5c6904 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp @@ -99,6 +99,15 @@ void PoldiResidualCorrelationCore::distributeCorrelationCounts( case 2: { int middleIndex = cleanIndex((locator.icmin + 1), m_timeBinCount); + if (middleIndex < 0) { + m_logger.warning() + << "Inconsistency foun while calculating distribute " + "correlation counts for d-value with index " + << boost::lexical_cast<std::string>(k) << ", got middle index: " + << boost::lexical_cast<std::string>(middleIndex) + << ", ignoring it." << std::endl; + break; + } addToCountData(locator.detectorElement, middleIndex, deltaForD); } case 1: { diff --git a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h index 4ced3e46bad5c158d1d9ef7f047fa179be817d44..35fbec1cc249f38f5f47758afc1a36845b5b3002 100644 --- a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h +++ b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h @@ -9,8 +9,7 @@ #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/IPeakFunction.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" #include "MantidSINQ/PoldiUtilities/PoldiPeak.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -21,6 +20,7 @@ using Mantid::Poldi::PoldiFitPeaks1D2; using namespace Mantid::Poldi; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::Kernel; using namespace Mantid::DataObjects; diff --git a/Framework/SINQ/test/PoldiFitPeaks1DTest.h b/Framework/SINQ/test/PoldiFitPeaks1DTest.h index a2158802104fad5391ed961eec6a2eced22c43b3..452d6472c3987e074ea2ba878042f6b2cca616c4 100644 --- a/Framework/SINQ/test/PoldiFitPeaks1DTest.h +++ b/Framework/SINQ/test/PoldiFitPeaks1DTest.h @@ -9,8 +9,7 @@ #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/IPeakFunction.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" #include "MantidSINQ/PoldiUtilities/PoldiPeak.h" @@ -18,6 +17,7 @@ using Mantid::Poldi::PoldiFitPeaks1D; using namespace Mantid::Poldi; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::Kernel; class TestablePoldiFitPeaks1D : public Mantid::Poldi::PoldiFitPeaks1D { diff --git a/Framework/SINQ/test/PoldiFitPeaks2DTest.h b/Framework/SINQ/test/PoldiFitPeaks2DTest.h index da95dd9141476a4b1fdef8b7604b044ff0b0f45a..a9f11eb2d9af4e130098bdbf47729f9625cfc4e6 100644 --- a/Framework/SINQ/test/PoldiFitPeaks2DTest.h +++ b/Framework/SINQ/test/PoldiFitPeaks2DTest.h @@ -433,6 +433,40 @@ public: TS_ASSERT_EQUALS(refinedCell, "5 5 5 90 90 90"); } + void testGetCrystalSystemFromPointGroup() { + TestablePoldiFitPeaks2D alg; + + auto pgCubic = PointGroupFactory::Instance().createPointGroup("m-3m"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgCubic), "Cubic"); + + auto pgTetra = PointGroupFactory::Instance().createPointGroup("4/mmm"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTetra), "Tetragonal"); + + auto pgOrtho = PointGroupFactory::Instance().createPointGroup("mmm"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgOrtho), + "Orthorhombic"); + + auto pgMono = PointGroupFactory::Instance().createPointGroup("2/m"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgMono), "Monoclinic"); + + auto pgTric = PointGroupFactory::Instance().createPointGroup("-1"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTric), "Triclinic"); + + auto pgHex = PointGroupFactory::Instance().createPointGroup("6/mmm"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgHex), "Hexagonal"); + + auto pgTrigRh = PointGroupFactory::Instance().createPointGroup("-3m r"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigRh), "Trigonal"); + + auto pgTrigHex = PointGroupFactory::Instance().createPointGroup("-3m"); + TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigHex), + "Hexagonal"); + + PointGroup_sptr invalid; + TS_ASSERT_THROWS(alg.getCrystalSystemFromPointGroup(invalid), + std::invalid_argument); + } + private: PoldiInstrumentAdapter_sptr m_instrument; PoldiTimeTransformer_sptr m_timeTransformer; diff --git a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h index f9eb10908965fcbc41cb3fb4ab9d8c382c5a8382..492393f6b0a8a8122190cbd8da275650fb1d74fe 100644 --- a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h +++ b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h @@ -12,7 +12,6 @@ #include "MantidAPI/FunctionValues.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MultiDomainFunction.h" -#include "MantidCurveFitting/Gaussian.h" #include "MantidCurveFitting/FitMW.h" #include "MantidCurveFitting/Jacobian.h" diff --git a/Framework/WorkflowAlgorithms/src/RefReduction.cpp b/Framework/WorkflowAlgorithms/src/RefReduction.cpp index 4ece40c1ee5a6b08b584bceb6cc4eb34b8aee91b..c65be0ce528d4931c1d315a5a70e4ce20c321a22 100644 --- a/Framework/WorkflowAlgorithms/src/RefReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/RefReduction.cpp @@ -629,6 +629,8 @@ double RefReduction::calculateAngleREFM(MatrixWorkspace_sptr workspace) { Mantid::Kernel::Property *prop = workspace->run().getProperty("SampleDetDis"); Mantid::Kernel::TimeSeriesProperty<double> *dp = dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double> *>(prop); + if (!dp) + throw std::runtime_error("SampleDetDis was not a TimeSeriesProperty"); const double det_distance = dp->getStatistics().mean / 1000.0; double direct_beam_pix = getProperty("DirectPixel"); diff --git a/MantidPlot/pymantidplot/__init__.py b/MantidPlot/pymantidplot/__init__.py index f77ce7c983d7da2f2fb6446947c212e40fcbedd5..3ea6a0189f54e0505309f7f71b712aba68fe14c9 100644 --- a/MantidPlot/pymantidplot/__init__.py +++ b/MantidPlot/pymantidplot/__init__.py @@ -300,7 +300,9 @@ def plotMD(source, plot_axis=-2, normalization=DEFAULT_MD_NORMALIZATION, error_b Args: source: Workspace(s) to plot plot_axis: Index of the plot axis (defaults to auto-select) - normalization: Type of normalization required (defaults to volume) + normalization: Type of normalization required (defaults to volume, options available: + MDNormalization.NoNormalization, MDNormalization.NumEventsNormalization, and + MDNormalization.VolumeNormalization). error_bars: Flag for error bar plotting. window: window used for plotting. If None a new one will be created clearWindow: if is True, the window specified will be cleared before adding new curve diff --git a/MantidPlot/src/ApplicationWindow.cpp b/MantidPlot/src/ApplicationWindow.cpp index d9455438c81ff03c2f0516cc79f00b0934b5c201..3fa69dd633f1932060d53fc279973fe2ed4731c0 100644 --- a/MantidPlot/src/ApplicationWindow.cpp +++ b/MantidPlot/src/ApplicationWindow.cpp @@ -10153,6 +10153,7 @@ void ApplicationWindow::showGraphContextMenu() { QMenu axes(this); QMenu colour(this); QMenu normalization(this); + QMenu normMD(this); QMenu exports(this); QMenu copy(this); QMenu prints(this); @@ -10218,6 +10219,27 @@ void ApplicationWindow::showGraphContextMenu() { noNorm->setChecked(!ag->isDistribution()); binNorm->setChecked(ag->isDistribution()); cm.insertItem(tr("&Normalization"), &normalization); + } else if (ag->normalizableMD()) { + QAction *noNormMD = new QAction(tr("N&one"), &normMD); + noNormMD->setCheckable(true); + connect(noNormMD, SIGNAL(activated()), ag, SLOT(noNormalizationMD())); + normMD.addAction(noNormMD); + + QAction *volNormMD = new QAction(tr("&Volume"), &normMD); + volNormMD->setCheckable(true); + connect(volNormMD, SIGNAL(activated()), ag, SLOT(volumeNormalizationMD())); + normMD.addAction(volNormMD); + + QAction *eventsNormMD = new QAction(tr("&Events"), &normMD); + eventsNormMD->setCheckable(true); + connect(eventsNormMD, SIGNAL(activated()), ag, SLOT(numEventsNormalizationMD())); + normMD.addAction(eventsNormMD); + + int normalization = ag->normalizationMD(); + noNormMD->setChecked(0 == normalization); + volNormMD->setChecked(1 == normalization); + eventsNormMD->setChecked(2 == normalization); + cm.insertItem("MD &Normalization", &normMD); } QMenu plotType(this); diff --git a/MantidPlot/src/ConfigDialog.cpp b/MantidPlot/src/ConfigDialog.cpp index 6344d67d31cb6107058a72196d4b9b7feec1ac5a..87e74e4ea83cab6eb72537345019aeadb92dc4f3 100644 --- a/MantidPlot/src/ConfigDialog.cpp +++ b/MantidPlot/src/ConfigDialog.cpp @@ -2341,8 +2341,11 @@ void ConfigDialog::apply() QList<MdiSubWindow*> windows = app->windowsList(); foreach(MdiSubWindow *w, windows){ if (w->isA("MultiLayer")){ - (dynamic_cast<MultiLayer*>(w))->setScaleLayersOnPrint(boxScaleLayersOnPrint->isChecked()); - (dynamic_cast<MultiLayer*>(w))->printCropmarks(boxPrintCropmarks->isChecked()); + MultiLayer* multiLayer = dynamic_cast<MultiLayer*>(w); + if (multiLayer) { + multiLayer->setScaleLayersOnPrint(boxScaleLayersOnPrint->isChecked()); + multiLayer->printCropmarks(boxPrintCropmarks->isChecked()); + } } } // general page: application tab diff --git a/MantidPlot/src/ContourLinesEditor.cpp b/MantidPlot/src/ContourLinesEditor.cpp index 19ff48b3bf2c9a39d2da9d592d99f953a1315e9b..144b2c7f245cd9c0bbb736cbee787ba77a733413 100644 --- a/MantidPlot/src/ContourLinesEditor.cpp +++ b/MantidPlot/src/ContourLinesEditor.cpp @@ -108,10 +108,14 @@ void ContourLinesEditor::updateContourLevels() int rows = table->rowCount(); QwtValueList levels; - for (int i = 0; i < rows; i++) - levels << dynamic_cast<DoubleSpinBox*>(table->cellWidget(i, 0))->value(); + for (int i = 0; i < rows; i++) { + DoubleSpinBox *spinBox = + dynamic_cast<DoubleSpinBox *>(table->cellWidget(i, 0)); + if (spinBox) + levels << spinBox->value(); + } - d_spectrogram->setContourLevels(levels); + d_spectrogram->setContourLevels(levels); } void ContourLinesEditor::updateContourPens() diff --git a/MantidPlot/src/CustomActionDialog.cpp b/MantidPlot/src/CustomActionDialog.cpp index 0ffe792247682d974fbf3c6af8338c200fa32c61..8b779deb8ec2a2fb4978b0b5a1439b5d8ba7b504 100644 --- a/MantidPlot/src/CustomActionDialog.cpp +++ b/MantidPlot/src/CustomActionDialog.cpp @@ -514,7 +514,10 @@ void CustomActionDialog::chooseFolder() QAction * CustomActionDialog::actionAt(int row) { ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(parent()); - QList<QAction *>actions = app->customActionsList(); + if (!app) + throw std::runtime_error( + "The parent of this dialog was not the Application Window"); + QList<QAction *>actions = app->customActionsList(); if (actions.isEmpty() || row < 0 || row >= actions.count()) return 0; diff --git a/MantidPlot/src/Graph.cpp b/MantidPlot/src/Graph.cpp index db3b3e6fcd290c43819c2df94f5f38d021aee8a4..b90d59c0c2ba39d003eb0589957f4663b3ab805e 100644 --- a/MantidPlot/src/Graph.cpp +++ b/MantidPlot/src/Graph.cpp @@ -60,6 +60,7 @@ #include "MantidAPI/AnalysisDataService.h" #include "Mantid/MantidMatrixCurve.h" +#include "Mantid/MantidMDCurve.h" #include "MantidQtAPI/PlotAxis.h" #include "MantidQtAPI/QwtRasterDataMD.h" #include "MantidQtAPI/QwtWorkspaceSpectrumData.h" @@ -209,6 +210,9 @@ Graph::Graph(int x, int y, int width, int height, QWidget* parent, Qt::WFlags f) m_isDistribution = false; m_normalizable = false; + + m_normalizableMD = false; + m_normalizationMD = 0; } void Graph::notifyChanges() @@ -1436,7 +1440,8 @@ void Graph::setAxisScale(int axis, double start, double end, int type, double st QwtScaleWidget *rightAxis = d_plot->axisWidget(QwtPlot::yRight); if(rightAxis) { - if (type == ScaleTransformation::Log10 && (start <= 0 || start == DBL_MAX)) + //if (type == ScaleTransformation::Log10 && (start <= 0 || start == DBL_MAX)) + if (type == GraphOptions::Log10 && (start <= 0 || start == DBL_MAX)) { start = sp->getMinPositiveValue(); } @@ -3411,12 +3416,15 @@ QString Graph::yAxisTitleFromFirstCurve() using namespace Mantid::API; QString wsName = firstCurve->workspaceName(); auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsName.toStdString()); - return MantidQt::API::PlotAxis(m_isDistribution, *ws).title(); - } - else - { - return axisTitle(0); + if (ws) + return MantidQt::API::PlotAxis(m_isDistribution, *ws).title(); + } else if (auto *firstCurve = dynamic_cast<MantidMDCurve*>(curve(0))) { + MantidQwtIMDWorkspaceData* data = firstCurve->mantidData(); + if (data) + return data->getYAxisLabel(); } + + return axisTitle(0); } void Graph::contextMenuEvent(QContextMenuEvent *e) @@ -5519,9 +5527,9 @@ void Graph::noNormalization() if(!m_isDistribution) return; // Nothing to do m_isDistribution = false; - updateDataCurves(); - d_plot->updateAxes(); - setYAxisTitle(yAxisTitleFromFirstCurve()); + + updateCurvesAndAxes(); + notifyChanges(); } @@ -5533,11 +5541,65 @@ void Graph::binWidthNormalization() if(m_isDistribution) return; // Nothing to do m_isDistribution = true; + + updateCurvesAndAxes(); + + notifyChanges(); +} + +/** + * Set 'None' normalization for MD plots + */ +void Graph::noNormalizationMD() +{ + if (!normalizableMD()) + return; + + setNormalizationMD(0); + + updateCurvesAndAxes(); + + notifyChanges(); +} + +/** + * Set volume normalization for MD plots + */ +void Graph::volumeNormalizationMD() +{ + if (!normalizableMD()) + return; + + setNormalizationMD(1); + + updateCurvesAndAxes(); + + notifyChanges(); +} + +/** + * Set number of events normalization for MD plots + */ +void Graph::numEventsNormalizationMD() +{ + if (!normalizableMD()) + return; + + setNormalizationMD(2); + + updateCurvesAndAxes(); + + notifyChanges(); +} + +/** + * Convenience method to use when updating the normalization types + * (whether Matrix or MD data normalizatio). + */ +void Graph::updateCurvesAndAxes() { updateDataCurves(); d_plot->updateAxes(); setYAxisTitle(yAxisTitleFromFirstCurve()); - - notifyChanges(); } void Graph::setWaterfallXOffset(int offset) @@ -5653,6 +5715,15 @@ void Graph::updateDataCurves() mc->invalidateBoundingRect(); mc->loadData(); } + else if (MantidMDCurve *mdc = dynamic_cast<MantidMDCurve*>(pc)) + { + //mdc->setDrawAsDistribution(m_isDistribution); + // yes, using int in Graph and ApplicationWindow instead of the proper enum, just so that + // IMDWorkspace.h does not need to be included in more places in MantidPlot + mdc->mantidData()->setNormalization(static_cast<Mantid::API::MDNormalization>(m_normalizationMD)); + mdc->invalidateBoundingRect(); + } + } QApplication::restoreOverrideCursor(); } diff --git a/MantidPlot/src/Graph.h b/MantidPlot/src/Graph.h index 9512139404943318a36ffc5dc9fa343d9fc82d7d..34ae08f03ca7eacf89224cf0b37a0bffcc81b19d 100644 --- a/MantidPlot/src/Graph.h +++ b/MantidPlot/src/Graph.h @@ -209,6 +209,20 @@ public slots: bool isDistribution() const { return m_isDistribution; } void setDistribution(const bool on) { m_isDistribution = on; } + void noNormalizationMD(); + void numEventsNormalizationMD(); + void volumeNormalizationMD(); + + /// normalizable in the MD sense, don't confuse with (bin width) normalizable(), + /// True if this is a plot MD + bool normalizableMD() const { return m_normalizableMD; } + void setNormalizableMD(const bool on) { m_normalizableMD = on; } + + /// when using MD curves (true == normalizbleMD()), what type of normalization + int normalizationMD() const { return m_normalizationMD; } + void setNormalizationMD(const int normalization) { m_normalizationMD = normalization; } + + //! Accessor method for #d_plot. Plot* plotWidget(){return d_plot;}; @@ -813,6 +827,8 @@ private: QString yAxisTitleFromFirstCurve(); + void updateCurvesAndAxes(); + Plot *d_plot; QwtPlotZoomer *d_zoomer[2]; TitlePicker *titlePicker; @@ -877,6 +893,12 @@ private: bool m_isDistribution; // True, if the graph can be plotted as distribution bool m_normalizable; + + // True if the graph is an MD plot and can be normalized (none, volume, events) + bool m_normalizableMD; + /// type of normalization for MD curves + int m_normalizationMD; + // x and y units of MantidCurves boost::shared_ptr<Mantid::Kernel::Unit> m_xUnits; boost::shared_ptr<Mantid::Kernel::Unit> m_yUnits; diff --git a/MantidPlot/src/ImportASCIIDialog.cpp b/MantidPlot/src/ImportASCIIDialog.cpp index 44c2ff0105b2c0636fe4a8fcebce9f9dbdcb0dcd..075910ef35fb89d929af75626a20ae8a6845b781 100644 --- a/MantidPlot/src/ImportASCIIDialog.cpp +++ b/MantidPlot/src/ImportASCIIDialog.cpp @@ -450,62 +450,67 @@ void ImportASCIIDialog::preview() void ImportASCIIDialog::previewTable() { - if (!d_preview_table) - return; + if (!d_preview_table) + return; - if (!d_preview_table->isVisible()) - d_preview_table->show(); + if (!d_preview_table->isVisible()) + d_preview_table->show(); - if (d_current_path.trimmed().isEmpty()){ - d_preview_table->clear(); - d_preview_table->resetHeader(); - return; - } + if (d_current_path.trimmed().isEmpty()){ + d_preview_table->clear(); + d_preview_table->resetHeader(); + return; + } - int importMode = d_import_mode->currentIndex(); - if (importMode == NewTables) - importMode = Table::Overwrite; - else - importMode -= 2; - - d_preview_table->resetHeader(); - d_preview_table->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(), - d_rename_columns->isChecked(), d_strip_spaces->isChecked(), - d_simplify_spaces->isChecked(), d_import_comments->isChecked(), - d_comment_string->text(), (Table::ImportMode)importMode, - boxEndLine->currentIndex(), d_preview_lines_box->value()); - - if (d_import_dec_separators->isChecked()) - d_preview_table->updateDecimalSeparators(decimalSeparators()); - if (!d_preview_table->isVisible()) - d_preview_table->show(); + int importMode = d_import_mode->currentIndex(); + if (importMode == NewTables) { + importMode = (ImportASCIIDialog::ImportMode)Table::Overwrite; + } else { + importMode -= 2; + } + + d_preview_table->resetHeader(); + d_preview_table->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(), + d_rename_columns->isChecked(), d_strip_spaces->isChecked(), + d_simplify_spaces->isChecked(), d_import_comments->isChecked(), + d_comment_string->text(), (Table::ImportMode)importMode, + boxEndLine->currentIndex(), d_preview_lines_box->value()); + + if (d_import_dec_separators->isChecked()) + d_preview_table->updateDecimalSeparators(decimalSeparators()); + + if (!d_preview_table->isVisible()) + d_preview_table->show(); } -void ImportASCIIDialog::previewMatrix() -{ - if (!d_preview_matrix) - return; +void ImportASCIIDialog::previewMatrix() { + if (!d_preview_matrix) + return; - if (d_current_path.trimmed().isEmpty()){ - d_preview_matrix->clear(); - return; - } + if (d_current_path.trimmed().isEmpty()) { + d_preview_matrix->clear(); + return; + } - int importMode = d_import_mode->currentIndex(); - if (importMode == NewMatrices) - importMode = Matrix::Overwrite; - else - importMode -= 2; + int importMode = d_import_mode->currentIndex(); + if (importMode == NewMatrices) { + importMode = (ImportASCIIDialog::ImportMode)Matrix::Overwrite; + } else { + // Overwrite-2 => NewColumns (in both Matrix::importMode and + // ImportASCIIDialog::importMode) + importMode -= 2; + } - QLocale locale = d_preview_matrix->locale(); - if(d_import_dec_separators->isChecked()) - locale = decimalSeparators(); + QLocale locale = d_preview_matrix->locale(); + if (d_import_dec_separators->isChecked()) + locale = decimalSeparators(); - d_preview_matrix->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(), - d_strip_spaces->isChecked(), d_simplify_spaces->isChecked(), - d_comment_string->text(), importMode, locale, - boxEndLine->currentIndex(), d_preview_lines_box->value()); - d_preview_matrix->resizeColumnsToContents(); + d_preview_matrix->importASCII( + d_current_path, columnSeparator(), d_ignored_lines->value(), + d_strip_spaces->isChecked(), d_simplify_spaces->isChecked(), + d_comment_string->text(), importMode, locale, boxEndLine->currentIndex(), + d_preview_lines_box->value()); + d_preview_matrix->resizeColumnsToContents(); } void ImportASCIIDialog::changePreviewFile(const QString& path) @@ -542,8 +547,8 @@ void ImportASCIIDialog::setNewWindowsOnly(bool on) if (on){ d_import_mode->clear(); d_import_mode->addItem(tr("New Table")); - d_import_mode->addItem(tr("New Matrice")); - d_import_mode->addItem(tr("New Workspace")); + d_import_mode->addItem(tr("New Matrix")); + d_import_mode->addItem(tr("New Workspace")); } d_preview_button->setChecked(false); diff --git a/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp b/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp index d83662b41b3b486ee0e4da6bce7f7fb13c2a5f1c..77766f8eff2801fa872fa1d9c612ba5122370e61 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp @@ -581,8 +581,8 @@ void UnwrappedSurface::drawSimpleToImage(QImage* image,bool picking)const if ( iw < 4 ) iw = 4; if ( ih < 4 ) ih = 4; - double w = (iw == 0)? dw : udet.width/2; - double h = (ih == 0)? dh : udet.height/2; + double w = udet.width/2; + double h = udet.height/2; if (!(m_viewRect.contains(udet.u-w, udet.v-h) || m_viewRect.contains(udet.u+w, udet.v+h))) continue; diff --git a/MantidPlot/src/Mantid/MantidUI.cpp b/MantidPlot/src/Mantid/MantidUI.cpp index d076bdf157480feeeb4f10b4ff922a8c1a7c90e4..f6ddf9efda70d0a46db18176e62f79426ebffe43 100644 --- a/MantidPlot/src/Mantid/MantidUI.cpp +++ b/MantidPlot/src/Mantid/MantidUI.cpp @@ -617,6 +617,9 @@ MultiLayer* MantidUI::plotMDList(const QStringList& wsNames, const int plotAxis, data->setPlotAxisChoice(plotAxis); data->setNormalization(normalization); + g->setNormalizableMD(true); + g->setNormalizationMD(normalization); + // Using information from the first graph if( i == 0 && isGraphNew ) g->setAutoScale(); diff --git a/MantidPlot/src/ScaleDetails.cpp b/MantidPlot/src/ScaleDetails.cpp index 71190376094ff0093f8972b303d2eba67214edcd..e6ef88b10316eb1eaf83abc126038653d8a710d5 100644 --- a/MantidPlot/src/ScaleDetails.cpp +++ b/MantidPlot/src/ScaleDetails.cpp @@ -272,6 +272,10 @@ void ScaleDetails::initWidgets() if (type == ScaleDraw::Date) { ScaleDraw *sclDraw = dynamic_cast<ScaleDraw *>(d_plot->axisScaleDraw(m_mappedaxis)); + if (!sclDraw) { + throw std::runtime_error("Could not convert the axis Scale Draw object " + "to a ScaleDraw object"); + } QDateTime origin = sclDraw->dateTimeOrigin(); m_dspnStart->hide(); diff --git a/MantidPlot/src/importOPJ.cpp b/MantidPlot/src/importOPJ.cpp index f5d393e96b4239a28a8c3f23f98e9eabfeca5a7d..458e67fe47debd7431cdd9268e58cb0edb4594b5 100644 --- a/MantidPlot/src/importOPJ.cpp +++ b/MantidPlot/src/importOPJ.cpp @@ -702,6 +702,8 @@ bool ImportOPJ::importGraphs(const OPJFile& opj) break; case 'F': s=opj.functionIndex(data.right(data.length()-2).toStdString().c_str()); + if (s<0) + break; int type; if(opj.functionType(s)==1)//Polar { diff --git a/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h b/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h index 85fa109a4511bb3ef96de179827dc54d33baab32..4d375e8cdc124c9d04bf0274f849ee4f597b7a13 100644 --- a/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h +++ b/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h @@ -36,19 +36,20 @@ namespace CustomDialogs { class GetNegMuMuonicXRDDialog : public API::AlgorithmDialog { Q_OBJECT - public: +public: /// Constructor GetNegMuMuonicXRDDialog(QWidget *parent = 0); - private: +private: /// Periodic Table widget used for selection of elements property - PeriodicTableWidget *periodicTable; + PeriodicTableWidget *m_periodicTable; /// QLineEdit used for input of y-position property - QLineEdit *yPosition; + QLineEdit *m_yPosition; /// QLineEdit used for input of GroupWorkspaceSpace - QLineEdit *groupWorkspaceNameInput; - //Check box for showing or hiding the Legend for PeriodicTableWidget - QCheckBox *showLegendCheck; + QLineEdit *m_groupWorkspaceNameInput; + // Check box for showing or hiding the Legend for PeriodicTableWidget + QCheckBox *m_showLegendCheck; + /// Validate that the input is not empty before running algorithm bool validateDialogInput(QString input); /** Enables a the buttons corresponding to the elements @@ -56,15 +57,15 @@ class GetNegMuMuonicXRDDialog : public API::AlgorithmDialog { */ void enableElementsForGetNegMuMuonicXRD(); - private slots: +private slots: /// When the "Run" button is clicked, the algorithm is executed with inputs void runClicked(); void showLegend(); - protected: +protected: // create the initial layout void initLayout(); - signals: +signals: /// signal emitted when validateDialogInput passes void validInput(); }; diff --git a/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp b/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp index 963da0325e8764e67562bd8801154cbca51c2648..463fae15e31cc0b36834b70bb1dfbef1ecd0c5a8 100644 --- a/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp +++ b/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp @@ -7,7 +7,6 @@ #include <QValidator> #include <QFormLayout> - namespace MantidQt { namespace CustomDialogs { DECLARE_DIALOG(GetNegMuMuonicXRDDialog) @@ -18,7 +17,8 @@ DECLARE_DIALOG(GetNegMuMuonicXRDDialog) */ GetNegMuMuonicXRDDialog::GetNegMuMuonicXRDDialog(QWidget *parent) - : API::AlgorithmDialog(parent) {} + : API::AlgorithmDialog(parent), m_periodicTable(NULL), m_yPosition(NULL), + m_groupWorkspaceNameInput(NULL), m_showLegendCheck(NULL) {} /// Initialise the layout void GetNegMuMuonicXRDDialog::initLayout() { @@ -26,18 +26,18 @@ void GetNegMuMuonicXRDDialog::initLayout() { this->setMaximumHeight(400); this->setMaximumWidth(675); // assign periodicTable member to a new periodicTable - periodicTable = new PeriodicTableWidget(); + m_periodicTable = new PeriodicTableWidget(); - // assign yPosition member to a new QLineEdit - yPosition = new QLineEdit(); - //assign GroupWorkspaceName member to a new QLineEdit - groupWorkspaceNameInput = new QLineEdit(); + // assign m_yPosition member to a new QLineEdit + m_yPosition = new QLineEdit(); + // assign GroupWorkspaceName member to a new QLineEdit + m_groupWorkspaceNameInput = new QLineEdit(); auto *groupWsInputLabel = new QLabel("OutputWorkspace"); - groupWorkspaceNameInput->setMaximumWidth(250); + m_groupWorkspaceNameInput->setMaximumWidth(250); // Disable all buttons on the periodicTable // as we only have a select few that need to be // enabled. - periodicTable->disableAllElementButtons(); + m_periodicTable->disableAllElementButtons(); /*Elements Enabled Correspond to those for which we * have data for in the dictionary found in @@ -51,44 +51,44 @@ void GetNegMuMuonicXRDDialog::initLayout() { // run button for executing the algorithm auto *runButton = new QPushButton("Run"); - // label for the QLineEdit for yPosition property - auto *yPositionLabel = new QLabel("Y Position"); + // label for the QLineEdit for m_yPosition property + auto *m_yPositionLabel = new QLabel("Y Position"); - /*validator allows only numeric input for yPosition + /*validator allows only numeric input for m_yPosition *this helps with validating the input. *Does not detect empty string as invalid input. */ - auto yPositionNumericValidator = new QDoubleValidator(); + auto m_yPositionNumericValidator = new QDoubleValidator(); // YPosition LineEdit Attributes - yPosition->setMaximumWidth(250); - yPosition->setPlaceholderText("-0.01"); - yPosition->setValidator(yPositionNumericValidator); + m_yPosition->setMaximumWidth(250); + m_yPosition->setPlaceholderText("-0.01"); + m_yPosition->setValidator(m_yPositionNumericValidator); // Run Button Attributes and signal/slot assignment runButton->setMaximumWidth(100); connect(runButton, SIGNAL(clicked()), this, SLOT(runClicked())); connect(this, SIGNAL(validInput()), this, SLOT(accept())); - //Show Legend button attributes and signal/slot asssignment - showLegendCheck = new QCheckBox("Show Legend"); - connect(showLegendCheck, SIGNAL(clicked()), this, SLOT(showLegend())); + // Show Legend button attributes and signal/slot asssignment + m_showLegendCheck = new QCheckBox("Show Legend"); + connect(m_showLegendCheck, SIGNAL(clicked()), this, SLOT(showLegend())); // Adding Widgets to Layout - main_layout->addWidget(periodicTable); - main_layout->addWidget(showLegendCheck); - main_layout->addWidget(yPositionLabel); - main_layout->addWidget(yPosition); + main_layout->addWidget(m_periodicTable); + main_layout->addWidget(m_showLegendCheck); + main_layout->addWidget(m_yPositionLabel); + main_layout->addWidget(m_yPosition); main_layout->addWidget(groupWsInputLabel); - main_layout->addWidget(groupWorkspaceNameInput); + main_layout->addWidget(m_groupWorkspaceNameInput); main_layout->addWidget(runButton); } /** * */ -void GetNegMuMuonicXRDDialog::showLegend(){ - bool checked = showLegendCheck->isChecked(); - periodicTable->showGroupLegend(checked); +void GetNegMuMuonicXRDDialog::showLegend() { + bool checked = m_showLegendCheck->isChecked(); + m_periodicTable->showGroupLegend(checked); } /** @@ -102,13 +102,13 @@ void GetNegMuMuonicXRDDialog::enableElementsForGetNegMuMuonicXRD() { * for the algorithm, and the button for that element can be enabled * the same as the elements are below. */ - periodicTable->enableButtonByName("Au"); - periodicTable->enableButtonByName("Ag"); - periodicTable->enableButtonByName("Cu"); - periodicTable->enableButtonByName("Zn"); - periodicTable->enableButtonByName("Pb"); - periodicTable->enableButtonByName("As"); - periodicTable->enableButtonByName("Sn"); + m_periodicTable->enableButtonByName("Au"); + m_periodicTable->enableButtonByName("Ag"); + m_periodicTable->enableButtonByName("Cu"); + m_periodicTable->enableButtonByName("Zn"); + m_periodicTable->enableButtonByName("Pb"); + m_periodicTable->enableButtonByName("As"); + m_periodicTable->enableButtonByName("Sn"); } /** @@ -128,7 +128,7 @@ bool GetNegMuMuonicXRDDialog::validateDialogInput(QString input) { */ void GetNegMuMuonicXRDDialog::runClicked() { // getting a list of strings of elements selected from periodicTableWidget - QString elementsSelectedStr = periodicTable->getAllCheckedElementsStr(); + QString elementsSelectedStr = m_periodicTable->getAllCheckedElementsStr(); // if no elements are selected from the PeriodicTableWidget, a pop-up appears // to the user. if (!validateDialogInput(elementsSelectedStr)) { @@ -141,15 +141,16 @@ void GetNegMuMuonicXRDDialog::runClicked() { // signal. if (validateDialogInput(elementsSelectedStr)) { storePropertyValue("Elements", elementsSelectedStr); - if (validateDialogInput(yPosition->text())) { - storePropertyValue("YAxisPosition", yPosition->text()); + if (validateDialogInput(m_yPosition->text())) { + storePropertyValue("YAxisPosition", m_yPosition->text()); } else { - // used as default value for yPosition property if the user does not input + // used as default value for m_yPosition property if the user does not + // input // one. - storePropertyValue("YAxisPosition", yPosition->placeholderText()); + storePropertyValue("YAxisPosition", m_yPosition->placeholderText()); } - if (validateDialogInput(groupWorkspaceNameInput->text())){ - storePropertyValue("OutputWorkspace", groupWorkspaceNameInput->text()); + if (validateDialogInput(m_groupWorkspaceNameInput->text())) { + storePropertyValue("OutputWorkspace", m_groupWorkspaceNameInput->text()); } emit validInput(); } diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h index 5423d7311d73d879001d488f2bdcd02e9b6ef5dc..1306417ed5c84ffd9139390a259a08e08a250d6d 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h @@ -62,6 +62,7 @@ namespace MantidQt virtual void giveUserWarning(std::string prompt, std::string title); virtual void giveUserCritical(std::string prompt, std::string title); virtual void showAlgorithmDialog(const std::string& algorithm); + virtual std::string requestNotebookPath(); //Plotting virtual void plotWorkspaces(const std::set<std::string>& workspaces); diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h index ba7cfe632c3682ec2472b1778fbfee8efb29998f..bfcca663b78dc95a9e99974146d2ec1d066007fb 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h @@ -57,6 +57,7 @@ namespace MantidQt virtual void giveUserWarning(std::string prompt, std::string title) = 0; virtual void giveUserCritical(std::string prompt, std::string title) = 0; virtual void showAlgorithmDialog(const std::string& algorithm) = 0; + virtual std::string requestNotebookPath() = 0; //Plotting virtual void plotWorkspaces(const std::set<std::string>& workspaces) = 0; diff --git a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp index 42270faab779a63de3226cd5b3b3cc4ebd2c2de6..e4e9d4484706608f74596258ca4846cf1bc906b7 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp @@ -145,6 +145,7 @@ void ApplyPaalmanPings::run() { switch (result) { case QMessageBox::YesToAll: interpolateAll = true; + //fall through case QMessageBox::Yes: addInterpolationStep(factorWs, absCorProps["SampleWorkspace"]); break; @@ -175,9 +176,18 @@ void ApplyPaalmanPings::run() { correctionType = "cyl"; break; } - const QString outputWsName = + QString outputWsName = sampleWsName.left(nameCutIndex) + +"_" + correctionType + "_Corrected"; + if (useCan) { + auto containerWsName = m_uiForm.dsContainer->getCurrentDataName(); + int cutIndex = containerWsName.indexOf("_"); + if (cutIndex == -1) { + cutIndex = containerWsName.length(); + } + outputWsName += "_Subtract_" + containerWsName.left(cutIndex); + } + applyCorrAlg->setProperty("OutputWorkspace", outputWsName.toStdString()); // Add corrections algorithm to queue diff --git a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp index 81277fad6d9919ec6d2057026a52be6716bff9c2..49584757883539d7ef1a4332893875067f9017e1 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp @@ -122,8 +122,17 @@ void CalculatePaalmanPings::run() { break; } - const QString outputWsName = + QString outputWsName = sampleWsName.left(nameCutIndex) + "_" + correctionType + "_abs"; + if (useCan) { + auto containerWsName = m_uiForm.dsContainer->getCurrentDataName(); + int cutIndex = containerWsName.indexOf("_"); + if (cutIndex == -1) { + cutIndex = containerWsName.length(); + } + outputWsName += "_Subtract_" + containerWsName.left(cutIndex); + } + absCorAlgo->setProperty("OutputWorkspace", outputWsName.toStdString()); // Add corrections algorithm to queue diff --git a/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp b/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp index ae32ddc36c2e30d07b9ff6dd2d5de8769a48a24a..9839ec88af9df01154c45c2d067bd7529c35b23d 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp @@ -447,6 +447,15 @@ void ISISEnergyTransfer::plotRaw() { return; } + if (m_uiForm.ckBackgroundRemoval->isChecked() == true) { + int startBack = m_uiForm.spBackgroundStart->value(); + int endBack = m_uiForm.spBackgroundEnd->value(); + if (startBack > endBack) { + emit showMessageBox("Background Start must be less than Background End"); + return; + } + } + QString rawFile = m_uiForm.dsRunFiles->getFirstFilename(); auto pos = rawFile.lastIndexOf("."); auto extension = rawFile.right(rawFile.length() - pos); diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp index a52e8a9ea46656ce5503523ea3af0e8a01bf2846..f70fe204e98fc0c6d7dd30b80c2caff417715d33 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp @@ -31,6 +31,7 @@ namespace CustomInterfaces ALCInterface::ALCInterface(QWidget* parent) : UserSubWindow(parent), m_ui(), + m_baselineModellingView(NULL), m_peakFittingView(NULL), m_dataLoading(NULL), m_baselineModelling(NULL), m_peakFitting(NULL), m_baselineModellingModel(new ALCBaselineModellingModel()), m_peakFittingModel(new ALCPeakFittingModel()) diff --git a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp index a2c94562df9b0f759051ea6d4a835b49f4ab67b0..6f599771e4f4ffc5b63452900b01485518c834b5 100644 --- a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp +++ b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp @@ -434,6 +434,17 @@ namespace MantidQt runPythonCode(QString::fromStdString(pythonSrc.str())); } + /** + Show the user file dialog to choose save location of notebook + */ + std::string QtReflMainView::requestNotebookPath() + { + QString qfilename = QFileDialog::getSaveFileName(0, "Save notebook file", QDir::currentPath(), + "IPython Notebook files (*.ipynb);;All files (*.*)", + new QString("IPython Notebook files (*.ipynb)")); + return qfilename.toStdString(); + } + /** Plot a workspace */ diff --git a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp index 8b813d6392f361ddceaef1748a5cf1a5cec4e2eb..2aedd280cf80054880642b336291837ffc642aa8 100644 --- a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp @@ -295,16 +295,15 @@ namespace MantidQt */ void ReflMainViewPresenter::saveNotebook(std::map<int,std::set<int>> groups, std::set<int> rows) { - std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook( - m_wsName, m_model, m_view->getProcessInstrument(), COL_RUNS, COL_TRANSMISSION, COL_OPTIONS, COL_ANGLE, - COL_QMIN, COL_QMAX, COL_DQQ, COL_SCALE, COL_GROUP)); - QString qfilename = QFileDialog::getSaveFileName(0, "Save notebook file", QDir::currentPath(), - "IPython Notebook files (*.ipynb);;All files (*.*)", - new QString("IPython Notebook files (*.ipynb)")); - std::string filename = qfilename.toStdString(); + + std::string filename = m_view->requestNotebookPath(); if (filename == "") { return; } + + std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook( + m_wsName, m_model, m_view->getProcessInstrument(), COL_RUNS, COL_TRANSMISSION, COL_OPTIONS, COL_ANGLE, + COL_QMIN, COL_QMAX, COL_DQQ, COL_SCALE, COL_GROUP)); std::string generatedNotebook = notebook->generateNotebook(groups, rows); std::ofstream file(filename.c_str(), std::ofstream::trunc); diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp index 60d8a1e2bd0dbc8a26e01cb9dcae0898e0a27395..b343d7c20876fa95bda014ff49ed75407ab2daaf 100644 --- a/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp +++ b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp @@ -5,9 +5,7 @@ using namespace MantidQt::CustomInterfaces; namespace MantidQt { namespace CustomInterfaces { -ImageStackPreParams::ImageStackPreParams() -{ +ImageStackPreParams::ImageStackPreParams() : medianFilter(false) {} -} } // namespace CustomInterfaces } // namespace MantidQt diff --git a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp index 15c9f4550e6d57228cd464e6c3cb350e47c23449..5aaaaccde66a10647182a685e42fefe0ca5570aa 100644 --- a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp +++ b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp @@ -582,7 +582,6 @@ TomographyIfaceModel::loadFITSImage(const std::string &path) { "Failed to load image. Could not load this file as a " "FITS image: " + std::string(e.what())); - return WorkspaceGroup_sptr(); } if (!alg->isExecuted()) { throw std::runtime_error( diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h index 2d7f91d24a4c10c40bf3b3b3eb28cd15585c7b90..026b49d21b3e9966e32a84f26c1b3df3b72ea023 100644 --- a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h +++ b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h @@ -33,6 +33,7 @@ public: MOCK_METHOD2(giveUserCritical, void(std::string, std::string)); MOCK_METHOD2(giveUserInfo, void(std::string, std::string)); MOCK_METHOD2(giveUserWarning, void(std::string, std::string)); + MOCK_METHOD0(requestNotebookPath, std::string()); MOCK_METHOD1(showAlgorithmDialog, void(const std::string&)); MOCK_METHOD1(plotWorkspaces, void(const std::set<std::string>&)); @@ -46,6 +47,7 @@ public: MOCK_CONST_METHOD0(getClipboard, std::string()); MOCK_CONST_METHOD0(getSearchString, std::string()); MOCK_CONST_METHOD0(getSearchInstrument, std::string()); + MOCK_METHOD0(getEnableNotebook, bool()); //Calls we don't care about virtual void showTable(QReflTableModel_sptr) {}; @@ -53,7 +55,6 @@ public: virtual void setOptionsHintStrategy(MantidQt::MantidWidgets::HintStrategy*) {}; virtual void setProgressRange(int,int) {}; virtual void setProgress(int) {}; - virtual bool getEnableNotebook() {return false;}; virtual void setTableList(const std::set<std::string>&) {}; virtual void setInstrumentList(const std::vector<std::string>&, const std::string&) {}; virtual std::string getProcessInstrument() const {return "FAKE";} diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h index 4c53fb56bf68c8693e9933f650f7aa5440c18545..36d043f921e47425dc4ed88c241c0207f61cee26 100644 --- a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h +++ b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h @@ -13,6 +13,7 @@ #include "MantidQtCustomInterfaces/ReflMainViewPresenter.h" #include "ReflMainViewMockObjects.h" +#include "../inc/MantidQtCustomInterfaces/IReflPresenter.h" using namespace MantidQt::CustomInterfaces; using namespace Mantid::API; @@ -136,6 +137,8 @@ public: TS_ASSERT(AnalysisDataService::Instance().doesExist("TestWorkspace")); AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testSaveExisting() { @@ -152,6 +155,8 @@ public: presenter.notify(IReflPresenter::SaveFlag); AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testSaveAs() { @@ -180,6 +185,8 @@ public: AnalysisDataService::Instance().remove("TestWorkspace"); AnalysisDataService::Instance().remove("Workspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testAppendRow() { @@ -220,6 +227,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testAppendRowSpecify() { @@ -263,6 +272,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testAppendRowSpecifyPlural() { @@ -305,6 +316,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPrependRow() { @@ -344,6 +357,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPrependRowSpecify() { @@ -386,6 +401,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPrependRowSpecifyPlural() { @@ -429,6 +446,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testDeleteRowNone() { @@ -460,6 +479,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testDeleteRowSingle() { @@ -495,6 +516,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testDeleteRowPlural() { @@ -533,6 +556,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testProcess() { @@ -559,6 +584,11 @@ public: EXPECT_CALL(mockView, getSelectedRows()) .Times(1) .WillRepeatedly(Return(rowlist)); + EXPECT_CALL(mockView, getEnableNotebook()) + .Times(1) + .WillRepeatedly(Return(false)); + EXPECT_CALL(mockView, requestNotebookPath()) + .Times(0); presenter.notify(IReflPresenter::ProcessFlag); // Check output workspaces were created as expected @@ -579,6 +609,52 @@ public: AnalysisDataService::Instance().remove("IvsLam_12346"); AnalysisDataService::Instance().remove("TOF_12346"); AnalysisDataService::Instance().remove("IvsQ_12345_12346"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); + } + + void testProcessWithNotebook() { + MockView mockView; + ReflMainViewPresenter presenter(&mockView); + + createPrefilledWorkspace("TestWorkspace"); + EXPECT_CALL(mockView, getWorkspaceToOpen()) + .Times(1) + .WillRepeatedly(Return("TestWorkspace")); + presenter.notify(IReflPresenter::OpenTableFlag); + + std::set<int> rowlist; + rowlist.insert(0); + rowlist.insert(1); + + createTOFWorkspace("TOF_12345", "12345"); + createTOFWorkspace("TOF_12346", "12346"); + + // We should not receive any errors + EXPECT_CALL(mockView, giveUserCritical(_, _)).Times(0); + + // The user hits the "process" button with the first two rows selected + EXPECT_CALL(mockView, getSelectedRows()) + .Times(1) + .WillRepeatedly(Return(rowlist)); + EXPECT_CALL(mockView, getEnableNotebook()) + .Times(1) + .WillRepeatedly(Return(true)); + EXPECT_CALL(mockView, requestNotebookPath()) + .Times(1); + presenter.notify(IReflPresenter::ProcessFlag); + + // Tidy up + AnalysisDataService::Instance().remove("TestWorkspace"); + AnalysisDataService::Instance().remove("IvsQ_12345"); + AnalysisDataService::Instance().remove("IvsLam_12345"); + AnalysisDataService::Instance().remove("TOF_12345"); + AnalysisDataService::Instance().remove("IvsQ_12346"); + AnalysisDataService::Instance().remove("IvsLam_12346"); + AnalysisDataService::Instance().remove("TOF_12346"); + AnalysisDataService::Instance().remove("IvsQ_12345_12346"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } /* @@ -641,6 +717,8 @@ public: AnalysisDataService::Instance().remove("IvsQ_12346"); AnalysisDataService::Instance().remove("IvsLam_12346"); AnalysisDataService::Instance().remove("IvsQ_dataA_12346"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testBadWorkspaceType() { @@ -671,6 +749,8 @@ public: presenter.notify(IReflPresenter::OpenTableFlag); AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testBadWorkspaceLength() { @@ -705,6 +785,8 @@ public: presenter.notify(IReflPresenter::OpenTableFlag); AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPromptSaveAfterAppendRow() { @@ -732,6 +814,8 @@ public: // The user tries to create a new table again, and does not get bothered EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0); presenter.notify(IReflPresenter::NewTableFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPromptSaveAfterDeleteRow() { @@ -771,6 +855,8 @@ public: // The user tries to create a new table again, and does not get bothered EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0); presenter.notify(IReflPresenter::NewTableFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPromptSaveAndDiscard() { @@ -791,6 +877,8 @@ public: // These next two times they don't get prompted - they have a new table presenter.notify(IReflPresenter::NewTableFlag); presenter.notify(IReflPresenter::NewTableFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPromptSaveOnOpen() { @@ -823,6 +911,8 @@ public: .WillRepeatedly(Return("TestWorkspace")); EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0); presenter.notify(IReflPresenter::OpenTableFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testExpandSelection() { @@ -984,6 +1074,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testClearRows() { @@ -1043,6 +1135,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testCopyRow() { @@ -1066,6 +1160,8 @@ public: .Times(1) .WillRepeatedly(Return(rowlist)); presenter.notify(IReflPresenter::CopySelectedFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testCopyRows() { @@ -1095,6 +1191,8 @@ public: .Times(1) .WillRepeatedly(Return(rowlist)); presenter.notify(IReflPresenter::CopySelectedFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testCutRow() { @@ -1129,6 +1227,8 @@ public: TS_ASSERT_EQUALS(ws->String(0, RunCol), "12345"); TS_ASSERT_EQUALS(ws->String(1, RunCol), "24681"); TS_ASSERT_EQUALS(ws->String(2, RunCol), "24682"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testCutRows() { @@ -1165,6 +1265,8 @@ public: TS_ASSERT_EQUALS(ws->rowCount(), 1); // Check the only unselected row is left behind TS_ASSERT_EQUALS(ws->String(0, RunCol), "24682"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPasteRow() { @@ -1212,6 +1314,8 @@ public: TS_ASSERT_EQUALS(ws->Double(1, ScaleCol), 5.0); TS_ASSERT_EQUALS(ws->Int(1, GroupCol), 6); TS_ASSERT_EQUALS(ws->String(1, OptionsCol), "abc"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPasteNewRow() { @@ -1257,6 +1361,8 @@ public: TS_ASSERT_EQUALS(ws->Double(4, ScaleCol), 5.0); TS_ASSERT_EQUALS(ws->Int(4, GroupCol), 6); TS_ASSERT_EQUALS(ws->String(4, OptionsCol), "abc"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPasteRows() { @@ -1315,6 +1421,8 @@ public: TS_ASSERT_EQUALS(ws->Double(2, ScaleCol), 3.0); TS_ASSERT_EQUALS(ws->Int(2, GroupCol), 2); TS_ASSERT_EQUALS(ws->String(2, OptionsCol), "def"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPasteNewRows() { @@ -1371,6 +1479,8 @@ public: TS_ASSERT_EQUALS(ws->Double(5, ScaleCol), 3.0); TS_ASSERT_EQUALS(ws->Int(5, GroupCol), 2); TS_ASSERT_EQUALS(ws->String(5, OptionsCol), "def"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testImportTable() { @@ -1378,6 +1488,8 @@ public: ReflMainViewPresenter presenter(&mockView); EXPECT_CALL(mockView, showAlgorithmDialog("LoadReflTBL")); presenter.notify(IReflPresenter::ImportTableFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testExportTable() { @@ -1385,6 +1497,8 @@ public: ReflMainViewPresenter presenter(&mockView); EXPECT_CALL(mockView, showAlgorithmDialog("SaveReflTBL")); presenter.notify(IReflPresenter::ExportTableFlag); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPlotRowWarn() { @@ -1416,6 +1530,8 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); AnalysisDataService::Instance().remove("TOF_12345"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } void testPlotGroupWarn() { @@ -1447,6 +1563,8 @@ public: AnalysisDataService::Instance().remove("TestWorkspace"); AnalysisDataService::Instance().remove("TOF_12345"); AnalysisDataService::Instance().remove("TOF_12346"); + + TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); } }; diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h index 87c698152d416147984d697f1388586bcfcbb8c6..c9ed1e70dcc5161d9133979b1a95a8ff6dcd466e 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h @@ -296,6 +296,8 @@ protected slots: void parameterChanged(QtProperty*); void parameterButtonClicked(QtProperty*); void globalChanged(QtProperty*, const QString&, bool); + /// Set value of an attribute (as a property) to a function + void setAttributeToFunction(Mantid::API::IFunction& fun, QtProperty* prop); protected: /// Manager for function group properties diff --git a/MantidQt/MantidWidgets/src/FunctionBrowser.cpp b/MantidQt/MantidWidgets/src/FunctionBrowser.cpp index edd8806fe5a7c6193b98df76b252a8d114346712..4184cc459586d37d77b198d246ceac180de1eab4 100644 --- a/MantidQt/MantidWidgets/src/FunctionBrowser.cpp +++ b/MantidQt/MantidWidgets/src/FunctionBrowser.cpp @@ -1348,6 +1348,28 @@ void FunctionBrowser::addFunction() emit functionStructureChanged(); } +/** + * Set value of an attribute (as a property) to a function. + * @param fun :: Function to which attribute is set. + * @param prop :: A property with the name and value of the attribute. + */ +void FunctionBrowser::setAttributeToFunction(Mantid::API::IFunction& fun, QtProperty* prop) +{ + std::string attName = prop->propertyName().toStdString(); + SetAttributeFromProperty setter(this,prop); + Mantid::API::IFunction::Attribute attr = fun.getAttribute(attName); + attr.apply(setter); + try + { + fun.setAttribute(attName,attr); + } + catch(std::exception& expt) + { + QMessageBox::critical(this,"MantidPlot - Error", "Cannot set attribute " + QString::fromStdString(attName) + + " of function " + prop->propertyName() + ":\n\n" + QString::fromStdString(expt.what())); + } +} + /** * Return the function * @param prop :: Function property @@ -1380,6 +1402,10 @@ Mantid::API::IFunction_sptr FunctionBrowser::getFunction(QtProperty* prop, bool cf->addFunction(f); } } + else if (isAttribute(child)) + { + setAttributeToFunction(*fun, child); + } } } else @@ -1390,19 +1416,7 @@ Mantid::API::IFunction_sptr FunctionBrowser::getFunction(QtProperty* prop, bool { if (isAttribute(child)) { - std::string attName = child->propertyName().toStdString(); - SetAttributeFromProperty setter(this,child); - Mantid::API::IFunction::Attribute attr = fun->getAttribute(attName); - attr.apply(setter); - try - { - fun->setAttribute(attName,attr); - } - catch(std::exception& expt) - { - QMessageBox::critical(this,"MantidPlot - Error", "Cannot set attribute " + QString::fromStdString(attName) + - " of function " + prop->propertyName() + ":\n\n" + QString::fromStdString(expt.what())); - } + setAttributeToFunction(*fun, child); } else if (!attributesOnly && isParameter(child)) { diff --git a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp index 49ba9501a901953737b28baed4496415ab89b8c3..2169429a18df8d1b89d87677a524940365dd3ffe 100644 --- a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp +++ b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp @@ -368,28 +368,23 @@ namespace MantidWidgets MatrixWorkspace_sptr ws; - auto load = boost::dynamic_pointer_cast<AlgorithmProxy>( AlgorithmManager::Instance().create("MuonLoad") ); - load->setChild(true); - load->setRethrows(true); - load->copyPropertiesFrom(*m_loadAlg); - - try - { + try { + auto load = AlgorithmManager::Instance().create("MuonLoad"); load->initialize(); - - load->setPropertyValue( "Filename", fileIt->toStdString() ); - load->setPropertyValue( "OutputWorkspace", "__YouDontSeeMeIAmNinja" ); // Is not used - - if ( m_fitPropBrowser->rawData() ) // TODO: or vice verca? - load->setPropertyValue( "RebinParams", "" ); + load->setChild(true); + load->setRethrows(true); + load->updatePropertyValues(*m_loadAlg); + load->setPropertyValue("Filename", fileIt->toStdString()); + load->setPropertyValue("OutputWorkspace", "__YouDontSeeMeIAmNinja"); + if (m_fitPropBrowser->rawData()) // TODO: or vice verca? + load->setPropertyValue("RebinParams", ""); load->execute(); ws = load->getProperty("OutputWorkspace"); - } - catch(...) - { - QMessageBox::critical(this, "Loading failed", + } catch (...) { + QMessageBox::critical( + this, "Loading failed", "Unable to load one of the files.\n\nCheck log for details"); break; } diff --git a/MantidQt/SliceViewer/src/PeaksViewer.cpp b/MantidQt/SliceViewer/src/PeaksViewer.cpp index 8034a80c7909877c78b2e430082b98b8e5b4776a..ac8fb544ccfb0608c79fc78374bcc485ece737eb 100644 --- a/MantidQt/SliceViewer/src/PeaksViewer.cpp +++ b/MantidQt/SliceViewer/src/PeaksViewer.cpp @@ -122,9 +122,9 @@ PeaksViewer::~PeaksViewer() {} */ bool PeaksViewer::hasThingsToShow() const { return m_presenter->size() >= 1; } -void PeaksViewer:: clearPeaksModeRequest( +void PeaksViewer::clearPeaksModeRequest( const PeaksWorkspaceWidget *const originWidget, const bool on) { - EditMode mode; + EditMode mode = None; if (on) { QList<PeaksWorkspaceWidget *> children = qFindChildren<PeaksWorkspaceWidget *>(this); @@ -149,7 +149,7 @@ void PeaksViewer:: clearPeaksModeRequest( void PeaksViewer::addPeaksModeRequest(const PeaksWorkspaceWidget * const originWidget, const bool on) { - EditMode mode; + EditMode mode = None; if(on) { QList<PeaksWorkspaceWidget *> children = qFindChildren<PeaksWorkspaceWidget *>(this); diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h index b3cd39f36e9a261ea1cfe2f29978d28b1efbb2c1..a7cdd630803f9bf82ed17fe8141e2dfad3eaac94 100644 --- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h +++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h @@ -96,7 +96,7 @@ class EXPORT_OPT_MANTIDQT_SPECTRUMVIEWER GraphDisplay double m_minY; double m_maxY; - static QColor g_curveColors[]; + static std::vector<QColor> g_curveColors; }; diff --git a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp index fb458c40088478e07a1b3a7bc941514268b022d4..3b3f3f25de46e91737a218ce8c00db2f5d172919 100644 --- a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp +++ b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp @@ -12,7 +12,7 @@ namespace MantidQt namespace SpectrumView { -QColor GraphDisplay::g_curveColors[] = {Qt::black, Qt::red, Qt::green, Qt::blue}; +std::vector<QColor> GraphDisplay::g_curveColors; /** * Construct a GraphDisplay to display selected graph on the specifed plot @@ -40,6 +40,11 @@ GraphDisplay::GraphDisplay( QwtPlot* graphPlot, { if(isVertical) graphPlot->setAxisMaxMajor( QwtPlot::xBottom, 3 ); + + g_curveColors.push_back(Qt::black); + g_curveColors.push_back(Qt::red); + g_curveColors.push_back(Qt::green); + g_curveColors.push_back(Qt::blue); } @@ -130,7 +135,7 @@ void GraphDisplay::setData(const QVector<double> & xData, auto curve = new QwtPlotCurve; curve->setData( xData, yData ); curve->attach( m_graphPlot ); - auto colorIndex = m_curves.size() % sizeof(g_curveColors); + auto colorIndex = m_curves.size() % g_curveColors.size(); curve->setPen(QPen(g_curveColors[colorIndex])); m_curves.append(curve); diff --git a/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py b/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py index d0fbaa674ef409534fa863367f3485c382d0a7c4..11fa3b62ea0893150faf633ee78992f4c4117bdd 100644 --- a/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py +++ b/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py @@ -238,6 +238,10 @@ class VesuvioTests(unittest.TestCase): #================== Failure cases ================================ + def test_run_range_bad_order_raises_error(self): + self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188-14187", + OutputWorkspace=self.ws_name) + def test_missing_spectra_property_raises_error(self): self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188", OutputWorkspace=self.ws_name) diff --git a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp index 748722813c5ac3a15ecafcdd812c525e03cee2c2..5413e173b246519bac7a43cb2f923107b971d8ea 100644 --- a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp +++ b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp @@ -92,6 +92,12 @@ namespace Mantid coord_t incrementX = (maxX - minX) / static_cast<coord_t>(nBinsX); coord_t incrementY = (maxY - minY) / static_cast<coord_t>(nBinsY); + boost::scoped_ptr<MDHistoWorkspaceIterator> iterator(dynamic_cast<MDHistoWorkspaceIterator*>(createIteratorWithNormalization(m_normalizationOption, m_workspace.get()))); + if (!iterator) { + throw std::runtime_error( + "Could not convert IMDIterator to a MDHistoWorkspaceIterator"); + } + const int imageSize = (nBinsX ) * (nBinsY ); vtkPoints *points = vtkPoints::New(); points->Allocate(static_cast<int>(imageSize)); @@ -119,8 +125,7 @@ namespace Mantid double progressFactor = 0.5/double(nBinsX); double progressOffset = 0.5; - boost::scoped_ptr<MDHistoWorkspaceIterator> iterator(dynamic_cast<MDHistoWorkspaceIterator*>(createIteratorWithNormalization(m_normalizationOption, m_workspace.get()))); - + size_t index = 0; for (int i = 0; i < nBinsX; i++) { diff --git a/buildconfig/move_class.py b/buildconfig/move_class.py index e51e53c45c28785f805f69b2f99f707b9d2a239b..09b62d51fee7a4296d2b399b93a97d5dfda56511 100755 --- a/buildconfig/move_class.py +++ b/buildconfig/move_class.py @@ -15,32 +15,36 @@ def move_one(subproject, classname, newproject, newclassname, oldfilename, newfi """Move one file """ # Move the file - cmd = "mv " + oldfilename + " " + newfilename - if not args.no_vcs: - cmd = "git " + cmd - print "Running:", cmd - retval = os.system(cmd) - if retval != 0: - raise RuntimeError("Error executing cmd '%s'" % cmd) - - f = open(newfilename, 'r') - text = f.read() - f.close() - - # Replace any includes of it - text = text.replace("Mantid" + subproject + "/" + args.source_subfolder + classname + ".h", - "Mantid" + newproject + "/" + args.dest_subfolder + newclassname + ".h") - - #Replace the guard - old_guard = "MANTID_%s_%s_H_" % (subproject.upper(), classname.upper()) - new_guard = "MANTID_%s_%s_H_" % (newproject.upper(), newclassname.upper()) - text = text.replace(old_guard, new_guard) - - # Replace the namespace declaration - text = text.replace("namespace " + subproject, "namespace " + newproject) - # Replace the conents - f = open(newfilename, 'w') - f.write(text) + try: + cmd = "mv " + oldfilename + " " + newfilename + cmd = cmd.replace("\\","/") + if not args.no_vcs: + cmd = "git " + cmd + print "Running:", cmd + retval = os.system(cmd) + if retval != 0: + raise RuntimeError("Error executing cmd '%s'" % cmd) + + f = open(newfilename, 'r') + text = f.read() + f.close() + + # Replace any includes of it + text = text.replace("Mantid" + subproject + "/" + args.source_subfolder + classname + ".h", + "Mantid" + newproject + "/" + args.dest_subfolder + newclassname + ".h") + + #Replace the guard + old_guard = "MANTID_%s_%s_H_" % (subproject.upper(), classname.upper()) + new_guard = "MANTID_%s_%s_H_" % (newproject.upper(), newclassname.upper()) + text = text.replace(old_guard, new_guard) + + # Replace the namespace declaration + text = text.replace("namespace " + subproject, "namespace " + newproject) + # Replace the conents + f = open(newfilename, 'w') + f.write(text) + except RuntimeError as err: + print err @@ -57,7 +61,7 @@ def move_all(subproject, classname, newproject, newclassname, args): newheaderfile = os.path.join(newbasedir, "inc/" + new_header_folder + "/" + args.dest_subfolder + newclassname + ".h") newsourcefile = os.path.join(newbasedir, "src/" + args.dest_subfolder + newclassname + ".cpp") - newtestfile = os.path.join(newbasedir, "test/" + newclassname + "Test.h") + newtestfile = os.path.join(newbasedir, "test/" + args.dest_subfolder + newclassname + "Test.h") if args.header and not overwrite and os.path.exists(newheaderfile): print "\nError! Header file %s already exists. Use --force to overwrite.\n" % newheaderfile diff --git a/docs/source/algorithms/Fit-v1.rst b/docs/source/algorithms/Fit-v1.rst index 55baf7dfbf7fbf9ae2af351d8b9afc0e82a8af2a..691219743c2e8a3c20358c1cb28e1cc099dbd908 100644 --- a/docs/source/algorithms/Fit-v1.rst +++ b/docs/source/algorithms/Fit-v1.rst @@ -355,5 +355,5 @@ Output: .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/Fit.h - :cpp: Framework/CurveFitting/src/Fit.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h + :cpp: Framework/CurveFitting/src/Algorithms/Fit.cpp \ No newline at end of file diff --git a/docs/source/algorithms/LoadMuonNexus-v1.rst b/docs/source/algorithms/LoadMuonNexus-v1.rst index acd6e582bb31550062f1022df13e320769f1b1b6..5f8aaf88a3c54b19f06667b7430512ea550aefdc 100644 --- a/docs/source/algorithms/LoadMuonNexus-v1.rst +++ b/docs/source/algorithms/LoadMuonNexus-v1.rst @@ -79,77 +79,6 @@ The ChildAlgorithms used by LoadMuonNexus are: LoadInstrument fails. As the Nexus file has limited instrument data, this only populates a few fields. -Usage ------ - -.. include:: ../usagedata-note.txt - -**Example - Load ISIS muon MUSR dataset:** - -.. testcode:: LoadMuonNexusOnePeriod - - # Load MUSR dataset - ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1) - print "Workspace has ", ws[0].getNumberHistograms(), " spectra" - -Output: - -.. testoutput:: LoadMuonNexusOnePeriod - - Workspace has 64 spectra - -**Example - Load event nexus file with time filtering:** - -.. testcode:: ExLoadMuonNexusSomeSpectra - - # Load some spectra - ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1) - print "Workspace has ", ws[0].getNumberHistograms(), " spectra" - -Output: - -.. testoutput:: ExLoadMuonNexusSomeSpectra - - Workspace has 6 spectra - -**Example - Load dead times into table:** - -.. testcode:: ExLoadDeadTimeTable - - # Load some spectra - ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable") - tab = mtd['deadTimeTable'] - for i in range(0,tab.rowCount()): - print tab.cell(i,0), tab.cell(i,1) - -Output: - -.. testoutput:: ExLoadDeadTimeTable - - 5 0.00161112251226 - 6 0.00215016817674 - 7 0.0102171599865 - 8 0.00431686220691 - 9 0.00743605662137 - 10 0.00421147653833 - -**Example - Load detector grouping into table:** - -.. testcode:: ExLoadDetectorGrouping - - # Load some spectra - ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumList="1,16,17,32",DetectorGroupingTable="detectorTable") - tab = mtd['detectorTable'] - for i in range(0,tab.rowCount()): - print tab.cell(i,0) - -Output: - -.. testoutput:: ExLoadDetectorGrouping - - [ 1 16] - [17 32] - .. categories:: .. sourcelink:: diff --git a/docs/source/algorithms/LoadMuonNexus-v2.rst b/docs/source/algorithms/LoadMuonNexus-v2.rst index 0ca954061e4aad8e1f7858f51b8fbd86d6ad6d88..2e0732e98a485b22bc128fe43e25cb757d49a566 100644 --- a/docs/source/algorithms/LoadMuonNexus-v2.rst +++ b/docs/source/algorithms/LoadMuonNexus-v2.rst @@ -80,6 +80,77 @@ detects that it has been asked to load a previous version muon nexus file it will call the previous version of the algorithm to perform the task. +Usage +----- + +.. include:: ../usagedata-note.txt + +**Example - Load ISIS muon MUSR dataset:** + +.. testcode:: LoadMuonNexusOnePeriod + + # Load MUSR dataset + ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1) + print "Workspace has ", ws[0].getNumberHistograms(), " spectra" + +Output: + +.. testoutput:: LoadMuonNexusOnePeriod + + Workspace has 64 spectra + +**Example - Load event nexus file with time filtering:** + +.. testcode:: ExLoadMuonNexusSomeSpectra + + # Load some spectra + ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1) + print "Workspace has ", ws[0].getNumberHistograms(), " spectra" + +Output: + +.. testoutput:: ExLoadMuonNexusSomeSpectra + + Workspace has 6 spectra + +**Example - Load dead times into table:** + +.. testcode:: ExLoadDeadTimeTable + + # Load some spectra + ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable") + tab = mtd['deadTimeTable'] + for i in range(0,tab.rowCount()): + print tab.cell(i,0), tab.cell(i,1) + +Output: + +.. testoutput:: ExLoadDeadTimeTable + + 5 0.00161112251226 + 6 0.00215016817674 + 7 0.0102171599865 + 8 0.00431686220691 + 9 0.00743605662137 + 10 0.00421147653833 + +**Example - Load detector grouping into table:** + +.. testcode:: ExLoadDetectorGrouping + + # Load some spectra + ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumList="1,16,17,32",DetectorGroupingTable="detectorTable") + tab = mtd['detectorTable'] + for i in range(0,tab.rowCount()): + print tab.cell(i,0) + +Output: + +.. testoutput:: ExLoadDetectorGrouping + + [ 1 16] + [17 32] + .. categories:: .. sourcelink:: diff --git a/docs/source/algorithms/SavePlot1DAsJson-v1.rst b/docs/source/algorithms/SavePlot1DAsJson-v1.rst index 86cbeeefd4e066d2a6f835388fa7cd9269f02e8e..85bb7a8d062628aad864fac2e7a84bdde2c6c871 100644 --- a/docs/source/algorithms/SavePlot1DAsJson-v1.rst +++ b/docs/source/algorithms/SavePlot1DAsJson-v1.rst @@ -26,12 +26,12 @@ Usage import os, numpy as np # prepare input - E = np.arange(-50, 50, 1.0) + E = np.arange(-50, 50, 10.0) I = 1000 * np.exp(-E**2/10**2) err = I ** .5 dataws = CreateWorkspace( DataX = E, DataY = I, DataE = err, NSpec = 1, - UnitX = "Energy(meV)") + UnitX = "Energy") # output path out_json = "myplot.json" # run algorithm diff --git a/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..2a390bc98a778ae33750d5aaaa43175e39501f3b --- /dev/null +++ b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst @@ -0,0 +1,59 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +Applies algorithm :ref:`algm-Cropworkspace` to an input workspace or a group of workspaces to crop the empty time channels. Boundaries are calculated as follows: + + :math:`X_{min} = 0` + + :math:`X_{max} = N_{fc}\times\Delta t` + +where :math:`N_{fc}` is the number of full time channels defined in the *full_channels* sample log and :math:`\Delta t` is the channel width defined in the *channel_width* sample log. + + +Restrictions on the input workspace +################################### + +- The unit of the X-axis must be **Time-of-flight**. +- Workspace must contain *channel_width* and *full_channels* sample logs. + + +Usage +----- + +**Example** + +.. testcode:: ExTOFTOFCropWorkspace + + # Load data + ws=Load(Filename='TOFTOFTestdata.nxs') + + print "Input workspace" + print "Total number of time channels: ", len(ws.readX(0)) + print "Number of filled time channels: ", ws.getRun().getLogData('full_channels').value + + wscropped = TOFTOFCropWorkspace(ws) + + print "Output workspace" + print "Total number of time channels: ", len(wscropped.readX(0)) + +Output: + +.. testoutput:: ExTOFTOFCropWorkspace + + Input workspace + Total number of time channels: 1025 + Number of filled time channels: 1020.0 + Output workspace + Total number of time channels: 1020 + +.. categories:: + +.. sourcelink:: diff --git a/docs/source/fitfunctions/Convolution.rst b/docs/source/fitfunctions/Convolution.rst index 4131d38a6c02f0a7699718f67a20c12abd0adb33..2d1effda494a58834752a49bd3c7ab410c77c1ce 100644 --- a/docs/source/fitfunctions/Convolution.rst +++ b/docs/source/fitfunctions/Convolution.rst @@ -45,5 +45,5 @@ Note that the box function is defined on interval [-5, 5]: .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h - :cpp: Framework/CurveFitting/src/Convolution.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h + :cpp: Framework/CurveFitting/src/Functions/Convolution.cpp \ No newline at end of file diff --git a/docs/source/fitfunctions/Quadratic.rst b/docs/source/fitfunctions/Quadratic.rst index ec969de22b9b6177cdc4299d1f9a2d8f8cfcc9c0..8ff860a418240b00e5bc2f381b9f03c666f4c98e 100644 --- a/docs/source/fitfunctions/Quadratic.rst +++ b/docs/source/fitfunctions/Quadratic.rst @@ -26,5 +26,5 @@ where .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h - :cpp: Framework/CurveFitting/src/Quadratic.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h + :cpp: Framework/CurveFitting/src/Functions/Quadratic.cpp \ No newline at end of file diff --git a/docs/source/fitfunctions/UserFunction.rst b/docs/source/fitfunctions/UserFunction.rst index 9cda7f413fdb76f7d3bbc3a30e82de60e69f4a32..9a8201cec132e63b0bd6cfd040011538f6b8b9b7 100644 --- a/docs/source/fitfunctions/UserFunction.rst +++ b/docs/source/fitfunctions/UserFunction.rst @@ -25,5 +25,5 @@ go first in UserFunction definition. .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h - :cpp: Framework/CurveFitting/src/UserFunction.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h + :cpp: Framework/CurveFitting/src/Functions/UserFunction.cpp \ No newline at end of file diff --git a/scripts/Interface/ui/reflectometer/refl_save.py b/scripts/Interface/ui/reflectometer/refl_save.py index 6dabce7fe2a500d16899e687dde973628f1c98de..52f4c8dc61f64444d7263953e7a70dcf40d99a0a 100644 --- a/scripts/Interface/ui/reflectometer/refl_save.py +++ b/scripts/Interface/ui/reflectometer/refl_save.py @@ -1,8 +1,8 @@ -#pylint: disable=invalid-name +#pylint: disable-all from PyQt4 import QtCore, QtGui import os from mantid.simpleapi import * -from mantid.api import WorkspaceGroup +from mantid.api import WorkspaceGroup, AnalysisDataService import xml.etree.ElementTree as xml from isis_reflectometry.quick import * from isis_reflectometry.procedures import * @@ -32,10 +32,12 @@ class Ui_SaveWindow(object): def setupUi(self, SaveWindow): self.SavePath="" SaveWindow.setObjectName(_fromUtf8("SaveWindow")) - SaveWindow.resize(700, 450) + SaveWindow.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)) SaveWindow.setAcceptDrops(True) - + main_layout = QtGui.QHBoxLayout() + SaveWindow.setLayout(main_layout) self.centralWidget = QtGui.QWidget(SaveWindow) + main_layout.addWidget(self.centralWidget) self.centralWidget.setObjectName(_fromUtf8("centralWidget")) self.gridLayout_2 = QtGui.QGridLayout(self.centralWidget) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) @@ -236,12 +238,18 @@ class Ui_SaveWindow(object): def retranslateUi(self, SaveWindow): SaveWindow.setWindowTitle(QtGui.QApplication.translate("SaveWindow", "SaveWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "SAVE", None, QtGui.QApplication.UnicodeUTF8)) + self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "Save", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_2.setText(QtGui.QApplication.translate("SaveWindow", "Refresh", None, QtGui.QApplication.UnicodeUTF8)) + def _get_saveable_workspace_names(self): + names = mtd.getObjectNames() + # Exclude WorkspaceGroups from our list. We cannot save them to ASCII. + names = [i for i in names if not isinstance(AnalysisDataService.retrieve(i), WorkspaceGroup)] + return names + def filterWksp(self): self.listWidget.clear() - names = mtd.getObjectNames() + names = self._get_saveable_workspace_names() if self.regExCheckBox.isChecked(): regex=re.compile(self.filterEdit.text()) filtered = list() @@ -268,7 +276,7 @@ class Ui_SaveWindow(object): def populateList(self): self.listWidget.clear() - names = mtd.getObjectNames() + names = self._get_saveable_workspace_names() if len(names): RB_Number=groupGet(names[0],'samp','rb_proposal') for ws in names: