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

QueryMDWorkspace v1

Summary

Query the IMDWorkspace in order to extract summary information.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

IMDWorkspace

Mandatory

An input MDWorkspace.

OutputWorkspace

Output

TableWorkspace

Mandatory

The output Tableworkspace with columns containing key summary information about the MDWorkspace.

LimitRows

Input

boolean

True

Limit the report output to a maximum number of rows

MaximumRows

Input

number

100000

The number of neighbours to utilise. Defaults to 100000.

Normalisation

Input

string

none

What normalisation do you wish to apply none: No normalisation. volume: Normalise by the volume. number of events: Normalise by the number of events. Allowed values: [‘none’, ‘volume’, ‘number of events’]

TransformCoordsToOriginal

Input

boolean

True

Output box coordinates in terms of original workspace coordinates

BoxDataTable

Output

TableWorkspace

Optional output data table with MDEventWorkspace-specific box data.

Description

This algorithm outputs a table workspace containing summary data about each box within an IMDWorkspace. The table workspace can be used as a basis for plotting.

Format

  • Column 1: Signal (double)

  • Column 2: Error (double)

  • Column 3: Number of Events (integer)

  • Column 4: Coords of box center (string)

Usage

Example - query MD workspace and look at the result:

# create sample inelastic workspace for MARI instrument containing 1 at all spectra
ws1 = CreateSimulationWorkspace(Instrument='MAR', BinParams='-10,1,10', UnitX='DeltaE')
AddSampleLog(ws1, 'Ei', '12.', 'Number')
ws2 = ws1 * 2;
# Convert to MD
mdWs1 = ConvertToMD(InputWorkspace=ws1, QDimensions='|Q|', QConversionScales='Q in A^-1', SplitInto='10,10', MaxRecursionDepth='1')

# get the query
table = QueryMDWorkspace(InputWorkspace=mdWs1)

# look at the output:
col_names = table.keys();
name0 = col_names[0];
nRows = len(table.column(name0));
print("Table contains {0} rows".format(nRows))
print("first 11 of them are:")
print("--------------------------------------------------------------------------------------------------------------")
print(' '.join('| {0:19}'.format(name) for name in col_names) + ' |')

print("--------------------------------------------------------------------------------------------------------------")
for i in range(0,11):
   print(' '.join('| {0:>19.4f}'.format(table.column(name)[i]) for name in col_names) + ' |')

Output:

Table contains 100 rows
first 11 of them are:
--------------------------------------------------------------------------------------------------------------
| Signal/none         | Error/none          | Number of Events    | |Q|/MomentumTransfer | DeltaE/DeltaE       |
--------------------------------------------------------------------------------------------------------------
|              0.0000 |              0.0000 |              0.0000 |              0.3982 |             -9.0000 |
|            338.0000 |              0.0000 |            338.0000 |              0.9065 |             -9.0000 |
|            164.0000 |              0.0000 |            164.0000 |              1.4149 |             -9.0000 |
|            164.0000 |              0.0000 |            164.0000 |              1.9233 |             -9.0000 |
|            153.0000 |              0.0000 |            153.0000 |              2.4317 |             -9.0000 |
|            162.0000 |              0.0000 |            162.0000 |              2.9401 |             -9.0000 |
|            171.0000 |              0.0000 |            171.0000 |              3.4485 |             -9.0000 |
|            195.0000 |              0.0000 |            195.0000 |              3.9568 |             -9.0000 |
|            231.0000 |              0.0000 |            231.0000 |              4.4652 |             -9.0000 |
|            258.0000 |              0.0000 |            258.0000 |              4.9736 |             -9.0000 |
|             28.0000 |              0.0000 |             28.0000 |              0.3982 |             -7.0000 |

Categories: AlgorithmIndex | MDAlgorithms\Utility\Workspace

Source

C++ header: QueryMDWorkspace.h

C++ source: QueryMDWorkspace.cpp