TUsignal

class pylayers.signal.bsignal.TUsignal(x=array([], dtype=float64), y=array([], dtype=float64), label=[])[source]

Bases: pylayers.signal.bsignal.TBsignal, pylayers.signal.bsignal.Usignal

Uniform signal in time domain

This class inheritates from TBsignal and Usignal

The signal can either be complex or real

Methods Summary

Efirst_loc(nint, E0)

find the Efirst using the mean like

EnImpulse(**kwargs)

Create an energy normalized Gaussian impulse (Usignal)

MaskImpulse(**kwargs)

MaskImpulse : Create an Energy normalized Gaussian impulse (Usignal)

Yadd_zeros2l(N)

time domain extension on the left with N zeros

Yadd_zeros2r(N)

time domain extension on right with N zeros

align(u2)

align two TUsignal on a same base

convolve(u)

time domain convolution

correlate(s[, normalized])

correlates with an other TUsignal

corrgauss(sigma)

Correlate TUsignal with a normalized gaussian of standard deviation sigma

diff()

numerical differentiation TUsignal

esd([mode])

Calculate the energy spectral density of the U signal

fft([shift])

forward fast Fourier transform of TUsignal

fftsh()

returns an FHsignal

filter([order, wp, ws, ftype])

TUsignal filtering

ft()

return the associated FUsignal

ftshift()

return the associated FUsignal

info()

display information about TUsignal

psd([Tpns, R, periodic])

calculate TUsignal power spectral density

shift(tau)

shift the Usignal by tau (expressed in the same unit as Bsignal.x)

showpsd([fig, ax, display, PRPns])

show psd

Methods Documentation

Efirst_loc(nint, E0)[source]

find the Efirst using the mean like

nint E0

EnImpulse(**kwargs)[source]

Create an energy normalized Gaussian impulse (Usignal)

fcGHz : float WGHz : float threshdB : float feGHz : float

MaskImpulse(**kwargs)[source]

MaskImpulse : Create an Energy normalized Gaussian impulse (Usignal)

Yadd_zeros2l(N)[source]

time domain extension on the left with N zeros

Ninteger

number of additinal zero values

Yadd_zeros2r

Work only for single y

Yadd_zeros2r(N)[source]

time domain extension on right with N zeros

Ninteger

number of additinal zero values

Yadd_zeros2l

align(u2)[source]

align two TUsignal on a same base

returns a list which contains the two aligned signals

It is assume that both signal u1 and u2 share the same dx This function can be improved regarding time granularity

u2 : TUsignal

TUsignal y extended TU signal, x bases are adjusted

>>> import matplotlib.pylab as plt
>>> from pylayers.signal.bsignal import *
>>> i1 = TUsignal()
>>> i2 = TUsignal()
>>> i1.EnImpulse()
>>> i2.EnImpulse()
>>> i2.translate(-10)
>>> i3 = i1.align(i2)
>>> fig,ax=i3.plot(typ=['v'])
>>> plt.show()

(Source code)

convolve(u)[source]

time domain convolution

correlate(s, normalized=True)[source]

correlates with an other TUsignal

s : TUsignal normalized : boolean

default True

The time step dx should be the same

The chosen time reference is the one of the self signal This means that this function can be used to detect events appearing in the self signal by correlating with signal ..math:s, maximum of the correlation function appears in the proper time of the self signal history.

Interpretation of the correlation levels

We assume that s1 is the self signal and s2 is the correlating signal

s1 = a1 * sn(t-tau) where sn is normalized in energy s2 = a2 * sn(t) ” ” ” ” “

the maximum of correlation appears at time tau and its value is

max (s1.correlate(s2,True)) = a1*a2

In the case of the propagation simulation we have

s1 : the time domain UWB received waveform s2 : the corresponding emitted waveform s2,

To determine the ratio a1/a2 or a2/a1 in order to evaluate the propagation Loss L = 20 log10(a2/a1)

This calculus assumes implicitely that the shape of the transmitted signal has not been modified during the propagation, which is a strong hypothesis. This calculus is then a minorant of the received energy.

L = max(s1.correlate(s2,True)/s1.Energy) with a1**2 = sum(s1**s1)*dx

corrgauss(sigma)[source]

Correlate TUsignal with a normalized gaussian of standard deviation sigma

sigmafloat

standard deviation of Gaussian

diff()[source]

numerical differentiation TUsignal

the number of points is reduced by one

esd(mode='bilateral')[source]

Calculate the energy spectral density of the U signal

modestring

‘unilateral’ | ‘bilateral’

FHsignal : if mode == ‘bilateral’ FUsignal : if mode == ‘unilateral’

FHsignal.unrex

fft(shift=False)[source]

forward fast Fourier transform of TUsignal

shiftboolean

default False

This fft is a scaled fft and takes into account the value of the sampling period.

FHsignal

>>> from pylayers.signal.bsignal import *
>>> e = TUsignal()
>>> e.EnImpulse()
>>> E = e.fft()
fftsh()[source]

returns an FHsignal

This fft is a scaled fft and takes into account the value of the sampling period.

FHsignal : Frequency signal with enforced Hermitian symetry

filter(order=4, wp=0.3, ws=0.4, ftype='butter')[source]

TUsignal filtering

order : int wp : float ws : float ftype : string

O : Output filtered TUsignal

ft()[source]

return the associated FUsignal

ftshift()[source]

return the associated FUsignal

H : FUsignal

pylayers.signal.bsignal.TUsignal.fftsh pylayers.signal.waveform.ip_generic

info()[source]

display information about TUsignal

psd(Tpns=100, R=50, periodic=True)[source]

calculate TUsignal power spectral density

R : Resistance (default 50 Ohms) Tpns : real

PRP (default 100 ns)

Note

If time is in ns the resulting PSD is expressed in dBm/MHz (~10-9)

shift(tau)[source]

shift the Usignal by tau (expressed in the same unit as Bsignal.x)

This method uses fft and ifft to produce a shift which is not necessarily a multiple of the time step dx.

tau : float

showpsd(fig=[], ax=[], display=True, PRPns=100)[source]

show psd

fig ax display

pylayers.signal.bsignal.TUsignal.psd pylayers.signal.bsignal.Usignal.zlr