$$\renewcommand\AA{\unicode{x212B}}$$

# AlignAndFocusPowder v1¶

## Summary¶

Algorithm to focus powder diffraction data into a number of histograms according to a grouping scheme defined in a CalFile.

AlignAndFocusPowderFromFiles

## Properties¶

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

The input workspace

OutputWorkspace

Output

MatrixWorkspace

Mandatory

The result of diffraction focussing of InputWorkspace

UnfocussedWorkspace

Output

MatrixWorkspace

Treated data in d-spacing before focussing (optional). This will likely need rebinning.

CalFileName

Input

string

The name of the calibration file with offset, masking, and grouping data. Allowed extensions: [‘.h5’, ‘.hd5’, ‘.hdf’, ‘.cal’]

GroupFilename

Input

string

Overrides grouping from CalFileName. Allowed extensions: [‘.xml’, ‘.cal’]

GroupingWorkspace

InOut

GroupingWorkspace

Optional: A GroupingWorkspace giving the grouping info.

CalibrationWorkspace

InOut

TableWorkspace

Optional: A Workspace containing the calibration information. Either this or CalibrationFile needs to be specified.

OffsetsWorkspace

Input

OffsetsWorkspace

Optional: An OffsetsWorkspace giving the detector calibration values.

InOut

Optional: A workspace giving which detectors are masked.

Input

TableWorkspace

Optional: A workspace giving pixels and bins to mask.

Params

Input

dbl list

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. Negative width values indicate logarithmic binning.

ResampleX

Input

number

0

Number of bins in x-axis. Non-zero value overrides “Params” property. Negative value means logarithmic binning.

Dspacing

Input

boolean

True

Bin in Dspace. (True is Dspace; False is TOF)

DMin

Input

dbl list

Minimum for Dspace axis. (Default 0.)

DMax

Input

dbl list

Maximum for Dspace axis. (Default 0.)

DeltaRagged

Input

dbl list

Step parameter for rebin

TMin

Input

number

Optional

Minimum for TOF axis. Defaults to 0.

TMax

Input

number

Optional

Maximum for TOF or dspace axis. Defaults to 0.

PreserveEvents

Input

boolean

True

If the InputWorkspace is an EventWorkspace, this will preserve the full event list (warning: this will use much more memory!).

RemovePromptPulseWidth

Input

number

0

Width of events (in microseconds) near the prompt pulse to remove. 0 disables

ResonanceFilterUnits

Input

string

Wavelength

Units for resonances to be filtered in. The data will be converted to these units temporarily to filter. Allowed values: [‘Energy’, ‘Wavelength’]

ResonanceFilterLowerLimits

Input

dbl list

Minimum values to filter absorption resonance. This must have same number of values as ResonanceFilterUpperLimits. Default behavior is to not filter.

ResonanceFilterUpperLimits

Input

dbl list

Maximum values to filter absorption resonance. This must have same number of values as ResonanceFilterLowerLimits. Default behavior is to not filter.

CompressTolerance

Input

number

1e-05

Compress events (in microseconds) within this tolerance. (Default 1e-5)

CompressWallClockTolerance

Input

number

Optional

The tolerance (in seconds) on the wall-clock time for comparison. Unset means compressing all wall-clock times together disabling pulsetime resolution.

CompressStartTime

Input

string

An ISO formatted date/time string specifying the timestamp for starting filtering. Ignored if WallClockTolerance is not specified. Default is start of run

LorentzCorrection

Input

boolean

False

Multiply each spectrum by sin(theta) where theta is half of the Bragg angle

UnwrapRef

Input

number

0

Reference total flight path for frame unwrapping. Zero skips the correction

LowResRef

Input

number

0

Reference DIFC for resolution removal. Zero skips the correction

CropWavelengthMin

Input

number

0

Crop the data at this minimum wavelength. Overrides LowResRef.

CropWavelengthMax

Input

number

Optional

Crop the data at this maximum wavelength. Forces use of CropWavelengthMin.

PrimaryFlightPath

Input

number

-1

If positive, focus positions are changed. (Default -1)

SpectrumIDs

Input

int list

Optional: Spectrum Nos (note that it is not detector ID or workspace indices).

L2

Input

dbl list

Optional: Secondary flight (L2) paths for each detector

Polar

Input

dbl list

Optional: Polar angles (two thetas) for detectors

Azimuthal

Input

dbl list

Azimuthal angles (out-of-plain) for detectors

LowResSpectrumOffset

Input

number

-1

Offset on spectrum No of low resolution spectra from high resolution one. If negative, then all the low resolution TOF will not be processed. Otherwise, low resolution TOF will be stored in an additional set of spectra. If offset is equal to 0, then the low resolution will have same spectrum Nos as the normal ones. Otherwise, the low resolution spectra will have spectrum IDs offset from normal ones.

ReductionProperties

Input

string

__powdereduction

## Description¶

This is a workflow algorithm that does the bulk of the work for time focusing diffraction data. This is done by executing several sub-algorithms as listed below. The way that algorithms are connected together is better described in the workflow diagram

### Workflow¶

The main workflow of the algorithm can be described in following diagram. In this diagram, the CalibrationWorkspace, MaskWorkspace, and GroupingWorkspace are abstractions of the many ways that this information can be provided (see below).

### Calibration¶

The way that calibration is supplied can be confusing. This section will attempt to clarify it.

Workspaces provided: If the GroupingWorkspace, CalibrationWorkspace, or MaskWorkspace are supplied as parameters they are used. If the OffsetsWorkspace is supplied it is converted to a CalibrationWorkspace using ConvertDiffCal v1. The values of CalFileName and GroupFilename will be ignored

Filenames provided, Workspaces not: Assuming the instrument short-name is <INSTR> (replace with the actual instrument short-name), the algorithm will look for the workspaces <INSTR>_group, <INSTR>_cal (falling back to <INSTR>_offsets), and <INSTR>_mask and use them without consulting the files. This behavior is to reduce the amount of overhead in processing a collection of input data. When loading information from a file, all 3 workspaces can be read from either type of calibration file (.h5 or .cal) and will get the default names. If the GroupFilename is provided, that will override the grouping information in the CalFilename.

Note

If the user wishes to force reading the supplied calibration file(s), they must delete the workspaces <INSTR>_group, <INSTR>_cal, <INSTR>_offsets, and <INSTR>_mask.

## Usage¶

Example: A simple Powgen example

The files needed for this example are not present in our standard usage data download due to their size. They can however be downloaded using these links: PG3_9830_event.nxs and pg3_mantid_det.cal.

You will have to rename pg3_mantid_det.cal manually, as its name in the link above is a list of random characters.

PG3_9830_event = Load('PG3_9830_event.nxs')
PG3_9830_event = AlignAndFocusPowder(PG3_9830_event,
CalFileName='pg3_mantid_det.cal', Params='100')


Categories: AlgorithmIndex | Workflow\Diffraction