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

AlignAndFocusPowderSlim v1

Warning

This algorithm is currently for the VULCAN instrument testing purposes

Summary

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

See Also

AlignAndFocusPowderFromFiles

Properties

Name

Direction

Type

Default

Description

Filename

Input

string

Mandatory

The name of the Event NeXus file to read, including its full or relative path. The file name is typically of the form INST_####_event.nxs. Allowed extensions: [‘.nxs.h5’, ‘.nxs’, ‘_event.nxs’]

FilterByTimeStart

Input

number

Optional

To only include events after the provided start time, in seconds (relative to the start of the run).

FilterByTimeStop

Input

number

Optional

To only include events before the provided stop time, in seconds (relative to the start of the run).

SplitterWorkspace

Input

Workspace

Input workspace specifying “splitters”, i.e. time intervals and targets for event filtering. Currently only a single output workspace is supported.

RelativeTime

Input

boolean

False

Flag indicating whether in SplitterWorkspace the times are absolute or relative. If true, they are relative to the run start time.

ProcessBankSplitTask

Input

boolean

False

For development testing. Changes how the splitters are processed. If true then use ProcessBankSplitTask otherwise loop over ProcessBankTask.

FilterBadPulses

Input

boolean

False

Filter bad pulses in the same way that FilterBadPulses v1 does.

BadPulsesLowerCutoff

Input

number

95

The percentage of the average to use as the lower bound when filtering bad pulses.

CalFileName

Input

string

The .cal file containing the position correction factors. Either this or OffsetsWorkspace needs to be specified. Allowed extensions: [‘.h5’, ‘.hd5’, ‘.hdf’, ‘.cal’]

XMin

Input

dbl list

0.1

Minimum x-value for the output binning

XDelta

Input

dbl list

0.0016

Bin size for output data

XMax

Input

dbl list

2

Minimum x-value for the output binning

BinningUnits

Input

string

dSpacing

The units of the input X min, max and delta values. Output will always be TOF. Allowed values: [‘dSpacing’, ‘TOF’, ‘MomentumTransfer’]

BinningMode

Input

string

Logarithmic

Specify binning behavior (‘Logarithmic’). Allowed values: [‘Logarithmic’, ‘Linear’]

LogAllowList

Input

str list

If specified, only these logs will be loaded from the file

LogBlockList

Input

str list

If specified, these logs will not be loaded from the file

OutputWorkspace

Output

Workspace

Mandatory

An output workspace.

ReadSizeFromDisk

Input

number

100000000

Number of elements of time-of-flight or detector-id to read at a time. This is a maximum

EventsPerThread

Input

number

1000000

Number of events to read in a single thread. Higher means less threads are created.

OutputSpectrumNumber

Input

number

Optional

The bank for which to read data; if specified, others will be blank

Description

This is a simplified version of AlignAndFocusPowderFromFiles v1 which uses very few child algorithms. The main feature is that this reads the events, filters and adjusts their time-of-flight, then increments the correct bin in the output workspace. As a result, there is a significantly smaller memory usage and the processing is significantly faster.

Current limitations compared to AlignAndFocusPowderFromFiles

  • only supports the VULCAN instrument

  • hard coded for 6 particular groups

  • does not support copping data

  • does not support removing prompt pulse

Child algorithms used are

Usage

Example - event filtering

This algorithm accepts the same SplitterWorkspace inputs as FilterEvents and more information can be found on the Event Filtering page.

# create splitter table using relative time
splitter = CreateEmptyTableWorkspace()
splitter.addColumn('float', 'start')
splitter.addColumn('float', 'stop')
splitter.addColumn('str', 'target')

splitter.addRow((10,20, '0'))
splitter.addRow((200,210, '0'))
splitter.addRow((400,410, '0'))

# pass the splitter table to AlignAndFocusPowderSlim
ws = AlignAndFocusPowderSlim("VULCAN_218062.nxs.h5",
                             SplitterWorkspace=splitter, RelativeTime=True,
                             XMin=0, XMax=50000, XDelta=50000,
                             BinningMode="Linear",
                             BinningUnits="TOF")

# This is equivalent to using FilterEvents with the same splitter table.
# But note that this example doesn't align the data so put everything in 1 big bin to compare.
ws2 = LoadEventNexus("VULCAN_218062.nxs.h5", NumberOfBins=1)
grp = CreateGroupingWorkspace(ws2, GroupDetectorsBy='bank')
ws2 = GroupDetectors(ws2, CopyGroupingFromWorkspace="grp")

FilterEvents(ws2,
             SplitterWorkspace=splitter, RelativeTime=True,
             FilterByPulseTime=True,
             OutputWorkspaceBaseName="filtered",
             GroupWorkspaces=True)
out = Rebin("filtered_0", "0,50000,50000", PreserveEvents=False)

CompareWorkspaces(ws, out, CheckUncertainty=False, CheckSpectraMap=False, CheckInstrument=False)

Example - filter events based on log values

# Load only the log we need
cave_temperature = LoadEventNexus("VULCAN_218062.nxs.h5",
                                  MetaDataOnly=True,
                                  AllowList="CaveTemperature")

# Use GenerateEventsFilter to create a splitter table based on the log values
GenerateEventsFilter(cave_temperature,
                     OutputWorkspace='splitter',
                     InformationWorkspace='info',
                     LogName='CaveTemperature',
                     MinimumLogValue=70.10,
                     MaximumLogValue=70.15,
                     LogValueInterval=0.01)

# Use the splitter table to filter the events during loading and output to workspace group
ws = AlignAndFocusPowderSlim("VULCAN_218062.nxs.h5", SplitterWorkspace='splitter')
print(ws.getNumberOfEntries())  # should be 6 workspaces in the group

Example - filter bad pulses

ws = AlignAndFocusPowderSlim("VULCAN_218062.nxs.h5",
                             XMin=0, XMax=50000, XDelta=50000,
                             BinningMode="Linear",
                             BinningUnits="TOF",
                             FilterBadPulses=True)

# This is equivalent to using FilterBadPulses.
# But note that this example doesn't align the data so put everything in 1 big bin to compare.
ws2 = LoadEventNexus("VULCAN_218062.nxs.h5")
grp = CreateGroupingWorkspace(ws2, GroupDetectorsBy='bank')
ws2 = GroupDetectors(ws2, CopyGroupingFromWorkspace="grp")
ws2 = FilterBadPulses(ws2)
ws2 = Rebin(ws2, "0,50000,50000", PreserveEvents=False)

CompareWorkspaces(ws, ws2, CheckUncertainty=False, CheckSpectraMap=False, CheckInstrument=False)

Note

We also can currently only filter based on the pulse time, not the event time-of-flight.

Categories: AlgorithmIndex | Workflow\Diffraction

Source

C++ header: AlignAndFocusPowderSlim.h

C++ source: AlignAndFocusPowderSlim.cpp