mwavepy.mathFunctions
index
/usr/local/lib/python2.6/dist-packages/mwavepy/mathFunctions.py

Provides commonly used math functions.

 
Modules
       
numpy
scipy.signal

 
Functions
       
complex2MagPhase(complx, deg=False)
complex2ReIm(complx)
complex2Scalar(input)
# old functions just for reference
complex2dB(complx)
complex_2_db(input)
returns the magnitude in dB of a complex number. 
 
returns:
        20*log10(|z|)
where z is a complex number
complex_2_degree(input)
returns the angle complex number in radians.
complex_2_magnitude(input)
returns the magnitude of a complex number.
complex_2_quadrature(z)
takes a complex number and returns quadrature, which is (length, arc-length from real axis)
complex_2_radian(input)
returns the angle complex number in radians.
complex_components(z)
break up a complex array into all possible scalar components
 
takes: complex ndarray 
return:
        c_real: real part
        c_imag: imaginary part
        c_angle: angle in degrees
        c_mag:  magnitude
        c_arc:  arclength from real axis, angle*magnitude
db_2_magnitude(input)
converts db to normal magnitude
 
returns:
        10**((z)/20.)
where z is a complex number
db_2_np(x)
converts a value in nepers to dB
degree_2rad_(deg)
dirac_delta(x)
the dirac function.
 
can take numpy arrays or numbers
returns 1 or 0
magnitude_2_db(input)
converts magnitude to db 
 
 db is given by 
        20*log10(|z|)
where z is a complex number
neuman(x)
neumans number
 
2-dirac_delta(x)
np_2_db(x)
converts a value in dB to neper's
null(A, eps=1.0000000000000001e-15)
 calculates the null space of matrix A.
i found this on stack overflow.
psd2TimeDomain(f, y, windowType='hamming')
convert a one sided complex spectrum into a real time-signal.
takes 
        f: frequency array, 
        y: complex PSD arary 
        windowType: windowing function, defaults to rect
 
returns in the form:
        [timeVector, signalVector]
timeVector is in inverse units of the input variable f,
if spectrum is not baseband then, timeSignal is modulated by 
        exp(t*2*pi*f[0])
so keep in mind units, also due to this f must be increasing left to right
radian_2_degree(rad)
scalar2Complex(input)

 
Data
        pi = 3.1415926535897931