Commit b0e14e06 authored by Danny Hindson's avatar Danny Hindson
Browse files

Revert MatrixWorkspace::isHistogramData API to original form

Based on review comments, revert the isHistogramData method to its
original form without any parameters to avoid encouraging creation
of matrix workspaces containing histograms with mix of xModes
Create private function instead that allows a specific histogram to
be checked
parent 0545e4f8
......@@ -423,7 +423,7 @@ public:
/// Returns true if the workspace contains data in histogram form (as
/// opposed to point-like)
virtual bool isHistogramData(std::size_t index = 0) const;
virtual bool isHistogramData() const;
/// Returns true if the workspace contains common X bins
virtual bool isCommonBins() const;
......@@ -601,6 +601,8 @@ private:
void buildDefaultSpectrumDefinitions();
void rebuildDetectorIDGroupings();
virtual bool isHistogramDataByIndex(std::size_t index = 0) const;
std::unique_ptr<Indexing::IndexInfo> m_indexInfo;
/// Has this workspace been initialised?
......
......@@ -1051,8 +1051,17 @@ void MatrixWorkspace::setDistribution(bool newValue) {
* Whether the workspace contains histogram data
* @return whether the workspace contains histogram data
*/
bool MatrixWorkspace::isHistogramData(const std::size_t index) const {
bool MatrixWorkspace::isHistogramData() const {
// all spectra *should* have the same behavior
return isHistogramDataByIndex(0);
}
/**
* Whether the specified histogram contains histogram data (ie bins)
* @param index :: Index of the histogram to be checked
* @return whether the histogram contains histogram data
*/
bool MatrixWorkspace::isHistogramDataByIndex(const std::size_t index) const {
bool isHist = (x(index).size() != y(index).size());
// TODOHIST temporary sanity check
......@@ -1386,7 +1395,7 @@ std::size_t MatrixWorkspace::yIndexOfX(const double xValue,
throw std::out_of_range("MatrixWorkspace::yIndexOfX - X value is greater"
" than the highest in the current range.");
if (isHistogramData(index))
if (isHistogramDataByIndex(index))
return binIndexOfValue(xValues, xValue, ascendingOrder, tolerance);
else
return xIndexOfValue(xValues, xValue, tolerance);
......
......@@ -137,7 +137,7 @@ public:
// Returns true always - an EventWorkspace always represents histogramm-able
// data
bool isHistogramData(std::size_t index) const override;
bool isHistogramData() const override;
std::size_t MRUSize() const;
......
......@@ -13,7 +13,6 @@
#include "MantidAPI/SpectraAxis.h"
#include "MantidAPI/SpectrumInfo.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidDataObjects/DllConfig.h"
#include "MantidDataObjects/EventWorkspaceMRU.h"
#include "MantidGeometry/IDetector.h"
#include "MantidGeometry/Instrument.h"
......@@ -453,10 +452,7 @@ void EventWorkspace::switchEventType(const Mantid::API::EventType type) {
/// Returns true always - an EventWorkspace always represents histogramm-able
/// data
/// @returns If the data is a histogram - always true for an eventWorkspace
bool EventWorkspace::isHistogramData(std::size_t index) const {
UNUSED_ARG(index)
return true;
}
bool EventWorkspace::isHistogramData() const { return true; }
/** Return how many entries in the Y MRU list are used.
* Only used in tests. It only returns the 0-th MRU list size.
......
......@@ -70,9 +70,6 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MatrixWorkspace_yIndexOfXOverloads,
// Overloads for YUnitLabel which has 1 optional argument
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MatrixWorkspace_YUnitLabelOverloads,
YUnitLabel, 0, 2)
// Overloads for isHistogramData which has 1 optional argument
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MatrixWorkspace_isHistogramDataOverloads,
MatrixWorkspace::isHistogramData, 0, 1)
GNU_DIAG_ON("conversion")
GNU_DIAG_ON("unused-local-typedef")
......@@ -393,10 +390,8 @@ void export_MatrixWorkspace() {
.def("getAxis", &MatrixWorkspace::getAxis,
(arg("self"), arg("axis_index")), return_internal_reference<>(),
"Get a pointer to a workspace axis")
.def("isHistogramData", &MatrixWorkspace::isHistogramData,
MatrixWorkspace_isHistogramDataOverloads(
(arg("self"), arg("index")),
"Returns ``True`` if this is considered to be binned data."))
.def("isHistogramData", &MatrixWorkspace::isHistogramData, arg("self"),
"Returns ``True`` if this is considered to be binned data.")
.def("isDistribution",
(bool (MatrixWorkspace::*)() const) &
MatrixWorkspace::isDistribution,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment