Skip to content
Snippets Groups Projects
Commit b9b8dd00 authored by Bhuvan Bezawada's avatar Bhuvan Bezawada
Browse files

Added minor changes to exposed methods

re #22885
parent 15ed9dce
No related branches found
No related tags found
No related merge requests found
......@@ -41,49 +41,37 @@ void export_DetectorInfo() {
// Export to Python
class_<DetectorInfo, boost::noncopyable>("DetectorInfo", no_init)
.def("__len__", &DetectorInfo::size, (arg("self")),
"Returns the size of the DetectorInfo, i.e., the number of "
"detectors in the instrument.")
.def("__len__", &DetectorInfo::size, (arg("self")),
"Returns the size of the DetectorInfo, i.e., the number of "
"detectors in the instrument.")
.def("size", &DetectorInfo::size, (arg("self")),
"Returns the size of the DetectorInfo, i.e., the number of "
"detectors in the instrument.")
.def("size", &DetectorInfo::size, (arg("self")),
"Returns the size of the DetectorInfo, i.e., the number of "
"detectors in the instrument.")
.def("isMonitor", isMonitor, (arg("self"), arg("index")),
"Returns True if the detector is a monitor.")
.def("isMonitor", isMonitor, (arg("self"), arg("index")),
"Returns True if the detector is a monitor.")
.def("isMasked", isMasked, (arg("self"), arg("index")),
"Returns True if the detector is masked.")
.def("isMasked", isMasked, (arg("self"), arg("index")),
"Returns True if the detector is masked.")
.def("isEquivalent", &DetectorInfo::isEquivalent,
(arg("self"), arg("other")),
"Returns true if the content of this is equivalent to the content "
"of other.")
.def("isEquivalent", &DetectorInfo::isEquivalent,
(arg("self"), arg("other")),
"Returns true if the content of this is equivalent to the content "
"of other.")
.def("twoTheta", twoTheta, (arg("self"), arg("index")),
"Returns 2 theta (scattering angle w.r.t.to beam direction).")
.def("twoTheta", twoTheta, (arg("self"), arg("index")),
"Returns 2 theta (scattering angle w.r.t beam direction).")
.def("signedTwoTheta", signedTwoTheta, (arg("self"), arg("index")),
"Returns signed 2 theta (signed scattering angle w.r.t. to beam "
"direction).")
.def("position", position, (arg("self"), arg("index")),
"Returns the absolute position of the detector with given index.")
.def("position", position, (arg("self"), arg("index")),
"Returns the absolute position of the detector with given index.")
.def("rotation", rotation, (arg("self"), arg("index")),
"Returns the absolute rotation of the detector with given index.")
.def("rotation", rotation, (arg("self"), arg("index")),
"Returns the absolute rotation of the detector with given index.")
.def("setMasked", setMasked, (arg("self"), arg("index"), arg("masked")),
"Set the mask flag of the detector with given index.")
.def("setMasked", setMasked, (arg("self"), arg("index"), arg("masked")),
"Set the mask flag of the detector with given index.")
.def("clearMaskFlags", &DetectorInfo::clearMaskFlags, (arg("self")),
"Sets all mask flags to false (unmasked).")
.def("setPosition", setPosition,
(arg("self"), arg("index"), arg("position")),
"Set the absolute position of the detector with given index.")
.def("setRotation", setRotation,
(arg("self"), arg("index"), arg("rotation")),
"Set the absolute rotation of the detector with given index.");
.def("clearMaskFlags", &DetectorInfo::clearMaskFlags, (arg("self")),
"Sets all mask flags to false (unmasked).");
}
......@@ -4,6 +4,7 @@ import unittest
from testhelpers import WorkspaceCreationHelper
from mantid.kernel import V3D
from mantid.kernel import Quat
from mantid.simpleapi import *
class DetectorInfoTest(unittest.TestCase):
......@@ -92,5 +93,15 @@ class DetectorInfoTest(unittest.TestCase):
retQuat = info.rotation(0)
self.assertEquals(quat, retQuat)
def test_createWorkspaceAndDetectorInfo(self):
""" Try to create a workspace and see if DetectorInfo object
is accessable """
dataX = [1,2,3,4,5]
dataY = [1,2,3,4,5]
workspace = CreateWorkspace(DataX=dataX, DataY=dataY)
info = workspace.detectorInfo()
self.assertEquals(info.size(), 0)
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment