[Yt-svn] commit/yt-doc: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Aug 31 09:39:26 PDT 2011
2 new changesets in yt-doc:
http://bitbucket.org/yt_analysis/yt-doc/changeset/82e8dd6432fb/
changeset: 82e8dd6432fb
user: ejtasker
date: 2011-08-31 18:08:37
summary: An example of how to access data in a object added to objects.rst
affected #: 1 file (422 bytes)
--- a/source/analyzing/objects.rst Mon Aug 29 15:39:06 2011 -0400
+++ b/source/analyzing/objects.rst Wed Aug 31 12:08:37 2011 -0400
@@ -20,10 +20,25 @@
my_object["Density"]
-where ``"Density"`` can be any field name. The full list of objects is
-available in :ref:`available-objects`, and information about how to create an
-object can be found in :ref:`creating-objects`. The field is returned as a
-single, flattened array without spatial information. The best mechanism for
+where ``"Density"`` can be any field name and ``"my_object"`` any one of
+the possible data containers listed at :ref:`available-objects`. For
+example, if we wanted to look at the temperature of cells within a
+spherical region of radius 10 kpc, centered at [0.5, 0.5, 0.5] in our
+simulation box, we would create a sphere object with:
+
+.. code-block:: python
+
+ sp = pf.h.sphere([0.5, 0.5, 0.5], 10.0/pf['kpc'])
+
+and then look at the temperaturre of its cells within it via:
+
+.. code-block:: python
+
+ print sp["Temperature"]
+
+Information about how to create a new type of object can be found in
+:ref:`creating-objects`. The field is returned as a single, flattened
+array without spatial information. The best mechanism for
manipulating spatial data is the :class:`~yt.lagos.CoveringGridBase` object.
The full list of fields that are available can be found as a property of the
http://bitbucket.org/yt_analysis/yt-doc/changeset/69e7b36a5c1f/
changeset: 69e7b36a5c1f
user: ejtasker
date: 2011-08-31 18:28:23
summary: New question added to FAQ: the second part of the query is answered already in the docs, but it goes along with the first part, so I repeated the information
affected #: 1 file (844 bytes)
--- a/source/faq.rst Wed Aug 31 12:08:37 2011 -0400
+++ b/source/faq.rst Wed Aug 31 12:28:23 2011 -0400
@@ -18,3 +18,29 @@
$ ~/yt/bin/pip install readline
+
+I added a new field to my simulation data, can ``yt`` see it?
+-------------------------------------------------------------
+
+Yes! ``yt`` identifies all the fields in the simulation's output file
+and will add them to its ``field_list`` even if they aren't listed in
+:ref:`field-list`. These can then be accessed in the usual manner. For
+example, if you have created a field for the potential called
+``PotentialField``, you could type:
+
+.. code-block:: python
+
+ pf = load("my_data")
+ dd = pf.h.all_data()
+ potential_field = dd["PotentialField"]
+
+The same applies to fields you might derive inside your ``yt`` script
+via :ref:`creating-derived-fields`. To check what fields are
+available, look at the properties ``field_list`` and ``derived_field_list``:
+
+.. code-block:: python
+
+ print pf.h.field_list
+ print pf.h.derived_field_list
+
+
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