Skip to content

Datkit v0.1.1

Latest

Choose a tag to compare

@MichaelClerx MichaelClerx released this 01 Jul 16:28
· 27 commits to main since this release

This version adds two methods to quickly inspect the frequency content of a time series

import matplotlib.pyplot as plt
import numpy as np
import datkit

t = np.linspace(0, 10, 1000)
v = 3 * np.sin(t * (2 * np.pi * 2)) + 10 * np.cos(t * (2 * np.pi * 3))
fig = plt.figure(figsize=(7, 7))
ax = fig.add_subplot(3, 1, 1)
ax.plot(t, v)

ax = fig.add_subplot(3, 1, 2)
ax.set_xlim(0, 10)
f, a = datkit.amplitude_spectrum(t, v)
ax.stem(f, a)

ax = fig.add_subplot(3, 1, 3)
ax.set_xlim(0, 10)
ax.set_yscale('log')
f, psd = datkit.power_spectral_density(t, v)
ax.plot(f, psd)

plt.show()