ResizeRectangularDetector v1

../_images/ResizeRectangularDetector-v1_dlg.png

ResizeRectangularDetector dialog.

Summary

Resize a RectangularDetector in X and/or Y.

Properties

Name Direction Type Default Description
Workspace InOut Workspace Mandatory  
ComponentName Input string   The name of the RectangularDetector to resize.
ScaleX Input number 1 The scaling factor in the X direction. Default 1.0
ScaleY Input number 1 The scaling factor in the Y direction. Default 1.0

Description

This algorithm will resize a RectangularDetector by applying X and Y scaling factors. Each pixel’s position will be modifed relative to the 0,0 point of the detector by these factors. Typically, a RectangularDetector is constructed around its center, so this would scale the detector around its center.

This only works on RectangularDetectors. Banks formed by e.g. tubes cannot be scaled in this way.

Internally, this sets the “scalex” and “scaley” parameters on the RectangularDetector. Note that the scaling is relative to the original size, and is not cumulative: that is, if you Resize * 2 and again * 3, your final detector is 3 times larger than the original, not 6 times.

Note: As of this writing, the algorithm does NOT modify the shape of individual pixels. This means that algorithms based on solid angle calculations might be off. Ray-tracing (e.g. peak finding) are unaffected.

See also MoveInstrumentComponent v1 and RotateInstrumentComponent v1 for other ways to move components.

Usage

Example - Resize bank 1:

# a sample workspace with rectangular detectors
ws = CreateSampleWorkspace()

ResizeRectangularDetector(ws,"bank1",2.0,0.5)

i=ws.getInstrument()
bank1=i.getComponentByName('bank1')
bank2=i.getComponentByName('bank2')

print ("bank 1 was scaled and is now %.2f by %.2f" % (bank1.xsize(), bank1.ysize()))
print ("bank 2 was not scaled and remains %.2f by %.2f" % (bank2.xsize(), bank2.ysize()))

Output:

bank 1 was scaled and is now 0.16 by 0.04
bank 2 was not scaled and remains 0.08 by 0.08

Categories: Algorithms | DataHandling\Instrument