Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 648 → Rev 649

/VibrationTest/trunk/VibrationTest/VibrationTestGui.py
512,7 → 512,7
self.TestListCtrl.SetStringItem(index, 2, str(test.speed))
self.TestListCtrl.SetStringItem(index, 3, test.channel)
 
vv = test.getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value)
vv = test.getVibValue()
vvs = "|%s| (%.1f)" % ("----------------------------------------------------------------------------------------------------"[0:min(int(vv+1)/2,100)], vv)
self.TestListCtrl.SetStringItem(index, 4, vvs)
 
567,7 → 567,7
data = []
x=1
for t in s[1:]:
data.append([x,self.app.getTest(t).getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value)])
data.append([x,self.app.getTest(t).getVibValue()])
x += 1
lines.append(wx.lib.plot.PolyLine(data, legend= s[0], colour=COLORS[cCnt], width=2))
lines.append(wx.lib.plot.PolyMarker(data, legend= "", colour=COLORS[cCnt], marker='circle',size=2))
603,7 → 603,7
if self.graphTypeChoice.GetSelection() == 1:
xydata = _Numeric.linspace(0,0.09*nb,2*nb)
xydata.shape = (nb, 2)
xydata[:,1] = vibTest.getFilteredData(self.app.settings["hpf"].value, self.app.settings["lpf"].value)
xydata[:,1] = vibTest.getFilteredData()
line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
765,7 → 765,7
print "about"
info = wx.AboutDialogInfo()
info.Name = "- MK Vibration Test - "
info.Version = "v0.9 RC1"
info.Version = "v0.9 RC2"
info.Copyright = ""
info.Developers=["Frederic Goddeeris Frederic@rc-flight.be"]
info.Description = "Please consult the WIKI page for a complete description of the tool:"
786,7 → 786,7
txt = ""
idx = self.TestListCtrl.GetFirstSelected()
while idx != -1:
txt += ("%d\n" % self.app.getTest(idx).getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value))
txt += ("%d\n" % self.app.getTest(idx).getVibValue())
idx = self.TestListCtrl.GetNextSelected(idx)
clipdata.SetText(txt)
wx.TheClipboard.Open()
927,6 → 927,9
 
class VibTest:
useRms = True
fc1 = None
fc2 = None
def __init__(self, descr, voltage, motor, speed, channel, rawData):
self.descr = descr
945,8 → 948,6
 
self.spectrum = None
self.filteredData = None
self.fc1 = None
self.fc2 = None
self.vibValue = None
968,32 → 969,24
self.filteredData = None
self.vibValue = None
 
def getFilteredData(self, fc1, fc2):
if self.fc1 != fc1 or self.fc2 != fc2:
self.filteredData = None
def getFilteredData(self):
if self.filteredData == None:
tmpfft = self.fft.copy()
fc = (float(fc1))/(FS/2)*len(tmpfft)
print "fc1=%d => fc=%f" % (fc1,fc)
fc = (float(self.fc1))/(FS/2)*len(tmpfft)
print "fc1=%d => fc=%f" % (self.fc1, fc)
for i in range(0,int(fc)+2):
tmpfft[i] = 0
fc = (float(fc2))/(FS/2)*len(tmpfft)
print "fc2=%d => fc=%f" % (fc2,fc)
fc = (float(self.fc2))/(FS/2)*len(tmpfft)
print "fc2=%d => fc=%f" % (self.fc2,fc)
for i in range(int(fc)+2, len(tmpfft)):
tmpfft[i] = 0
self.filteredData = _Numeric.fft.irfft(tmpfft)
self.fc1 = fc1
self.fc2 = fc2
return self.filteredData
def getVibValue(self, fc1, fc2):
if self.fc1 != fc1 or self.fc2 != fc2:
self.vibValue = None
def getVibValue(self):
if self.vibValue == None:
fd = self.getFilteredData(fc1, fc2)[100:-100];
fd = self.getFilteredData()[100:-100];
if self.useRms:
print "RMS"
self.vibValue = math.sqrt(sum([x*x for x in fd])/len(fd))*2*math.sqrt(2)
1062,10 → 1055,15
def onSettingsChanged(self, store):
if store:
self.storeSettings()
if self.settings["calcmethod"].value == "rms":
VibTest.useRms = True
else:
VibTest.useRms = False
VibTest.fc1 = self.settings["hpf"].value
VibTest.fc2 = self.settings["lpf"].value
for test in self.VibTests:
test.refresh()
self.frame_1.refreshData()