Subversion Repositories Projects

Rev

Rev 606 | Rev 608 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 606 Rev 607
1
#!/usr/bin/env python
1
#!/usr/bin/env python
2
# -*- coding: iso-8859-15 -*-
2
# -*- coding: iso-8859-15 -*-
3
# generated by wxGlade 0.6.3 on Thu Sep 24 15:46:36 2009
3
# generated by wxGlade 0.6.3 on Thu Sep 24 15:46:36 2009
4
 
4
 
5
import sys
5
import sys
6
import os
6
import os
7
import wx
7
import wx
8
import wx.lib
8
import wx.lib
9
import wx.lib.plot
9
import wx.lib.plot
-
 
10
import ConfigParser
10
 
11
 
11
# Needs Numeric or numarray or NumPy
12
# Needs Numeric or numarray or NumPy
12
try:
13
try:
13
    import numpy.oldnumeric as _Numeric
14
    import numpy.oldnumeric as _Numeric
14
except:
15
except:
15
    try:
16
    try:
16
        import numarray as _Numeric  #if numarray is used it is renamed Numeric
17
        import numarray as _Numeric  #if numarray is used it is renamed Numeric
17
    except:
18
    except:
18
        try:
19
        try:
19
            import Numeric as _Numeric
20
            import Numeric as _Numeric
20
        except:
21
        except:
21
            msg= """
22
            msg= """
22
            This module requires the Numeric/numarray or NumPy module,
23
            This module requires the Numeric/numarray or NumPy module,
23
            which could not be imported.  It probably is not installed
24
            which could not be imported.  It probably is not installed
24
            (it's not part of the standard Python distribution). See the
25
            (it's not part of the standard Python distribution). See the
25
            Numeric Python site (http://numpy.scipy.org) for information on
26
            Numeric Python site (http://numpy.scipy.org) for information on
26
            downloading source or binaries."""
27
            downloading source or binaries."""
27
            raise ImportError, "Numeric,numarray or NumPy not found. \n" + msg
28
            raise ImportError, "Numeric,numarray or NumPy not found. \n" + msg
28
 
29
 
29
# begin wxGlade: extracode
30
# begin wxGlade: extracode
30
# end wxGlade
31
# end wxGlade
31
 
32
 
32
 
33
 
33
 
34
 
34
class SettingsFrame(wx.Frame):
35
class SettingsDialog(wx.Dialog):
35
    def __init__(self, *args, **kwds):
36
    def __init__(self, *args, **kwds):
36
        # begin wxGlade: SettingsFrame.__init__
37
        # begin wxGlade: SettingsDialog.__init__
37
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
38
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
38
        wx.Frame.__init__(self, *args, **kwds)
39
        wx.Dialog.__init__(self, *args, **kwds)
39
        self.label_5 = wx.StaticText(self, -1, "COM Port ", style=wx.ALIGN_RIGHT)
40
        self.label_5_copy = wx.StaticText(self, -1, "COM Port ", style=wx.ALIGN_RIGHT)
40
        self.comPortCtrl = wx.TextCtrl(self, -1, "")
41
        self.comPortCtrl_copy = wx.TextCtrl(self, -1, "")
41
        self.button_5 = wx.Button(self, wx.ID_CANCEL, "")
42
        self.button_5_copy = wx.Button(self, wx.ID_CANCEL, "")
42
        self.button_6 = wx.Button(self, wx.ID_OK, "")
43
        self.button_6_copy = wx.Button(self, wx.ID_OK, "")
43
 
44
 
44
        self.__set_properties()
45
        self.__set_properties()
45
        self.__do_layout()
46
        self.__do_layout()
46
        # end wxGlade
47
        # end wxGlade
47
 
48
 
48
    def __set_properties(self):
49
    def __set_properties(self):
49
        # begin wxGlade: SettingsFrame.__set_properties
50
        # begin wxGlade: SettingsDialog.__set_properties
50
        self.SetTitle("Settings")
51
        self.SetTitle("Settings")
51
        # end wxGlade
52
        # end wxGlade
52
 
53
 
53
    def __do_layout(self):
54
    def __do_layout(self):
54
        # begin wxGlade: SettingsFrame.__do_layout
55
        # begin wxGlade: SettingsDialog.__do_layout
55
        sizer_5 = wx.BoxSizer(wx.VERTICAL)
56
        sizer_5_copy = wx.BoxSizer(wx.VERTICAL)
56
        grid_sizer_3 = wx.GridSizer(1, 2, 0, 0)
57
        grid_sizer_3_copy = wx.GridSizer(1, 2, 0, 0)
57
        sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
58
        sizer_6_copy = wx.BoxSizer(wx.HORIZONTAL)
58
        grid_sizer_2 = wx.GridSizer(1, 2, 4, 4)
59
        grid_sizer_2_copy = wx.GridSizer(1, 2, 4, 4)
59
        sizer_5.Add((20, 20), 0, 0, 0)
60
        sizer_5_copy.Add((20, 20), 0, 0, 0)
60
        sizer_6.Add((20, 20), 0, 0, 0)
61
        sizer_6_copy.Add((20, 20), 0, 0, 0)
61
        grid_sizer_2.Add(self.label_5, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
62
        grid_sizer_2_copy.Add(self.label_5_copy, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
62
        grid_sizer_2.Add(self.comPortCtrl, 0, 0, 0)
63
        grid_sizer_2_copy.Add(self.comPortCtrl_copy, 0, 0, 0)
63
        sizer_6.Add(grid_sizer_2, 0, 0, 0)
64
        sizer_6_copy.Add(grid_sizer_2_copy, 0, 0, 0)
64
        sizer_6.Add((20, 20), 0, 0, 0)
65
        sizer_6_copy.Add((20, 20), 0, 0, 0)
65
        sizer_5.Add(sizer_6, 1, wx.EXPAND, 0)
66
        sizer_5_copy.Add(sizer_6_copy, 1, wx.EXPAND, 0)
66
        sizer_5.Add((20, 20), 0, 0, 0)
67
        sizer_5_copy.Add((20, 20), 0, 0, 0)
67
        grid_sizer_3.Add(self.button_5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
68
        grid_sizer_3_copy.Add(self.button_5_copy, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
68
        grid_sizer_3.Add(self.button_6, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
69
        grid_sizer_3_copy.Add(self.button_6_copy, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
69
        sizer_5.Add(grid_sizer_3, 0, wx.EXPAND, 0)
70
        sizer_5_copy.Add(grid_sizer_3_copy, 0, wx.EXPAND, 0)
70
        sizer_5.Add((20, 20), 0, 0, 0)
71
        sizer_5_copy.Add((20, 20), 0, 0, 0)
71
        self.SetSizer(sizer_5)
72
        self.SetSizer(sizer_5_copy)
72
        sizer_5.Fit(self)
73
        sizer_5_copy.Fit(self)
73
        self.Layout()
74
        self.Layout()
74
        # end wxGlade
75
        # end wxGlade
-
 
76
 
-
 
77
# end of class SettingsDialog
-
 
78
 
-
 
79
 
-
 
80
class SettingsFrame(wx.Frame):
-
 
81
    def __init__(self, *args, **kwds):
-
 
82
        # content of this block not found: did you rename this class?
-
 
83
        pass
-
 
84
 
-
 
85
    def __set_properties(self):
-
 
86
        # content of this block not found: did you rename this class?
-
 
87
        pass
-
 
88
 
-
 
89
    def __do_layout(self):
-
 
90
        # content of this block not found: did you rename this class?
-
 
91
        pass
75
 
92
 
76
# end of class SettingsFrame
93
# end of class SettingsFrame
77
 
94
 
78
 
95
 
79
class MenuBar(wx.MenuBar):
96
class MenuBar(wx.MenuBar):
80
    def __init__(self, *args, **kwds):
97
    def __init__(self, *args, **kwds):
81
        # content of this block not found: did you rename this class?
98
        # content of this block not found: did you rename this class?
82
        pass
99
        pass
83
 
100
 
84
    def __set_properties(self):
101
    def __set_properties(self):
85
        # content of this block not found: did you rename this class?
102
        # content of this block not found: did you rename this class?
86
        pass
103
        pass
87
 
104
 
88
    def __do_layout(self):
105
    def __do_layout(self):
89
        # content of this block not found: did you rename this class?
106
        # content of this block not found: did you rename this class?
90
        pass
107
        pass
91
 
108
 
92
# end of class MenuBar
109
# end of class MenuBar
93
 
110
 
94
 
111
 
95
class wxFrame(wx.Panel):
112
class wxFrame(wx.Panel):
96
    def __init__(self, *args, **kwds):
113
    def __init__(self, *args, **kwds):
97
        # content of this block not found: did you rename this class?
114
        # content of this block not found: did you rename this class?
98
        pass
115
        pass
99
 
116
 
100
    def __set_properties(self):
117
    def __set_properties(self):
101
        # content of this block not found: did you rename this class?
118
        # content of this block not found: did you rename this class?
102
        pass
119
        pass
103
 
120
 
104
    def __do_layout(self):
121
    def __do_layout(self):
105
        # content of this block not found: did you rename this class?
122
        # content of this block not found: did you rename this class?
106
        pass
123
        pass
107
 
124
 
108
# end of class wxFrame
125
# end of class wxFrame
109
 
126
 
110
 
127
 
111
class MyFrame(wx.Frame):
128
class MyFrame(wx.Frame):
112
    def __init__(self, *args, **kwds):
129
    def __init__(self, *args, **kwds):
113
        # content of this block not found: did you rename this class?
130
        # content of this block not found: did you rename this class?
114
        pass
131
        pass
115
 
132
 
116
    def __set_properties(self):
133
    def __set_properties(self):
117
        # content of this block not found: did you rename this class?
134
        # content of this block not found: did you rename this class?
118
        pass
135
        pass
119
 
136
 
120
    def __do_layout(self):
137
    def __do_layout(self):
121
        # content of this block not found: did you rename this class?
138
        # content of this block not found: did you rename this class?
122
        pass
139
        pass
123
 
140
 
124
# end of class MyFrame
141
# end of class MyFrame
125
 
142
 
126
 
143
 
127
class MainFrame(wx.Frame):
144
class MainFrame(wx.Frame):
128
    def __init__(self, *args, **kwds):
145
    def __init__(self, *args, **kwds):
129
        # begin wxGlade: MainFrame.__init__
146
        # begin wxGlade: MainFrame.__init__
130
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
147
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
131
        wx.Frame.__init__(self, *args, **kwds)
148
        wx.Frame.__init__(self, *args, **kwds)
132
       
149
       
133
        # Menu Bar
150
        # Menu Bar
134
        self.frame_1_menubar = wx.MenuBar()
151
        self.frame_1_menubar = wx.MenuBar()
135
        wxglade_tmp_menu = wx.Menu()
152
        wxglade_tmp_menu = wx.Menu()
-
 
153
        wxglade_tmp_menu.Append(101, "Settings", "", wx.ITEM_NORMAL)
136
        wxglade_tmp_menu.Append(wx.NewId(), "Exit", "", wx.ITEM_NORMAL)
154
        wxglade_tmp_menu.Append(150, "Exit", "", wx.ITEM_NORMAL)
137
        self.frame_1_menubar.Append(wxglade_tmp_menu, "File")
155
        self.frame_1_menubar.Append(wxglade_tmp_menu, "File")
138
        wxglade_tmp_menu = wx.Menu()
156
        wxglade_tmp_menu = wx.Menu()
139
        self.frame_1_menubar.Append(wxglade_tmp_menu, "Settings")
-
 
140
        wxglade_tmp_menu = wx.Menu()
-
 
141
        wxglade_tmp_menu.Append(wx.NewId(), "Clear", "", wx.ITEM_NORMAL)
157
        wxglade_tmp_menu.Append(301, "Clear", "", wx.ITEM_NORMAL)
142
        wxglade_tmp_menu.Append(wx.NewId(), "Import", "", wx.ITEM_NORMAL)
158
        wxglade_tmp_menu.Append(302, "Import", "", wx.ITEM_NORMAL)
143
        self.frame_1_menubar.Append(wxglade_tmp_menu, "TestSet")
159
        self.frame_1_menubar.Append(wxglade_tmp_menu, "TestSet")
144
        wxglade_tmp_menu = wx.Menu()
160
        wxglade_tmp_menu = wx.Menu()
145
        self.frame_1_menubar.Append(wxglade_tmp_menu, "MK")
161
        self.frame_1_menubar.Append(wxglade_tmp_menu, "MK")
146
        wxglade_tmp_menu = wx.Menu()
162
        wxglade_tmp_menu = wx.Menu()
147
        self.frame_1_menubar.Append(wxglade_tmp_menu, "Help")
163
        self.frame_1_menubar.Append(wxglade_tmp_menu, "Help")
148
        self.SetMenuBar(self.frame_1_menubar)
164
        self.SetMenuBar(self.frame_1_menubar)
149
        # Menu Bar end
165
        # Menu Bar end
150
        self.Description = wx.StaticText(self, -1, "Description")
166
        self.Description = wx.StaticText(self, -1, "Description")
151
        self.text_ctrl_6 = wx.TextCtrl(self, -1, "Test")
167
        self.text_ctrl_6 = wx.TextCtrl(self, -1, "Test")
152
        self.label_37 = wx.StaticText(self, -1, "Speed(s)")
168
        self.label_37 = wx.StaticText(self, -1, "Speed(s)")
153
        self.text_ctrl_9 = wx.TextCtrl(self, -1, "100-200:10")
169
        self.text_ctrl_9 = wx.TextCtrl(self, -1, "100-200:10")
154
        self.label_35 = wx.StaticText(self, -1, "Motor(s)")
170
        self.label_35 = wx.StaticText(self, -1, "Motor(s)")
155
        self.text_ctrl_7 = wx.TextCtrl(self, -1, "1")
171
        self.text_ctrl_7 = wx.TextCtrl(self, -1, "1")
156
        self.label_38 = wx.StaticText(self, -1, "")
172
        self.label_38 = wx.StaticText(self, -1, "")
157
        self.text_ctrl_10 = wx.TextCtrl(self, -1, "")
173
        self.text_ctrl_10 = wx.TextCtrl(self, -1, "")
158
        self.label_36 = wx.StaticText(self, -1, "Channel")
174
        self.label_36 = wx.StaticText(self, -1, "Channel")
159
        self.text_ctrl_8 = wx.TextCtrl(self, -1, "6")
175
        self.text_ctrl_8 = wx.TextCtrl(self, -1, "6")
160
        self.label_39 = wx.StaticText(self, -1, "")
176
        self.label_39 = wx.StaticText(self, -1, "")
161
        self.text_ctrl_11 = wx.TextCtrl(self, -1, "")
177
        self.text_ctrl_11 = wx.TextCtrl(self, -1, "")
162
        self.button_4 = wx.Button(self, -1, "Start")
178
        self.button_4 = wx.Button(self, -1, "Start")
163
        self.GraphPanel = wx.Panel(self, -1)
179
        self.GraphPanel = wx.Panel(self, -1)
164
        self.label_40 = wx.StaticText(self, -1, "Graph Type ")
180
        self.label_40 = wx.StaticText(self, -1, "Graph Type ")
165
        self.graphTypeChoice = wx.Choice(self, -1, choices=["Raw Signal", "Filtered Signal", "Spectrum"])
181
        self.graphTypeChoice = wx.Choice(self, -1, choices=["Raw Signal", "Filtered Signal", "Spectrum"])
166
        self.label_41 = wx.StaticText(self, -1, "Y Axis Range ")
182
        self.label_41 = wx.StaticText(self, -1, "Y Axis Range ")
167
        self.yAxisChoice = wx.Choice(self, -1, choices=["25", "50", "100", "200"])
183
        self.yAxisChoice = wx.Choice(self, -1, choices=["25", "50", "100", "200"])
168
        self.TestListCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
184
        self.TestListCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
169
 
185
 
170
        self.__set_properties()
186
        self.__set_properties()
171
        self.__do_layout()
187
        self.__do_layout()
-
 
188
 
172
 
189
        self.Bind(wx.EVT_MENU, self.OnSettings, id=101)
173
        self.Bind(wx.EVT_MENU, self.onClear, id=-1)
190
        self.Bind(wx.EVT_MENU, self.onClear, id=301)
174
        self.Bind(wx.EVT_MENU, self.OnImport, id=-1)
191
        self.Bind(wx.EVT_MENU, self.OnImport, id=302)
175
        self.Bind(wx.EVT_CHOICE, self.onGraphTypeChange, self.graphTypeChoice)
192
        self.Bind(wx.EVT_CHOICE, self.onGraphTypeChange, self.graphTypeChoice)
176
        self.Bind(wx.EVT_CHOICE, self.onYAxisChange, self.yAxisChoice)
193
        self.Bind(wx.EVT_CHOICE, self.onYAxisChange, self.yAxisChoice)
177
        # end wxGlade
194
        # end wxGlade
178
 
195
 
179
    def setApp(self, app):
196
    def setApp(self, app):
180
        self.app = app
197
        self.app = app
181
 
198
 
182
    def __set_properties(self):
199
    def __set_properties(self):
183
        # begin wxGlade: MainFrame.__set_properties
200
        # begin wxGlade: MainFrame.__set_properties
184
        self.SetTitle("VibrationTest")
201
        self.SetTitle("VibrationTest")
185
        self.SetSize((850, 700))
202
        self.SetSize((850, 700))
186
        self.Description.SetMinSize((53, 13))
203
        self.Description.SetMinSize((53, 13))
187
        self.button_4.SetMinSize((80, 80))
204
        self.button_4.SetMinSize((80, 80))
188
        self.GraphPanel.SetMinSize((800,300))
205
        self.GraphPanel.SetMinSize((800,300))
189
        self.graphTypeChoice.SetSelection(0)
206
        self.graphTypeChoice.SetSelection(0)
190
        self.yAxisChoice.SetSelection(1)
207
        self.yAxisChoice.SetSelection(1)
191
        self.TestListCtrl.SetMinSize((800,300))
208
        self.TestListCtrl.SetMinSize((800,300))
192
        # end wxGlade
209
        # end wxGlade
193
 
210
 
194
    def __do_layout(self):
211
    def __do_layout(self):
195
        # begin wxGlade: MainFrame.__do_layout
212
        # begin wxGlade: MainFrame.__do_layout
196
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
213
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
197
        sizer_8 = wx.BoxSizer(wx.VERTICAL)
214
        sizer_8 = wx.BoxSizer(wx.VERTICAL)
198
        sizer_11 = wx.BoxSizer(wx.VERTICAL)
215
        sizer_11 = wx.BoxSizer(wx.VERTICAL)
199
        sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
216
        sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
200
        sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
217
        sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
201
        sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
218
        sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
202
        grid_sizer_1 = wx.GridSizer(3, 4, 4, 5)
219
        grid_sizer_1 = wx.GridSizer(3, 4, 4, 5)
203
        sizer_3.Add((20, 20), 0, 0, 0)
220
        sizer_3.Add((20, 20), 0, 0, 0)
204
        sizer_8.Add((20, 20), 0, 0, 0)
221
        sizer_8.Add((20, 20), 0, 0, 0)
205
        grid_sizer_1.Add(self.Description, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
222
        grid_sizer_1.Add(self.Description, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
206
        grid_sizer_1.Add(self.text_ctrl_6, 0, 0, 0)
223
        grid_sizer_1.Add(self.text_ctrl_6, 0, 0, 0)
207
        grid_sizer_1.Add(self.label_37, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
224
        grid_sizer_1.Add(self.label_37, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
208
        grid_sizer_1.Add(self.text_ctrl_9, 0, 0, 0)
225
        grid_sizer_1.Add(self.text_ctrl_9, 0, 0, 0)
209
        grid_sizer_1.Add(self.label_35, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
226
        grid_sizer_1.Add(self.label_35, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
210
        grid_sizer_1.Add(self.text_ctrl_7, 0, 0, 0)
227
        grid_sizer_1.Add(self.text_ctrl_7, 0, 0, 0)
211
        grid_sizer_1.Add(self.label_38, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
228
        grid_sizer_1.Add(self.label_38, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
212
        grid_sizer_1.Add(self.text_ctrl_10, 0, 0, 0)
229
        grid_sizer_1.Add(self.text_ctrl_10, 0, 0, 0)
213
        grid_sizer_1.Add(self.label_36, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
230
        grid_sizer_1.Add(self.label_36, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
214
        grid_sizer_1.Add(self.text_ctrl_8, 0, 0, 0)
231
        grid_sizer_1.Add(self.text_ctrl_8, 0, 0, 0)
215
        grid_sizer_1.Add(self.label_39, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
232
        grid_sizer_1.Add(self.label_39, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
216
        grid_sizer_1.Add(self.text_ctrl_11, 0, 0, 0)
233
        grid_sizer_1.Add(self.text_ctrl_11, 0, 0, 0)
217
        sizer_9.Add(grid_sizer_1, 0, 0, 0)
234
        sizer_9.Add(grid_sizer_1, 0, 0, 0)
218
        sizer_10.Add((50, 20), 0, 0, 0)
235
        sizer_10.Add((50, 20), 0, 0, 0)
219
        sizer_10.Add(self.button_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
236
        sizer_10.Add(self.button_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
220
        sizer_9.Add(sizer_10, 1, wx.EXPAND, 0)
237
        sizer_9.Add(sizer_10, 1, wx.EXPAND, 0)
221
        sizer_8.Add(sizer_9, 0, 0, 0)
238
        sizer_8.Add(sizer_9, 0, 0, 0)
222
        sizer_8.Add((20, 30), 0, 0, 0)
239
        sizer_8.Add((20, 30), 0, 0, 0)
223
        sizer_11.Add(self.GraphPanel, 1, wx.EXPAND, 0)
240
        sizer_11.Add(self.GraphPanel, 1, wx.EXPAND, 0)
224
        sizer_11.Add((20, 5), 0, 0, 0)
241
        sizer_11.Add((20, 5), 0, 0, 0)
225
        sizer_12.Add(self.label_40, 0, wx.ALIGN_CENTER_VERTICAL, 0)
242
        sizer_12.Add(self.label_40, 0, wx.ALIGN_CENTER_VERTICAL, 0)
226
        sizer_12.Add(self.graphTypeChoice, 0, 0, 0)
243
        sizer_12.Add(self.graphTypeChoice, 0, 0, 0)
227
        sizer_12.Add((40, 20), 0, 0, 0)
244
        sizer_12.Add((40, 20), 0, 0, 0)
228
        sizer_12.Add(self.label_41, 0, wx.ALIGN_CENTER_VERTICAL, 0)
245
        sizer_12.Add(self.label_41, 0, wx.ALIGN_CENTER_VERTICAL, 0)
229
        sizer_12.Add(self.yAxisChoice, 0, 0, 0)
246
        sizer_12.Add(self.yAxisChoice, 0, 0, 0)
230
        sizer_11.Add(sizer_12, 0, 0, 0)
247
        sizer_11.Add(sizer_12, 0, 0, 0)
231
        sizer_8.Add(sizer_11, 0, 0, 0)
248
        sizer_8.Add(sizer_11, 0, 0, 0)
232
        sizer_8.Add((20, 30), 0, 0, 0)
249
        sizer_8.Add((20, 30), 0, 0, 0)
233
        sizer_8.Add(self.TestListCtrl, 1, 0, 0)
250
        sizer_8.Add(self.TestListCtrl, 1, 0, 0)
234
        sizer_8.Add((20, 20), 0, 0, 0)
251
        sizer_8.Add((20, 20), 0, 0, 0)
235
        sizer_3.Add(sizer_8, 1, wx.EXPAND, 0)
252
        sizer_3.Add(sizer_8, 1, wx.EXPAND, 0)
236
        self.SetSizer(sizer_3)
253
        self.SetSizer(sizer_3)
237
        self.Layout()
254
        self.Layout()
238
        self.SetSize((850, 700))
255
        self.SetSize((850, 700))
239
        # end wxGlade
256
        # end wxGlade
240
 
257
 
241
        # List events
258
        # List events
242
        self.TestListCtrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnTestSelected, self.TestListCtrl)
259
        self.TestListCtrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnTestSelected, self.TestListCtrl)
243
 
260
 
244
        # Configure Graph
261
        # Configure Graph
245
        self.client = wx.lib.plot.PlotCanvas(self.GraphPanel, size=(800,300))
262
        self.client = wx.lib.plot.PlotCanvas(self.GraphPanel, size=(800,300))
246
       
263
       
247
        self.client.SetPointLabelFunc(self.DrawPointLabel)
264
        self.client.SetPointLabelFunc(self.DrawPointLabel)
248
       
265
       
249
        self.client.SetFont(wx.Font(10,wx.SWISS,wx.NORMAL,wx.NORMAL))
266
        self.client.SetFont(wx.Font(10,wx.SWISS,wx.NORMAL,wx.NORMAL))
250
        self.client.SetFontSizeAxis(10)
267
        self.client.SetFontSizeAxis(10)
251
        self.client.SetFontSizeLegend(7)
268
        self.client.SetFontSizeLegend(7)
252
        self.client.setLogScale((False,False))
269
        self.client.setLogScale((False,False))
253
 
270
 
254
 
271
 
255
        # Configure TestListCtrl
272
        # Configure TestListCtrl
256
        self.TestListCtrl.InsertColumn(0, "Description")
273
        self.TestListCtrl.InsertColumn(0, "Description")
257
        self.TestListCtrl.InsertColumn(1, "Speed")
274
        self.TestListCtrl.InsertColumn(1, "Speed")
258
        self.TestListCtrl.InsertColumn(2, "Channel")
275
        self.TestListCtrl.InsertColumn(2, "Channel")
259
        self.TestListCtrl.InsertColumn(3, "VibrationValue")
276
        self.TestListCtrl.InsertColumn(3, "Vibration Value")
-
 
277
        self.TestListCtrl.SetColumnWidth(3, 500)
260
 
278
 
261
    def DrawPointLabel(self, dc, mDataDict):
279
    def DrawPointLabel(self, dc, mDataDict):
262
        """This is the fuction that defines how the pointLabels are plotted
280
        """This is the fuction that defines how the pointLabels are plotted
263
            dc - DC that will be passed
281
            dc - DC that will be passed
264
            mDataDict - Dictionary of data that you want to use for the pointLabel
282
            mDataDict - Dictionary of data that you want to use for the pointLabel
265
 
283
 
266
            As an example I have decided I want a box at the curve point
284
            As an example I have decided I want a box at the curve point
267
            with some text information about the curve plotted below.
285
            with some text information about the curve plotted below.
268
            Any wxDC method can be used.
286
            Any wxDC method can be used.
269
        """
287
        """
270
        # ----------
288
        # ----------
271
        dc.SetPen(wx.Pen(wx.BLACK))
289
        dc.SetPen(wx.Pen(wx.BLACK))
272
        dc.SetBrush(wx.Brush( wx.BLACK, wx.SOLID ) )
290
        dc.SetBrush(wx.Brush( wx.BLACK, wx.SOLID ) )
273
       
291
       
274
        sx, sy = mDataDict["scaledXY"] #scaled x,y of closest point
292
        sx, sy = mDataDict["scaledXY"] #scaled x,y of closest point
275
        dc.DrawRectangle( sx-5,sy-5, 10, 10)  #10by10 square centered on point
293
        dc.DrawRectangle( sx-5,sy-5, 10, 10)  #10by10 square centered on point
276
        px,py = mDataDict["pointXY"]
294
        px,py = mDataDict["pointXY"]
277
        cNum = mDataDict["curveNum"]
295
        cNum = mDataDict["curveNum"]
278
        pntIn = mDataDict["pIndex"]
296
        pntIn = mDataDict["pIndex"]
279
        legend = mDataDict["legend"]
297
        legend = mDataDict["legend"]
280
        #make a string to display
298
        #make a string to display
281
        s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" %(cNum, legend, px, py, pntIn)
299
        s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" %(cNum, legend, px, py, pntIn)
282
        dc.DrawText(s, sx , sy+1)
300
        dc.DrawText(s, sx , sy+1)
283
        # -----------
301
        # -----------
284
 
302
 
285
 
303
 
286
    def onNewTest(self, test):
304
    def onNewTest(self, test):
287
        index = self.TestListCtrl.InsertStringItem(sys.maxint, test.descr)
305
        index = self.TestListCtrl.InsertStringItem(sys.maxint, test.descr)
288
        self.TestListCtrl.SetStringItem(index, 1, str(test.speed))
306
        self.TestListCtrl.SetStringItem(index, 1, str(test.speed))
289
        self.TestListCtrl.SetStringItem(index, 2, test.channel)
307
        self.TestListCtrl.SetStringItem(index, 2, test.channel)
-
 
308
 
-
 
309
        vv = int(test.getVibValue())
-
 
310
        vvs = "|%s| (%d)" % ("----------------------------------------------------------------------------------------------------"[0:min(vv,100)], vv)
290
        self.TestListCtrl.SetStringItem(index, 3, str(test.getVibValue()))
311
        self.TestListCtrl.SetStringItem(index, 3, vvs)
291
        if (index == 0):
312
        if (index == 0):
292
            self.TestListCtrl.Select(index)
313
            self.TestListCtrl.Select(index)
293
 
314
 
294
 
315
 
295
    def OnTestSelected(self, event):
316
    def OnTestSelected(self, event):
296
         testId = event.m_itemIndex
317
         testId = event.m_itemIndex
297
         print "Test Selected id=%d" % (testId)
318
         print "Test Selected id=%d" % (testId)
298
         self.activeTestId = testId
319
         self.activeTestId = testId
299
         self.drawGraph()
320
         self.drawGraph()
300
 
321
 
301
    def drawGraph(self):
322
    def drawGraph(self):
302
         vibTest = self.app.getTest(self.activeTestId)
-
 
303
         nb = vibTest.getDataLen()
-
 
-
 
323
         
304
         y = int(self.yAxisChoice.GetStringSelection())
324
         y = int(self.yAxisChoice.GetStringSelection())
305
 
325
 
306
         if self.graphTypeChoice.GetSelection() == 0:
-
 
307
             xydata = _Numeric.linspace(0,0.09*nb,2*nb)
-
 
308
             xydata.shape = (nb, 2)
-
 
309
             xydata[:,1] = vibTest.getRawData()
-
 
310
             line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
-
 
311
   
-
 
312
             title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
-
 
313
             self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
-
 
-
 
326
         nbSelected = self.TestListCtrl.SelectedItemCount
314
             self.client.SetEnableGrid('Horizontal')
327
 
-
 
328
         if nbSelected > 1:
-
 
329
             self.graphTypeChoice.Disable()
315
 
330
             x = 1
316
         if self.graphTypeChoice.GetSelection() == 1:
331
             data = []
-
 
332
             idx = self.TestListCtrl.GetFirstSelected()
-
 
333
             while idx != -1:
317
             xydata = _Numeric.linspace(0,0.09*nb,2*nb)
334
                 data.append([x,self.app.getTest(idx).getVibValue()])
318
             xydata.shape = (nb, 2)
335
                 x += 1
319
             xydata[:,1] = vibTest.getFilteredData()
-
 
320
             line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
336
                 idx = self.TestListCtrl.GetNextSelected(idx)
-
 
337
             line = wx.lib.plot.PolyLine(data, legend= 'Vibrations', colour='red', width=2)
321
   
338
             markers = wx.lib.plot.PolyMarker(data, legend= '', colour='red', marker='circle',size=2)
322
             title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
339
             title = "Comparing tests"
-
 
340
             self.client.Draw(wx.lib.plot.PlotGraphics([line, markers], title, "Test", "Vibration Value"), xAxis=(1,max(x,10)), yAxis=(0,y))
323
             self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
341
             self.client.SetEnableGrid('Horizontal')
324
             self.client.SetEnableGrid('Horizontal')
342
 
325
 
343
         else:
326
         elif self.graphTypeChoice.GetSelection() == 2:
344
             self.graphTypeChoice.Enable()
-
 
345
             vibTest = self.app.getTest(self.activeTestId)
-
 
346
             nb = vibTest.getDataLen()
-
 
347
 
327
             xydata = _Numeric.linspace(0,5555,nb)
348
             if self.graphTypeChoice.GetSelection() == 0:
-
 
349
                 xydata = _Numeric.linspace(0,0.09*nb,2*nb)
328
             xydata.shape = (nb/2, 2)
350
                 xydata.shape = (nb, 2)
329
             
351
                 xydata[:,1] = vibTest.getRawData()
330
             xydata[:,1] = vibTest.getSpectrum()
352
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
-
 
353
       
-
 
354
                 title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
-
 
355
                 self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
-
 
356
                 self.client.SetEnableGrid('Horizontal')
-
 
357
   
-
 
358
             if self.graphTypeChoice.GetSelection() == 1:
-
 
359
                 xydata = _Numeric.linspace(0,0.09*nb,2*nb)
-
 
360
                 xydata.shape = (nb, 2)
-
 
361
                 xydata[:,1] = vibTest.getFilteredData()
-
 
362
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
-
 
363
       
-
 
364
                 title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
-
 
365
                 self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
-
 
366
                 self.client.SetEnableGrid('Horizontal')
-
 
367
   
-
 
368
             elif self.graphTypeChoice.GetSelection() == 2:
-
 
369
                 xydata = _Numeric.linspace(0,5555,nb)
-
 
370
                 xydata.shape = (nb/2, 2)
-
 
371
                 
-
 
372
                 xydata[:,1] = vibTest.getSpectrum()
331
 
373
   
332
             line = wx.lib.plot.PolyLine(xydata, legend= 'Spectrum', colour='red')
374
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Spectrum', colour='red')
333
             markers = wx.lib.plot.PolyMarker(xydata, legend= '', colour='red', marker='circle',size=2)
375
                 markers = wx.lib.plot.PolyMarker(xydata, legend= '', colour='red', marker='circle',size=2)
334
   
376
       
335
             title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
377
                 title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
336
             self.client.Draw(wx.lib.plot.PlotGraphics([line,markers], title, "Freq (Hz)", "Acc"), xAxis=(0,200), yAxis= (-0,y))
378
                 self.client.Draw(wx.lib.plot.PlotGraphics([line,markers], title, "Freq (Hz)", "Acc"), xAxis=(0,200), yAxis= (-0,y))
337
             self.client.SetEnableGrid(True)
379
                 self.client.SetEnableGrid(True)
338
 
380
 
339
 
381
 
340
    def OnImport(self, event): # wxGlade: MainFrame.<event_handler>
382
    def OnImport(self, event): # wxGlade: MainFrame.<event_handler>
341
        dlg = wx.FileDialog(
383
        dlg = wx.FileDialog(
342
            self, message="Choose a file",
384
            self, message="Choose a file",
343
            defaultDir=os.getcwd(),
385
            defaultDir=os.getcwd(),
344
            defaultFile="*.txt",
386
            defaultFile="*.txt",
345
            wildcard="",
387
            wildcard="",
346
            style=wx.OPEN | wx.CHANGE_DIR
388
            style=wx.OPEN | wx.CHANGE_DIR
347
            )
389
            )
348
        if dlg.ShowModal() == wx.ID_OK:
390
        if dlg.ShowModal() == wx.ID_OK:
349
            paths = dlg.GetPaths();
391
            paths = dlg.GetPaths();
350
            self.app.Import(paths[0])
392
            self.app.Import(paths[0])
351
        dlg.Destroy()
393
        dlg.Destroy()
352
 
394
 
353
    def onYAxisChange(self, event): # wxGlade: MainFrame.<event_handler>
395
    def onYAxisChange(self, event): # wxGlade: MainFrame.<event_handler>
354
        self.drawGraph()
396
        self.drawGraph()
355
 
397
 
356
    def onGraphTypeChange(self, event): # wxGlade: MainFrame.<event_handler>
398
    def onGraphTypeChange(self, event): # wxGlade: MainFrame.<event_handler>
357
        self.drawGraph()
399
        self.drawGraph()
358
 
400
 
359
    def onClear(self, event): # wxGlade: MainFrame.<event_handler>
401
    def onClear(self, event): # wxGlade: MainFrame.<event_handler>
360
        print "Event handler `onClear' not implemented"
402
        print "Event handler `onClear' not implemented"
361
        event.Skip()
403
        event.Skip()
-
 
404
 
-
 
405
    def OnSettings(self, event): # wxGlade: MainFrame.<event_handler>
-
 
406
        dlg = SettingsDialog(self, -1, "Sample Dialog", size=(350, 200),
-
 
407
                         #style=wx.CAPTION | wx.SYSTEM_MENU | wx.THICK_FRAME,
-
 
408
                         style=wx.DEFAULT_DIALOG_STYLE, # & ~wx.CLOSE_BOX
-
 
409
                         )
-
 
410
        dlg.CenterOnScreen()
-
 
411
 
-
 
412
        # this does not return until the dialog is closed.
-
 
413
        val = dlg.ShowModal()
-
 
414
 
-
 
415
        dlg.Destroy()
362
 
416
 
-
 
417
# end of class MainFrame
-
 
418
 
-
 
419
class Setting:
-
 
420
    def __init__(self, descr, defaultValue):
363
# end of class MainFrame
421
        self.descr = descr
364
 
422
        self.value = defaultValue
365
 
423
 
366
class VibTest:
424
class VibTest:
367
    def __init__(self, descr, motor, speed, channel, rawData):
425
    def __init__(self, descr, motor, speed, channel, rawData):
368
        self.descr = descr
426
        self.descr = descr
369
        self.motor = motor
427
        self.motor = motor
370
        self.speed = speed
428
        self.speed = speed
371
        self.channel = channel
429
        self.channel = channel
372
 
430
 
373
        self.dataLen = len(rawData)
431
        self.dataLen = len(rawData)
374
 
432
 
375
        self.rawData = _Numeric.array(rawData)
433
        self.rawData = _Numeric.array(rawData)
376
        self.dc = self.rawData.mean()
434
        self.dc = self.rawData.mean()
377
        self.rawData -= self.dc
435
        self.rawData -= self.dc
378
 
436
 
379
        self.fft = _Numeric.fft.rfft(self.rawData)
437
        self.fft = _Numeric.fft.rfft(self.rawData)
380
 
438
 
381
        self.spectrum = None
439
        self.spectrum = None
382
        self.filteredData = None
440
        self.filteredData = None
383
       
441
       
384
        self.vibValue = None
442
        self.vibValue = None
385
       
443
       
386
    def getDescr(self):
444
    def getDescr(self):
387
        return self.Descr
445
        return self.Descr
388
 
446
 
389
    def getRawData(self):
447
    def getRawData(self):
390
        return self.rawData
448
        return self.rawData
391
 
449
 
392
    def getDataLen(self):
450
    def getDataLen(self):
393
        return self.dataLen
451
        return self.dataLen
394
 
452
 
395
    def getSpectrum(self):
453
    def getSpectrum(self):
396
        if self.spectrum == None:
454
        if self.spectrum == None:
397
            self.spectrum = _Numeric.absolute(self.fft[1:self.dataLen/2+1]) / (self.dataLen/2)
455
            self.spectrum = _Numeric.absolute(self.fft[1:self.dataLen/2+1]) / (self.dataLen/2)
398
        return self.spectrum
456
        return self.spectrum
399
 
457
 
400
    def getFilteredData(self):
458
    def getFilteredData(self):
401
        if self.filteredData == None:
459
        if self.filteredData == None:
402
            tmpfft = self.fft.copy()
460
            tmpfft = self.fft.copy()
403
            for i in range(0,5):
461
            for i in range(0,5):
404
                tmpfft[i] = 0
462
                tmpfft[i] = 0
405
            for i in range(30, len(tmpfft)):
463
            for i in range(30, len(tmpfft)):
406
                tmpfft[i] = 0
464
                tmpfft[i] = 0
407
            self.filteredData = _Numeric.fft.irfft(tmpfft)
465
            self.filteredData = _Numeric.fft.irfft(tmpfft)
408
        return self.filteredData
466
        return self.filteredData
409
       
467
       
410
    def getVibValue(self):
468
    def getVibValue(self):
411
      if self.vibValue == None:
469
      if self.vibValue == None:
412
        fd = self.getFilteredData();
470
        fd = self.getFilteredData();
413
        self.vibValue = max(fd)-min(fd)
471
        self.vibValue = max(fd)-min(fd)
414
      return self.vibValue
472
      return self.vibValue
-
 
473
 
-
 
474
 
415
 
475
 
-
 
476
class App(wx.App):
-
 
477
 
-
 
478
    SETTINGSFILE = "settings.cfg"
416
class App(wx.App):
479
 
417
    def __init__(self, par):
480
    def __init__(self, par):
418
        self.VibTests = []
-
 
419
 
481
        self.VibTests = []
-
 
482
        wx.App.__init__(self, par)
-
 
483
 
-
 
484
        # Init settings
-
 
485
        self.settings={}
-
 
486
        self.settings["serialPort"] = Setting("SerialPort", "COM1")
-
 
487
        self.settings["hpf"] = Setting("HP Filter cutoff (Hz)", 50)
-
 
488
        self.settings["lpf"] = Setting("LP Filter cutoff (Hz)", 400)
-
 
489
 
420
        wx.App.__init__(self, par)
490
        self.readSettings()
421
 
491
 
422
        if len(sys.argv)>1:
492
        if len(sys.argv)>1:
423
            self.Import(sys.argv[1])
493
            self.Import(sys.argv[1])
424
 
494
 
-
 
495
 
-
 
496
    def readSettings(self):
-
 
497
        print "Reading settings"
-
 
498
        cp = ConfigParser.ConfigParser()
-
 
499
 
-
 
500
        try:
-
 
501
            cp.read(App.SETTINGSFILE)
-
 
502
            for setting in cp.items("DEFAULT"):
-
 
503
                print " ",setting
-
 
504
                try:
-
 
505
                    self.settings[setting[0]].value = setting[1]
-
 
506
                except:
-
 
507
                    print "WARNING, unknown setting"
-
 
508
        except:
-
 
509
            print "ERROR reading settingsfile"
-
 
510
 
-
 
511
 
-
 
512
    def storeSettings(self):
-
 
513
        print "Storing settings"
-
 
514
 
-
 
515
        cp = ConfigParser.ConfigParser()
-
 
516
        for setting in self.settings.iteritems():
-
 
517
            cp.set("", setting[0], setting[1].value)
-
 
518
 
-
 
519
        file = open(App.SETTINGSFILE, "w")
-
 
520
        cp.write(file)
-
 
521
        file.close()
425
 
522
 
426
    def AddTest(self, descr, motor, speed, channel, rawData):
523
    def AddTest(self, descr, motor, speed, channel, rawData):
427
        test = VibTest(descr, motor, speed, channel, rawData)
524
        test = VibTest(descr, motor, speed, channel, rawData)
428
        self.VibTests.append(test)
525
        self.VibTests.append(test)
429
        self.frame_1.onNewTest(test)
526
        self.frame_1.onNewTest(test)
430
 
527
 
431
    def getTest(self, testId):
528
    def getTest(self, testId):
432
        return self.VibTests[testId]
529
        return self.VibTests[testId]
433
 
530
 
434
    def OnInit(self):
531
    def OnInit(self):
435
        wx.InitAllImageHandlers()
532
        wx.InitAllImageHandlers()
436
        self.frame_1 = MainFrame(None, -1, "")
533
        self.frame_1 = MainFrame(None, -1, "")
437
        self.frame_1.setApp(self);
534
        self.frame_1.setApp(self);
438
        self.SetTopWindow(self.frame_1)
535
        self.SetTopWindow(self.frame_1)
-
 
536
 
439
 
537
        self.frame_1.CenterOnScreen()
440
        self.frame_1.Show()
538
        self.frame_1.Show()
441
        return 1
539
        return 1
442
 
540
 
443
    def Import(self, filePath):
541
    def Import(self, filePath):
444
       
542
       
445
        print "Importing file \"%s\"" % filePath
543
        print "Importing file \"%s\"" % filePath
446
 
544
 
447
        logfile = open(filePath, "r")
545
        logfile = open(filePath, "r")
448
        data = None
546
        data = None
449
 
547
 
450
        headers = (logfile.readline()).split(',')
548
        headers = (logfile.readline()).split(',')
451
        nbCols = len(headers)
549
        nbCols = len(headers)
452
        print "NbCols =", nbCols
550
        print "NbCols =", nbCols
453
 
551
 
454
        data = []
552
        data = []
455
        descr = []
553
        descr = []
456
        speed = []
554
        speed = []
457
        channel = []
555
        channel = []
458
        for c in range(nbCols):
556
        for c in range(nbCols):
459
            data.append([])
557
            data.append([])
460
            h = headers[c].split(' ')
558
            h = headers[c].split(' ')
461
            descr.append(h[0]);
559
            descr.append(h[0]);
462
            speed.append(h[1]);
560
            speed.append(h[1]);
463
            channel.append(h[2]);
561
            channel.append(h[2]);
464
 
562
 
465
        for line in logfile:
563
        for line in logfile:
466
            values = line.split(',')
564
            values = line.split(',')
467
            for i in range(nbCols):
565
            for i in range(nbCols):
468
                data[i].append(int(values[i]))
566
                data[i].append(int(values[i]))
469
        logfile.close()
567
        logfile.close()
470
 
568
 
471
        for c in range(nbCols):
569
        for c in range(nbCols):
472
            if (len(data[c]) % 2) != 0:
570
            if (len(data[c]) % 2) != 0:
473
                data[c].append(data[c][-1])
571
                data[c].append(data[c][-1])
474
            self.AddTest(descr[c], 0, int(speed[c]), channel[c], data[c])
572
            self.AddTest(descr[c], 0, int(speed[c]), channel[c], data[c])
475
       
573
       
476
       
574
       
477
           
575
           
478
 
576
 
479
       
577
       
480
# end of class App
578
# end of class App
481
 
579
 
482
if __name__ == "__main__":
580
if __name__ == "__main__":
483
    VibrationTestGui = App(0)
581
    VibrationTestGui = App(0)
484
    VibrationTestGui.MainLoop()
582
    VibrationTestGui.MainLoop()
485
 
583