Commit 8bcd0097 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

use int64_t for now



Signed-off-by: Hahn, Steven's avatarSteven Hahn <hahnse@ornl.gov>
parent 610fdd7f
......@@ -514,7 +514,7 @@ public:
// Check if this class has an oriented lattice on a sample object
virtual bool hasOrientedLattice() const override;
virtual std::pair<int64_t, int64_t> find(double value) const;
virtual int64_t find(double value) const;
//=====================================================================================
// End IMDWorkspace methods
......
......@@ -1931,7 +1931,7 @@ MantidImage_sptr MatrixWorkspace::getImage(
return image;
}
std::pair<int64_t, int64_t> MatrixWorkspace::find(double value) const {
int64_t MatrixWorkspace::find(double value) const {
std::pair<int64_t, int64_t> out(-1, -1);
const int64_t numHists = static_cast<int64_t>(this->getNumberHistograms());
for (int64_t i = 0; i < numHists; ++i) {
......@@ -1941,7 +1941,7 @@ std::pair<int64_t, int64_t> MatrixWorkspace::find(double value) const {
break;
}
}
return out;
return out.first;
}
/**
......
......@@ -71,6 +71,32 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MatrixWorkspace_YUnitLabelOverloads,
GNU_DIAG_ON("conversion")
GNU_DIAG_ON("unused-local-typedef")
// Converts a std::pair instance to a Python tuple.
template <typename T1, typename T2>
struct std_pair_to_tuple
{
static PyObject* convert(std::pair<T1, T2> const& p)
{
return boost::python::incref(
boost::python::make_tuple(p.first, p.second).ptr());
}
static PyTypeObject const *get_pytype () {return &PyTuple_Type; }
};
// Helper for convenience.
template <typename T1, typename T2>
struct std_pair_to_python_converter
{
std_pair_to_python_converter()
{
boost::python::to_python_converter<
std::pair<T1, T2>,
std_pair_to_tuple<T1, T2>,
true //std_pair_to_tuple has get_pytype
>();
}
};
/**
* Set the values from an python array-style object into the given spectrum in
* the workspace
......@@ -365,7 +391,7 @@ void export_MatrixWorkspace() {
":class:`~mantid.api.MatrixWorkspace.hasMaskedBins` MUST be called "
"first to check if any bins are "
"masked, otherwise an exception will be thrown")
.def("find", &find, (arg("self"), arg("value")), "find index of Y value")
.def("find", &MatrixWorkspace::find, (arg("self"), arg("value")), "find index of Y value")
// Deprecated
.def("getNumberBins", &getNumberBinsDeprecated, arg("self"),
"Returns size of the Y data array (deprecated, use "
......
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