[yt-svn] commit/yt-doc: 3 new changesets

Bitbucket commits-noreply at bitbucket.org
Thu Jan 31 12:17:27 PST 2013


3 new commits in yt-doc:

https://bitbucket.org/yt_analysis/yt-doc/commits/65f949be3172/
changeset:   65f949be3172
user:        juxtaposicion
date:        2013-01-30 23:16:16
summary:     added plot annotations
added off axis plots
added new field and new quantity snippets
affected #:  1 file

diff -r 54e5330b26137d6aec682c2587c7d7b95b4b0e48 -r 65f949be3172ef6e2bfa65d3d350a98ad2059007 cheatsheet.tex
--- a/cheatsheet.tex
+++ b/cheatsheet.tex
@@ -2,6 +2,7 @@
 \usepackage{multicol}
 \usepackage{calc}
 \usepackage{ifthen}
+\usepackage{listings}
 \usepackage[landscape]{geometry}
 \usepackage[colorlinks = true, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref}
 
@@ -255,10 +256,24 @@
 \texttt{pf.h.save\_object(sp, {\it "sp\_for\_later"})} \textemdash\ Save an object (\texttt{sp}) for later use.\\
 \texttt{sp = pf.h.load\_object({\it "sp\_for\_later"})} \textemdash\ Recover a saved object.\\
 
+
+Define a new field \\
+\texttt{def \_MetalMassMsun({\it field},{\it data})}\\
+\texttt{\hspace{4 mm} return data["Metallicity"]*data["CellMassMsun"]}\\
+\texttt{add\_field("MetalMassMsun",function=\_MetalMassMsun)}\\
+Define a new quantity; note the first function operates on grids and data objects and the second on the results of the first. \\
+\texttt{def \_TotalMass(data): }\\
+\texttt{\hspace{4 mm} baryon\_mass = data["CellMassMsun"].sum()}\\
+\texttt{\hspace{4 mm} particle\_mass = data["ParticleMassMsun"].sum()}\\
+\texttt{\hspace{4 mm} return baryon\_mass, particle\_mass}\\
+\texttt{def \_combTotalMass(data, baryon\_mass, particle\_mass):}\\
+\texttt{\hspace{4 mm} return baryon\_mass.sum() + particle\_mass.sum()}\\
+\texttt{add\_quantity("TotalMass", function=\_TotalMass,}\\
+\texttt{\hspace{4 mm} combine\_function=\_combTotalMass, n\_ret = 2)}\\
+
 \end{tabular}
 
-
-\subsection{Plots and Projections}
+\subsection{Slices and Projections}
 \settowidth{\MyLen}{\texttt{multicol} }
 %\begin{tabular}{@{}p{\the\MyLen}%
 %               @{}p{\linewidth-\the\MyLen}@{}}
@@ -269,11 +284,32 @@
 \texttt{slc.save({\it file\_prefix})} \textemdash\ Save the slice to a png with name prefix {\it file\_prefix}.
 \texttt{.save()} works similarly for the commands below.\\
 
-\texttt{prj = ProjectionPlot(pf, {\it axis}, {\it field}, {\it addit. params})} \textemdash\ Make a projection.
+\texttt{prj = ProjectionPlot(pf, {\it axis}, {\it field}, {\it addit. params})} \textemdash\ Make a projection. \\
+\texttt{prj = OffAxisSlicePlot(pf, {\it normal}, {\it fields}, {\it center=}, {\it width=}, {\it depth=},{\it north\_vector=},{\it weight\_field=})} \textemdash Make an off-axis slice. Note this takes an array of fields. \\
+\texttt{prj = OffAxisProjectionPlot(pf, {\it normal}, {\it fields}, {\it center=}, {\it width=}, {\it depth=},{\it north\_vector=},{\it weight\_field=})} \textemdash Make an off axis projection. Note this takes an array of fields. \\
 
 \end{tabular}
 
-
+\subsection{Plot Annotations}
+\settowidth{\MyLen}{\texttt{multicol} }
+Plot callbacks are functions itemized in a registry that is attached to every plot object. They can be accessed and then called like \texttt{ prj.modify["velocity"](factor=16,normalize=False)}. Most callbacks also accept a {\it plot\_args} dict that is fed to matplotlib annotator. \\
+\begin{tabular}{@{}p{8cm}}
+\texttt{velocity({\it factor=},{\it scale=},{\it scale\_units=}, {\it normalize=})} \textemdash\ Uses field "x-velocity" to draw quivers\\
+\texttt{magnetic\_field({\it factor=},{\it scale=},{\it scale\_units=}, {\it normalize=})} \textemdash\ Uses field "Bx" to draw quivers\\
+\texttt{quiver({\it field\_x},{\it field\_y},{\it factor=},{\it scale=},{\it scale\_units=}, {\it normalize=})} \\
+\texttt{contour({\it field=},{\it ncont=},{\it factor=},{\it clim=},{\it take\_log=}, {\it additional parameters})} \textemdash Plots a number of contours {\it ncont} to interpolate {\it field} optionally using {\it take\_log}, upper and lower {\it c}ontour{\it lim}its and {\it factor} number of points in the interpolation.\\
+\texttt{grids({\it alpha=}, {\it draw\_ids=}, {\it periodic=}, {\it min\_level=}, {\it max\_level=})} \textemdash Add grid boundaries. \\
+\texttt{streamlines({\it field\_x},{\it field\_y},{\it factor=},{\it density=})}\\
+\texttt{clumps({\it clumplist})} \textemdash Generate {\it clumplist} using the clump finder and plot. \\
+\texttt{arrow({\it pos}, {\it code\_size})} Add an arrow at a {\it pos}ition. \\
+\texttt{point({\it pos}, {\it text})} \textemdash Add text at a {\it pos}ition. \\
+\texttt{marker({\it pos}, {\it marker=})} \textemdash Add a matplotlib-defined marker at a {\it pos}ition. \\
+\texttt{sphere({\it center}, {\it radius}, {\it text=})} \textemdash Draw a circle and append {\it text}.\\
+\texttt{hop\_circles({\it hop\_output}, {\it max\_number=}, {\it annotate=}, {\it min\_size=}, {\it max\_size=}, {\it font\_size=}, {\it print\_halo\_size=}, {\it fixed\_radius=}, {\it min\_mass=}, {\it print\_halo\_mass=}, {\it width=})} \textemdash Draw a halo, printing it's ID, mass, clipping halos depending on number of particles ({\it size}) and optionally fixing the drawn circle radius to be constant for all halos.\\
+\texttt{hop\_particles({\it hop\_output},{\it max\_number=},{\it p\_size=},{\it min\_size},{\it alpha=}} Draw particle positions for member halos with a certain number of pixels per particle.\\
+\texttt{particles({\it width},{\it p\_size=},{\it col=}, {\it marker=}, {\it stride=}, {\it ptype=}, {\it stars\_only=}, {\it dm\_only=}, {\it minimum\_mass=}, {\it alpha=}}  \textemdash  Draw particles of {\it p\_size} pixels in a slab of {\it width} with {\it col}or using a matplotlib {\it marker} plotting only every {\it stride} number of particles.\\
+\texttt{title({\it text})}\\
+\end{tabular}
 
 \subsection{The $\sim$/.yt/ Directory}
 \settowidth{\MyLen}{\texttt{multicol} }


https://bitbucket.org/yt_analysis/yt-doc/commits/bf4077f86fd6/
changeset:   bf4077f86fd6
user:        juxtaposicion
date:        2013-01-31 21:01:45
summary:     adding in stephens corrections
affected #:  1 file

diff -r 65f949be3172ef6e2bfa65d3d350a98ad2059007 -r bf4077f86fd6cb83c97e7c2f7d219b58d8166a25 cheatsheet.tex
--- a/cheatsheet.tex
+++ b/cheatsheet.tex
@@ -2,7 +2,6 @@
 \usepackage{multicol}
 \usepackage{calc}
 \usepackage{ifthen}
-\usepackage{listings}
 \usepackage[landscape]{geometry}
 \usepackage[colorlinks = true, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref}
 
@@ -257,7 +256,8 @@
 \texttt{sp = pf.h.load\_object({\it "sp\_for\_later"})} \textemdash\ Recover a saved object.\\
 
 
-Define a new field \\
+\subsection{Defining New Fields & Quantities}
+\texttt{yt} expects on-disk fields, fields generated on-demand and in-memory. Quantities reduce a field (e.g. "Density") defined over an object (e.g. "sphere") to get a single value (e.g. "Mass").
 \texttt{def \_MetalMassMsun({\it field},{\it data})}\\
 \texttt{\hspace{4 mm} return data["Metallicity"]*data["CellMassMsun"]}\\
 \texttt{add\_field("MetalMassMsun",function=\_MetalMassMsun)}\\
@@ -273,6 +273,7 @@
 
 \end{tabular}
 
+
 \subsection{Slices and Projections}
 \settowidth{\MyLen}{\texttt{multicol} }
 %\begin{tabular}{@{}p{\the\MyLen}%


https://bitbucket.org/yt_analysis/yt-doc/commits/bcb26c76ff8c/
changeset:   bcb26c76ff8c
user:        juxtaposicion
date:        2013-01-31 21:04:52
summary:     missed a backslash
affected #:  1 file

diff -r bf4077f86fd6cb83c97e7c2f7d219b58d8166a25 -r bcb26c76ff8c007e2e8e6c84c0b6164cb562a2bc cheatsheet.tex
--- a/cheatsheet.tex
+++ b/cheatsheet.tex
@@ -256,8 +256,8 @@
 \texttt{sp = pf.h.load\_object({\it "sp\_for\_later"})} \textemdash\ Recover a saved object.\\
 
 
-\subsection{Defining New Fields & Quantities}
-\texttt{yt} expects on-disk fields, fields generated on-demand and in-memory. Quantities reduce a field (e.g. "Density") defined over an object (e.g. "sphere") to get a single value (e.g. "Mass").
+\subsection{Defining New Fields \& Quantities}
+\texttt{yt} expects on-disk fields, fields generated on-demand and in-memory. Quantities reduce a field (e.g. "Density") defined over an object (e.g. "sphere") to get a single value (e.g. "Mass"). \\
 \texttt{def \_MetalMassMsun({\it field},{\it data})}\\
 \texttt{\hspace{4 mm} return data["Metallicity"]*data["CellMassMsun"]}\\
 \texttt{add\_field("MetalMassMsun",function=\_MetalMassMsun)}\\

Repository URL: https://bitbucket.org/yt_analysis/yt-doc/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list