Ejemplo n.º 1
0
    def __init__(self, R1, R2, fp, fs, gpass, gstop, ftype, btype):
        """ Variables init """
        Filter.__init__(self, fp, fs, gpass, gstop, ftype, btype)
        self.R1 = R1
        self.R2 = R2
        self.units = Units()

        """ TEST DATA FOR CHEBY """
        #self.gpass = 1.5
        #self.ord = 4
        #self.wn = np.pi * 100000.0

        """ TEST DATA FOR BUTTER """
        #self.ord = 5
        #self.wn = 100000.0

        if ftype == 'butter':
            self.alpha = self.alpha()
        elif ftype in ('cheby1', 'cheby2'):
            self.E = self.epsilon()
            self.gamma = self.gamma()
            self.a = self.a_help_var()
            self.a_ = self.a_prim_help_var()

            print("gamma ", self.gamma)
            print("epsilon ", self.E)
            print("a", self.a)
            print("a_ ", self.a_)
           
        #Frequency to pulsation
        self.wn = self.wn * np.pi * 2    
Ejemplo n.º 2
0
    def __init__(self, R1, R2, fp, fs, gpass, gstop, ftype, btype):
        """ Variables init """
        Filter.__init__(self, fp, fs, gpass, gstop, ftype, btype)
        self.R1 = R1
        self.R2 = R2
        self.units = Units()

        """ TEST DATA FOR CHEBY """
        #self.gpass = 1.5
        #self.ord = 4
        #self.wn = np.pi * 100000.0

        """ TEST DATA FOR BUTTER """
        #self.ord = 5
        #self.wn = 100000.0

        if ftype == 'butter':
            self.alpha = self.alpha()
        elif ftype in ('cheby1', 'cheby2'):
            self.E = self.epsilon()
            self.gamma = self.gamma()
            self.a = self.a_help_var()
            self.a_ = self.a_prim_help_var()

            print "gamma ", self.gamma
            print "epsilon ", self.E
            print "a", self.a
            print "a_ ", self.a_
           
        #Frequency to pulsation
        self.wn = self.wn * np.pi * 2    
Ejemplo n.º 3
0
    def OnClick(self, event):
        """ Event bind to 'Generate' button """
        #Validation
        valid = self.validation()
        if valid == True:
            pass
        else:
            return None
	
	pyplot.close("all")
        filter_ = Filter(self.fp, self.fs, self.gpass, self.gstop, ftype=self.ftype, btype=self.btype)
        filter_.step_response()
        filter_.phase_response()
        filter_.poles_zeros() 
        filter_.freq_response()

        if self.ftype == "ellip":
            pass
        else:
            ladder = LCladder(self.R1, self.R2, self.fp, self.fs, self.gpass, self.gstop, ftype=self.ftype, btype=self.btype) 
            if filter_.btype == "lowpass":
                if self.R1 == self.R2:
                    lc_ladder_elements = ladder.load_matched()
                else:
                    lc_ladder_elements = ladder.load_not_matched()
                    
                scheme = Scheme(self.R1, self.R2, filter_.ord)
                scheme.design(lc_ladder_elements) 
                
                frame = wx.Frame(None, size=(scheme.img_size[0], 250))
                panel = SchemePanel(frame)
                frame.Show()
        pyplot.show()
Ejemplo n.º 4
0
    def OnClick(self, event):
        """ Event bind to 'Generate' button """
        # Validation
        valid = self.validation()
        if valid == True:
            pass
        else:
            return None

        pyplot.close("all")
        filter_ = Filter(self.fp,
                         self.fs,
                         self.gpass,
                         self.gstop,
                         ftype=self.ftype,
                         btype=self.btype)
        filter_.step_response()
        filter_.phase_response()
        filter_.poles_zeros()
        filter_.freq_response()

        if self.ftype == "ellip":
            pass
        else:
            ladder = LCladder(self.R1,
                              self.R2,
                              self.fp,
                              self.fs,
                              self.gpass,
                              self.gstop,
                              ftype=self.ftype,
                              btype=self.btype)
            if filter_.btype == "lowpass":
                if self.R1 == self.R2:
                    lc_ladder_elements = ladder.load_matched()
                else:
                    lc_ladder_elements = ladder.load_not_matched()

                scheme = Scheme(self.R1, self.R2, filter_.ord)
                scheme.design(lc_ladder_elements)

                frame = wx.Frame(None, size=(scheme.img_size[0], 250))
                panel = SchemePanel(frame)
                frame.Show()
        pyplot.show()
Ejemplo n.º 5
0
def main():
    """Responds to any HTTP request.
    Args:
        request (flask.Request): HTTP request object.
    Returns:
        The response text or any set of values that can be turned into a
        Response object using
        #flask.Flask.make_response>`.
        `make_response <http://flask.pocoo.org/docs/1.0/api/
    """
    response = Filter(request)
    return response