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

DiffractionEventCalibrateDetectors v1

Summary

This algorithm optimizes the position and angles of all of the detector panels. The target instruments for this feature are SNAP and TOPAZ.

See Also

AlignComponents

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

EventWorkspace

Mandatory

The workspace containing the geometry to be calibrated.

Params

Input

string

A comma separated list of first bin boundary, width, last bin boundary. Optionally this can be followed by a comma and more widths and last boundary pairs. Use bin boundaries close to peak you wish to maximize. Negative width values indicate logarithmic binning.

MaxIterations

Input

number

10

Stop after this number of iterations if a good fit is not found

LocationOfPeakToOptimize

Input

number

2.0308

Optimize this location of peak by moving detectors

DetCalFilename

Input

string

Mandatory

The output filename of the ISAW DetCal file. Allowed extensions: [‘.detcal’]

BankName

Input

string

Optional: To only calibrate one bank. Any bank whose name does not match the given string will have no events.

Description

Moves the detectors in an instrument to optimize the maximum intensity of each detector using gsl_multimin_fminimizer_nmsimplex. Only bin data close to peak you wish to maximize.

Usage

Example: move detectors to maximize intensity

import os
ws = CreateSampleWorkspace("Event",NumBanks=1,BankPixelWidth=1)
ws = MoveInstrumentComponent(Workspace='ws', ComponentName='bank1', X=0.5, RelativePosition=False)
wsD = ConvertUnits(InputWorkspace='ws',  Target='dSpacing')
maxD = Max(wsD)
#Peak is at 2.69 in dSpace
DiffractionEventCalibrateDetectors(InputWorkspace='ws', Params = "2.6, 0.001, 2.8",
    LocationOfPeakToOptimize=2.67, BankName="bank1", DetCalFilename="Test.DetCal")
LoadIsawDetCal(InputWorkspace='ws',Filename=os.path.join(config["defaultsave.directory"], 'Test.DetCal'))
ws = ConvertUnits(InputWorkspace='ws',  Target='dSpacing')
maxA = Max(ws)
print("Peak in dSpace {:.11f}".format(0.5*(maxD.readX(0)[0]+maxD.readX(0)[1])))
print("Peak from calibration {:.11f}".format(0.5*(maxA.readX(0)[0]+maxA.readX(0)[1])))

Output:

 Peak in dSpace 2.6...
 Peak from calibration 2.6...

Categories: AlgorithmIndex | Diffraction\Calibration | CorrectionFunctions\InstrumentCorrections

Source

C++ header: DiffractionEventCalibrateDetectors.h

C++ source: DiffractionEventCalibrateDetectors.cpp