[yt-svn] commit/yt-doc: 8 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Feb 13 12:52:01 PST 2013
8 new commits in yt-doc:
https://bitbucket.org/yt_analysis/yt-doc/commits/e387b29fb0ce/
changeset: e387b29fb0ce
user: ngoldbaum
date: 2013-02-13 07:53:24
summary: Fixing sphinx build errors and warnings, moving things around, generally cleaning up.
affected #: 13 files
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/advanced/index.rst
--- a/source/advanced/index.rst
+++ b/source/advanced/index.rst
@@ -16,4 +16,5 @@
debugdrive
external_analysis
developing
+ creating_frontend
reason_architecture
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/advanced/parallel_computation.rst
--- a/source/advanced/parallel_computation.rst
+++ b/source/advanced/parallel_computation.rst
@@ -16,9 +16,9 @@
Currently, YT is able to
perform the following actions in parallel:
- * Projections (:ref:`how-to-make-projections`)
- * Slices (:ref:`how-to-make-slices`)
- * Cutting planes (oblique slices) (:ref:`how-to-make-oblique-slices`)
+ * Projections (:ref:`projection-plots`)
+ * Slices (:ref:`slice-plots`)
+ * Cutting planes (oblique slices) (:ref:`off-axis-slices`)
* Derived Quantities (total mass, angular momentum, etc) (:ref:`creating_derived_quantities`,
:ref:`derived-quantities`)
* 1-, 2-, and 3-D profiles (:ref:`generating-profiles-and-histograms`)
@@ -26,8 +26,8 @@
* Merger tree (:ref:`merger_tree`)
* Two point functions (:ref:`two_point_functions`)
* Volume rendering (:ref:`volume_rendering`)
- * Radial column density
- * Isocontours & flux calculations
+ * Radial column density (:ref: `radial-column-density`)
+ * Isocontours & flux calculations (:ref: `extracting-isocontour-information`)
This list covers just about every action YT can take! Additionally, almost all
scripts will benefit from parallelization without any modification. The goal
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/analysis_modules/index.rst
--- a/source/analysis_modules/index.rst
+++ b/source/analysis_modules/index.rst
@@ -15,6 +15,7 @@
planning_cosmology_simulations
absorption_spectrum
star_analysis
+ simulated_observations
halo_mass_function
two_point_functions
merger_tree
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/analysis_modules/simulated_observations.rst
--- /dev/null
+++ b/source/analysis_modules/simulated_observations.rst
@@ -0,0 +1,66 @@
+.. _simulated_observations:
+
+Generating Simulated Observations
+=================================
+
+yt has several facilities for generating simulated observations. Each of these
+comes with several caveats, and none should be expected to produce a completely
+finished product. You should investigate each option carefully and determine
+which, if any, will deliver the type of observation you are interested in.
+
+
+
+X-ray Observations
+++++++++++++++++++
+
+Under the assumption of optically thin gas, projections can be made
+using emissivity to generated simulated observations. yt includes a
+method for handling output from CLOUDY in the ROCO (Smith et al 2008)
+format, and generating integrated emissivity over given energy ranges.
+
+Caveats: The ROCO format for input requires some non-trivial handling
+of CLOUDY output.
+
+= SED Generation and Deposition =
+
+Using BC03 models for stellar population synthesis, star particles in
+a given calculation can be assigned an integrated flux for a specific
+bandpass. These fluxes can then be combined using either projections
+or volume rendering. This can use CIC interpolation to deposit a
+total flux into each cell (which should be flux-conserving, modulo a
+multiplicative factor not currently included) which is then either
+projected or volume rendered.
+
+Caveats: The deposition method produces far too washed out and murky
+results. The multiplicative factor is not currently set correctly
+universally.
+
+= Thermal Gas Emission =
+
+Applying a black body spectrum to the thermal content of the gas, we
+can volume render the domain and apply absorption based on broad
+arguments of scattering. One could theoretically include star
+particles as point sources in this, using recent changes to the volume
+renderer.
+
+Caveats: Scattering that results in re-emission is completely
+neglected, such as Halpha emission. Scattering that results in just
+attenuating the emission is set in an ad hoc fashion. Emission from
+point sources, if included at all, is included in a non-conservative
+fashion.
+
+= Export to Sunrise =
+
+Data can be exported to Sunrise for simulated observation generation.
+
+Caveats: This process is poorly documented.
+
+= SZ Compton y and SZ Kinetic Maps =
+
+Future Directions
+-----------------
+
+* ALMA maps
+* 21cm observations
+* Applying PSFs
+*
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/analyzing/loading_data.rst
--- a/source/analyzing/loading_data.rst
+++ b/source/analyzing/loading_data.rst
@@ -286,7 +286,7 @@
.. loading-amr-data:
Generic AMR Data
----------------
+----------------
It is possible to create native ``yt`` parameter file from Python's dictionary
that describes set of rectangular patches of data of possibly varying
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/api/api.rst
--- a/source/api/api.rst
+++ b/source/api/api.rst
@@ -239,7 +239,7 @@
.. autosummary::
:toctree: generated/
- ~yt.analysis_modules.light_cone.light_cone.LightCone
+ ~yt.analysis_modules.cosmological_observation.light_cone.light_cone.LightCone
Volume Rendering
^^^^^^^^^^^^^^^^
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/cookbook/index.rst
--- a/source/cookbook/index.rst
+++ b/source/cookbook/index.rst
@@ -27,4 +27,3 @@
complex_plots
cosmological_analysis
constructing_data_objects
- advanced
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/getting_involved/index.rst
--- a/source/getting_involved/index.rst
+++ b/source/getting_involved/index.rst
@@ -104,7 +104,8 @@
-----------------------
Contributing code is another excellent way to participate -- whether it's
-bug fixes, new features, analysis modules, or a new code frontend.
+bug fixes, new features, analysis modules, or a new code frontend. See
+:ref:`creating_frontend` for more details.
The process is pretty simple: fork on BitBucket, make changes, issue a pull
request. We can then go back and forth with comments in the pull request, but
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/visualizing/index.rst
--- a/source/visualizing/index.rst
+++ b/source/visualizing/index.rst
@@ -9,4 +9,3 @@
manual_plotting
volume_rendering
streamlines
-
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/visualizing/plots.rst
--- a/source/visualizing/plots.rst
+++ b/source/visualizing/plots.rst
@@ -104,6 +104,8 @@
:class:`~yt.visualization.plot_window.SlicePlot` for the full class
description.
+.. _projection-plots:
+
Projection Plots
~~~~~~~~~~~~~~~~
@@ -133,6 +135,8 @@
:class:`~yt.visualization.plot_window.ProjectionPlot` for the full
class description.
+.. _off-axis-slices:
+
Off Axis Slices
~~~~~~~~~~~~~~~
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/visualizing/simulated_observations.rst
--- a/source/visualizing/simulated_observations.rst
+++ /dev/null
@@ -1,64 +0,0 @@
-Generating Simulated Observations
-=================================
-
-yt has several facilities for generating simulated observations. Each of these
-comes with several caveats, and none should be expected to produce a completely
-finished product. You should investigate each option carefully and determine
-which, if any, will deliver the type of observation you are interested in.
-
-
-
-X-ray Observations
-++++++++++++++++++
-
-Under the assumption of optically thin gas, projections can be made
-using emissivity to generated simulated observations. yt includes a
-method for handling output from CLOUDY in the ROCO (Smith et al 2008)
-format, and generating integrated emissivity over given energy ranges.
-
-Caveats: The ROCO format for input requires some non-trivial handling
-of CLOUDY output.
-
-= SED Generation and Deposition =
-
-Using BC03 models for stellar population synthesis, star particles in
-a given calculation can be assigned an integrated flux for a specific
-bandpass. These fluxes can then be combined using either projections
-or volume rendering. This can use CIC interpolation to deposit a
-total flux into each cell (which should be flux-conserving, modulo a
-multiplicative factor not currently included) which is then either
-projected or volume rendered.
-
-Caveats: The deposition method produces far too washed out and murky
-results. The multiplicative factor is not currently set correctly
-universally.
-
-= Thermal Gas Emission =
-
-Applying a black body spectrum to the thermal content of the gas, we
-can volume render the domain and apply absorption based on broad
-arguments of scattering. One could theoretically include star
-particles as point sources in this, using recent changes to the volume
-renderer.
-
-Caveats: Scattering that results in re-emission is completely
-neglected, such as Halpha emission. Scattering that results in just
-attenuating the emission is set in an ad hoc fashion. Emission from
-point sources, if included at all, is included in a non-conservative
-fashion.
-
-= Export to Sunrise =
-
-Data can be exported to Sunrise for simulated observation generation.
-
-Caveats: This process is poorly documented.
-
-= SZ Compton y and SZ Kinetic Maps =
-
-Future Directions
------------------
-
-* ALMA maps
-* 21cm observations
-* Applying PSFs
-*
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/visualizing/volume_rendering.rst
--- a/source/visualizing/volume_rendering.rst
+++ b/source/visualizing/volume_rendering.rst
@@ -86,6 +86,7 @@
# To add the grid outlines to the image:
cam.draw_grids(im)
write_bitmap(im, 'test_rendering_with_grids.png')
+
Method
------
diff -r 5171d5fc896bc2b45b4dfa40ad6a00ea23dac794 -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad source/welcome/objects.rst
--- a/source/welcome/objects.rst
+++ b/source/welcome/objects.rst
@@ -53,6 +53,8 @@
fetches what is necessary--from code, physical, and reduced
objects as necessary.
+.. _intro_to_projections:
+
Flexible Projections: an Example of Reusable Data Reduction
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
https://bitbucket.org/yt_analysis/yt-doc/commits/ecb3831e4d97/
changeset: ecb3831e4d97
user: ngoldbaum
date: 2013-02-13 09:16:06
summary: Removing references to image panner docs, which have been removed.
affected #: 2 files
diff -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad -r ecb3831e4d97bc025f3865fbdecc6eddb58d418f source/api/api.rst
--- a/source/api/api.rst
+++ b/source/api/api.rst
@@ -312,9 +312,6 @@
Image Panning and Scanning
^^^^^^^^^^^^^^^^^^^^^^^^^^
-See also :ref:`image-panner`.
-
-
.. autosummary::
:toctree: generated/
diff -r e387b29fb0ce77c7366ace76d1a9a60258a2c9ad -r ecb3831e4d97bc025f3865fbdecc6eddb58d418f source/changelog.rst
--- a/source/changelog.rst
+++ b/source/changelog.rst
@@ -212,7 +212,7 @@
* Multi-band image writing (see :ref:`image_writer`)
* Parallel halo merger tree (see :ref:`merger_tree`)
* Parallel structure function generator (see :ref:`two_point_functions`)
- * Image pan and zoom object and display widget (see :ref:`image-panner`)
+ * Image pan and zoom object and display widget.
* Parallel volume rendering (see :ref:`volume_rendering`)
* Multivariate volume rendering, allowing for multiple forms of emission and
absorption, including approximate scattering and Planck emissions. (see
https://bitbucket.org/yt_analysis/yt-doc/commits/249659676822/
changeset: 249659676822
user: ngoldbaum
date: 2013-02-13 09:17:03
summary: Adding docs and a cookbook recipe for OffAxisProjectionPlot. Closes #489.
affected #: 3 files
diff -r ecb3831e4d97bc025f3865fbdecc6eddb58d418f -r 249659676822e4c3667deb7446b766ac03ae66f2 source/cookbook/offaxis_projection_colorbar.py
--- a/source/cookbook/offaxis_projection_colorbar.py
+++ b/source/cookbook/offaxis_projection_colorbar.py
@@ -14,26 +14,24 @@
# automatically.
L = [0.5, 0.4, 0.7]
-# Our "width" is the width of the image plane as well as the depth.
-# The first element is the left to right width, the second is the
-# top-bottom width, and the last element is the back-to-front width
+# Here, W is the width of the image. The first element is the left to right
+# width, the second is the top-bottom width. D, specified seperately, is the
+# back-to-front width. The widths can be specified in code units by supplying a
+# a list of floats or in arbitrary physical units by supplying a list of (width,
+# unit) tuples.
+# physical units by
# (all in code units)
-W = [0.04,0.04,0.4]
+W = [(40,'kpc'),(40,'kpc')]
+D = (40,'kpc')
-# The number of pixels along one side of the image.
-# The final image will have Npixel^2 pixels.
-Npixels = 512
+# Now we create an OffAxisProjectionPlot. Note that we set no_ghost equal to
+# False, so that we *do* include ghost zones in our data. This takes longer to
+# calculate, but the results look much cleaner than when you ignore the ghost
+# zones. Also note that we set the field which we want to project as "Density",
+# but really we could use any arbitrary field or list of fields (e.g
+# "Temperature", or ["Metallicity","VorticitySquared"]).
+image = OffAxisProjectionPlot(pf, L, "Density", center=c, width=w, depth=d)
-# Now we call the off_axis_projection function, which handles the rest.
-# Note that we set no_ghost equal to False, so that we *do* include ghost
-# zones in our data. This takes longer to calculate, but the results look
-# much cleaner than when you ignore the ghost zones.
-# Also note that we set the field which we want to project as "Density", but
-# really we could use any arbitrary field like "Temperature", "Metallicity"
-# or whatever.
-image = off_axis_projection(pf, c, L, W, Npixels, "Density", no_ghost=False)
-
-# Image is now an NxN array representing the intensities of the various pixels.
-# And now, we call our direct image saver. We save the log of the result.
-write_projection(image, "offaxis_projection_colorbar.png",
- colorbar_label="Column Density (cm$^{-2}$)")
+# Image is now an instance of PWViewerMPL, just like the other plot window
+# plots. It can be saved to disk very easily:
+filename = image.save()
diff -r ecb3831e4d97bc025f3865fbdecc6eddb58d418f -r 249659676822e4c3667deb7446b766ac03ae66f2 source/visualizing/plots.rst
--- a/source/visualizing/plots.rst
+++ b/source/visualizing/plots.rst
@@ -15,12 +15,12 @@
:class:`~yt.visualization.plot_window.PlotWindow` interface is useful for
taking a quick look at simulation outputs. The ``PlotCollection`` interface
was previously used to generate all types of plots, but is now primarily left
-as a mechanism for easily generating profile and phase plots.
+as a mechanism for generating profile and phase plots.
.. _simple-inspection:
-Simple Data Inspection
-----------------------
+Visual Inspection
+-----------------
If you need to take a quick look at a single simulation output, ``yt``
provides the ``PlotWindow`` interface for generating annotated 2D
@@ -37,9 +37,10 @@
is requested of it -- for instance, when the width or field is changed
-- this high-resolution data is then pixelized and placed in a buffer
of fixed size. This is accomplished behind the scenes using
-:class:`yt.visualization.fixed_resolution.FixedResolutionBuffer`.
-``PlotWindow`` plots expose the underlying matplotlib ``figure`` and
-``axes`` objects, making it easy to add new annotations.
+:class:`yt.visualization.fixed_resolution.FixedResolutionBuffer``
+``PlotWindow`` expose the underlying matplotlib ``figure`` and
+``axes`` objects, making it easy to customize your plots and
+add new annotations.
.. _slice-plots:
@@ -54,7 +55,7 @@
from yt.mods import *
pf = load("RedshiftOutput0005")
- slc = SlicePlot(pf, 'z', 'Density',[0.2,0.3,0.8],(20,'kpc'))
+ slc = SlicePlot(pf, 'z', 'Density', [0.2,0.3,0.8], (20,'kpc'))
slc.save()
The above example will display an annotated plot of a slice of the
@@ -110,9 +111,7 @@
~~~~~~~~~~~~~~~~
Using a fast adaptive projection, ``yt`` is able to quickly project
-simulation data along the coordinate axes. Off-axis projections are
-also available, although only as a raw image file (see
-:ref:`cookbook-offaxis_projection`).
+simulation data along the coordinate axes.
Projection plots are created by instantiating a
:class:`~yt.visualization.plot_window.ProjectionPlot` object. For
@@ -167,8 +166,65 @@
:class:`~yt.visualization.plot_window.OffAxisSlicePlot` for the full
class description.
-In-Depth Data Visualization
----------------------------
+.. _off-axis-projections:
+
+Off Axis Projections
+~~~~~~~~~~~~~~~~~~~~
+
+Off axis projection plots . Internally, off axis projections are
+created using :ref:`the-camera-interface` by applying the
+:class:`~yt.visualization.volume_rendering.transfer_functions.ProjectionTransferFunction`.
+In this use case, the volume renderer casts a set of plane
+parallel rays, one for each pixel in the image. The data values
+along each ray are summed, creating the final image buffer.
+
+.. _off-axis-projection-function:
+
+To avoid manually creating a camera and setting the transfer
+function, yt provides the :func:`~yt.visualization.volume_rendering.camera.off-axis-projection`
+function, which wraps the camera interface to create an off axis
+projection image buffer. These images can be saved to disk or
+used in custom plots. This snippet creates an off axis
+projection through a simulation.
+
+.. code-block:: python
+
+ from yt.mods import *
+ pf = load("RedshiftOutput0005")
+ L = [1,1,0] # vector normal to cutting plane
+ north_vector = [1,-1,0]
+ W = [0.2, 0.2, 0.2]
+ N = 512
+ image = off_axis_projection(pf, c, L, W, N, "Density")
+ write_image(na.log10(image), "%s_offaxis_projection.png" % pf)
+
+Here, ``W`` is the width of the projection in the x, y, *and* z
+directions.
+
+One can also generate generate annotated off axis projections
+using
+:class:`~yt.visualization.plot_window.OffAxisProjectionPlot`. These
+plots can be created in much the same way as an
+``OffAxisSlicePlot``, requiring only an open dataset, a direction
+to project along, and a field to project. For example:
+
+.. code-block:: python
+
+ from yt.mods import *
+ pf = load("RedshiftOutput0005")
+ L = [1,1,0] # vector normal to cutting plane
+ north_vector = [1,-1,0]
+ prj = OffAxisProjectionPlot(pf,L,'Density',north_vector=north_vector)
+ prj.save()
+
+OffAxisProjectionPlots can also be created with a number of
+keyword arguments, as described in the `api reference`__ for the
+class initializer.
+
+__ :class:`~yt.visualization.plot_window.OffAxisProjectionPlot`
+
+Quantative Analysis and Visualization
+-------------------------------------
The second plotting interface, based on the
:class:`~yt.visualization.plot_collection.PlotCollection` class, is
diff -r ecb3831e4d97bc025f3865fbdecc6eddb58d418f -r 249659676822e4c3667deb7446b766ac03ae66f2 source/visualizing/volume_rendering.rst
--- a/source/visualizing/volume_rendering.rst
+++ b/source/visualizing/volume_rendering.rst
@@ -132,7 +132,7 @@
.. image:: _images/vr_sample.jpg
:width: 512
-.. _the_camera_interface:
+.. _the-camera-interface:
The Camera Interface
--------------------
@@ -504,6 +504,6 @@
The Simple Volume Rendering Interface
-------------------------------------
-.. warning:: This has been removed in yt-2.3. Please use :ref:`the_camera_interface`.
+.. warning:: This has been removed in yt-2.3. Please use :ref:`the-camera-interface`.
https://bitbucket.org/yt_analysis/yt-doc/commits/601f1bf94608/
changeset: 601f1bf94608
user: ngoldbaum
date: 2013-02-13 09:17:30
summary: Merged yt_analysis/yt-doc into default
affected #: 2 files
diff -r 249659676822e4c3667deb7446b766ac03ae66f2 -r 601f1bf94608cf077911db44636033f385e711b5 cheatsheet.tex
--- a/cheatsheet.tex
+++ b/cheatsheet.tex
@@ -37,7 +37,7 @@
% if using A4 paper. (This probably isn't strictly necessary.)
% If using another size paper, use default 1cm margins.
\ifthenelse{\lengthtest { \paperwidth = 11in}}
- { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} }
+ { \geometry{top=.5in,left=.5in,right=.5in,bottom=0.85in} }
{\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
@@ -102,18 +102,25 @@
Need help? Start here \url{http://yt-project.org/doc/help/} and then
try the IRC chat room \url{http://yt-project.org/irc.html},
or the mailing list \url{http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org}.
-
+{\bf Installing yt:} The easiest way to install yt is to use the installation script
+found on the yt homepage or the docs linked above.
\subsection{Command Line yt}
+yt, and its convenience functions, are launched from a command line prompt.
+Many commands have flags to control behavior.
+Commands can be followed by
+{\bf {-}{-}help} (e.g. {\bf yt render {-}{-}help}) for detailed help for that command
+including a list of the available flags.
\begin{tabular}{@{}lp{3.5cm}@{}}
\texttt{iyt} & Load yt and IPython. \\
\texttt{yt load} {\it dataset} & Load a single dataset. \\
\texttt{yt help} & Print yt help information. \\
\texttt{yt stats} \it{dataset} & Print stats of a dataset. \\
\texttt{yt update} & Update yt to most recent version.\\
+\texttt{yt update --all} & Update yt and dependencies to most recent version. \\
\texttt{yt instinfo} & yt installation information. \\
\texttt{yt notebook} & Run the IPython notebook server. \\
-\texttt{yt serve} (\it{dataset}) & Run yt-specific web GUI.\\
+\texttt{yt serve} (\it{dataset}) & Run yt-specific web GUI ({\it dataset} is optional).\\
\texttt{yt upload\_image} \it{image.png} & Upload PNG image to imgur.com. \\
\texttt{yt upload\_notebook} \it{notebook.nb} & Upload IPython notebook to hub.yt-project.org.\\
\texttt{yt plot} \it{dataset} & Create a set of images.\\
@@ -137,13 +144,10 @@
session.
\end{tabular}
-Many commands have flags to control behavior.
-Commands can be followed by
-{\bf {-}{-}help} (e.g. {\bf yt render {-}{-}help}) for detailed help for that command
-including a list of the available flags.
-({\it Parentheticals}) above are optional.
-
\subsection{yt Imports}
+In order to use yt, Python must load the relevant yt modules into memory.
+The import commands are entered in the Python/IPython shell or
+used as part of a script.
\newlength{\MyLen}
\settowidth{\MyLen}{\texttt{letterpaper}/\texttt{a4paper} \ }
%\begin{tabular}{@{}p{\the\MyLen}%
@@ -153,26 +157,22 @@
\texttt{from yt.mods import \textasteriskcentered} \textemdash\
Load base yt modules. \\
\texttt{from yt.config import ytcfg} \textemdash\
-Used to set yt configuration options. \textemdash\
- If used, must be called before importing other modules.\\
+Used to set yt configuration options.
+ If used, must be called before importing any other module.\\
\texttt{from yt.analysis\_modules.api import \textasteriskcentered} \textemdash\
Load all yt analysis modules. \\
\texttt{from yt.analysis\_modules.\emph{halo\_finding}.api import \textasteriskcentered} \textemdash\
-Load halo finding modules. Other modules, listed below,
+Load halo finding modules. Other modules
are loaded in a similar way by swapping the
{\em emphasized} text.
-\texttt{absorption\_spectrum}, \texttt{coordinate\_transformation},
-\texttt{cosmological\_observation}, \texttt{halo\_mass\_function},
-\texttt{halo\_merger\_tree}, \texttt{halo\_profiler}, \texttt{level\_sets},
-\texttt{hierarchy\_subset}, \texttt{radial\_column\_density},
-\texttt{spectral\_integrator}, \texttt{star\_analysis}, \texttt{sunrise\_export},
-\texttt{two\_point\_functions}
+See the \textbf{Analysis Modules} section for a listing and short descriptions of each.
\end{tabular}
-The import commands are entered in the Python shell or
-used as part of a script.
\subsection{Numpy Arrays}
-% More examples are probably needed especially, but this is a start.
+Simulation data in yt is returned in Numpy arrays. The Numpy package provides a wealth of built-in
+functions that operate on Numpy arrays. Here is a very brief list of some useful ones.
+Please see \url{http://docs.scipy.org/doc/numpy/reference/} for the full
+numpy documentation.
\settowidth{\MyLen}{\texttt{multicol} }
\begin{tabular}{@{}p{8cm}}
@@ -181,17 +181,19 @@
min value of \texttt{a}.\\
\texttt{v = a[}{\it index}\texttt{]} \textemdash\ Select a single value from \texttt{a} at location {\it index}.\\
\texttt{b = a[}{\it i:j}\texttt{]} \textemdash\ Select the slice of values from \texttt{a} between
-locations {\it i} to {\it j-1} saved to a new numpy array \texttt{b} with length {\it j-i}. \\
-
+locations {\it i} to {\it j-1} saved to a new Numpy array \texttt{b} with length {\it j-i}. \\
+\texttt{sel = (a > const)} \textemdash\ Create a new boolean Numpy array \texttt{sel}, of the same shape as \texttt{a},
+that marks which values of \texttt{a > const}. Other operators work as well.\\
+\texttt{b = a[sel]} \textemdash\ Create a new Numpy array \texttt{b} made up of elements from \texttt{a} that correspond to elements of \texttt{sel}
+that are {\it True}.\\
+\texttt{a.dump({\it filename.dat})} \textemdash\ Save \texttt{a} to the binary file {\it filename.dat}.\\
+\texttt{a = load({\it filename.dat})} \textemdash\ Load the contents of {\it filename.dat} into \texttt{a}.
\end{tabular}
-Please see \url{http://docs.scipy.org/doc/numpy/reference/} for the full
-numpy documentation.
-
\subsection{IPython Tips}
\settowidth{\MyLen}{\texttt{multicol} }
These tips work if IPython has been loaded, typically either by invoking
-\texttt{iyt} or \texttt{yt load} on the command line or using the IPython notebook (\texttt{yt notebook}).
+\texttt{iyt} or \texttt{yt load} on the command line, or using the IPython notebook (\texttt{yt notebook}).
\begin{tabular}{@{}p{8cm}}
\texttt{Tab complete} \textemdash\ IPython will attempt to auto-complete a
variable or function name when the \texttt{Tab} key is pressed, e.g. {\it HaloFi}\textendash\texttt{Tab} would auto-complete
@@ -199,6 +201,7 @@
would give you a list of random functions (note the trailing period before hitting \texttt{Tab}).\\
\texttt{?, ??} \textemdash\ Appending one or two question marks at the end of any object gives you
detailed information about it, e.g. {\it variable\_name}?.\\
+Below a few IPython ``magics'' are listed, which are IPython-specific shortcut commands.\\
\texttt{\%paste} \textemdash\ Paste content from the system clipboard into the IPython shell.\\
\texttt{\%hist} \textemdash\ Print recent command history.\\
\texttt{\%quickref} \textemdash\ Print IPython quick reference.\\
@@ -212,11 +215,14 @@
IPython documentation.
\subsection{Load and Access Data}
+The first step in using yt is to reference a simulation snapshot.
+After that, simulation data is generally accessed in yt using {\it Data Containers} which are Python objects
+that define a region of simulation space from which data should be selected.
\settowidth{\MyLen}{\texttt{multicol} }
%\begin{tabular}{@{}p{\the\MyLen}%
% @{}p{\linewidth-\the\MyLen}@{}}
\begin{tabular}{@{}p{8cm}}
-\texttt{pf = load(}{\it dataset}\texttt{)} \textemdash\ Load a single snapshot.\\
+\texttt{pf = load(}{\it dataset}\texttt{)} \textemdash\ Reference a single snapshot.\\
\texttt{dd = pf.h.all\_data()} \textemdash\ Select the entire volume.\\
\texttt{a = dd[}{\it field\_name}\texttt{]} \textemdash\ Saves the contents of {\it field} into the
numpy array \texttt{a}. Similarly for other data containers.\\
@@ -246,10 +252,29 @@
{\it [sp, ``NOT'', (di, ``OR'', re)]} gives a volume defined
by {\it sp} minus the patches covered by {\it di} and {\it re}.\\
+\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.\\
+
+
+\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)}\\
+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}@{}}
@@ -260,16 +285,124 @@
\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} }
+yt will automatically check for configuration files in a special directory (\texttt{\$HOME/.yt/}) in the user's home directory.
+
+%\begin{tabular}{@{}p{\the\MyLen}%
+% @{}p{\linewidth-\the\MyLen}@{}}
+\begin{tabular}{@{}p{8cm}}
+The \texttt{config} file \textemdash\ Settings that control runtime behavior. \\
+The \texttt{my\_plugins.py} file \textemdash\ Add functions, derived fields, constants, or other commonly-used Python code to yt.
+\end{tabular}
+
+
+
+\subsection{Analysis Modules}
+\settowidth{\MyLen}{\texttt{multicol}}
+The import name for each module is listed at the end of each description (see \textbf{yt Imports}).
+%\begin{tabular}{@{}p{\the\MyLen}%
+% @{}p{\linewidth-\the\MyLen}@{}}
+\begin{tabular}{@{}p{8cm}}
+\texttt{Absorption Spectrum} \textemdash\ (\texttt{absorption\_spectrum}). \\
+\texttt{Clump Finder} \textemdash\ Find clumps defined by density thresholds (\texttt{level\_sets}). \\
+\texttt{Coordinate Transformation} \textemdash\ (\texttt{coordinate\_transformation}). \\
+\texttt{Halo Finding} \textemdash\ Locate halos of dark matter particles (\texttt{halo\_finding}). \\
+\texttt{Halo Mass Function} \textemdash\ Find halo mass functions from data and from theory (\texttt{halo\_mass\_function}). \\
+\texttt{Halo Profiling} \textemdash\ Profile and project multiple halos (\texttt{halo\_profiler}). \\
+\texttt{Halo Merger Tree} \textemdash\ Create a database of halo mergers (\texttt{halo\_merger\_tree}). \\
+\texttt{Light Cone Generator} \textemdash\ \\
+\texttt{Light Ray Generator} \textemdash\ \\
+\texttt{Radial Column Density} \textemdash\ Calculate column densities around a point (\texttt{radial\_column\_density}). \\
+\texttt{Rockstar Halo Finding} \textemdash\ Locate halos of dark matter using the Rockstar halo finder (\texttt{halo\_finding.rockstar}). \\
+\texttt{Star Particle Analysis} \textemdash\ Analyze star formation history and assemble spectra (\texttt{star\_analysis}). \\
+\texttt{Sunrise Exporter} \textemdash\ Export data to the sunrise visualization format (\texttt{sunrise\_export}). \\
+\texttt{Two Point Functions} \textemdash\ Two point correlations (\texttt{two\_point\_functions}). \\
+
+\end{tabular}
+
+\subsection{Parallel Analysis}
+\settowidth{\MyLen}{\texttt{multicol}}
+Nearly all of yt is parallelized using MPI.
+The {\it mpi4py} package must be installed for parallelism in yt.
+To install {\it pip install mpi4py} on the command line usually works.
+Execute python in parallel similar to this:\\
+{\it mpirun -n 12 python script.py --parallel}\\
+This command may differ for each system on which you use yt;
+please consult the system documentation for details on how to run parallel applications.
+\begin{tabular}{@{}p{8cm}}
+\texttt{from yt.pmods import *} \textemdash\ Load yt faster when in parallel.
+This replaces the usual \texttt{from yt.mods import *}.\\
+\texttt{parallel\_objects()} \textemdash\ A way to parallelize analysis over objects
+(such as halos or clumps).\\
+
+\end{tabular}
+
+\subsection{Pre-Installed Versions}
+\settowidth{\MyLen}{\texttt{multicol}}
+yt is pre-installed on several supercomputer systems.
+\begin{tabular}{@{}p{8cm}}
+\textbf{NICS Kraken} \textemdash\ {\it module load yt} \\
+\end{tabular}
+
+\subsection{Mercurial}
+\settowidth{\MyLen}{\texttt{multicol}}
+Please see \url{http://mercurial.selenic.com/} for the full Mercurial documentation.
+\begin{tabular}{@{}p{8cm}}
+\texttt{hg clone https://bitbucket.org/yt\_analysis/yt} \textemdash\ Clone a copy of yt. \\
+\texttt{hg status} \textemdash\ Files changed in working directory.\\
+\texttt{hg diff} \textemdash\ Print diff of all changed files in working directory. \\
+\texttt{hg diff -r{\it RevX} -r{\it RevY}} \textemdash\ Print diff of all changes between revision {\it RevX} and {\it RevY}.\\
+\texttt{hg log} \textemdash\ History of changes.\\
+\texttt{hg cat -r{\it RevX file}} \textemdash\ Print the contents of {\it file} from revision {\it RevX}.\\
+\texttt{hg heads} \textemdash\ Print all the current heads. \\
+\texttt{hg revert -r{\it RevX file}} \textemdash\ Revert {\it file} to revision {\it RevX}. On-disk changed version is
+moved to {\it file.orig}. \\
+\texttt{hg commit} \textemdash\ Commit changes to repository. \\
+\texttt{hg push} \textemdash\ Push changes to default remote repository. \\
+\texttt{hg pull} \textemdash\ Pull changes from default remote repository. \\
+\texttt{hg serve} \textemdash\ Launch a webserver on the local machine to examine the repository in a web browser. \\
+\end{tabular}
+
+\subsection{FAQ}
+\settowidth{\MyLen}{\texttt{multicol}}
+\begin{tabular}{@{}p{8cm}}
+\texttt{pf.field\_info[`field'].take\_log = False} \textemdash\ When plotting \texttt{field}, do not take log.
+Must enter \texttt{pf.h} before this command. \\
+\end{tabular}
%\rule{0.3\linewidth}{0.25pt}
%\scriptsize
% Can put some final stuff here like copyright etc...
+\end{multicols}
-\end{multicols}
\end{document}
\ No newline at end of file
diff -r 249659676822e4c3667deb7446b766ac03ae66f2 -r 601f1bf94608cf077911db44636033f385e711b5 source/advanced/parallel_computation.rst
--- a/source/advanced/parallel_computation.rst
+++ b/source/advanced/parallel_computation.rst
@@ -48,7 +48,7 @@
.. code-block:: python
- from yt.mods import *
+ from yt.pmods import *
pf = load("RD0035/RedshiftOutput0035")
v, c = pf.h.find_max("Density")
print v, c
@@ -56,7 +56,12 @@
p.save()
Will execute the finding of the maximum density and the projection in parallel
-if launched in parallel. To do so, at the command line you would execute
+if launched in parallel.
+Note that the usual "from yt.mods import *" has been replaced by
+"from yt.pmods import *".
+The pmods option gives the same result as reglar mods, but it can speed up
+the initialization process when running in parallel.
+To do so, at the command line you would execute
.. code-block:: bash
@@ -147,7 +152,7 @@
# simultaneously. This will be fixed, eventually...
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False"
# As always...
- from yt.mods import *
+ from yt.pmods import *
import glob
# The number 4, below, is the number of processes to parallelize over, which
@@ -211,7 +216,7 @@
.. code-block:: python
- from yt.mods import *
+ from yt.pmods import *
ts = TimeSeriesData.from_filenames("DD*/output_*", parallel = True)
sphere = ts.sphere("max", (1.0, "pc"))
L_vecs = sphere.quantities["AngularMomentumVector"]()
@@ -226,7 +231,7 @@
.. code-block:: python
- from yt.mods import *
+ from yt.pmods import *
ts = TimeSeriesData.from_filenames("DD*/output_*", parallel = True)
my_storage = {}
for sto,pf in ts.piter(storage=my_storage):
@@ -246,7 +251,7 @@
.. code-block:: python
- from yt.mods import *
+ from yt.pmods import *
ts = TimeSeriesData.from_filenames("DD*/output_*", parallel = 4)
sphere = ts.sphere("max", (1.0, "pc))
L_vecs = sphere.quantities["AngularMomentumVector"]()
@@ -418,7 +423,7 @@
.. code-block:: python
- from yt.mods import *
+ from yt.pmods import *
import time
pf = load("DD0152")
https://bitbucket.org/yt_analysis/yt-doc/commits/727e703ed7fd/
changeset: 727e703ed7fd
user: ngoldbaum
date: 2013-02-13 09:19:46
summary: Updating the callback reference.
affected #: 1 file
Diff not available.
https://bitbucket.org/yt_analysis/yt-doc/commits/bd9ad8165b41/
changeset: bd9ad8165b41
user: ngoldbaum
date: 2013-02-13 09:22:29
summary: Minor adjustments for the cheat sheet.
affected #: 1 file
Diff not available.
https://bitbucket.org/yt_analysis/yt-doc/commits/d58efe2c379b/
changeset: d58efe2c379b
user: ngoldbaum
date: 2013-02-13 21:11:27
summary: Restoring write_projection, adding a new cookbook recipe for OffAxisProjectionPlot.
affected #: 4 files
Diff not available.
https://bitbucket.org/yt_analysis/yt-doc/commits/a27de1d97ef7/
changeset: a27de1d97ef7
user: MatthewTurk
date: 2013-02-13 21:51:25
summary: Merging in PR #72.
affected #: 18 files
Diff not available.
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