Subversion Repositories Projects

Rev

Rev 634 | Rev 637 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 634 Rev 636
Line 25... Line 25...
25
 
25
 
26
 
26
 
27
CHANNEL_NAMES = ["GyroYaw", "GyroRoll", "GyroNick", "Pressure", "Batt", "AccTop", "AccRoll", "AccNick"]
27
CHANNEL_NAMES = ["GyroYaw", "GyroRoll", "GyroNick", "Pressure", "Batt", "AccTop", "AccRoll", "AccNick"]
-
 
28
FS = 11111
-
 
29
pi = 3.14
-
 
30
COLOR_YELLOW = wx.Colour(255, 240, 0)
-
 
31
COLOR_BACKGROUND = wx.Colour(0x80, 0x80, 0x80)
Line 28... Line 32...
28
FS = 11111
32
 
Line 29... Line 33...
29
pi = 3.14
33
COLORS = [wx.RED, wx.GREEN, wx.BLUE, COLOR_YELLOW, COLOR_BACKGROUND, wx.BLACK,]*2
30
 
34
 
Line 72... Line 76...
72
        self.Bind(wx.EVT_BUTTON, self.onButton, self.button)
76
        self.Bind(wx.EVT_BUTTON, self.onButton, self.button)
73
        # end wxGlade
77
        # end wxGlade
Line 74... Line 78...
74
       
78
       
Line 75... Line -...
75
        self.button.SetFocus()
-
 
76
       
-
 
-
 
79
        self.button.SetFocus()
-
 
80
       
77
        YELLOW = wx.Colour(255, 240, 0)
81
       
78
        BG = wx.Colour(0x80, 0x80, 0x80)
82
       
79
        # Configure Voltage Ctrl
83
        # Configure Voltage Ctrl
80
        self.voltageCtrl.SetAngleRange(0,pi)
84
        self.voltageCtrl.SetAngleRange(0,pi)
81
        intervals = range(0, 5)
85
        intervals = range(0, 5)
82
        self.voltageCtrl.SetIntervals(intervals)
86
        self.voltageCtrl.SetIntervals(intervals)
83
        colours = [wx.RED, wx.GREEN, wx.GREEN, YELLOW]
87
        colours = [wx.RED, wx.GREEN, wx.GREEN, COLOR_YELLOW]
84
        self.voltageCtrl.SetIntervalColours(colours)
88
        self.voltageCtrl.SetIntervalColours(colours)
85
        ticks = ["", "", "", "", ""]
89
        ticks = ["", "", "", "", ""]
86
        self.voltageCtrl.SetTicks(ticks)
90
        self.voltageCtrl.SetTicks(ticks)
Line 87... Line 91...
87
        self.voltageCtrl.SetTicksColour(wx.WHITE)
91
        self.voltageCtrl.SetTicksColour(wx.WHITE)
88
        self.voltageCtrl.SetHandColour(YELLOW)
92
        self.voltageCtrl.SetHandColour(COLOR_YELLOW)
89
 
93
 
Line 90... Line 94...
90
        icon = wx.Icon("%s/Resources/fuel.ico" % rootPath, wx.BITMAP_TYPE_ICO)
94
        icon = wx.Icon("%s/Resources/fuel.ico" % rootPath, wx.BITMAP_TYPE_ICO)
91
        icon.SetWidth(24)
95
        icon.SetWidth(24)
92
        icon.SetHeight(24)
96
        icon.SetHeight(24)
93
 
97
 
Line 94... Line 98...
94
        self.voltageCtrl.SetMiddleIcon(icon)        
98
        self.voltageCtrl.SetMiddleIcon(icon)        
95
        self.voltageCtrl.SetSpeedBackground(BG)        
99
        self.voltageCtrl.SetSpeedBackground(COLOR_BACKGROUND)        
96
        self.voltageCtrl.SetArcColour(wx.WHITE)
100
        self.voltageCtrl.SetArcColour(wx.WHITE)
97
        self.voltageCtrl.SetSpeedValue(2)
101
        self.voltageCtrl.SetSpeedValue(2)
Line 98... Line 102...
98
 
102
 
99
 
103
 
100
        # Configure Speed Ctr;
104
        # Configure Speed Ctr;
101
        self.speedCtrl.SetAngleRange(0,pi)        
105
        self.speedCtrl.SetAngleRange(0,pi)        
102
        intervals = range(0, 261, 20)
106
        intervals = range(0, 261, 20)
103
        self.speedCtrl.SetIntervals(intervals)
107
        self.speedCtrl.SetIntervals(intervals)
Line 112... Line 116...
112
        self.speedCtrl.SetNumberOfSecondaryTicks(1)
116
        self.speedCtrl.SetNumberOfSecondaryTicks(1)
113
        self.speedCtrl.SetTicksFont(wx.Font(7, wx.SWISS, wx.NORMAL, wx.NORMAL))
117
        self.speedCtrl.SetTicksFont(wx.Font(7, wx.SWISS, wx.NORMAL, wx.NORMAL))
114
        self.speedCtrl.SetMiddleText("Speed")
118
        self.speedCtrl.SetMiddleText("Speed")
115
        self.speedCtrl.SetMiddleTextColour(wx.WHITE)
119
        self.speedCtrl.SetMiddleTextColour(wx.WHITE)
116
        self.speedCtrl.SetMiddleTextFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD))
120
        self.speedCtrl.SetMiddleTextFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD))
117
        self.speedCtrl.SetHandColour(YELLOW)
121
        self.speedCtrl.SetHandColour(COLOR_YELLOW)
118
        self.speedCtrl.SetSpeedBackground(BG)  
122
        self.speedCtrl.SetSpeedBackground(COLOR_BACKGROUND)  
119
        self.speedCtrl.SetArcColour(wx.WHITE)        
123
        self.speedCtrl.SetArcColour(wx.WHITE)        
120
        self.speedCtrl.SetSpeedValue(0)
124
        self.speedCtrl.SetSpeedValue(0)
Line 121... Line 125...
121
 
125
 
Line 511... Line 515...
511
    def OnTestSelected(self, event):
515
    def OnTestSelected(self, event):
512
         testId = event.m_itemIndex
516
         testId = event.m_itemIndex
513
         print "Test Selected id=%d" % (testId)
517
         print "Test Selected id=%d" % (testId)
514
         self.activeTestId = testId
518
         self.activeTestId = testId
515
         self.drawGraph()
519
         self.drawGraph()
-
 
520
         
-
 
521
         
-
 
522
    def orderSelectedTests(self):
-
 
523
        tests = []
-
 
524
        idx = self.TestListCtrl.GetFirstSelected()
-
 
525
        while idx != -1:
-
 
526
            header = "%s %s"%(self.app.getTest(idx).descr,self.app.getTest(idx).channel)
-
 
527
            found = False
-
 
528
            for t in tests:
-
 
529
              if t[0] == header:
-
 
530
                t.append(idx)
-
 
531
                found = True
-
 
532
                break
-
 
533
            if not found:
-
 
534
                tests.append([header, idx])
-
 
535
            idx = self.TestListCtrl.GetNextSelected(idx)
-
 
536
        return tests
-
 
537
       
Line 516... Line 538...
516
 
538
 
Line 517... Line 539...
517
    def drawGraph(self):
539
    def drawGraph(self):
Line 524... Line 546...
524
              self.graphCtrl.Clear()
546
              self.graphCtrl.Clear()
Line 525... Line 547...
525
         
547
         
526
         elif nbSelected > 1:
548
         elif nbSelected > 1:
527
             self.graphTypeChoice.Disable()
549
             self.graphTypeChoice.Disable()
-
 
550
             self.copyGraphButton.Enable()
-
 
551
             
-
 
552
             tests = self.orderSelectedTests()
-
 
553
             
528
             self.copyGraphButton.Enable()
554
             lines = []
529
             x = 1
555
             maxX = 0
530
             data = []
556
             cCnt = 0
-
 
557
             for s in tests:
-
 
558
               data = []
531
             idx = self.TestListCtrl.GetFirstSelected()
559
               x=1
532
             while idx != -1:
560
               for t in s[1:]:
533
                 data.append([x,self.app.getTest(idx).getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value)])
561
                 data.append([x,self.app.getTest(t).getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value)])
534
                 x += 1
-
 
535
                 idx = self.TestListCtrl.GetNextSelected(idx)
562
                 x += 1
536
             line = wx.lib.plot.PolyLine(data, legend= 'Vibrations', colour='red', width=2)
563
               lines.append(wx.lib.plot.PolyLine(data, legend= s[0], colour=COLORS[cCnt], width=2))
-
 
564
               lines.append(wx.lib.plot.PolyMarker(data, legend= "", colour=COLORS[cCnt], marker='circle',size=2))
-
 
565
               maxX = max(maxX, x)
-
 
566
               cCnt += 1
537
             markers = wx.lib.plot.PolyMarker(data, legend= '', colour='red', marker='circle',size=2)
567
                       
538
             title = "Comparing tests"
568
             title = "Comparing tests"
539
             self.graphCtrl.setLogScale((False,False))
569
             self.graphCtrl.setLogScale((False,False))
540
             self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line, markers], title, "Test", "Vibration Value"), xAxis=(1,max(x,10)), yAxis=(0,y))
570
             self.graphCtrl.Draw(wx.lib.plot.PlotGraphics(lines, title, "Test", "Vibration Value"), xAxis=(1,maxX), yAxis=(0,y))
-
 
571
             self.graphCtrl.SetEnableGrid('Horizontal')
-
 
572
             self.graphCtrl.SetEnableLegend(True)
Line 541... Line 573...
541
             self.graphCtrl.SetEnableGrid('Horizontal')
573
             
542
 
574
 
543
         else:
575
         else:
544
             self.graphTypeChoice.Enable()
576
             self.graphTypeChoice.Enable()
Line 554... Line 586...
554
       
586
       
555
                 title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
587
                 title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
556
                 self.graphCtrl.setLogScale((False,False))
588
                 self.graphCtrl.setLogScale((False,False))
557
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
589
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
-
 
590
                 self.graphCtrl.SetEnableGrid('Horizontal')
-
 
591
                 self.graphCtrl.SetEnableLegend(False)
Line 558... Line 592...
558
                 self.graphCtrl.SetEnableGrid('Horizontal')
592
                 
559
   
593
   
560
             if self.graphTypeChoice.GetSelection() == 1:
594
             if self.graphTypeChoice.GetSelection() == 1:
561
                 xydata = _Numeric.linspace(0,0.09*nb,2*nb)
595
                 xydata = _Numeric.linspace(0,0.09*nb,2*nb)
Line 565... Line 599...
565
       
599
       
566
                 title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
600
                 title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
567
                 self.graphCtrl.setLogScale((False,False))
601
                 self.graphCtrl.setLogScale((False,False))
568
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
602
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
-
 
603
                 self.graphCtrl.SetEnableGrid('Horizontal')
Line 569... Line 604...
569
                 self.graphCtrl.SetEnableGrid('Horizontal')
604
                 self.graphCtrl.SetEnableLegend(False)
570
   
605
   
571
             elif self.graphTypeChoice.GetSelection() == 2:
606
             elif self.graphTypeChoice.GetSelection() == 2:
Line 583... Line 618...
583
                 filterLine1 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
618
                 filterLine1 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
584
                 fc = self.app.settings["lpf"].value
619
                 fc = self.app.settings["lpf"].value
585
                 filterLine2 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
620
                 filterLine2 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
Line 586... Line 621...
586
       
621
       
587
                 title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
-
 
588
                 self.graphCtrl.SetEnableGrid(True)
622
                 title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
589
                 self.graphCtrl.setLogScale((True,False))
623
                 self.graphCtrl.setLogScale((True,False))
-
 
624
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line,markers, filterLine1, filterLine2], title, "Freq (Hz)", "Acc"), xAxis=(20,500), yAxis= (0,y))
-
 
625
                 self.graphCtrl.SetEnableGrid(True)
Line 590... Line 626...
590
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line,markers, filterLine1, filterLine2], title, "Freq (Hz)", "Acc"), xAxis=(20,500), yAxis= (0,y))
626
                 self.graphCtrl.SetEnableLegend(False)
591
                 
627