Exemplo n.º 1
1
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.

"""
================================================================================
Sampling Effects on the Wigner-Ville Distribution of a Real Valued Gaussian Atom
================================================================================

This example shows the Wigner-Ville distribution of a real valued Gaussian
atom. If a signal is sampled at the Nyquist rate, the WVD is affected by
spectral aliasing and many additional interferences. To fix this, either the
signal may be oversampled, or an analytical signal may be used.

Figure 4.6 from the tutorial.
"""

import numpy as np
from tftb.generators import atoms
from tftb.processing import WignerVilleDistribution

x = np.array([[32, .15, 20, 1],
             [96, .32, 20, 1]])
g = atoms(128, x)
spec = WignerVilleDistribution(np.real(g))
spec.run()
spec.plot(kind="contour", show_tf=True, scale="log")
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.

"""
=============================================
Wigner-Ville Distribution of a Doppler Signal
=============================================

This example shows the Wigner-Ville distribution of a Doppler signal. The
signal steadily rises and falls, but there are many interference terms present
in the time-friequency plane, due to the bilinearity of the signal.

Figure 4.2 from the tutorial.
"""

from tftb.generators import doppler
from tftb.processing import WignerVilleDistribution

fm, am, iflaw = doppler(256, 50.0, 13.0, 10.0, 200.0)
sig = am * fm
dist = WignerVilleDistribution(sig)
tfr, times, freqs = dist.run()
dist.plot(show_tf=True, kind="contour", scale="log")
Exemplo n.º 3
0
N=256
dT=T - 1
window = np.ones(T)
TFD = Spectrogram(sig, n_fbins=N, fwindow=window)
TFD.run()
TFD.plot(kind="contour", threshold=0.1, show_tf=False)

# plt.xlabel('t (s)','FontSize',12)
# plt.ylabel('f (Hz)','FontSize',12)
# plt.title(cat('T=',str(T),',N=',str(N),',dT=',str(dT)))

# ukazi.m:49 -- Note:
# Wigner-Villova časovno-frekvenčna porazdelitev - skoraj idealna časovna in frekvenčna ločljivost

wvd = WignerVilleDistribution(np.real(sig))
wvd.run()
wvd.plot(kind='contour')

tfr, rtfr, hat = pseudo_wigner_ville(np.real(sig))

TFD,t,f=tfrwv(sig,nargout=3)
# ukazi4.m:41
plt.figure()
imagesc(t,f,TFD)
plt.axis('tight')
plt.xlabel('t','FontSize',12)
plt.ylabel('f','FontSize',12)
plt.axis('tight')
plt.axis('xy')
plt.title(cat('Wigner-Villova asovno-frekvenna porazdelitev'))
Exemplo n.º 4
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
================================================================================
Sampling Effects on the Wigner-Ville Distribution of a Real Valued Gaussian Atom
================================================================================

This example shows the Wigner-Ville distribution of a real valued Gaussian
atom. If a signal is sampled at the Nyquist rate, the WVD is affected by
spectral aliasing and many additional interferences. To fix this, either the
signal may be oversampled, or an analytical signal may be used.

Figure 4.6 from the tutorial.
"""

import numpy as np
from tftb.generators import atoms
from tftb.processing import WignerVilleDistribution

x = np.array([[32, .15, 20, 1], [96, .32, 20, 1]])
g = atoms(128, x)
spec = WignerVilleDistribution(np.real(g))
spec.run()
spec.plot(kind="contour", show_tf=True, scale="log")
Exemplo n.º 5
0
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.

"""
===================================================================
Wigner Ville distribution of a Gaussian Atom and a Complex Sinusoid
===================================================================

This example demonstrates the Wigner Ville distribution of a signal
composed from a Gaussian atom and a complex sinusoid with constant frequency
modulation. Although the representation does isolate the atom and the sinusoid
as independent phenomena in the signal, it also produces some interference
between them.

"""

from tftb.generators import fmconst, amgauss
from tftb.processing import WignerVilleDistribution
import numpy as np

sig = fmconst(128, 0.15)[0] + amgauss(128) * fmconst(128, 0.4)[0]
tfr = WignerVilleDistribution(sig)
tfr.run()
tfr.plot(show_tf=True, kind='contour',
        freq_x=(abs(np.fft.fftshift(np.fft.fft(sig))) ** 2)[::-1][:64],
        freq_y=np.arange(sig.shape[0] / 2))
Exemplo n.º 6
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
=============================================
Wigner-Ville Distribution of a Doppler Signal
=============================================

This example shows the Wigner-Ville distribution of a Doppler signal. The
signal steadily rises and falls, but there are many interference terms present
in the time-friequency plane, due to the bilinearity of the signal.

Figure 4.2 from the tutorial.
"""

from tftb.generators import doppler
from tftb.processing import WignerVilleDistribution

fm, am, iflaw = doppler(256, 50.0, 13.0, 10.0, 200.0)
sig = am * fm
dist = WignerVilleDistribution(sig)
tfr, times, freqs = dist.run()
dist.plot(show_tf=True, kind="contour", scale="log")
Exemplo n.º 7
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
===================================================================
Wigner Ville distribution of a Gaussian Atom and a Complex Sinusoid
===================================================================

This example demonstrates the Wigner Ville distribution of a signal
composed from a Gaussian atom and a complex sinusoid with constant frequency
modulation. Although the representation does isolate the atom and the sinusoid
as independent phenomena in the signal, it also produces some interference
between them.

Figure 4.8 from the tutorial.
"""

from tftb.generators import fmconst, amgauss
from tftb.processing import WignerVilleDistribution

sig = fmconst(128, 0.15)[0] + amgauss(128) * fmconst(128, 0.4)[0]
tfr = WignerVilleDistribution(sig)
tfr.run()
tfr.plot(show_tf=True, kind='contour')
Exemplo n.º 8
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.

"""
=====================================================
Wigner-Ville Distribution of a Dirac Impulse Function
=====================================================

This example demonstrates the Wigner-Ville distribution of a Dirac impulse
function, and shows the limitations of the WV distribution when applied to
broadband signals.

Figure 4.24 from the tutorial.
"""

from tftb.generators import anapulse
from tftb.processing import WignerVilleDistribution

sig = anapulse(128)
wvd = WignerVilleDistribution(sig)
wvd.run()
wvd.plot(kind="contour", scale="log")
def wigner_ville_dist(mag):
    from tftb.processing import WignerVilleDistribution
    wvd = WignerVilleDistribution(mag)
    wvd.run()
    wvd.plot(kind="contour" )#, scale="log")