Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "MantidPythonInterface/core/Policies/RemoveConst.h"

#include <boost/python/class.hpp>
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/overloads.hpp>
#include <boost/python/register_ptr_to_python.hpp>

Expand Down Expand Up @@ -74,6 +75,12 @@ void export_Instrument() {
"Return the valid to :class:`~mantid.kernel.DateAndTime` of the "
"instrument")

.def("getFilename", &Instrument::getFilename, arg("self"), return_value_policy<copy_const_reference>(),
"Return the name of the file that the original IDF was from")

.def("setFilename", &Instrument::setFilename, (arg("self"), arg("filename")),
"Set the name of the file that the original IDF was from")

.def("getBaseInstrument", &Instrument::baseInstrument, arg("self"), return_value_policy<RemoveConstSharedPtr>(),
"Return reference to the base instrument")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ def test_getReferenceFrame(self):
frame = self.__testws.getInstrument().getReferenceFrame()
self.assertTrue(isinstance(frame, ReferenceFrame))

def test_getFilename(self):
inst = self.__testws.getInstrument()

# get the filename
NAME_ORIG = inst.getFilename()

# check that the filename can be set
NAME_NEW = "testable"
inst.setFilename(NAME_NEW)
self.assertEqual(inst.getFilename(), NAME_NEW)

# put the filename back to what it was
inst.setFilename(NAME_ORIG)

def test_ValidDates(self):
inst = self.__testws.getInstrument()
valid_from = inst.getValidFromDate()
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Exposed ``Instrument.getFilename()`` and ``Instrument.setFilename()`` to python