[Yt-svn] yt: 3 new changesets

hg at spacepope.org hg at spacepope.org
Thu Apr 22 11:09:16 PDT 2010


hg Repository: yt
details:   yt/rev/2ed9f1c5a4d6
changeset: 1584:2ed9f1c5a4d6
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Apr 21 09:52:41 2010 -0700
description:
Merging from yt

hg Repository: yt
details:   yt/rev/1f0351edd266
changeset: 1585:1f0351edd266
user:      Matthew Turk <matthewturk at gmail.com>
date:
Thu Apr 22 07:17:51 2010 -0700
description:
Initial import of support for the Tiger code

hg Repository: yt
details:   yt/rev/d9dc71c21f5f
changeset: 1586:d9dc71c21f5f
user:      Matthew Turk <matthewturk at gmail.com>
date:
Thu Apr 22 11:08:18 2010 -0700
description:
Adding hand-written fortran reader.

diffstat:

 doc/install_script.sh                              |     2 +
 doc/install_script_osx106.sh                       |    77 +-
 yt/_amr_utils/VolumeIntegrator.pyx                 |   256 +-
 yt/_amr_utils/fortran_reader.pyx                   |    70 +
 yt/amr_utils.c                                     |  3846 ++++++++++++++-----------
 yt/amr_utils.pyx                                   |     1 +
 yt/extensions/EnzoSimulation.py                    |    44 +-
 yt/extensions/volume_rendering/TransferFunction.py |   119 +-
 yt/extensions/volume_rendering/UBVRI.py            |   105 -
 yt/extensions/volume_rendering/__init__.py         |     5 +-
 yt/extensions/volume_rendering/grid_partitioner.py |    28 +-
 yt/extensions/volume_rendering/image_handling.py   |     2 +-
 yt/extensions/volume_rendering/multi_texture.py    |   302 --
 yt/extensions/volume_rendering/software_sampler.py |    12 +-
 yt/funcs.py                                        |     9 +-
 yt/lagos/BaseDataTypes.py                          |    14 +-
 yt/lagos/BaseGridType.py                           |    24 +
 yt/lagos/DataReadingFuncs.py                       |    26 +
 yt/lagos/FieldInfoContainer.py                     |     9 +
 yt/lagos/HierarchyType.py                          |    76 +
 yt/lagos/OutputTypes.py                            |    75 +-
 yt/lagos/ParallelTools.py                          |     4 +-
 yt/lagos/StructureFunctionGenerator.py             |    76 +-
 yt/mods.py                                         |     2 +-
 yt/physical_constants.py                           |     3 +-
 yt/setup.py                                        |     5 +
 26 files changed, 2679 insertions(+), 2513 deletions(-)

diffs (truncated from 8934 to 300 lines):

diff -r 54cdd56fb83c -r d9dc71c21f5f doc/install_script.sh
--- a/doc/install_script.sh	Tue Apr 20 18:12:16 2010 -0700
+++ b/doc/install_script.sh	Thu Apr 22 11:08:18 2010 -0700
@@ -330,6 +330,8 @@
     [ ! -e wxPython-src-2.8.10.1 ] && tar xfj wxPython-src-2.8.10.1.tar.bz2
     cd wxPython-src-2.8.10.1
 
+    get_enzotools wxpython28101_gdiwrap.diff
+    patch -p0 < wxpython28101_gdiwrap.diff
     ( ./configure --prefix=${DEST_DIR}/ --with-opengl 2>&1 ) 1>> ${LOG_FILE} || do_exit
     ( make install 2>&1 ) 1>> ${LOG_FILE} || do_exit
     cd contrib
diff -r 54cdd56fb83c -r d9dc71c21f5f doc/install_script_osx106.sh
--- a/doc/install_script_osx106.sh	Tue Apr 20 18:12:16 2010 -0700
+++ b/doc/install_script_osx106.sh	Thu Apr 22 11:08:18 2010 -0700
@@ -22,8 +22,9 @@
 HDF5_DIR=
 
 INST_HG=1       # Install Mercurial or not?
+INST_GUI=1      # Install the necessary bits for the GUI?
 # If you've got YT some other place, set this to point to it.
-YT_DIR=""
+YT_DIR=
 
 #------------------------------------------------------------------------------#
 #                                                                              #
@@ -216,6 +217,70 @@
     ( sudo ${PY_DIR}/bin/pip install -U mercurial 2>&1 ) 1>> ${LOG_FILE} || do_exit
 fi
 
+
+if [ $INST_GUI -eq 1 ]
+then
+    # This is a long, long list.
+    get_enzotools qt-mac-cocoa-opensource-4.6.2.dmg 
+    get_enzotools VTK-5.5.0-Darwin.dmg
+    get_enzotools VTK-5.5-Darwin-Python.dmg
+    get_enzotools ETS-20100316.tar.gz
+    get_enzotools sip-4.9.1.tar.gz
+    get_enzotools PyQt-mac-gpl-4.6.1.tar.gz
+
+    # We do these in order!  Hooray!
+    [ ! -e ${DEST_DIR}/src/qt_done ] && self_install \
+        qt-mac-cocoa-opensource-4.6.2.dmg 
+    touch ${DEST_DIR}/src/qt_done
+
+    [ ! -e ${DEST_DIR}/src/vtk_done ] && self_install \
+        VTK-5.5.0-Darwin.dmg
+    touch ${DEST_DIR}/src/vtk_done
+
+    [ ! -e ${DEST_DIR}/src/pyvtk_done ] && self_install \
+        VTK-5.5-Darwin-Python.dmg
+    touch ${DEST_DIR}/src/pyvtk_done
+
+    if [ ! -e ${DEST_DIR}/src/sip-4.9.1/done ]
+    then
+        [ ! -e sip-4.9.1 ] && tar xvfz sip-4.9.1.tar.gz
+        echo "Installing SIP."
+        echo "You may be asked to accept a license, and this may require sudo."
+        cd sip-4.9.1
+        ( ${PY_DIR}/bin/python2.6 configure.py 0>&0 2>&1 ) 1>> ${LOG_FILE} || do_exit
+        ( make 2>&1 ) 1>> ${LOG_FILE} || do_exit
+        ( sudo make install 2>&1 ) 1>> ${LOG_FILE} || do_exit
+        touch done
+        cd ..
+    fi
+
+    if [ ! -e ${DEST_DIR}/src/PyQt-mac-gpl-4.6.1/done ]
+    then
+        [ ! -e PyQt-mac-gpl-4.6.1 ] && tar xvfz PyQt-mac-gpl-4.6.1.tar.gz
+        echo
+        echo "Installing PyQt4."
+        echo "You may be asked to accept a license, and this may require sudo."
+        echo "Once you've answered, the compilation may take a while.  You could get a sandwich."
+        echo
+        cd PyQt-mac-gpl-4.6.1
+        ( ${PY_DIR}/bin/python2.6 configure.py --qmake=/usr/bin/qmake 0>&0 2>&1 ) | tee -a ${LOG_FILE} || do_exit
+        ( make 2>&1 ) 1>> ${LOG_FILE} || do_exit
+        ( sudo make install 2>&1 ) 1>> ${LOG_FILE} || do_exit
+        touch done
+        cd ..
+    fi
+
+    if [ ! -e ${DEST_DIR}/src/ets_done ] 
+    then
+        echo "Installing ETS (needs sudo)"
+        tar xvfz ETS-20100316.tar.gz
+        sudo easy_install -N ETS_3.3.1/dist/*.egg
+    fi
+    touch ${DEST_DIR}/src/ets_done
+
+    echo "GUI installed successfully."
+fi
+
 echo
 echo
 echo "========================================================================"
@@ -247,6 +312,12 @@
   echo "$DEST_DIR/bin/hg"
   echo
 fi
+if [ $INST_GUI -eq 1 ]
+then
+  echo "The GUI toolkit dependencies have also been installed."
+  echo "You will need to add /usr/lib/vtk-5.5/ to your DYLD_LIBRARY_PATH ."
+  echo "Additionally, set ETS_TOOLKIT to 'qt4' in your environment."
+fi
 echo
 echo "For support, see one of the following websites:"
 echo
@@ -258,3 +329,7 @@
 echo "    http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org"
 echo
 echo "========================================================================"
+echo
+echo "      Everything is fine.  Nothing is ruined."
+echo
+echo "========================================================================"
diff -r 54cdd56fb83c -r d9dc71c21f5f yt/_amr_utils/VolumeIntegrator.pyx
--- a/yt/_amr_utils/VolumeIntegrator.pyx	Tue Apr 20 18:12:16 2010 -0700
+++ b/yt/_amr_utils/VolumeIntegrator.pyx	Thu Apr 22 11:08:18 2010 -0700
@@ -73,152 +73,81 @@
 
 cdef class VectorPlane
 
-cdef struct FieldInterpolationTable:
-    # Note that we make an assumption about retaining a reference to values
-    # externally.
-    np.float64_t *values 
-    np.float64_t bounds[2]
-    np.float64_t dbin
-    np.float64_t idbin
-    int field_id
-    int weight_field_id
-    int weight_table_id
-    int nbins
-    int pass_through
+cdef class TransferFunctionProxy:
+    cdef np.float64_t x_bounds[2]
+    cdef np.float64_t *vs[4]
+    cdef int nbins
+    cdef public int ns
+    cdef np.float64_t dbin, idbin
+    cdef np.float64_t light_color[3]
+    cdef np.float64_t light_dir[3]
+    cdef int use_light
+    cdef public object tf_obj
+    def __cinit__(self, tf_obj):
+        self.tf_obj = tf_obj
+        cdef np.ndarray[np.float64_t, ndim=1] temp
+        temp = tf_obj.red.y
+        self.vs[0] = <np.float64_t *> temp.data
+        temp = tf_obj.green.y
+        self.vs[1] = <np.float64_t *> temp.data
+        temp = tf_obj.blue.y
+        self.vs[2] = <np.float64_t *> temp.data
+        temp = tf_obj.alpha.y
+        self.vs[3] = <np.float64_t *> temp.data
+        self.x_bounds[0] = tf_obj.x_bounds[0]
+        self.x_bounds[1] = tf_obj.x_bounds[1]
+        self.nbins = tf_obj.nbins
+        self.dbin = (self.x_bounds[1] - self.x_bounds[0])/self.nbins
+        self.idbin = 1.0/self.dbin
+        self.light_color[0] = tf_obj.light_color[0]
+        self.light_color[1] = tf_obj.light_color[1]
+        self.light_color[2] = tf_obj.light_color[2]
+        self.light_dir[0] = tf_obj.light_dir[0]
+        self.light_dir[1] = tf_obj.light_dir[1]
+        self.light_dir[2] = tf_obj.light_dir[2]
+        cdef np.float64_t normval = 0.0
+        for i in range(3): normval += self.light_dir[i]**2
+        normval = normval**0.5
+        for i in range(3): self.light_dir[i] /= normval
+        self.use_light = tf_obj.use_light
 
-cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins,
-              np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2,
-              int field_id, int weight_field_id = -1, int weight_table_id = -1,
-              int pass_through = 0):
-    fit.bounds[0] = bounds1; fit.bounds[1] = bounds2
-    fit.nbins = nbins
-    fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins
-    fit.idbin = 1.0/fit.dbin
-    # Better not pull this out from under us, yo
-    fit.values = values
-    fit.field_id = field_id
-    fit.weight_field_id = weight_field_id
-    fit.weight_table_id = weight_table_id
-    fit.pass_through = pass_through
-
-cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit,
-                            np.float64_t *dvs):
-    cdef np.float64_t bv, dy, dd, tf
-    cdef int bin_id
-    if fit.pass_through == 1: return dvs[fit.field_id]
-    bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
-    dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
-    if bin_id > fit.nbins - 2 or bin_id < 0: return 0.0
-    bv = fit.values[bin_id]
-    dy = fit.values[bin_id + 1] - bv
-    if fit.weight_field_id != -1:
-        return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)
-    return (bv + dd*dy*fit.idbin)
-
-cdef class TransferFunctionProxy:
-    cdef int n_fields
-    cdef int n_field_tables
-    cdef public int ns
-
-    # These are the field tables and their affiliated storage.
-    # We have one field_id for every table.  Note that a single field can
-    # correspond to multiple tables, and each field table will only have
-    # interpolate called once.
-    cdef FieldInterpolationTable field_tables[6]
-    cdef np.float64_t istorage[6]
-
-    # Here are the field tables that correspond to each of the six channels.
-    # We have three emission channels, three absorption channels.
-    cdef int field_table_ids[6]
-
-    # We store a reference to the transfer function object and to the field
-    # interpolation tables
-    cdef public object tf_obj
-    cdef public object my_field_tables
-
-    def __cinit__(self, tf_obj):
-        # We have N fields.  We have 6 channels.  We have M field tables.
-        # The idea is that we can have multiple channels corresponding to the
-        # same field table.  So, we create storage for the outputs from all the
-        # field tables.  We need to know which field value to pass in to the
-        # field table, and we need to know which table to use for each of the
-        # six channels.
-        cdef int i
-        cdef np.ndarray[np.float64_t, ndim=1] temp
-        cdef FieldInterpolationTable fit
-
-        self.tf_obj = tf_obj
-
-        self.n_field_tables = tf_obj.n_field_tables
-        for i in range(6): self.istorage[i] = 0.0
-
-        self.my_field_tables = []
-        for i in range(self.n_field_tables):
-            temp = tf_obj.tables[i].y
-            FIT_initialize_table(&self.field_tables[i],
-                      temp.shape[0],
-                      <np.float64_t *> temp.data,
-                      tf_obj.tables[i].x_bounds[0],
-                      tf_obj.tables[i].x_bounds[1],
-                      tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
-                      tf_obj.weight_table_ids[i],
-                      tf_obj.tables[i].pass_through)
-            self.my_field_tables.append((tf_obj.tables[i],
-                                         tf_obj.tables[i].y))
-            self.field_tables[i].field_id = tf_obj.field_ids[i]
-            self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i]
-            print "Field table", i, "corresponds to",
-            print self.field_tables[i].field_id,
-            print "(Weighted with ", self.field_tables[i].weight_field_id,
-            print ")"
-
-        for i in range(6):
-            self.field_table_ids[i] = tf_obj.field_table_ids[i]
-            print "Channel", i, "corresponds to", self.field_table_ids[i]
-            
     @cython.boundscheck(False)
     @cython.wraparound(False)
-    cdef void eval_transfer(self, np.float64_t dt, np.float64_t *dvs,
-                                  np.float64_t *rgba, np.float64_t *grad):
-        cdef int i, fid, use
-        cdef np.float64_t ta, tf, trgba[6], dot_prod
-        # This very quick pass doesn't hurt us too badly, and it helps for
-        # early-cutoff.  We check all the field tables, because we want to be
-        # able to attenuate even in the presence of no emissivity.
-        use = 0
-        for i in range(self.n_field_tables):
-            fid = self.field_tables[i].field_id
-            if (dvs[fid] >= self.field_tables[i].bounds[0]) and \
-               (dvs[fid] <= self.field_tables[i].bounds[1]):
-                use = 1
-                break
-        for i in range(self.n_field_tables):
-            self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs)
-        # We have to do this after the interpolation
-        for i in range(self.n_field_tables):
-            fid = self.field_tables[i].weight_table_id
-            if fid != -1: self.istorage[i] *= self.istorage[fid]
-        for i in range(6):
-            trgba[i] = self.istorage[self.field_table_ids[i]]
-            #print i, trgba[i],
-        #print
-        # A few words on opacity.  We're going to be integrating equation 1.23
-        # from Rybicki & Lightman.  dI_\nu / ds = -\alpha_\nu I_\nu + j_\nu
-        # \alpha_nu = \kappa \rho , but we leave that up to the input
-        # transfer function.
-        # SOoooooOOOooo, the upshot is that we are doing a rectangular
-        # integration here:
-        #   I_{i+1} = ds * C_i + (1.0 - ds*alpha_i) * I_i
-        for i in range(3):
-            # This is the new way: alpha corresponds to opacity of a given



More information about the yt-svn mailing list