Example #1
0
        #print(avg_gamma)
        #print(ts)
        colors.loglog(ts, avg_gamma, sadname)
        if data.shape[1] > 2:
            max_avg_gamma = data[:, 2]
            min_avg_gamma = data[:, 3]
            plt.fill_between(ts, min_avg_gamma, max_avg_gamma,
                            edgecolor='none', linewidth=0,
                            color=colors.color('sad'),
                            alpha=0.1, zorder=-51)
except:
    raise

def gamma_sa(t, t0):
    return t0/np.maximum(t, t0)

t0s = ['1e3', '1e4', '1e5', '1e6', '1e7']



for t0 in t0s:
    colors.loglog(ts, gamma_sa(ts, float(t0)), 'samc-%s-%s' %(t0, filename.replace('n', '')))
    plt.xlabel(r'$\textrm{Moves}$')
    plt.ylabel(r'$\gamma_{t}$')
    colors.legend()
plt.tight_layout()
plt.savefig('figs/gamma-%s.pdf' % filename.replace('.', '_'))
if 'noshow' not in sys.argv:
    plt.show()

Example #2
0
                    t = ts[i]
                    tL = time[j]
                    NE = num_sad_states[j]
                    Sbar = abs(elo[j]-ehi[j])/(Tmin) # removed 3 from denominator!
                    gamma[i] = (Sbar + t/tL)/(Sbar + t**2/(tL*NE))

        sadname = sad.split('/')[-1].split('.')[0]
    else: #data.shape[0] == 2: # we are using parse-yaml-out.py
        ts = data[:,0]
        gamma = data[:,1]
        sadname = sad.split('/')[-1].split('.')[0]



    colors.loglog(ts, gamma,sadname)

def gamma_sa(t,t0):
    return t0/np.maximum(t, t0)

t0s = [1e3,1e4,1e5,1e6,1e7]
for t0 in t0s:
    colors.loglog(ts,gamma_sa(ts, t0),'samc-%g' %t0)
    plt.xlabel(r'$\textrm{Moves}$')
    plt.ylabel(r'$\gamma_{t}$')
    colors.legend()
plt.tight_layout()
plt.savefig('figs/gamma-%s.pdf' % filename.replace('.','_'))
if 'noshow' not in sys.argv:
    plt.show()

Example #3
0
            # e, lnw = readnew.e_lnw(basename)
            # ax.plot(e, -lnw, colors[suffix_index]+':')
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception as e:
            print(e)
            pass

    ax.set_xlabel(r'$E$')
    ax.set_ylim(1.1 * minlndos, maxlndos + 5)
    # ax.set_xlim(-5, -0.3)
    ax.set_xlim(mine, maxe)
    ax.set_ylabel(r'$\ln DOS$')
    # ax.legend(loc='best').get_frame().set_alpha(0.25)
    if too_lo is not None:
        plt.title(r'lv movie from %s ($T_{\min} = %g$, $E_{lo} = %g$)' %
                  (filename, min_T, too_lo))
    else:
        plt.title(r'lv movie from %s ($T_{\min} = %g$)' % (filename, min_T))
    colors.legend(loc='lower right')

    fname = '%s/frame%06d.png' % (moviedir, frame)
    plt.savefig(fname)

duration = 10.0  # seconds

avconv = "avconv -y -r %g -i %s/frame%%06d.png -b 1000k %s/movie.mp4" % (
    numframes / duration, moviedir, moviedir)
os.system(avconv)  # make the movie
print(avconv)
Example #4
0
            ff = float(ff)
            # Get N directly from title.
            moves = iterations * float(N)
        if system == 'ising':
            N = filebase.split('N')[-1]
            moves = iterations * float(N)

        max_time = max(max_time, moves.max())

        if energy > 0:
            plt.figure('error-at-energy-iterations')
            colors.plot(moves, erroratenergy, method=method[1:])
            plt.title('Error at energy %g %s' % (energy, filebase))
            plt.xlabel('# moves')
            plt.ylabel('error')
            colors.legend()
            plt.savefig('figs/%s-error-energy-%g.pdf' % (tex_filebase, energy))

            plt.figure('round-trips-at-energy')
            colors.plot(moves, Nrt_at_energy, method=method[1:])
            plt.title('Round Trips at energy %g, %s' % (energy, filebase))
            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))
Example #5
0
    for suffix_index in range(len(suffixes)):
        suffix = suffixes[suffix_index]
        basename = dataformat % (suffix, frame*skipby)

        try:
            datname = basename+'-transitions.dat'
            #print(readnew.moves(datname))
            e, hist = readnew.e_hist(basename)
            colors.plot(e, hist, method=suffix)
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception as e:
            print(e)
            pass

    ax.set_xlabel(r'$E$')
    ax.set_ylim(1.1*minhist, maxhist+5)
    ax.set_xlim(mine, maxe)
    ax.set_ylabel(r'$\textrm{Histogram}$')
    colors.legend(loc='lower right')

    fname = '%s/frame%06d.png' % (moviedir, frame)
    plt.savefig(fname)

duration = 10.0 # seconds

avconv = "avconv -y -r %g -i %s/frame%%06d.png -b 1000k %s/movie.mp4" % (numframes/duration, moviedir, moviedir)
os.system(avconv) # make the movie
print(avconv)
moves = np.array([1e6, 1e13])
for i in np.arange(-8, 19, 1.0):
    colors.loglog(moves, 10**i / np.sqrt(0.1 * moves), method=r'1/sqrt(t)')

# for fname in fnames:
#         method = fname # FIXME
#         data = np.loadtxt(datadir+fname+'-cv-error.txt')
#         colors.loglog(data[:,0], data[:,2], method=method)

plt.xlabel(r'Moves')
plt.ylabel(r'Maximum Error in $C_V/k_B$')

plt.xlim(1e7, 3e12)
plt.ylim(1e-1, 1e4)

colors.legend()
plt.tight_layout()

plt.savefig('lj-cv-error.pdf')

plt.figure('cv')

data = np.loadtxt(datadir + 'bench-cv.txt')

wideax = plt.gca()
# inset axes....
inset_rect = [0.08, 0.43, 0.46, 0.57]
zoomax = wideax.inset_axes(inset_rect)

zoomax.set_xlim(data[0, 0], data[-1, 0])
    matplotlib.use('Agg')
    print('true?')

cv_data = pd.read_csv('%s/N%s-heat-capacity.csv' % (file_dir, N),
                      delimiter='\t',
                      encoding='utf-8',
                      engine='python')

#cv_data['cvref'] = cv_data['cvref'].astype(float)
print(cv_data.head(10))

cv_headers = list(cv_data)[1:]
print(cv_headers)

# Begin plotting the heat capacity
plt.figure('heat capacity plot')
Temp = np.array(pd.to_numeric(cv_data['Temperature'], errors='coerce'))
for name in cv_headers:
    cv = pd.to_numeric(cv_data[name], errors='coerce')
    colors.plot(1 / Temp, cv / N**2, method=name)

colors.legend(loc='best')
plt.xlabel(r'$\beta / J$')
plt.ylabel(r'$c_V$ / $ k_B$')
plt.xlim(0.3, 0.6)
if N == 32:
    plt.ylim(0.3, 2.0)

plt.savefig('../ising/N%i-Cv.pdf' % N)

plt.show()
Example #8
0
def legend_of_feature(feature):
    print(json.dumps(colors.legend(feature)))