[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Jul 31 10:02:15 PDT 2014
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/97b56b2f0444/
Changeset: 97b56b2f0444
Branch: yt-3.0
User: brittonsmith
Date: 2014-07-31 17:53:21
Summary: Adding section on field parameters.
Affected #: 2 files
diff -r 61f020440f1a983b9d0e4875f16773b5a3419e69 -r 97b56b2f04443bba4b51311c07a8419b92e2ea70 doc/source/analyzing/fields.rst
--- a/doc/source/analyzing/fields.rst
+++ b/doc/source/analyzing/fields.rst
@@ -102,6 +102,36 @@
for fields which are mesh-dependent, specifically particle masses in some
cosmology codes.)
+.. _field_parameters:
+
+Field Parameters
+++++++++++++++++
+
+Certain fields require external information in order to be calculated. For
+example, the radius field has to be defined based on some point of reference
+and the radial velocity field needs to know the bulk velocity of the data object
+so that it can be subtracted. This information is passed into a field function
+by setting field parameters, which are user-specified data that can be associated
+with a data object. The :meth:`yt.data_objects.data_containers.set_field_parameter`
+and :meth:`yt.data_objects.data_containers.get_field_parameter` functions are
+used to set and retrieve field parameter values for a given data object.
+
+.. code-block:: python
+
+ ad.set_field_parameter("wickets", 13)
+
+ print ad.get_field_parameter("wickets")
+
+Within a field function, these can then be retrieved and used in the same way.
+
+.. code-block:: python
+
+ def _wicket_density(field, data):
+ n_wickets = data.get_field_parameter("wickets")
+ return data["gas", "density"] * n_wickets
+
+For a practical application of this, see :ref:`cookbook-radial-velocity`.
+
Field types known to yt
+++++++++++++++++++++++
diff -r 61f020440f1a983b9d0e4875f16773b5a3419e69 -r 97b56b2f04443bba4b51311c07a8419b92e2ea70 doc/source/cookbook/calculating_information.rst
--- a/doc/source/cookbook/calculating_information.rst
+++ b/doc/source/cookbook/calculating_information.rst
@@ -32,12 +32,16 @@
.. yt_cookbook:: global_phase_plots.py
+.. _cookbook-radial-velocity:
+
Radial Velocity Profile
~~~~~~~~~~~~~~~~~~~~~~~
This recipe demonstrates how to subtract off a bulk velocity on a sphere before
calculating the radial velocity within that sphere.
-See :ref:`how-to-make-1d-profiles` for more information.
+See :ref:`how-to-make-1d-profiles` for more information on creating profiles and
+:ref:`field_parameters` for an explanation of how the bulk velocity is provided
+to the radial velocity field function.
.. yt_cookbook:: rad_velocity.py
https://bitbucket.org/yt_analysis/yt/commits/7be9a877c0f6/
Changeset: 7be9a877c0f6
Branch: yt-3.0
User: brittonsmith
Date: 2014-07-31 18:25:21
Summary: Adjusting for comments.
Affected #: 1 file
diff -r 97b56b2f04443bba4b51311c07a8419b92e2ea70 -r 7be9a877c0f63938efa845e33f81d7cd27707233 doc/source/analyzing/fields.rst
--- a/doc/source/analyzing/fields.rst
+++ b/doc/source/analyzing/fields.rst
@@ -112,22 +112,31 @@
and the radial velocity field needs to know the bulk velocity of the data object
so that it can be subtracted. This information is passed into a field function
by setting field parameters, which are user-specified data that can be associated
-with a data object. The :meth:`yt.data_objects.data_containers.set_field_parameter`
-and :meth:`yt.data_objects.data_containers.get_field_parameter` functions are
-used to set and retrieve field parameter values for a given data object.
+with a data object. The :meth:`~yt.data_objects.data_containers.set_field_parameter`
+and :meth:`~yt.data_objects.data_containers.get_field_parameter` functions are
+used to set and retrieve field parameter values for a given data object. In the
+cases above, the field parameters are ``center`` and ``bulk_velocity`` respectively --
+the two most commonly used field parameters.
.. code-block:: python
+ ds = yt.load("my_data")
+ ad = ds.all_data()
+
ad.set_field_parameter("wickets", 13)
print ad.get_field_parameter("wickets")
+If a field parameter is not set, ``get_field_parameter`` will return None.
Within a field function, these can then be retrieved and used in the same way.
.. code-block:: python
def _wicket_density(field, data):
n_wickets = data.get_field_parameter("wickets")
+ if n_wickets is None:
+ # use a default if unset
+ n_wickets = 88
return data["gas", "density"] * n_wickets
For a practical application of this, see :ref:`cookbook-radial-velocity`.
https://bitbucket.org/yt_analysis/yt/commits/a8dd15c035af/
Changeset: a8dd15c035af
Branch: yt-3.0
User: brittonsmith
Date: 2014-07-31 18:36:35
Summary: Third time, hopefully, the charm.
Affected #: 1 file
diff -r 7be9a877c0f63938efa845e33f81d7cd27707233 -r a8dd15c035af1ff44b6c08f33db2f1e71a9ce20f doc/source/analyzing/fields.rst
--- a/doc/source/analyzing/fields.rst
+++ b/doc/source/analyzing/fields.rst
@@ -112,8 +112,11 @@
and the radial velocity field needs to know the bulk velocity of the data object
so that it can be subtracted. This information is passed into a field function
by setting field parameters, which are user-specified data that can be associated
-with a data object. The :meth:`~yt.data_objects.data_containers.set_field_parameter`
-and :meth:`~yt.data_objects.data_containers.get_field_parameter` functions are
+with a data object. The
+:meth:`~yt.data_objects.data_containers.YTDataContainer.set_field_parameter`
+and
+:meth:`~yt.data_objects.data_containers.YTDataContainer.get_field_parameter`
+functions are
used to set and retrieve field parameter values for a given data object. In the
cases above, the field parameters are ``center`` and ``bulk_velocity`` respectively --
the two most commonly used field parameters.
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
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