1. Matthew Turk
  2. 2011-yt-princeton-tutorial

Commits

Matthew Turk  committed a2cd27b

Adding a few items.

  • Participants
  • Parent commits 9e663b3
  • Branches default

Comments (0)

Files changed (3)

File scripts/derived_fields.py

View file
+from yt.mods import *
+
+@derived_field(name = "Dinosaurs", units = "TRexPerS")
+def Dinosaurs(field, data):
+    return (data["Density"]**(2./3) /
+            data["Temperature"]**(0.5))
+
+pf = load("DD0023/DD0023")
+dd = pf.h.all_data()
+
+dinosaurs, = dd.quantities["TotalQuantity"](["Dinosaurs"])
+print "Total T-Rexes per Second: %0.3e" % (dinosaurs)

File scripts/phase_plot.py

View file
+from yt.mods import *
+
+pf = load("DD0087/DD0087")
+v, c = pf.h.find_max("Density")
+pc = PlotCollection(pf, c)
+
+pc.add_phase_sphere(100.0, "au",
+    ["Density", "Temperature", "MagneticEnergy"])
+
+pc.add_phase_sphere(100.0, "au",
+    ["Density", "Temperature", "CellMassMsun"],
+    weight = None)
+
+pc.save()

File yt_intro.tex

View file
 \newcommand{\bigsimple}[1]{
   \begin{frame}[c]{}
   \begin{center}
+    {\Huge \textbf{#1} }
+  \end{center}
+  \end{frame}
+}
+\newcommand{\mediumsimple}[1]{
+  \begin{frame}[c]{}
+  \begin{center}
     \textbf{#1}
   \end{center}
   \end{frame}
 \usepackage{fancyvrb}
 \usepackage{../pastie}
 
-
 \title{\yt{}: A Deep Dive}
 
 \begin{document}
 \end{itemize}
 \end{frame}
 
+\bigsimple{Simple stuff: The Command Line}
+
 \begin{frame}[fragile,t]{}
 \small
 <<d['scripts/yt_stats.sh|fn|pyg|l']>>
 <<d['scripts/yt_render_help.sh|fn|bash|pyg|l']>>
 \end{frame}
 
+\bigsimple{Simple stuff: Scripting}
+
+\mediumsimple{type: py-yt (or python) and your script name}
+
+\bigsimple{First, we make a bit of data.}
+
 \begin{frame}[fragile,t]{}
 \small
 <<d['scripts/load_data.py|fn|pyg|l']>>
 <<d['scripts/load_data.py|fn|py|pyg|l']>>
 \end{frame}
 
+\bigsimple{Now, let's make some plots.}
+
 \begin{frame}[fragile,t]{}
 \small
 <<d['scripts/yt_plot_collection.py|fn|pyg|l']>>
 
 \fullimage{DD0023_Slice_z_Density.png}
 
+\bigsimple{But it's cosmology, so can we find halos, too?}
+
 \begin{frame}[fragile,t]{}
 \small
 <<d['scripts/halo_plotting.py|fn|pyg|l']>>
 
 \fullimage{DD0023_Projection_y_Density_Density.png}
 
+\bigsimple{Let's dig deeper into our data.}
+
 \begin{frame}[fragile,t]{}
 \tiny
 <<d['scripts/inspect_grids.py|fn|pyg|l']>>
 <<d['scripts/inspect_grids.py|fn|py|pyg|l']>>
 \end{frame}
 
+\bigsimple{Simple Scripting: Data Objects}
+
 \begin{frame}[fragile,t]{}
 \tiny
 <<d['scripts/create_sphere.py|fn|pyg|l']>>
 \end{frame}
 
 \begin{frame}[fragile,t]{}
+\tiny
+<<d['scripts/derived_fields.py|fn|pyg|l']>>
+\hline
+<<d['scripts/derived_fields.py|fn|py|pyg|l']>>
 \end{frame}
 
+\begin{frame}[fragile,t]{}
+\tiny
+<<d['scripts/phase_plot.py|fn|pyg|l']>>
+\hline
+<<d['scripts/phase_plot.py|fn|py|pyg|l']>>
+\end{frame}
+\fullimage{DD0087_Profile2D_0_Density_Temperature_MagneticEnergy.png}
+\fullimage{DD0087_Profile2D_1_Density_Temperature_CellMassMsun.png}
+
 \end{document}