[Yt-svn] yt: Adding some tweaking of the field container to eliminate one...

hg at spacepope.org hg at spacepope.org
Thu Dec 2 16:41:43 PST 2010


hg Repository: yt
details:   yt/rev/f165b6dffbc0
changeset: 3572:f165b6dffbc0
user:      Matthew Turk <matthewturk at gmail.com>
date:
Thu Dec 02 16:41:35 2010 -0800
description:
Adding some tweaking of the field container to eliminate one of the invalid
sqrt's.  The other comes from TangentialVelocity, which can have negative
values *during* the field detection, but no other times.

Also added statement to ensure that algae was the default colormap.

diffstat:

 yt/data_objects/field_info_container.py |  5 +++--
 yt/visualization/color_maps.py          |  5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r 26fd27e01006 -r f165b6dffbc0 yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py	Thu Dec 02 16:10:42 2010 -0800
+++ b/yt/data_objects/field_info_container.py	Thu Dec 02 16:41:35 2010 -0800
@@ -164,7 +164,8 @@
         self.hierarchy = fake_hierarchy()
         self.requested = []
         self.requested_parameters = []
-        defaultdict.__init__(self, lambda: na.ones((nd,nd,nd)))
+        defaultdict.__init__(self,
+            lambda: na.ones((nd,nd,nd), dtype='float64') + 1e-4*na.random.random((nd,nd,nd)))
     def __missing__(self, item):
         if FieldInfo.has_key(item) and \
             FieldInfo[item]._function.func_name != '<lambda>':
@@ -195,7 +196,7 @@
     def get_field_parameter(self, param):
         self.requested_parameters.append(param)
         if param in ['bulk_velocity','center','height_vector']:
-            return na.array([0,0,0])
+            return na.random.random(3)*1e-2
         else:
             return 0.0
     _spatial = True
diff -r 26fd27e01006 -r f165b6dffbc0 yt/visualization/color_maps.py
--- a/yt/visualization/color_maps.py	Thu Dec 02 16:10:42 2010 -0800
+++ b/yt/visualization/color_maps.py	Thu Dec 02 16:41:35 2010 -0800
@@ -22,10 +22,11 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 import numpy as na
+
+import matplotlib
 import matplotlib.colors as cc
 import matplotlib.cm as mcm
 
-
 def check_color(name):
     try:
         ss = cc.colorConverter.to_rgb(name)
@@ -74,6 +75,8 @@
 add_cmap('bds_highcontrast', cdict)
 add_cmap('algae', cdict)
 
+# Set the default colormap to be algae.
+matplotlib.rc('image', cmap="algae")
 
 # This next colormap was designed by Tune Kamae and converted here by Matt
 _vs = na.linspace(0,1,255)



More information about the yt-svn mailing list