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

Minor changes to doctests and docstrings

re #22885
re #23093
parent 2d25dfca
No related branches found
No related tags found
No related merge requests found
......@@ -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'.");
}
......@@ -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`
......
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