[yt-svn] commit/yt: 7 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jul 16 06:05:33 PDT 2014


7 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/36184fa50b21/
Changeset:   36184fa50b21
Branch:      yt-3.0
User:        chummels
Date:        2014-07-12 19:41:59
Summary:     Moving the unparsed_args initialization over from yt.mods to the yt import.  This way you can still access that functionality when you just import yt.
Affected #:  2 files

diff -r 6ccdbe9cd120d66ae7a40fbe2212acfc96a5a40b -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e yt/__init__.py
--- a/yt/__init__.py
+++ b/yt/__init__.py
@@ -76,7 +76,6 @@
 
 # First module imports
 import numpy as np # For modern purposes
-import numpy # In case anyone wishes to use it by name
 
 from yt.funcs import \
     iterable, \
@@ -162,3 +161,9 @@
 from yt.utilities.math_utils import \
     ortho_find, quartiles, periodic_position
 
+# The variable unparsed_args is not used internally but is provided
+# as a convenience for users who wish to parse arguments in scripts.
+# See http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-December/
+#     001727.html
+import startup_tasks as __startup_tasks
+unparsed_args = __startup_tasks.unparsed_args

diff -r 6ccdbe9cd120d66ae7a40fbe2212acfc96a5a40b -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e yt/mods.py
--- a/yt/mods.py
+++ b/yt/mods.py
@@ -25,12 +25,7 @@
 
 # This next item will handle most of the actual startup procedures, but it will
 # also attempt to parse the command line and set up the global state of various
-# operations.  The variable unparsed_args is not used internally but is
-# provided as a convenience for users who wish to parse arguments in scripts.
-# See http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-December/
-#     001727.html
-import yt.startup_tasks as __startup_tasks
-unparsed_args = __startup_tasks.unparsed_args
+# operations.  
 
 from yt.config import ytcfg, ytcfg_defaults
 


https://bitbucket.org/yt_analysis/yt/commits/50f4b65d410f/
Changeset:   50f4b65d410f
Branch:      yt-3.0
User:        chummels
Date:        2014-07-12 19:42:45
Summary:     Merging.
Affected #:  19 files

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -7,6 +7,7 @@
 rockstar.cfg
 yt_updater.log
 yt/frontends/artio/_artio_caller.c
+yt/analysis_modules/halo_finding/rockstar/rockstar_groupies.c
 yt/analysis_modules/halo_finding/rockstar/rockstar_interface.c
 yt/frontends/ramses/_ramses_reader.cpp
 yt/frontends/sph/smoothing_kernel.c

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca MANIFEST.in
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -12,4 +12,3 @@
 prune tests
 graft yt/gui/reason/html/resources
 exclude clean.sh .hgchurn
-recursive-include yt/utilities/kdtree *.f90 *.v Makefile LICENSE

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca doc/source/analyzing/analysis_modules/running_halofinder.rst
--- a/doc/source/analyzing/analysis_modules/running_halofinder.rst
+++ b/doc/source/analyzing/analysis_modules/running_halofinder.rst
@@ -300,40 +300,11 @@
 Therefore Parallel HOP is not a direct substitution for
 normal HOP, but is very similar.
 
-.. _fkd_setup:
-
-Fortran kD Tree Setup
-^^^^^^^^^^^^^^^^^^^^^
-
-Parallel HOP will not build automatically with yt. Please follow the instructions
-below in order to setup Parallel HOP.
-
-  #. Download `Forthon <http://hifweb.lbl.gov/Forthon/>`_. Extract the files
-     (e.g. tar -zxvf Forthon.tgz) and cd into the new Forthon directory. 
-     Making sure you're using the same version of python you use with yt, invoke
-     ``python setup.py install``.
-  #. Change directory to your yt source. Starting from the top level, cd into
-     ``yt/utilities/kdtree``.
-  #. Inside that directory, you should see these files:
-  
-     .. code-block:: bash
-     
-        % ls
-        Makefile        fKD.f90         fKD_source.f90
-        __init__.py     fKD.v           test.py
-  
-  #. Type ``make``. If that is successful, there should be a file in the
-     directory named ``fKDpy.so``. If there are problems, please contact the
-     `yt-users email list <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>`_.
-  #. Go to the top level of the yt source directory, which from the ``kdtree``
-     directory is three levels up ``cd ../../..``, and invoke
-     ``python setup.py install``.
-  #. Parallel HOP should now work.
-     
-
 Running Parallel HOP
 ^^^^^^^^^^^^^^^^^^^^
 
+Note: This is probably broken now that the Fortran kdtree has been removed.
+
 In the simplest form, Parallel HOP is run very similarly to the other halo finders.
 In the example below, Parallel HOP will be run on a dataset with all the default
 values. Parallel HOP can be run in serial, but as mentioned above, it is

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca setup.py
--- a/setup.py
+++ b/setup.py
@@ -25,48 +25,6 @@
 from distutils.core import Command
 from distutils.spawn import find_executable
 
-def find_fortran_deps():
-    return (find_executable("Forthon"),
-            find_executable("gfortran"))
-
-class BuildForthon(Command):
-
-    """Command for building Forthon modules"""
-
-    description = "Build Forthon modules"
-    user_options = []
-
-    def initialize_options(self):
-
-        """init options"""
-
-        pass
-
-    def finalize_options(self):
-
-        """finalize options"""
-
-        pass
-
-    def run(self):
-
-        """runner"""
-        (Forthon_exe, gfortran_exe) = find_fortran_deps()
-        if None in (Forthon_exe, gfortran_exe):
-            sys.stderr.write(
-                "fKDpy.so won't be built due to missing Forthon/gfortran\n"
-            )
-            return
-
-        cwd = os.getcwd()
-        os.chdir(os.path.join(cwd, 'yt/utilities/kdtree'))
-        cmd = [Forthon_exe, "-F", "gfortran", "--compile_first",
-               "fKD_source", "--no2underscores", "--fopt", "'-O3'", "fKD",
-               "fKD_source.f90"]
-        subprocess.check_call(cmd, shell=False)
-        shutil.move(glob.glob('build/lib*/fKDpy.so')[0], os.getcwd())
-        os.chdir(cwd)
-
 REASON_FILES = []
 REASON_DIRS = [
     "",
@@ -193,21 +151,9 @@
 
 class my_build_src(build_src.build_src):
     def run(self):
-        self.run_command("build_forthon")
         build_src.build_src.run(self)
 
 
-class my_install_data(np_install_data.install_data):
-    def run(self):
-        (Forthon_exe, gfortran_exe) = find_fortran_deps()
-        if None in (Forthon_exe, gfortran_exe):
-            pass
-        else:
-            self.distribution.data_files.append(
-                ('yt/utilities/kdtree', ['yt/utilities/kdtree/fKDpy.so'])
-                )
-        np_install_data.install_data.run(self)
-
 class my_build_py(build_py):
     def run(self):
         # honor the --dry-run flag
@@ -277,8 +223,7 @@
         configuration=configuration,
         zip_safe=False,
         data_files=REASON_FILES,
-        cmdclass={'build_py': my_build_py, 'build_forthon': BuildForthon,
-                  'build_src': my_build_src, 'install_data': my_install_data},
+        cmdclass={'build_py': my_build_py, 'build_src': my_build_src},
     )
     return
 

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py
--- a/yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py
+++ b/yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py
@@ -21,12 +21,14 @@
 from yt.funcs import *
 from yt.utilities.performance_counters import yt_counters, time_function
 try:
+    # Note: This is now broken due to removing of kdtree (DHR 7/11/2014)
     from yt.utilities.kdtree.api import \
         chainHOP_tags_dens, \
         create_tree, fKD, find_nn_nearest_neighbors, \
         free_tree, find_chunk_nearest_neighbors
 except ImportError:
-    mylog.debug("The Fortran kD-Tree did not import correctly.")
+    mylog.debug("The Fortran kD-Tree did not import correctly. "
+                "It was removed as of 7/11/2014.")
 
 from yt.utilities.spatial import cKDTree
 

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -508,6 +508,13 @@
 
         f.close()
 
+    def _set_derived_attrs(self):
+        if self.domain_left_edge is None or self.domain_right_edge is None:
+            self.domain_left_edge = np.nan
+            self.domain_right_edge = np.nan
+            self.index
+        super(TipsyDataset, self)._set_derived_attrs()
+
     def _set_code_unit_attributes(self):
         if self.cosmological_simulation:
             mu = self.parameters.get('dMsolUnit', 1.)

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca yt/utilities/kdtree/LICENSE
--- a/yt/utilities/kdtree/LICENSE
+++ /dev/null
@@ -1,98 +0,0 @@
-
-The KDTREE2 software is licensed under the terms of the Academic Free
-Software License, listed herein.  In addition, users of this software
-must give appropriate citation in relevant technical documentation or
-journal paper to the author, Matthew B. Kennel, Institute For
-Nonlinear Science, preferably via a reference to the www.arxiv.org
-repository of this document, {\tt www.arxiv.org e-print:
-physics/0408067}.  This requirement will be deemed to be advisory and
-not mandatory as is necessary to permit the free inclusion of the
-present software with any software licensed under the terms of any
-version of the GNU General Public License, or GNU Library General
-Public License.
-
-
-Academic Free License
-Version 1.1
-
-This Academic Free License applies to any original work of authorship
-(the "Original Work") whose owner (the "Licensor") has placed the
-following notice immediately following the copyright notice for the
-Original Work: "Licensed under the Academic Free License version 1.1."
-
-Grant of License. Licensor hereby grants to any person obtaining a
-copy of the Original Work ("You") a world-wide, royalty-free,
-non-exclusive, perpetual, non-sublicenseable license (1) to use, copy,
-modify, merge, publish, perform, distribute and/or sell copies of the
-Original Work and derivative works thereof, and (2) under patent
-claims owned or controlled by the Licensor that are embodied in the
-Original Work as furnished by the Licensor, to make, use, sell and
-offer for sale the Original Work and derivative works thereof, subject
-to the following conditions.
-
-Right of Attribution. Redistributions of the Original Work must
-reproduce all copyright notices in the Original Work as furnished by
-the Licensor, both in the Original Work itself and in any
-documentation and/or other materials provided with the distribution of
-the Original Work in executable form.
-
-Exclusions from License Grant. Neither the names of Licensor, nor the
-names of any contributors to the Original Work, nor any of their
-trademarks or service marks, may be used to endorse or promote
-products derived from this Original Work without express prior written
-permission of the Licensor.
-
-WARRANTY AND DISCLAIMERS. LICENSOR WARRANTS THAT THE COPYRIGHT IN AND
-TO THE ORIGINAL WORK IS OWNED BY THE LICENSOR OR THAT THE ORIGINAL
-WORK IS DISTRIBUTED BY LICENSOR UNDER A VALID CURRENT LICENSE FROM THE
-COPYRIGHT OWNER. EXCEPT AS EXPRESSLY STATED IN THE IMMEDIATELY
-PRECEEDING SENTENCE, THE ORIGINAL WORK IS PROVIDED UNDER THIS LICENSE
-ON AN "AS IS" BASIS, WITHOUT WARRANTY, EITHER EXPRESS OR IMPLIED,
-INCLUDING, WITHOUT LIMITATION, THE WARRANTY OF NON-INFRINGEMENT AND
-WARRANTIES THAT THE ORIGINAL WORK IS MERCHANTABLE OR FIT FOR A
-PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
-WORK IS WITH YOU. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
-PART OF THIS LICENSE. NO LICENSE TO ORIGINAL WORK IS GRANTED HEREUNDER
-EXCEPT UNDER THIS DISCLAIMER.
-
-LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL
-THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE,
-SHALL THE LICENSOR BE LIABLE TO ANY PERSON FOR ANY DIRECT, INDIRECT,
-SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING
-AS A RESULT OF THIS LICENSE OR THE USE OF THE ORIGINAL WORK INCLUDING,
-WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE,
-COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL
-DAMAGES OR LOSSES, EVEN IF SUCH PERSON SHALL HAVE BEEN INFORMED OF THE
-POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT
-APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH
-PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH
-LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
-LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION
-AND LIMITATION MAY NOT APPLY TO YOU.
-
-License to Source Code. The term "Source Code" means the preferred
-form of the Original Work for making modifications to it and all
-available documentation describing how to access and modify the
-Original Work. Licensor hereby agrees to provide a machine-readable
-copy of the Source Code of the Original Work along with each copy of
-the Original Work that Licensor distributes. Licensor reserves the
-right to satisfy this obligation by placing a machine-readable copy of
-the Source Code in an information repository reasonably calculated to
-permit inexpensive and convenient access by You for as long as
-Licensor continues to distribute the Original Work, and by publishing
-the address of that information repository in a notice immediately
-following the copyright notice that applies to the Original Work.
-
-Mutual Termination for Patent Action. This License shall terminate
-automatically and You may no longer exercise any of the rights granted
-to You by this License if You file a lawsuit in any court alleging
-that any OSI Certified open source software that is licensed under any
-license containing this "Mutual Termination for Patent Action" clause
-infringes any patent claims that are essential to use that software.
-
-This license is Copyright (C) 2002 Lawrence E. Rosen. All rights
-reserved. Permission is hereby granted to copy and distribute this
-license without modification. This license may not be modified without
-the express written permission of its copyright owner.
-
-

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca yt/utilities/kdtree/Makefile
--- a/yt/utilities/kdtree/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# if you want to build this statically, you need to include fKD.f90 to the
-# compile line, so pick the first of the two below. Otherwise, eliminate it, 
-# like the second, for a shared object.
-
-ifdef FORTHON_EXE
-FORTHON=$(FORTHON_EXE)
-else
-FORTHON=Forthon
-endif
-
-fKD: fKD.f90 fKD.v fKD_source.f90
-#	Forthon --compile_first fKD_source --no2underscores -g fKD fKD.f90 fKD_source.f90
-	@echo "Using $(FORTHON) ($(FORTHON_EXE))"
-	$(FORTHON) -F gfortran --compile_first fKD_source --no2underscores --fopt "-O3" fKD fKD_source.f90
-	mv build/lib*/fKDpy.so .
-
-clean:
-	rm -rf build fKDpy.a fKDpy.so

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca yt/utilities/kdtree/api.py
--- a/yt/utilities/kdtree/api.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from .fKDpy import \
-    chainHOP_tags_dens, \
-    create_tree, \
-    fKD, \
-    find_nn_nearest_neighbors, \
-    free_tree, \
-    find_chunk_nearest_neighbors
-
-

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca yt/utilities/kdtree/fKD.f90
--- a/yt/utilities/kdtree/fKD.f90
+++ /dev/null
@@ -1,346 +0,0 @@
-subroutine create_tree(treeID)
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-    
-    integer, intent (in), optional         :: treeID
-    
-    integer :: ID
-    
-    if (present(treeID)) then
-       ID = treeID
-    else
-       ID = -1
-    end if
-    
-    ! create a kd tree object
-    
-    if (ID == 1) then
-        t1%tree2 => kdtree2_create(t1%pos,sort=t1%sort,rearrange=t1%rearrange)
-    elseif (ID == 2) then
-        t2%tree2 => kdtree2_create(t2%pos,sort=t2%sort,rearrange=t2%rearrange)
-    else
-        tree2 => kdtree2_create(pos,sort=sort,rearrange=rearrange)
-    end if
-
-    return
-
-end subroutine create_tree
-
-subroutine add_tree(treeID)
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-    
-    integer :: treeID
-    
-    if (treeID == 1) then
-        t1 => Newtree_set()
-    elseif (treeID == 2) then
-        t2 => Newtree_set()
-    end if
-    
-    return
-
-end subroutine add_tree
-
-subroutine find_nn_nearest_neighbors()
-     use kdtree2_module
-     use fKD_module
-     use tree_setmodule
-     use kdtree2module
-     use tree_nodemodule
-     use intervalmodule
-
-     integer :: k
-     type(kdtree2_result),allocatable :: results(:) ! nearest neighbors
-     !integer, parameter  :: nn ! number of nearest neighbors found
-
-     allocate(results(nn)) 
-
-     call kdtree2_n_nearest(tp=tree2,qv=qv,nn=nn,results=results) 
-
-     dist = results%dis
-     tags = results%idx
-
-  !do k=1,nn
-  !   print *, "k = ", k, " idx = ", tags(k)," dis = ", dist(k)
-  !   print *, "x y z", pos(1,results(k)%idx), pos(2,results(k)%idx), pos(3,results(k)%idx)
-  !enddo
-
-
-     deallocate(results)
-     return
-
-end subroutine find_nn_nearest_neighbors
-
-subroutine find_many_nn_nearest_neighbors()
-    ! Given an input array of query vectors (qv_many), find their
-    ! nearest neighbors.
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-    
-    integer :: k, number
-    type(kdtree2_result),allocatable :: results(:)
-
-    allocate(results(nn))
-
-    number = size(qv_many,2)
-
-    do k=1, number
-        qv(:) = qv_many(:,k)
-        call kdtree2_n_nearest(tp=tree2,qv=qv,nn=nn,results=results)
-        nn_tags(:, k) = results%idx
-    end do
-    
-    deallocate(results)
-    return
-
-end subroutine find_many_nn_nearest_neighbors
-
-subroutine find_r_nearest()
-    ! Given an input array of a point (qv), find the number, fortran indices and
-    ! squared distances to all neighbors within (radius) of (qv).
-    ! The number of neighbors with indices and radius returned is set by
-    ! (radius_n), and if this is smaller than (nfound) when returned,
-    ! there are neighbors missing from the results.
-    ! Store the results in (dist) and (tags).
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-    
-    integer :: k
-    type(kdtree2_result),allocatable :: results(:) ! nearest neighbors
-    
-    allocate(results(radius_n))
-    nfound = 0
-    
-    ! do it.
-    call kdtree2_r_nearest(tp=tree2,qv=qv,r2=radius,nfound=nfound,nalloc=radius_n,results=results)
-    
-    tags(:) = results%idx
-    dist(:) = results%dis
-    
-    deallocate(results)
-    return
-
-end subroutine find_r_nearest
-
-subroutine find_many_r_nearest(treeID)
-    ! Given an input array of a points (qv_many), find the number, fortran indices and
-    ! squared distances to all neighbors within (radius) of (qv).
-    ! The number of neighbors with indices and radius returned is set by
-    ! (radius_n), and if this is smaller than (nfound) when returned,
-    ! there are neighbors missing from the results.
-    ! Store the results in (dist) and (tags).
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-
-    integer, intent (in), optional         :: treeID
-    
-    integer :: ID
-    integer :: k, number
-    type(kdtree2_result),allocatable :: results(:) ! nearest neighbors
-
-    
-    if (present(treeID)) then
-       ID = treeID
-    else
-       ID = -1
-    end if    
-
-    if (ID==1) then
-        allocate(results(t1%radius_n))
-        number = size(t1%qv_many,2)
-        do k=1, number
-            t1%qv(:) = t1%qv_many(:,k)
-            t1%nfound = t1%nfound_many(k)
-            call kdtree2_r_nearest(tp=t1%tree2,qv=t1%qv,r2=t1%radius,nfound=t1%nfound,nalloc=t1%radius_n,results=results)
-            t1%nfound_many(k) = t1%nfound
-            t1%nn_tags(:, k) = results%idx
-            t1%nn_dist(:, k) = results%dis
-        end do
-    elseif (ID==2) then
-        allocate(results(t2%radius_n))
-        number = size(t2%qv_many,2)
-        do k=1, number
-            t2%qv(:) = t2%qv_many(:,k)
-            t2%nfound = t2%nfound_many(k)
-            call kdtree2_r_nearest(tp=t2%tree2,qv=t2%qv,r2=t2%radius,nfound=t2%nfound,nalloc=t2%radius_n,results=results)
-            t2%nfound_many(k) = t2%nfound
-            t2%nn_tags(:, k) = results%idx
-            t2%nn_dist(:, k) = results%dis
-        end do
-    else
-        allocate(results(radius_n))
-        number = size(qv_many,2)
-        do k=1, number
-            qv(:) = qv_many(:,k)
-            nfound = nfound_many(k)
-            call kdtree2_r_nearest(tp=tree2,qv=qv,r2=radius,nfound=nfound,nalloc=radius_n,results=results)
-            nfound_many(k) = nfound
-            nn_tags(:, k) = results%idx
-            nn_dist(:, k) = results%dis
-        end do
-    end if
-    
-    deallocate(results)
-    return
-
-end subroutine find_many_r_nearest
-
-subroutine find_all_nn_nearest_neighbors()
-    ! for all particles in pos, find their nearest neighbors and return the
-    ! indexes and distances as big arrays
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-    
-    integer :: k
-    type(kdtree2_result),allocatable :: results(:) ! nearest neighbors
-
-    allocate(results(nn))
-    
-    do k=1,nparts
-        qv(:) = pos(:,k)
-        call kdtree2_n_nearest(tp=tree2,qv=qv,nn=nn,results=results)
-        nn_dist(:,k) = results%dis
-        nn_tags(:,k) = results%idx
-    end do
-    
-    deallocate(results)
-    return
-
-end subroutine find_all_nn_nearest_neighbors
-
-subroutine find_chunk_nearest_neighbors()
-    ! for a chunk of the full number of particles, find their nearest neighbors
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-
-    integer :: k
-    type(kdtree2_result),allocatable :: results(:) ! nearest neighbors
-    allocate(results(nn))
-    do k=start,finish
-        qv(:) = pos(:,k)
-        call kdtree2_n_nearest(tp=tree2,qv=qv,nn=nn,results=results)
-        chunk_tags(:,k - start + 1) = results%idx
-
-    end do
-    
-    deallocate(results)
-    return
-
-end subroutine find_chunk_nearest_neighbors
-
-subroutine chainHOP_tags_dens()
-    ! for all particles in pos, find their nearest neighbors, and calculate
-    ! their density. Return only nMerge nearest neighbors.
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-
-    integer :: k, pj, i
-    real :: ih2, fNorm, r2, rs
-    integer, allocatable :: temp_tags(:)
-    real, allocatable :: temp_dist(:)
-    type(kdtree2_result),allocatable :: results(:) ! nearest neighbors
-    allocate(results(nn))
-    allocate(temp_tags(nn))
-    allocate(temp_dist(nn))
-    
-    do k=1,nparts
-        qv(:) = pos(:,k)
-        
-        call kdtree2_n_nearest(tp=tree2,qv=qv,nn=nn,results=results)
-        temp_tags(:) = results%idx
-        temp_dist(:) = results%dis
-        
-        ! calculate the density for this particle
-        ih2 = 4.0/maxval(results%dis)
-        fNorm = 0.5*sqrt(ih2)*ih2/3.1415926535897931
-        do i=1,nn
-            pj = temp_tags(i)
-            r2 = temp_dist(i) * ih2
-            rs = 2.0 - sqrt(r2)
-            if (r2 < 1.0) then
-                rs = (1.0 - 0.75*rs*r2)
-            else
-                rs = 0.25*rs*rs*rs
-            end if
-            rs = rs * fNorm
-            dens(k) = dens(k) + rs * mass(pj)
-            dens(pj) = dens(pj) + rs * mass(k)
-        end do
-
-        ! record only nMerge nearest neighbors, but skip the first one which
-        ! is always the self-same particle
-        ! nn_tags(:,k) = temp_tags(2:nMerge)
-    end do
-    
-    deallocate(results)
-    deallocate(temp_dist)
-    deallocate(temp_tags)
-    return
-
-end subroutine chainHOP_tags_dens
-
-subroutine free_tree(treeID)
-    use kdtree2_module
-    use fKD_module
-    use tree_setmodule
-    use kdtree2module
-    use tree_nodemodule
-    use intervalmodule
-
-    integer, intent (in), optional         :: treeID
-    
-    integer :: ID
-    
-    if (present(treeID)) then
-       ID = treeID
-    else
-       ID = -1
-    end if
-    
-    ! this releases memory for the tree BUT NOT THE ARRAY OF DATA YOU PASSED
-    ! TO MAKE THE TREE.  
-    if (ID == 1) then
-        call kdtree2_destroy(t1%tree2)
-    elseif (ID == 2) then
-        call kdtree2_destroy(t2%tree2)
-    else
-        call kdtree2_destroy(tree2)
-    end if
-    
-    ! The data to make the tree has to be deleted in python BEFORE calling
-    ! this!
-end subroutine free_tree
-

diff -r 36184fa50b21b4eda9f1532353fac7ecce90ed1e -r 50f4b65d410f0301a545468bdf7b92e660c415ca yt/utilities/kdtree/fKD.v
--- a/yt/utilities/kdtree/fKD.v
+++ /dev/null
@@ -1,139 +0,0 @@
-fKD
-
-****** fKD_module vars:
-t1 _tree_set
-t2 _tree_set
-# This contains the objects that any given kD tree might wish to use.
-# Not all of these are being used all the time, but they only take memory
-# if they're initialized in python.
-tags(:) _integer # particle ID tags
-dist(:) _real # interparticle spacings
-nn_tags(:,:) _integer # for all particles at once, [nth neighbor, index]
-chunk_tags(:,:) _integer # for finding only a chunk of the nearest neighbors
-nn_dist(:,:) _real 
-pos(3,:) _real
-dens(:) _real
-mass(:) _real
-qv(3) real
-qv_many(3,:) _real
-nparts integer
-nn integer
-nMerge integer # number of nearest neighbors used in chain merging
-start integer
-finish integer
-tree2 _kdtree2
-sort logical /.false./
-rearrange logical /.true./
-radius real # the unsquared radius for radius searches
-radius_n integer # the number of results to return
-nfound integer # number of neighbors within radius
-nfound_many(:) _integer # an array of number of neighbors within radius
-
-%%%% interval:
-lower real
-upper real
-#real(kdkind) :: lower,upper
-
-
-%%%% tree_node:
-# an internal tree node
-cut_dim integer
-#integer :: cut_dim
-# the dimension to cut
-cut_val real
-#real(kdkind) :: cut_val
-# where to cut the dimension
-cut_val_left real
-cut_val_right real
-#real(kdkind) :: cut_val_left, cut_val_right  
-# improved cutoffs knowing the spread in child boxes.
-u integer
-l integer
-#integer :: l, u
-left _tree_node
-right _tree_node
-#type(tree_node), pointer :: left, right
-box(:) _interval
-#type(interval), pointer :: box(:) => null()
-# child pointers
-# Points included in this node are indexes[k] with k \in [l,u] 
-
-
-%%%% kdtree2:
-# Global information about the tree, one per tree
-dimen integer /0/
-n integer /0/
-# dimensionality and total # of points
-the_data(:,:) _real
-#real(kdkind), pointer :: the_data(:,:) => null()
-# pointer to the actual data array 
-# 
-#  IMPORTANT NOTE:  IT IS DIMENSIONED   the_data(1:d,1:N)
-#  which may be opposite of what may be conventional.
-#  This is, because in Fortran, the memory layout is such that
-#  the first dimension is in sequential order.  Hence, with
-#  (1:d,1:N), all components of the vector will be in consecutive
-#  memory locations.  The search time is dominated by the
-#  evaluation of distances in the terminal nodes.  Putting all
-#  vector components in consecutive memory location improves
-#  memory cache locality, and hence search speed, and may enable 
-#  vectorization on some processors and compilers. 
-ind(:) _integer
-#integer, pointer :: ind(:) => null()
-# permuted index into the data, so that indexes[l..u] of some
-# bucket represent the indexes of the actual points in that
-# bucket.
-# do we always sort output results?
-sort logical /.false./
-#logical       :: sort = .false.
-rearrange logical /.false./
-#logical       :: rearrange = .false. 
-rearranged_data(:,:) _real
-#real(kdkind), pointer :: rearranged_data(:,:) => null()
-# if (rearrange .eqv. .true.) then rearranged_data has been
-# created so that rearranged_data(:,i) = the_data(:,ind(i)),
-# permitting search to use more cache-friendly rearranged_data, at
-# some initial computation and storage cost.
-root _tree_node
-#type(tree_node), pointer :: root => null()
-# root pointer of the tree
-
-
-%%%% tree_set:
-# This contains the objects that any given kD tree might wish to use.
-# Not all of these are being used all the time, but they only take memory
-# if they're initialized in python.
-tags(:) _integer # particle ID tags
-dist(:) _real # interparticle spacings
-nn_tags(:,:) _integer # for all particles at once, [nth neighbor, index]
-chunk_tags(:,:) _integer # for finding only a chunk of the nearest neighbors
-nn_dist(:,:) _real 
-pos(3,:) _real
-dens(:) _real
-mass(:) _real
-qv(3) real
-qv_many(3,:) _real
-nparts integer
-nn integer
-nMerge integer # number of nearest neighbors used in chain merging
-start integer
-finish integer
-tree2 _kdtree2
-sort logical /.false./
-rearrange logical /.true./
-radius real # the unsquared radius for radius searches
-radius_n integer # the number of results to return
-nfound integer # number of neighbors within radius
-nfound_many(:) _integer # an array of number of neighbors within radius
-
-***** Subroutines:
-find_nn_nearest_neighbors subroutine
-create_tree(treeID:integer) subroutine
-add_tree(treeID:integer) subroutine
-free_tree(treeID:integer) subroutine
-find_all_nn_nearest_neighbors subroutine
-find_r_nearest subroutine
-find_many_r_nearest(treeID:integer) subroutine
-find_many_nn_nearest_neighbors subroutine
-find_chunk_nearest_neighbors subroutine
-chainHOP_tags_dens subroutine

This diff is so big that we needed to truncate the remainder.

https://bitbucket.org/yt_analysis/yt/commits/b2403b6960cf/
Changeset:   b2403b6960cf
Branch:      yt-3.0
User:        chummels
Date:        2014-07-15 02:18:03
Summary:     Backing out changeset 36184fa.
Affected #:  2 files

diff -r 50f4b65d410f0301a545468bdf7b92e660c415ca -r b2403b6960cf90515d3149868a0fb816d139b22f yt/__init__.py
--- a/yt/__init__.py
+++ b/yt/__init__.py
@@ -76,6 +76,7 @@
 
 # First module imports
 import numpy as np # For modern purposes
+import numpy # In case anyone wishes to use it by name
 
 from yt.funcs import \
     iterable, \
@@ -161,9 +162,3 @@
 from yt.utilities.math_utils import \
     ortho_find, quartiles, periodic_position
 
-# The variable unparsed_args is not used internally but is provided
-# as a convenience for users who wish to parse arguments in scripts.
-# See http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-December/
-#     001727.html
-import startup_tasks as __startup_tasks
-unparsed_args = __startup_tasks.unparsed_args

diff -r 50f4b65d410f0301a545468bdf7b92e660c415ca -r b2403b6960cf90515d3149868a0fb816d139b22f yt/mods.py
--- a/yt/mods.py
+++ b/yt/mods.py
@@ -25,7 +25,12 @@
 
 # This next item will handle most of the actual startup procedures, but it will
 # also attempt to parse the command line and set up the global state of various
-# operations.  
+# operations.  The variable unparsed_args is not used internally but is
+# provided as a convenience for users who wish to parse arguments in scripts.
+# See http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-December/
+#     001727.html
+import yt.startup_tasks as __startup_tasks
+unparsed_args = __startup_tasks.unparsed_args
 
 from yt.config import ytcfg, ytcfg_defaults
 


https://bitbucket.org/yt_analysis/yt/commits/1aa734182dae/
Changeset:   1aa734182dae
Branch:      yt-3.0
User:        chummels
Date:        2014-07-16 00:21:13
Summary:     Updating surface_plot recipe to have aspect ratio fixed.
Affected #:  1 file

diff -r 50f4b65d410f0301a545468bdf7b92e660c415ca -r 1aa734182daef52162e0c2f0ef9c367b42d760f6 doc/source/cookbook/surface_plot.py
--- a/doc/source/cookbook/surface_plot.py
+++ b/doc/source/cookbook/surface_plot.py
@@ -1,6 +1,3 @@
-### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
-### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
-
 import yt
 import numpy as np
 from mpl_toolkits.mplot3d import Axes3D
@@ -28,8 +25,20 @@
 # Set the surface colors in the right scaling [0,1]
 p3dc.set_facecolors(colors[0,:,:]/255.)
 ax.add_collection(p3dc)
-ax.auto_scale_xyz(surface.vertices[0,:], surface.vertices[1,:], surface.vertices[2,:])
-ax.set_aspect(1.0)
+
+# We do this little magic to keep the axis ratio fixed in all directions
+# Take the maximum extent in one dimension and make it the bounds in all 
+# dimensions
+max_extent = np.max([np.max(surface.vertices[0,:]) - np.min(surface.vertices[0,:]), \
+                    np.max(surface.vertices[1,:]) - np.min(surface.vertices[1,:]), \
+                    np.max(surface.vertices[2,:]) - np.min(surface.vertices[2,:])])
+bounds = np.array([[np.mean(surface.vertices[0,:]) - max_extent/2,  \
+                    np.mean(surface.vertices[0,:]) + max_extent/2], \
+                   [np.mean(surface.vertices[1,:]) - max_extent/2,  \
+                    np.mean(surface.vertices[1,:]) + max_extent/2], \
+                   [np.mean(surface.vertices[2,:]) - max_extent/2,  \
+                    np.mean(surface.vertices[2,:]) + max_extent/2]])
+ax.auto_scale_xyz(bounds[0,:], bounds[1,:], bounds[2,:])
 
 # Save the figure
 plt.savefig("%s_Surface.png" % ds)


https://bitbucket.org/yt_analysis/yt/commits/2590ae9f41f4/
Changeset:   2590ae9f41f4
Branch:      yt-3.0
User:        chummels
Date:        2014-07-16 00:41:41
Summary:     Merging.
Affected #:  2 files

diff -r 1aa734182daef52162e0c2f0ef9c367b42d760f6 -r 2590ae9f41f42286fe718a85f69b5566814e2379 yt/__init__.py
--- a/yt/__init__.py
+++ b/yt/__init__.py
@@ -76,6 +76,7 @@
 
 # First module imports
 import numpy as np # For modern purposes
+import numpy # In case anyone wishes to use it by name
 
 from yt.funcs import \
     iterable, \
@@ -161,9 +162,3 @@
 from yt.utilities.math_utils import \
     ortho_find, quartiles, periodic_position
 
-# The variable unparsed_args is not used internally but is provided
-# as a convenience for users who wish to parse arguments in scripts.
-# See http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-December/
-#     001727.html
-import startup_tasks as __startup_tasks
-unparsed_args = __startup_tasks.unparsed_args

diff -r 1aa734182daef52162e0c2f0ef9c367b42d760f6 -r 2590ae9f41f42286fe718a85f69b5566814e2379 yt/mods.py
--- a/yt/mods.py
+++ b/yt/mods.py
@@ -25,7 +25,12 @@
 
 # This next item will handle most of the actual startup procedures, but it will
 # also attempt to parse the command line and set up the global state of various
-# operations.  
+# operations.  The variable unparsed_args is not used internally but is
+# provided as a convenience for users who wish to parse arguments in scripts.
+# See http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2011-December/
+#     001727.html
+import yt.startup_tasks as __startup_tasks
+unparsed_args = __startup_tasks.unparsed_args
 
 from yt.config import ytcfg, ytcfg_defaults
 


https://bitbucket.org/yt_analysis/yt/commits/84d5e141bf64/
Changeset:   84d5e141bf64
Branch:      yt-3.0
User:        chummels
Date:        2014-07-16 02:33:45
Summary:     Updating surface_plot.py recipe to be more efficient in calculating bounds of surface distribution.
Affected #:  1 file

diff -r 2590ae9f41f42286fe718a85f69b5566814e2379 -r 84d5e141bf6484ff8125b837ba185e535fff243d doc/source/cookbook/surface_plot.py
--- a/doc/source/cookbook/surface_plot.py
+++ b/doc/source/cookbook/surface_plot.py
@@ -26,18 +26,13 @@
 p3dc.set_facecolors(colors[0,:,:]/255.)
 ax.add_collection(p3dc)
 
-# We do this little magic to keep the axis ratio fixed in all directions
-# Take the maximum extent in one dimension and make it the bounds in all 
-# dimensions
-max_extent = np.max([np.max(surface.vertices[0,:]) - np.min(surface.vertices[0,:]), \
-                    np.max(surface.vertices[1,:]) - np.min(surface.vertices[1,:]), \
-                    np.max(surface.vertices[2,:]) - np.min(surface.vertices[2,:])])
-bounds = np.array([[np.mean(surface.vertices[0,:]) - max_extent/2,  \
-                    np.mean(surface.vertices[0,:]) + max_extent/2], \
-                   [np.mean(surface.vertices[1,:]) - max_extent/2,  \
-                    np.mean(surface.vertices[1,:]) + max_extent/2], \
-                   [np.mean(surface.vertices[2,:]) - max_extent/2,  \
-                    np.mean(surface.vertices[2,:]) + max_extent/2]])
+# Let's keep the axis ratio fixed in all directions by taking the maximum 
+# extent in one dimension and make it the bounds in all dimensions
+max_extent = (surface.vertices.max(axis=1) - surface.vertices.min(axis=1)).max()
+centers = (surface.vertices.max(axis=1) + surface.vertices.min(axis=1)) / 2
+bounds = np.zeros([3,2])
+bounds[:,0] = centers[:] - max_extent/2
+bounds[:,1] = centers[:] + max_extent/2
 ax.auto_scale_xyz(bounds[0,:], bounds[1,:], bounds[2,:])
 
 # Save the figure


https://bitbucket.org/yt_analysis/yt/commits/fe6b0d8e6f9c/
Changeset:   fe6b0d8e6f9c
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-07-16 15:05:25
Summary:     Merged in chummels/yt/yt-3.0 (pull request #1023)

Fix the surface_plot recipe
Affected #:  3 files

diff -r 15df3bd5cf753b0c981ff75210c860eceda5b3dc -r fe6b0d8e6f9c4aaefccaa556dab34b11f8a1fd33 doc/source/cookbook/surface_plot.py
--- a/doc/source/cookbook/surface_plot.py
+++ b/doc/source/cookbook/surface_plot.py
@@ -1,6 +1,3 @@
-### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
-### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
-
 import yt
 import numpy as np
 from mpl_toolkits.mplot3d import Axes3D
@@ -28,8 +25,15 @@
 # Set the surface colors in the right scaling [0,1]
 p3dc.set_facecolors(colors[0,:,:]/255.)
 ax.add_collection(p3dc)
-ax.auto_scale_xyz(surface.vertices[0,:], surface.vertices[1,:], surface.vertices[2,:])
-ax.set_aspect(1.0)
+
+# Let's keep the axis ratio fixed in all directions by taking the maximum 
+# extent in one dimension and make it the bounds in all dimensions
+max_extent = (surface.vertices.max(axis=1) - surface.vertices.min(axis=1)).max()
+centers = (surface.vertices.max(axis=1) + surface.vertices.min(axis=1)) / 2
+bounds = np.zeros([3,2])
+bounds[:,0] = centers[:] - max_extent/2
+bounds[:,1] = centers[:] + max_extent/2
+ax.auto_scale_xyz(bounds[0,:], bounds[1,:], bounds[2,:])
 
 # Save the figure
 plt.savefig("%s_Surface.png" % ds)

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list