Пример #1
0
def plot_timing(data):
    fig = on_key.figure()
    ax  = fig.add_subplot(1,1,1)

    for fct_name in data:

        N = data[fct_name][:,0]
        T = data[fct_name][:,1:]

        mean = np.mean(T, axis=1)
        std  = np.std(T,  axis=1)

        assert(len(N) == len(mean))
        assert(len(N) == len(std))

        ax.errorbar(N, mean, yerr=std, label=fct_name)
    del fct_name

    ax.grid(True)
    ax.legend(loc='best')
    ax.set_xlabel('N')
    ax.set_ylabel('Duration [s]')
    ax.set_xscale('log', basex=2)
    ax.set_yscale('log')
    xlims = ax.get_xlim()
    ax.set_xlim(xlims[0]/2, xlims[1]*2)
    ax.set_title('Scaling of different sorting algorithms implemented in Rust 1.2')
    on_key.show()
Пример #2
0
def main():
    import matplotlib.pyplot as plt
    import on_key

    r = np.linspace(0.0, 10.0, 1000)

    css = []
    css.append(0)
    css.append(1)
    css.append(2)
    css.append(3)
    css.append(4)
    css.append(5)
    css.append(6)

    fig = on_key.figure()
    axprops = dict()
    ax1 = fig.add_subplot(211, **axprops)
    axprops['sharex'] = ax1
    plt.setp(ax1.get_xticklabels(), visible=False)
    ax2 = fig.add_subplot(212, **axprops)
    plt.subplots_adjust(hspace=0.0)
    ax1.grid(True)
    ax2.grid(True)

    for cs in css:
        HS_U = HS_Fitting_Function_Xe_Potential(r, cs)
        HS_E = HS_Fitting_Function_Xe_Field(r, cs)

        indices = np.where(r > HS_Xe_rmax[cs])
        HS_U[indices] = -float(cs) / r[indices]
        HS_E[indices] = -float(cs) / (r[indices]*r[indices])
        #HS_U[indices] = 0.0
        #HS_E[indices] = 0.0

        ax1.plot(r, HS_U, label = str(cs) + "+")
        ax2.plot(r, HS_E, label = str(cs) + "+")


    ax2.legend(loc='best')
    ax1.set_ylabel("Potentiel energy (Hartree)")
    ax2.set_ylabel("Electric field (atomic units)")
    ax2.set_xlabel("Distance (Bohr)")
    ax1.set_ylim((-5.0, 0.0))
    ax2.set_ylim((-0.6, 0.0))
    plt.show()
Пример #3
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import sys, os, glob
import numpy
import matplotlib.pyplot as plt

import on_key

globber = glob.glob(os.path.join("output", "*"))
globber.sort()

fig = on_key.figure()

colors = ["b", "r", "m", "c", "g", "y"]
symbols = ["-", "--", ":", "-."]
line_width = 2

fi = 0
for prng_file in globber:

    # Skip folders
    if not os.path.isfile(prng_file) or prng_file == "output/make_run.log":
        continue

    print "prng_file =", prng_file

    data = numpy.loadtxt(prng_file, dtype=float)

    plt.hist(data, bins=100, label=prng_file.replace("output/", ""), alpha=0.5)