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

CropWorkspaceForMDNorm v1

Summary

Crops an event workspace and store the information about trajectories limits in the run object.

See Also

RecalculateTrajectoriesExtents

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

IEventWorkspace

Mandatory

Input workspace. It has to be an event workspace with units of energy transfer or momentum

XMin

Input

number

Mandatory

Minimum energy transfer or momentum

XMax

Input

number

Mandatory

Maximum energy transfer or momentum

OutputWorkspace

Output

Workspace

Mandatory

Output workspace

Description

This algorithm is part of the new workflow for normalizing multi-dimensional event workspaces. It is intended to crop the input event workspace, and store the end of detector trajectories in either momentum (diffraction) or energy transfer (inelastic) units.

Example - CropWorkspaceForMDNorm

ws_in = CreateSampleWorkspace(WorkspaceType='Event',
                              Function='Flat background',
                              XUnit='Momentum',
                              XMax=10,
                              BinWidth=0.1)
ws_out = CropWorkspaceForMDNorm(InputWorkspace=ws_in,
                                XMin=1,
                                XMax=6)
print(f"Number of events in the original workspace {ws_in.getNumberEvents()}")
print(f"Number of events in the cropped workspace {ws_out.getNumberEvents()}")
print(f"Largest momentum in the output workspace {ws_out.getSpectrum(1).getTofs().max():.1f}")
Number of events in the original workspace 200000
Number of events in the cropped workspace 100000
Largest momentum in the output workspace 6.0

Categories: AlgorithmIndex | Utility\Workspaces | MDAlgorithms\Normalisation

Source

Python: CropWorkspaceForMDNorm.py