ConvertToMatrixWorkspace v1

../_images/ConvertToMatrixWorkspace-v1_dlg.png

ConvertToMatrixWorkspace dialog.

Summary

Converts an EventWorkspace into a Workspace2D, using the input workspace’s current X bin values.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory An input EventWorkspace.
OutputWorkspace Output MatrixWorkspace 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 MantidPlot 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 1
51200 1

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++ source: ConvertToMatrixWorkspace.cpp (last modified: 2019-06-05)

C++ header: ConvertToMatrixWorkspace.h (last modified: 2018-10-05)