41#include "MantidHistogramData/HistogramBuilder.h"
42#include "MantidHistogramData/HistogramDx.h"
43#include "MantidHistogramData/LinearGenerator.h"
44#include "MantidIndexing/IndexInfo.h"
66using Mantid::Types::Core::DateAndTime;
67using Mantid::Types::Event::TofEvent;
73 : peakCentre(peakCentre_),
sigma(sigma_),
height(height_), fitStatus(fitStatus_) {}
77 : workspaceIndex(
index), peakCentre(peakCentre_),
sigma(sigma_),
height(height_), fitStatus(fitStatus_) {}
83void removeWS(
const std::string &
name) { Mantid::API::AnalysisDataService::Instance().remove(
name); }
97template <
typename YType,
typename EType> Histogram
createHisto(
bool isHistogram, YType &&yAxis, EType &&eAxis) {
100 const size_t yValsSize = yAxis.size();
102 BinEdges xAxis(yValsSize + 1, LinearGenerator(1, 1));
103 Histogram histo{std::move(xAxis), std::forward<YType>(yAxis), std::forward<EType>(eAxis)};
106 Points xAxis(yValsSize, LinearGenerator(1, 1));
107 Histogram pointsHisto{std::move(xAxis), std::forward<YType>(yAxis), std::forward<EType>(eAxis)};
114 MersenneTwister randomGen(DateAndTime::getCurrentTime().nanoseconds(), 0, std::numeric_limits<int>::max());
116 auto randFunc = [&randomGen] {
return randomGen.
nextValue(); };
117 Counts counts(size, randFunc);
118 CountStandardDeviations errorVals(size, randFunc);
120 auto retVal = std::make_shared<Workspace2D>();
121 retVal->initialize(1,
createHisto(isHisto, counts, errorVals));
126 Counts yVals(size,
value);
127 CountStandardDeviations errVals(size,
error);
129 auto retVal = std::make_shared<Workspace2D>();
130 retVal->initialize(1,
createHisto(isHisto, yVals, errVals));
137 auto dx1 = Kernel::make_cow<HistogramData::HistogramDx>(size, xError);
138 ws->setSharedDx(0, dx1);
143 BinEdges xVals(size + 1, LinearGenerator(1, 1));
145 CountStandardDeviations errVals(size);
147 auto retVal = std::make_shared<Workspace2D>();
148 retVal->initialize(1,
createHisto(isHisto, yVals, errVals));
164 for (
int workspaceIndex = 0; workspaceIndex < nhist; workspaceIndex++) {
165 std::vector<double> yValues(numBoundaries,
static_cast<double>(workspaceIndex));
166 out->mutableY(workspaceIndex) = yValues;
175 auto newAxis = std::make_unique<NumericAxis>(nHist);
176 auto newAxisRaw = newAxis.get();
177 outputWS->replaceAxis(1, std::move(newAxis));
178 newAxisRaw->unit() = std::make_shared<Units::Degrees>();
179 for (
int i = 0; i < nHist; ++i) {
180 newAxisRaw->setValue(i, i + 1);
201 const std::set<int64_t> &maskedWorkspaceIndices,
double xVal,
double yVal,
202 double eVal,
bool hasDx =
false) {
203 auto x1 = Kernel::make_cow<HistogramData::HistogramX>(isHist ? nBins + 1 : nBins, LinearGenerator(xVal, 1.0));
204 Counts y1(nBins, yVal);
205 CountStandardDeviations e1(nBins, eVal);
206 auto dx = Kernel::make_cow<HistogramData::HistogramDx>(nBins, yVal);
207 auto retVal = std::make_shared<Workspace2D>();
208 retVal->initialize(nHist,
createHisto(isHist, y1, e1));
209 for (
int i = 0; i < nHist; i++) {
210 retVal->setSharedX(i, x1);
212 retVal->setSharedDx(i, dx);
213 retVal->getSpectrum(i).setDetectorID(i);
214 retVal->getSpectrum(i).setSpectrumNo(i);
216 if (maskedWorkspaceIndices.size() > 0) {
217 retVal =
maskSpectra(retVal, maskedWorkspaceIndices);
223 double yVal,
double eVal,
double dxVal,
224 const std::set<int64_t> &maskedWorkspaceIndices) {
226 PointStandardDeviations dx1(nBins, dxVal);
227 for (
int i = 0; i < nHist; i++) {
228 ws->setPointStandardDeviations(i, dx1);
234 const std::set<int64_t> &maskedWorkspaceIndices,
bool hasDx) {
239 const std::set<int64_t> &maskedWorkspaceIndices,
bool hasDx) {
244 const auto nhist =
static_cast<int>(
workspace->getNumberHistograms());
245 if (
workspace->getInstrument()->nelements() == 0) {
247 auto instrument = std::make_shared<Instrument>();
250 std::string xmlShape =
"<sphere id=\"shape\"> ";
251 xmlShape += R
"(<centre x="0.0" y="0.0" z="0.0" /> )";
252 xmlShape += "<radius val=\"0.05\" /> ";
253 xmlShape +=
"</sphere>";
254 xmlShape +=
"<algebra val=\"shape\" /> ";
258 for (
int i = 0; i < nhist; ++i) {
261 instrument->add(det);
262 instrument->markAsDetector(det);
267 workspace->setIndexInfo(Indexing::IndexInfo(nhist));
270 auto &spectrumInfo =
workspace->mutableSpectrumInfo();
271 for (
const auto index : maskedWorkspaceIndices)
272 spectrumInfo.setMasked(
index,
true);
280 auto group = std::make_shared<WorkspaceGroup>();
281 AnalysisDataService::Instance().add(stem,
group);
282 for (
int i = 0; i < nEntries; ++i) {
284 std::ostringstream os;
285 os << stem <<
"_" << i;
286 AnalysisDataService::Instance().add(os.str(), ws);
287 group->add(os.str());
300 MantidVec x_data{100., 200., 300., 400.};
311 x_data2 = {200., 400.};
314 }
else if (version == 2) {
317 }
else if (version == 3) {
319 x_data2 = {200., 500., 600.};
320 }
else if (version == 4) {
322 y_data = {2., 2., 2.};
323 e_data = {2., 2., 2.};
328 Mantid::HistogramData::HistogramBuilder builder;
329 builder.setX(x_data);
330 builder.setY(y_data);
331 builder.setE(e_data);
332 raggedWS->setHistogram(0, builder.build());
334 Mantid::HistogramData::HistogramBuilder builder2;
335 builder2.setX(x_data2);
336 builder2.setY(y_data2);
337 builder2.setE(e_data2);
338 raggedWS->setHistogram(1, builder2.build());
347 BinEdges
x(numVals + 1, LinearGenerator(x0, deltax));
348 Counts
y(numVals, 2);
349 CountStandardDeviations e(numVals, M_SQRT2);
350 return create<Workspace2D>(nhist, Histogram(
x,
y, e));
357 Points
x(numVals, LinearGenerator(x0, deltax));
358 Counts
y(numVals, 2);
359 CountStandardDeviations e(numVals, M_SQRT2);
360 return create<Workspace2D>(nhist, Histogram(
x,
y, e));
371 BinEdges
x(xBoundaries, xBoundaries + numBoundaries);
372 const int numBins = numBoundaries - 1;
373 Counts
y(numBins, 2);
374 CountStandardDeviations e(numBins, M_SQRT2);
375 auto dx = Kernel::make_cow<HistogramData::HistogramDx>(numBins, LinearGenerator(0.1, .1));
376 auto retVal = std::make_shared<Workspace2D>();
378 for (
int i = 0; i < nhist; i++) {
379 retVal->setBinEdges(i,
x);
381 retVal->setSharedDx(i, dx);
394 const size_t seed(12345);
396 for (
size_t iSpec = 0; iSpec < ws->getNumberHistograms(); iSpec++) {
397 auto &mutableY = ws->mutableY(iSpec);
398 auto &mutableE = ws->mutableE(iSpec);
399 for (
size_t i = 0; i < mutableY.size(); i++) {
400 mutableY[i] += noise * randGen.
nextValue();
401 mutableE[i] += noise;
413 bool isHistogram,
const std::string &instrumentName,
bool hasDx) {
414 if (includeMonitors && nhist < 2) {
415 throw std::invalid_argument(
"Attempting to 2 include monitors for a "
416 "workspace with fewer than 2 histograms");
426 space->setTitle(
"Test histogram");
427 space->getAxis(0)->setUnit(
"TOF");
428 space->setYUnit(
"Counts");
440 size_t startTime,
size_t firstInterval,
441 bool includeMonitors,
bool startYNegative,
443 const std::string &instrumentName) {
450 std::vector<double> timeRanges;
451 for (
size_t i = 0; i < nTimeIndexes; ++i) {
452 timeRanges.emplace_back(
double(i + firstInterval));
455 builder.setTimeRanges(DateAndTime(
int(startTime), 0), timeRanges);
457 return builder.buildWorkspace();
467 const int nbins,
const double x0,
const double deltax,
468 const std::string &instrumentName,
469 const std::string &xunit) {
471 inputWorkspace->getAxis(0)->unit() = UnitFactory::Instance().create(xunit);
476 return inputWorkspace;
492 const std::string &instrumentName) {
496 ws->setInstrument(inst);
497 ws->getAxis(0)->setUnit(
"dSpacing");
498 for (
size_t wi = 0; wi < ws->getNumberHistograms(); wi++) {
499 ws->getSpectrum(wi).setDetectorID(
detid_t(numPixels * numPixels + wi));
500 ws->getSpectrum(wi).setSpectrumNo(
specnum_t(wi));
521 ws->setInstrument(inst);
524 const auto &xVals = ws->x(0);
525 const size_t xSize = xVals.size();
526 auto ax0 = std::make_unique<NumericAxis>(xSize);
527 ax0->setUnit(
"dSpacing");
528 for (
size_t i = 0; i < xSize; i++) {
529 ax0->setValue(i, xVals[i]);
531 ws->replaceAxis(0, std::move(ax0));
534 const auto detIds = inst->getDetectorIDs();
535 for (
int wi = 0; wi < static_cast<int>(ws->getNumberHistograms()); ++wi) {
536 ws->getSpectrum(wi).clearDetectorIDs();
538 ws->getSpectrum(wi).clear(
true);
539 ws->getSpectrum(wi).setDetectorID(detIds[wi]);
558 ws->setInstrument(inst);
561 const auto &xVals = ws->x(0);
562 const size_t xSize = xVals.size();
563 auto ax0 = std::make_unique<NumericAxis>(xSize);
564 ax0->setUnit(
"dSpacing");
565 for (
size_t i = 0; i < xSize; i++) {
566 ax0->setValue(i, xVals[i]);
568 ws->replaceAxis(0, std::move(ax0));
571 const auto detIds = inst->getDetectorIDs();
572 for (
int wi = 0; wi < static_cast<int>(ws->getNumberHistograms()); ++wi) {
573 ws->getSpectrum(wi).clearDetectorIDs();
575 ws->getSpectrum(wi).clear(
true);
576 ws->getSpectrum(wi).setDetectorID(detIds[wi]);
583 const int DETECTORS_PER_BANK(9);
585 V3D srcPos(0., 0., -10.), samplePos;
589 ws->setInstrument(inst);
591 std::vector<detid_t> detectorIds = inst->getDetectorIDs();
594 assert(detectorIds.size() == ws->getNumberHistograms());
597 for (
size_t wi = 0; wi < ws->getNumberHistograms(); wi++) {
598 ws->getSpectrum(wi).clearDetectorIDs();
600 ws->getSpectrum(wi).clear(
true);
601 ws->getSpectrum(wi).setDetectorID(detectorIds[wi]);
616 const double deltaX) {
642 const V3D &slit2Pos,
const double vg1,
643 const double vg2,
const V3D &sourcePos,
644 const V3D &monitorPos,
const V3D &samplePos,
645 const V3D &detectorPos,
const int nBins,
646 const double deltaX) {
648 instrument->setReferenceFrame(
649 std::make_shared<ReferenceFrame>(PointingAlong::Y, PointingAlong::X, Handedness::Left,
"0,0,0"));
662 pmap.addDouble(slit1,
"vertical gap", vg1);
663 pmap.addDouble(slit2,
"vertical gap", vg2);
665 workspace->getSpectrum(0).setDetectorID(2);
666 workspace->getSpectrum(1).setDetectorID(1);
690 const double startX,
const double detSize,
const V3D &slit1Pos,
const V3D &slit2Pos,
const double vg1,
691 const double vg2,
const V3D &sourcePos,
const V3D &monitorPos,
const V3D &samplePos,
const V3D &detectorCenterPos,
692 const int nSpectra,
const int nBins,
const double deltaX) {
694 instrument->setReferenceFrame(
695 std::make_shared<ReferenceFrame>(PointingAlong::Y , PointingAlong::X , Handedness::Left,
"0,0,0"));
702 const double minY = detectorCenterPos.
Y() - detSize * (nDet - 1) / 2.;
703 for (
int i = 0; i < nDet; ++i) {
704 const double y = minY + i * detSize;
705 const V3D pos{detectorCenterPos.
X(),
y, detectorCenterPos.
Z()};
714 pmap.addDouble(slit1,
"vertical gap", vg1);
715 pmap.addDouble(slit2,
"vertical gap", vg2);
716 for (
int i = 0; i <
nSpectra; ++i) {
717 workspace->getSpectrum(i).setDetectorID(i + 1);
723 const V3D &sourcePosition,
const std::vector<V3D> &detectorPositions) {
725 instrument->setReferenceFrame(std::make_shared<ReferenceFrame>(
Y,
X,
Left,
"0,0,0"));
730 for (
int i = 0; i < static_cast<int>(detectorPositions.size()); ++i) {
731 std::stringstream buffer;
732 buffer <<
"detector_" << i;
736 workspace->getSpectrum(i).addDetectorID(i);
743 return std::make_shared<WorkspaceSingleValue>(
value, sqrt(
value));
747 return std::make_shared<WorkspaceSingleValue>(
value,
error);
753 ew->mutableRun().integrateProtonCharge();
775 int eventPattern,
int start_at_pixelID) {
777 DateAndTime(
"2010-01-01T00:00:00"));
784 double binDelta,
int eventPattern,
int start_at_pixelID,
785 DateAndTime run_start) {
790 auto retVal = std::make_shared<EventWorkspace>();
791 retVal->initialize(numPixels, 1, 1);
793 MersenneTwister randomGen(DateAndTime::getCurrentTime().nanoseconds(), 0, std::numeric_limits<int>::max());
797 size_t workspaceIndex = 0;
798 for (
int pix = start_at_pixelID + 0; pix < start_at_pixelID + numPixels; pix++) {
799 EventList &el = retVal->getSpectrum(workspaceIndex);
804 if (eventPattern == 1)
805 el += TofEvent((pix + i + 0.5) * binDelta, run_start +
double(i));
806 else if (eventPattern == 2)
808 el += TofEvent((i + 0.5) * binDelta, run_start +
double(i));
809 el += TofEvent((i + 0.5) * binDelta, run_start +
double(i));
810 }
else if (eventPattern == 3)
812 el += TofEvent((i + 0.5) * binDelta, run_start +
double(i));
813 }
else if (eventPattern == 4)
816 for (
int q = 0; q < pix; q++)
817 el += TofEvent((i + 0.5) * binDelta, run_start +
double(i));
818 }
else if (eventPattern == 5)
820 el += TofEvent(
static_cast<double>(randomGen.
nextValue()), run_start +
double(i));
827 retVal->setAllX(BinEdges(numBins, LinearGenerator(x0, binDelta)));
836 double binDelta,
double xOffset) {
838 auto retVal = std::make_shared<EventWorkspace>();
839 retVal->initialize(groups.size(), 2, 1);
841 for (
size_t g = 0; g < groups.size(); g++) {
842 retVal->getSpectrum(g).clearDetectorIDs();
843 std::vector<int> dets = groups[g];
844 for (
auto det : dets) {
845 for (
int i = 0; i < numBins; i++)
846 retVal->getSpectrum(g) += TofEvent((i + 0.5) * binDelta, 1);
847 retVal->getSpectrum(g).addDetectorID(det);
852 retVal->setAllX(BinEdges(numBins, LinearGenerator(0.0, binDelta)));
854 for (
size_t g = 0; g < groups.size(); g++) {
856 const double x0 = xOffset *
static_cast<double>(g);
857 retVal->setX(g, make_cow<HistogramX>(numBins, LinearGenerator(x0, binDelta)));
873 auto retVal = std::make_shared<EventWorkspace>();
874 retVal->initialize(numpixels, numbins, numbins - 1);
877 auto pAxis0 = std::make_unique<NumericAxis>(numbins);
880 HistogramData::BinEdges axis(numbins, LinearGenerator(0.0, bin_delta));
881 for (
int i = 0; i < static_cast<int>(numbins); ++i) {
882 pAxis0->setValue(i, axis[i]);
884 pAxis0->setUnit(
"TOF");
886 MersenneTwister randomGen(DateAndTime::getCurrentTime().nanoseconds(), 0, std::numeric_limits<int>::max());
888 for (
size_t i = 0; i < numpixels; i++) {
891 for (std::size_t ie = 0; ie < numbins; ie++) {
893 events += TofEvent(
static_cast<double>(randomGen.
nextValue()),
static_cast<int64_t
>(randomGen.
nextValue()));
897 retVal->setAllX(axis);
898 retVal->replaceAxis(0, std::move(pAxis0));
911 for (
int g = 0; g < static_cast<int>(numHist); g++) {
912 auto &spec = retVal->getSpectrum(g);
913 for (
int i = 1; i <= 9; i++)
914 spec.addDetectorID(g * 9 + i);
915 spec.setSpectrumNo(g + 1);
917 return std::dynamic_pointer_cast<MatrixWorkspace>(retVal);
923 size_t numHist = RootOfNumHist * RootOfNumHist;
926 for (
int g = 0; g < static_cast<int>(numHist); g++) {
927 auto &spec = retVal->getSpectrum(g);
928 spec.addDetectorID(g + 1);
929 for (
int i = 1; i <= 9; i++)
930 spec.addDetectorID(g * 9 + i);
931 spec.setSpectrumNo(g + 1);
933 return std::dynamic_pointer_cast<MatrixWorkspace>(retVal);
939 const size_t numHists = ws->getNumberHistograms();
940 for (
size_t i = 0; i < numHists; ++i) {
941 std::cout <<
"Histogram " << i <<
" = ";
942 const auto &
y = ws->y(i);
943 for (
size_t j = 0; j <
y.size(); ++j) {
944 std::cout <<
y[j] <<
" ";
954 const size_t numHists = ws->getNumberHistograms();
955 for (
size_t i = 0; i < numHists; ++i) {
956 std::cout <<
"Histogram " << i <<
" = ";
957 const auto &
x = ws->x(i);
958 for (
size_t j = 0; j <
x.size(); ++j) {
959 std::cout <<
x[j] <<
" ";
968 const size_t numHists = ws->getNumberHistograms();
969 for (
size_t i = 0; i < numHists; ++i) {
970 std::cout <<
"Histogram " << i <<
" = ";
971 const auto &e = ws->e(i);
972 for (
size_t j = 0; j < e.size(); ++j) {
973 std::cout << e[j] <<
" ";
989 tsp->
addValue(
"2011-05-24T00:00:00", val);
1003 ws->mutableSample().setOrientedLattice(std::make_unique<OrientedLattice>(a, b, c, 90., 90., 90.));
1020 ws->mutableRun().setGoniometer(gm,
true);
1025 bool has_oriented_lattice) {
1026 auto rHist =
static_cast<size_t>(std::sqrt(
static_cast<double>(numPixels)));
1027 while (rHist * rHist < numPixels)
1031 auto pAxis0 = std::make_unique<NumericAxis>(numBins);
1032 for (
size_t i = 0; i < numBins; i++) {
1033 double dE = -1.0 +
static_cast<double>(i) * 0.8;
1034 pAxis0->setValue(i, dE);
1036 pAxis0->setUnit(
"DeltaE");
1037 ws->replaceAxis(0, std::move(pAxis0));
1038 if (has_oriented_lattice) {
1039 ws->mutableSample().setOrientedLattice(std::make_unique<OrientedLattice>(1, 1, 1, 90., 90., 90.));
1046 ws->mutableRun().setGoniometer(gm,
true);
1062 const std::vector<double> &polar,
1063 const std::vector<double> &azimutal,
size_t numBins,
1064 double Emin,
double Emax,
double Ei) {
1066 std::set<int64_t> maskedWorkspaceIndices;
1067 size_t numPixels = L2.size();
1075 for (
int g = 0; g < static_cast<int>(numPixels); g++) {
1076 auto &spec = ws->getSpectrum(g);
1079 spec.setDetectorID(g + 1);
1082 spec.setSpectrumNo(g + 1);
1088 const double dE = (Emax - Emin) /
static_cast<double>(numBins);
1089 for (
size_t j = 0; j < numPixels; j++) {
1090 std::vector<double> E_transfer;
1091 E_transfer.reserve(numBins);
1092 for (
size_t i = 0; i <= numBins; i++) {
1093 E_transfer.emplace_back(Emin +
static_cast<double>(i) * dE);
1095 ws->mutableX(j) = E_transfer;
1099 auto pAxis0 = std::make_unique<NumericAxis>(numBins);
1100 const auto &E_transfer = ws->x(0);
1101 for (
size_t i = 0; i < numBins; i++) {
1102 double E = 0.5 * (E_transfer[i] + E_transfer[i + 1]);
1103 pAxis0->setValue(i, E);
1106 pAxis0->setUnit(
"DeltaE");
1108 ws->replaceAxis(0, std::move(pAxis0));
1111 ws->mutableSample().setOrientedLattice(std::make_unique<OrientedLattice>(1, 1, 1, 90., 90., 90.));
1122 ws->mutableRun().setGoniometer(gm,
true);
1140 outputWS->initialize(sourceWS->getInstrument()->getDetectorIDs(
true).size(), 1, 1);
1143 outputWS->getAxis(0)->unit() = UnitFactory::Instance().create(
"TOF");
1144 outputWS->setYUnit(
"Counts");
1145 outputWS->setTitle(
"Empty_Title");
1148 int runnumber = sourceWS->getRunNumber();
1149 outputWS->mutableRun().addProperty(
"run_number", runnumber);
1151 std::string runstartstr = sourceWS->run().getProperty(
"run_start")->value();
1152 outputWS->mutableRun().addProperty(
"run_start", runstartstr);
1157 loadInst->setPropertyValue(
"InstrumentName", sourceWS->getInstrument()->getName());
1160 loadInst->executeAsChildAlg();
1163 outputWS->populateInstrumentParameters();
1168 outputWS->getInstrument()->getDetectors(detector_map);
1171 size_t workspaceIndex = 0;
1172 const auto &detectorInfo = outputWS->detectorInfo();
1173 for (
auto it = detector_map.begin(); it != detector_map.end(); ++it) {
1174 if (!detectorInfo.isMonitor(detectorInfo.indexOf(it->first))) {
1175 auto &spec = outputWS->getSpectrum(workspaceIndex);
1176 spec.addDetectorID(it->first);
1178 spec.setSpectrumNo(
specnum_t(workspaceIndex + 1));
1179 workspaceIndex += 1;
1189 Mantid::API::AnalysisDataService::Instance().add(
"rebinTest", outputWS);
1192 std::vector<double> qbins{0.0, 1.0, 4.0};
1193 std::vector<double> qaxis;
1197 const size_t numHist = numY - 1;
1198 const size_t numX = 7;
1199 outputWS->initialize(numHist, numX, numX - 1);
1202 outputWS->getAxis(0)->unit() = UnitFactory::Instance().create(
"DeltaE");
1203 outputWS->setYUnit(
"Counts");
1204 outputWS->setTitle(
"Empty_Title");
1207 HistogramData::BinEdges x1{-3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0};
1210 auto verticalAxis = std::make_unique<NumericAxis>(numY);
1213 for (
size_t i = 0; i < numHist; ++i) {
1214 outputWS->setBinEdges(i, x1);
1215 verticalAxis->setValue(i, qaxis[i]);
1218 verticalAxis->setValue(numHist, qaxis[numHist]);
1221 verticalAxis->unit() = UnitFactory::Instance().create(
"MomentumTransfer");
1222 verticalAxis->title() =
"|Q|";
1223 outputWS->replaceAxis(1, std::move(verticalAxis));
1226 outputWS->getAxis(0)->title() =
"Energy transfer";
1254 outputWS->finalize();
1257 for (
size_t i = 0; i < numHist; ++i) {
1258 auto &mutableE = outputWS->mutableE(i);
1259 for (
size_t j = 0; j < numX - 1; ++j) {
1260 mutableE[j] = std::sqrt(mutableE[j]);
1263 outputWS->setSqrdErrors(
false);
1280template <
typename T>
1283 for (
const double val : values) {
1284 destination[startingIndex +
index] = val;
1290 auto peaksWS = std::make_shared<PeaksWorkspace>();
1292 peaksWS->setInstrument(inst);
1294 for (
int i = 0; i < numPeaks; ++i) {
1295 Peak peak(inst, i, i + 0.5);
1296 peaksWS->addPeak(peak);
1299 if (createOrientedLattice) {
1300 peaksWS->mutableSample().setOrientedLattice(std::make_unique<OrientedLattice>());
1308 throw std::invalid_argument(
"UB matrix is not 3x3");
1312 peaksWS->mutableSample().getOrientedLattice().setUB(ubMat);
1317 const bool createOrientedLattice) {
1318 auto peaksWS = std::make_shared<LeanElasticPeaksWorkspace>();
1320 for (
int i = 0; i < numPeaks; ++i) {
1321 Peak peak(inst, i, i + 0.5);
1323 peaksWS->addPeak(lpeak);
1326 if (createOrientedLattice) {
1327 peaksWS->mutableSample().setOrientedLattice(std::make_unique<OrientedLattice>());
1335 throw std::invalid_argument(
"UB matrix is not 3x3");
1339 peaksWS->mutableSample().getOrientedLattice().setUB(ubMat);
1343void create2DAngles(std::vector<double> &L2, std::vector<double> &polar, std::vector<double> &azim,
size_t nPolar,
1344 size_t nAzim,
double polStart,
double polEnd,
double azimStart,
double azimEnd) {
1345 size_t nDet = nPolar * nAzim;
1346 L2.resize(nDet, 10);
1350 double dPolar = (polEnd - polStart) /
static_cast<double>(nDet - 1);
1351 double dAzim = (azimEnd - azimEnd) /
static_cast<double>(nDet - 1);
1352 for (
size_t i = 0; i < nPolar; i++) {
1353 for (
size_t j = 0; j < nAzim; j++) {
1354 polar[i * nPolar + j] = polStart + dPolar *
static_cast<double>(i);
1355 azim[i * nPolar + j] = azimStart + dAzim *
static_cast<double>(j);
1362 auto wsIndexColumn = ws->addColumn(
"int",
"WorkspaceIndex");
1363 auto centreColumn = ws->addColumn(
"double",
"PeakCentre");
1364 auto centreErrorColumn = ws->addColumn(
"double",
"PeakCentreError");
1365 auto sigmaColumn = ws->addColumn(
"double",
"Sigma");
1366 auto sigmaErrorColumn = ws->addColumn(
"double",
"SigmaError");
1367 auto heightColumn = ws->addColumn(
"double",
"Height");
1368 auto heightErrorColumn = ws->addColumn(
"double",
"HeightError");
1369 auto chiSqColumn = ws->addColumn(
"double",
"chiSq");
1370 auto statusColumn = ws->addColumn(
"str",
"FitStatus");
1371 for (
size_t i = 0; i != rows.size(); ++i) {
1372 const auto &row = rows[i];
1373 if (row.workspaceIndex < 0) {
1374 wsIndexColumn->cell<
int>(i) =
static_cast<int>(i);
1376 wsIndexColumn->cell<
int>(i) = row.workspaceIndex;
1378 centreColumn->cell<
double>(i) = row.peakCentre;
1379 centreErrorColumn->cell<
double>(i) = row.peakCentreError;
1380 sigmaColumn->cell<
double>(i) = row.sigma;
1381 sigmaErrorColumn->cell<
double>(i) = row.sigmaError;
1382 heightColumn->cell<
double>(i) = row.height;
1383 heightErrorColumn->cell<
double>(i) = row.heightError;
1384 chiSqColumn->cell<
double>(i) = row.chiSq;
1390 int maskedWorkspaceIndex,
int maskedBinIndex) {
1392 ws->flagMasked(maskedWorkspaceIndex, maskedBinIndex);
1398 const std::string IDF_FILE(
"SNAPLite_Definition.xml");
1401 auto loadEmptyInstr = AlgorithmManager::Instance().createUnmanaged(
"LoadEmptyInstrument");
1402 loadEmptyInstr->initialize();
1403 loadEmptyInstr->setProperty(
"Filename", IDF_FILE);
1404 loadEmptyInstr->setProperty(
"OutputWorkspace", wkspName);
1406 loadEmptyInstr->execute();
1407 if (!loadEmptyInstr->isExecuted())
1408 throw std::runtime_error(
"Failed to execute LoadEmptyInstrument");
1413 ang1Prop->
addValue(DateAndTime(0), ang1);
1415 ang2Prop->
addValue(DateAndTime(0), ang2);
1417 len1Prop->
addValue(DateAndTime(0), 0.045);
1419 len2Prop->
addValue(DateAndTime(0), 0.043);
1422 std::dynamic_pointer_cast<MatrixWorkspace>(AnalysisDataService::Instance().retrieve(wkspName));
1423 wsIn->mutableRun().addProperty(ang1Prop);
1424 wsIn->mutableRun().addProperty(ang2Prop);
1425 wsIn->mutableRun().addProperty(len1Prop);
1426 wsIn->mutableRun().addProperty(len2Prop);
1429 auto loadInstr = AlgorithmManager::Instance().createUnmanaged(
"LoadInstrument");
1430 loadInstr->initialize();
1431 loadInstr->setProperty(
"Workspace", wkspName);
1432 loadInstr->setProperty(
"Filename", IDF_FILE);
1433 loadInstr->setProperty(
"RewriteSpectraMap",
"False");
1434 loadInstr->execute();
1435 if (!loadInstr->isExecuted())
1436 throw std::runtime_error(
"Failed to execute LoadInstrument");
1439 auto xAxis = wsIn->getAxis(0);
1440 xAxis->unit() = Mantid::Kernel::UnitFactory::Instance().create(
"dSpacing");
1445 const std::string &groupingDescr,
const double ang1,
1446 const double ang2) {
1447 const std::string GROUP_WS_NAME =
"tmpGroupingWorkspace_" + groupingAlg +
"_" + groupingDescr;
1453 auto createGroupingAlg = AlgorithmManager::Instance().createUnmanaged(groupingAlg);
1454 createGroupingAlg->initialize();
1455 createGroupingAlg->setProperty(
"OutputWorkspace", GROUP_WS_NAME);
1456 if (groupingAlg ==
"CreateGroupingWorkspace") {
1457 createGroupingAlg->setProperty(
"InputWorkspace", ws);
1458 createGroupingAlg->setProperty(
"GroupDetectorsBy", groupingDescr);
1459 }
else if (groupingAlg ==
"LoadDetectorsGroupingFile") {
1460 createGroupingAlg->setProperty(
"InputWorkspace", ws);
1461 createGroupingAlg->setProperty(
"InputFile", groupingDescr);
1463 throw std::runtime_error(
"Do not know how to create grouping using \"" + groupingAlg +
"\" algorithm");
1465 createGroupingAlg->execute();
1466 if (!createGroupingAlg->isExecuted())
1467 throw std::runtime_error(
"Failed to execute CreateGroupingWorkspace");
1470 auto focusAlg = AlgorithmManager::Instance().createUnmanaged(
"DiffractionFocussing");
1471 focusAlg->initialize();
1472 focusAlg->setProperty(
"InputWorkspace", wkspName);
1473 focusAlg->setProperty(
"OutputWorkspace", wkspName);
1474 focusAlg->setProperty(
"GroupingWorkspace", GROUP_WS_NAME);
1475 focusAlg->execute();
1476 AnalysisDataService::Instance().remove(GROUP_WS_NAME);
1477 if (!focusAlg->isExecuted())
1478 throw std::runtime_error(
"Failed to execute DiffractionFocussing");
1480 return std::dynamic_pointer_cast<MatrixWorkspace>(AnalysisDataService::Instance().retrieve(wkspName));
double value
The value of the point.
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
double lower
lower and upper bounds on the multiplier, if known
Base class from which all concrete algorithm classes should be derived.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
void addDetectorID(const detid_t detID)
Add a detector ID to the set of detector IDs.
void setDetectorID(const detid_t detID)
Clear the list of detector IDs, then add one.
void setSpectrumNo(specnum_t num)
Sets the spectrum number of this spectrum.
void addProperty(Kernel::Property *prop, bool overwrite=false)
Add data to the object in the form of a property.
Helper class for reporting progress from algorithms.
This class stores information regarding an experimental run as a series of log entries.
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
Structure describing a single-crystal peak.
Structure describing a single-crystal peak.
ScanningWorkspaceBuilder : This is a helper class to make it easy to build a scanning workspace (a wo...
void setPos(double, double, double) override
Set the IComponent position, x, y, z respective to parent (if present)
This class represents a detector - i.e.
Class to represent a particular goniometer setting, which is described by the rotation matrix.
void makeUniversalGoniometer()
Make a default universal goniometer with phi,chi,omega angles according to SNS convention.
Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm.
std::shared_ptr< CSGObject > createShape(Poco::XML::Element *pElem)
Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain t...
size_t numRows() const
Return the number of rows in the matrix.
size_t numCols() const
Return the number of columns in the matrix.
This implements the Mersenne Twister 19937 pseudo-random number generator algorithm as a specialzatio...
double nextValue() override
Generate the next random number in the sequence within the given range default range.
OptionalBool : Tri-state bool.
The concrete, templated class for properties.
A specialised Property class for holding a series of time-value pairs.
void addValue(const Types::Core::DateAndTime &time, const TYPE &value)
Add a value to the map using a DateAndTime object.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
constexpr double Z() const noexcept
Get z.
Implements a copy on write data template.
StubAlgorithm(size_t nSteps=100)
Mantid::Geometry::Instrument_sptr createCylInstrumentWithDetInGivenPositions(const std::vector< double > &L2, const std::vector< double > &polar, const std::vector< double > &azim)
create instrument with cylindrical detectors located in specific angular positions
Mantid::Geometry::Instrument_sptr createTestInstrumentCylindrical(int num_banks, const Mantid::Kernel::V3D &sourcePos=Mantid::Kernel::V3D(0.0, 0.0, -10.), const Mantid::Kernel::V3D &samplePos=Mantid::Kernel::V3D(), const double cylRadius=0.004, const double cylHeight=0.0002)
Create an test instrument with n panels of 9 cylindrical detectors, a source and a sample position.
Mantid::Geometry::Instrument_sptr createTestInstrumentRectangular2(int num_banks, int pixels, double pixelSpacing=0.008)
Create an test instrument with n panels of rectangular detectors, pixels*pixels in size,...
Mantid::Geometry::Instrument_sptr createTestInstrumentRectangular(int num_banks, int pixels, double pixelSpacing=0.008, double bankDistanceFromSample=5.0, bool addMonitor=false, const std::string &instrumentName="basic_rect")
Create a test instrument with n panels of rectangular detectors, pixels*pixels in size,...
void addMonitor(Mantid::Geometry::Instrument_sptr &instrument, const Mantid::Kernel::V3D &position, const int ID, const std::string &name)
Adds a monitor to an instrument.
void addSource(Mantid::Geometry::Instrument_sptr &instrument, const Mantid::Kernel::V3D &position, const std::string &name)
Adds a source to an instrument.
void addFullInstrumentToWorkspace(Mantid::API::MatrixWorkspace &workspace, bool includeMonitors, bool startYNegative, const std::string &instrumentName)
void addInstrumentWithGeographicalDetectorsToWorkspace(Mantid::API::MatrixWorkspace &workspace, const int nlat, const int nlong, const double anginc, const std::string &instrumentName)
void addSample(Mantid::Geometry::Instrument_sptr &instrument, const Mantid::Kernel::V3D &position, const std::string &name)
Adds a sample to an instrument.
Mantid::Geometry::Component * addComponent(Mantid::Geometry::Instrument_sptr &instrument, const Mantid::Kernel::V3D &position, const std::string &name)
Adds a component to an instrument.
void addDetector(Mantid::Geometry::Instrument_sptr &instrument, const Mantid::Kernel::V3D &position, const int ID, const std::string &name, Mantid::Geometry::ObjCompAssembly *compAss=nullptr)
Adds a detector to an instrument.
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.
static MatrixWorkspace_sptr createWorkspaceSingleValue(const double &rhsValue)
Creates a temporary single value workspace the error is set to zero.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::size_t numEvents(Nexus::File &file, bool &hasTotalCounts, bool &oldNeXusFileNames, const std::string &prefix)
Get the number of events in the currently opened group.
std::shared_ptr< PeaksWorkspace > PeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::shared_ptr< LeanElasticPeaksWorkspace > LeanElasticPeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::shared_ptr< WorkspaceSingleValue > WorkspaceSingleValue_sptr
shared pointer to the WorkspaceSingleValue class
std::shared_ptr< const EventWorkspace > EventWorkspace_const_sptr
shared pointer to a const Workspace2D
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
std::shared_ptr< RebinnedOutput > RebinnedOutput_sptr
shared pointer to the RebinnedOutput class
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
std::shared_ptr< Instrument > Instrument_sptr
Shared pointer to an instrument object.
std::size_t MANTID_KERNEL_DLL createAxisFromRebinParams(const std::vector< double > ¶ms, std::vector< double > &xnew, const bool resize_xnew=true, const bool full_bins_only=false, const double xMinHint=std::nan(""), const double xMaxHint=std::nan(""), const bool useReverseLogarithmic=false, const double power=-1)
Creates a new output X array given a 'standard' set of rebinning parameters.
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.
std::map< detid_t, Geometry::IDetector_const_sptr > detid2det_map
Typedef of a map from detector ID to detector shared pointer.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
int32_t specnum_t
Typedef for a spectrum Number.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWhereYIsWorkspaceIndex(int nhist, int numBoundaries)
Create a Workspace2D where the Y value at each bin is == to the workspace index.
Mantid::DataObjects::Workspace2D_sptr create1DWorkspaceConstant(int size, double value, double error, bool isHisto)
void setOrientedLattice(const Mantid::API::MatrixWorkspace_sptr &ws, double a, double b, double c)
Sets the OrientedLattice in the crystal as an crystal with given lattice lengths, angles of 90 deg.
void createInstrumentForWorkspaceWithDistances(const Mantid::API::MatrixWorkspace_sptr &workspace, const Mantid::Kernel::V3D &samplePosition, const Mantid::Kernel::V3D &sourcePosition, const std::vector< Mantid::Kernel::V3D > &detectorPositions)
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWithGeographicalDetectors(const int nlat, const int nlong, const double anginc, int nbins, const double x0=0.5, const double deltax=1.0, const std::string &instrumentName=std::string("testInst"), const std::string &xunit=std::string("Momentum"))
Create an Workspace2D with an instrument that contains detectors arranged at even latitude/longitude ...
Mantid::API::MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrumentMultiDetector(const double startX=0.0, const double detSize=0.0, const Mantid::Kernel::V3D &slit1Pos=Mantid::Kernel::V3D(0, 0, 0), const Mantid::Kernel::V3D &slit2Pos=Mantid::Kernel::V3D(0, 0, 1), const double vg1=0.5, const double vg2=1.0, const Mantid::Kernel::V3D &sourcePos=Mantid::Kernel::V3D(0, 0, 0), const Mantid::Kernel::V3D &monitorPos=Mantid::Kernel::V3D(14, 0, 0), const Mantid::Kernel::V3D &samplePos=Mantid::Kernel::V3D(15, 0, 0), const Mantid::Kernel::V3D &detectorCenterPos=Mantid::Kernel::V3D(20,(20 - 15), 0), const int nSpectra=4, const int nBins=20, const double deltaX=5000.0)
Create a 2D workspace with one monitor and three detectors based around a virtual reflectometry instr...
void displayData(const Mantid::API::MatrixWorkspace_const_sptr &ws)
Mantid::API::MatrixWorkspace_sptr createProcessedInelasticWS(const std::vector< double > &L2, const std::vector< double > &polar, const std::vector< double > &azimutal, size_t numBins=4, double Emin=-10, double Emax=10, double Ei=11)
Create a workspace with all components needed for inelastic analysis and 3 detectors in specific plac...
Mantid::API::ITableWorkspace_sptr createEPPTableWorkspace(const std::vector< EPPTableRow > &rows={})
Create a table workspace corresponding to what the FindEPP algorithm gives.
void displayDataY(const Mantid::API::MatrixWorkspace_const_sptr &ws)
Mantid::DataObjects::WorkspaceSingleValue_sptr createWorkspaceSingleValueWithError(double value, double error)
void create2DAngles(std::vector< double > &L2, std::vector< double > &polar, std::vector< double > &azim, size_t nPolar=10, size_t nAzim=10, double polStart=0, double polEnd=90, double azimStart=-30, double azimEnd=30)
Mantid::DataObjects::Workspace2D_sptr create1DWorkspaceConstantWithXerror(int size, double value, double error, double xError, bool isHisto=true)
Mantid::API::MatrixWorkspace_sptr create2DWorkspaceRagged(int version=0)
Create a 2D ragged workspace.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceBinned(size_t nhist, size_t numVals, double x0=0.0, double deltax=1.0)
Create a 2D workspace with this many histograms and bins.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWithRectangularInstrument(int numBanks, int numPixels, int numBins, const std::string &instrumentName="basic_rect")
Create an Workspace2D with an instrument that contains RectangularDetector's.
void populateWsWithInitList(T &destination, size_t startingIndex, const std::initializer_list< double > &values)
Populates a mutable reference from initializer list starting at user specified index.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceNonUniformlyBinned(int nhist, const int numBoundaries, const double xBoundaries[], bool hasDx=false)
Create a 2D workspace with this many histograms and bins.
Mantid::DataObjects::EventWorkspace_sptr createEventWorkspaceWithFullInstrument(int numBanks, int numPixels, bool clearEvents=true)
Create an Eventworkspace with an instrument that contains RectangularDetector's.
Mantid::DataObjects::Workspace2D_sptr create1DWorkspaceFib(int size, bool isHisto)
std::shared_ptr< Mantid::DataObjects::PeaksWorkspace > createPeaksWorkspace(const int numPeaks, const bool createOrientedLattice=false)
Create a simple peaks workspace containing the given number of peaks.
void addNoise(const Mantid::API::MatrixWorkspace_sptr &ws, double noise, const double lower=-0.5, const double upper=0.5)
Add random noise to a 2D workspace.
Mantid::DataObjects::EventWorkspace_sptr createGroupedEventWorkspace(std::vector< std::vector< int > > const &groups, int numBins, double binDelta=1., double xOffset=0.)
Create event workspace, with several detector IDs in one event list.
void removeWS(const std::string &name)
Deletes a workspace.
void displayDataE(const Mantid::API::MatrixWorkspace_const_sptr &ws)
Mantid::HistogramData::Histogram createHisto(bool isHistogram, YType &&yAxis, EType &&eAxis)
Creates and returns point or bin based histograms with the data specified in parameters.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWithValuesAndXerror(int64_t nHist, int64_t nBins, bool isHist, double xVal, double yVal, double eVal, double dxVal, const std::set< int64_t > &maskedWorkspaceIndices=std::set< int64_t >())
Mantid::API::WorkspaceGroup_sptr createWorkspaceGroup(int nEntries, int nHist, int nBins, const std::string &stem)
Create a WorkspaceGroup with N workspaces and the specified parameters.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspace154(int64_t nHist, int64_t nBins, bool isHist=false, const std::set< int64_t > &maskedWorkspaceIndices=std::set< int64_t >(), bool hasDx=false)
std::shared_ptr< Mantid::DataObjects::LeanElasticPeaksWorkspace > createLeanPeaksWorkspace(const int numPeaks, const bool createOrientedLattice=false)
Create a simple lean peaks workspace containing the given number of peaks.
Mantid::DataObjects::EventWorkspace_sptr createRandomEventWorkspace(size_t numbins, size_t numpixels, double bin_delta=1.0)
Create an event workspace with randomized TOF and pulsetimes.
Mantid::API::MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrument(const double startX=0.0, const Mantid::Kernel::V3D &slit1Pos=Mantid::Kernel::V3D(0, 0, 0), const Mantid::Kernel::V3D &slit2Pos=Mantid::Kernel::V3D(0, 0, 1), const double vg1=0.5, const double vg2=1.0, const Mantid::Kernel::V3D &sourcePos=Mantid::Kernel::V3D(0, 0, 0), const Mantid::Kernel::V3D &monitorPos=Mantid::Kernel::V3D(14, 0, 0), const Mantid::Kernel::V3D &samplePos=Mantid::Kernel::V3D(15, 0, 0), const Mantid::Kernel::V3D &detectorPos=Mantid::Kernel::V3D(20,(20 - 15), 0), const int nBins=100, const double deltaX=2000.0)
Create a 2D workspace with one detector and one monitor based around a virtual reflectometry instrume...
Mantid::DataObjects::EventWorkspace_sptr createEventWorkspaceWithStartTime(int numPixels, int numBins, int numEvents=100, double x0=0.0, double binDelta=1.0, int eventPattern=1, int start_at_pixelID=0, Mantid::Types::Core::DateAndTime run_start=Mantid::Types::Core::DateAndTime("2010-01-01T00:00:00"))
void addTSPEntry(Mantid::API::Run &runInfo, const std::string &name, double val)
Utility function to add a TimeSeriesProperty with a name and value.
Mantid::DataObjects::EventWorkspace_sptr createEventWorkspace()
Create event workspace with: 500 pixels 1000 histogrammed bins.
Mantid::API::MatrixWorkspace_sptr createFocusedSNAPLiteInstrument(const std::string &wkspName, const std::string &groupingAlg, const std::string &groupingDescr, const double ang1=-65.3, const double ang2=104.95)
Mantid::DataObjects::EventWorkspace_sptr createEventWorkspace3(const Mantid::DataObjects::EventWorkspace_const_sptr &sourceWS, const std::string &wsname, Mantid::API::Algorithm *alg)
Mantid::API::MatrixWorkspace_sptr create2DDetectorScanWorkspaceWithFullInstrument(int nhist, int nbins, size_t nTimeIndexes, size_t startTime=0, size_t firstInterval=1, bool includeMonitors=false, bool startYNegative=false, bool isHistogram=true, const std::string &instrumentName=std::string("testInst"))
Create a workspace as for create2DWorkspaceWithFullInstrument, but including time indexing,...
Mantid::API::MatrixWorkspace_sptr createSNAPLiteInstrument(const std::string &wkspName, const double ang1=-65.3, const double ang2=104.95)
Create a copy of the SNAP "lite" instrument.
Mantid::API::MatrixWorkspace_sptr createProcessedWorkspaceWithCylComplexInstrument(size_t numPixels=100, size_t numBins=20, bool has_oriented_lattice=true)
Mantid::DataObjects::Workspace2D_sptr create2DWorkspace123(int64_t nHist, int64_t nBins, bool isHist=false, const std::set< int64_t > &maskedWorkspaceIndices=std::set< int64_t >(), bool hasDx=false)
Mantid::DataObjects::Workspace2D_sptr maskSpectra(Mantid::DataObjects::Workspace2D_sptr workspace, const std::set< int64_t > &maskedWorkspaceIndices)
Workspace2D_sptr create2DWorkspaceWithValues(int64_t nHist, int64_t nBins, bool isHist, const std::set< int64_t > &maskedWorkspaceIndices, double xVal, double yVal, double eVal, bool hasDx=false)
create2DWorkspaceWithValues
DataObjects::Workspace2D_sptr reflectometryWorkspace(const double startX, const int nSpectra, const int nBins, const double deltaX)
Creates a binned 2DWorkspace with title and TOF x-axis and counts y-axis.
Mantid::DataObjects::RebinnedOutput_sptr createRebinnedOutputWorkspace()
Function to create a fixed RebinnedOutput workspace.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceThetaVsTOF(int nHist, int nBins)
Create a test workspace with a Theta numeric axis instead of a spectrum axis the values run from 1 to...
void displayDataX(const Mantid::API::MatrixWorkspace_const_sptr &ws)
Mantid::DataObjects::Workspace2D_sptr create1DWorkspaceRand(int size, bool isHisto)
Mantid::API::MatrixWorkspace_sptr createGroupedWorkspace2DWithRingsAndBoxes(size_t RootOfNumHist=10, int numBins=10, double binDelta=1.0)
Mantid::DataObjects::Workspace2D_sptr create2DWorkspace123WithMaskedBin(int numHist, int numBins, int maskedWorkspaceIndex, int maskedBinIndex)
void setGoniometer(const Mantid::API::MatrixWorkspace_sptr &ws, double phi, double chi, double omega)
Create a default universal goniometer and set its angles.
Mantid::DataObjects::EventWorkspace_sptr createEventWorkspaceWithNonUniformInstrument(int numBanks, bool clearEvents)
Creates an event workspace with instrument which consists of cylindrical detectors.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWithFullInstrument(int nhist, int nbins, bool includeMonitors=false, bool startYNegative=false, bool isHistogram=true, const std::string &instrumentName=std::string("testInst"), bool hasDx=false)
Create a test workspace with a fully defined instrument.
Mantid::DataObjects::EventWorkspace_sptr createEventWorkspaceWithFullInstrument2(int numBanks, int numPixels, bool clearEvents=true)
Create an Eventworkspace with instrument 2.0 that contains RectangularDetector's.
Mantid::DataObjects::EventWorkspace_sptr createEventWorkspace2(int numPixels=50, int numBins=100)
Create event workspace with: 50 pixels 100 histogrammed bins from 0.0 in steps of 1....
Mantid::DataObjects::Workspace2D_sptr create2DWorkspace(size_t nhist, size_t numBoundaries)
Mantid::API::MatrixWorkspace_sptr createGroupedWorkspace2D(size_t numHist, int numBins, double binDelta)
Create Workspace2d, with numHist spectra, each with 9 detectors, with IDs 1-9, 10-18,...
void eventWorkspace_Finalize(const Mantid::DataObjects::EventWorkspace_sptr &ew)
Perform some finalization on event workspace stuff.
Mantid::DataObjects::Workspace2D_sptr create2DWorkspacePoints(size_t nhist, size_t numVals, double x0=0.0, double deltax=1.0)
Create a 2D workspace with this many point-histograms and bins.
Generate a tableworkspace to store the calibration results.
EPPTableRow()=default
Construct a row with the default values.
FitStatus
FindEPP algorithm fitting success status.
Create a Fibonacci series.