Skip to content

Commit

Permalink
Re #6192. Remove SpectraAxis::populateOneToOne method.
Browse files Browse the repository at this point in the history
Nothing was using it on the C++ side. It was exposed to python, but
as far as I can tell nothing was using it there either.
  • Loading branch information
RussellTaylor committed Feb 28, 2013
1 parent c18b61a commit 88420c5
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 31 deletions.
1 change: 0 additions & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/SpectraAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class MANTID_API_DLL SpectraAxis: public Axis
void getSpectraIndexMap(spec2index_map&) const;
void getIndexSpectraMap(index2spec_map& map) const;

void populateOneToOne(int64_t start, int64_t end);
/// returns min value defined on axis
double getMin()const{return double(m_values.front()) ; }
/// returns max value defined on axis
Expand Down
22 changes: 2 additions & 20 deletions Code/Mantid/Framework/API/src/SpectraAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SpectraAxis::SpectraAxis(const std::size_t& length, const bool initWithDefaults
}

/**
* Constructor taking a reference to an ISpectraDetectorMap implementation. The
* Constructor taking a reference to an ISpectraDetectorMap implementation. The
* axis is initialized to first length unique spectra values provided by the map
* @param length :: The length of the axis
* @param spectramap :: A reference to an ISpectraDetectorMap implementation.
Expand All @@ -49,7 +49,7 @@ SpectraAxis::SpectraAxis(const std::size_t length, const Geometry::ISpectraDetec
if( length == 0 ) return;
Geometry::ISpectraDetectorMap::const_iterator itr = spectramap.cbegin();
Geometry::ISpectraDetectorMap::const_iterator iend = spectramap.cend();
if( itr == iend )
if( itr == iend )
{
m_values.resize(0);
return;
Expand Down Expand Up @@ -193,24 +193,6 @@ void SpectraAxis::getSpectraIndexMap(spec2index_map& map)const
}
}

/**
* Populate the SpectraAxis with a 1:1 map from start to end (inclusive).
*/
void SpectraAxis::populateOneToOne(int64_t start, int64_t end)
{
if( start > end )
{
throw std::invalid_argument("SpectraAxis::populateOneToOne - start > end");
}
const size_t nvalues(end-start+1);
m_values.resize(nvalues, 0);
for (size_t i=0; i < nvalues; i++)
{
m_values[i] = static_cast<specid_t>(start+i);
}
}


/** Check if two axis defined as spectra or numeric axis are equivalent
* @param axis2 :: Reference to the axis to compare to
* @return true is self and second axis are equal
Expand Down
8 changes: 0 additions & 8 deletions Code/Mantid/Framework/API/test/SpectraAxisTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ class SpectraAxisTest : public CxxTest::TestSuite
delete one2one;
}

void testPopulateOneToOne()
{
SpectraAxis ax(5);
ax.populateOneToOne(1,100);
TS_ASSERT_EQUALS( ax.length(), 100);
TS_ASSERT_EQUALS( ax.spectraNo(23), 24);
}

void testCopyConstructor()
{
SpectraAxisTester axistester1;
Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/Framework/PythonAPI/src/api_exports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ void export_dataitem()
class_< API::SpectraAxis, bases<API::Axis>, boost::noncopyable >("SpectraAxis", no_init)
.def("spectraNumber", (const specid_t & (Mantid::API::SpectraAxis::*)(const size_t &) const) & API::SpectraAxis::spectraNo, return_value_policy<copy_const_reference>() )
.def("setValue", & API::SpectraAxis::setValue)
.def("populateOneToOne", & API::SpectraAxis::populateOneToOne)
;
// Text Axis subclass
class_< API::TextAxis, bases<API::Axis>, boost::noncopyable >("TextAxis", no_init)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ void export_SpectraAxis()
class_< SpectraAxis, bases<Axis>, boost::noncopyable >("SpectraAxis", no_init)
.def("spectraNo", (const specid_t &(SpectraAxis::*)(const size_t &) const)&SpectraAxis::spectraNo,
return_value_policy<copy_const_reference>(), "Returns the spectrum no at the given index")
.def("populateOneToOne", & SpectraAxis::populateOneToOne, "Populate the list with 1:1 values")
.def("create", &createSpectraAxis, return_internal_reference<>(), "Creates a new SpectraAxis of a specified length")
.staticmethod("create")
;
Expand Down

0 comments on commit 88420c5

Please sign in to comment.