[Yt-svn] yt-commit r1688 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Fri Apr 9 16:07:23 PDT 2010
Author: mturk
Date: Fri Apr 9 16:07:22 2010
New Revision: 1688
URL: http://yt.enzotools.org/changeset/1688
Log:
Supporting possibility for no field values to be above zero, and also adding an
editorial comment.
Modified:
trunk/yt/lagos/DerivedQuantities.py
Modified: trunk/yt/lagos/DerivedQuantities.py
==============================================================================
--- trunk/yt/lagos/DerivedQuantities.py (original)
+++ trunk/yt/lagos/DerivedQuantities.py Fri Apr 9 16:07:22 2010
@@ -380,6 +380,8 @@
:param fields: A field name, or a list of field names
:param filter: a string to be evaled to serve as a data filter.
"""
+ # There is a heck of a lot of logic in this. I really wish it were more
+ # elegant.
fields = ensure_list(fields)
if filter is not None: this_filter = eval(filter)
mins, maxs = [], []
@@ -389,9 +391,14 @@
maxs.append(-1e90)
continue
if filter is None:
- # Note that we're hijacking an argument here
- if non_zero: nz_filter = data[field]>0.0
- else: nz_filter = None
+ if non_zero:
+ nz_filter = data[field]>0.0
+ if not nz_filter.any():
+ mins.append(1e90)
+ maxs.append(-1e90)
+ continue
+ else:
+ nz_filter = None
mins.append(data[field][nz_filter].min())
maxs.append(data[field][nz_filter].max())
else:
More information about the yt-svn
mailing list