\(\renewcommand\AA{\unicode{x212B}}\)

MoveInstrumentComponent v1

Summary

Moves an instrument component to a new position.

See Also

RotateInstrumentComponent, SetInstrumentParameter

Properties

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.

MoveFixedDetectors

Input

boolean

False

Whether to allow moving of individual detector pixels located within a structured bank. If set to false then a request to move a detector pixel within a structured bank will be ignored. The default value for this property is set to false to maintain backwards compatibility.

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.

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.

Usage

Example 1: Move a component by name

MoveBank.png‎

Moving a bank through three movements. All the pixels of the bank move along with the bank 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())

Output

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

Example 2: Move a detector by ID

DetectorMove.png‎

Moving an individual detector using the detector 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: AlgorithmIndex | DataHandling\Instrument

Source

C++ header: MoveInstrumentComponent.h

C++ source: MoveInstrumentComponent.cpp