Esempio n. 1
0
def plot_spectral_estimate(f, sdf, sdf_ests, limits=None, elabels=()):
    """
    Plot an estimate of a spectral transform against the ground truth.

    Utility file used in building the documentation
    """
    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1)
    ax_limits = (sdf.min() - 2 * np.abs(sdf.min()),
                 sdf.max() + 1.25 * np.abs(sdf.max()))
    ax.plot(f, sdf, 'c', label='True S(f)')

    if not elabels:
        elabels = ('', ) * len(sdf_ests)
    colors = 'bgkmy'
    for e, l, c in zip(sdf_ests, elabels, colors):
        ax.plot(f, e, color=c, linewidth=2, label=l)

    if limits is not None:
        ax.fill_between(f,
                        limits[0],
                        y2=limits[1],
                        color=(1, 0, 0, .3),
                        alpha=0.5)

    ax.set_ylim(ax_limits)
    ax.legend()
    return fig
Esempio n. 2
0
def plot_spectral_estimate(f, sdf, sdf_ests, limits=None, elabels=()):
    """
    Plot an estimate of a spectral transform against the ground truth.

    Utility file used in building the documentation
    """
    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1)
    ax_limits = (sdf.min() - 2*np.abs(sdf.min()),
                 sdf.max() + 1.25*np.abs(sdf.max()))
    ax.plot(f, sdf, 'c', label='True S(f)')

    if not elabels:
        elabels = ('',) * len(sdf_ests)
    colors = 'bgkmy'
    for e, l, c in zip(sdf_ests, elabels, colors):
        ax.plot(f, e, color=c, linewidth=2, label=l)

    if limits is not None:
        ax.fill_between(f, limits[0], y2=limits[1], color=(1, 0, 0, .3),
                        alpha=0.5)

    ax.set_ylim(ax_limits)
    ax.legend()
    return fig
Esempio n. 3
0
def animate(x):
    global runtime
    try:
        current_temp = float((get(APIURL + 'temp')).text)
    except:
        current_temp = 0
        print("Cannot reach API")
    if current_temp < 10:
        current_temp = 10
    if current_temp > 50:
        current_temp = 50
    print(temperature_history)
    temperature_history.insert(0,current_temp)
    time_ran.append(runtime)
    runtime += 1
    time_ran_plot = time_ran
    temperature_history_plot = temperature_history
    axis.clear()
    axis.plot(time_ran_plot, temperature_history_plot)
    axis.set_xlim(300,0)
    axis.set_ylim(10,50)
    plot.xlabel('seconds ago')
    plot.ylabel('degrees C')