forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExampleRedStep.py
49 lines (36 loc) · 1.61 KB
/
ExampleRedStep.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=no-init
from mantid.kernel import *
from mantid.api import *
from mantid.simpleapi import *
class ExampleRedStep(PythonAlgorithm):
def name(self):
return "ExampleRedStep"
def PyInit(self):
self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", "", Direction.Input))
self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", Direction.Output))
self.declareProperty(AlgorithmProperty("Algorithm"))
def PyExec(self):
input_ws = self.getProperty("InputWorkspace").value
output_ws = self.getProperty("OutputWorkspace").value
alg = self.getProperty("Algorithm").value
alg.setPropertyValue("InputWorkspace", str(input_ws))
alg.setPropertyValue("OutputWorkspace", output_ws)
alg.execute()
#AlgorithmFactory.subscribe(ExampleRedStep)
class ExampleLoader(PythonAlgorithm):
def name(self):
return "ExampleLoader"
def PyInit(self):
self.declareProperty("Filename", "")
self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", Direction.Output))
def PyExec(self):
filename = self.getProperty("Filename").value
output_ws = self.getProperty("OutputWorkspace").value
LoadAscii(filename, output_ws)
print(filename, output_ws)