1 | from MantidFramework import * |
---|
2 | |
---|
3 | def RunFFT(InputWorkspace, OutputWorkspace, Real): |
---|
4 | algm = mantid.createAlgorithm("FFT") |
---|
5 | algm.setPropertyValue("InputWorkspace", makeString(InputWorkspace).lstrip('? ')) |
---|
6 | algm.setPropertyValue("OutputWorkspace", makeString(OutputWorkspace).lstrip('? ')) |
---|
7 | algm.setPropertyValue("Real", makeString(Real).lstrip('? ')) |
---|
8 | algm.execute() |
---|
9 | |
---|
10 | class FuryCompile(PythonAlgorithm): |
---|
11 | |
---|
12 | def PyInit(self): |
---|
13 | self.declareWorkspaceProperty("InputWorkspace", "", Direction.Input) |
---|
14 | self.declareWorkspaceProperty("OutputWorkspace", "", Direction.Output) |
---|
15 | self.declareProperty("FFTPart", 2) |
---|
16 | |
---|
17 | def PyExec(self): |
---|
18 | inWS = self.getProperty("InputWorkspace") |
---|
19 | fftPart = self.getProperty("FFTPart") |
---|
20 | nhist = inWS.getNumberHistograms() |
---|
21 | |
---|
22 | for i in range(0, nhist): |
---|
23 | tmpWS = '_fury_algorithm_temp' |
---|
24 | RunFFT(inWS, tmpWS, i) |
---|
25 | |
---|
26 | tempWS = mantid.getMatrixWorkspace(tmpWS) |
---|
27 | #tempWS = WorkspaceFactory.createMatrixWorkspace(3,inWS.getNumberBins(), inWS.getNumberBins()) |
---|
28 | if ( i == 0 ): |
---|
29 | outWS = WorkspaceFactory.createMatrixWorkspaceFromCopy(tempWS, nhist, tempWS.getNumberBins(), tempWS.getNumberBins()) |
---|
30 | |
---|
31 | for j in range(0, outWS.getNumberBins()): |
---|
32 | outWS.dataX(i)[j] = tempWS.readX(fftPart)[j] |
---|
33 | outWS.dataE(i)[j] = tempWS.readE(fftPart)[j] |
---|
34 | outWS.dataY(i)[j] = tempWS.readY(fftPart)[j] |
---|
35 | |
---|
36 | self.setProperty("OutputWorkspace", outWS) |
---|
37 | |
---|
38 | mantid.registerPyAlgorithm(FuryCompile()) |
---|