예제 #1
0
def db10(w):
    """Return x in dB where x is assumed to be a non-power quantity

    >>> w1=Waveform(array([1,2,3]),array([complex(-1,0),complex(0,1),2]))
    >>> db10(w1)
    Waveform(array([1, 2, 3]), array([ 0.        ,  0.        ,  3.01029996]))
        
    """
    return applyfunc(lambda x: 10.0*log10(abs(x)), w, 'db10')
예제 #2
0
def db10(w):
    """Return x in dB where x is assumed to be a non-power quantity

    >>> w1=Waveform(array([1,2,3]),array([complex(-1,0),complex(0,1),2]))
    >>> db10(w1)
    Waveform(array([1, 2, 3]), array([ 0.        ,  0.        ,  3.01029996]))
        
    """
    return applyfunc(lambda x: 10.0*log10(abs(x)), w, 'db10')
예제 #3
0
def db20(w):
    """Return x in dB where x is assumed to be a non-power quantity

    >>> w1=Waveform(array([1,2,3]),array([complex(-1,0),complex(0,1), \
              complex(1,-1)]), ylabel='x')
    >>> db20(w1)
    Waveform(array([1, 2, 3]), array([ 0.        ,  0.        ,  3.01029996]))
    >>> db20(w1).ylabel
    'db20(x)'
        
    """
    return applyfunc(lambda x: 20.0*log10(abs(x)), w, 'db20')
예제 #4
0
def db20(w):
    """Return x in dB where x is assumed to be a non-power quantity

    >>> w1=Waveform(array([1,2,3]),array([complex(-1,0),complex(0,1), \
              complex(1,-1)]), ylabel='x')
    >>> db20(w1)
    Waveform(array([1, 2, 3]), array([ 0.        ,  0.        ,  3.01029996]))
    >>> db20(w1).ylabel
    'db20(x)'
        
    """
    return applyfunc(lambda x: 20.0*log10(abs(x)), w, 'db20')
예제 #5
0
def phase(w):
    """Return argument in degrees of complex values

    Example:

    >>> phase(1)
    0.0
    >>> phase(complex(0,1))
    90.0
    >>> phase(Waveform((range(3),), array([1, complex(1,1), complex(0,-1)])))
    Waveform(array([0, 1, 2]), array([  0.,  45., -90.]))

    """
    def phase(x): 
        return np.angle(w, deg=True)
    return applyfunc(phase , w)
예제 #6
0
def phase(w):
    """Return argument in degrees of complex values

    Example:

    >>> phase(1)
    0.0
    >>> phase(complex(0,1))
    90.0
    >>> phase(Waveform((range(3),), array([1, complex(1,1), complex(0,-1)])))
    Waveform(array([0, 1, 2]), array([  0.,  45., -90.]))

    """
    def phase(x): 
        return np.angle(w, deg=True)
    return applyfunc(phase , w)