[Yt-svn] yt: 2 new changesets

hg at spacepope.org hg at spacepope.org
Fri Apr 23 14:16:28 PDT 2010


hg Repository: yt
details:   yt/rev/7df4438c7f0c
changeset: 1591:7df4438c7f0c
user:      mturk
date:
Wed Apr 21 07:04:43 2010 -0700
description:
[svn r1694] 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.

hg Repository: yt
details:   yt/rev/2c7e6783870c
changeset: 1592:2c7e6783870c
user:      Matthew Turk <matthewturk at gmail.com>
date:
Fri Apr 23 14:16:22 2010 -0700
description:
Merging from trunk

diffstat:

 .hgignore                                          |     3 +
 doc/install_script.sh                              |    22 +-
 doc/install_script_osx.sh                          |     1 +
 doc/install_script_osx106.sh                       |     1 +
 scripts/fbranch                                    |     5 +-
 scripts/fbury                                      |     5 +-
 scripts/fdigup                                     |     5 +-
 scripts/fido                                       |     5 +-
 scripts/fimport                                    |     5 +-
 yt/_amr_utils/fortran_reader.pyx                   |    70 +
 yt/_amr_utils/png_writer.pyx                       |   147 +
 yt/amr_utils.c                                     |  2431 +++++++++++++++----------
 yt/amr_utils.pyx                                   |     2 +
 yt/arraytypes.py                                   |    11 +
 yt/config.py                                       |     1 +
 yt/extensions/EnzoSimulation.py                    |    65 +-
 yt/extensions/MergerTree.py                        |   840 ++++++++
 yt/extensions/StarAnalysis.py                      |    24 +-
 yt/extensions/_colormap_data.py                    |   797 ++++++++
 yt/extensions/image_writer.py                      |    65 +
 yt/extensions/kdtree/fKD.f90                       |    27 +
 yt/extensions/kdtree/fKD.v                         |     2 +
 yt/extensions/volume_rendering/__init__.py         |     2 +-
 yt/extensions/volume_rendering/software_sampler.py |    10 +
 yt/fido/share_data.py                              |    83 +
 yt/funcs.py                                        |     9 +-
 yt/lagos/BaseDataTypes.py                          |    39 +-
 yt/lagos/BaseGridType.py                           |    24 +
 yt/lagos/DataReadingFuncs.py                       |    26 +
 yt/lagos/FieldInfoContainer.py                     |     9 +
 yt/lagos/HaloFinding.py                            |    93 +-
 yt/lagos/HierarchyType.py                          |    76 +
 yt/lagos/OutputTypes.py                            |    77 +-
 yt/lagos/ParallelTools.py                          |    45 +
 yt/lagos/StructureFunctionGenerator.py             |   746 +++++++
 yt/lagos/__init__.py                               |     2 +
 yt/lagos/kd.py                                     |     2 +-
 yt/lagos/parallelHOP/parallelHOP.py                |    31 +-
 yt/lagos/setup.py                                  |     4 +-
 yt/logger.py                                       |    26 +
 yt/mods.py                                         |     3 +-
 yt/raven/ColorMaps.py                              |     9 +
 yt/reason/plot_editors.py                          |    10 +-
 yt/reason/reason_v2.py                             |     5 +-
 yt/reason/tvtk_interface.py                        |     5 +-
 yt/setup.py                                        |    62 +-
 46 files changed, 4800 insertions(+), 1132 deletions(-)

diffs (truncated from 13743 to 300 lines):

diff -r 54b40176db2a -r 2c7e6783870c .hgignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Fri Apr 23 14:16:22 2010 -0700
@@ -0,0 +1,3 @@
+syntax: glob
+*.pyc
+.*.swp
diff -r 54b40176db2a -r 2c7e6783870c doc/install_script.sh
--- a/doc/install_script.sh	Thu Apr 15 08:32:10 2010 -0700
+++ b/doc/install_script.sh	Fri Apr 23 14:16:22 2010 -0700
@@ -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
diff -r 54b40176db2a -r 2c7e6783870c doc/install_script_osx.sh
--- a/doc/install_script_osx.sh	Thu Apr 15 08:32:10 2010 -0700
+++ b/doc/install_script_osx.sh	Fri Apr 23 14:16:22 2010 -0700
@@ -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
diff -r 54b40176db2a -r 2c7e6783870c doc/install_script_osx106.sh
--- a/doc/install_script_osx106.sh	Thu Apr 15 08:32:10 2010 -0700
+++ b/doc/install_script_osx106.sh	Fri Apr 23 14:16:22 2010 -0700
@@ -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
diff -r 54b40176db2a -r 2c7e6783870c scripts/fbranch
--- a/scripts/fbranch	Thu Apr 15 08:32:10 2010 -0700
+++ b/scripts/fbranch	Fri Apr 23 14:16:22 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 54b40176db2a -r 2c7e6783870c scripts/fbury
--- a/scripts/fbury	Thu Apr 15 08:32:10 2010 -0700
+++ b/scripts/fbury	Fri Apr 23 14:16:22 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 54b40176db2a -r 2c7e6783870c scripts/fdigup
--- a/scripts/fdigup	Thu Apr 15 08:32:10 2010 -0700
+++ b/scripts/fdigup	Fri Apr 23 14:16:22 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 54b40176db2a -r 2c7e6783870c scripts/fido
--- a/scripts/fido	Thu Apr 15 08:32:10 2010 -0700
+++ b/scripts/fido	Fri Apr 23 14:16:22 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+from yt.mods import *
+
+fido.runAction()
diff -r 54b40176db2a -r 2c7e6783870c scripts/fimport
--- a/scripts/fimport	Thu Apr 15 08:32:10 2010 -0700
+++ b/scripts/fimport	Fri Apr 23 14:16:22 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+from yt.mods import *
+
+fido.runAction()
diff -r 54b40176db2a -r 2c7e6783870c yt/_amr_utils/fortran_reader.pyx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/_amr_utils/fortran_reader.pyx	Fri Apr 23 14:16:22 2010 -0700
@@ -0,0 +1,70 @@
+"""
+Simple readers for fortran unformatted data, specifically for the Tiger code.
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: UCSD
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2010 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import numpy as np
+cimport numpy as np
+cimport cython
+
+from stdio cimport fopen, fclose, FILE
+
+cdef extern from "stdio.h":
+    cdef int SEEK_SET
+    cdef int SEEK_CUR
+    cdef int SEEK_END
+    int fseek(FILE *stream, long offset, int whence)
+    size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
+    long ftell(FILE *stream)
+
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
+def read_tiger_section(
+                     char *fn,
+                     np.ndarray[np.int64_t, ndim=1] slab_start,
+                     np.ndarray[np.int64_t, ndim=1] slab_size,
+                     np.ndarray[np.int64_t, ndim=1] root_size,
+                     int offset = 36):
+    cdef int strides[3]
+    strides[0] = 1
+    strides[1] = root_size[0] * strides[0]
+    strides[2] = strides[1] * root_size[1] + 2
+    cdef np.int64_t i, j, k
+    cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F')
+    cdef FILE *f = fopen(fn, "rb")
+    #for i in range(3): offset += strides[i] * slab_start[i]
+    cdef np.int64_t pos = 0
+    cdef np.int64_t moff = 0
+    cdef float *data = <float *> buffer.data
+    fseek(f, offset, 0)
+    # If anybody wants to convert this loop to a SEEK_CUR, that'd be great.
+    for i in range(slab_size[2]):
+        for j in range(slab_size[1]):
+            moff = (slab_start[0]    ) * strides[0] \
+                 + (slab_start[1] + j) * strides[1] \
+                 + (slab_start[2] + i) * strides[2]
+            #print offset + 4 * moff, pos
+            fseek(f, offset + 4 * moff, SEEK_SET)
+            fread(<void *> (data + pos), 4, slab_size[0], f)
+            pos += slab_size[0]
+    return buffer
diff -r 54b40176db2a -r 2c7e6783870c yt/_amr_utils/png_writer.pyx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/_amr_utils/png_writer.pyx	Fri Apr 23 14:16:22 2010 -0700
@@ -0,0 +1,147 @@
+"""
+A light interface to libpng
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: UCSD
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2010 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import numpy as np
+cimport numpy as np
+cimport cython
+
+from stdio cimport fopen, fclose, FILE
+
+cdef extern from "stdlib.h":
+    # NOTE that size_t might not be int
+    void *alloca(int)
+
+cdef extern from "png.h":
+    ctypedef unsigned long png_uint_32
+    ctypedef long png_int_32
+    ctypedef unsigned short png_uint_16
+    ctypedef short png_int_16
+    ctypedef unsigned char png_byte
+    ctypedef void            *png_voidp
+    ctypedef png_byte        *png_bytep
+    ctypedef png_uint_32     *png_uint_32p
+    ctypedef png_int_32      *png_int_32p
+    ctypedef png_uint_16     *png_uint_16p
+    ctypedef png_int_16      *png_int_16p
+    ctypedef char            *png_charp
+    ctypedef char            *png_const_charp
+    ctypedef FILE            *png_FILE_p
+
+    ctypedef struct png_struct:
+        pass
+    ctypedef png_struct      *png_structp
+
+    ctypedef struct png_info:
+        pass
+    ctypedef png_info        *png_infop
+
+    ctypedef struct png_color_8:
+        png_byte red
+        png_byte green
+        png_byte blue
+        png_byte gray
+        png_byte alpha
+    ctypedef png_color_8 *png_color_8p
+
+    cdef png_const_charp PNG_LIBPNG_VER_STRING
+
+    # Note that we don't support error or warning functions
+    png_structp png_create_write_struct(
+        png_const_charp user_png_ver, png_voidp error_ptr,
+        void *error_fn, void *warn_fn)
+    
+    png_infop png_create_info_struct(png_structp png_ptr)
+
+    void png_init_io(png_structp png_ptr, png_FILE_p fp)
+
+    void png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
+        png_uint_32 width, png_uint_32 height, int bit_depth,
+        int color_type, int interlace_method, int compression_method,
+        int filter_method)
+
+    cdef int PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE
+    cdef int PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE
+
+    void png_set_pHYs(png_structp png_ptr, png_infop info_ptr,



More information about the yt-svn mailing list