From 25e9697b4dd98b58fb812c2a32dd8be56376f76c Mon Sep 17 00:00:00 2001 From: Bhuvan Bezawada <bhuvan_777@outlook.com> Date: Wed, 25 Jul 2018 15:43:56 +0100 Subject: [PATCH] Minor changes to doctests and docstrings re #22885 re #23093 --- .../geometry/src/Exports/DetectorInfo.cpp | 10 +++--- .../python/mantid/geometry/DetectorInfo.rst | 32 +++++++++++-------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp index 6d64ae24950..9bb59f43430 100644 --- a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp +++ b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp @@ -47,22 +47,22 @@ void export_DetectorInfo() { "Returns True if the detector is masked.") .def("setMasked", setMasked, (arg("self"), arg("index"), arg("masked")), - "Set the mask flag of the detector with given index.") + "Set the mask flag of the detector where the detector is identified by 'index'.") .def("clearMaskFlags", &DetectorInfo::clearMaskFlags, (arg("self")), "Sets all mask flags to false (unmasked).") .def("isEquivalent", &DetectorInfo::isEquivalent, (arg("self"), arg("other")), - "Returns true if the content of this is equivalent to the content " - "of other.") + "Returns True if the content of this detector is equivalent to the content " + "of the other detector.") .def("twoTheta", twoTheta, (arg("self"), arg("index")), "Returns 2 theta (scattering angle w.r.t beam direction).") .def("position", position, (arg("self"), arg("index")), - "Returns the absolute position of the detector with given index.") + "Returns the absolute position of the detector where the detector is identified by 'index'.") .def("rotation", rotation, (arg("self"), arg("index")), - "Returns the absolute rotation of the detector with given index."); + "Returns the absolute rotation of the detector where the detector is identified by 'index'."); } diff --git a/docs/source/api/python/mantid/geometry/DetectorInfo.rst b/docs/source/api/python/mantid/geometry/DetectorInfo.rst index 1eb72d2d145..5d3a1f09f83 100644 --- a/docs/source/api/python/mantid/geometry/DetectorInfo.rst +++ b/docs/source/api/python/mantid/geometry/DetectorInfo.rst @@ -13,8 +13,8 @@ Many users may need this extra information so that they can have a better unders DetectorInfo is one of three objects that the user can gain access to from a Workspace. The other two are: -* SpectrumInfo -* ComponentInfo + * SpectrumInfo + * ComponentInfo ------- Usage @@ -46,13 +46,14 @@ The method takes in an integer ``index`` parameter which corresponds to a compon info = ws.detectorInfo() # Call setMasked - print(info.setMasked(0, True)) + info.setMasked(0, True) print(info.isMasked(0)) - print(info.setMasked(0, False)) + info.setMasked(0, False) print(info.isMasked(0)) **Example 3 - Calling the twoTheta method on the DetectorInfo Object:** -The ``twoTheta()`` method takes in an integer ``index`` parameter which represents a detector index. The return value is a float which represents the scattering angle with respect to the beam direction. +The ``twoTheta()`` method takes in an integer ``index`` parameter which represents a detector index. +The return value is a float which represents the scattering angle with respect to the beam direction. .. testcode:: CallTwoThetaMethod @@ -66,7 +67,9 @@ The ``twoTheta()`` method takes in an integer ``index`` parameter which represen print(type(info.twoTheta(0))) **Example 4 - Calling the position method on the DetectorInfo Object:** -The ``position()`` method takes an ``index`` parameter which represents a detector index and returns the absolute position of that detector. The returned object is of type V3D which is a essentially 3D vector. +The ``position()`` method takes an ``index`` parameter which represents a detector index. +The method returns the absolute position of that detector. +The returned object is of type V3D which is a position in 3D space. .. testcode:: CallPositionMethod @@ -81,7 +84,8 @@ The ``position()`` method takes an ``index`` parameter which represents a detect **Example 5 - Calling the size method on the DetectorInfo Object:** -The ``size()`` method does not take in any parameters and returns a number of detectors in the instrument. One can also use the built in ``__len__`` function to obtain the same result. +The ``size()`` method does not take in any parameters and returns a number of detectors in the instrument. +One can also use the built in ``__len__`` function to obtain the same result. .. testcode:: CallSizeAndLenMethods @@ -99,25 +103,25 @@ Output: .. testoutput:: CreateDetectorInfoObject -<class 'mantid.geometry._geometry.DetectorInfo'> + <class 'mantid.geometry._geometry.DetectorInfo'> .. testoutput:: CallSetMaskedMethod -True -False + True + False .. testoutput:: CallTwoThetaMethod -<type 'float'> + <class 'float'> .. testoutput:: CallPositionMethod -<class 'mantid.kernel._kernel.V3D'> + <class 'mantid.kernel._kernel.V3D'> .. testoutput:: CallSizeAndLenMethods -200 -200 + 200 + 200 *bases:* :py:obj:`mantid.geometry.DetectorInfo` -- GitLab