Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | An input workspace. |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | An output workspace. |
ComponentNames | Input | str list | List of component names which are used to crop the workspace.to. |
This algorithm takes a list of component names and an input workspaces and produces an output workspace which only contains the detectors which are part of the specified components. If no components are specified then the full workspace is returned.
The workspace allows users to select a specific bank for exclusive investigation in subsequent operations.
Example - CropToComponent
# Create sample workspace with four banks where each bank has 3x3 detectors
sample_workspace = CreateSampleWorkspace(NumBanks=4, BankPixelWidth=3)
# Crop to a component, we select bank2 here
cropped_workspace = CropToComponent(InputWorkspace=sample_workspace, ComponentNames="bank2")
# Check the number of histograms
sample_number_of_histograms = sample_workspace.getNumberHistograms()
cropped_number_of_histograms = cropped_workspace.getNumberHistograms()
print("The original workspace has {0} histograms and the cropped workspace has {1} histograms.".format(sample_number_of_histograms, cropped_number_of_histograms))
Output:
The original workspace has 36 histograms and the cropped workspace has 9 histograms.
Categories: AlgorithmIndex | Transforms\Splitting
C++ source: CropToComponent.cpp (last modified: 2019-06-04)
C++ header: CropToComponent.h (last modified: 2018-10-05)