# 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')
#! /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)
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2015 jaidev <jaidev@newton> # # Distributed under terms of the MIT license. """ Example in section 1.3.1 """ 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])
#! /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])
""" ========================================== Wigner-Ville Distribution of a Noisy Chirp ========================================== Generate a noisy chirp and visualize its Wigner-Ville spectrum. """ 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')
plt.plot(time1, finalData1) plt.title("Oscilloscope Channel 1") plt.ylabel("Voltage (V)") plt.xlabel("Time (uS)") plt.show() plt.plot(time2, finalData2) plt.title("Oscilloscope Channel 2") plt.ylabel("Voltage (V)") plt.xlabel("Time (uS)") plt.show() wvd = WignerVilleDistribution(finalData1) wvd.run() wvd.plot(kind='cont') #print(k) n_fbins = 1190 signal = finalData1 y = np.linspace(0, 1000, finalData1.shape[0]) X, Y = np.meshgrid(time1, y) tausec = round(n_fbins) winlength = tausec - 1 ts = time1 tfr = np.zeros((n_fbins, ts.shape[0]), dtype=complex)
def plot_wvd(signal): wvd = WignerVilleDistribution(signal) wvd.run() wvd.plot(kind='contour')