-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from jaidevd/jd-fix-fig4.4567
Add Wigner-Ville contour plots to the gallery
- Loading branch information
Showing
8 changed files
with
130 additions
and
111 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# vim:fenc=utf-8 | ||
# | ||
# Copyright © 2015 jaidev <jaidev@newton> | ||
# | ||
# Distributed under terms of the MIT license. | ||
|
||
""" | ||
================================================== | ||
Pseudo Wigner-Ville Distribution of Gaussian Atoms | ||
================================================== | ||
This example shows the Pseudo Wigner-Ville distribution of four Gaussian atoms | ||
located at the corners of a rectangle in the time-frequency plane. The | ||
`PseudoWignerVilleDistribution` class uses frequency smoothing, which | ||
attenuates the interferences oscillating along the time axis. | ||
Figure 4.5 from the tutorial. | ||
""" | ||
|
||
import numpy as np | ||
from tftb.generators import atoms | ||
from tftb.processing import PseudoWignerVilleDistribution | ||
|
||
x = np.array([[32, .15, 20, 1], | ||
[96, .15, 20, 1], | ||
[32, .35, 20, 1], | ||
[96, .35, 20, 1]]) | ||
g = atoms(128, x) | ||
spec = PseudoWignerVilleDistribution(g) | ||
spec.run() | ||
spec.plot(kind="contour", scale="log", show_tf=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#! /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 Analytic Gaussian Atoms | ||
==================================================== | ||
This example shows the WVD of and analytic Gaussian atom. As seen in Figure | ||
4.6, the WVD of a real valued signal may present interference terms and | ||
spectral aliasing. One of the ways to fix this is to use an analytic signal, | ||
which divides the spectral domain into two parts: real and imaginary. Thus, the | ||
number of interference terms is also halved. Secondly, analytic signals have no | ||
negative components, so the terms present in the negative half plane also | ||
vanish. | ||
Figure 4.7 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(g) | ||
spec.run() | ||
spec.plot(show_tf=True, kind="contour", scale="log") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#! /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 Gaussian Atoms | ||
=========================================== | ||
This example shows the WV distribution of four Gaussian atoms, each localized | ||
at the corner of a rectangle in the time-frequency plane. The distribution does | ||
show the four signal terms, as well as six interference terms. | ||
Figure 4.4 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, .15, 20, 1], | ||
[32, .35, 20, 1], | ||
[96, .35, 20, 1]]) | ||
g = atoms(128, x) | ||
spec = WignerVilleDistribution(g) | ||
spec.run() | ||
spec.plot(kind="contour", show_tf=True, scale="log") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#! /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") |