RotateSource v1

../_images/RotateSource-v1_dlg.png

RotateSource dialog.

Summary

Rotates the source by a given angle

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.
Angle Input number 0 The angle of rotation in degrees (according to the handedness of the coordinate system.

Description

This algorithm corrects the source’s position by rotating it around an axis centered at the sample. The rotation axis is perpendicular to the plane determined by the beam direction and the up direction. The handedness of the coordinate system is considered to determine whether a positive/negative angle corresponds to a clockwise or counterclockwise rotation.

Usage

Example - RotateSource

# Create a workspace with a simple instrument
ws = CreateSampleWorkspace()

# Original positions
samplePos = ws.getInstrument().getSample().getPos()
sourcePos = ws.getInstrument().getSource().getPos()
print "Original position of the sample: [%.1f, %.1f, %.1f]" % (samplePos.X(), samplePos.Y(), samplePos.Z())
print "Original position of the source: [%.1f, %.1f, %.1f]" % (sourcePos.X(), sourcePos.Y(), sourcePos.Z())

# Move (rotate) the source around X axis
RotateSource(ws, -90)

# New positions
samplePos = ws.getInstrument().getSample().getPos()
sourcePos = ws.getInstrument().getSource().getPos()
print "New position of the sample: [%.1f, %.1f, %.1f]" % (samplePos.X(), samplePos.Y(), samplePos.Z())
print "New position of the source: [%.1f, %.1f, %.1f]" % (sourcePos.X(), sourcePos.Y(), sourcePos.Z())

Output:

Original position of the sample: [0.0, 0.0, 0.0]
Original position of the source: [0.0, 0.0, -10.0]
New position of the sample: [0.0, 0.0, 0.0]
New position of the source: [0.0, 10.0, -0.0]

Categories: Algorithms | DataHandling\Instrument

Source

C++ source: RotateSource.cpp

C++ header: RotateSource.h