ax1 = plt.subplot(2, 1, 1)
            if data.shape[0] > 4:
                minmean = data[3]
                maxmean = data[4]
                plt.fill_between(moves,
                                 minmean,
                                 maxmean,
                                 edgecolor='none',
                                 linewidth=0,
                                 color=colors.color(method[1:]),
                                 alpha=0.1,
                                 zorder=-51)
            my_S_error = errorinentropy[0:len(iterations)]
            min_error = min(min_error, my_S_error[my_S_error > 0].min())

            colors.loglog(moves, my_S_error, method=method[1:])

            # make these tick labels invisible
            plt.setp(ax1.get_xticklabels(), visible=False)
            #plt.xlabel(r'$\textrm{Moves}$')
            plt.ylabel(r'$\textrm{Average Entropy Error}$')
            #plt.title('Average Entropy Error at Each Iteration, %s' %filebase)
            if "default" in transcale:
                plt.title(r'$N=%d$, $\eta = %g$ $\delta_0 = 0.05$' %
                          (int(N), ff))
            elif "slow" in transcale:
                plt.title(r'$N=%d$, $\eta = %g$ $\delta_0 = 0.005$' %
                          (int(N), ff))
            elif "fast" in transcale:
                plt.title(r'$N=%d$, $\eta = %g$ $\delta_0 = 0.5$' %
                          (int(N), ff))
示例#2
0
        wlmoves, wlfactor = np.loadtxt(wl, dtype = float, unpack = True)
        data = np.loadtxt(wl)
        moves = data[:, 0]
        factor = data[:, 1]
        if (data[0, 0] == 'wl_factor'): # using c++ data!
            moves = np.zeros(len(wlmoves)*2+2)
            factor = np.zeros_like(moves)
            factor[0] = 1
            moves[0] = 1
            for i in range(len(wlmoves)):
                moves[2*i+1] = wlmoves[i]
                moves[2*i+2] = wlmoves[i]
                factor[2*i+1] = wlfactor[i]*2
                factor[2*i+2] = wlfactor[i]
        colors.loglog(moves, factor,
                      'vanilla_wang_landau'
                         + wl[len("data/gamma/%s/wl" % filename):-4])
        plt.ylim(ymin=1e-10, ymax=1e1)
        plt.xlim(xmin=1e0, xmax=2e12)

except:
    pass

print((glob.glob("data/gamma/%s/sad*.dat" % filename)))
try:
    for sad in glob.glob("data/gamma/%s/sad*.dat" % filename):
        data = np.loadtxt(sad)
        ts = data[:, 0]
        avg_gamma = data[:, 1]
        sadname = sad.split('/')[-1].split('.')[0]
    
示例#3
0
            colors.legend()
            plt.savefig('figs/%s-round-trips-%g.pdf' % (tex_filebase, energy))

            plt.figure('error-at-energy-round-trips')
            colors.plot(Nrt_at_energy[Nrt_at_energy > 0],
                        erroratenergy[Nrt_at_energy > 0],
                        method=method[1:])
            plt.title('Error at energy %g %s' % (energy, filebase))
            plt.xlabel('Round Trips')
            plt.ylabel('Error')
            colors.legend()
            plt.savefig('figs/%s-error-energy-Nrt-%g.pdf' %
                        (tex_filebase, energy))

        plt.figure('maxerror')
        colors.loglog(moves, maxerror, method=method[1:])
        plt.xlabel(r'Moves')
        plt.ylabel(r'Maximum Entropy Error')
        #plt.title('Maximum Entropy Error vs Iterations, %s' %filebase)
        colors.legend()

        if type(iterations) is not np.float64:
            plt.figure('errorinentropy')
            if data.shape[0] > 4:
                minmean = data[3]
                maxmean = data[4]
                plt.fill_between(moves,
                                 minmean,
                                 maxmean,
                                 edgecolor='none',
                                 linewidth=0,
示例#4
0
plt.figure(figsize=(5,4))

try:
    for wl in glob.glob("data/gamma/%s/wl*.txt" % filename):
        wlmoves, wlfactor = np.loadtxt(wl, dtype = float, unpack = True)
        moves = np.zeros(len(wlmoves)*2+2)
        factor = np.zeros_like(moves)
        factor[0] = 1
        moves[0] = 1
        for i in range(len(wlmoves)):
            moves[2*i+1] = wlmoves[i]
            moves[2*i+2] = wlmoves[i]
            factor[2*i+1] = wlfactor[i]*2
            factor[2*i+2] = wlfactor[i]
        colors.loglog(moves, factor,
                      'vanilla_wang_landau'
                         + wl[len("data/gamma/%s/wl" % filename):-4])
        plt.ylim(ymin=1e-10, ymax=1e1)
        plt.xlim(xmin=1e0, xmax=1e13)

except:
    pass


for sad in glob.glob("data/gamma/%s/sad*.dat" % filename):
    data = np.loadtxt(sad)
    print data.shape
    if data.shape[1] > 2: # i.e. we are not using parse-yaml-out.py
        num_sad_states = data[:,0]
        time = data[:,1]
        ehi = data[:,2]
        wlmoves, wlfactor = np.loadtxt(wl, dtype=float, unpack=True)
        data = np.loadtxt(wl)
        moves = data[:, 0]
        factor = data[:, 1]
        if (data[0, 0] == 'wl_factor'):  # using c++ data!
            moves = np.zeros(len(wlmoves) * 2 + 2)
            factor = np.zeros_like(moves)
            factor[0] = 1
            moves[0] = 1
            for i in range(len(wlmoves)):
                moves[2 * i + 1] = wlmoves[i]
                moves[2 * i + 2] = wlmoves[i]
                factor[2 * i + 1] = wlfactor[i] * 2
                factor[2 * i + 2] = wlfactor[i]
        colors.loglog(
            moves, factor,
            'is' + wl[len("../ising/data/gamma/%s/wl" % filename):-4])
        #plt.ylim(1e-10, 1e1)
        #plt.xlim(1e3, 1e13)

except:
    pass

try:
    for sad in glob.glob("../ising/data/gamma/%s/*sad*.dat" % filename):
        data = np.loadtxt(sad)
        print(data.shape)
        if data.shape[1] > 2:  # i.e. we are not using parse-yaml-out.py
            num_sad_states = data[:, 0]
            time = data[:, 1]
            ehi = data[:, 2]
            longest_iters = data[:, 0]
    best = np.zeros(most_iters) + 1e30
    worst = np.zeros(most_iters)
    for i in range(most_iters):
        for dE in errors:
            if i < len(errors[dE]):
                best[i] = min(best[i], errors[dE][i])
                worst[i] = max(worst[i], errors[dE][i])
    if 'sad' in method:
        # plt.fill_between(longest_iters, worst, best,
        #                  edgecolor='none', linewidth=0,
        #                  color=colors.color(method),
        #                  alpha=0.1, zorder=-51)
        # colors.loglog(iters[0.001], errors[0.001], method=r'SAD $\Delta E=0.001\epsilon$')
        colors.loglog(iters[0.01],
                      errors[0.01],
                      method=r'SAD $\Delta E=0.01\epsilon$')
        colors.loglog(iters[0.1],
                      errors[0.1],
                      method=r'SAD $\Delta E=0.1\epsilon$')
    else:
        colors.loglog(iters[0.01], errors[0.01], method=method)

for method in extra_files:
    fname = extra_files[method]
    data = np.loadtxt(datadir + fname + '-cv-error.txt')
    if len(data) == 0:
        continue
    colors.loglog(data[:, 0], data[:, 2], method=method)

moves = np.array([1e6, 1e13])
示例#7
0
                plt.xlabel('# moves')
                plt.ylabel('Round Trips')
                colors.legend()
                plt.savefig('figs/%s-round-trips-%g.pdf' % (tex_filebase, energy))

                plt.figure('error-at-energy-round-trips')
                colors.plot(Nrt_at_energy[Nrt_at_energy > 0], erroratenergy[Nrt_at_energy > 0],
                         method = method[1:])
                plt.title('Error at energy %g %s' % (energy,filebase))
                plt.xlabel('Round Trips')
                plt.ylabel('Error')
                colors.legend()
                plt.savefig('figs/%s-error-energy-Nrt-%g.pdf' % (tex_filebase, energy))

        plt.figure('maxerror')
        colors.loglog(moves, maxerror, method = method[1:])
        plt.xlabel(r'Moves')
        plt.ylabel(r'Maximum Entropy Error')
        #plt.title('Maximum Entropy Error vs Iterations, %s' %filebase)
        colors.legend()

        if type(iterations) is not np.float64:
                plt.figure('errorinentropy')
                my_S_error = errorinentropy[0:len(iterations)]
                min_error = min(min_error, my_S_error[my_S_error > 0].min())
                colors.loglog(moves, my_S_error, method = method[1:])
                plt.xlabel(r'$\textrm{Moves}$')
                plt.ylabel(r'$\textrm{Average Entropy Error}$')
                #plt.title('Average Entropy Error at Each Iteration, %s' %filebase)
                if "default" in transcale:
                    plt.title(r'$N=%d$, $\eta = %g$ $\delta_0 = 0.05$' % (int(N), ff))
示例#8
0
plt.figure(figsize=(5, 4))

try:
    for wl in glob.glob("data/gamma/%s/wl*.txt" % filename):
        wlmoves, wlfactor = np.loadtxt(wl, dtype=float, unpack=True)
        moves = np.zeros(len(wlmoves) * 2 + 2)
        factor = np.zeros_like(moves)
        factor[0] = 1
        moves[0] = 1
        for i in range(len(wlmoves)):
            moves[2 * i + 1] = wlmoves[i]
            moves[2 * i + 2] = wlmoves[i]
            factor[2 * i + 1] = wlfactor[i] * 2
            factor[2 * i + 2] = wlfactor[i]
        colors.loglog(
            moves, factor,
            'vanilla_wang_landau' + wl[len("data/gamma/%s/wl" % filename):-4])
        plt.ylim(ymin=1e-10, ymax=1e1)
        plt.xlim(xmin=1e0, xmax=1e13)

except:
    pass

for sad in glob.glob("data/gamma/%s/sad*.dat" % filename):
    data = np.loadtxt(sad)
    print data.shape
    if data.shape[1] > 2:  # i.e. we are not using parse-yaml-out.py
        num_sad_states = data[:, 0]
        time = data[:, 1]
        ehi = data[:, 2]
        elo = data[:, 3]
示例#9
0
        wlmoves, wlfactor = np.loadtxt(wl, dtype=float, unpack=True)
        data = np.loadtxt(wl)
        moves = data[:, 0]
        factor = data[:, 1]
        if (data[0, 0] == 'wl_factor'):  # using c++ data!
            moves = np.zeros(len(wlmoves) * 2 + 2)
            factor = np.zeros_like(moves)
            factor[0] = 1
            moves[0] = 1
            for i in range(len(wlmoves)):
                moves[2 * i + 1] = wlmoves[i]
                moves[2 * i + 2] = wlmoves[i]
                factor[2 * i + 1] = wlfactor[i] * 2
                factor[2 * i + 2] = wlfactor[i]
        colors.loglog(
            moves, factor,
            'wl' + wl[len("../square-well/data/gamma/%s/wl" % filename):-4])
        plt.ylim(ymin=1e-10, ymax=1e1)
        plt.xlim(xmin=1e3, xmax=1e12)

except:
    pass

try:
    for sad in glob.glob("../square-well/data/gamma//%s/sad*.dat" % filename):
        data = np.loadtxt(sad)
        print((data.shape))
        if data.shape[1] > 2:  # i.e. we are not using parse-yaml-out.py
            num_sad_states = data[:, 0]
            time = data[:, 1]
            ehi = data[:, 2]