Rev 594 | Rev 599 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 594 | Rev 596 | ||
---|---|---|---|
Line 219... | Line 219... | ||
219 | #make a string to display |
219 | #make a string to display |
220 | s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" %(cNum, legend, px, py, pntIn) |
220 | s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" %(cNum, legend, px, py, pntIn) |
221 | dc.DrawText(s, sx , sy+1) |
221 | dc.DrawText(s, sx , sy+1) |
222 | # ----------- |
222 | # ----------- |
Line -... | Line 223... | ||
- | 223 | ||
- | 224 | ||
- | 225 | def onNewTest(self, test): |
|
- | 226 | index = self.TestListCtrl.InsertStringItem(sys.maxint, test.descr) |
|
- | 227 | self.TestListCtrl.SetStringItem(index, 1, str(test.speed)) |
|
- | 228 | self.TestListCtrl.SetStringItem(index, 2, test.channel) |
|
- | 229 | self.TestListCtrl.SetStringItem(index, 3, "OK") |
|
- | 230 | ||
223 | 231 | ||
224 | def OnTestSelected(self, event): |
232 | def OnTestSelected(self, event): |
225 | testId = event.m_itemIndex |
233 | testId = event.m_itemIndex |
226 | print "Test Selected id=%d" % (testId) |
234 | print "Test Selected id=%d" % (testId) |
227 | self.activeTestId = testId |
235 | self.activeTestId = testId |
Line 235... | Line 243... | ||
235 | #self.client.Clear() |
243 | #self.client.Clear() |
236 | xydata = _Numeric.linspace(0,0.09*nb,2*nb) |
244 | xydata = _Numeric.linspace(0,0.09*nb,2*nb) |
237 | xydata.shape = (nb, 2) |
245 | xydata.shape = (nb, 2) |
238 | xydata[:,1] = vibTest.getRawData() |
246 | xydata[:,1] = vibTest.getRawData() |
239 | line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red') |
247 | line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red') |
- | 248 | ||
- | 249 | title = "%s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed) |
|
240 | self.client.Draw(wx.lib.plot.PlotGraphics([line],"Graph Title", "Time (ms)", "Acc"), yAxis= (-y,y)) |
250 | self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y)) |
241 | self.client.SetEnableGrid('Horizontal') |
251 | self.client.SetEnableGrid('Horizontal') |
Line 242... | Line 252... | ||
242 | 252 | ||
243 | 253 | ||
Line 249... | Line 259... | ||
249 | 259 | ||
Line 250... | Line 260... | ||
250 | # end of class MainFrame |
260 | # end of class MainFrame |
251 | 261 | ||
252 | 262 | ||
253 | class VibTest: |
263 | class VibTest: |
254 | def __init__(self, descr, motor, speed, rawData): |
264 | def __init__(self, descr, motor, speed, channel, rawData): |
- | 265 | self.descr = descr |
|
255 | self.descr = descr |
266 | self.motor = motor |
256 | self.motor = motor |
267 | self.speed = speed |
257 | self.speed = speed |
268 | self.channel = channel |
258 | self.rawData = _Numeric.array(rawData) |
269 | self.rawData = _Numeric.array(rawData) |
Line 275... | Line 286... | ||
275 | self.VibTests = [] |
286 | self.VibTests = [] |
Line 276... | Line 287... | ||
276 | 287 | ||
Line 277... | Line 288... | ||
277 | wx.App.__init__(self, par) |
288 | wx.App.__init__(self, par) |
278 | 289 | ||
279 | 290 | ||
280 | def AddTest(self, descr, motor, speed, rawData): |
- | |
281 | test = VibTest(descr, motor, speed, rawData) |
- | |
282 | self.VibTests.append(test) |
291 | def AddTest(self, descr, motor, speed, channel, rawData): |
Line 283... | Line 292... | ||
283 | 292 | test = VibTest(descr, motor, speed, channel, rawData) |
|
284 | index = self.frame_1.TestListCtrl.InsertStringItem(sys.maxint, test.descr) |
293 | self.VibTests.append(test) |
Line 285... | Line 294... | ||
285 | self.frame_1.TestListCtrl.SetStringItem(index, 3, "OK") |
294 | self.frame_1.onNewTest(test) |
Line 295... | Line 304... | ||
295 | 304 | ||
296 | self.frame_1.Show() |
305 | self.frame_1.Show() |
Line 297... | Line 306... | ||
297 | return 1 |
306 | return 1 |
- | 307 | ||
- | 308 | def Import(self): |
|
- | 309 | #filePath = "./unbal200.txt" |
|
298 | 310 | filePath = "./nikivan.txt" |
|
- | 311 | ||
299 | def Import(self): |
312 | print "Import %s" % filePath |
300 | print "Import" |
313 | |
- | 314 | logfile = open(filePath, "r") |
|
- | 315 | data = None |
|
- | 316 | ||
- | 317 | headers = (logfile.readline()).split(',') |
|
- | 318 | nbCols = len(headers) |
|
- | 319 | print "NbCols =", nbCols |
|
- | 320 | ||
- | 321 | data = [] |
|
- | 322 | descr = [] |
|
- | 323 | speed = [] |
|
- | 324 | channel = [] |
|
- | 325 | for c in range(nbCols): |
|
- | 326 | data.append([]) |
|
- | 327 | h = headers[c].split(' ') |
|
- | 328 | print h |
|
- | 329 | descr.append(h[0]); |
|
- | 330 | speed.append(h[1]); |
|
301 | logfile = open("./unbal200.txt", "r") |
331 | channel.append(h[2]); |
302 | data = None |
332 | |
303 | for line in logfile: |
- | |
304 | values = line.split(',') |
- | |
305 | if data == None: |
- | |
306 | nbCols = len(values) |
- | |
307 | print "%d cols" % nbCols |
- | |
308 | data = [] |
- | |
309 | for i in range(nbCols): |
- | |
310 | data.append([]) |
333 | for line in logfile: |
311 | else: |
334 | values = line.split(',') |
312 | for i in range(nbCols): |
335 | for i in range(nbCols): |
- | 336 | data[i].append(int(values[i])) |
|
313 | data[i].append(int(values[i])) |
337 | logfile.close() |
314 | logfile.close() |
338 |