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]) |
|
|