def plot_2(file_dir, pf, condition_function, label_r=None, label_i=None, color_r=color_black, color_i=color_red): r_filenames = os.listdir(file_dir + '/' + pf) i_filenames = os.listdir(file_dir + '_i/' + pf) flag_label_present = False for r_filename in r_filenames: k, W = pd.gen_data(file_dir + '/' + pf + '/' + r_filename) for w in W: condition = np.abs(condition_function(k, w, float(pf)).imag) < 1e-5 not_condition = np.invert(condition) if not flag_label_present: plt.plot(k[condition], w[condition] ** 2, label=label_r, color=color_r) plt.plot(k[not_condition], w[not_condition] ** 2, color=color_r, ls='dashed') flag_label_present = True else: plt.plot(k[condition], w[condition] ** 2 , color=color_r) plt.plot(k[not_condition], w[not_condition] ** 2 , color=color_r, ls='dashed') flag_label_present = False for i_filename in i_filenames: k, W = pd.gen_data(file_dir + '_i/' + pf + '/' + i_filename) for w in W: if not flag_label_present: plt.plot(k, -w * w, label=label_i, color=color_i) flag_label_present = True else: plt.plot(k, w ** 2, color=color_i)
def plot(file_dir, label=None, ls=None, color=color_black): flag_label_present = False filenames = os.listdir(file_dir) for filename in filenames: x, Y = pd.gen_data(file_dir + '/' + filename) for y in Y: if flag_label_present: plt.plot(x, y, ls=ls, color=color) else: plt.plot(x, y, ls=ls, color=color, label=label) flag_label_present = True
def plot_2_as(file_dir, pf, label_r=None, label_i=None, color_r=color_black_light, color_i=color_red_light, ls='dotted'): r_filenames = os.listdir(file_dir + '/' + pf) i_filenames = os.listdir(file_dir + '_i/' + pf) flag_label_present = False for r_filename in r_filenames: k, W = pd.gen_data(file_dir + '/' + pf + '/' + r_filename) for w in W: if not flag_label_present: plt.plot(k, w ** 2, label=label_r, color=color_r, ls=ls) flag_label_present = True else: plt.plot(k, w ** 2, color=color_r, ls=ls) flag_label_present = False for i_filename in i_filenames: k, W = pd.gen_data(file_dir + '_i/' + pf + '/' + i_filename) for w in W: if not flag_label_present: plt.plot(k, -w ** 2, label=label_i, color=color_i, ls=ls) flag_label_present = True else: plt.plot(k, -w ** 2, color=color_i, ls=ls)
def plot_new(file_dir, pf, label=None, ls=None, color=color_black): flag_label_present = False filenames = os.listdir(file_dir) for filename in filenames: x, Y = pd.gen_data(file_dir + '/' + filename) for y in Y: condition = np.abs(fv.d_pnd(x, y, pf, width=0).imag) == 0 not_condition = np.invert(condition) if flag_label_present: plt.plot(x[condition], y[condition], ls='-', color=color) plt.plot(x[not_condition], y[not_condition], ls=':', color=color) else: plt.plot(x[condition], y[condition], ls='-', color=color, label=label) plt.plot(x[not_condition], y[not_condition], ls=':', color=color) flag_label_present = True
import modules_py.functions_vec as fv import modules_py.proc_image as pi import modules_py.proc_data as pd import os import matplotlib.pyplot as plt pf = 2.7 dir_name = 'graph_data/eq_pnn_as/' + str(pf) filenames = os.listdir(dir_name) for filename in filenames: k, W = pd.gen_data(dir_name + '/' + filename) for w in W: plt.plot(k, fv.eq_pnn_as(k, w, pf)) plt.ylim(-.5, .5) pi.show()
return w * f.d_pnn(k, w, pf, width=0).imag graph_data = 'graph_data' function_name = 'eq_pnn_real' working_dir = graph_data + '/' + function_name PF = os.listdir(working_dir) function_name_i = 'eq_pnn_real_i' working_dir_i = graph_data + '/' + function_name_i for pf in PF: # Account for real solutions here filenames = os.listdir(working_dir + '/' + pf) for filename in filenames: integral_values = np.array([]) K, W = pd.gen_data(working_dir + '/' + pf + '/' + filename) for i, k in enumerate(K): integral_value, _ = quad(integrand_pnn, 1e-9, np.inf, args=(k, float(pf))) integral_value *= 2. / np.pi for w in W[:, i]: if f.d_pnn(k, w, float(pf), width=0).imag == 0: integral_value += 2 * w / (2 * w - f.pi_dw(k, w, float(pf))) integral_values = np.append(integral_values, integral_value) plt.plot(K, integral_values, color='#363636') # Account for imaginary solutions here filenames_i = os.listdir(working_dir_i + '/' + pf) for filename_i in filenames_i: integral_values_i = np.array([]) K_i, W_i = pd.gen_data(working_dir_i + '/' + pf + '/' + filename_i) if np.size(W_i) == 0: