17#include "Poco/NumberParser.h"
19#include <boost/lexical_cast.hpp>
20#include <boost/regex.hpp>
34 std::vector<double> pars = dataWS->getInstrument()->getNumberParameter(parameter);
45 return 1000000 + 1000 * pixel_x + pixel_y;
53 double &
x,
double &
y) {
58 x = (pixel_x - nx_pixels / 2.0 + 0.5) * pixel_size_x / 1000.0;
59 y = (pixel_y - ny_pixels / 2.0 + 0.5) * pixel_size_y / 1000.0;
76 pixel_x =
x / pixel_size_x * 1000.0 + nx_pixels / 2.0 - 0.5;
77 pixel_y =
y / pixel_size_y * 1000.0 + ny_pixels / 2.0 - 0.5;
97 double sourceToSampleDistance;
99 std::vector<double> parsDouble = dataWS->getInstrument()->getNumberParameter(
"Header_source_distance");
100 if (!parsDouble.empty()) {
102 sourceToSampleDistance = parsDouble[0] *= 1000;
104 const auto nGuides = dataWS->run().getPropertyValueAsType<
int>(
"Motor_Positions_nguides");
106 std::vector<std::string> parsString = dataWS->getInstrument()->getStringParameter(
"aperture-distances");
107 if (parsString.empty())
109 std::string guidesDistances = parsString[0];
111 std::vector<std::string> guidesDistancesSplit;
112 boost::split(guidesDistancesSplit, guidesDistances, boost::is_any_of(
"\t ,"), boost::token_compress_on);
113 sourceToSampleDistance = boost::lexical_cast<double>(guidesDistancesSplit[nGuides]);
115 auto sourceToSampleDistanceOffset =
116 dataWS->run().getPropertyValueAsType<
double>(
"Header_sample_aperture_to_flange");
118 sourceToSampleDistance -= sourceToSampleDistanceOffset;
120 return sourceToSampleDistance;
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Exception for errors associated with the instrument definition.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
void getDefaultBeamCenter(const API::MatrixWorkspace_sptr &dataWS, double &pixel_x, double &pixel_y)
double getSourceToSampleDistance(const API::MatrixWorkspace_sptr &dataWS)
double readInstrumentParameter(const std::string ¶meter, const API::MatrixWorkspace_sptr &dataWS)
File change history is stored at: https://github.com/mantidproject/mantid Code Documentation is avail...
int getDetectorFromPixel(const int &pixel_x, const int &pixel_y, const API::MatrixWorkspace_sptr &dataWS)
void getCoordinateFromPixel(const double &pixel_x, const double &pixel_y, const API::MatrixWorkspace_sptr &dataWS, double &x, double &y)
void getPixelFromCoordinate(const double &x, const double &y, const API::MatrixWorkspace_sptr &dataWS, double &pixel_x, double &pixel_y)