Esempio n. 1
0
def example2():
    """
    Compute the GRADEV of a nonstationary white phase noise.
    """
    N = 1000  # number of samples
    f = 1  # data samples per second
    s = 1 + 5 / N * np.arange(0, N)
    y = s * np.random.randn(1, N)[0, :]
    x = [xx for xx in np.linspace(1, len(y), len(y))]
    x_ax, y_ax, (err_l, err_h), ns = allan.gradev(y,
                                                  data_type='phase',
                                                  rate=f,
                                                  taus=x)
    plt.loglog(x_ax, y_ax, 'b.', label="No gaps")
    y[int(0.4 * N):int(0.6 * N, )] = np.NaN  # Simulate missing data
    x_ax, y_ax, (err_l, err_h), ns = allan.gradev(y,
                                                  data_type='phase',
                                                  rate=f,
                                                  taus=x)
    plt.loglog(x_ax, y_ax, 'g.', label="With gaps")
    plt.grid()
    plt.legend()
    plt.xlabel('Tau / s')
    plt.ylabel('Overlapping Allan deviation')
    plt.show()
Esempio n. 2
0
def example1():
    """
    Compute the GRADEV of a white phase noise. Compares two different 
    scenarios. 1) The original data and 2) ADEV estimate with gap robust ADEV.
    """
    N = 1000
    f = 1
    y = np.random.randn(1, N)[0, :]
    x = [xx for xx in np.linspace(1, len(y), len(y))]
    x_ax, y_ax, (err_l, err_h), ns = allan.gradev(y,
                                                  data_type='phase',
                                                  rate=f,
                                                  taus=x)
    plt.errorbar(x_ax, y_ax, yerr=[err_l, err_h], label='GRADEV, no gaps')

    y[int(np.floor(0.4 *
                   N)):int(np.floor(0.6 *
                                    N))] = np.NaN  # Simulate missing data
    x_ax, y_ax, (err_l, err_h), ns = allan.gradev(y,
                                                  data_type='phase',
                                                  rate=f,
                                                  taus=x)
    plt.errorbar(x_ax, y_ax, yerr=[err_l, err_h], label='GRADEV, with gaps')
    plt.xscale('log')
    plt.yscale('log')
    plt.grid()
    plt.legend()
    plt.xlabel('Tau / s')
    plt.ylabel('Overlapping Allan deviation')
    plt.show()
Esempio n. 3
0
def test_gradev():
    x_ax, y_ax, (el, eh), ns = at.gradev(y, data_type='phase', rate=f, taus=x)
    x_ax_gap, y_ax_gap, (el_gap, eh_gap), ns_gap = at.gradev(y_gap,
                                                             data_type='phase',
                                                             rate=f,
                                                             taus=x)
    for i in range(len(x_ax)):
        i_gap = np.where(x_ax_gap == x_ax[i])
        if len(i_gap[0]) > 0:
            # Seems like a loose condition
            assert (np.log(y_ax[i] / y_ax_gap[i_gap[0][0]]) < 1)
Esempio n. 4
0
def example2():
    """
    Compute the GRADEV of a nonstationary white phase noise.
    """
    N=1000 # number of samples
    f = 1 # data samples per second
    s=1+5/N*np.arange(0,N)
    y=s*np.random.randn(1,N)[0,:]
    x = [xx for xx in np.linspace(1,len(y),len(y))]
    x_ax, y_ax, (err_l, err_h) , ns = allan.gradev(frequency=y,rate=f,taus=x)
    plt.loglog(x_ax, y_ax,'b.',label="No gaps")
    y[int(0.4*N):int(0.6*N,)] = np.NaN  # Simulate missing data
    x_ax, y_ax, (err_l, err_h), ns = allan.gradev(frequency=y,rate=f,taus=x)
    plt.loglog(x_ax, y_ax,'g.',label="With gaps")
    plt.grid()
    plt.legend()
    plt.xlabel('Tau / s')
    plt.ylabel('Overlapping Allan deviation')
    plt.show()
Esempio n. 5
0
def example1():
    """
    Compute the GRADEV of a white phase noise. Compares two different 
    scenarios. 1) The original data and 2) ADEV estimate with gap robust ADEV.
    """
    N = 1000
    f = 1
    y = np.random.randn(1,N)[0,:]
    x = [xx for xx in np.linspace(1,len(y),len(y))]
    x_ax, y_ax, (err_l, err_h), ns = allan.gradev(frequency=y,rate=f,taus=x)
    plt.errorbar(x_ax, y_ax,yerr=[err_l,err_h],label='GRADEV, no gaps')
    
    
    y[np.floor(0.4*N):np.floor(0.6*N)] = np.NaN # Simulate missing data
    x_ax, y_ax, (err_l, err_h) , ns = allan.gradev(frequency=y,rate=f,taus=x)
    plt.errorbar(x_ax, y_ax,yerr=[err_l,err_h], label='GRADEV, with gaps')
    plt.xscale('log')
    plt.yscale('log')
    plt.grid()
    plt.legend()
    plt.xlabel('Tau / s')
    plt.ylabel('Overlapping Allan deviation')
    plt.show()