コード例 #1
0
ファイル: EEIdentify.py プロジェクト: braydenware/FBI-talk
L_min, L_max = min(Ls), max(Ls)
shift_func = lambda L: 0.1 if L==9 else -0.15
#shift_func = lambda L: 0.2*(L-L_max)/(L_max - L_min)
#shift_func = lambda L: 0

params = IO.Params.kw('LKN', L=Ls, K=[0], N=[0])
for p in params:
    run.create_edge_spectrum(state, p, overwrite=False)

spectrum = pp.load_edge_spectrum(state, Ls)
spectrum = pp.shift_boson_number(spectrum)

spectrum.add_as_prop(pp.energy, val='val')
data_name = 'energy'

pp.shift_and_scale(spectrum, scale=1) #just shift
data_name = 'E'
all_points = list(spectrum.points())

for point in all_points:
    if not point['L']%2:
        point['shifted_E'] = point['E']
    else:
        point['shifted_E'] = 2*point['E']+0.25
data_name = 'shifted_E'
spec_points = spectrum.collect(['K', 'N', 'band'], 'L', data_name)

spec_points.plot_toolbox = data.SpectraPlotTools()
spec_points.plot_toolbox.markers = ['1', '2', '3', '4']
#spec_points.plot_toolbox.markers
spec_points.update_plot_args(title='Edge Spectrum', xlabel='K', ylabel='Energy',
コード例 #2
0
def go(L):
    #with PdfPages('L_10_all_mom_10.pdf') as pdf:
    ###########################################################
    #get state
    i=10
    stri = str(i)
    IO.go_to_data_parent('interpolatedboson/a'+stri)
    IO.add_to_path()
    state = IO.get_state()
    Ls = [L]
    L_min, L_max = min(Ls), max(Ls)
    shift_func = lambda L: 0
    ###########################################################
    #make edge spectrum if necessary
    params = IO.Params.kw('LKN', L=Ls, K=[0], N=[0])
    for p in params:
        run.create_edge_spectrum(state, p, overwrite=False)
    ###########################################################
    #load and prepeare edge spectrum
    spectrum = pp.load_edge_spectrum(state, Ls)
    spectrum = pp.shift_boson_number(spectrum)
    spectrum.add_as_prop(pp.energy, val='val')
    data_name = 'energy'
    pp.shift_and_scale(spectrum, scale=0) #just shift
    data_name = 'E'
    all_points = list(spectrum.points())

    spec_points = spectrum.collect(['K', 'N', 'band'], 'L', data_name)
    spec_points = spec_points.filter([lambda p: p['K']<=L/2])
    spec_points.plot_toolbox = data.SpectraPlotTools()
    spec_points.plot_toolbox.markers = ['1', '2', '3', '4']
    spec_points.update_plot_args(title='', xlabel='K', ylabel='Energy',
                                      xlim=[-0.5, 12], ylim=[-0.4, 6])
    #even_colors = ['k', 'b', 'g', 'r', 'gold', 'orange', 'orangered', 'y','m', 'lime', 'c']    
    color_pairs = [('k', 'k'), ('b', 'c'),('g', 'lime'),('r', 'm'),('orange', 'orangered'),('gold', 'y')] 
    colors = [c for cp in color_pairs for c in cp]
    def color_func(N):
        x=0
        if N<0:
            x=1
        if N%2==0: 
            return abs(N)+x
        else:
            return abs(N)+1+4+x

    spec_points.plot_toolbox.colors = colors
    spec_points.plot_toolbox.color_func = color_func
    ###########################################################
    #make plot
    if makelegend:
        xlim=[-0.5, np.floor(L/2)+1.1]
    else:
        xlim=[-0.5, np.floor(L/2)+.5]

    fig, spec_ax = spec_points.plot_toolbox.spec_plot(spec_points, data_name,
                                                     shift_func=shift_func, copy_points=True,xlim=xlim, legend=None)

    # if i!=10 and i!=0:
        # plt.title('Entanglement Spectrum for b=0.'+stri)
    # elif i==10:
        # plt.title('Entanglement Spectrum for soft-core state')
    # elif i==0:
        # plt.title('Entanglement Spectrum for hard-core FBI')
    if L==10:
        plt.ylabel('Entanglement Energy')
    if L==9:
        plt.ylabel('')
    ax = plt.gca()
    Ks = np.arange(0, np.floor(L/2+1))
    ax.set_xticks(Ks)
    if L==10:
        ax.set_xticklabels(['0', '$\pi/5$', '$2\pi/5$', '$3\pi/5$', '$4\pi/5$', '$\pi$'])
    if L==9:
        ax.set_xticklabels(['0', '$2\pi/9$', '$4\pi/9$', '$6\pi/9$', '$8\pi/9$'])  
    #ax.set_xticklabels(['$2\pi'+str(K)+'/'+str(L)+'$' if K in [1for K in Ks])
    ax.yaxis.tick_left()
    ax.xaxis.tick_bottom()
    if makelegend:
        handles, labels = ax.get_legend_handles_labels()
        hl = sorted(zip(handles, labels),
                key= lambda x: abs(int(x[1])))
        handles2, labels2 = zip(*hl)
        def label_helper(string_representing_integer):
            i = int(string_representing_integer)
            if not i%2:
                if i<=0:
                    return str(i//2)
                else:
                    return '+'+str(i//2)
            else:
                if i<=0:
                    return str(i)+'/2'
                else:
                    return '+'+str(i)+'/2'
                
        labels3 = [label_helper(l) for l in labels2]
        if L==9:
            legendloc = (0.8, 0.15)
        if L==10:
            legendloc = (0.825, 0.15)
        leg=ax.legend(handles2, labels3, loc = legendloc, numpoints=1, frameon=False, labelspacing=0.25)
コード例 #3
0
ファイル: edge_specL3.py プロジェクト: braydenware/FBI-talk
for p in params:
    run.create_edge_spectrum(state, p)
def rotated_state_params(Ls):
    params = data.pdict.kw('LKN', L = Ls, K = range(max(Ls)), N = range(-max(Ls), max(Ls)+1))
    K_lt_L = lambda p: p['K']<p['L']
    N_le_L = lambda p: -p['L'] <= p['N'] <= p['L']
    params.add_constraints([K_lt_L, N_le_L])
    return params

Ls = [1, 2, 3]
L_min = min(Ls)
L_max = max(Ls)

params = rotated_state_params(Ls)
spectrum = data.ParametrizedDataSet(params)
for L in Ls:
    edge_spectrum_list = run.load_edge_spectrum(state, data.OrderedDict(zip(['L', 'K', 'N'], [L, 0, 0])))
    edge_spectrum_dict = spec.collect_spectrum_points(edge_spectrum_list)
    for K, N in edge_spectrum_dict:
        for indx, val in enumerate(edge_spectrum_dict[(K, N)]):
            spectrum.append(data.DataPoint(L=L, K=K, N=N, val=val, band=indx))
pp.shift_and_scale(spectrum, scale=0)
spec_points = spectrum.collect(['K', 'N', 'band'], 'L', 'E')  # ParametrizedDataSet with K, N, band as parameters
spec_points.plot_toolbox = data.SpectraPlotTools()
spec_points.plot_toolbox.markers = ['1', '2', '3', '4']
spec_points.update_plot_args(title='Edge Spectrum', xlabel='K', ylabel='Energy',
                                 xlim=[-0.7, 4.1], ylim=[-0.1, 10])
fig, spec_ax = spec_points.plot_toolbox.spec_plot(spec_points, 'E',
                                                shift_func=lambda L: 0.3*(L-L_max-1)/(L_max - L_min))
axs = []
コード例 #4
0
ファイル: tms_fs_3.py プロジェクト: braydenware/FBI-talk
    "ytick.labelsize": 12,  # 8
    "lines.markersize": 12,  # 8
    "savefig.bbox": "tight",  # tight
    "savefig.pad_inches": 0.1,  # 0.1
    # 'text.usetex': True,
    "font.family": "serif",
    #'text.latex.preamble' : [r'\usepackage{amsmath}'],
    "figure.figsize": (10, 8),
}
rcParams.update(plot_params)
from DataAnalysis import PEPS_plots as pp

state = pp.IO.get_state()
Ls = range(2, 9)
spectrum = pp.load_transfer_matrix_spectrum(state, Ls)
pp.shift_and_scale(spectrum)
spectrum = spectrum.filter([lambda p: (0 <= p["K"] < 4 and 0 <= p["N"] < 4)], [])
spec_points = spectrum.collect(["K", "N", "band"], "L", "E")  # ParametrizedDataSet with K, N, band as parameters
spec_points.plot_toolbox = pp.data.SpectraPlotTools()
spec_points.plot_toolbox.markers = ["1", "2", "3", "4"]
spec_points.update_plot_args(
    title="Transfer Matrix Spectrum",
    xlabel="K",
    ylabel="Inverse Correlation Length -log(|T|) = 1/$\\xi$",
    xlim=[-0.5, 2.1],
    ylim=[-0.1, 2.1],
    ls=":",
    markersize=8,
)

L_min = min(Ls)