Пример #1
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 two simultaneous chirps.
"""

from tftb.generators import fmlin, sigmerge
from tftb.processing.cohen import WignerVilleDistribution

N = 64
sig = sigmerge(fmlin(N, 0, 0.4)[0], fmlin(N, 0.3, 0.5)[0], 1)
tfr = WignerVilleDistribution(sig)
tfr.run()
tfr.plot(kind='contour', sqmod=True, show_tf=True)
Пример #2
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 Chirp
====================================

Construct a chirp signal and visualize its `Wigner-Ville distribution
<https://en.wikipedia.org/wiki/Wigner_distribution_function>`_.

"""

from tftb.generators import fmlin
from tftb.processing.cohen import WignerVilleDistribution

n_points = 128
fmin, fmax = 0.0, 0.5
signal, _ = fmlin(n_points, fmin, fmax)

# Wigner-Ville distribution of the chirp.

wvd = WignerVilleDistribution(signal)
wvd.run()
wvd.plot(kind='contour', extent=[0, n_points, fmin, fmax])
Пример #3
0
# Distributed under terms of the MIT license.
"""
==========================================
Wigner-Ville Distribution of a Noisy Chirp
==========================================

Generate a noisy chirp and visualize its Wigner-Ville spectrum.

Figure 1.6 from the tutorial.
"""

from tftb.generators import fmlin, sigmerge, noisecg
from tftb.processing.cohen import WignerVilleDistribution

# Generate a chirp signal

n_points = 128
fmin, fmax = 0.0, 0.5

signal, _ = fmlin(n_points, fmin, fmax)

# Noisy chirp

noisy_signal = sigmerge(signal, noisecg(128), 0)

# Wigner-Ville spectrum of noisy chirp.

wvd = WignerVilleDistribution(noisy_signal)
wvd.run()
wvd.plot(kind='contour')
Пример #4
0
def plot_wvd(signal):
    wvd = WignerVilleDistribution(signal)
    wvd.run()
    wvd.plot(kind='contour')