3 import matplotlib.pyplot
as plt
4 import matplotlib.cm
as cm
7 parser = argparse.ArgumentParser(description=
'reading strings for plotting')
8 parser.add_argument(
'strings', metavar=
'ID', nargs=
'+', help=
'string to plot')
10 args = parser.parse_args()
33 if data_dir[0] !=
"/":
34 data_dir =
"../" + data_dir
35 data = data_dir +
"/" + pltval
36 lines = np.loadtxt(data)
37 val = np.reshape(lines, (xDim,yDim))
39 val = -np.log(val) * 1E4 * 1.0545718E-34 40 data_V = "../data/K_0" 41 lines_V = np.loadtxt(data_V) 42 V_val = np.reshape(lines_V, (xDim, yDim)) 43 final_val = V_val - val 45 plt.imshow(val, extent=(1,xDim,1,yDim), interpolation=
'nearest',
54 if data_dir[0] !=
"/":
55 data_dir =
"../" + data_dir
56 for i
in range(start, end, incr):
58 output = pltval +
"%s" % i
59 data = data_dir +
"/" + output
60 lines = np.loadtxt(data)
61 val = np.reshape(lines, (xDim,yDim))
62 plt.imshow(val, extent=(1,xDim,1,yDim), interpolation=
'nearest',
69 output_str = pltval + num_str.rjust(5,
'0') +
".png" 70 fig.savefig(output_str)
75 def plot_wfc(xDim, yDim, data_dir, pltval, start, end, incr):
76 if data_dir[0] !=
"/":
77 data_dir =
"../" + data_dir
78 for i
in range(start,end,incr):
80 data_real = data_dir +
"/wfc_0_const_%s" % i
81 data_im = data_dir +
"/wfc_0_consti_%s" % i
90 lines_real = np.loadtxt(data_real)
91 lines_im = np.loadtxt(data_im)
92 wfc_real = np.reshape(lines_real, (xDim,yDim));
93 wfc_im = np.reshape(lines_im, (xDim,yDim));
95 wfc = abs(wfc_real + 1j * wfc_im)
102 plt.imshow(wfc, extent=(-6.9804018707623236e-04,6.9804018707623236e-04,-6.9804018707623236e-04,6.9804018707623236e-04), interpolation=
'nearest',
111 if data_dir[0] !=
"/":
112 data_dir =
"../" + data_dir
114 data_real = data_dir +
"/" + pltval +
"_0" 115 data_im = data_dir +
"/" + pltval +
"i_0" 117 lines_real = np.loadtxt(data_real)
118 lines_im = np.loadtxt(data_im)
119 wfc_real = np.reshape(lines_real, (xDim,yDim));
120 wfc_im = np.reshape(lines_im, (xDim,yDim));
122 wfc = abs(wfc_real + 1j * wfc_im)
125 plt.imshow(wfc, extent=(1,xDim,1,yDim), interpolation=
'nearest',
133 def plot_wfc_k(xDim, yDim, data_dir, pltval, start, end, incr):
134 if data_dir[0] !=
"/":
135 data_dir =
"../" + data_dir
137 for i
in range(start,end,incr):
139 data_real = data_dir +
"/wfc_0_const_%s" % i
140 data_im = data_dir +
"/wfc_0_consti_%s" % i
144 lines_real = np.loadtxt(data_real)
145 lines_im = np.loadtxt(data_im)
146 wfc_real = np.reshape(lines_real, (xDim,yDim));
147 wfc_im = np.reshape(lines_im, (xDim,yDim));
149 wfc = (wfc_real + 1j * wfc_im)
151 wfc_k = np.fft.fft2(wfc)
152 wfc_k_plot = np.abs(np.fft.fftshift(wfc_k))
153 wfc_k_plot = wfc_k_plot**2
155 plt.imshow(wfc_k_plot, extent=(1,xDim,1,yDim), interpolation=
'nearest',
164 if data_dir[0] !=
"/":
165 data_dir =
"../" + data_dir
166 for i
in range(start,end,incr):
168 data_real = data_dir +
"/wfc_0_const_%s" % i
169 data_im = data_dir +
"/wfc_0_consti_%s" % i
173 lines_real = np.loadtxt(data_real)
174 lines_im = np.loadtxt(data_im)
175 wfc_real = np.reshape(lines_real, (xDim,yDim));
176 wfc_im = np.reshape(lines_im, (xDim,yDim));
178 wfc = (wfc_real + 1j * wfc_im)
181 plt.imshow(wfc, extent=(1,xDim,1,yDim), interpolation=
'nearest',
194 print(string_list[i])
195 while i < len(string_list):
197 if (string_list[i] ==
"d"):
198 par.data_dir = string_list[i+1]
201 elif (string_list[i] ==
"i"):
202 par.item = string_list[i+1]
205 elif (string_list[i] ==
"r"): 206 par.start = int(string_list[i+1]) 207 par.end = int(string_list[i+2]) + 1 208 par.incr = int(string_list[i+3]) 212 elif (string_list[i] ==
"g"):
213 par.xDim = int(string_list[i+1])
214 par.yDim = int(string_list[i+2])
219 if (par.item ==
"wfc"):
220 plot_wfc(par.xDim, par.yDim, par.data_dir, par.item,
221 par.start, par.end, par.incr)
222 elif (par.item ==
"wfc_k"):
223 plot_wfc_k(par.xDim, par.yDim, par.data_dir, par.item,
224 par.start, par.end, par.incr)
225 elif (par.item ==
"wfc_phase"):
227 par.start, par.end, par.incr)
228 elif (par.item ==
"GK" or par.item ==
"GV"):
229 plot_complex(par.xDim, par.yDim, par.data_dir, par.item,
230 par.start, par.end, par.incr)
233 par.start, par.end, par.incr)
235 plot_var(par.xDim, par.yDim, par.data_dir, par.item)
def plot_wfc_k(xDim, yDim, data_dir, pltval, start, end, incr)
def parse_args(string_list)
def plot_wfc(xDim, yDim, data_dir, pltval, start, end, incr)
def plot_wfc_phase(xDim, yDim, data_dir, pltval, start, end, incr)
def plot_complex(xDim, yDim, data_dir, pltval, start, end, incr)
def plot_var(xDim, yDim, data_dir, pltval)
def plot_var_range(xDim, yDim, data_dir, pltval, start, end, incr)
Latin Modern latex print('-dpng','-r300', ['./Comp_CBAR_', int2str(iii),'.png'])