\(\renewcommand\AA{\unicode{x212B}}\)
CreateMDWorkspace v1¶
Summary¶
Creates an empty MDEventWorkspace with a given number of dimensions.
See Also¶
ConvertToMD, CreateMDHistoWorkspace, FakeMDEventData, CreateMD
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
Dimensions |
Input |
number |
1 |
Number of dimensions that the workspace will have. |
EventType |
Input |
string |
MDLeanEvent |
Which underlying data type will event take. Allowed values: [‘MDEvent’, ‘MDLeanEvent’] |
Extents |
Input |
dbl list |
A comma separated list of min, max for each dimension, specifying the extents of each dimension. |
|
Names |
Input |
str list |
A comma separated list of the name of each dimension. |
|
Units |
Input |
str list |
A comma separated list of the units of each dimension. |
|
Frames |
Input |
str list |
A comma separated list of the frames of each dimension. The frames can be General Frame: Any frame which is not a Q-based frame. QLab: Wave-vector converted into the lab frame. QSample: Wave-vector converted into the frame of the sample. HKL: Wave-vector converted into the crystal’s HKL indices. Note if nothing is specified then the General Frame is being selected. Also note that if you select a frame then this might override your unit selection if it is not compatible with the frame. |
|
SplitInto |
Input |
int list |
5 |
A comma separated list of into how many sub-grid elements each dimension should split; or just one to split into the same number for all dimensions. Default 5. |
SplitThreshold |
Input |
number |
1000 |
How many events in a box before it should be split. Default 1000. |
MaxRecursionDepth |
Input |
number |
5 |
How many levels of box splitting recursion are allowed. The smallest box will have each side length \(l = (extents) / (SplitInto^{MaxRecursionDepth}).\) Default 5. |
MinRecursionDepth |
Input |
number |
0 |
Optional. If specified, then all the boxes will be split to this minimum recursion depth. 0 = no splitting, 1 = one level of splitting, etc. Be careful using this since it can quickly create a huge number of boxes = (SplitInto ^ (MinRercursionDepth * NumDimensions)). |
OutputWorkspace |
Output |
Mandatory |
Name of the output MDEventWorkspace. |
|
Filename |
Input |
string |
Optional: to use a file as the back end, give the path to the file to save. Allowed extensions: [‘.nxs’] |
|
Memory |
Input |
number |
-1 |
If Filename is specified to use a file back end: The amount of memory (in MB) to allocate to the in-memory cache. If not specified, a default of 40% of free physical memory is used. |
Description¶
This algorithm creates an empty MDEventWorkspace from scratch. The workspace can have any number of dimensions (up to ~20). Each dimension must have its name, units, extents specified as comma-spearated string.
The SplitInto parameter determines how splitting of dense boxes will be performed. For example, if SplitInto=5 and the number of dimensions is 3, then each box will get split into 5x5x5 sub-boxes.
The SplitThreshold parameter determines how many events to keep in a box before splitting it into sub-boxes. This value can significantly affect performance/memory use! Too many events per box will mean unnecessary iteration and a slowdown in general. Too few events per box will waste memory with the overhead of boxes.
You can create a file-backed MDEventWorkspace by specifying the Filename and Memory parameters.
Usage¶
Example
mdws = CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10', Names='A,B,C', Units='U,U,U')
print("mdws is a " + mdws.id())
print("with {0} dimensions:".format(mdws.getNumDims()))
for i in range (mdws.getNumDims()):
print(mdws.getDimension(i).name)
Output:
mdws is a MDEventWorkspace<MDLeanEvent,3>
with 3 dimensions:
A
B
C
Categories: AlgorithmIndex | MDAlgorithms\Creation
Source¶
C++ header: CreateMDWorkspace.h
C++ source: CreateMDWorkspace.cpp