for line in param: if line=="" or line=="\n": new_param.write("\n") else: if line[0]=='U': new_param.write("U={}\n".format(pair[0])) elif line[:5]=='Gamma': new_param.write('Gamma={}\n'.format(pair[1])) else: new_param.write(line) param.close() new_param.close() subprocess.call([ 'mv' , 'new_param' , 'param' ]) subprocess.call( './1d_run_th_fl' ) N = pf.get_N( 'e-q0s2_table1.dat' ) nrg_eigenvalues = pf.read_h0_eigenvalues_lowest() U_array = np.empty( int(N/2) ) GAMMA_array = np.empty( int(N/2) ) nrg_eigenvalue_step = np.empty( 6 ) for n in range(0,int(N/2)): nrg_eigenvalues_step = nrg_eigenvalues[n,:] res = opt.least_squares( F , [0.3,0.7] ) U_array[n] = res.x[0] GAMMA_array[n] = res.x[1] col = colours[colour]
import matplotlib.colors as mcolors arguments = [] for arg in sys.argv[1:]: arguments.append(arg) OUTNAME = 0 if len(arguments) > 0: OUTNAME = arguments[0] plt.style.use('seaborn-paper') fig, ax = plt.subplots() plt.grid(b=True, which='major', color='black', linewidth='0.4', alpha=0.3) nrg = pf.read_h0_eigenvalues_lowest() N = np.arange(0, pf.get_N('e-q0s2_table1.dat'), 2) ax.plot(N, nrg[:-1, 0], label='Q=0, S=1/2') ax.plot(N, nrg[:-1, 1], label='Q=0, S=3/2') ax.plot(N, nrg[:-1, 2], label='Q=1, S=0') ax.plot(N, nrg[:-1, 3], label='Q=1, S=1') ax.plot(N, nrg[:-1, 4], label='Q=2, S=1/2') ax.plot(N, nrg[:-1, 5], label='Q=3, S=0') ax.set_ylim([-0.1, 6.5]) ax.set_yticks(np.arange(0, 7, 1)) ax.legend(loc='upper left', frameon=True, framealpha=0.7, facecolor='white', edgecolor='white')
if len(arguments) < 3: print( 'Incorrect arguments. O/E, Q and S are mandatory, #EIGENVALUES is optional. Exiting.' ) sys.exit() O_E = arguments[0] Q = arguments[1] S = arguments[2] filename = '{}-q{}s{}.dat'.format(O_E, Q, S) subprocess.call(['./99_f_extract_1sub', O_E, Q, S]) subprocess.call(['./99_f_fix_1sub_file.py', filename]) n_steps = pf.get_N(filename) f = open(filename, 'r') if np.size(arguments) > 3: n_eigenvalues = int(arguments[3]) else: n_eigenvalues = 6 steps = np.arange(pf.get_n(filename), pf.get_N(filename), 2) eigenvalues = np.empty((len(steps), n_eigenvalues)) plt.style.use('seaborn-paper') fig, ax = plt.subplots() twin = ax.twinx() pf.plotfile(f, steps, eigenvalues, ax, colour='black') f.close()