Esempio n. 1
0
def handle_gui():
    from Tkinter import Tk
    from tkFileDialog import askopenfilename
    # we save these imports so the script can be run as a server
    # without requiring matplotlib.
    import matplotlib.pyplot as plt
    import visualize

    Tk().withdraw()# we don't want a full GUI, so keep the root window from appearing
    filename = askopenfilename()# show an "Open" dialog box and return the path to the selected file

    with open(filename, 'rb') as f:
      payload = f.read()
    # decompress
    fcst = compress.decompress_dataset(payload)
    # plot
    visualize.plot_forecast(fcst)
    # save or show
    plt.show()
Esempio n. 2
0
def handle_plot(args):
    # we save these imports so the script can be run as a server
    # without requiring matplotlib.
    import matplotlib.pyplot as plt
    import visualize

    # read in the input
    if args.input is None:
        raise argparse.ArgumentError(args.input,
                                     "--input is required, specify -h for usage.")
    payload = args.input.read()
    # decompress
    fcst = compress.decompress_dataset(payload)
    # plot
    visualize.plot_forecast(fcst)
    # save or show
    if args.output is None:
        plt.show()
    else:
        plt.savefig(args.output.name)