[Yt-svn] yt-commit r1694 - in trunk: doc yt/extensions/volume_rendering yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed Apr 21 07:04:46 PDT 2010


Author: mturk
Date: Wed Apr 21 07:04:43 2010
New Revision: 1694
URL: http://yt.enzotools.org/changeset/1694

Log:
Backport from hg.

 * Adding installation of libpng, to support some changes in the future.  Disabling wxPython by default *for now*, because it's not clear at the moment if we're going to stick with wxPython or move to Qt, and it's causing some problems.  Additionally, the GUI probably doesn't work anyway at the moment.  (Although there is a set of utilities in here that could provide a relatively functional GUI ...)
 * Adding save_image to the volume rendering object.
 * Fixing bug with field list changing during iteration in getting data for AMRData objects.



Modified:
   trunk/doc/install_script.sh
   trunk/doc/install_script_osx.sh
   trunk/doc/install_script_osx106.sh
   trunk/yt/extensions/volume_rendering/__init__.py
   trunk/yt/extensions/volume_rendering/software_sampler.py
   trunk/yt/lagos/BaseDataTypes.py

Modified: trunk/doc/install_script.sh
==============================================================================
--- trunk/doc/install_script.sh	(original)
+++ trunk/doc/install_script.sh	Wed Apr 21 07:04:43 2010
@@ -28,10 +28,11 @@
 # If you absolutely can't get the fortran to work, try this:
 #NUMPY_ARGS="--fcompiler=fake"
 
-INST_WXPYTHON=1 # If you 't want to install wxPython, set this to 1
+INST_WXPYTHON=0 # If you want to install wxPython, set this to 1
 INST_ZLIB=1     # On some systems (Kraken) matplotlib has issues with 
                 # the system zlib, which is compiled statically.
                 # If need be, you can turn this off.
+INST_PNG=0      # Install a local libpng?  Same things apply as with zlib.
 INST_TRAITS=0   # Experimental TraitsUI installation
 INST_HG=1       # Install Mercurial or not?
 
@@ -229,6 +230,7 @@
 fi
 
 [ $INST_ZLIB -eq 1 ] && get_enzotools zlib-1.2.3.tar.bz2 
+[ $INST_PNG -eq 1 ] && get_enzotools libpng-1.2.43.tar.gz
 [ $INST_WXPYTHON -eq 1 ] && get_enzotools wxPython-src-2.8.10.1.tar.bz2
 get_enzotools Python-2.6.3.tgz
 get_enzotools numpy-1.3.0.tar.gz
@@ -272,6 +274,23 @@
     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ZLIB_DIR}/lib/"
 fi
 
+if [ $INST_PNG -eq 1 ]
+then
+    if [ ! -e libpng-1.2.43/done ]
+    then
+        [ ! -e libpng-1.2.43 ] && tar xfz libpng-1.2.43.tar.gz
+        echo "Installing PNG"
+        cd libpng-1.2.43
+        ( ./configure --prefix=${DEST_DIR}/ 2>&1 ) 1>> ${LOG_FILE} || do_exit
+        ( make install 2>&1 ) 1>> ${LOG_FILE} || do_exit
+        touch done
+        cd ..
+    fi
+    PNG_DIR=${DEST_DIR}
+    export LDFLAGS="${LDFLAGS} -L${PNG_DIR}/lib/ -L${PNG_DIR}/lib64/"
+    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PNG_DIR}/lib/"
+fi
+
 if [ -z "$HDF5_DIR" ]
 then
     if [ ! -e hdf5-1.6.9/done ]
@@ -352,6 +371,7 @@
 
 echo "Installing yt"
 echo $HDF5_DIR > hdf5.cfg
+[ $INST_PNG -eq 1 ] && echo $PNG_DIR > png.cfg
 ( ${DEST_DIR}/bin/python2.6 setup.py develop 2>&1 ) 1>> ${LOG_FILE} || do_exit
 touch done
 cd $MY_PWD

Modified: trunk/doc/install_script_osx.sh
==============================================================================
--- trunk/doc/install_script_osx.sh	(original)
+++ trunk/doc/install_script_osx.sh	Wed Apr 21 07:04:43 2010
@@ -203,6 +203,7 @@
 
 echo "Installing yt (may need sudo)"
 echo $HDF5_DIR > hdf5.cfg
+echo /usr/X11 > png.cfg # I think this should work everywhere
 ( ${PY_DIR}/bin/python2.5 setup.py build_ext -i 2>&1 ) 1>> ${LOG_FILE} || do_exit
 ( sudo ${PY_DIR}/bin/python2.5 setup.py develop 2>&1 ) 1>> ${LOG_FILE} || do_exit
 touch done

Modified: trunk/doc/install_script_osx106.sh
==============================================================================
--- trunk/doc/install_script_osx106.sh	(original)
+++ trunk/doc/install_script_osx106.sh	Wed Apr 21 07:04:43 2010
@@ -205,6 +205,7 @@
 
 echo "Installing yt (may need sudo)"
 echo $HDF5_DIR > hdf5.cfg
+echo /usr/X11 > png.cfg # I think this should work everywhere
 ( ${PY_DIR}/bin/python2.6 setup.py build_ext -i 2>&1 ) 1>> ${LOG_FILE} || do_exit
 ( sudo ${PY_DIR}/bin/python2.6 setup.py develop 2>&1 ) 1>> ${LOG_FILE} || do_exit
 touch done

Modified: trunk/yt/extensions/volume_rendering/__init__.py
==============================================================================
--- trunk/yt/extensions/volume_rendering/__init__.py	(original)
+++ trunk/yt/extensions/volume_rendering/__init__.py	Wed Apr 21 07:04:43 2010
@@ -31,6 +31,6 @@
 from grid_partitioner import HomogenizedBrickCollection, \
                              export_partitioned_grids, \
                              import_partitioned_grids
-from software_sampler import VolumeRendering
 from image_handling import export_rgba, import_rgba, \
                            plot_channel, plot_rgb
+from software_sampler import VolumeRendering

Modified: trunk/yt/extensions/volume_rendering/software_sampler.py
==============================================================================
--- trunk/yt/extensions/volume_rendering/software_sampler.py	(original)
+++ trunk/yt/extensions/volume_rendering/software_sampler.py	Wed Apr 21 07:04:43 2010
@@ -134,6 +134,16 @@
         # This will need to be modified for parallel
         export_partitioned_grids(self.bricks, fn)
 
+    def save_image(self, prefix = None, norm = 1.0):
+        if norm is not None:
+            mi, ma = self.image.min(), norm*self.image.max()
+            print "Normalizing with ", mi, ma
+            image = (na.clip(self.image, mi, ma) - mi)/(ma - mi)
+        else:
+            image = self.image
+        if prefix is None: prefix = "%s_volume_rendering" % (self.pf)
+        plot_rgb(image, prefix)
+
     def partition_grids(self):
         log_field = (self.fields[0] in self.pf.field_info and 
                      self.pf.field_info[self.fields[0]].take_log)

Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py	(original)
+++ trunk/yt/lagos/BaseDataTypes.py	Wed Apr 21 07:04:43 2010
@@ -165,7 +165,7 @@
     def _set_center(self, center):
         if center is None:
             pass
-        elif isinstance(center, (types.ListType, na.ndarray)):
+        elif isinstance(center, (types.ListType, types.TupleType, na.ndarray)):
             center = na.array(center)
         elif center == ("max"): # is this dangerous for race conditions?
             center = pf.h.find_max("Density")
@@ -405,12 +405,12 @@
             self._get_list_of_grids()
         points = []
         if not fields:
-            fields_to_get = self.fields
+            fields_to_get = self.fields[:]
         else:
             fields_to_get = ensure_list(fields)
         if not self.sort_by in fields_to_get and \
             self.sort_by not in self.data:
-            fields_to_get.append(self.sort_by)
+            fields_to_get.insert(0, self.sort_by)
         mylog.debug("Going to obtain %s", fields_to_get)
         for field in fields_to_get:
             if self.data.has_key(field):
@@ -574,7 +574,7 @@
         if not self.has_key('pdx'):
             self._generate_coords()
         if fields == None:
-            fields_to_get = self.fields
+            fields_to_get = self.fields[:]
         else:
             fields_to_get = ensure_list(fields)
         temp_data = {}
@@ -1616,7 +1616,7 @@
             self._get_list_of_grids()
         points = []
         if not fields:
-            fields_to_get = self.fields
+            fields_to_get = self.fields[:]
         else:
             fields_to_get = ensure_list(fields)
         mylog.debug("Going to obtain %s", fields_to_get)
@@ -2402,7 +2402,7 @@
         self._get_list_of_grids()
         # We don't generate coordinates here.
         if field == None:
-            fields_to_get = self.fields
+            fields_to_get = self.fields[:]
         else:
             fields_to_get = ensure_list(field)
         for grid in self._grids:
@@ -2504,7 +2504,7 @@
         self._get_list_of_grids()
         # We don't generate coordinates here.
         if field == None:
-            fields_to_get = self.fields
+            fields_to_get = self.fields[:]
         else:
             fields_to_get = ensure_list(field)
         for field in fields_to_get:
@@ -2641,7 +2641,7 @@
         self._get_list_of_grids()
         # We don't generate coordinates here.
         if field == None:
-            fields_to_get = self.fields
+            fields_to_get = self.fields[:]
         else:
             fields_to_get = ensure_list(field)
         for grid in self._grids:
@@ -2700,7 +2700,7 @@
         self._get_list_of_grids()
         # We don't generate coordinates here.
         if field == None:
-            fields_to_get = self.fields
+            fields_to_get = self.fields[:]
         else:
             fields_to_get = ensure_list(field)
         for field in fields_to_get:



More information about the yt-svn mailing list