[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Nov 30 11:13:17 PST 2015
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/97253f5ea9b4/
Changeset: 97253f5ea9b4
Branch: yt
User: MatthewTurk
Date: 2015-11-24 16:14:30+00:00
Summary: Implement ptp operation.
Affected #: 2 files
diff -r 03a54b627189e63eaee9f2bc1d4a36c3ab6b9637 -r 97253f5ea9b43fc81ebfb1b9e84d7b633d90ab26 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -712,7 +712,27 @@
raise NotImplementedError
def ptp(self, field):
- raise NotImplementedError
+ r"""Compute the range of values (maximum - minimum) of a field.
+
+ This will, in a parallel-aware fashion, compute the "peak-to-peak" of
+ the given field.
+
+ Parameters
+ ----------
+ field : string or tuple of strings
+ The field to average.
+
+ Returns
+ -------
+ Scalar
+
+ Examples
+ --------
+
+ >>> rho_range = reg.ptp("density")
+ """
+ ex = self._compute_extrema(field)
+ return ex[1] - ex[0]
def hist(self, field, weight = None, bins = None):
raise NotImplementedError
diff -r 03a54b627189e63eaee9f2bc1d4a36c3ab6b9637 -r 97253f5ea9b43fc81ebfb1b9e84d7b633d90ab26 yt/data_objects/tests/test_numpy_ops.py
--- a/yt/data_objects/tests/test_numpy_ops.py
+++ b/yt/data_objects/tests/test_numpy_ops.py
@@ -73,6 +73,9 @@
q = ad.max("density").v
yield assert_equal, q, ad["density"].max()
+ ptp = ad.ptp("density").v
+ yield assert_equal, ptp, ad["density"].max() - ad["density"].min()
+
p = ad.max("density", axis=1)
p1 = ds.proj("density", 1, data_source=ad, method="mip")
yield assert_equal, p["density"], p1["density"]
https://bitbucket.org/yt_analysis/yt/commits/66152c77e32c/
Changeset: 66152c77e32c
Branch: yt
User: bwkeller
Date: 2015-11-30 19:12:59+00:00
Summary: Merged in MatthewTurk/yt (pull request #1888)
Implement ptp operation.
Affected #: 2 files
diff -r 0ba5b60db61ce63dfdd2c58ebaa4b14b19e16f03 -r 66152c77e32c81c8bce0506a67f9a192302f8623 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -712,7 +712,27 @@
raise NotImplementedError
def ptp(self, field):
- raise NotImplementedError
+ r"""Compute the range of values (maximum - minimum) of a field.
+
+ This will, in a parallel-aware fashion, compute the "peak-to-peak" of
+ the given field.
+
+ Parameters
+ ----------
+ field : string or tuple of strings
+ The field to average.
+
+ Returns
+ -------
+ Scalar
+
+ Examples
+ --------
+
+ >>> rho_range = reg.ptp("density")
+ """
+ ex = self._compute_extrema(field)
+ return ex[1] - ex[0]
def hist(self, field, weight = None, bins = None):
raise NotImplementedError
diff -r 0ba5b60db61ce63dfdd2c58ebaa4b14b19e16f03 -r 66152c77e32c81c8bce0506a67f9a192302f8623 yt/data_objects/tests/test_numpy_ops.py
--- a/yt/data_objects/tests/test_numpy_ops.py
+++ b/yt/data_objects/tests/test_numpy_ops.py
@@ -73,6 +73,9 @@
q = ad.max("density").v
yield assert_equal, q, ad["density"].max()
+ ptp = ad.ptp("density").v
+ yield assert_equal, ptp, ad["density"].max() - ad["density"].min()
+
p = ad.max("density", axis=1)
p1 = ds.proj("density", 1, data_source=ad, method="mip")
yield assert_equal, p["density"], p1["density"]
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