Esempio n. 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.

"""
===========================================================
Unterberger distribution of a hyperbolic group delay signal
===========================================================

The active Unterberger distribution is the only localized bi-frequency kernel
distribution which localizes perfectly signals having a group delay in
:math:`1/\\nu^{2}`

Figure 4.23 from the tutorial.
"""

from tftb.processing import UnterbergerDistribution
from tftb.generators import gdpower

sig = gdpower(128, -1)[0]
dist = UnterbergerDistribution(sig, fmin=0.01, fmax=0.22, n_voices=172)
dist.run()
dist.plot()
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.

"""
Example showing a Bertrand distribution of a hyperbolic group delay signal.
"""

from tftb.processing import bertrand
from tftb.generators import gdpower
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt


sig = gdpower(128)[0]
tfr, t, f = bertrand(sig, fmin=0.01, fmax=0.22, n_voices=128)
t, f = np.meshgrid(t, f)

fig, axContour = plt.subplots()
axContour.contour(t, f, tfr)
axContour.grid(True)
axContour.set_title("Bertrand distribution of hyperbolic GD signal.")
axContour.set_ylabel('Frequency')
axContour.set_xlabel('Time')

divider = make_axes_locatable(axContour)
axTime = divider.append_axes("top", 1.2, pad=0.5)
axFreq = divider.append_axes("left", 1.2, pad=0.5)
axTime.plot(np.real(sig))
axTime.set_xlim(0, 128)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.

"""
==========================================================
D-Flandrin Distribution of a Hyperbolic Group Delay Signal
==========================================================

This example shows the D-Flandrin distribution of a signal having hyperbolic
group delay. This is the only type of distribution that almost perfectly
localizes signals having a group delay in :math:`1 / \sqrt{\\nu}`

Figure 4.22 from the tutorial.
"""

from tftb.processing import DFlandrinDistribution
from tftb.generators import gdpower

sig = gdpower(128, 1.0 / 2)[0]
spec = DFlandrinDistribution(sig, fmin=0.01, fmax=0.22, n_voices=128)
spec.run()
spec.plot()
Esempio 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.
"""
==========================================================
D-Flandrin Distribution of a Hyperbolic Group Delay Signal
==========================================================

This example shows the D-Flandrin distribution of a signal having hyperbolic
group delay. This is the only type of distribution that almost perfectly
localizes signals having a group delay in :math:`1 / \sqrt{\\nu}`

Figure 4.22 from the tutorial.
"""

from tftb.processing import DFlandrinDistribution
from tftb.generators import gdpower

sig = gdpower(128, 1.0 / 2)[0]
spec = DFlandrinDistribution(sig, fmin=0.01, fmax=0.22, n_voices=128)
spec.run()
spec.plot()