# Distributed under terms of the MIT license.

"""
Morlet Scalograms of Lipschitz singularities.

Figure 5.7 from the tutorial
"""

from tftb.processing import scalogram
from tftb.generators import anasing
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt


sig = anasing(64)

tfr, t, f, _ = scalogram(sig, waveparams=4, fmin=0.01, fmax=0.5, n_voices=256)

t, f = np.meshgrid(t, f)

fig, axContour = plt.subplots()
axContour.contour(t, f, tfr, 10)
axContour.grid(True)
axContour.set_title("Morlet Scalogram of Lipschitz singularity")
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)
Morlet Scalogram of a Lipschitz Singularity
===========================================

The time localization of the Lipschitz function can be seen at smaller scales.

Figure 5.8 from the tutorial.
"""

from tftb.processing import scalogram
from tftb.generators import anasing
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt


sig = anasing(64, 32, -0.5)

tfr, t, f, _ = scalogram(sig, waveparams=4, fmin=0.01, fmax=0.5, n_voices=256)

t, f = np.meshgrid(t, f)

fig, axContour = plt.subplots()
axContour.contour(t, f, tfr, 10)
axContour.grid(True)
axContour.set_title("Morlet Scalogram of Lipschitz singularity")
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)
示例#3
0
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
Morlet Scalograms of Lipschitz singularities.

Figure 5.7 from the tutorial
"""

from tftb.processing import scalogram
from tftb.generators import anasing
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt

sig = anasing(64)

tfr, t, f, _ = scalogram(sig, waveparams=4, fmin=0.01, fmax=0.5, n_voices=256)

t, f = np.meshgrid(t, f)

fig, axContour = plt.subplots()
axContour.contour(t, f, tfr, 10)
axContour.grid(True)
axContour.set_title("Morlet Scalogram of Lipschitz singularity")
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)
示例#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.

"""

"""


from tftb.generators import anasing
import matplotlib.pyplot as plt
import numpy as np

x = anasing(128)
plt.plot(np.real(x))
plt.xlim(0, 128)
plt.grid()
plt.title('Lipschitz Singularity')
plt.show()