Rev 601 | Rev 606 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 601 | Rev 602 | ||
---|---|---|---|
Line 253... | Line 253... | ||
253 | 253 | ||
254 | # Configure TestListCtrl |
254 | # Configure TestListCtrl |
255 | self.TestListCtrl.InsertColumn(0, "Description") |
255 | self.TestListCtrl.InsertColumn(0, "Description") |
256 | self.TestListCtrl.InsertColumn(1, "Speed") |
256 | self.TestListCtrl.InsertColumn(1, "Speed") |
257 | self.TestListCtrl.InsertColumn(2, "Channel") |
257 | self.TestListCtrl.InsertColumn(2, "Channel") |
Line 258... | Line 258... | ||
258 | self.TestListCtrl.InsertColumn(3, "Result") |
258 | self.TestListCtrl.InsertColumn(3, "VibrationValue") |
259 | 259 | ||
260 | def DrawPointLabel(self, dc, mDataDict): |
260 | def DrawPointLabel(self, dc, mDataDict): |
261 | """This is the fuction that defines how the pointLabels are plotted |
261 | """This is the fuction that defines how the pointLabels are plotted |
Line 284... | Line 284... | ||
284 | 284 | ||
285 | def onNewTest(self, test): |
285 | def onNewTest(self, test): |
286 | index = self.TestListCtrl.InsertStringItem(sys.maxint, test.descr) |
286 | index = self.TestListCtrl.InsertStringItem(sys.maxint, test.descr) |
287 | self.TestListCtrl.SetStringItem(index, 1, str(test.speed)) |
287 | self.TestListCtrl.SetStringItem(index, 1, str(test.speed)) |
288 | self.TestListCtrl.SetStringItem(index, 2, test.channel) |
288 | self.TestListCtrl.SetStringItem(index, 2, test.channel) |
Line 289... | Line 289... | ||
289 | self.TestListCtrl.SetStringItem(index, 3, "OK") |
289 | self.TestListCtrl.SetStringItem(index, 3, str(test.getVibValue())) |
290 | 290 | ||
291 | 291 | ||
Line 328... | Line 328... | ||
328 | 328 | ||
329 | line = wx.lib.plot.PolyLine(xydata, legend= 'Spectrum', colour='red') |
329 | line = wx.lib.plot.PolyLine(xydata, legend= 'Spectrum', colour='red') |
Line 330... | Line 330... | ||
330 | markers = wx.lib.plot.PolyMarker(xydata, legend= '', colour='red', marker='circle',size=2) |
330 | markers = wx.lib.plot.PolyMarker(xydata, legend= '', colour='red', marker='circle',size=2) |
331 | 331 | ||
332 | title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed) |
332 | title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed) |
Line 333... | Line 333... | ||
333 | self.client.Draw(wx.lib.plot.PlotGraphics([line,markers], title, "Freq (Hz)", "Acc"), xAxis=(0,300), yAxis= (-0,y)) |
333 | self.client.Draw(wx.lib.plot.PlotGraphics([line,markers], title, "Freq (Hz)", "Acc"), xAxis=(0,200), yAxis= (-0,y)) |
334 | self.client.SetEnableGrid(True) |
334 | self.client.SetEnableGrid(True) |
Line 366... | Line 366... | ||
366 | self.fft = _Numeric.fft.rfft(self.rawData) |
366 | self.fft = _Numeric.fft.rfft(self.rawData) |
Line 367... | Line 367... | ||
367 | 367 | ||
368 | self.spectrum = None |
368 | self.spectrum = None |
Line -... | Line 369... | ||
- | 369 | self.filteredData = None |
|
- | 370 | ||
369 | self.filteredData = None |
371 | self.vibValue = None |
370 | 372 | ||
Line 371... | Line 373... | ||
371 | def getDescr(self): |
373 | def getDescr(self): |
372 | return self.Descr |
374 | return self.Descr |
Line 383... | Line 385... | ||
383 | return self.spectrum |
385 | return self.spectrum |
Line 384... | Line 386... | ||
384 | 386 | ||
385 | def getFilteredData(self): |
387 | def getFilteredData(self): |
386 | if self.filteredData == None: |
388 | if self.filteredData == None: |
387 | tmpfft = self.fft.copy() |
389 | tmpfft = self.fft.copy() |
388 | for i in range(0,7): |
390 | for i in range(0,5): |
389 | tmpfft[i] = 0 |
391 | tmpfft[i] = 0 |
390 | for i in range(30, len(tmpfft)): |
392 | for i in range(30, len(tmpfft)): |
391 | tmpfft[i] = 0 |
393 | tmpfft[i] = 0 |
392 | self.filteredData = _Numeric.fft.irfft(tmpfft) |
394 | self.filteredData = _Numeric.fft.irfft(tmpfft) |
- | 395 | return self.filteredData |
|
- | 396 | ||
- | 397 | def getVibValue(self): |
|
- | 398 | if self.vibValue == None: |
|
- | 399 | fd = self.getFilteredData(); |
|
- | 400 | self.vibValue = max(fd)-min(fd) |
|
Line 393... | Line 401... | ||
393 | return self.filteredData |
401 | return self.vibValue |
394 | 402 | ||
395 | class App(wx.App): |
403 | class App(wx.App): |
Line 416... | Line 424... | ||
416 | self.frame_1.Show() |
424 | self.frame_1.Show() |
417 | return 1 |
425 | return 1 |
Line 418... | Line 426... | ||
418 | 426 | ||
Line 419... | Line 427... | ||
419 | def Import(self): |
427 | def Import(self): |
420 | 428 | ||
- | 429 | #filePath = "./unbal150.txt" |
|
- | 430 | #filePath = "./nikivan.txt" |
|
- | 431 | #filePath = "./MK1_unbal.txt" |
|
Line 421... | Line 432... | ||
421 | filePath = "./unbal150.txt" |
432 | filePath = "./MK1_bal.txt" |
Line 422... | Line 433... | ||
422 | #filePath = "./nikivan.txt" |
433 | |
423 | 434 |