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

TransformMD v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Scale and/or offset the coordinates of a MDWorkspace

See Also

InvertMDDim

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

IMDWorkspace

Mandatory

Any input MDWorkspace.

Scaling

Input

dbl list

1

Scaling value multiplying each coordinate. Default 1. Either a single value or a list for each dimension.

Offset

Input

dbl list

0

Offset value to add to each coordinate. Default 0. Either a single value or a list for each dimension.

OutputWorkspace

Output

IMDWorkspace

Mandatory

Name of the output MDWorkspace.

Description

This algorithm applies a simple linear transformation to a MDWorkspace or MDHistoWorkspace. This could be used, for example, to scale the Energy dimension to different units.

Each coordinate is transformed so that \(x'_d = (x_d * s_d) + o_d\) where:

  • d : index of the dimension, from 0 to the number of dimensions

  • s : value of the Scaling parameter

  • o : value of the Offset parameter.

You can specify either a single value for Scaling and Offset, in which case the same m_scaling or m_offset are applied to each dimension; or you can specify a list with one entry for each dimension.

Notes

The relationship between the workspace and the original MDWorkspace, for example when the MDHistoWorkspace is the result of BinMD v1, is lost. This means that you cannot re-bin a transformed MDHistoWorkspace.

No units are not modified by this algorithm.

Performance Notes

  • Performing the operation in-place (input=output) is always faster because the first step of the algorithm if NOT in-place is to clone the original workspace.

  • For MDHistoWorkspaces done in-place, TransformMD is very quick (no data is modified, just the coordinates).

  • For MDWorkspaces, every event’s coordinates gets modified, so this may take a while for large workspaces.

  • For file-backed MDWorkspaces, you will find much better performance if you perform the change in-place (input=output), because the data gets written out to disk twice otherwise.

Categories: AlgorithmIndex | MDAlgorithms\Transforms

Source

C++ header: TransformMD.h

C++ source: TransformMD.cpp