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

ReplicateMD v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

This is an algorithm to create a higher dimensional dataset by replicating along an additional axis

See Also

CreateMDWorkspace, MergeMD

Properties

Name

Direction

Type

Default

Description

ShapeWorkspace

Input

IMDHistoWorkspace

Mandatory

An input workspace defining the shape of the output.

DataWorkspace

Input

IMDHistoWorkspace

Mandatory

An input workspace containing the data to replicate.

OutputWorkspace

Output

IMDHistoWorkspace

Mandatory

An output workspace with replicated data.

Description

This algorithm creates a higher dimensional dataset by replicating along an additional axis. The syntax is similar to that used by Horace.

The ShapeWorkspace input defines the shape of the OutputWorkspace, but not the contents. The DataWorkspace provides the data contents in the lower dimensionality cut, which will be replicated over. This algorithm operates on MDHistoWorkspace inputs and provides a MDHistoWorkspace as an output.

The ShapeWorkspace and DataWorkspace can have any number of extra integrated trailing dimensions. For example the ShapeWorkspace can have shape [10, 5, 1, 1] (where each number in the list is a number of bins in the corresponding dimension) and the DataWorkspace can have either [10, 1, 1, 1] or [1, 5, 1, 1]. But the following arrangement will cause a run-time error: shape [10, 1, 5, 1], data [1, 1, 5, 1]. In such case the dimensions can be re-arranged using TransposeMD v1 algorithm.

Usage

Example - ReplicateMD 1D to 2D

import numpy as np
data = CreateMDHistoWorkspace(2, SignalInput=np.arange(20*30), ErrorInput=np.arange(20*30), NumberOfEvents=np.arange(20*30), Extents=[-10, 10, -1,1], NumberOfBins=[20, 30], Names='E,Qx', Units='MeV,A^-1')
shape = CreateMDHistoWorkspace(3, SignalInput=np.tile([1], 20*30*10), ErrorInput=np.tile([1], 20*30*10), NumberOfEvents=np.tile([1], 20*30*10), Extents=[-1,1, -10, 10, -10,10], NumberOfBins=[30,20,10], Names='Qx,E,Qy', Units='A^-1, MeV, A^-1')

replicated = ReplicateMD(ShapeWorkspace=shape, DataWorkspace=data)

print('Num dims: {}'.format(replicated.getNumDims()))
print('Num points: {}'.format(replicated.getNPoints()))

Output:

Num dims: 3
Num points: 6000

Categories: AlgorithmIndex | MDAlgorithms\Creation

Source

C++ header: ReplicateMD.h

C++ source: ReplicateMD.cpp