In [129]:
!ipython locate profile


/home/dominique/.ipython/profile_default

In [130]:
%install_ext https://raw.githubusercontent.com/rasbt/python_reference/master/ipython_magic/watermark.py
%load_ext watermark


Installed watermark.py. To use it, type:
  %load_ext watermark
The watermark extension is already loaded. To reload it, use:
  %reload_ext watermark

You need to run a command like ipcluster start -n 4 to start the multithread


In [131]:
from IPython import parallel
c = parallel.Client()
view = c.load_balanced_view()


[autoreload of watermark failed: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/IPython/extensions/autoreload.py", line 247, in check
    superreload(m, reload, self.old_objects)
ImportError: No module named watermark
]

In [132]:
%%px --local

import numpy as np
from numpy import linalg as LA
from numpy import array
from numpy import pi
import matplotlib.pyplot as plt

In [133]:
%matplotlib inline

In [134]:
from scipy.interpolate import griddata
dpi_out = 400
fig_width = 3.39
golden_mean = (np.sqrt(5)-1.0)/2.0    # Aesthetic ratio
fig_height = fig_width*golden_mean # height in inches
MAX_HEIGHT_INCHES = 8.0
if fig_height > MAX_HEIGHT_INCHES:
    print("WARNING: fig_height too large:" + fig_height + 
          "so will reduce to" + MAX_HEIGHT_INCHES + "inches.")
    fig_height = MAX_HEIGHT_INCHES
fig, ax = plt.subplots(figsize = (fig_width, fig_height), dpi=400, frameon=True)
small_tick_size = 8
small_label_size = 8



In [135]:
%%px --local

import matplotlib.pyplot as plt
import sys
import math
from scipy.optimize import curve_fit
import pickle

if "/home/dominique/Code/PG/Source" not in sys.path:
    sys.path.append("/home/dominique/Code/PG/Source")

import phase_fluctuations as PF
from phase_fluctuations import TbModel, TbParams, SWaveModel, DWaveModel
from MCMC import MCMCDriver
import scipy.constants as cst
def K_to_meV(in_temp):
    return cst.physical_constants["Boltzmann constant in eV/K"][0] * in_temp * 1000.0
def meV_to_K(in_temp):
    return  in_temp / 1000.0 / cst.physical_constants["Boltzmann constant in eV/K"][0]
def func(x, a, b, c):
    return a * np.exp(-b * x) + c
def func_short(x, a, b):
    return a * np.exp(-b * x)
def func_combined(x, a, b, d):
    return a * np.exp(-b * x) / np.power(x, d)
def func_power(x, a, b):
    return a * np.power(x, b)
def func_exponent(x, a, b):
    #return a * np.power(x - 290.112982064, b)
    return a * np.exp(-np.power(x - 290.112982064, b))
def func_full(x, a, b, c):
    return a * np.exp(-np.abs(b) * x) / np.power(x, c)

In [136]:
%load_ext autoreload
%autoreload 2


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [137]:
%who


BCS_PARAMS	 DWaveModel	 K_to_meV	 LA	 MAX_HEIGHT_INCHES	 MCMCDriver	 MC_PARAMS_CLUSTER	 MC_PARAMS_MP	 MC_Params	 
MY_DRIVER	 MY_DWAVE_MODEL	 PF	 SWaveModel	 T_CST	 T_KT	 TbModel	 TbParams	 Tc_mf	 
array	 array_coords	 ax	 c	 cbar4	 cbar_ax	 color_map	 color_maps	 cst	 
curve_fit	 data	 dpi_out	 elem	 energy	 fig	 fig_height	 fig_width	 func	 
func_combined	 func_exponent	 func_full	 func_power	 func_short	 golden_mean	 griddata	 i	 im	 
item	 line	 math	 max_cbar	 max_ticks	 meV_to_K	 min_cbar	 nb_samples	 np	 
parallel	 pi	 pickle	 plt	 result	 selected_color_map	 small_label_size	 small_tick_size	 sys	 
test	 ticks	 to_add	 view	 visu_factor	 x_convert	 x_data	 x_size	 x_tick_list	 
x_tick_position	 xi	 xmax	 xmin	 xtick_labels	 y_convert	 y_data	 y_size	 y_step	 
y_tick_list	 y_tick_position	 yi	 ymax	 ymin	 z_values	 zi	 

In [138]:
%watermark -a "Dominique" -d -t -u -v -h -m -g


Dominique Last updated: 02/07/2015 11:58:48 

CPython 2.7.9
IPython 3.2.0

compiler   : GCC 4.9.2
system     : Linux
release    : 3.19.0-21-generic
machine    : x86_64
processor  : x86_64
CPU cores  : 4
interpreter: 64bit
host name  : Everest
Git hash   : 7c26db33a3a19dfc1123c143051b7315e1e9eb8b

TB Model

We pick the following parameters:

  • hopping constant $ t= 250$ meV
  • $\Delta = 1.0 t$ so that $T_c^{MF} = 0.5 t$, and so that $\xi_0 \simeq a_0$
  • $g = -0.25$, unitless, so as to match the article's formalism, not the thesis'
  • $J = \dfrac{0.1 t}{0.89}$ so as to set $T_{KT} = 0.1 t$.

This means that we have the following physical properties


In [139]:
Tc_mf = meV_to_K(0.5*250)
print meV_to_K(pi/2.0)
print 1.0/0.89
print cst.physical_constants["Boltzmann constant"]


18.2283362633
1.12359550562
(1.3806488e-23, 'J K^-1', 1.3e-29)

In [140]:
print r"$T_c^{MF} = $", Tc_mf, "K"
T_KT =  meV_to_K(0.1*250)
print r"$T_{KT} = $", T_KT, "K"


$T_c^{MF} = $ 1450.56491032 K
$T_{KT} = $ 290.112982064 K

Instantiation


In [22]:
%%px --local

T_CST = 0.25
MY_PARAMS = {"width":10, "chem_potential": 0.0,
                 "hopping_constant": T_CST, "J_constant": 0.1 * T_CST / 0.89,
                 "delta": 1.0 * T_CST,
                 "use_assaad": False, "broadening_delta": 0.01 * T_CST}
MY_MODEL = TbModel(MY_PARAMS)

TB Model

Modification


In [23]:
%%px --local

TB_PARAMS = {"width":14, "use_assaad": True}
MY_MODEL.set_params(TB_PARAMS)
print MY_MODEL


Class: <class 'phase_fluctuations.TbModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.TbParams'>
Width: 14
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
196
[stdout:0] 
Class: <class 'phase_fluctuations.TbModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.TbParams'>
Width: 14
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
196
[stdout:1] 
Class: <class 'phase_fluctuations.TbModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.TbParams'>
Width: 14
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
196
[stdout:2] 
Class: <class 'phase_fluctuations.TbModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.TbParams'>
Width: 14
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
196
[stdout:3] 
Class: <class 'phase_fluctuations.TbModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.TbParams'>
Width: 14
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
196

A(k, $\omega$) Computation - Do not use, this is single thread!


In [24]:
all_test_vectors = []
nb_samples = MY_MODEL.lattice.width
for elem in np.arange(nb_samples):
    print "handling", elem
    k_in = elem * 1.0 * np.pi * np.array([1.0, 1.0]) / nb_samples
    test2_vector = MY_MODEL.get_vector_spectral_function_point(k_in,
                                                               MY_MODEL.lattice.omega_mesh)
    all_test_vectors.append(test2_vector)


handling 0
handling 1
handling 2
handling 3
handling 4
handling 5
handling 6
handling 7
handling 8
handling 9
handling 10
handling 11
handling 12
handling 13

Rather, use this parallel code version


In [27]:
%%px --local
import numpy as np
import os

In [28]:
%%px --local

def get_spectral_function(x):
    nb_samples = MY_MODEL.lattice.width
    k_in = x * np.pi * np.array([1.0, 1.0]) / nb_samples
    return MY_MODEL.get_vector_spectral_function_point(k_in, MY_MODEL.lattice.omega_mesh)

In [29]:
nb_samples = MY_MODEL.lattice.width
x = np.arange(nb_samples)
all_test_vectors = view.map_sync(get_spectral_function, x)

OR, with older clumsier style (but no need for a local cluster)


In [ ]:
import multiprocessing
nb_samples = MY_MODEL.lattice.width
multiprocessing.cpu_count()
pool = multiprocessing.Pool(processes=3)
all_test_vectors = pool.map(get_spectral_function, np.arange(nb_samples))

Plot results


In [30]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples):
    k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
    to_add = [[k_in[0], energy/T_CST] for energy in MY_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
    
array_coords = np.array(array_coords)
z_values = np.array(z_values)

In [31]:
from scipy.interpolate import griddata
visu_factor = 3
fig, ax = plt.subplots(figsize = (fig_width*visu_factor, fig_height*visu_factor), dpi=400, frameon=False)

xmin = 0.0
xmax = np.pi
ymin = -5.0
ymax = 5.0
#grid_x = np.linspace(xmin, xmax, num = 200)
#grid_y = np.linspace(ymin, ymax, num = 2000)
grid_x, grid_y = np.mgrid[xmin:xmax:100j, ymin:ymax:200j]
grid_z1 = griddata(array_coords, z_values, (grid_x, grid_y), method='nearest', fill_value=0.0)
p = ax.pcolormesh(grid_x, grid_y, grid_z1, cmap=plt.get_cmap('Greys'),rasterized=True)

#for index, theta in np.ndenumerate(thetas):
#    ax.plot(theta, resonance_omega_values[index], marker='o', color='k')

cb = fig.colorbar(p, ax=ax)
ax.plot(grid_x, -2.0 * 2.0 * T_CST * np.cos(grid_x) / T_CST)
ax.set_xlim([xmin, xmax])
ax.set_ylim([ymin, ymax])
plt.savefig("spectral_function.pdf")



In [32]:
import contextlib
@contextlib.contextmanager
def printoptions(*args, **kwargs):
    """Define some temporary pretty print options
    """
    original = np.get_printoptions()
    np.set_printoptions(*args, **kwargs)
    yield
    np.set_printoptions(**original)

Use with caution, this takes up a lot of space on the page


In [34]:
with printoptions(precision=4, suppress=True, threshold=np.nan):
    print MY_MODEL._eigen_values
    for i in np.arange(MY_MODEL.lattice.width):
        print MY_MODEL._unitary_matrix[i]


  File "<ipython-input-34-df69010635a4>", line 4
    #print MY_MODEL._unitary_matrix[i]
                                      ^
IndentationError: expected an indented block

In [36]:
k_in = 1.0 * np.pi * np.array([1.0, 1.0])
test = MY_MODEL.get_vector_spectral_function_point(k_in,
                                                   MY_MODEL.lattice.omega_mesh)

In [37]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)

x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl

ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f'  %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f'  %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])

ax.plot(MY_MODEL.lattice.omega_mesh/T_CST, test)
#ax.plot(MY_MODEL.lattice.omega_mesh/T_CST, test_elem)


Out[37]:
[<matplotlib.lines.Line2D at 0x7efbc39a3d50>]

d Wave

Instantiation


In [116]:
%%px --local

T_CST = 0.25
BCS_PARAMS = {"width":4, "chem_potential": 0.0,
              "hopping_constant": T_CST, "J_constant":  0.1 * T_CST / 0.89,
              "g_constant": 0.25, "delta": 1.0 * T_CST, "use_assaad": True,
              "uniform_phase": True, "temperature": 100}
MY_DWAVE_MODEL = DWaveModel(BCS_PARAMS)

In [117]:
print MY_DWAVE_MODEL


Class: <class 'phase_fluctuations.DWaveModel'>
Seed: 1234567890
Uniform phase: True
Temperature: 100 K

Base class:
Class: <class 'phase_fluctuations.DWaveModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.PairingParams'>
J constant: 0.0280898876404 eV
U constant: -0.825 eV
g constant: 0.25 eV
delta: 0.25 eV

Base class:
Class: <class 'phase_fluctuations.PairingParams'>
Width: 4
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
16

Modification


In [118]:
%%px --local

BCS_PARAMS = {"width":5, "use_assaad": True,
              "uniform_phase": True,  "temperature": 1.75*145.0,
              "delta": 1.0 * T_CST}
MY_DWAVE_MODEL.set_params(BCS_PARAMS)

In [119]:
print MY_DWAVE_MODEL
print "temp: ", K_to_meV(MY_DWAVE_MODEL.temperature), "meV"


Class: <class 'phase_fluctuations.DWaveModel'>
Seed: 1234567890
Uniform phase: True
Temperature: 253.75 K

Base class:
Class: <class 'phase_fluctuations.DWaveModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.PairingParams'>
J constant: 0.0280898876404 eV
U constant: -0.825 eV
g constant: 0.25 eV
delta: 0.25 eV

Base class:
Class: <class 'phase_fluctuations.PairingParams'>
Width: 5
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
25
temp:  21.866480965 meV

Scan BZ


In [126]:
%%px --local

def get_spectral_function(x):
    local_model = MY_DWAVE_MODEL
    nb_samples = local_model.lattice.width
    k_in = x * np.pi * np.array([1.0, 1.0]) / nb_samples
    return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)

In [127]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples)
all_test_vectors_nodal = view.map_sync(get_spectral_function, x)

SINGLE THREAD VERSION


In [21]:
all_test_vectors = []
nb_samples = MY_DWAVE_MODEL.lattice.width
for elem in np.arange(nb_samples):
    print "handling", elem
    k_in = elem * np.pi * np.array([1.0, 1.0]) / nb_samples
    test2_vector = MY_DWAVE_MODEL.get_vector_spectral_function_point(k_in,
                                                                     MY_DWAVE_MODEL.lattice.omega_mesh)
    all_test_vectors.append(test2_vector)


handling 0
handling 1
handling 2
handling 3
handling 4
handling 5
handling 6
handling 7
handling 8
handling 9
handling 10
handling 11

Plot Results


In [58]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples):
    k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
    to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
    
array_coords = np.array(array_coords)
z_values = np.array(z_values)

In [59]:
from scipy.interpolate import griddata
visu_factor = 3
fig, ax = plt.subplots(figsize = (fig_width*visu_factor, fig_height*visu_factor), dpi=400, frameon=False)

xmin = 0.0
xmax = np.pi
ymin = -5.0
ymax = 5.0
#grid_x = np.linspace(xmin, xmax, num = 200)
#grid_y = np.linspace(ymin, ymax, num = 2000)
grid_x, grid_y = np.mgrid[xmin:xmax:100j, ymin:ymax:200j]
grid_z1 = griddata(array_coords, z_values, (grid_x, grid_y), method='nearest', fill_value=0.0)
p = ax.pcolormesh(grid_x, grid_y, grid_z1, cmap=plt.get_cmap('Greys'),rasterized=True)

#for index, theta in np.ndenumerate(thetas):
#    ax.plot(theta, resonance_omega_values[index], marker='o', color='k')

cb = fig.colorbar(p, ax=ax)
ax.set_xlim([xmin, xmax])
ax.set_ylim([ymin, ymax])


Out[59]:
(-5.0, 5.0)

In [60]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)

x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl

ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f'  %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f'  %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])

ax.plot(MY_DWAVE_MODEL.lattice.omega_mesh/T_CST,
        MY_DWAVE_MODEL.get_vector_spectral_function_point(np.array([0.6, 0.6]),
                                                         MY_DWAVE_MODEL.lattice.omega_mesh))


Out[60]:
[<matplotlib.lines.Line2D at 0x7efbc1ee3bd0>]

Scan BZ: gap


In [114]:
%%px --local

def get_spectral_function(x):
    local_model = MY_DWAVE_MODEL
    nb_samples = local_model.lattice.width
    k_in = x * np.pi * np.array([1.0, 0.0]) / nb_samples
    return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)

In [115]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples+1)
all_test_vectors = view.map_sync(get_spectral_function, x)

Plot Results


In [116]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples+1):
    k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
    to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
    
array_coords = np.array(array_coords)
z_values = np.array(z_values)

In [117]:
visu_factor = 1

fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
                                  fig_height * visu_factor),
                       dpi=800,
                       frameon=False)

color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]

x_size = 200
y_size = 200
xmax = np.pi
xmin = 0.0
ymax = 5.0
ymin = -5.0

def x_convert(in_x):
    out = (in_x - xmin) * x_size / (xmax - xmin)
    return out

def y_convert(in_y):
    out = (in_y - ymin) * y_size / (ymax - ymin)
    return out

############  IMSHOW  ##############################################

xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)

min_cbar = 0.0
max_cbar = np.max(zi)

low_cutoff = 0.005

im = plt.imshow(zi.T,aspect='auto',
                origin = 'lower',
                extent=[0,x_size,0,y_size],
                vmin=min_cbar, vmax=max_cbar,
                #norm=LogNorm())#,
                cmap=plt.get_cmap(color_map))

#####    Colorbar  ###############################################

max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
    
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')

#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)

cbar4.set_ticklabels(['%1.0f'  % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor) 
cbar4.set_label(r"$A((k_x, 0), E)$",
                fontsize=small_label_size * visu_factor,
                labelpad=-37.5 * visu_factor)

#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)

#####    Figure properties ###############################################

ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])

ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1

x_tick_list = np.pi * np.array([1.0 / 6.0, 1.0 / 4.0, 1.0 / 3.0, 1.0 / 2.0,
                                2.0 / 3.0, 3.0 / 4.0, 5.0 / 6.0, 1.0])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$\frac{\pi}{6}$", r"$\frac{\pi}{4}$",
                         r"$\frac{\pi }{3}$", r'$\frac{\pi}{2}$',
                         r'$\frac{2 \pi}{3}$', r'$\frac{3 \pi}{4}$',
                         r'$\frac{5 \pi}{6}$', r'$\pi$'])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f'  % i for i in x_tick_list])


y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f'  % (i) for i in y_tick_list])

ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)

for item in (ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
    line.set_color('k')
    line.set_markeredgewidth(1)
    
plt.savefig("./Figures/spectral_gap_dwave_" + color_map + ".pdf",
            bbox_extra_artists=(cbar4.ax,),
            bbox_inches='tight',
            dpi=dpi_out)


second segment


In [118]:
%%px --local

def get_spectral_function(x):
    local_model = MY_DWAVE_MODEL
    nb_samples = local_model.lattice.width
    k_in = np.array([np.pi, x * np.pi / nb_samples])
    return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)

In [119]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples+1)
spectral_func_second_segment = view.map_sync(get_spectral_function, x)

Plot Results


In [120]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples+1):
    k_in = elem * np.pi * np.array([1.0, 0.0]) / nb_samples
    to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(spectral_func_second_segment[elem])# / np.amax(all_test_vectors[elem]))

array_coords = np.array(array_coords)
z_values = np.array(z_values)

In [121]:
visu_factor = 1

fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
                                  fig_height * visu_factor),
                       dpi=800,
                       frameon=False)

color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]

x_size = 200
y_size = 200
xmax = np.pi
xmin = 0.0
ymax = 5.0
ymin = -5.0

def x_convert(in_x):
    out = (in_x - xmin) * x_size / (xmax - xmin)
    return out

def y_convert(in_y):
    out = (in_y - ymin) * y_size / (ymax - ymin)
    return out

############  IMSHOW  ##############################################

xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)

min_cbar = 0.0
max_cbar = np.max(zi)

low_cutoff = 0.005

im = plt.imshow(zi.T,aspect='auto',
                origin = 'lower',
                extent=[0,x_size,0,y_size],
                vmin=min_cbar, vmax=max_cbar,
                #norm=LogNorm())#,
                cmap=plt.get_cmap(color_map))

#####    Colorbar  ###############################################

max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
    
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')

#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)

cbar4.set_ticklabels(['%1.0f'  % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor) 
cbar4.set_label(r"$A((k_x, 0), E)$",
                fontsize=small_label_size * visu_factor,
                labelpad=-37.5 * visu_factor)

#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)

#####    Figure properties ###############################################

ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])

ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1

x_tick_list = np.pi * np.array([1.0 / 6.0, 1.0 / 4.0, 1.0 / 3.0, 1.0 / 2.0,
                                2.0 / 3.0, 3.0 / 4.0, 5.0 / 6.0, 1.0])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$\frac{\pi}{6}$", r"$\frac{\pi}{4}$",
                         r"$\frac{\pi }{3}$", r'$\frac{\pi}{2}$',
                         r'$\frac{2 \pi}{3}$', r'$\frac{3 \pi}{4}$',
                         r'$\frac{5 \pi}{6}$', r'$\pi$'])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f'  % i for i in x_tick_list])


y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f'  % (i) for i in y_tick_list])

ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)

for item in (ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
    line.set_color('k')
    line.set_markeredgewidth(1)
    
plt.savefig("./Figures/spectral_gap_dwave_2segment_" + color_map + ".pdf",
            bbox_extra_artists=(cbar4.ax,),
            bbox_inches='tight',
            dpi=dpi_out)


Third segment


In [156]:
%%px --local

def get_spectral_function(x):
    local_model = MY_DWAVE_MODEL
    nb_samples = local_model.lattice.width
    k_in = (float(x) / nb_samples) * np.array([np.pi, np.pi])
    return local_model.get_vector_spectral_function_point(k_in, local_model.lattice.omega_mesh)

In [157]:
nb_samples = MY_DWAVE_MODEL.lattice.width
x = np.arange(nb_samples+1)
spectral_func_third_segment = view.map_sync(get_spectral_function, x)

Plot Results


In [158]:
#spectral_func_third_segment = all_test_vectors_nodal[::-1]

array_coords = []
z_values = []
for elem in np.arange(nb_samples):
    k_in = (float(elem) / nb_samples) * np.array([np.pi, np.pi])
    print k_in
    to_add = [[k_in[0], energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(spectral_func_third_segment[nb_samples - elem -1])# / np.amax(all_test_vectors[elem]))

array_coords = np.array(array_coords)
z_values = np.array(z_values)


[ 0.  0.]
[ 0.26179939  0.26179939]
[ 0.52359878  0.52359878]
[ 0.78539816  0.78539816]
[ 1.04719755  1.04719755]
[ 1.30899694  1.30899694]
[ 1.57079633  1.57079633]
[ 1.83259571  1.83259571]
[ 2.0943951  2.0943951]
[ 2.35619449  2.35619449]
[ 2.61799388  2.61799388]
[ 2.87979327  2.87979327]

In [159]:
visu_factor = 3

fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
                                  fig_height * visu_factor),
                       dpi=800,
                       frameon=False)

color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]

x_size = 200
y_size = 200
xmax = np.pi
xmin = 0.0
ymax = 5.0
ymin = -5.0

def x_convert(in_x):
    out = (in_x - xmin) * x_size / (xmax - xmin)
    return out

def y_convert(in_y):
    out = (in_y - ymin) * y_size / (ymax - ymin)
    return out

############  IMSHOW  ##############################################

xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)

min_cbar = 0.0
max_cbar = np.max(zi)

low_cutoff = 0.005

im = plt.imshow(zi.T,aspect='auto',
                origin = 'lower',
                extent=[0,x_size,0,y_size],
                vmin=min_cbar, vmax=max_cbar,
                #norm=LogNorm())#,
                cmap=plt.get_cmap(color_map))

#####    Colorbar  ###############################################

max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
    
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')

#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)

cbar4.set_ticklabels(['%1.0f'  % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor) 
cbar4.set_label(r"$A((k_x, 0), E)$",
                fontsize=small_label_size * visu_factor,
                labelpad=-37.5 * visu_factor)

#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)

#####    Figure properties ###############################################

ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])

ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1

x_tick_list = np.pi * np.array([1.0 / 6.0, 1.0 / 4.0, 1.0 / 3.0, 1.0 / 2.0,
                                2.0 / 3.0, 3.0 / 4.0, 5.0 / 6.0, 1.0])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$\frac{\pi}{6}$", r"$\frac{\pi}{4}$",
                         r"$\frac{\pi }{3}$", r'$\frac{\pi}{2}$',
                         r'$\frac{2 \pi}{3}$', r'$\frac{3 \pi}{4}$',
                         r'$\frac{5 \pi}{6}$', r'$\pi$'])
ax.set_xticklabels(xtick_labels)


y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f'  % (i) for i in y_tick_list])

ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)

for item in (ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
    line.set_color('k')
    line.set_markeredgewidth(1)
    
plt.savefig("./Figures/spectral_gap_dwave_3segment_" + color_map + ".pdf",
            bbox_extra_artists=(cbar4.ax,),
            bbox_inches='tight',
            dpi=dpi_out)


Combine


In [162]:
array_coords = []
z_values = []
for elem in np.arange(nb_samples):
    to_add = [[elem, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(all_test_vectors[elem])# / np.amax(all_test_vectors[elem]))
for elem in np.arange(nb_samples)[1:]:
    to_add = [[nb_samples + elem -1, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(spectral_func_second_segment[elem])# / np.amax(all_test_vectors[elem]))
for elem in np.arange(nb_samples)[1:]:
    to_add = [[2.0 * nb_samples + elem -1, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(spectral_func_third_segment[nb_samples - elem -1])# / np.amax(all_test_vectors[elem]))
    
array_coords = np.array(array_coords)
z_values = np.array(z_values)

print array_coords.shape


(4930, 2)

In [165]:
visu_factor = 3

fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
                                  fig_height * visu_factor),
                       dpi=800,
                       frameon=False)

color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]

x_size = 200
y_size = 200
xmax = 3 * nb_samples
xmin = 0.0
ymax = 5.0
ymin = -5.0

def x_convert(in_x):
    out = (in_x - xmin) * x_size / (xmax - xmin)
    return out

def y_convert(in_y):
    out = (in_y - ymin) * y_size / (ymax - ymin)
    return out

############  IMSHOW  ##############################################

xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)

min_cbar = 0.0
max_cbar = np.max(zi)

im = plt.imshow(zi.T,aspect='auto',
                origin = 'lower',
                extent=[0,x_size,0,y_size],
                vmin=min_cbar, vmax=max_cbar,
                #norm=LogNorm())#,
                cmap=plt.get_cmap(color_map))

#####    Colorbar  ###############################################

max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
    
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')

#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)

cbar4.set_ticklabels(['%1.0f'  % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor) 
cbar4.set_label(r"$A((k_x, 0), E)$",
                fontsize=small_label_size * visu_factor,
                labelpad=-37.5 * visu_factor)

#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)

#####    Figure properties ###############################################

ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])

ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1

x_tick_list = np.array([0, nb_samples, 2 * nb_samples])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$(0, 0)$", r"$(\pi, 0)$", r"$(\pi, \pi)$"])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f'  % i for i in x_tick_list])

y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f'  % (i) for i in y_tick_list])

ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)

for item in (ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
    line.set_color('k')
    line.set_markeredgewidth(1)
    
plt.savefig("./Figures/spectral_gap_dwave_complete_" + color_map + ".pdf",
            bbox_extra_artists=(cbar4.ax,),
            bbox_inches='tight',
            dpi=dpi_out)


Test


In [74]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)

x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl

ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f'  %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f'  %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])

for i in range(6)[1:4]:
    ax.plot(MY_DWAVE_MODEL.lattice.omega_mesh/T_CST + 0.5 * i,
            spectral_func_second_segment[i], label=str(i))

plt.legend()


Out[74]:
<matplotlib.legend.Legend at 0x7f5b18e78110>

In [76]:
fig, ax = plt.subplots(figsize = (10, 8), dpi=100, frameon=False)

x_axis_ampl = 4.5
xmin = -x_axis_ampl
xmax = x_axis_ampl

ax.set_xlim([xmin, xmax])
#ax.set_ylim([0.0, 1.0])
l_xticks = np.linspace(int(xmin), int(xmax), 9,endpoint=True)
ax.set_xticks(l_xticks)
ax.set_xticklabels(['%1.1f'  %elem for elem in l_xticks])
#ax.set_xticklabels([r'$\psi$' for elem in l_xticks])
#ax.set_yticks(np.linspace(xmin, xmax, 5,endpoint=True))
#ax.set_yticklabels(['%1.1f'  %elem for elem in np.linspace(xmin, xmax,5,endpoint=True)])

for i in range(6)[1:4]:
    ax.plot(MY_DWAVE_MODEL.lattice.omega_mesh/T_CST + 0.5 * i,
            all_test_vectors[-i], label=str(-i))

plt.legend()


Out[76]:
<matplotlib.legend.Legend at 0x7f5b1984b210>

MC Driver

Instantiation


In [120]:
MC_Params = {"seed": 222315, "intervals": 100,
             "target_snapshots": 15, "observable_list":["dispersion"]}
MY_DRIVER = MCMCDriver(MY_DWAVE_MODEL, MC_Params)

Modification


In [121]:
MC_PARAMS_MP = {"intervals": BCS_PARAMS["width"]**2 / 2,
                "target_snapshots": 25,
                "algorithm":"metropolis"}
MC_PARAMS_CLUSTER = {"intervals": 5,
                     "target_snapshots": 25,
                     "algorithm":"cluster"}
MY_DRIVER.set_params(MC_PARAMS_CLUSTER)
print MY_DWAVE_MODEL._uniform_phase


True

In [122]:
MY_DRIVER.mc_object.set_params({"temperature": 2.0 * 145.0, "uniform_phase": False})
MY_DRIVER.mc_object.set_params({"width":8, "temperature": 0.4 * 145.0, "uniform_phase": False})

In [123]:
print MY_DRIVER
print MY_DRIVER.params


Class: <class 'MCMC.MCMCDriver'>
Seed: 222315
Intervals: 1
Algorithm: cluster
Target snapshots: 25
Observable list: ['dispersion']

MC Object:
Class: <class 'phase_fluctuations.DWaveModel'>
Seed: 1234567890
Uniform phase: False
Temperature: 58.0 K

Base class:
Class: <class 'phase_fluctuations.DWaveModel'>
broadening delta: 0.0025 eV
use Assad: True
is up to date: False

Lattice: 
Class: <class 'phase_fluctuations.PairingParams'>
J constant: 0.0280898876404 eV
U constant: -0.825 eV
g constant: 0.25 eV
delta: 0.25 eV

Base class:
Class: <class 'phase_fluctuations.PairingParams'>
Width: 8
Chemical potential: 0.0 eV
Hopping constant: 0.25 eV
Number of sites: 
64

Results: None
{'intervals': 5, 'algorithm': 'cluster', 'seed': 222315, 'target_snapshots': 25, 'observable_list': ['dispersion']}

In [124]:
MY_DRIVER.thermalize(20000)
#MY_DRIVER.mc_object.set_params({"temperature": 1.1 * 145.0})
#MY_DRIVER.thermalize(50)

In [125]:
MY_DRIVER.execute()

In [126]:
result = MY_DRIVER.result
data = result.observable_results["dispersion"]
print data["momentum_coordinates"].shape
print data["momentum_coordinates"]
print data["spectral_functions"]
print result
x_data = data["momentum_coordinates"]
y_data = data["spectral_functions"]


(24, 2)
[[ 0.          0.        ]
 [ 0.39269908  0.        ]
 [ 0.78539816  0.        ]
 [ 1.17809725  0.        ]
 [ 1.57079633  0.        ]
 [ 1.96349541  0.        ]
 [ 2.35619449  0.        ]
 [ 2.74889357  0.        ]
 [ 3.14159265  0.        ]
 [ 3.14159265  0.39269908]
 [ 3.14159265  0.78539816]
 [ 3.14159265  1.17809725]
 [ 3.14159265  1.57079633]
 [ 3.14159265  1.96349541]
 [ 3.14159265  2.35619449]
 [ 3.14159265  2.74889357]
 [ 3.14159265  3.14159265]
 [ 2.74889357  2.74889357]
 [ 2.35619449  2.35619449]
 [ 1.96349541  1.96349541]
 [ 1.57079633  1.57079633]
 [ 1.17809725  1.17809725]
 [ 0.78539816  0.78539816]
 [ 0.39269908  0.39269908]]
[[ 0.00246668  0.00275813  0.00310508 ...,  0.00015157  0.00014752
   0.00014364]
 [ 0.00205908  0.00228591  0.00255315 ...,  0.00017408  0.00016882
   0.00016383]
 [ 0.0023646   0.002639    0.00296478 ...,  0.00015702  0.0001526
   0.0001484 ]
 ..., 
 [ 0.00085069  0.00091262  0.00098216 ...,  0.0002768   0.0002657
   0.00025537]
 [ 0.00161331  0.00176835  0.00194764 ...,  0.0001735   0.00016853
   0.00016379]
 [ 0.00201182  0.0022358   0.00250057 ...,  0.00018855  0.00018222
   0.00017628]]
Class: <class 'MCMC.ResultContainer'>
bcs_params: {'hopping_constant': 0.25, 'uniform_phase': False, 'use_assaad': True, 'delta': 0.25, 'width': 8, 'J_constant': 0.02808988764044944, 'g_constant': 0.25, 'chem_potential': 0.0, 'temperature': 58.0}
mc_params: {'intervals': 5, 'algorithm': 'cluster', 'seed': 222315, 'target_snapshots': 25, 'observable_list': ['dispersion']}
Code version: {'id': '51bbd05e76221254fce543bdf881662fde3521cd', 'time': 'Tue, 30 Jun 2015 17:45'}
Observable list: ['dispersion']

In [127]:
array_coords = []
z_values = []
for elem in np.arange(data["momentum_coordinates"].shape[0]):
    to_add = [[elem, energy/T_CST] for energy in MY_DWAVE_MODEL.lattice.omega_mesh]
    array_coords.extend(to_add)
    z_values.extend(data["spectral_functions"][elem])# / np.amax(all_test_vectors[elem]))
    
array_coords = np.array(array_coords)
z_values = np.array(z_values)

print array_coords.shape


(2424, 2)

In [128]:
visu_factor = 3

fig, ax = plt.subplots(figsize = (fig_width * visu_factor,
                                  fig_height * visu_factor),
                       dpi=800,
                       frameon=False)

color_maps = ['Accent', 'Paired', 'Set1', 'Spectral', 'gist_ncar', 'jet', 'Greys']
selected_color_map = -1
color_map = color_maps[selected_color_map]

nb_samples = MY_DWAVE_MODEL.lattice.width

x_size = 200
y_size = 200
xmax = 3 * nb_samples
xmin = 0.0
ymax = 5.0
ymin = -5.0

def x_convert(in_x):
    out = (in_x - xmin) * x_size / (xmax - xmin)
    return out

def y_convert(in_y):
    out = (in_y - ymin) * y_size / (ymax - ymin)
    return out

############  IMSHOW  ##############################################

xi, yi = np.mgrid[xmin:xmax:200j, ymin:ymax:200j]
zi = griddata(array_coords, z_values, (xi, yi), method='nearest', fill_value=0.0)

min_cbar = 0.0
max_cbar = np.max(zi)

im = plt.imshow(zi.T,aspect='auto',
                origin = 'lower',
                extent=[0,x_size,0,y_size],
                vmin=min_cbar, vmax=max_cbar,
                #norm=LogNorm())#,
                cmap=plt.get_cmap(color_map))

#####    Colorbar  ###############################################

max_ticks = max_cbar
ticks = np.linspace(0.0, max_ticks, num=9, endpoint=True)
    
cbar_ax = fig.add_axes([0.125, 1.05, 0.775, 0.08])
cbar4 = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')

#cb4.outline.set_visible(False)
cbar4.set_ticks([])
cbar4.set_ticks(ticks)

cbar4.set_ticklabels(['%1.0f'  % (i) for i in ticks] )
cbar4.ax.tick_params(labelsize=small_label_size * visu_factor) 
cbar4.set_label(r"$A((k_x, 0), E)$",
                fontsize=small_label_size * visu_factor,
                labelpad=-37.5 * visu_factor)

#cbar4.outline.remove()
cbar4.outline.set_linewidth(0.1)

#####    Figure properties ###############################################

ax.set_ylim([0,y_size])
ax.set_xlim([0,x_size])

ax.tick_params(axis='y', which='major', pad=5)
ax.yaxis.labelpad = 3
ax.xaxis.labelpad = 1

x_tick_list = np.array([0, nb_samples, 2 * nb_samples])
x_tick_position = x_convert(x_tick_list)
ax.set_xticks(x_tick_position)
xtick_labels = np.array([r"$(0, 0)$", r"$(\pi, 0)$", r"$(\pi, \pi)$"])
ax.set_xticklabels(xtick_labels)
#ax.set_xticklabels(['%1.1f'  % i for i in x_tick_list])

y_step = 1.0
y_tick_list = np.arange(start=ymin, stop=ymax, step=y_step)
y_tick_position = y_convert(y_tick_list)
ax.set_yticks(y_tick_position)
ax.set_yticklabels(['%1.1f'  % (i) for i in y_tick_list])

ax.set_xlabel(r'$k_x$', fontsize=small_label_size * visu_factor)
ax.set_ylabel(r'$E / t$', fontsize=small_label_size * visu_factor)

for item in (ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(small_tick_size * visu_factor)
for line in ax.get_xticklines() + ax.get_yticklines():
    line.set_color('k')
    line.set_markeredgewidth(1)
    
plt.savefig("./Figures/spectral_gap_dwave_direct_" + color_map + ".pdf",
            bbox_extra_artists=(cbar4.ax,),
            bbox_inches='tight',
            dpi=dpi_out)



In [ ]: