Ejemplo n.º 1
0
        y = data[2048 - n_pts:2048 + n_pts]
        # Fit the absorption peak with a parabola y = ax^2+bx+c
        z = np.polyfit(x, y, 2)
        a = z[0]
        b = z[1]
        c = z[2]
        # Find the position of the peak minimum by derivating the parabola
        peak_pos = factor * -b / (2 * a)

        frequency = np.roll(frequency, -1)
        frequency[-1] = peak_pos

        # Plot
        li.set_ydata(frequency)
        ax.relim()
        ax.autoscale_view(True, True, True)
        fig.canvas.draw()
        print time.time() - t0, peak_pos
        plt.pause(0.001)
    except KeyboardInterrupt:
        break

a = allantools.Dataset(data=frequency)
a.compute("adev")

# Plot it using the Plot class
b = allantools.Plot()
b.plot(a, errorbars=True, grid=True)
# You can override defaults before "show" if needed
b.ax.set_xlabel("Tau (s)")
b.show()
Ejemplo n.º 2
0
def test_plot():
    ds = at.Dataset(data=at.noise.white(1000), rate=1.234)
    ds.compute("adev")
    p = at.Plot(no_display=True)
    p.plot(ds, errorbars=True)
Ejemplo n.º 3
0
    if not proper_file_type:
        raise ValueError("Invalid file type. Expected one of {}".format(POSSIBLE_FILE_TYPES))

    if args.allan_deviation:
        if proper_file_type != 'clockstats':
            raise ValueError("Invalid file type for producing AllanDeviation. Expected clockstats")

        print("Plotting Allan deviation")
        clock_times = np.loadtxt(args.input_file, usecols=3)
        rate = 1   # 1 Hz, if NTP is set up with PPS flag4 = 1
        at_dataset = allantools.Dataset(data=clock_times, rate=rate, data_type="phase", taus="octave")

        # Other possible computations are adev, mdev, tdev, hdev, ohdev, totdev,
        # mtotdev, ttotdev, htotdev, theo1, mtie, tierms, gradev
        at_dataset.compute("oadev")
        at_plotter = allantools.Plot()
        at_plotter.plot(at_dataset)
        at_plotter.show()

    # TODO: Code reuse for most of the following:
    if args.offset:
        if proper_file_type != 'loopstats':
            raise ValueError("Invalid file type for producing offset plot. Expected loopstats")

        print("Plotting loopstats offset")
        offsets = np.loadtxt(args.input_file, usecols=2)
        fig, ax = plt.subplots()
        t = np.arange(len(offsets))  # TODO: Plot this using actual date-time values from loopstats
        ax.plot(t * 16, offsets)
        ax.set(xlabel='time (s)', ylabel='offset (s)', title='Loopstats offset')
        ax.grid()