Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Workspace | InOut | Workspace | Mandatory | The name of the workspace for which the new instrument configuration will have an effect. Any other workspaces stored in the analysis data service will be unaffected. |
ComponentName | Input | string | The name of the component to move. Component names are defined in the instrument definition files. A pathname delited by ‘/’ may be used for non-unique name. | |
DetectorID | Input | number | -1 | The ID of the detector to move. If both the component name and the detector ID are set the latter will be used. |
X | Input | number | 0 | The x-part of the new location vector. |
Y | Input | number | 0 | The y-part of the new location vector. |
Z | Input | number | 0 | The z-part of the new location vector. |
RelativePosition | Input | boolean | True | The property defining how the (X,Y,Z) vector should be interpreted. If true it is a vector relative to the initial component’s position. Otherwise it is a new position in the absolute co-ordinates. |
This moves an instrument component, e.g. a bank or a pixel.
You can specify a pathname as the name of a non-unique component (e.g. “WISH/panel03/WISHpanel03/tube005”) and one can skip parts not needed for uniqueness (e.g. “panel03/tube005”). For a unique component, you can just specify the name (e.g. “panel03”).
You can either specify an absolute position or a relative position. The relative position will be applied to the current position, so applying this twice will move the detector twice.
If you move a component that is made up of smaller parts (such as a bank is made up of detectors, or a tube is made up of pixels) then the smaller parts will be transated along with the component.
# Create a workspace with a simple instrument
ws = CreateSampleWorkspace()
# Original position of instrument component 'bank1'
print(ws.getInstrument().getComponentByName('bank1').getPos())
# Move 'bank1' by vector (1,0,0) relative to its original position
MoveInstrumentComponent( ws, 'bank1', X=1,Y=0,Z=0 )
# Check the new position of 'bank1'
print(ws.getInstrument().getComponentByName('bank1').getPos())
# Move the same bank again by vector (2,0,0)
MoveInstrumentComponent( ws, 'bank1', X=2,Y=0,Z=0 )
# Check the new position of 'bank1'
print(ws.getInstrument().getComponentByName('bank1').getPos())
# Move 'bank1' to a new absolute position (1,2,3)
MoveInstrumentComponent( ws, 'bank1', X=1,Y=2,Z=3, RelativePosition=False )
# Check the new position of 'bank1'
print(ws.getInstrument().getComponentByName('bank1').getPos())
# Load a MUSR file
musr = Load('MUSR00015189')
# and use the first workspace in the workspace group
ws = mtd['musr_1']
# Original position of detector 33
print(ws.getInstrument().getDetector(33).getPos())
# Move detector 33 by vector (1,0,0) relative to its original position
MoveInstrumentComponent( ws, DetectorID=33, X=1,Y=0,Z=0 )
# Check the new position of detector 33
print(ws.getInstrument().getDetector(33).getPos())
[0.0888151,-0.108221,-0.145]
[1.08882,-0.108221,-0.145]
Categories: AlgorithmIndex | DataHandling\Instrument
C++ source: MoveInstrumentComponent.cpp (last modified: 2019-06-04)
C++ header: MoveInstrumentComponent.h (last modified: 2018-10-05)