Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Framework/API/inc/MantidAPI/WorkspaceProperty.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "MantidKernel/PropertyHistory.h"
#include "MantidKernel/Strings.h"

#include <boost/algorithm/string/trim.hpp>

#include <json/value.h>

namespace Mantid {
Expand Down
1 change: 1 addition & 0 deletions Framework/API/src/FrameworkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "MantidKernel/PropertyManagerDataService.h"
#include "MantidKernel/UsageService.h"

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

#include <nexus/NeXusFile.hpp>
Expand Down
2 changes: 2 additions & 0 deletions Framework/API/test/AlgorithmTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "MantidKernel/Strings.h"
#include "MantidKernel/WriteLock.h"
#include "PropertyManagerHelper.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <map>
#include <utility>

Expand Down
4 changes: 1 addition & 3 deletions Framework/API/test/ScopedWorkspaceTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include "MantidAPI/ScopedWorkspace.h"
#include "MantidAPI/WorkspaceGroup.h"

#include <boost/algorithm/string/predicate.hpp>

using namespace Mantid::API;

/// MockWorkspace copied from AnalysisDataServiceTest so I have something to add
Expand Down Expand Up @@ -62,7 +60,7 @@ class ScopedWorkspaceTest : public CxxTest::TestSuite {

const std::string prefix("__ScopedWorkspace_");

TS_ASSERT(boost::starts_with(test.name(), prefix));
TS_ASSERT(test.name().starts_with(prefix));
TS_ASSERT_EQUALS(test.name().size(), prefix.size() + 16);
}

Expand Down
3 changes: 3 additions & 0 deletions Framework/API/test/ScriptBuilderTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include "MantidKernel/PropertyManager.h"
#include "MantidKernel/PropertyManagerProperty.h"

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

using namespace Mantid::API;
using namespace Mantid::Kernel;

Expand Down
1 change: 1 addition & 0 deletions Framework/Algorithms/src/CreateCalFileByNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <boost/algorithm/string/detail/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>

#include <fstream>
#include <queue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "MantidKernel/VectorHelper.h"
#include "MantidKernel/WarningSuppressions.h"

#include <boost/algorithm/string.hpp>

using namespace Mantid::API;
using namespace Mantid::Kernel;
using Mantid::DataObjects::Workspace2D;
Expand Down
6 changes: 2 additions & 4 deletions Framework/Algorithms/src/MaskBinsFromTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include "MantidKernel/ArrayProperty.h"
#include "MantidKernel/System.h"

#include <boost/algorithm/string/predicate.hpp>

using namespace Mantid::Kernel;
using namespace Mantid::API;
using namespace Mantid::DataObjects;
Expand Down Expand Up @@ -150,9 +148,9 @@ void MaskBinsFromTable::processMaskBinWorkspace(const TableWorkspace_sptr &maskt
id_xmin = i;
else if (colname == "xmax")
id_xmax = i;
else if (boost::algorithm::starts_with(colname, "spec")) {
else if (colname.starts_with("spec")) {
id_spec = i;
} else if (boost::algorithm::starts_with(colname, "detectorid")) {
} else if (colname.starts_with("detectorid")) {
id_dets = i;
} else {
g_log.warning() << "In TableWorkspace " << masktblws->getName() << ", column " << i << " with name " << colname
Expand Down
1 change: 1 addition & 0 deletions Framework/Algorithms/src/Q1DWeighted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "MantidKernel/UnitFactory.h"
#include "MantidKernel/VectorHelper.h"

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

#include <algorithm>
Expand Down
6 changes: 5 additions & 1 deletion Framework/Algorithms/test/GeneratePythonFitScriptTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/FrameworkManager.h"
#include "MantidFrameworkTestHelpers/WorkspaceCreationHelper.h"
#include <Poco/File.h>

#include <fstream>

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

#include <Poco/File.h>

using namespace Mantid::API;
using namespace Mantid::Kernel;
using namespace WorkspaceCreationHelper;
Expand Down
20 changes: 12 additions & 8 deletions Framework/Crystal/src/PeakHKLErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#include "MantidAPI/Sample.h"
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidGeometry/Instrument/Goniometer.h"

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/special_functions/round.hpp>

using namespace Mantid::DataObjects;
Expand Down Expand Up @@ -66,11 +69,11 @@ void PeakHKLErrors::setUpOptRuns() {
OptRunstemp = OptRunstemp.substr(1, OptRunstemp.size() - 1);

if (!OptRunstemp.empty() && OptRunstemp.at(OptRunstemp.size() - 1) == '/')
OptRunstemp = OptRunstemp.substr(0, OptRunstemp.size() - 1);
OptRunstemp.pop_back();

boost::split(OptRunNums, OptRunstemp, boost::is_any_of("/"));

for (auto &OptRunNum : OptRunNums) {
for (const auto &OptRunNum : OptRunNums) {
declareParameter("phi" + OptRunNum, 0.0, "Phi sample orientation value");
declareParameter("chi" + OptRunNum, 0.0, "Chi sample orientation value");
declareParameter("omega" + OptRunNum, 0.0, "Omega sample orientation value");
Expand Down Expand Up @@ -229,7 +232,7 @@ void PeakHKLErrors::getRun2MatMap(PeaksWorkspace_sptr &Peaks, const std::string
std::map<int, Mantid::Kernel::Matrix<double>> &Res) const {

for (int i = 0; i < Peaks->getNumberPeaks(); ++i) {
Geometry::IPeak &peak_old = Peaks->getPeak(i);
const Geometry::IPeak &peak_old = Peaks->getPeak(i);

int runNum = peak_old.getRunNumber();
std::string runNumStr = std::to_string(runNum);
Expand Down Expand Up @@ -350,7 +353,7 @@ void PeakHKLErrors::function1D(double *out, const double *xValues, const size_t
double ChiSqTot = 0.0;
for (size_t i = 0; i < nData; i += 3) {
int peakNum = boost::math::iround(xValues[i]);
Peak &peak_old = peaksWs->getPeak(peakNum);
const Peak &peak_old = peaksWs->getPeak(peakNum);

int runNum = peak_old.getRunNumber();
std::string runNumStr = std::to_string(runNum);
Expand Down Expand Up @@ -429,19 +432,20 @@ void PeakHKLErrors::functionDeriv1D(Jacobian *out, const double *xValues, const
g_log.debug() << "----------------------------Derivative------------------------\n";

V3D samplePosition = instNew->getSample()->getPos();
IPeak &ppeak = peaksWs->getPeak(0);
const IPeak &ppeak = peaksWs->getPeak(0);
double L0 = ppeak.getL1();
double velocity = (L0 + ppeak.getL2()) / ppeak.getTOF();

double K = 2 * M_PI / ppeak.getWavelength() / velocity; // 2pi/lambda = K* velocity
V3D beamDir = instNew->getBeamDirection();

size_t paramNums[] = {parameterIndex(std::string("SampleXOffset")), parameterIndex(std::string("SampleYOffset")),
parameterIndex(std::string("SampleZOffset"))};
const size_t paramNums[] = {parameterIndex(std::string("SampleXOffset")),
parameterIndex(std::string("SampleYOffset")),
parameterIndex(std::string("SampleZOffset"))};

for (size_t i = 0; i < nData; i += 3) {
int peakNum = boost::math::iround(xValues[i]);
Peak &peak_old = peaksWs->getPeak(peakNum);
const Peak &peak_old = peaksWs->getPeak(peakNum);
Peak peak = createNewPeak(peak_old, instNew, 0, peak_old.getL1());

int runNum = peak_old.getRunNumber();
Expand Down
5 changes: 2 additions & 3 deletions Framework/Crystal/src/SCDCalibratePanels2ObjFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Instrument/RectangularDetector.h"

#include <boost/algorithm/string.hpp>
#include <boost/math/special_functions/round.hpp>
#include <cmath>

Expand Down Expand Up @@ -70,7 +69,7 @@ void SCDCalibratePanels2ObjFunc::setPeakWorkspace(IPeaksWorkspace_sptr &pws, con
if (inst->getName().compare("CORELLI") == 0 && m_cmpt != "moderator")
// the second check is just to ensure that no accidental passing in
// a bank name with sixteenpack already appended
if (!boost::algorithm::ends_with(m_cmpt, "/sixteenpack"))
if (!m_cmpt.ends_with("/sixteenpack"))
m_cmpt.append("/sixteenpack");

// Get the experimentally measured TOFs
Expand Down Expand Up @@ -283,7 +282,7 @@ SCDCalibratePanels2ObjFunc::scaleRectagularDetectorSize(const double &scalex, co
std::dynamic_pointer_cast<const Geometry::RectangularDetector>(comp);
if (rectDet) {
// get instrument parameter map and find out whether the
Geometry::ParameterMap &pmap = pws->instrumentParameters();
const Geometry::ParameterMap &pmap = pws->instrumentParameters();
auto oldscalex = pmap.getDouble(rectDet->getName(), "scalex");
auto oldscaley = pmap.getDouble(rectDet->getName(), "scaley");
double relscalex{scalex}, relscaley{scaley};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class MANTID_CURVEFITTING_DLL LeBailFit final : public API::Algorithm {
void exportBraggPeakParameterToTable();

/// Output parameters (fitted or tied)
void exportInstrumentParameterToTable(std::map<std::string, Parameter> parammap);
void exportInstrumentParameterToTable(const std::map<std::string, Parameter> &parammap);

/// Create output data workspace
void createOutputDataWorkspace();
Expand Down Expand Up @@ -164,11 +164,11 @@ class MANTID_CURVEFITTING_DLL LeBailFit final : public API::Algorithm {
double limitProposedValueInBound(const Parameter &param, double newvalue, double direction, int choice);

/// Book keep the (sopposed) best MC result
void bookKeepBestMCResult(std::map<std::string, Parameter> parammap, const std::vector<double> &bkgddata,
void bookKeepBestMCResult(const std::map<std::string, Parameter> &parammap, const std::vector<double> &bkgddata,
Kernel::Rfactor rfactor, size_t istep);

/// Apply the value of parameters in the source to target
void applyParameterValues(std::map<std::string, Parameter> &srcparammap,
void applyParameterValues(const std::map<std::string, Parameter> &srcparammap,
std::map<std::string, Parameter> &tgtparammap);

/// Store/buffer current background parameters
Expand Down Expand Up @@ -286,7 +286,8 @@ class MANTID_CURVEFITTING_DLL LeBailFit final : public API::Algorithm {
};

/// Write a set of (XY) data to a column file
void writeRfactorsToFile(std::vector<double> vecX, std::vector<Kernel::Rfactor> vecR, const std::string &filename);
void writeRfactorsToFile(const std::vector<double> &vecX, const std::vector<Kernel::Rfactor> &vecR,
const std::string &filename);

} // namespace Algorithms
} // namespace CurveFitting
Expand Down
29 changes: 14 additions & 15 deletions Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "MantidKernel/VisibleWhenProperty.h"

#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>

#include <cctype>
#include <fstream>
Expand Down Expand Up @@ -1050,7 +1049,7 @@ void LeBailFit::parseBackgroundTableWorkspace(const TableWorkspace_sptr &bkgdpar
g_log.error(errss.str());
throw runtime_error(errss.str());
} else {
if (!(boost::starts_with(colnames[0], "Name") && boost::starts_with(colnames[1], "Value"))) {
if (!(colnames[0].starts_with("Name") && colnames[1].starts_with("Value"))) {
// Column 0 and 1 must be Name and Value (at least started with)
stringstream errss;
errss << "Input parameter table workspace have wrong column definition. "
Expand Down Expand Up @@ -1165,7 +1164,7 @@ void LeBailFit::exportBraggPeakParameterToTable() {
* @param parammap : map of Parameters whose values are written to
* TableWorkspace
*/
void LeBailFit::exportInstrumentParameterToTable(std::map<std::string, Parameter> parammap) {
void LeBailFit::exportInstrumentParameterToTable(const std::map<std::string, Parameter> &parammap) {
// 1. Create table workspace
DataObjects::TableWorkspace *tablews;

Expand All @@ -1183,7 +1182,7 @@ void LeBailFit::exportInstrumentParameterToTable(std::map<std::string, Parameter
tablews->addColumn("double", "Diff");

// 2. Add profile parameter value
std::map<std::string, Parameter>::iterator paramiter;
std::map<std::string, Parameter>::const_iterator paramiter;
std::map<std::string, double>::iterator opiter;
for (paramiter = parammap.begin(); paramiter != parammap.end(); ++paramiter) {
std::string parname = paramiter->first;
Expand Down Expand Up @@ -1450,7 +1449,7 @@ void LeBailFit::doMarkovChain(const map<string, Parameter> &parammap, const Mant
for (size_t icycle = 1; icycle <= maxcycles; ++icycle) {
// Refine parameters (for all parameters in turn) to data with background
// removed
for (auto &MCGroup : m_MCGroups) {
for (const auto &MCGroup : m_MCGroups) {
// Propose new value for ONE AND ONLY ONE Monte Carlo parameter group
/*
int igroup = giter->first; // group id
Expand Down Expand Up @@ -1575,7 +1574,7 @@ void LeBailFit::doMarkovChain(const map<string, Parameter> &parammap, const Mant

map<string, Parameter>::iterator mapiter;
for (mapiter = mapCurrParameter.begin(); mapiter != mapCurrParameter.end(); ++mapiter) {
Parameter &param = mapiter->second;
const Parameter &param = mapiter->second;
if (param.fit) {
g_log.notice() << setw(10) << param.name << "\t: Average Stepsize = " << setw(10) << setprecision(5)
<< param.sumstepsize / double(maxcycles) << ", Max Step Size = " << setw(10) << setprecision(5)
Expand Down Expand Up @@ -1666,7 +1665,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() {
m_MCGroups.emplace(0, geomparams);

dboutss << "Geometry parameters: ";
for (auto &geomparam : geomparams)
for (const auto &geomparam : geomparams)
dboutss << geomparam << "\t\t";
dboutss << "\n";

Expand All @@ -1679,7 +1678,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() {
m_MCGroups.emplace(1, alphs);

dboutss << "Alpha parameters";
for (auto &alph : alphs)
for (const auto &alph : alphs)
dboutss << alph << "\t\t";
dboutss << "\n";

Expand All @@ -1692,7 +1691,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() {
m_MCGroups.emplace(2, betas);

dboutss << "Beta parameters";
for (auto &beta : betas)
for (const auto &beta : betas)
dboutss << beta << "\t\t";
dboutss << "\n";

Expand All @@ -1704,7 +1703,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() {
m_MCGroups.emplace(3, sigs);

dboutss << "Sig parameters";
for (auto &sig : sigs)
for (const auto &sig : sigs)
dboutss << sig << "\t\t";
dboutss << "\n";

Expand Down Expand Up @@ -2148,8 +2147,8 @@ bool LeBailFit::acceptOrDeny(Rfactor currR, Rfactor newR) {
* @param rfactor :: R-factor (Rwp and Rp)
* @param istep: current MC step to be recorded
*/
void LeBailFit::bookKeepBestMCResult(map<string, Parameter> parammap, const vector<double> &bkgddata, Rfactor rfactor,
size_t istep) {
void LeBailFit::bookKeepBestMCResult(const map<string, Parameter> &parammap, const vector<double> &bkgddata,
Rfactor rfactor, size_t istep) {
// TODO : [RPRWP] Here is a metric of goodness of it.
double goodness = rfactor.Rwp;
bool better = goodness < m_bestRwp;
Expand Down Expand Up @@ -2186,8 +2185,8 @@ void LeBailFit::bookKeepBestMCResult(map<string, Parameter> parammap, const vect
* @param tgtparammap: map of Parameters whose values to be copied from
* others;
*/
void LeBailFit::applyParameterValues(map<string, Parameter> &srcparammap, map<string, Parameter> &tgtparammap) {
map<string, Parameter>::iterator srcmapiter;
void LeBailFit::applyParameterValues(const map<string, Parameter> &srcparammap, map<string, Parameter> &tgtparammap) {
map<string, Parameter>::const_iterator srcmapiter;
map<string, Parameter>::iterator tgtmapiter;
for (srcmapiter = srcparammap.begin(); srcmapiter != srcparammap.end(); ++srcmapiter) {
string parname = srcmapiter->first;
Expand Down Expand Up @@ -2222,7 +2221,7 @@ std::map<std::string, double> LeBailFit::convertToDoubleMap(std::map<std::string

/** Write a set of (XY) data to a column file
*/
void writeRfactorsToFile(vector<double> vecX, vector<Rfactor> vecR, const string &filename) {
void writeRfactorsToFile(const vector<double> &vecX, const vector<Rfactor> &vecR, const string &filename) {
ofstream ofile;
ofile.open(filename.c_str());

Expand Down
2 changes: 2 additions & 0 deletions Framework/CurveFitting/test/Algorithms/PawleyFitTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "MantidFrameworkTestHelpers/WorkspaceCreationHelper.h"
#include "MantidKernel/V3D.h"

#include <boost/algorithm/string/join.hpp>

using Mantid::CurveFitting::Algorithms::PawleyFit;
using Mantid::CurveFitting::Algorithms::V3DFromHKLColumnExtractor;
using namespace Mantid::API;
Expand Down
8 changes: 4 additions & 4 deletions Framework/DataHandling/inc/MantidDataHandling/LoadILLTOF2.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ class MANTID_DATAHANDLING_DLL LoadILLTOF2 : public API::IFileLoader<Kernel::Nexu
void addFacility();
void addPulseInterval();

void fillStaticWorkspace(NeXus::NXEntry &entry, const std::vector<std::string> &monitorList, bool convertToTOF);
void fillScanWorkspace(NeXus::NXEntry &entry, const std::vector<std::string> &monitorList);
void fillStaticWorkspace(const NeXus::NXEntry &entry, const std::vector<std::string> &monitorList, bool convertToTOF);
void fillScanWorkspace(const NeXus::NXEntry &entry, const std::vector<std::string> &monitorList);

std::vector<std::string> getMonitorInfo(const NeXus::NXEntry &firstEntry);
void initWorkspace(NeXus::NXEntry &entry);
void initWorkspace(const NeXus::NXEntry &entry);

void loadInstrumentDetails(const NeXus::NXEntry &);
void loadTimeDetails(const NeXus::NXEntry &entry);

std::vector<double> prepareAxis(NeXus::NXEntry &entry, bool convertToTOF);
std::vector<double> prepareAxis(const NeXus::NXEntry &entry, bool convertToTOF);

API::MatrixWorkspace_sptr m_localWorkspace;

Expand Down
Loading
Loading