Commit 8b75662a authored by YesunHuang's avatar YesunHuang
Browse files

Seperate Save function

parent 2df40450
......@@ -96,42 +96,5 @@ print('Time cost:'+str(te-ts)+'s')
np.savetxt('Data/population_g_'+str(g)+'_Ea_'+str(Ea)+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.txt',data)
np.save('Data/population_g_'+str(g)+'_Ea_'+str(Ea)+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.npy',data)
#print population
fig, axes = plt.subplots(3,1 , figsize=(3,18))
axes[0].set_xlabel(r'$\Delta_b$')
axes[1].set_xlabel(r'$\Delta_b$')
axes[1].set_xlabel(r'$\Delta_b$')
axes[0].set_ylabel(r'$\langle b^{\dagger}b\rangle$')
axes[1].set_ylabel(r'$\langle c^{\dagger}c\rangle$')
axes[2].set_ylabel(r'$\langle a^{\dagger}a\rangle$')
axes[0].plot(DeltaB,data[...,0],linestyle='-')
axes[1].plot(DeltaB,data[...,1],linestyle='-')
axes[2].plot(DeltaB,data[...,2],linestyle='-')
fig.savefig('imgs/population_g_'+str(g)+'_Ea_'+str(Ea)+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.svg',dpi=600,format='svg',bbox_inches='tight')
#print other data
fig, axes = plt.subplots(3,2,figsize=(12,18))
axes[0,0].set_xlabel(r'$\Delta_b$')
axes[0,1].set_xlabel(r'$\Delta_b$')
axes[1,0].set_xlabel(r'$\Delta_b$')
axes[1,1].set_xlabel(r'$\Delta_b$')
axes[2,0].set_xlabel(r'$\Delta_b$')
axes[2,1].set_xlabel(r'$\Delta_b$')
#axes[0,1].set_ylim(0,5)
#axes[1,0].set_ylim(0,2)
#axes[1,1].set_ylim(0,2)
#axes[2,0].set_ylim(0,2)
axes[0,0].plot(DeltaB,data[...,4],linestyle='-.')
axes[0,1].plot(DeltaB,data[...,5],linestyle='-.')
axes[1,0].plot(DeltaB,data[...,8],linestyle='-.')
axes[1,1].plot(DeltaB,data[...,6],linestyle='-.')
axes[2,0].plot(DeltaB,data[...,7],linestyle='-.')
axes[2,1].plot(DeltaB,data[...,0],linestyle='-.')
axes[0,0].set_ylabel(r'$g_2ab$')
axes[0,1].set_ylabel(r'$g_2ac$')
axes[1,0].set_ylabel(r'$g_2a$')
axes[1,1].set_ylabel(r'$g_2b$')
axes[2,0].set_ylabel(r'$g_2c$')
axes[2,1].set_ylabel(r'$t_max$')
fig.savefig('imgs/otherData_g_'+str(g)+'_Ea_'+str(Ea)+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.svg',dpi=600,format='svg',bbox_inches='tight')
......@@ -2,7 +2,6 @@
#SBATCH -J SFG_Search
#SBATCH -o job-%j.log
#SBATCH -e job-%j.err
#SBATCH -N 4 -n 8
#SBATCH -N 4 -n 16
cd /gpfs/home/quaninfo/yesunhuang/SFG
conda activate sfg_dev
python SFG_search.py
import numpy as np
from scipy import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from matplotlib.pyplot import MultipleLocator
import time
#load data
g=1
Ea=1
DeltaB_s=-4.0;DeltaB_e=4.0
data=np.load('Data/population_g_'+str(g)+'_Ea_'+str(Ea)+'_DeltaB_'+str(DeltaB_s)+'-'+str(DeltaB_e)+'.npy')
DeltaB=np.linspace(DeltaB_s,DeltaB_e,np.size(data,0))
#print population
fig, axes = plt.subplots(3,1 , figsize=(3,18))
axes[0].set_xlabel(r'$\Delta_b$')
axes[1].set_xlabel(r'$\Delta_b$')
axes[1].set_xlabel(r'$\Delta_b$')
axes[0].set_ylabel(r'$\langle b^{\dagger}b\rangle$')
axes[1].set_ylabel(r'$\langle c^{\dagger}c\rangle$')
axes[2].set_ylabel(r'$\langle a^{\dagger}a\rangle$')
axes[0].plot(DeltaB,data[...,1],linestyle='-')
axes[1].plot(DeltaB,data[...,2],linestyle='-')
axes[2].plot(DeltaB,data[...,3],linestyle='-')
fig.savefig('imgs/population_g_'+str(g)+'_Ea_'+str(Ea)+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.svg',dpi=600,format='svg',bbox_inches='tight')
#print other data
fig, axes = plt.subplots(3,2,figsize=(12,18))
axes[0,0].set_xlabel(r'$\Delta_b$')
axes[0,1].set_xlabel(r'$\Delta_b$')
axes[1,0].set_xlabel(r'$\Delta_b$')
axes[1,1].set_xlabel(r'$\Delta_b$')
axes[2,0].set_xlabel(r'$\Delta_b$')
axes[2,1].set_xlabel(r'$\Delta_b$')
#axes[0,1].set_ylim(0,5)
#axes[1,0].set_ylim(0,2)
#axes[1,1].set_ylim(0,2)
#axes[2,0].set_ylim(0,2)
axes[0,0].plot(DeltaB,data[...,4],linestyle='-.')
axes[0,1].plot(DeltaB,data[...,5],linestyle='-.')
axes[1,0].plot(DeltaB,data[...,8],linestyle='-.')
axes[1,1].plot(DeltaB,data[...,6],linestyle='-.')
axes[2,0].plot(DeltaB,data[...,7],linestyle='-.')
axes[2,1].plot(DeltaB,data[...,0],linestyle='-.')
axes[0,0].set_ylabel(r'$g_2ab$')
axes[0,1].set_ylabel(r'$g_2ac$')
axes[1,0].set_ylabel(r'$g_2a$')
axes[1,1].set_ylabel(r'$g_2b$')
axes[2,0].set_ylabel(r'$g_2c$')
axes[2,1].set_ylabel(r'$t_max$')
fig.savefig('imgs/otherData_g_'+str(g)+'_Ea_'+str(Ea)+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.svg',dpi=600,format='svg',bbox_inches='tight')
\ No newline at end of file
import numpy as np
from scipy import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from matplotlib.pyplot import MultipleLocator
import time
g=2
DeltaB_s=-4.0;DeltaB_e=4.0
Ea_s=0.1;Ea_e=1.0
data=np.load('Data/population_g_'+str(g)+'_Ea_'+str(Ea_s)+'-'+str(Ea_e)+'_DeltaB_'+str(DeltaB_s)+'-'+str(DeltaB_e)+'.npy')
DeltaB=np.linspace(DeltaB_s,DeltaB_e,np.size(data,1))
Ea=np.linspace(Ea_s,Ea_e,np.size(data,0))
#print population
fig = plt.figure(figsize=(6,18))
axes=[]
axes.append(fig.add_subplot(3, 1, 1))
axes.append(fig.add_subplot(3, 1, 2))
axes.append(fig.add_subplot(3, 1, 3))
ax0=axes[0].contourf(DeltaB,Ea,data[:,:,0],cmap=cm.coolwarm)
ax1=axes[1].contourf(DeltaB,Ea,data[:,:,1],cmap=cm.coolwarm)
ax3=axes[2].contourf(DeltaB,Ea,data[:,:,2],cmap=cm.coolwarm)
ax00=axes[0].contour(DeltaB,Ea,data[:,:,0],ax0.levels)
ax11=axes[1].contour(DeltaB,Ea,data[:,:,1],ax1.levels)
ax11=axes[2].contour(DeltaB,Ea,data[:,:,2],ax1.levels)
#fmt = '%1.2f '
axes[0].clabel(ax00, ax00.levels, inline=True)
axes[1].clabel(ax11, ax11.levels, inline=True)
axes[2].clabel(ax11, ax11.levels, inline=True)
axes[0].set_xlabel(r'$\Delta_b$');axes[1].set_xlabel(r'$\Delta_b$');axes[2].set_xlabel(r'$\Delta_b$')
axes[0].set_ylabel(r'$E_a$');axes[1].set_ylabel(r'$E_a$');axes[2].set_ylabel(r'$E_a$')
bar1=fig.colorbar(ax0,ax=axes[0],pad=0.1)
bar2=fig.colorbar(ax1,ax=axes[1],pad=0.1)
bar2=fig.colorbar(ax1,ax=axes[2],pad=0.1)
fig.savefig('imgs/population_g_'+str(g)+'_Ea_'+str(Ea[0])+'-'+str(Ea[-1])+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.svg',dpi=600,format='svg',bbox_inches='tight')
#print other data
fig = plt.figure(figsize=(12,18))
axes=[]
for i in range(0,6):
axes.append(fig.add_subplot(3, 2, i+1))
ax_s=axes[i].contourf(DeltaB,Ea,data[:,:,(i+3)%9],cmap=cm.coolwarm)
ax_ss=axes[i].contour(DeltaB,Ea,data[:,:,(i+3)%9],ax_s.levels)
axes[i].clabel(ax_ss, ax_ss.levels, inline=True)
axes[i].set_xlabel(r'$\Delta_b$')
axes[0].set_ylabel(r'$E_a$')
fig.colorbar(ax_s,ax=axes[i],pad=0.1)
axes[0].set_ylabel(r'$[g_2ab]E_a$')
axes[1].set_ylabel(r'$[g_2ac]E_a$')
axes[2].set_ylabel(r'$[g_2a]E_a$')
axes[3].set_ylabel(r'$[g_2b]E_a$')
axes[4].set_ylabel(r'$[g_2c]E_a$')
axes[5].set_ylabel(r'$[t_max]E_a$')
fig.savefig('imgs/otherData_g_'+str(g)+'_Ea_'+str(Ea[0])+'-'+str(Ea[-1])+'_DeltaB_'+str(DeltaB[0])+'-'+str(DeltaB[-1])+'.svg',dpi=600,format='svg',bbox_inches='tight')
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment