Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
3c8377a3
Commit
3c8377a3
authored
6 years ago
by
Owen Arnold
Browse files
Options
Downloads
Patches
Plain Diff
refs #24597. Convert to doctest
parent
8a0b3c71
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/source/concepts/ComponentInfo.rst
+17
-12
17 additions, 12 deletions
docs/source/concepts/ComponentInfo.rst
docs/source/concepts/DetectorInfo.rst
+18
-22
18 additions, 22 deletions
docs/source/concepts/DetectorInfo.rst
with
35 additions
and
34 deletions
docs/source/concepts/ComponentInfo.rst
+
17
−
12
View file @
3c8377a3
...
...
@@ -20,15 +20,20 @@ Examples of using ``ComponentInfo`` in python
Print indices of detectors in "bank1" that are masked
.. code-block:: python
from mantid.simpleapi import CreateSampleWorkspace
ws = CreateSampleWorkspace()
comp_info = ws.componentInfo()
det_info = ws.detectorInfo()
bank_index compinfo.indexOfAny('bank1')
for det_index in compinfo.detectorsInSubtree(bank_index):
if det_info.isMasked(int(det_index)):
print('Masked detector of bank1, ', det_index)
.. testcode:: show_masked_detectors_in_bank
from mantid.simpleapi import CreateSampleWorkspace
ws = CreateSampleWorkspace()
comp_info = ws.componentInfo()
det_info = ws.detectorInfo()
det_info.setMasked(2, True) # Mask a bank 1 detector for demo
det_info.setMasked(len(det_info)-1, True) # Mask detector not in bank 1
bank_index = comp_info.indexOfAny('bank1')
for det_index in comp_info.detectorsInSubtree(bank_index):
if det_info.isMasked(int(det_index)):
print('Masked detector index of bank1 is {}'.format(det_index))
.. testoutput:: show_masked_detectors_in_bank
Masked detector index of bank1 is 2
This diff is collapsed.
Click to expand it.
docs/source/concepts/DetectorInfo.rst
+
18
−
22
View file @
3c8377a3
...
...
@@ -16,30 +16,26 @@ Introduction
Python Interface
----------------
Example
s
of using ``DetectorInfo`` in python
Example of using ``DetectorInfo`` in python
Mask detectors at some distance from the source
**
Mask detectors at some distance from the source
**
.. code-block:: python
from mantid.simpleapi import CreateSampleWorkspace
.. testcode:: mask_detectors
# Test workspace with instrument
ws = CreateSampleWorkspace()
det_info = ws.detectorInfo();
for item in det_info:
if not item.isMonitor and item.l2 > 2.0:
item.setMasked(True)
from mantid.simpleapi import CreateSampleWorkspace
# Test workspace with instrument
ws = CreateSampleWorkspace()
det_info = ws.detectorInfo();
mask_count = 0
for item in det_info:
if not item.isMonitor and item.l2 > 2.0:
item.setMasked(True)
mask_count += 1
print('masked {} detectors'.format(mask_count))
Print detectors with scattering angle
.. code-block:: python
from mantid.simpleapi import CreateSampleWorkspace
# Test workspace with instrument
ws = CreateSampleWorkspace()
det_info = ws.detectorInfo()
for item in det_info:
if item.l2 > 0.01:
print(item.index)
.. testoutput:: mask_detectors
masked 200 detectors
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment