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

GroupWorkspaces v1

../_images/GroupWorkspaces-v1_dlg.png

GroupWorkspaces dialog.

Summary

Takes workspaces as input and groups similar workspaces together.

Properties

Name Direction Type Default Description
InputWorkspaces Input str list   Names of the Input Workspaces to Group
GlobExpression Input string   Add all Workspaces that match Glob expression to Group
OutputWorkspace Output WorkspaceGroup Mandatory Name of the workspace to be created as the output of grouping

Description

This algorithm takes two or more workspaces as input and creates an output workspace group. A list of workspaces and a glob pattern may be specified together.

Usage

# Create two workspaces
ws1 = CreateSampleWorkspace()
ws2 = CreateSampleWorkspace()

# Group them
group = GroupWorkspaces( [ws1,ws2] )

# Check the result
from mantid.api import WorkspaceGroup
print("Workspace's type is WorkspaceGroup: {}".format(isinstance(group, WorkspaceGroup)))
print('It has {} entries'.format(group.getNumberOfEntries()))
print('Its first  item is {}'.format(group.getItem(0)))
print('Its second item is {}'.format(group.getItem(1)))

wrkspc1 = CreateSampleWorkspace()
wrkspc2 = CreateSampleWorkspace()
anotherGroup = GroupWorkspaces(GlobExpression='wrkspc?')

# Check the result
print('It has {} entries'.format(anotherGroup.getNumberOfEntries()))
print('Its first  item is {}'.format(anotherGroup.getItem(0)))
print('Its second item is {}'.format(anotherGroup.getItem(1)))

Output

Workspace's type is WorkspaceGroup: True
It has 2 entries
Its first  item is ws1
Its second item is ws2
It has 2 entries
Its first  item is wrkspc1
Its second item is wrkspc2

Categories: AlgorithmIndex | Transforms\Grouping | Utility\Workspaces

Source

C++ header: GroupWorkspaces.h (last modified: 2021-03-31)

C++ source: GroupWorkspaces.cpp (last modified: 2021-03-31)