频率数据示例
注意尿囊素假定无量纲频率数据输入。
标准化,例如用平均值分割所有数据点
频率,留给用户。>>> import allantools
>>> import pylab as plt
>>> import numpy as np
>>> t = np.logspace(0, 3, 50) # tau values from 1 to 1000
>>> y = allantools.noise.white(10000) # Generate some frequency data
>>> r = 12.3 # sample rate in Hz of the input data
>>> (t2, ad, ade, adn) = allantools.oadev(y, rate=r, data_type="freq", taus=t) # Compute the overlapping ADEV
>>> fig = plt.loglog(t2, ad) # Plot the results
>>> # plt.show()
new in 2016.11:简单的顶级API,使用专用类进行数据处理和绘图。import allantools # https://github.com/aewallin/allantools/
import numpy as np
# Compute a deviation using the Dataset class
a = allantools.Dataset(data=np.random.rand(1000))
a.compute("mdev")
# New in 2019.7 : write results to file
a.write_result("output.dat")
# Plot it using the Plot class
b = allantools.Plot()
# New in 2019.7 : additional keyword arguments are passed to
# matplotlib.pyplot.plot()
b.plot(a, errorbars=True, grid=True)
# You can override defaults before "show" if needed
b.ax.set_xlabel("Tau (s)")
b.show()