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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Feb 13 09:20:56 PST 2018


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/e0535aa48ef7/
Changeset:   e0535aa48ef7
User:        brittonsmith
Date:        2018-02-07 19:24:28+00:00
Summary:     Specify a field type in clump callback so that reloaded clump datasets can be plotted as well.
Affected #:  1 file

diff -r 55143ab1d8474419f795545f878f3c72a42f129c -r e0535aa48ef7ab574c39d95f9146ae16fc9b2289 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -23,6 +23,10 @@
 
 from functools import wraps
 
+from yt.analysis_modules.level_sets.clump_handling import \
+    Clump
+from yt.frontends.ytdata.data_structures import \
+    YTClumpContainer
 from yt.funcs import \
     mylog, iterable
 from yt.extern.six import add_metaclass
@@ -946,14 +950,23 @@
         for i,clump in enumerate(reversed(self.clumps)):
             mylog.info("Pixelizing contour %s", i)
 
-            xf_copy = clump[xf].copy().in_units("code_length")
-            yf_copy = clump[yf].copy().in_units("code_length")
+            if isinstance(clump, Clump):
+                ftype = "index"
+            elif isinstance(clump, YTClumpContainer):
+                ftype = "grid"
+            else:
+                raise RuntimeError(
+                    "Unknown field type for object of type %s." %
+                    type(clump))
+
+            xf_copy = clump[ftype, xf].copy().in_units("code_length")
+            yf_copy = clump[ftype, yf].copy().in_units("code_length")
 
             temp = np.zeros((ny, nx), dtype="f8")
             pixelize_cartesian(temp, xf_copy, yf_copy,
-                                 clump[dxf].in_units("code_length")/2.0,
-                                 clump[dyf].in_units("code_length")/2.0,
-                                 clump[dxf].d*0.0+i+1, # inits inside Pixelize
+                                 clump[ftype, dxf].in_units("code_length")/2.0,
+                                 clump[ftype, dyf].in_units("code_length")/2.0,
+                                 clump[ftype, dxf].d*0.0+i+1, # inits inside Pixelize
                              (x0, x1, y0, y1), 0)
             buff = np.maximum(temp, buff)
         self.rv = plot._axes.contour(buff, np.unique(buff),


https://bitbucket.org/yt_analysis/yt/commits/3c8e5bfb0866/
Changeset:   3c8e5bfb0866
User:        brittonsmith
Date:        2018-02-07 19:58:02+00:00
Summary:     Add example of plotting reloaded clumps to recipe.
Affected #:  1 file

diff -r e0535aa48ef7ab574c39d95f9146ae16fc9b2289 -r 3c8e5bfb0866cfdbf7c26829028eafaee18432ce doc/source/cookbook/find_clumps.py
--- a/doc/source/cookbook/find_clumps.py
+++ b/doc/source/cookbook/find_clumps.py
@@ -52,6 +52,16 @@
 # Reload the clump dataset.
 cds = yt.load(fn)
 
+# Clump annotation can also be done with the reloaded clump dataset.
+
+# Remove the original clump annotation
+prj.annotate_clear()
+
+# Get the leaves and add the callback.
+leaf_clumps_reloaded = cds.leaves
+prj.annotate_clumps(leaf_clumps_reloaded)
+prj.save('clumps_reloaded')
+
 # Query fields for clumps in the tree.
 print (cds.tree["clump", "center_of_mass"])
 print (cds.tree.children[0]["grid", "density"])


https://bitbucket.org/yt_analysis/yt/commits/f2edff9efd5f/
Changeset:   f2edff9efd5f
User:        ngoldbaum
Date:        2018-02-13 17:20:40+00:00
Summary:     Merge pull request #1683 from brittonsmith/clumps

Allow clump callback to work with loaded clump datasets.
Affected #:  2 files

diff -r d56c08c5a2d0db3997132fc57a931863e8fbb5df -r f2edff9efd5fd9999cfa559f4d2a012683da87f4 doc/source/cookbook/find_clumps.py
--- a/doc/source/cookbook/find_clumps.py
+++ b/doc/source/cookbook/find_clumps.py
@@ -52,6 +52,16 @@
 # Reload the clump dataset.
 cds = yt.load(fn)
 
+# Clump annotation can also be done with the reloaded clump dataset.
+
+# Remove the original clump annotation
+prj.annotate_clear()
+
+# Get the leaves and add the callback.
+leaf_clumps_reloaded = cds.leaves
+prj.annotate_clumps(leaf_clumps_reloaded)
+prj.save('clumps_reloaded')
+
 # Query fields for clumps in the tree.
 print (cds.tree["clump", "center_of_mass"])
 print (cds.tree.children[0]["grid", "density"])

diff -r d56c08c5a2d0db3997132fc57a931863e8fbb5df -r f2edff9efd5fd9999cfa559f4d2a012683da87f4 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -23,6 +23,10 @@
 
 from functools import wraps
 
+from yt.analysis_modules.level_sets.clump_handling import \
+    Clump
+from yt.frontends.ytdata.data_structures import \
+    YTClumpContainer
 from yt.funcs import \
     mylog, iterable
 from yt.extern.six import add_metaclass
@@ -946,14 +950,23 @@
         for i,clump in enumerate(reversed(self.clumps)):
             mylog.info("Pixelizing contour %s", i)
 
-            xf_copy = clump[xf].copy().in_units("code_length")
-            yf_copy = clump[yf].copy().in_units("code_length")
+            if isinstance(clump, Clump):
+                ftype = "index"
+            elif isinstance(clump, YTClumpContainer):
+                ftype = "grid"
+            else:
+                raise RuntimeError(
+                    "Unknown field type for object of type %s." %
+                    type(clump))
+
+            xf_copy = clump[ftype, xf].copy().in_units("code_length")
+            yf_copy = clump[ftype, yf].copy().in_units("code_length")
 
             temp = np.zeros((ny, nx), dtype="f8")
             pixelize_cartesian(temp, xf_copy, yf_copy,
-                                 clump[dxf].in_units("code_length")/2.0,
-                                 clump[dyf].in_units("code_length")/2.0,
-                                 clump[dxf].d*0.0+i+1, # inits inside Pixelize
+                                 clump[ftype, dxf].in_units("code_length")/2.0,
+                                 clump[ftype, dyf].in_units("code_length")/2.0,
+                                 clump[ftype, dxf].d*0.0+i+1, # inits inside Pixelize
                              (x0, x1, y0, y1), 0)
             buff = np.maximum(temp, buff)
         self.rv = plot._axes.contour(buff, np.unique(buff),

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