Newer
Older
from __future__ import (absolute_import, division, print_function)
import mantid.simpleapi as mantid
class FFTPresenter(object):
# set data
self.getWorkspaceNames()
#connect
self.view.tableClickSignal.connect(self.tableClicked)
self.view.buttonSignal.connect(self.handleButton)
self.view.phaseCheckSignal.connect(self.phaseCheck)
self.alg.started.connect(self.deactivate)
self.alg.finished.connect(self.activate)
def activate(self):
self.view.activateButton()
def deactivate(self):
self.view.deactivateButton()
# ignore raw
runName,options = self.load.getCurrentWS()
if ";" in pick and "Raw" not in pick and runName in pick:
#functions
def phaseCheck(self):
self.view.phaseQuadChanged()
#check if a phase table exists
if mantid.AnalysisDataService.doesExist("PhaseTable"):
if row == self.view.getImBoxRow() and col == 1 and self.view.getWS() !="PhaseQuad":
self.view.changedHideUnTick(self.view.getImBox(),self.view.getImBoxRow()+1)
elif row == self.view.getShiftBoxRow() and col == 1:
self.view.changed(self.view.getShiftBox(),self.view.getShiftBoxRow()+1)
def handleButton(self):
inputs={}
inputs["Run"]=self.load.getRunName()
#do apodization and padding to real data
preInputs=self.view.initAdvanced()
if self.view.getWS() == "PhaseQuad":
phaseTable={}
phaseTable["newTable"]= self.view.isNewPhaseTable()
phaseTable["axis"]=self.view.getAxis()
phaseTable["Instrument"]=self.load.getInstrument()
inputs["phaseTable"]=phaseTable
#model.makePhaseQuadTable(axis,self.load.getInstrument())
#self.model.PhaseQuad()
self.view.RePhaseAdvanced(preInputs)
else:
self.view.ReAdvanced(preInputs)
if self.view.isRaw():
self.view.addRaw(preInputs,"InputWorkspace")
inputs["preRe"]=preInputs
#model.preAlg(preInputs)
#do apodization and padding to complex data
if self.view.isComplex() and self.view.getWS()!="PhaseQuad":
ImPreInputs=self.view.initAdvanced()
self.view.ImAdvanced(ImPreInputs)
self.view.addRaw(ImPreInputs,"InputWorkspace")
#model.preAlg(preInputs)
inputs["preIm"]=ImPreInputs
FFTInputs = self.get_FFT_input()
if self.view.getWS()=="PhaseQuad":
self.view.getFFTRePhase(FFTInputs)
if self.view.isComplex():
self.view.getFFTImPhase(FFTInputs)
else:
if self.view.isRaw():
self.view.addRaw(FFTInputs,"OutputWorkspace")
#model.FFTAlg(FFTInputs)
inputs["FFT"]=FFTInputs
self.alg.loadData(inputs)
self.alg.start()
self.view.setPhaseBox()
FFTInputs=self.view.initFFTInput()
self.view.addFFTShift(FFTInputs)
self.view.addFFTComplex(FFTInputs)
return FFTInputs