MoveInstrumentComponent v1

../_images/MoveInstrumentComponent-v1_dlg.png

MoveInstrumentComponent dialog.

Summary

Moves an instrument component to a new position.

Properties

Name Direction Type Default Description
Workspace InOut MatrixWorkspace 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.

Description

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.

Usage

Example 1: move a component by name

# 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 the same vector
MoveInstrumentComponent( ws, 'bank1', X=1,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()

Output

[0,0,5]
[1,0,5]
[2,0,5]
[1,2,3]

Example 2: move a detector by ID

# 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()

Output

[0.0888151,-0.108221,-0.145]
[1.08882,-0.108221,-0.145]

Categories: Algorithms | DataHandling | Instrument