ssh/ssh_phase_diagram_multiprocessing.py
def plot_phase_diagram(param_list, k_means_label, file_name, plot_boundary=True):
    """ plots phase diagram for ssh model
    Args:
        param_list: list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 (outputs of get_wasersten).
        k_means_label: output of k means clustering (k_means) for the elements in param_list
        file_name: name of the file to which we save the phase diagram
    Returns:
        None

    """
    fig, ax = plt.subplots()
    ax.tick_params(axis='x', labelsize=20)
    ax.tick_params(axis='y', labelsize=20)
    c_list = []
    c_choice = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
    num_clusters = np.max(k_means_label) + 1
    assert num_clusters < len(c_choice), 'too many clusters'
    for i in k_means_label:
        for j in range(num_clusters):
            if i == j:
                c_list.append(c_choice[j])
                break
    ax.scatter(np.array(param_list)[:, 0], np.array(param_list)[:, 1], c=c_list, linewidth=1)
    if plot_boundary == True:
        ax.plot(np.zeros(50) - 1, np.linspace(0.5, 1.5, 50), '-.k')
        ax.plot(np.zeros(50) + 1, np.linspace(0.5, 1.5, 50), '-.k')
    ax.axes.yaxis.set_ticks([1])

    name_dir = os.path.dirname(file_name)
    os.makedirs(name_dir, exist_ok=True)
    plt.savefig(file_name + '.pdf', format='pdf')
 plots phase diagram for ssh model
    Args:
        param_list: list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 (outputs of get_wasersten).
        k_means_label: output of k means clustering (k_means) for the elements in param_list
        file_name: name of the file to which we save the phase diagram
    Returns:
        None

    
plots phase diagram for ssh model
plots phase diagram for ssh model
def plot_phase_diagram(param_list, k_means_label, file_name, plot_boundary=True):
    fig, ax = plt.subplots()
    ax.tick_params(axis='x', labelsize=20)
    ax.tick_params(axis='y', labelsize=20)
    c_list = []
    c_choice = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
    num_clusters = np.max(k_means_label) + 1
    assert num_clusters < len(c_choice), 'too many clusters'
    for i in k_means_label:
        for j in range(num_clusters):
            if i == j:
                c_list.append(c_choice[j])
                break
    ax.scatter(np.array(param_list)[:, 0], np.array(param_list)[:, 1], c=c_list, linewidth=1)
    if plot_boundary == True:
        ax.plot(np.zeros(50) - 1, np.linspace(0.5, 1.5, 50), '-.k')
        ax.plot(np.zeros(50) + 1, np.linspace(0.5, 1.5, 50), '-.k')
    ax.axes.yaxis.set_ticks([1])
    name_dir = os.path.dirname(file_name)
    os.makedirs(name_dir, exist_ok=True)
    plt.savefig(file_name + '.pdf', format='pdf')
def plot_phase_diagram ( param_list , k_means_label , file_name , plot_boundary = True ) : fig , ax = plt . subplots ( ) ax . tick_params ( axis = 'x' , labelsize = 20 ) ax . tick_params ( axis = 'y' , labelsize = 20 ) c_list = [ ] c_choice = [ 'b' , 'g' , 'r' , 'c' , 'm' , 'y' , 'k' ] num_clusters = np . max ( k_means_label ) + 1 assert num_clusters < len ( c_choice ) , 'too many clusters' for i in k_means_label : for j in range ( num_clusters ) : if i == j : c_list . append ( c_choice [ j ] ) break ax . scatter ( np . array ( param_list ) [ : , 0 ] , np . array ( param_list ) [ : , 1 ] , c = c_list , linewidth = 1 ) if plot_boundary == True : ax . plot ( np . zeros ( 50 ) - 1 , np . linspace ( 0.5 , 1.5 , 50 ) , '-.k' ) ax . plot ( np . zeros ( 50 ) + 1 , np . linspace ( 0.5 , 1.5 , 50 ) , '-.k' ) ax . axes . yaxis . set_ticks ( [ 1 ] ) name_dir = os . path . dirname ( file_name ) os . makedirs ( name_dir , exist_ok = True ) plt . savefig ( file_name + '.pdf' , format = 'pdf' )
plots phase diagram for ssh model
plots phase diagram for ssh model
""" plots phase diagram for ssh model
    Args:
        param_list: list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 (outputs of get_wasersten).
        k_means_label: output of k means clustering (k_means) for the elements in param_list
        file_name: name of the file to which we save the phase diagram
    Returns:
        None

    """
None
param_list
list or array such that [:,0] contains list of t1 and [:,1] contains list of t2 (outputs of get_wasersten).
list or array such that [ : 0 ] contains list of t1 and [ : 1 ] contains list of t2 ( outputs of get_wasersten ) .
k_means_label
output of k means clustering (k_means) for the elements in param_list
output of k means clustering ( k_means ) for the elements in param_list
file_name
name of the file to which we save the phase diagram
name of the file to which we save the phase diagram
plot_boundary