Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 596 → Rev 599

/VibrationTest/trunk/VibrationTest/VibrationTestGui.py
125,7 → 125,8
self.__do_layout()
 
self.Bind(wx.EVT_MENU, self.OnImport, id=-1)
self.Bind(wx.EVT_COMBOBOX, self.onYAxesChange, self.yAxesChoice)
self.Bind(wx.EVT_COMBOBOX, self.onYAxisChange, self.yAxesChoice)
self.Bind(wx.EVT_COMBOBOX, self.onYAxisChange, self.graphTypeChoise)
# end wxGlade
 
def setApp(self, app):
134,7 → 135,7
def __set_properties(self):
# begin wxGlade: MainFrame.__set_properties
self.SetTitle("VibrationTest")
self.GraphPanel.SetMinSize((800,300))
self.GraphPanel.SetMinSize((800,350))
self.yAxesChoice.SetSelection(2)
self.graphTypeChoise.SetSelection(0)
# end wxGlade
240,23 → 241,39
nb = vibTest.getDataLen()
y = int(self.yAxesChoice.GetStringSelection())
 
#self.client.Clear()
xydata = _Numeric.linspace(0,0.09*nb,2*nb)
xydata.shape = (nb, 2)
xydata[:,1] = vibTest.getRawData()
line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red')
if self.graphTypeChoise.GetSelection() == 0:
xydata = _Numeric.linspace(0,0.09*nb,2*nb)
xydata.shape = (nb, 2)
xydata[:,1] = vibTest.getRawData()
line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red')
title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
self.client.SetEnableGrid('Horizontal')
 
title = "%s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
self.client.SetEnableGrid('Horizontal')
elif self.graphTypeChoise.GetSelection() == 2:
xydata = _Numeric.linspace(0,5555,nb)
xydata.shape = (nb/2, 2)
xydata[:,1] = vibTest.getSpectrum()
 
line = wx.lib.plot.PolyLine(xydata, legend= 'Spectrum', colour='red')
markers = wx.lib.plot.PolyMarker(xydata, legend= '', colour='red', marker='circle',size=1)
title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
self.client.Draw(wx.lib.plot.PlotGraphics([line,markers], title, "Freq (Hz)", "Acc"), xAxis=(0,500), yAxis= (-0,y))
self.client.SetEnableGrid('Horizontal')
 
 
def OnImport(self, event): # wxGlade: MainFrame.<event_handler>
self.app.Import()
 
def onYAxesChange(self, event): # wxGlade: MainFrame.<event_handler>
def onYAxisChange(self, event): # wxGlade: MainFrame.<event_handler>
self.drawGraph()
 
def onYAxisChange(self, event): # wxGlade: MainFrame.<event_handler>
self.drawGraph()
 
# end of class MainFrame
 
 
266,11 → 283,16
self.motor = motor
self.speed = speed
self.channel = channel
 
self.dataLen = len(rawData)
print self.dataLen
 
self.rawData = _Numeric.array(rawData)
self.dc = self.rawData.mean()
self.rawData -= self.dc
self.dataLen = len(rawData)
 
self.fft = _Numeric.fft.fft(self.rawData)
def getDescr(self):
return self.Descr
 
280,7 → 302,10
def getDataLen(self):
return self.dataLen
 
def getSpectrum(self):
return _Numeric.absolute(self.fft[1:self.dataLen/2+1]) / (self.dataLen/2)
 
 
class App(wx.App):
def __init__(self, par):
self.VibTests = []
306,8 → 331,8
return 1
 
def Import(self):
#filePath = "./unbal200.txt"
filePath = "./nikivan.txt"
filePath = "./unbal200.txt"
#filePath = "./nikivan.txt"
print "Import %s" % filePath
 
337,6 → 362,8
logfile.close()
 
for c in range(nbCols):
if (len(data[c]) % 2) != 0:
data[c].append(data[c][-1])
self.AddTest(descr[c], 0, int(speed[c]), channel[c], data[c])
/VibrationTest/trunk/VibrationTest/VibrationTestGui.wxg
1,5 → 1,5
<?xml version="1.0"?>
<!-- generated by wxGlade 0.6.3 on Tue Sep 29 18:58:17 2009 -->
<!-- generated by wxGlade 0.6.3 on Thu Oct 01 13:13:08 2009 -->
 
<application path="D:\Fred\MK_Proj\VibrationTest\trunk\VibrationTest\VibrationTestGui.py" name="VibrationTestGui" class="App" option="0" language="python" top_window="frame_1" encoding="ISO-8859-15" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6" is_template="0">
<object class="MainFrame" name="frame_1" base="EditFrame">
191,7 → 191,7
<option>1</option>
<object class="wxPanel" name="GraphPanel" base="EditPanel">
<style>wxDOUBLE_BORDER|wxTAB_TRAVERSAL</style>
<size>800,300</size>
<size>800,350</size>
</object>
</object>
<object class="sizeritem">
213,7 → 213,7
<choice>250</choice>
</choices>
<events>
<handler event="EVT_COMBOBOX">onYAxesChange</handler>
<handler event="EVT_COMBOBOX">onYAxisChange</handler>
</events>
</object>
</object>
227,6 → 227,9
<choice>Filtered Data</choice>
<choice>Spectrum</choice>
</choices>
<events>
<handler event="EVT_COMBOBOX">onYAxisChange</handler>
</events>
</object>
</object>
</object>