[yt-svn] commit/yt: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jul 18 08:39:19 PDT 2017


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/81156da9da1b/
Changeset:   81156da9da1b
User:        ngoldbaum
Date:        2017-07-11 22:05:58+00:00
Summary:     Update docs on finding field values at points. Closes #1455
Affected #:  1 file

diff -r fc58054806fe06993c0fc585939e8fd48552c117 -r 81156da9da1b98c3cec3bf14c7d4c0030df9de8e doc/source/examining/low_level_inspection.rst
--- a/doc/source/examining/low_level_inspection.rst
+++ b/doc/source/examining/low_level_inspection.rst
@@ -107,22 +107,32 @@
 specific point*.  While there are several ways to find out the answer to this
 question, a few helper routines are provided as well.  To identify the
 finest-resolution (i.e., most canonical) data at a given point, use
-:meth:`~yt.data_objects.index.AMRHierarchy.find_field_value_at_point`.
-This accepts a position (in coordinates of the domain) and returns the field
-values for one or multiple fields.
+the point data object::
 
-To identify all the grids that intersect a given point, the function
-:meth:`~yt.data_objects.index.AMRHierarchy.find_point` will return indices
-and objects that correspond to it.  For instance:
+  from yt.units import kpc
+  point_obj = ds.point([30, 75, 80]*kpc)
+  density_at_point = point_obj['gas', 'density']
+
+The point data object works just like any other yt data object. It is special
+because it is the only zero-dimensional data object: it will only return data at
+the exact point specified when creating the point data object. For more
+information about yt data objects, see :ref:`Data-objects`.
 
-.. code-block:: python
+If you need to find field values at many points, the
+:meth:`~yt.data_objects.static_output.Dataset.find_field_values_at_points`
+function may be more efficient. This function returns a nested list of field
+values at multiple points in the simulation volume. For example, if one wanted
+to find the value of a mesh field at the location of the particles in a
+simulation, one could do::
 
-   gs, gi = ds.find_point((0.5, 0.6, 0.9))
-   for g in gs:
-       print(g.Level, g.LeftEdge, g.RightEdge)
+  ad = ds.all_data()
+  ppos = ad['all', 'particle_position']
+  ppos_den_vel = ds.find_field_values_at_points(
+      ['density', 'velocity_x'], ppos)
 
-Note that this doesn't just return the canonical output, but also all of the
-parent grids that overlap with that point.
+In this example, ``ppos_den_vel`` will be a list of arrays. The first array will
+contain the density values at the particle positions, the second will contain
+the x velocity values at the particle positions.
 
 .. _examining-grid-data-in-a-fixed-resolution-array:
 


https://bitbucket.org/yt_analysis/yt/commits/292512de33aa/
Changeset:   292512de33aa
User:        ngoldbaum
Date:        2017-07-18 15:38:42+00:00
Summary:     Merge pull request #1489 from ngoldbaum/point-docs

Update docs on finding field values at points. Closes #1455
Affected #:  1 file

diff -r 6a9dc5be6bfe4ad5611c291ccccc0d362378571d -r 292512de33aa61e0c24350fce522ab4c1649cd41 doc/source/examining/low_level_inspection.rst
--- a/doc/source/examining/low_level_inspection.rst
+++ b/doc/source/examining/low_level_inspection.rst
@@ -107,22 +107,32 @@
 specific point*.  While there are several ways to find out the answer to this
 question, a few helper routines are provided as well.  To identify the
 finest-resolution (i.e., most canonical) data at a given point, use
-:meth:`~yt.data_objects.index.AMRHierarchy.find_field_value_at_point`.
-This accepts a position (in coordinates of the domain) and returns the field
-values for one or multiple fields.
+the point data object::
 
-To identify all the grids that intersect a given point, the function
-:meth:`~yt.data_objects.index.AMRHierarchy.find_point` will return indices
-and objects that correspond to it.  For instance:
+  from yt.units import kpc
+  point_obj = ds.point([30, 75, 80]*kpc)
+  density_at_point = point_obj['gas', 'density']
+
+The point data object works just like any other yt data object. It is special
+because it is the only zero-dimensional data object: it will only return data at
+the exact point specified when creating the point data object. For more
+information about yt data objects, see :ref:`Data-objects`.
 
-.. code-block:: python
+If you need to find field values at many points, the
+:meth:`~yt.data_objects.static_output.Dataset.find_field_values_at_points`
+function may be more efficient. This function returns a nested list of field
+values at multiple points in the simulation volume. For example, if one wanted
+to find the value of a mesh field at the location of the particles in a
+simulation, one could do::
 
-   gs, gi = ds.find_point((0.5, 0.6, 0.9))
-   for g in gs:
-       print(g.Level, g.LeftEdge, g.RightEdge)
+  ad = ds.all_data()
+  ppos = ad['all', 'particle_position']
+  ppos_den_vel = ds.find_field_values_at_points(
+      ['density', 'velocity_x'], ppos)
 
-Note that this doesn't just return the canonical output, but also all of the
-parent grids that overlap with that point.
+In this example, ``ppos_den_vel`` will be a list of arrays. The first array will
+contain the density values at the particle positions, the second will contain
+the x velocity values at the particle positions.
 
 .. _examining-grid-data-in-a-fixed-resolution-array:

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