AlignComponents v1

../_images/AlignComponents-v1_dlg.png

AlignComponents dialog.

Summary

Align a component by minimising difference to an offset workspace

Properties

Name Direction Type Default Description
CalibrationTable Input TableWorkspace Mandatory Calibration table, currently only uses difc
MaskWorkspace Input MatrixWorkspace   Mask workspace
InstrumentFilename Input string   Instrument filename. Allowed extensions: [‘.xml’]
Workspace Input Workspace   Workspace containing the instrument to be calibrated.
FitSourcePosition Input boolean False Fit the source position, changes L1 (source to sample) distance.Uses entire instrument. Occurs before Components are Aligned.
FitSamplePosition Input boolean False Fit the sample position, changes L1 (source to sample) and L2 (sample to detector) distance.Uses entire instrument. Occurs before Components are Aligned.
ComponentList Input str list   Comma separated list on instrument components to refine.
Xposition Input boolean False Refine Xposition
MinXposition Input number -0.1 Minimum relative X bound (m)
MaxXposition Input number 0.1 Maximum relative X bound (m)
Yposition Input boolean False Refine Yposition
MinYposition Input number -0.1 Minimum relative Y bound (m)
MaxYposition Input number 0.1 Maximum relative Y bound (m)
Zposition Input boolean False Refine Zposition
MinZposition Input number -0.1 Minimum relative Z bound (m)
MaxZposition Input number 0.1 Maximum relative Z bound (m)
EulerConvention Input string YZX Euler angles convention used when calculating and displaying angles,eg XYZ corresponding to alpha beta gamma. Allowed values: [‘ZXZ’, ‘XYX’, ‘YZY’, ‘ZYZ’, ‘XZX’, ‘YXY’, ‘XYZ’, ‘YZX’, ‘ZXY’, ‘XZY’, ‘ZYX’, ‘YXZ’]
AlphaRotation Input boolean False Refine rotation around first axis, alpha
MinAlphaRotation Input number -10 Minimum relative alpha rotation (deg)
MaxAlphaRotation Input number 10 Maximum relative alpha rotation (deg)
BetaRotation Input boolean False Refine rotation around seconds axis, beta
MinBetaRotation Input number -10 Minimum relative beta rotation (deg)
MaxBetaRotation Input number 10 Maximum relative beta rotation (deg)
GammaRotation Input boolean False Refine rotation around third axis, gamma
MinGammaRotation Input number -10 Minimum relative gamma rotation (deg)
MaxGammaRotation Input number 10 Maximum relative gamma rotation (deg)

Description

This algorithm will take a calibration in the form of a diffractioncalibration workspace from the output of for example GetDetOffsetsMultiPeaks v1 or CalibrateRectangularDetectors v1 and minimize the difference between the DIFC of the instrument and calibration workspace by moving and rotating instrument components.

The resulting calibrated geometry can be exported by ExportGeometry v1.

ComponentList

The ComponentList can include any instrument component that can be moved and rotated by MoveInstrumentComponent v1 and RotateInstrumentComponent v1. For example in POWGEN you can list bank46 or Column4 (which includes banks 42-46) or Group3 (which all the banks in Column 3 and 4). In the case of a component group it is treated as one object and not individual banks. In some instruments you can also specify individual tubes or pixel, e.g. bank20/tube3 and bank20/tube3/pixel7, although that is not the intention of the algorithm. You can list multiple components which will be refined in turn (e.g. in the Align the Y rotation of bank26 and bank46 in POWGEN usage example below).

Masking

The only masking that is on taken into account when minimising the difference in DIFC is the masking in the workspace of the MaskWorkspace property of AlignComponents.

Fitting Sample/Source

When fitting the sample or source position it uses the entire instrument and moves in the directions that you select. All rotation options are ignored. You can use a masking workspace to mask part of the instrument you don’t want to use to align the sample/source position (e.g. in the Align sample position in POWGEN usage example below).

The source and sample positions (in that order) are aligned before an components are aligned.

Usage

Example - Align the X and Z position of bank26 in POWGEN:

LoadCalFile(InstrumentName="PG3",
      CalFilename="PG3_golden.cal",
      MakeGroupingWorkspace=False,
      MakeOffsetsWorkspace=True,
      MakeMaskWorkspace=True,
      WorkspaceName="PG3")
ws = LoadEmptyInstrument(Filename="POWGEN_Definition_2015-08-01.xml")
component="bank26"
print "Start position is",ws.getInstrument().getComponentByName(component).getPos()
AlignComponents(CalibrationTable="PG3_cal",
        Workspace=ws,
        MaskWorkspace="PG3_mask",
        Xposition=True, ZPosition=True,
        ComponentList=component)
ws=mtd['ws']
print "Final position is",ws.getInstrument().getComponentByName(component).getPos()

Output:

Start position is [1.54436,0.863271,-1.9297]
Final position is [1.50591,0.863271,-1.92734]

Example - Align the Y rotation of bank26 and bank46 in POWGEN:

LoadCalFile(InstrumentName="PG3",
      CalFilename="PG3_golden.cal",
      MakeGroupingWorkspace=False,
      MakeOffsetsWorkspace=True,
      MakeMaskWorkspace=True,
      WorkspaceName="PG3")
ws = LoadEmptyInstrument(Filename="POWGEN_Definition_2015-08-01.xml")
components="bank26,bank46"
bank26Rot = ws.getInstrument().getComponentByName("bank26").getRotation().getEulerAngles()
bank46Rot = ws.getInstrument().getComponentByName("bank46").getRotation().getEulerAngles()
print "Start bank26 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank26Rot[0], bank26Rot[1], bank26Rot[2])
print "Start bank46 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank46Rot[0], bank46Rot[1], bank46Rot[2])
AlignComponents(CalibrationTable="PG3_cal",
        Workspace=ws,
        MaskWorkspace="PG3_mask",
        EulerConvention="YZX",
        AlphaRotation=True,
        ComponentList=components)
ws=mtd['ws']
bank26Rot = ws.getInstrument().getComponentByName("bank26").getRotation().getEulerAngles()
bank46Rot = ws.getInstrument().getComponentByName("bank46").getRotation().getEulerAngles()
print "Final bank26 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank26Rot[0], bank26Rot[1], bank26Rot[2])
print "Final bank46 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank46Rot[0], bank46Rot[1], bank46Rot[2])

Output:

Start bank26 rotation is [-24.061.0.120,18.016]
Start bank46 rotation is [-41.092.0.061,17.795]
Final bank26 rotation is [-25.226.0.120,18.016]
Final bank46 rotation is [-37.397.0.061,17.795]

Example - Align sample position in POWGEN:

LoadCalFile(InstrumentName="PG3",
      CalFilename="PG3_golden.cal",
      MakeGroupingWorkspace=False,
      MakeOffsetsWorkspace=True,
      MakeMaskWorkspace=True,
      WorkspaceName="PG3")
# Mask banks that don't have calibration data
MaskBTP(Workspace='PG3_mask', Instrument='POWGEN',
        Bank='22-25,42-45,62-66,82-86,102-105,123,124,143,144,164,184,204')
ws = LoadEmptyInstrument(Filename="POWGEN_Definition_2015-08-01.xml")
print "Start sample position is",ws.getInstrument().getSample().getPos().getZ()
AlignComponents(CalibrationTable="PG3_cal",
      Workspace=ws,
      MaskWorkspace="PG3_mask",
      FitSamplePosition=True,
      Zposition=True)
print "Final sample position is {:.5f}".format(mtd['ws'].getInstrument().getSample().getPos().getZ())

Output:

Start sample position is 0.0
Final sample position is 0.02826

Categories: Algorithms | Diffraction