Skip to content

Commit

Permalink
Add python algorithm to create table workspace re #5414
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlPalmen committed May 29, 2012
1 parent ce80a42 commit 89481f8
Showing 1 changed file with 20 additions and 0 deletions.
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)

0 comments on commit 89481f8

Please sign in to comment.