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

CalculateDynamicRange v1

Summary

Calculates and sets Qmin and Qmax of a SANS workspace

Properties

Name

Direction

Type

Default

Description

Workspace

InOut

MatrixWorkspace

Mandatory

An input workspace.

ComponentNames

Input

str list

List of component names to calculate the q ranges for.

Description

Calculates the minimum and maximum momentum transfer (Q) for a SANS workspace. The input workspace must have instrument defined and data in units of wavelength [Angstroms], or the wavelength must be present in the sample logs. Elastic scattering is assumed. Masked detectors and monitors do not enter the calculation. The calculated values (in inverse Angstroms) will be set in sample logs as qmin and qmax respectively. Optionally, list of detector components can be given, in which case minimum and maximum momentum transfers will be calculated also for each component. They will be set in sample logs with the same names as the components preceeded by prefixes qmin_ and qmax_ respectively.

Usage

Example - CalculateDynamicRange

ws = CreateSampleWorkspace(XUnit='Wavelength', NumBanks=1, PixelSpacing=0.1, XMin=1, XMax=5, BinWidth=0.4)
MoveInstrumentComponent(Workspace=ws, RelativePosition=True, ComponentName="bank1", Y=-0.5, X=-0.5)
shapeXML = \
"""
<infinite-cylinder id="A" >
<centre x="0" y="0" z="0" />
<axis x="0" y="0" z="1" />
<radius val="0.1" />
</infinite-cylinder>
"""
MaskDetectorsInShape(ws, ShapeXML=shapeXML)
CalculateDynamicRange(Workspace=ws)
print("QMin = %.5f" % ws.getRun().getLogData("qmin").value)
print("QMax = %.5f" % ws.getRun().getLogData("qmax").value)

Output:

QMin = 0.03701
QMax = 0.73500

Categories: AlgorithmIndex | Utility\Workspaces

Source

C++ header: CalculateDynamicRange.h

C++ source: CalculateDynamicRange.cpp