Skip to content

Commit

Permalink
Add a WorkspaceGroupProperty to Python. Refs #6603
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Mar 15, 2013
1 parent 9b7998e commit ec6a8ba
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""*WIKI*
*WIKI*"""


from mantid.kernel import *
from mantid.api import *
import numpy as np

import os

class TestWorkspaceGroupProperty(PythonAlgorithm):
"""
"""

def category(self):
return "PythonAlgorithms"

def name(self):
return "WorkspaceGroupProperty"

def PyInit(self):
self.declareProperty(WorkspaceGroupProperty("InputWorkspace", "", Direction.Input), doc="Group workspace that automatically includes all members.")
self.declareProperty(MatrixWorkspaceProperty("InputWorkspace2", "", Direction.Input), doc="asd")

def PyExec(self):
ws = self.getProperty("InputWorkspace").value
logger.notice("Input type: %s" % str(type(ws)))
ws2 = self.getProperty("InputWorkspace2").value
logger.notice("Input type: %s" % str(type(ws2)))


registerAlgorithm(TestWorkspaceGroupProperty)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ set ( EXPORT_FILES
src/Exports/IPeaksWorkspace.cpp
src/Exports/BinaryOperations.cpp
src/Exports/WorkspaceGroup.cpp
src/Exports/WorkspaceGroupProperty.cpp
src/Exports/WorkspaceValidators.cpp
src/Exports/InstrumentValidator.cpp
src/Exports/Axis.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "MantidPythonInterface/api/WorkspacePropertyMacro.h"
#include "MantidAPI/WorkspaceGroup.h"

void export_WorkspaceGroupProperty()
{
using Mantid::API::WorkspaceGroup;
EXPORT_WORKSPACE_PROPERTY(WorkspaceGroup, "WorkspaceGroupProperty");
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"""
import unittest
import testhelpers
from mantid.api import (WorkspaceProperty, MatrixWorkspaceProperty, IEventWorkspaceProperty,
ITableWorkspaceProperty, IMDHistoWorkspaceProperty, PropertyMode, LockMode)
from mantid.kernel import Direction
from mantid.api import (WorkspaceProperty, WorkspaceGroupProperty, MatrixWorkspaceProperty,
IEventWorkspaceProperty, ITableWorkspaceProperty, IMDHistoWorkspaceProperty,
PropertyMode, LockMode)
from mantid.kernel import Direction, Property

class WorkspacePropertiesTest(unittest.TestCase):

def _do_test(self, classtype):
self.assertTrue(issubclass(WorkspaceGroupProperty, Property))
self._do_construction_with_name_default_direction(classtype)
self._do_construction_with_name_default_direction_optional(classtype)

Expand Down Expand Up @@ -40,6 +42,9 @@ def _do_construction_with_name_default_direction_optional_no_locking(self, class
def test_WorkspaceProperty_can_be_instantiated(self):
self._do_test(WorkspaceProperty)

def test_WorkspaceGroupProperty_can_be_instantiated(self):
self._do_test(WorkspaceGroupProperty)

def test_MatrixWorkspaceProperty_can_be_instantiated(self):
self._do_test(MatrixWorkspaceProperty)

Expand Down

0 comments on commit ec6a8ba

Please sign in to comment.