ConvertToMatrixWorkspace v1#
Summary#
Converts an EventWorkspace into a Workspace2D, using the input workspace’s current X bin values.
See Also#
Properties#
Name |
Direction |
Type |
Default |
Description |
|---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
An input EventWorkspace. |
|
OutputWorkspace |
Output |
Mandatory |
An output Workspace2D. |
Description#
This can also be performed using the Rebin v1 algorithm and having the “PreserveEvents” parameter set to false.
Usage#
Note
To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.
Example - Simple conversion of an EventWorkspace
event_ws = Load('CNCS_7860_event.nxs')
# Run the conversion algorithm
histo_ws = ConvertToMatrixWorkspace(event_ws)
# Check that the original workspace and the converted workspace have the same shape
print("{} {}".format(event_ws.getNumberHistograms(), event_ws.blocksize()))
print("{} {}".format(histo_ws.getNumberHistograms(), histo_ws.blocksize()))
51200 500
51200 500
Example - Conversion when blocksize > 1
event_ws = Load('CNCS_7860_event.nxs')
# Rebin the loaded EventWorkspace to a new EventWorkspace that has > 1 bins
event_ws_rebinned = Rebin(InputWorkspace=event_ws, Params=1e3, PreserveEvents=True)
# Run the conversion algorithm
histo_ws_rebinned = ConvertToMatrixWorkspace(event_ws_rebinned)
# Check that the original workspace and the converted workspace have the same shape
print("{} {}".format(event_ws_rebinned.getNumberHistograms(), event_ws_rebinned.blocksize()))
print("{} {}".format(histo_ws_rebinned.getNumberHistograms(), histo_ws_rebinned.blocksize()))
Output:
51200 17
51200 17
Categories: AlgorithmIndex | Events
Source#
C++ header: ConvertToMatrixWorkspace.h
C++ source: ConvertToMatrixWorkspace.cpp