Commits

J.S. Oishi committed e8eeb34

more.

Comments (0)

Files changed (2)

advanced_visualization.tex

 
 \bigsimple{What about Profiles?}
 
+\begin{frame}[fragile,t]{Make a profile object}
+  \tiny
+  <<d['scripts/profile.py|fn|pyg|l']>>
+  \hline
+  \tiny
+  <<d['scripts/profile.py|fn|py|pyg|l']>>  
+\end{frame}
 
+\begin{frame}[fragile,t]{These are just numpy arrays!}
+  \tiny
+  <<d['scripts/profile.py|fn|py|pyg|l']>>  
+\end{frame}
+
+\begin{frame}[fragile,t]{So, let's plot them.}
+  \tiny
+  <<d['scripts/profile2.py|fn|pyg|l']>>  
+\end{frame}
+
+\fullimage{density_profile.png}
 
 \bigsimple{Let's get more complicated.}
 

scripts/profile2.py

+import pylab as P
+from yt.config import ytcfg
+ytcfg['yt','suppressStreamLogging'] = 'True'
+from yt.mods import *
+
+pf  = load("data/enzo_tiny_cosmology/DD0042/DD0042")
+c = pf.h.find_max("Density")[1]
+sph = pf.h.sphere(c, 10./pf['mpc']) # a 1 Mpc sphere
+
+prof = BinnedProfile1D(sph, 32, "RadiusMpc", 1, 10)
+prof.add_fields("Density")
+prof.add_fields("Temperature")
+
+fig = P.figure()
+d_ax = fig.add_axes([0.15,0.1,0.80,0.35])
+t_ax = fig.add_axes([0.15,0.45,0.80,0.35])
+
+d_ax.loglog(prof['RadiusMpc'], prof['Density'], 
+         lw=2.0, linestyle=':')
+t_ax.loglog(prof['RadiusMpc'], prof['Temperature'], 
+         lw=2.0, linestyle='-')
+
+d_ax.set_xlabel(r'Radius (Mpc)', fontsize=16)
+d_ax.set_ylabel(r'$\mathrm{Density\ (g\ cm^{-3})}$', fontsize=16)
+t_ax.set_ylabel(r'Temperature (K)', fontsize=16)
+
+fig.savefig('density_profile.png')