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

SetDetScale v1

Summary

Set/change the detScale parameters for a MatrixWorkspace or PeaksWorkspace instrument

Properties

Name

Direction

Type

Default

Description

Workspace

InOut

Workspace

Mandatory

MatrixWorkspace or PeaksWorkspace with instrument.

DetScaleList

Input

str list

Comma separated list detectorNumbers:detScales eg. 13:1.046504,14:1.259293

DetScaleFile

Input

string

Optional text file with detector number and its scale on each line separated by spaces. Allowed values: [‘txt’]

Description

Given a PeaksWorkspace or MatrixWorkspace with an instrument, this algorithm will set or change the detector bank scales that are used in SaveHKL and AnvredCorrection. The input format is the same as used in anvred3.py, so DetScaleList input can be pasted from the definition of detScale there. Alternately, there is an option, DetScaleFile, to read a text file with each line containing the detector number and scale factor for that detector. If scales for a detector are given in both the DetScaleList text string and DetScaleFile, the values from the text string will be used. The default values can be set in the instrument parameter file.

Usage

Example:

w=LoadIsawPeaks("TOPAZ_3007.peaks")

print("Before SetDetScale:")
print('{0:.5f}'.format(w.getInstrument().getNumberParameter("detScale17")[0]))
print('{0:.5f}'.format(w.getInstrument().getNumberParameter("detScale49")[0]))

#This SetDetScale will change the parameters set in parameter file
SetDetScale(Workspace=w, DetScaleList='17:1.0,49:2.0')
print("After SetDetScale:")
print('{0:.5f}'.format(w.getInstrument().getNumberParameter("detScale17")[0]))
print('{0:.5f}'.format(w.getInstrument().getNumberParameter("detScale49")[0]))

Output:

Before SetDetScale:
1.18898
0.79420
After SetDetScale:
1.00000
2.00000

Categories: AlgorithmIndex | DataHandling\Instrument

Source

Python: SetDetScale.py