Mantid
Loading...
Searching...
No Matches
Q1DWeighted.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8#include "MantidAPI/Axis.h"
12#include "MantidAPI/Run.h"
14#include "MantidAPI/TableRow.h"
30
31#include <boost/algorithm/string/classification.hpp>
32#include <boost/algorithm/string/split.hpp>
33
34#include <algorithm>
35
36constexpr double deg2rad = M_PI / 180.0;
37
38namespace Mantid::Algorithms {
39
40// Register the algorithm into the AlgorithmFactory
41DECLARE_ALGORITHM(Q1DWeighted)
42
43using namespace Kernel;
44using namespace API;
45using namespace Geometry;
46using namespace DataObjects;
47
49 auto wsValidator = std::make_shared<CompositeValidator>(CompositeRelation::OR);
50 auto monoValidator = std::make_shared<CompositeValidator>(CompositeRelation::AND);
51 auto monoUnitValidator = std::make_shared<CompositeValidator>(CompositeRelation::OR);
52 auto tofValidator = std::make_shared<CompositeValidator>(CompositeRelation::AND);
53
54 monoUnitValidator->add<WorkspaceUnitValidator>("Label"); // case for D16 omega scan, which has unit "Omega scan"
55 monoUnitValidator->add<WorkspaceUnitValidator>("Empty"); // case for kinetic data
56
57 monoValidator->add(monoUnitValidator);
58 monoValidator->add<HistogramValidator>(false);
59 monoValidator->add<InstrumentValidator>();
60
61 tofValidator->add<WorkspaceUnitValidator>("Wavelength");
62 tofValidator->add<HistogramValidator>(true);
63 tofValidator->add<InstrumentValidator>();
64
65 wsValidator->add(monoValidator);
66 wsValidator->add(tofValidator);
67
68 declareProperty(std::make_unique<WorkspaceProperty<>>("InputWorkspace", "", Direction::Input, wsValidator),
69 "Input workspace containing the SANS 2D data");
70 declareProperty(std::make_unique<WorkspaceProperty<>>("OutputWorkspace", "", Direction::Output),
71 "Workspace that will contain the I(Q) data");
72 declareProperty(std::make_unique<ArrayProperty<double>>("OutputBinning", std::make_shared<RebinParamsValidator>()),
73 "The new bin boundaries in the form: :math:`x_1,\\Delta x_1,x_2,\\Delta "
74 "x_2,\\dots,x_n`");
75
76 auto positiveInt = std::make_shared<BoundedValidator<int>>();
77 positiveInt->setLower(0);
78 auto positiveDouble = std::make_shared<BoundedValidator<double>>();
79 positiveDouble->setLower(0);
80
81 declareProperty("NPixelDivision", 1, positiveInt,
82 "Number of sub-pixels used for each detector pixel in each "
83 "direction.The total number of sub-pixels will be "
84 "NPixelDivision*NPixelDivision.");
85
86 // Wedge properties
87 declareProperty("NumberOfWedges", 2, positiveInt, "Number of wedges to calculate.");
88 declareProperty("WedgeAngle", 30.0, positiveDouble, "Opening angle of the wedge, in degrees.");
89 declareProperty("WedgeOffset", 0.0, positiveDouble, "Wedge offset relative to the horizontal axis, in degrees.");
90 declareProperty(std::make_unique<WorkspaceProperty<WorkspaceGroup>>("WedgeWorkspace", "", Direction::Output,
92 "Name for the WorkspaceGroup containing the wedge I(q) distributions.");
93
94 declareProperty("PixelSizeX", 5.15, positiveDouble, "Pixel size in the X direction (mm).");
95 declareProperty("PixelSizeY", 5.15, positiveDouble, "Pixel size in the Y direction (mm).");
96 declareProperty("ErrorWeighting", false, "Choose whether each pixel contribution will be weighted by 1/error^2.");
97
98 declareProperty("AsymmetricWedges", false, "Choose to produce the results for asymmetric wedges.");
99
100 declareProperty("AccountForGravity", false, "Take the nominal gravity drop into account.");
101
104 "Table workspace containing the shapes (sectors only) drawn in the "
105 "instrument viewer; if specified, the wedges properties defined above "
106 "are not taken into account.");
107}
108
110 MatrixWorkspace_const_sptr inputWS = getProperty("InputWorkspace");
111 bootstrap(inputWS);
112 calculate(inputWS);
113 finalize(inputWS);
114}
115
122 // Get pixel size and pixel sub-division
123 m_pixelSizeX = getProperty("PixelSizeX");
124 m_pixelSizeY = getProperty("PixelSizeY");
125 m_pixelSizeX /= 1000.;
126 m_pixelSizeY /= 1000.;
127 m_nSubPixels = getProperty("NPixelDivision");
128
129 // Get weighting option
130 m_errorWeighting = getProperty("ErrorWeighting");
131
132 // Get gravity flag
133 m_correctGravity = getProperty("AccountForGravity");
134
135 // Calculate the output binning
136 const std::vector<double> binParams = getProperty("OutputBinning");
137
138 m_nQ = static_cast<size_t>(VectorHelper::createAxisFromRebinParams(binParams, m_qBinEdges)) - 1;
139
140 m_isMonochromatic = inputWS->getAxis(0)->unit()->unitID() != "Wavelength";
141 // number of spectra in the input
142 m_nSpec = inputWS->getNumberHistograms();
143
144 // get the number of wavelength bins / samples in the input, note that the input is a histogram
145 m_nBins = inputWS->readY(0).size();
146
147 m_wedgesParameters = std::vector<Q1DWeighted::Wedge>();
148
149 m_asymmWedges = getProperty("AsymmetricWedges");
150
151 if (isDefault("ShapeTable")) {
152 const int wedges = getProperty("NumberOfWedges");
153 m_nWedges = static_cast<size_t>(wedges);
154
155 // Get wedge properties
156 const double wedgeOffset = getProperty("WedgeOffset");
157 const double wedgeAngle = getProperty("WedgeAngle");
158
159 // Define wedges parameters in a general way
160 for (size_t iw = 0; iw < m_nWedges; ++iw) {
161 double innerRadius = 0.;
162
163 // Negative outer radius is taken as a convention for infinity
164 double outerRadius = -1.;
165 double centerX = 0.;
166 double centerY = 0.;
167 double angleRange = wedgeAngle * deg2rad;
168 double midAngle = M_PI * static_cast<double>(iw) / static_cast<double>(m_nWedges);
169 if (m_asymmWedges)
170 midAngle *= 2;
171 midAngle += wedgeOffset * deg2rad;
172
173 m_wedgesParameters.push_back(
174 Q1DWeighted::Wedge(innerRadius, outerRadius, centerX, centerY, midAngle, angleRange));
175 }
176 } else {
177 g_log.warning("This option is still in active development and might be "
178 "subject to changes in the next version.");
181 }
182
183 // we store everything in 3D arrays
184 // index 1 : is for the wedges + the one for the full integration, if there are no wedges, the 1st dimension will be 1
185 // index 2 : will iterate over lambda bins / over samples if monochromatic
186 // index 3 : will iterate over Q bins
187 // we want to do this, since we want to average the I(Q) in each lambda bin then average all the I(Q)s together (in
188 // the case of TOF)
189 m_intensities = std::vector<std::vector<std::vector<double>>>(
190 m_nWedges + 1, std::vector<std::vector<double>>(m_nBins, std::vector<double>(m_nQ, 0.0)));
193}
194
201 ITableWorkspace_sptr shapeWs = getProperty("ShapeTable");
202 size_t rowCount = shapeWs->rowCount();
203
204 std::map<std::string, std::vector<double>> viewportParams;
205
206 // by convention, the last row is supposed to be the viewport
207 getViewportParams(shapeWs->String(rowCount - 1, 1), viewportParams);
208
209 for (size_t i = 0; i < rowCount - 1; ++i) {
210 std::map<std::string, std::vector<std::string>> paramMap;
211 std::vector<std::string> splitParams;
212 boost::algorithm::split(splitParams, shapeWs->String(i, 1), boost::algorithm::is_any_of("\n"));
213 std::vector<std::string> params;
214 for (std::string val : splitParams) {
215 if (val.empty())
216 continue;
217 boost::algorithm::split(params, val, boost::algorithm::is_any_of("\t"));
218
219 // NB : the first value of the vector also is the key, and is not a meaningful value
220 paramMap[params[0]] = params;
221 }
222 if (paramMap["Type"][1] == "sector")
223 getWedgeParams(paramMap["Parameters"], viewportParams);
224 else
225 g_log.information() << "Shape " << i + 1 << " is of type " << paramMap["Type"][1]
226 << " which is not supported. This shape is ignored." << std::endl;
227 }
228
229 std::sort(m_wedgesParameters.begin(), m_wedgesParameters.end(),
230 [](const Q1DWeighted::Wedge &wedgeA, const Q1DWeighted::Wedge &wedgeB) {
231 return wedgeA.angleMiddle < wedgeB.angleMiddle;
232 });
233
235}
236
244void Q1DWeighted::getViewportParams(const std::string &viewport,
245 std::map<std::string, std::vector<double>> &viewportParams) {
246
247 std::vector<std::string> params;
248 boost::algorithm::split(params, viewport, boost::algorithm::is_any_of("\t, \n"));
249
250 if (params[0] != "Translation") {
251 g_log.error(
252 "No viewport found in the shape table. Please provide a table using shapes drawn in the Full3D projection.");
253 }
254
255 // Translation
256 viewportParams[params[0]] = std::vector<double>(2);
257 viewportParams[params[0]][0] = std::stod(params[1]);
258 viewportParams[params[0]][1] = std::stod(params[2]);
259
260 // Zoom
261 viewportParams[params[3]] = std::vector<double>(1);
262 viewportParams[params[3]][0] = std::stod(params[4]);
263
264 // Rotation quaternion
265 viewportParams[params[5]] = std::vector<double>(4);
266 viewportParams[params[5]][0] = std::stod(params[6]);
267 viewportParams[params[5]][1] = std::stod(params[7]);
268 viewportParams[params[5]][2] = std::stod(params[8]);
269 viewportParams[params[5]][3] = std::stod(params[9]);
270
271 double epsilon = 1e-10;
272
273 if (std::fabs(viewportParams["Rotation"][0]) > epsilon || std::fabs(viewportParams["Rotation"][1]) > epsilon ||
274 std::fabs(viewportParams["Rotation"][3]) > epsilon || std::fabs(viewportParams["Rotation"][2] - 1) > epsilon) {
275 g_log.warning("The shapes were created using a rotated viewport not using Z- projection, which is not supported. "
276 "Results are likely to be erroneous. Consider freezing the rotation in the instrument viewer.");
277 }
278}
279
285void Q1DWeighted::getWedgeParams(const std::vector<std::string> &params,
286 const std::map<std::string, std::vector<double>> &viewport) {
287 double zoom = viewport.at("Zoom")[0];
288
289 double innerRadius = std::stod(params[1]) / zoom;
290 double outerRadius = std::stod(params[2]) / zoom;
291
292 double startAngle = std::stod(params[3]);
293 double endAngle = std::stod(params[4]);
294
295 double centerAngle = (startAngle + endAngle) / 2;
296 if (endAngle < startAngle)
297 centerAngle = std::fmod(centerAngle + M_PI, 2 * M_PI);
298
299 double angleRange = std::fmod(endAngle - startAngle, 2 * M_PI);
300 angleRange = angleRange >= 0 ? angleRange : angleRange + 2 * M_PI;
301
302 // since the viewport was in Z-, the axis are inverted so we have to take the symmetry of the angle
303 centerAngle = std::fmod(3 * M_PI - centerAngle, 2 * M_PI);
304
305 double xOffset = viewport.at("Translation")[0];
306 double yOffset = viewport.at("Translation")[1];
307
308 double centerX = -(std::stod(params[5]) - xOffset) / zoom;
309 double centerY = (std::stod(params[6]) - yOffset) / zoom;
310
311 Q1DWeighted::Wedge wedge = Q1DWeighted::Wedge(innerRadius, outerRadius, centerX, centerY, centerAngle, angleRange);
312
313 if (m_asymmWedges || !checkIfSymetricalWedge(wedge)) {
314 m_wedgesParameters.push_back(wedge);
315 }
316}
317
326 return std::any_of(m_wedgesParameters.cbegin(), m_wedgesParameters.cend(),
327 [&wedge](const auto &params) { return wedge.isSymmetric(params); });
328}
329
337 for (size_t i = 0; i < m_wedgesParameters.size() - 1; ++i) {
338 if (m_wedgesParameters[i].angleMiddle == m_wedgesParameters[i + 1].angleMiddle) {
339 g_log.warning() << "Two of the given wedges are superposed, at " << m_wedgesParameters[i].angleMiddle / deg2rad
340 << " degrees." << std::endl;
341 ;
342 }
343 }
344}
345
352 // Set up the progress
353 Progress progress(this, 0.0, 1.0, m_nSpec * m_nBins);
354
355 const auto &spectrumInfo = inputWS->spectrumInfo();
356 const V3D sourcePos = spectrumInfo.sourcePosition();
357 const V3D samplePos = spectrumInfo.samplePosition();
358 // Beam line axis, to compute scattering angle
359 const V3D beamLine = samplePos - sourcePos;
360
361 const auto up = inputWS->getInstrument()->getReferenceFrame()->vecPointingUp();
362 double monoWavelength = 0;
363 if (m_isMonochromatic) {
364 if (inputWS->run().hasProperty("wavelength")) {
365 monoWavelength = inputWS->run().getPropertyAsSingleValue("wavelength");
366 } else
367 throw std::runtime_error("Could not find wavelength in the sample logs.");
368 }
369
371 // first we loop over spectra
372 for (int index = 0; index < static_cast<int>(m_nSpec); ++index) {
374 const auto i = static_cast<size_t>(index);
375 // skip spectra with no detectors, monitors or masked spectra
376 if (!spectrumInfo.hasDetectors(i) || spectrumInfo.isMonitor(i) || spectrumInfo.isMasked(i)) {
377 continue;
378 }
379
380 // store masked bins
381 std::vector<size_t> maskedBins;
382 // check if we have masked bins
383 if (inputWS->hasMaskedBins(i)) {
384 maskedBins = inputWS->maskedBinsIndices(i);
385 }
386
387 // get readonly references to the input data
388 const auto &XIn = inputWS->x(i);
389 const auto &YIn = inputWS->y(i);
390 const auto &EIn = inputWS->e(i);
391
392 // get the position of the pixel wrt sample (normally 0,0,0).
393 const V3D pos = spectrumInfo.position(i) - samplePos;
394
395 // prepare a gravity helper, this is much faster than calculating
396 // on-the-fly, see the caching in the helper
397 GravitySANSHelper gravityHelper(spectrumInfo, i, 0.0);
398
399 // loop over bins
400 for (size_t j = 0; j < m_nBins; ++j) {
401
402 // skip if the bin is masked
403 if (std::binary_search(maskedBins.cbegin(), maskedBins.cend(), j)) {
404 continue;
405 }
406
407 const double wavelength = m_isMonochromatic ? monoWavelength : (XIn[j] + XIn[j + 1]) / 2.;
408
409 V3D correction;
410 if (m_correctGravity) {
411 correction = up * gravityHelper.gravitationalDrop(wavelength);
412 }
413
414 // Each pixel might be sub-divided in the number of pixels given as
415 // input parameter (NPixelDivision x NPixelDivision)
416 for (int isub = 0; isub < m_nSubPixels * m_nSubPixels; ++isub) {
417
418 // Find the position offset for this sub-pixel in real space
419 const double subY = m_pixelSizeY * ((isub % m_nSubPixels) - (m_nSubPixels - 1.0) / 2.0) / m_nSubPixels;
420 const double subX = m_pixelSizeX *
421 (floor(static_cast<double>(isub) / m_nSubPixels) - (m_nSubPixels - 1.0) * 0.5) /
423
424 // calculate Q
425 const V3D position = pos - V3D(subX, subY, 0.0) + correction;
426 const double sinTheta = sin(0.5 * position.angle(beamLine));
427 const double q = 4.0 * M_PI * sinTheta / wavelength;
428
429 if (q < m_qBinEdges.front() || q > m_qBinEdges.back()) {
430 continue;
431 }
432
433 // after check above, no need to wrap this in try catch
435
436 double w = 1.0;
437 if (m_errorWeighting) {
438 // When using the error as weight we have:
439 // w_i = 1/s_i^2 where s_i is the uncertainty on the ith
440 // pixel.
441 //
442 // I(q_i) = (sum over i of I_i * w_i) / (sum over i of w_i)
443 // where all pixels i contribute to the q_i bin, and I_i is
444 // the intensity in the ith pixel.
445 //
446 // delta I(q_i) = 1/sqrt( (sum over i of w_i) ) using simple
447 // error propagation.
448 double err = 1.0;
449 if (EIn[j] > 0)
450 err = EIn[j];
451 w /= m_nSubPixels * m_nSubPixels * err * err;
452 }
453 PARALLEL_CRITICAL(iqnorm) {
454 // Fill in the data for full azimuthal integral
455 m_intensities[0][j][k] += YIn[j] * w;
456 m_errors[0][j][k] += w * w * EIn[j] * EIn[j];
457 m_normalisation[0][j][k] += w;
458 }
459
460 for (size_t iw = 0; iw < m_nWedges; ++iw) {
461
463 double centerAngle = wedge.angleMiddle;
464 const V3D subPix = V3D(position.X(), position.Y(), 0.0);
465 const V3D center = V3D(wedge.centerX, wedge.centerY, 0);
466 double angle = std::fabs((subPix - center).angle(V3D(cos(centerAngle), sin(centerAngle), 0.0)));
467
468 // checks that the pixel is within the angular range or, if the
469 // integration is symmetrical, within the angular range + PI
470 bool isWithinAngularRange =
471 angle < wedge.angleRange * 0.5 || (!m_asymmWedges && std::fabs(M_PI - angle) < wedge.angleRange * 0.5);
472
473 bool isWithinRadii = subPix.distance(center) > wedge.innerRadius &&
474 (wedge.outerRadius <= 0 || subPix.distance(center) <= wedge.outerRadius);
475
476 if (isWithinAngularRange && isWithinRadii) {
477 PARALLEL_CRITICAL(iqnorm_wedges) {
478 // first index 0 is the full azimuth, need to offset+1
479 m_intensities[iw + 1][j][k] += YIn[j] * w;
480 m_errors[iw + 1][j][k] += w * w * EIn[j] * EIn[j];
481 m_normalisation[iw + 1][j][k] += w;
482 }
483 }
484 }
485 }
486 progress.report("Computing I(Q)");
487 }
489 }
491}
492
499 const size_t nSpectra = m_isMonochromatic ? m_nBins : 1;
501 setProperty("OutputWorkspace", outputWS);
502
503 // Create workspace group that holds output workspaces for wedges
504 auto wsgroup = std::make_shared<WorkspaceGroup>();
505 if (m_nWedges != 0) {
506 // Create wedge workspaces
507 for (size_t iw = 0; iw < m_nWedges; ++iw) {
509 wedgeWs->mutableRun().addProperty("wedge_angle", m_wedgesParameters[iw].angleMiddle / deg2rad, "degrees", true);
510 wsgroup->addWorkspace(wedgeWs);
511 }
512 // set the output property
513 std::string outputWSGroupName = getPropertyValue("WedgeWorkspace");
514 if (outputWSGroupName.empty()) {
515 std::string outputWSName = getPropertyValue("OutputWorkspace");
516 outputWSGroupName = outputWSName + "_wedges";
517 setPropertyValue("WedgeWorkspace", outputWSGroupName);
518 }
519 setProperty("WedgeWorkspace", wsgroup);
520 }
521
522 for (size_t iout = 0; iout < m_nWedges + 1; ++iout) {
523
524 auto ws = (iout == 0) ? outputWS : std::dynamic_pointer_cast<MatrixWorkspace>(wsgroup->getItem(iout - 1));
525
526 if (m_isMonochromatic) {
527 fillMonochromaticOutput(ws, iout);
528 } else {
529 fillTOFOutput(ws, iout);
530 }
531 }
532}
533
542
543 for (size_t iSample = 0; iSample < m_nBins; ++iSample) {
544 auto &YOut = outputWS->mutableY(iSample);
545 auto &EOut = outputWS->mutableE(iSample);
546
548 for (int iq = 0; iq < static_cast<int>(m_nQ); ++iq) {
550 const double norm = m_normalisation[iout][iSample][iq];
551 if (norm != 0.) {
552 YOut[iq] = m_intensities[iout][iSample][iq] / norm;
553 EOut[iq] = m_errors[iout][iSample][iq] / (norm * norm);
554 }
556 }
558 }
559}
560
567void Q1DWeighted::fillTOFOutput(MatrixWorkspace_sptr &outputWS, const size_t iout) {
568 auto &YOut = outputWS->mutableY(0);
569 auto &EOut = outputWS->mutableE(0);
570
571 std::vector<double> normLambda(m_nQ, 0.0);
572
573 for (size_t il = 0; il < m_nBins; ++il) {
575 for (int iq = 0; iq < static_cast<int>(m_nQ); ++iq) {
577 const double norm = m_normalisation[iout][il][iq];
578 if (norm != 0.) {
579 YOut[iq] += m_intensities[iout][il][iq] / norm;
580 EOut[iq] += m_errors[iout][il][iq] / (norm * norm);
581 normLambda[iq] += 1.;
582 }
584 }
586 }
587
588 for (size_t i = 0; i < m_nQ; ++i) {
589 YOut[i] /= normLambda[i];
590 EOut[i] = sqrt(EOut[i]) / normLambda[i];
591 }
592}
593
603 const std::vector<double> &binEdges, const size_t nSpectra) {
604
605 MatrixWorkspace_sptr outputWS = WorkspaceFactory::Instance().create(parent, nSpectra, nBins + 1, nBins);
606 outputWS->getAxis(0)->unit() = UnitFactory::Instance().create("MomentumTransfer");
607 for (size_t iSpectra = 0; iSpectra < nSpectra; ++iSpectra) {
608 outputWS->setBinEdges(iSpectra, binEdges);
609 }
610 outputWS->setYUnitLabel("1/cm");
611 outputWS->setDistribution(true);
612 return outputWS;
613}
614
615} // namespace Mantid::Algorithms
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
double position
Definition GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
int64_t nSpectra
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_CRITICAL(name)
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
constexpr double deg2rad
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Kernel::Logger & g_log
Definition Algorithm.h:422
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
bool isDefault(const std::string &name) const
void setPropertyValue(const std::string &name, const std::string &value) override
Set the value of a property by string N.B.
A validator which checks that a workspace contains histogram data (the default) or point data as requ...
A validator which checks that a workspace has a valid instrument.
Helper class for reporting progress from algorithms.
Definition Progress.h:25
A property class for workspaces.
A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the exp...
A helper class for calculating neutron's gravitional drop.
double gravitationalDrop(const double wav) const
void getTableShapes()
Q1DWeighted::getTableShapes if the user provided a shape table, parse the stored values and get the v...
void bootstrap(const API::MatrixWorkspace_const_sptr &)
Q1DWeighted::bootstrap initializes the user inputs.
void fillTOFOutput(API::MatrixWorkspace_sptr &, const size_t)
Q1DWeighted::fillTOFOutput Fill in the output workspace for TOF input, averaging over lambda bins.
std::vector< Wedge > m_wedgesParameters
std::vector< std::vector< std::vector< double > > > m_intensities
bool checkIfSymetricalWedge(Wedge &Wedge)
Q1DWeighted::checkIfSymetricalWedge Check if the symetrical wedge to the one defined by the parameter...
void fillMonochromaticOutput(API::MatrixWorkspace_sptr &, const size_t)
Q1DWeighted::fillMonochromaticOutput Fill the output workspace for monochromatic, kinetic input.
std::vector< std::vector< std::vector< double > > > m_errors
void finalize(const API::MatrixWorkspace_const_sptr &)
Q1DWeighted::finalize performs final averaging and sets the output workspaces.
void init() override
Initialisation code.
void getViewportParams(const std::string &, std::map< std::string, std::vector< double > > &)
Q1DWeighted::getViewportParams get the parameters defining the viewport of the instrument view when t...
std::vector< double > m_qBinEdges
void getWedgeParams(const std::vector< std::string > &, const std::map< std::string, std::vector< double > > &)
Q1DWeighted::getWedgeParams.
std::vector< std::vector< std::vector< double > > > m_normalisation
API::MatrixWorkspace_sptr createOutputWorkspace(const API::MatrixWorkspace_const_sptr &, const size_t, const std::vector< double > &, const size_t)
Create an output workspace.
void checkIfSuperposedWedges()
Q1DWeighted::checkIfSuperposedWedges Check if some wedges ahev the same angleMiddle,...
void calculate(const API::MatrixWorkspace_const_sptr &)
Q1DWeighted::calculate Performs the azimuthal averaging for each wavelength bin.
void exec() override
Execution code.
Support for a property that holds an array of values.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void error(const std::string &msg)
Logs at error level.
Definition Logger.cpp:108
void warning(const std::string &msg)
Logs at warning level.
Definition Logger.cpp:117
void information(const std::string &msg)
Logs at information level.
Definition Logger.cpp:136
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
Class for 3D vectors.
Definition V3D.h:34
double distance(const V3D &v) const noexcept
Calculates the distance between two vectors.
Definition V3D.h:293
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< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
constexpr double deg2rad
Defines units/enum for Crystal work.
Definition AngleUnits.h:20
size_t MANTID_KERNEL_DLL indexOfValueFromEdges(const std::vector< double > &bin_edges, const double value)
Gets the bin of a value from a vector of bin edges.
int MANTID_KERNEL_DLL createAxisFromRebinParams(const std::vector< double > &params, 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.
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
@ Input
An input workspace.
Definition Property.h:53
@ Output
An output workspace.
Definition Property.h:54