[Yt-svn] yt-commit r534 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Wed Jun 4 14:14:51 PDT 2008
Author: mturk
Date: Wed Jun 4 14:14:49 2008
New Revision: 534
URL: http://yt.spacepope.org/changeset/534
Log:
Added an "Extrema" quantity. This will get propagated back up to the lazy
profilers. (But, again, it will be much slower to do it this way --
particularly with sphere -- than feeding in your own bin limits.)
Modified:
trunk/yt/lagos/DerivedQuantities.py
Modified: trunk/yt/lagos/DerivedQuantities.py
==============================================================================
--- trunk/yt/lagos/DerivedQuantities.py (original)
+++ trunk/yt/lagos/DerivedQuantities.py Wed Jun 4 14:14:49 2008
@@ -190,3 +190,22 @@
return bound
add_quantity("IsBound",function=_IsBound,combine_function=_combIsBound,n_ret=1,
force_unlazy=True)
+
+def _Extrema(data, fields):
+ fields = ensure_list(fields)
+ mins, maxs = [], []
+ for field in fields:
+ if data[field].size < 1:
+ mins.append(1e90)
+ maxs.append(-1e90)
+ continue
+ mins.append(data[field].min())
+ maxs.append(data[field].max())
+ return len(fields), mins, maxs
+def _combExtrema(data, n_fields, mins, maxs):
+ mins, maxs = na.atleast_2d(mins, maxs)
+ n_fields = mins.shape[1]
+ return [(na.min(mins[:,i]), na.max(maxs[:,i])) for i in range(n_fields)]
+add_quantity("Extrema", function=_Extrema, combine_function=_combExtrema,
+ n_ret=3)
+
More information about the yt-svn
mailing list