In [ ]:
%matplotlib inline
import yt
yt.mylog.setLevel("ERROR")
import numpy as np
import matplotlib
matplotlib.rcParams['figure.dpi'] = 150
import matplotlib.pyplot as plt
from tools import setup_cl
In [ ]:
dirs = [
#'/home/ychen/data/0only_1110_h0_rerun/',
#'/home/ychen/data/0only_0529_h1/',
#'/home/ychen/data/0only_0605_hinf/',
#'/home/ychen/data/0only_1212_h0_10Myr_rerun/',
#'/home/ychen/data/0only_1022_h1_10Myr/',
#'/home/ychen/data/0only_0204_hinf_10Myr/'
'/home/ychen/data/0only_0330_h0_nojiggle/',
'/home/ychen/data/0only_0314_h1_nojiggle/',
'/home/ychen/data/0only_0525_hinf_nojiggle/'
]
colors, labels = setup_cl(dirs)
for dir in dirs:
data = np.loadtxt(dir+'GridAnalysis_MagneticFields_150kpc.txt')
label = labels[dir]
tt = data[:,1]
EBtor = data[:,2]
EBr = data[:,3]
EBz = data[:,4]
Emag = data[:,5]
plt.plot(tt, EBtor, ls=':', color=colors[dir])#, label=r'$E_{Btor}$')
plt.plot(tt, EBz, ls='--', color=colors[dir])#, label=r'$E_{Bpol}$')
#plt.plot(tt, EBz, ls='-.', color=colors[dir], label='z')
plt.plot(tt, Emag, ls='-', color=colors[dir], label=label)
p1 = plt.plot([],[],ls='--', color='k', label=r'$E_{Bz}$')
p2 = plt.plot([],[],ls=':', color='k', label=r'$E_{B\phi}$')
p3 = plt.plot([],[],ls='-', color='k', label=r'$E_{B}$')
handles, labels = plt.axes().get_legend_handles_labels()
# reverse the order
plt.legend(handles[::-1], labels[::-1], ncol=2, loc=2)
plt.grid()
dummy_lines = [p1,p2,p3]
#leg2 = plt.legend(dummy_lines, loc=2)
#plt.axes().add_artist(leg2)
#plt.legend(ncol=2, loc=1)
#plt.ylabel('z (kpc)')
plt.xlim(0.2,5)
plt.xlabel('t (Myr)')
plt.ylim(3E55,3E57)
plt.ylabel('magnetic energy (erg)')
plt.semilogy()
plt.semilogx()
ticks = [0.2,0.4,0.6,0.8,1,2,3,4,5]
plt.xticks(ticks, ticks)
plt.savefig('MagEnergy_nojiggle.pdf')
In [ ]:
dirs = [
#'/home/ychen/data/0only_1110_h0_rerun/',
#'/home/ychen/data/0only_0529_h1/',
#'/home/ychen/data/0only_0605_hinf/',
#'/home/ychen/data/0only_1212_h0_10Myr_rerun/',
#'/home/ychen/data/0only_1022_h1_10Myr/',
#'/home/ychen/data/0only_0204_hinf_10Myr/'
'/home/ychen/data/0only_0330_h0_nojiggle/',
'/home/ychen/data/0only_0314_h1_nojiggle/',
'/home/ychen/data/0only_0525_hinf_nojiggle/'
]
colors, labels = setup_cl(dirs)
for dir in dirs:
data = np.loadtxt(dir+'GridAnalysis_MagneticFields_150kpc.txt')
label = labels[dir]
tt = data[:,1]
EBtor = data[:,2]
EBr = data[:,3]
EBz = data[:,4]
Emag = data[:,5]
plt.plot(tt, EBtor/Emag, ls=':', color=colors[dir], label='tor')
plt.plot(tt, EBz/Emag, ls='-.', color=colors[dir], label=label)
handles, labels = plt.axes().get_legend_handles_labels()
# reverse the order
plt.legend(handles[::-1], labels[::-1], loc=1)
#plt.ylabel('z (kpc)')
plt.xlabel('t (Myr)')
plt.xlim(0,10)
#plt.semilogy()
#plt.semilogx()
plt.axvline(10, ls=':', lw=1, alpha=0.5)
plt.ylim(0,2)
#plt.savefig('LobeSize_20Myr.pdf')
#plt.semilogx()
In [ ]:
dirs = [
#'/home/ychen/data/0only_1110_h0_rerun/',
#'/home/ychen/data/0only_0529_h1/',
#'/home/ychen/data/0only_0605_hinf/',
#'/home/ychen/data/0only_1212_h0_10Myr_rerun/',
#'/home/ychen/data/0only_1022_h1_10Myr/',
#'/home/ychen/data/0only_0204_hinf_10Myr/'
'/home/ychen/data/0only_0330_h0_nojiggle/',
'/home/ychen/data/0only_0314_h1_nojiggle/',
'/home/ychen/data/0only_0525_hinf_nojiggle/'
]
colors, labels = setup_cl(dirs)
for dir in dirs:
data = np.loadtxt(dir+'GridAnalysis_MagneticFields_150kpc.txt')
label = labels[dir]
tt = data[:,1]
EBtor = data[:,2]
EBr = data[:,3]
EBz = data[:,4]
Emag = data[:,5]
V = data[:,6]
V_thres = data[:,7]
Mjet = data[:,8]
plt.plot(tt, np.sqrt(Emag*erg*8*np.pi/V/kpc**3).in_units('G')*1E6, ls=':', color=colors[dir], label=label)
#plt.plot(tt, Emag/V_thres, ls='-.', color=colors[dir], label='B2')
handles, labels = plt.axes().get_legend_handles_labels()
# reverse the order
plt.legend(handles[::-1], labels[::-1], loc=1)
#plt.ylabel('z (kpc)')
plt.xlabel('t (Myr)')
plt.xlim(0,10)
#plt.semilogy()
#plt.semilogx()
#plt.axvline(10, ls=':', lw=1, alpha=0.5)
#plt.ylim(0,2)
#plt.savefig('LobeSize_20Myr.pdf')
#plt.semilogx()
In [ ]:
dirs = [
#'/home/ychen/data/0only_1110_h0_rerun/',
#'/home/ychen/data/0only_0529_h1/',
#'/home/ychen/data/0only_0605_hinf/',
#'/home/ychen/data/0only_1212_h0_10Myr_rerun/',
#'/home/ychen/data/0only_1022_h1_10Myr/',
#'/home/ychen/data/0only_0204_hinf_10Myr/'
'/home/ychen/data/0only_0330_h0_nojiggle/',
'/home/ychen/data/0only_0314_h1_nojiggle/',
'/home/ychen/data/0only_0525_hinf_nojiggle/'
]
colors, labels = setup_cl(dirs)
for dir in dirs:
data = np.loadtxt(dir+'GridAnalysis_MagneticFields_150kpc.txt')
label = labels[dir]
tt = data[:,1]
Mjet = data[:,8]
plt.plot(tt, Mjet, ls='-', color=colors[dir], label=label)
#plt.plot(tt, Emag/V_thres, ls='-.', color=colors[dir], label='B2')
handles, labels = plt.axes().get_legend_handles_labels()
# reverse the order
plt.legend(handles[::-1], labels[::-1], loc=1)
#plt.ylabel('z (kpc)')
plt.xlabel('t (Myr)')
plt.xlim(0,10)
#plt.semilogy()
#plt.semilogx()
#plt.axvline(10, ls=':', lw=1, alpha=0.5)
#plt.ylim(0,2)
#plt.savefig('LobeSize_20Myr.pdf')
In [ ]: