[yt-svn] commit/yt: ngoldbaum: Adding a find_min convenience method defined on Dataset instances.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue May 20 05:05:58 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/ee9a8bb2ae6e/
Changeset:   ee9a8bb2ae6e
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-05-19 23:21:26
Summary:     Adding a find_min convenience method defined on Dataset instances.

This mirrors the find_max method that is already available.
Affected #:  1 file

diff -r 7a08af110b448af6365b9167f0d3a9db019719aa -r ee9a8bb2ae6e2a7d4c891bdd08871b4cb2626c90 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -519,16 +519,28 @@
 
     def find_max(self, field):
         """
-        Returns (value, center) of location of maximum for a given field.
+        Returns (value, location) of the maximum of a given field.
         """
         mylog.debug("Searching for maximum value of %s", field)
         source = self.all_data()
         max_val, maxi, mx, my, mz = \
-            source.quantities["MaxLocation"](field)
+            source.quantities.max_location(field)
         mylog.info("Max Value is %0.5e at %0.16f %0.16f %0.16f",
               max_val, mx, my, mz)
         return max_val, np.array([mx, my, mz], dtype="float64")
 
+    def find_min(self, field):
+        """
+        Returns (value, location) for the minimum of a given field.
+        """
+        mylog.debug("Searching for minimum value of %s", field)
+        source = self.all_data()
+        min_val, maxi, mx, my, mz = \
+            source.quantities.min_location(field)
+        mylog.info("Min Value is %0.5e at %0.16f %0.16f %0.16f",
+              min_val, mx, my, mz)
+        return min_val, np.array([mx, my, mz], dtype="float64")
+
     # Now all the object related stuff
     def all_data(self, find_max=False):
         if find_max: c = self.find_max("density")[1]

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