Mantid
|
FractionalRebinning helper functionality, used by the Rebin2D algorithm. More...
Enumerations | |
enum class | QuadrilateralType { Rectangle , TrapezoidX , TrapezoidY , General } |
Functions | |
void | calcGeneralIntersections (const std::vector< double > &xAxis, const std::vector< double > &yAxis, const Quadrilateral &inputQ, const size_t qstart, const size_t qend, const size_t x_start, const size_t x_end, std::vector< AreaInfo > &areaInfos) |
Computes the output grid bins which intersect the input quad and their overlapping areas for arbitrary shaped input grids. More... | |
void | calcRectangleIntersections (const std::vector< double > &xAxis, const std::vector< double > &yAxis, const Quadrilateral &inputQ, const size_t y_start, const size_t y_end, const size_t x_start, const size_t x_end, std::vector< AreaInfo > &areaInfos) |
Computes the output grid bins which intersect the input quad and their overlapping areas assuming both input and output grids are rectangular. More... | |
void | calcTrapezoidYIntersections (const std::vector< double > &xAxis, const std::vector< double > &yAxis, const Quadrilateral &inputQ, const size_t y_start, const size_t y_end, const size_t x_start, const size_t x_end, std::vector< AreaInfo > &areaInfos) |
Computes the output grid bins which intersect the input quad and their overlapping areas assuming input quad is a y-axis aligned trapezoid. More... | |
MANTID_DATAOBJECTS_DLL void | finalizeFractionalRebin (DataObjects::RebinnedOutput &outputWS) |
Set finalize flag after fractional rebinning loop. More... | |
MANTID_DATAOBJECTS_DLL bool | getIntersectionRegion (const std::vector< double > &xAxis, const std::vector< double > &verticalAxis, const Geometry::Quadrilateral &inputQ, size_t &qstart, size_t &qend, size_t &x_start, size_t &x_end) |
Find the intersect region on the output grid. More... | |
QuadrilateralType | getQuadrilateralType (const Quadrilateral &inputQ) |
Determine the (axis-aligned) quadrilateral type of the input polygon. More... | |
MANTID_DATAOBJECTS_DLL void | normaliseOutput (const API::MatrixWorkspace_sptr &outputWS, const API::MatrixWorkspace_const_sptr &inputWS, API::Progress *progress=nullptr) |
Compute sqrt of errors and put back in bin width division if necessary. More... | |
MANTID_DATAOBJECTS_DLL void | rebinToFractionalOutput (const Geometry::Quadrilateral &inputQ, const API::MatrixWorkspace_const_sptr &inputWS, const size_t i, const size_t j, DataObjects::RebinnedOutput &outputWS, const std::vector< double > &verticalAxis, const DataObjects::RebinnedOutput_const_sptr &inputRB=nullptr) |
Rebin the input quadrilateral to to output grid. More... | |
MANTID_DATAOBJECTS_DLL void | rebinToOutput (const Geometry::Quadrilateral &inputQ, const API::MatrixWorkspace_const_sptr &inputWS, const size_t i, const size_t j, API::MatrixWorkspace &outputWS, const std::vector< double > &verticalAxis) |
Rebin the input quadrilateral to to output grid. More... | |
Variables | |
const double | POS_TOLERANCE = 1.e-10 |
FractionalRebinning helper functionality, used by the Rebin2D algorithm.
|
strong |
Enumerator | |
---|---|
Rectangle | |
TrapezoidX | |
TrapezoidY | |
General |
Definition at line 47 of file FractionalRebinning.cpp.
void Mantid::DataObjects::FractionalRebinning::calcGeneralIntersections | ( | const std::vector< double > & | xAxis, |
const std::vector< double > & | yAxis, | ||
const Quadrilateral & | inputQ, | ||
const size_t | qstart, | ||
const size_t | qend, | ||
const size_t | x_start, | ||
const size_t | x_end, | ||
std::vector< AreaInfo > & | areaInfos | ||
) |
Computes the output grid bins which intersect the input quad and their overlapping areas for arbitrary shaped input grids.
xAxis | A vector containing the output horizontal axis edges |
yAxis | The output data vertical axis |
inputQ | The input quadrilateral |
qstart | The starting y-axis index |
qend | The starting y-axis index |
x_start | The starting x-axis index |
x_end | The starting x-axis index |
areaInfos | Output vector of indices and areas of overlapping bins |
Definition at line 442 of file FractionalRebinning.cpp.
References Mantid::Geometry::ConvexPolygon::area(), Mantid::Geometry::ConvexPolygon::clear(), and Mantid::Geometry::intersection().
Referenced by rebinToFractionalOutput().
void Mantid::DataObjects::FractionalRebinning::calcRectangleIntersections | ( | const std::vector< double > & | xAxis, |
const std::vector< double > & | yAxis, | ||
const Quadrilateral & | inputQ, | ||
const size_t | y_start, | ||
const size_t | y_end, | ||
const size_t | x_start, | ||
const size_t | x_end, | ||
std::vector< AreaInfo > & | areaInfos | ||
) |
Computes the output grid bins which intersect the input quad and their overlapping areas assuming both input and output grids are rectangular.
xAxis | A vector containing the output horizontal axis edges |
yAxis | The output data vertical axis |
inputQ | The input quadrilateral |
y_start | The starting y-axis index |
y_end | The starting y-axis index |
x_start | The starting x-axis index |
x_end | The starting x-axis index |
areaInfos | Output vector of indices and areas of overlapping bins |
Definition at line 128 of file FractionalRebinning.cpp.
References height, Mantid::Geometry::Quadrilateral::maxX(), Mantid::Geometry::Quadrilateral::maxY(), Mantid::Geometry::Quadrilateral::minX(), and Mantid::Geometry::Quadrilateral::minY().
Referenced by rebinToFractionalOutput().
void Mantid::DataObjects::FractionalRebinning::calcTrapezoidYIntersections | ( | const std::vector< double > & | xAxis, |
const std::vector< double > & | yAxis, | ||
const Quadrilateral & | inputQ, | ||
const size_t | y_start, | ||
const size_t | y_end, | ||
const size_t | x_start, | ||
const size_t | x_end, | ||
std::vector< AreaInfo > & | areaInfos | ||
) |
Computes the output grid bins which intersect the input quad and their overlapping areas assuming input quad is a y-axis aligned trapezoid.
xAxis | A vector containing the output horizontal axis edges |
yAxis | The output data vertical axis |
inputQ | The input quadrilateral |
y_start | The starting y-axis index |
y_end | The ending y-axis index |
x_start | The starting x-axis index |
x_end | The ending x-axis index |
areaInfos | Output vector of indices and areas of overlapping bins |
Definition at line 162 of file FractionalRebinning.cpp.
References Mantid::Kernel::V2D::X(), and Mantid::Kernel::V2D::Y().
Referenced by rebinToFractionalOutput().
void Mantid::DataObjects::FractionalRebinning::finalizeFractionalRebin | ( | RebinnedOutput & | outputWS | ) |
Set finalize flag after fractional rebinning loop.
Called at the completion of the fractional rebinning loop to the set the finalize and hasSqrdError flags in the output workspace.
outputWS | Reference to the rebinned output workspace |
Definition at line 652 of file FractionalRebinning.cpp.
References Mantid::DataObjects::RebinnedOutput::setFinalized(), and Mantid::DataObjects::RebinnedOutput::setSqrdErrors().
Referenced by Mantid::Algorithms::Rebin2D::exec(), Mantid::Algorithms::SofQWNormalisedPolygon::exec(), and Mantid::DataObjects::ReflectometryTransform::executeNormPoly().
bool Mantid::DataObjects::FractionalRebinning::getIntersectionRegion | ( | const std::vector< double > & | xAxis, |
const std::vector< double > & | verticalAxis, | ||
const Quadrilateral & | inputQ, | ||
size_t & | qstart, | ||
size_t & | qend, | ||
size_t & | x_start, | ||
size_t & | x_end | ||
) |
Find the intersect region on the output grid.
Find the possible region of intersection on the output workspace for the given polygon.
The given polygon must have a CLOCKWISE winding and the first vertex must be the "lowest left" point.
xAxis | A vector containing the output horizontal axis edges |
verticalAxis | A vector containing the output vertical axis edges |
inputQ | The input polygon (Polygon winding must be clockwise) |
qstart | An output giving the starting index in the Q direction |
qend | An output giving the end index in the Q direction |
x_start | An output giving the start index in the dX direction |
x_end | An output giving the end index in the dX direction |
Definition at line 82 of file FractionalRebinning.cpp.
References Mantid::Geometry::Quadrilateral::maxX(), Mantid::Geometry::Quadrilateral::maxY(), Mantid::Geometry::Quadrilateral::minX(), and Mantid::Geometry::Quadrilateral::minY().
Referenced by rebinToFractionalOutput(), and rebinToOutput().
QuadrilateralType Mantid::DataObjects::FractionalRebinning::getQuadrilateralType | ( | const Quadrilateral & | inputQ | ) |
Determine the (axis-aligned) quadrilateral type of the input polygon.
inputQ | Input polygon (assumes vertices are in order: ll, ul, ur, lr) |
Definition at line 53 of file FractionalRebinning.cpp.
References fabs, General, POS_TOLERANCE, Rectangle, TrapezoidX, TrapezoidY, Mantid::Geometry::X, and Mantid::Geometry::Y.
Referenced by rebinToFractionalOutput().
void Mantid::DataObjects::FractionalRebinning::normaliseOutput | ( | const MatrixWorkspace_sptr & | outputWS, |
const MatrixWorkspace_const_sptr & | inputWS, | ||
Progress * | progress | ||
) |
Compute sqrt of errors and put back in bin width division if necessary.
Computes the square root of the errors and if the input was a distribution this divides by the new bin-width.
outputWS | The workspace containing the output data |
inputWS | The input workspace used for testing distribution state |
progress | An optional progress object. Reported to once per bin. |
Definition at line 468 of file FractionalRebinning.cpp.
References Mantid::Kernel::ProgressBase::report().
Referenced by Mantid::Algorithms::Rebin2D::exec(), Mantid::Algorithms::SofQWNormalisedPolygon::exec(), Mantid::Algorithms::SofQWPolygon::exec(), and Mantid::DataObjects::ReflectometryTransform::executeNormPoly().
void Mantid::DataObjects::FractionalRebinning::rebinToFractionalOutput | ( | const Quadrilateral & | inputQ, |
const MatrixWorkspace_const_sptr & | inputWS, | ||
const size_t | i, | ||
const size_t | j, | ||
RebinnedOutput & | outputWS, | ||
const std::vector< double > & | verticalAxis, | ||
const RebinnedOutput_const_sptr & | inputRB | ||
) |
Rebin the input quadrilateral to to output grid.
Rebin the input quadrilateral to the output grid The quadrilateral must have a CLOCKWISE winding.
inputQ | The input polygon (Polygon winding must be clockwise) |
inputWS | The input workspace containing the input intensity values |
i | The indexiin the vertical axis direction that inputQ references |
j | The index in the horizontal axis direction that inputQ references |
outputWS | A pointer to the output workspace that accumulates the data Note that the error array of the output workspace contains the variance and not the errors (standard deviations). |
verticalAxis | A vector containing the output vertical axis bin boundaries |
inputRB | A pointer, of RebinnedOutput type, to the input workspace. It is used to take into account the input area fractions when calcuting the final output fractions. This can be null to indicate that the input was a standard 2D workspace. |
Definition at line 571 of file FractionalRebinning.cpp.
References Mantid::Geometry::Quadrilateral::area(), calcGeneralIntersections(), calcRectangleIntersections(), calcTrapezoidYIntersections(), Mantid::DataObjects::RebinnedOutput::dataF(), error, getIntersectionRegion(), getQuadrilateralType(), Mantid::API::MatrixWorkspace::mutableE(), Mantid::API::MatrixWorkspace::mutableY(), PARALLEL_CRITICAL, Rectangle, TrapezoidY, Mantid::API::MatrixWorkspace::x(), and Mantid::Geometry::X.
Referenced by Mantid::Algorithms::Rebin2D::exec(), Mantid::Algorithms::SofQWNormalisedPolygon::exec(), and Mantid::DataObjects::ReflectometryTransform::executeNormPoly().
void Mantid::DataObjects::FractionalRebinning::rebinToOutput | ( | const Quadrilateral & | inputQ, |
const MatrixWorkspace_const_sptr & | inputWS, | ||
const size_t | i, | ||
const size_t | j, | ||
MatrixWorkspace & | outputWS, | ||
const std::vector< double > & | verticalAxis | ||
) |
Rebin the input quadrilateral to to output grid.
Rebin the input quadrilateral to the output grid.
The quadrilateral must have a CLOCKWISE winding.
inputQ | The input polygon (Polygon winding must be Clockwise) |
inputWS | The input workspace containing the input intensity values |
i | The index in the vertical axis direction that inputQ references |
j | The index in the horizontal axis direction that inputQ references |
outputWS | A pointer to the output workspace that accumulates the data |
verticalAxis | A vector containing the output vertical axis bin boundaries |
Definition at line 504 of file FractionalRebinning.cpp.
References Mantid::Geometry::ConvexPolygon::area(), Mantid::Geometry::Quadrilateral::area(), Mantid::Geometry::ConvexPolygon::clear(), getIntersectionRegion(), Mantid::Geometry::intersection(), Mantid::Geometry::ConvexPolygon::maxX(), Mantid::Geometry::ConvexPolygon::minX(), Mantid::API::MatrixWorkspace::mutableE(), Mantid::API::MatrixWorkspace::mutableY(), PARALLEL_CRITICAL, Mantid::API::MatrixWorkspace::x(), Mantid::Geometry::X, and Mantid::Geometry::y.
Referenced by Mantid::Algorithms::Rebin2D::exec(), and Mantid::Algorithms::SofQWPolygon::exec().
const double Mantid::DataObjects::FractionalRebinning::POS_TOLERANCE = 1.e-10 |
Definition at line 45 of file FractionalRebinning.cpp.
Referenced by getQuadrilateralType().