Subversion Repositories Projects

Rev

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

Rev 643 Rev 644
Line 945... Line 945...
945
            self.filteredData = None  
945
            self.filteredData = None  
Line 946... Line 946...
946
           
946
           
947
        if self.filteredData == None:
947
        if self.filteredData == None:
948
            tmpfft = self.fft.copy()
948
            tmpfft = self.fft.copy()
949
            fc = (float(fc1))/(FS/2)*len(tmpfft)
949
            fc = (float(fc1))/(FS/2)*len(tmpfft)
950
            print "fc1=%d => fc=%d" % (fc1,fc)
950
            print "fc1=%d => fc=%f" % (fc1,fc)
951
            for i in range(0,int(fc)):
951
            for i in range(0,int(fc)+2):
952
                tmpfft[i] = 0
952
                tmpfft[i] = 0
953
            fc = (float(fc2))/(FS/2)*len(tmpfft)
953
            fc = (float(fc2))/(FS/2)*len(tmpfft)
954
            print "fc2=%d => fc=%d" % (fc2,fc)
954
            print "fc2=%d => fc=%f" % (fc2,fc)
955
            for i in range(int(fc), len(tmpfft)):
955
            for i in range(int(fc)+2, len(tmpfft)):
956
                tmpfft[i] = 0
956
                tmpfft[i] = 0
957
            self.filteredData = _Numeric.fft.irfft(tmpfft)
957
            self.filteredData = _Numeric.fft.irfft(tmpfft)
958
            self.fc1 = fc1
958
            self.fc1 = fc1
Line 982... Line 982...
982
        self.settings={}
982
        self.settings={}
983
        self.settings["serialport"] = Setting("Serial Port", "COM1")
983
        self.settings["serialport"] = Setting("Serial Port", "COM1")
984
        self.settings["startupspeed"] = Setting("Motor Startup Speed", 25)
984
        self.settings["startupspeed"] = Setting("Motor Startup Speed", 25)
985
        self.settings["startupsettling"] = Setting("Motor Startup Setting time (s)", 3)
985
        self.settings["startupsettling"] = Setting("Motor Startup Setting time (s)", 3)
986
        self.settings["serialport"] = Setting("Serial Port", "COM1")
986
        self.settings["serialport"] = Setting("Serial Port", "COM1")
987
        self.settings["hpf"] = Setting("HP Filter cutoff (Hz)", 50)
987
        self.settings["hpf"] = Setting("HP Filter cutoff (Hz)", 40)
988
        self.settings["lpf"] = Setting("LP Filter cutoff (Hz)", 400)
988
        self.settings["lpf"] = Setting("LP Filter cutoff (Hz)", 400)
989
        self.settings["minvoltage"] = Setting("Minimum Bettery Voltage (0=Automatic) (V) ", 0)
989
        self.settings["minvoltage"] = Setting("Minimum Bettery Voltage (0=Automatic) (V) ", 0)
990
        self.settings["maxvoltage"] = Setting("Maximum Bettery Voltage (0=Automatic) (V) ", 0)
990
        self.settings["maxvoltage"] = Setting("Maximum Bettery Voltage (0=Automatic) (V) ", 0)
Line 999... Line 999...
999
    def readSettings(self):
999
    def readSettings(self):
1000
        print "Reading settings"
1000
        print "Reading settings"
1001
        cp = ConfigParser.ConfigParser()
1001
        cp = ConfigParser.ConfigParser()
Line 1002... Line 1002...
1002
 
1002
 
1003
        try:
1003
        try:
1004
            cp.read(App.SETTINGSFILE)
1004
            cp.read("%s/%s" % (rootPath, App.SETTINGSFILE))
1005
            for setting in cp.items("DEFAULT"):
1005
            for setting in cp.items("DEFAULT"):
1006
                print " ",setting
1006
                print " ",setting
1007
                try:
1007
                try:
1008
                    self.settings[setting[0]].set(setting[1])
1008
                    self.settings[setting[0]].set(setting[1])
Line 1017... Line 1017...
1017
 
1017
 
1018
        cp = ConfigParser.ConfigParser()
1018
        cp = ConfigParser.ConfigParser()
1019
        for setting in self.settings.iteritems():
1019
        for setting in self.settings.iteritems():
Line 1020... Line 1020...
1020
            cp.set("", setting[0], setting[1].value)
1020
            cp.set("", setting[0], setting[1].value)
1021
 
1021
 
1022
        file = open(App.SETTINGSFILE, "w")
1022
        file = open("%s/%s" % (rootPath, App.SETTINGSFILE), "w")
Line 1023... Line 1023...
1023
        cp.write(file)
1023
        cp.write(file)