-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add python algorithm to create table workspace re #5414
- Loading branch information
1 parent
ce80a42
commit 89481f8
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
Code/Mantid/Framework/PythonAPI/PythonAlgorithms/CreateEmptyTableWorkspace.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from mantid.api import PythonAlgorithm, registerAlgorithm, ITableWorkspaceProperty, WorkspaceFactory | ||
from mantid.kernel import Direction | ||
|
||
# Create an empty table workspace to be populated by a python script. | ||
class CreateEmptyTableWorkspace(PythonAlgorithm): | ||
|
||
def PyInit(self): | ||
# Declare properties | ||
self.declareProperty(ITableWorkspaceProperty("OutputWorkspace", "", Direction.Output), "Name of Calibration Table Workspace") | ||
|
||
def PyExec(self): | ||
tableWS = WorkspaceFactory.createTable() | ||
tableWS.addColumn(type="int",name="Detector ID") | ||
tableWS.addColumn(type="V3D",name="Detector Position") | ||
|
||
self.setProperty("OutputWorkspace", tableWS) | ||
|
||
# Register algorithm with Mantid | ||
registerAlgorithm(CreateEmptyTableWorkspace) | ||
|