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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jan 27 09:14:10 PST 2016


9 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/bf3fcb4db07c/
Changeset:   bf3fcb4db07c
Branch:      yt
User:        MatthewTurk
Date:        2016-01-22 21:54:26+00:00
Summary:     Linting Cython routines
Affected #:  6 files

diff -r fa3c48d195c1c97f8188ca46f9e2de70e0877b85 -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 doc/source/analyzing/_static/axes_calculator.pyx
--- a/doc/source/analyzing/_static/axes_calculator.pyx
+++ b/doc/source/analyzing/_static/axes_calculator.pyx
@@ -1,7 +1,7 @@
 import numpy as np
 cimport numpy as np
 cimport cython
-from stdlib cimport malloc, free
+from libc.stdlib cimport malloc, free
 
 cdef extern from "axes.h":
     ctypedef struct ParticleCollection:
@@ -16,7 +16,9 @@
 def examine_axes(np.ndarray[np.float64_t, ndim=1] xpos,
                  np.ndarray[np.float64_t, ndim=1] ypos,
                  np.ndarray[np.float64_t, ndim=1] zpos):
-    cdef double ax1[3], ax2[3], ax3[3]
+    cdef double ax1[3]
+    cdef double ax2[3]
+    cdef double ax3[3]
     cdef ParticleCollection particles
     cdef int i
 

diff -r fa3c48d195c1c97f8188ca46f9e2de70e0877b85 -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 yt/utilities/lib/alt_ray_tracers.pyx
--- a/yt/utilities/lib/alt_ray_tracers.pyx
+++ b/yt/utilities/lib/alt_ray_tracers.pyx
@@ -97,7 +97,7 @@
     """
     cdef int i, I
     cdef np.float64_t a, b, bsqrd, twoa
-    cdef np.ndarray[np.float64_t, ndim=1] dp, p1cart, p2cart, dpcart, t, s, \
+    cdef np.ndarray[np.float64_t, ndim=1] p1cart, p2cart, dpcart, t, s, \
                                           rleft, rright, zleft, zright, \
                                           cleft, cright, thetaleft, thetaright, \
                                           tmleft, tpleft, tmright, tpright, tsect
@@ -105,7 +105,6 @@
     cdef np.ndarray[np.float64_t, ndim=2] xyz, rztheta, ptemp, b1, b2, dsect
 
     # set up  points
-    dp = p2 - p1
     ptemp = np.array([p1, p2])
     ptemp = _cyl2cart(ptemp)
     p1cart = ptemp[0]

diff -r fa3c48d195c1c97f8188ca46f9e2de70e0877b85 -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 yt/utilities/lib/amr_kdtools.pyx
--- a/yt/utilities/lib/amr_kdtools.pyx
+++ b/yt/utilities/lib/amr_kdtools.pyx
@@ -277,7 +277,6 @@
                     int rank,
                     int size):
     cdef int i, j, nless, ngreater
-    cdef np.int64_t gid
     if not should_i_build(node, rank, size):
         return
 
@@ -468,7 +467,7 @@
                         np.uint8_t *less_ids,
                         np.uint8_t *greater_ids,
                        ):
-    cdef int i, j, k, dim, n_unique, best_dim, n_best, addit, my_split
+    cdef int i, j, k, dim, n_unique, best_dim, my_split
     cdef np.float64_t split
     cdef np.float64_t **uniquedims
     cdef np.float64_t *uniques
@@ -542,7 +541,7 @@
                        int rank,
                        int size):
     # Find a Split
-    cdef int i, j, k
+    cdef int i, j
 
     data = <np.float64_t ***> malloc(ngrids * sizeof(np.float64_t**))
     for i in range(ngrids):

diff -r fa3c48d195c1c97f8188ca46f9e2de70e0877b85 -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 yt/utilities/lib/basic_octree.pyx
--- a/yt/utilities/lib/basic_octree.pyx
+++ b/yt/utilities/lib/basic_octree.pyx
@@ -58,9 +58,8 @@
         self.max_level = imax(self.max_level, level)
 
 cdef void OTN_refine(OctreeNode *self, int incremental = 0):
-    cdef int i, j, k, i1, j1
+    cdef int i, j, k
     cdef np.int64_t npos[3]
-    cdef OctreeNode *node
     for i in range(2):
         npos[0] = self.pos[0] * 2 + i
         for j in range(2):
@@ -134,7 +133,6 @@
                   int nvals, int incremental = False):
         cdef int i, j, k
         self.incremental = incremental
-        cdef OctreeNode *node
         cdef np.int64_t pos[3]
         cdef np.float64_t *vals = <np.float64_t *> alloca(
                 sizeof(np.float64_t)*nvals)
@@ -231,7 +229,6 @@
     def get_all_from_level(self, int level, int count_only = 0):
         cdef int i, j, k
         cdef int total = 0
-        vals = []
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
                 for k in range(self.top_grid_dims[2]):
@@ -374,7 +371,6 @@
         # node in the list that is at the same or lower (coarser) level than
         # this node. This is useful in the treecode for skipping over nodes
         # that don't need to be inspected.
-        cdef int i, j, k
         cdef OctreeNode *initial_next
         cdef OctreeNode *temp_next
         initial_next = node.next
@@ -391,7 +387,6 @@
         # Set treecode = 1 if nodes with no mass are to be skipped in the
         # list.
         cdef int i, j, k, sum, top_grid_total, ii, jj, kk
-        cdef OctreeNode *this_node
         self.last_node = self.root_nodes[0][0][0]
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
@@ -429,9 +424,6 @@
         cdef np.float64_t angle, dist
         cdef OctreeNode *this_node
         cdef OctreeNode *pair_node
-        cdef int pair_count
-        cdef int to_break
-        to_break = 0
         this_node = self.root_nodes[0][0][0]
         while this_node is not NULL:
             # Iterate down the list to a node that either has no children and
@@ -499,7 +491,7 @@
         """
         # The real work is done in fbe_main(), this just sets things up
         # and returns the potential.
-        cdef int i, j, k, sum
+        cdef int i
         cdef np.float64_t potential
         potential = 0.0
         self.opening_angle = opening_angle

diff -r fa3c48d195c1c97f8188ca46f9e2de70e0877b85 -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 yt/utilities/lib/bitarray.pyx
--- a/yt/utilities/lib/bitarray.pyx
+++ b/yt/utilities/lib/bitarray.pyx
@@ -83,7 +83,7 @@
         arr : array, castable to uint8
             The array we set from.
         """
-        cdef np.uint64_t i, j, elem
+        cdef np.uint64_t i, j
         cdef np.uint8_t *btemp = self.buf
         arr = np.ascontiguousarray(arr)
         j = 0
@@ -108,7 +108,7 @@
             The uint8 values expanded into boolean values
 
         """
-        cdef np.uint64_t i, j, elem
+        cdef np.uint64_t i, j
         cdef np.uint8_t *btemp = self.buf
         cdef np.ndarray[np.uint8_t, ndim=1] output
         output = np.zeros(self.size, "uint8")

diff -r fa3c48d195c1c97f8188ca46f9e2de70e0877b85 -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 yt/utilities/lib/contour_finding.pyx
--- a/yt/utilities/lib/contour_finding.pyx
+++ b/yt/utilities/lib/contour_finding.pyx
@@ -199,7 +199,7 @@
         # This coalesces contour IDs, so that we have only the final name
         # resolutions -- the .join_id from a candidate.  So many items will map
         # to a single join_id.
-        cdef int i, j, k, ni, nj, nk, nc
+        cdef int i, ni, nc
         cdef CandidateContour *first = NULL
         cdef CandidateContour *temp
         cdef np.int64_t cid1, cid2
@@ -375,8 +375,8 @@
         pg = contours[node_ids[i]][2]
         vcs[i] = pg.container
     cdef np.ndarray[np.uint8_t] examined = np.zeros(n_nodes, "uint8")
-    for nid, cinfo in sorted(contours.items(), key = lambda a: -a[1][0]):
-        level, node_ind, pg, sl = cinfo
+    for _, cinfo in sorted(contours.items(), key = lambda a: -a[1][0]):
+        _, node_ind, pg, _ = cinfo
         construct_boundary_relationships(trunk, tree, node_ind,
             examined, vcs, node_ids)
         examined[node_ind] = 1
@@ -403,7 +403,7 @@
                 np.ndarray[np.int64_t, ndim=1] node_ids):
     # We only look at the boundary and find the nodes next to it.
     # Contours is a dict, keyed by the node.id.
-    cdef int i, j, off_i, off_j, oi, oj, level, ax, ax0, ax1, n1, n2
+    cdef int i, j, off_i, off_j, oi, oj, ax, ax0, ax1, n1, n2
     cdef np.int64_t c1, c2
     cdef Node adj_node
     cdef VolumeContainer *vc1
@@ -474,8 +474,7 @@
 def update_joins(np.ndarray[np.int64_t, ndim=2] joins,
                  np.ndarray[np.int64_t, ndim=3] contour_ids,
                  np.ndarray[np.int64_t, ndim=1] final_joins):
-    cdef np.int64_t new, old
-    cdef int i, j, nj, nf
+    cdef int j, nj, nf
     cdef int ci, cj, ck
     nj = joins.shape[0]
     nf = final_joins.shape[0]
@@ -530,9 +529,8 @@
         cdef Oct **neighbors = NULL
         cdef OctInfo oi
         cdef ContourID *c0
-        cdef ContourID *c1
         cdef np.int64_t moff = octree.get_domain_offset(domain_id + domain_offset)
-        cdef np.int64_t i, j, k, n, nneighbors, pind0, offset
+        cdef np.int64_t i, j, k, n, nneighbors = -1, pind0, offset
         cdef int counter = 0
         cdef int verbose = 0
         pcount = np.zeros_like(dom_ind)
@@ -540,7 +538,6 @@
         # First, we find the oct for each particle.
         pdoms = np.zeros(positions.shape[0], dtype="int64")
         pdoms -= -1
-        cdef np.int64_t *pdom = <np.int64_t*> pdoms.data
         # First we allocate our container
         cdef ContourID **container = <ContourID**> malloc(
             sizeof(ContourID*) * positions.shape[0])
@@ -572,7 +569,6 @@
         cdef np.int64_t *nind = <np.int64_t *> malloc(sizeof(np.int64_t)*nsize)
         counter = 0
         cdef np.int64_t frac = <np.int64_t> (doff.shape[0] / 20.0)
-        cdef int inside, skip_early
         if verbose == 1: print >> sys.stderr, "Will be outputting every", frac
         for i in range(doff.shape[0]):
             if verbose == 1 and counter >= frac:
@@ -658,7 +654,7 @@
         cdef ContourID *c0
         cdef ContourID *c1
         cdef np.int64_t pind1
-        cdef int i, j, k
+        cdef int i, j
         # We use pid here so that we strictly take new ones.
         # Note that pind0 will not monotonically increase, but
         c0 = container[pind0]
@@ -710,7 +706,6 @@
     cdef int i
     cdef np.float64_t r2, DR
     r2 = 0.0
-    cdef int inside = 0
     for i in range(3):
         if cpos[i] < edges[0][i]:
             return 0


https://bitbucket.org/yt_analysis/yt/commits/4d382da080fd/
Changeset:   4d382da080fd
Branch:      yt
User:        MatthewTurk
Date:        2016-01-22 22:39:58+00:00
Summary:     Continuing to lint
Affected #:  8 files

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/geometry/fake_octree.pyx
--- a/yt/geometry/fake_octree.pyx
+++ b/yt/geometry/fake_octree.pyx
@@ -60,7 +60,7 @@
     print "child", parent.file_ind, ind[0], ind[1], ind[2], cur_leaf, cur_level
     cdef int ddr[3]
     cdef int ii
-    cdef long i,j,k
+    cdef long i
     cdef float rf #random float from 0-1
     if cur_level >= max_level:
         return cur_leaf

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/geometry/grid_container.pyx
--- a/yt/geometry/grid_container.pyx
+++ b/yt/geometry/grid_container.pyx
@@ -163,7 +163,7 @@
                           SelectorObject selector):
         # This iterates over all root grids, given a selector+data, and then
         # visits each one and its children.
-        cdef int i, n
+        cdef int i
         # Because of confusion about mapping of children to parents, we are
         # going to do this the stupid way for now.
         cdef GridTreeNode *grid

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/utilities/lib/depth_first_octree.pyx
--- a/yt/utilities/lib/depth_first_octree.pyx
+++ b/yt/utilities/lib/depth_first_octree.pyx
@@ -61,8 +61,6 @@
     cdef int child_i, child_j, child_k
     cdef OctreeGrid child_grid
     cdef OctreeGrid grid = grids[gi]
-    cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
-    cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
     cdef np.float64_t dx = grid.dx[0]
@@ -118,7 +116,6 @@
     cdef OctreeGrid grid = grids[gi-1]
     cdef int level = grid.level
     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
-    cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
     cdef np.float64_t dx = grid.dx[0]
@@ -126,10 +123,10 @@
     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
     cdef np.float64_t cx, cy, cz
     cdef int cp
+    s = None
     for i_off in range(i_f):
         i = i_off + i_i
         cx = (leftedges[0] + i*dx)
-        if i_f > 2: print k, cz
         for j_off in range(j_f):
             j = j_off + j_i
             cy = (leftedges[1] + j*dx)

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/utilities/lib/element_mappings.pyx
--- a/yt/utilities/lib/element_mappings.pyx
+++ b/yt/utilities/lib/element_mappings.pyx
@@ -124,9 +124,6 @@
     cdef void map_real_to_unit(self, double* mapped_x, 
                                double* vertices, double* physical_x) nogil:
     
-        cdef int i
-        cdef double d
-        cdef double[3] bvec
         cdef double[3] col0
         cdef double[3] col1
         cdef double[3] col2
@@ -289,7 +286,7 @@
                                double* vertices,
                                double* physical_x) nogil:
         cdef int i
-        cdef double d, val
+        cdef double d
         cdef double[3] f 
         cdef double[3] r
         cdef double[3] s
@@ -471,7 +468,7 @@
                                double* vertices,
                                double* physical_x) nogil:
         cdef int i
-        cdef double d, val
+        cdef double d
         cdef double[2] f
         cdef double[2] x
         cdef double[4] A
@@ -566,8 +563,7 @@
                               double* x,
                               double* vertices,
                               double* phys_x) nogil:
-    cdef int i
-    cdef double rm, rp, sm, sp, tm, tp
+    cdef double rm, rp, sm, sp
 
     rm = 1.0 - x[0]
     rp = 1.0 + x[0]

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/utilities/lib/field_interpolation_tables.pxd
--- a/yt/utilities/lib/field_interpolation_tables.pxd
+++ b/yt/utilities/lib/field_interpolation_tables.pxd
@@ -56,7 +56,7 @@
 @cython.cdivision(True)
 cdef inline np.float64_t FIT_get_value(FieldInterpolationTable *fit,
                                        np.float64_t dvs[6]) nogil:
-    cdef np.float64_t bv, dy, dd, tf, rv
+    cdef np.float64_t bv, dy, dd
     cdef int bin_id
     if dvs[fit.field_id] >= fit.bounds[1] or dvs[fit.field_id] <= fit.bounds[0]: return 0.0
     if not isnormal(dvs[fit.field_id]): return 0.0
@@ -76,8 +76,8 @@
                             np.float64_t *rgba, int n_fits,
                             FieldInterpolationTable fits[6],
                             int field_table_ids[6], int grey_opacity) nogil:
-    cdef int i, fid, use
-    cdef np.float64_t ta, tf, ttot, dot_prod
+    cdef int i, fid
+    cdef np.float64_t ta
     cdef np.float64_t istorage[6]
     cdef np.float64_t trgba[6]
     for i in range(6): istorage[i] = 0.0
@@ -106,8 +106,8 @@
         np.float64_t *rgba, int n_fits,
         FieldInterpolationTable fits[6],
         int field_table_ids[6], int grey_opacity) nogil:
-    cdef int i, fid, use
-    cdef np.float64_t ta, tf, dot_prod
+    cdef int i, fid
+    cdef np.float64_t ta, dot_prod
     cdef np.float64_t istorage[6]
     cdef np.float64_t trgba[6]
     dot_prod = 0.0

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/utilities/lib/fortran_reader.pyx
--- a/yt/utilities/lib/fortran_reader.pyx
+++ b/yt/utilities/lib/fortran_reader.pyx
@@ -60,12 +60,12 @@
                    int nhydro_vars,
                    level_info):
     cdef int nchild = 8
-    cdef int i, Lev, next_record, nLevel
+    cdef int next_record = -1, nLevel = -1
     cdef int dummy_records[9]
-    cdef int readin
+    cdef int readin = -1
     cdef FILE *f = fopen(fn, "rb")
     fseek(f, offset, SEEK_SET)
-    for Lev in range(min_level + 1, max_level + 1):
+    for _ in range(min_level + 1, max_level + 1):
         fread(dummy_records, sizeof(int), 2, f);
         fread(&nLevel, sizeof(int), 1, f); FIX_LONG(nLevel)
         print level_info
@@ -101,24 +101,20 @@
     # nOct.  For those following along at home, we only need to read:
     #   iOctPr, iOctLv
     cdef int nchild = 8
-    cdef int i, Lev, cell_ind, iOct, nLevel, nLevCells, ic1
-    cdef np.int64_t next_record
+    cdef int iOct, nLevel, ic1
+    cdef np.int64_t next_record = -1
     cdef long long child_record
-    cdef int idc, cm
     cdef int iOctPs[3]
     cdef np.int64_t dummy_records[9]
-    cdef int readin
+    cdef int readin = -1
     cdef FILE *f = fopen(fn, "rb")
     fseek(f, offset, SEEK_SET)
-    cdef int Level
+    cdef int Level = -1
     cdef int * iNOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
     cdef int * iHOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
-    cell_ind = 0
-    cdef int total_cells = 0, total_masked
     cdef int iOctMax = 0
     level_offsets = [0]
-    idc = 0
-    for Lev in range(min_level + 1, max_level + 1):
+    for _ in range(min_level + 1, max_level + 1):
         fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
         fread(&Level, sizeof(int), 1, f); FIX_LONG(Level)
         fread(&iNOLL[Level], sizeof(int), 1, f); FIX_LONG(iNOLL[Level])
@@ -154,7 +150,6 @@
             fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
             assert readin==52
 
-        total_masked = 0
         level_offsets.append(ftell(f))
 
         #skip over the hydro variables
@@ -194,7 +189,7 @@
 
     cdef FILE *f = fopen(fn, "rb")
     cdef int j,l, cell_record_size = nhydro_vars * sizeof(float)
-    cdef float temp
+    cdef float temp = -1
     l=0
     fseek(f, root_grid_offset, SEEK_SET)
     # Now we seet out the cell we want
@@ -219,9 +214,9 @@
     # nhydro_vars is the number of columns- 3 (adjusting for vars)
     # this is normally 10=(8+2chem species)
     cdef int record_size = 2+1+1+nhydro_vars+2
-    cdef float temp
+    cdef float temp = -1.0
     cdef float varpad[2]
-    cdef int new_padding
+    cdef int new_padding = -1
     cdef int padding[3]
     cdef long offset = 8*grid_id*record_size*sizeof(float)
     fseek(f, level_offsets[grid_level] + offset, SEEK_SET)
@@ -251,7 +246,7 @@
               np.ndarray[np.float32_t, ndim=2] level_data,
               int level, int ref_factor,
               component_grid_info):
-    cdef int gi, i, j, k, domain, offset, grid_id
+    cdef int gi, i, j, k, grid_id
     cdef int ir, jr, kr
     cdef int offi, offj, offk, odind
     cdef np.int64_t di, dj, dk
@@ -267,8 +262,6 @@
         end_index[i] = start_index[i] + grid_dims[i]
     for gi in range(len(component_grid_info)):
         ogrid_info = component_grid_info[gi]
-        domain = ogrid_info[0]
-        #print "Loading", domain, ogrid_info
         grid_id = ogrid_info[1]
         og_start_index = ogrid_info[3:6] #the oct left edge
         for i in range(2*ref_factor):

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/utilities/lib/geometry_utils.pyx
--- a/yt/utilities/lib/geometry_utils.pyx
+++ b/yt/utilities/lib/geometry_utils.pyx
@@ -498,9 +498,8 @@
                              np.ndarray[np.float64_t, ndim=3] triangles):
     cdef np.float64_t p0[3]
     cdef np.float64_t p1[3]
-    cdef np.float64_t p2[3]
     cdef np.float64_t p3[3]
-    cdef int i, j, k, count, i0, i1, i2, ntri, nlines
+    cdef int i, j, k, count, ntri, nlines
     nlines = 0
     ntri = triangles.shape[0]
     cdef PointSet *first

diff -r bf3fcb4db07c1202d42d4bd202c64df5ed14aeb5 -r 4d382da080fd4e47f7caee95aef43e726ab3766c yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -289,7 +289,7 @@
             self.extent_function = calculate_extent_null
             self.vector_function = generate_vector_info_null
         self.sampler = NULL
-        cdef int i, j
+        cdef int i
         # These assignments are so we can track the objects and prevent their
         # de-allocation from reference counts.  Note that we do this to the
         # "atleast_3d" versions.  Also, note that we re-assign the input
@@ -319,8 +319,7 @@
         # This routine will iterate over all of the vectors and cast each in
         # turn.  Might benefit from a more sophisticated intersection check,
         # like http://courses.csusm.edu/cs697exz/ray_box.htm
-        cdef int vi, vj, hit, i, j, k, ni, nj, nn, xi, yi
-        cdef np.int64_t offset
+        cdef int vi, vj, hit, i, j
         cdef np.int64_t iter[4]
         cdef VolumeContainer *vc = pg.container
         cdef ImageContainer *im = self.image
@@ -328,7 +327,6 @@
         if self.sampler == NULL: raise RuntimeError
         cdef np.float64_t *v_pos
         cdef np.float64_t *v_dir
-        cdef np.float64_t rgba[6]
         cdef np.float64_t max_t
         hit = 0
         cdef np.int64_t nx, ny, size
@@ -342,7 +340,6 @@
         size = nx * ny
         cdef ImageAccumulator *idata
         cdef np.float64_t width[3]
-        cdef int use_vec, max_i
         for i in range(3):
             width[i] = self.width[i]
         with nogil, parallel(num_threads = num_threads):
@@ -421,7 +418,6 @@
     # we assume this has vertex-centered data.
     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
                     + index[1] * (vc.dims[2] + 1) + index[2]
-    cdef np.float64_t slopes[6]
     cdef np.float64_t dp[3]
     cdef np.float64_t ds[3]
     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
@@ -456,7 +452,6 @@
                   n_samples = 10, **kwargs):
         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
                                x_vec, y_vec, width, **kwargs)
-        cdef int i
         # Now we handle tf_obj
         self.vra = <VolumeRenderAccumulator *> \
             malloc(sizeof(VolumeRenderAccumulator))
@@ -487,7 +482,6 @@
                     + index[1] * (vc.dims[2]) + index[2]
     if vc.mask[cell_offset] != 1:
         return
-    cdef np.float64_t slopes[6]
     cdef np.float64_t dp[3]
     cdef np.float64_t ds[3]
     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
@@ -524,7 +518,6 @@
     # we assume this has vertex-centered data.
     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
                     + index[1] * (vc.dims[2] + 1) + index[2]
-    cdef np.float64_t slopes[6]
     cdef np.float64_t dp[3]
     cdef np.float64_t ds[3]
     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
@@ -562,7 +555,7 @@
                    np.ndarray[np.float64_t, ndim=1] pos_y,
                    np.ndarray[np.float64_t, ndim=1] pos_z,
                    np.ndarray[np.float64_t, ndim=2] star_colors):
-        cdef int i, n
+        cdef int i
         cdef np.float64_t *pointer = <np.float64_t *> star_colors.data
         for i in range(pos_x.shape[0]):
             kdtree_utils.kd_insert3(self.tree,
@@ -597,9 +590,10 @@
     cdef np.float64_t cell_left[3]
     cdef np.float64_t local_dds[3]
     cdef np.float64_t pos[3]
-    cdef int nstars, dti, i, j
+    cdef int nstars, i, j
     cdef np.float64_t *colors = NULL
     cdef np.float64_t gexp, gaussian, px, py, pz
+    px = py = pz = -1
     for i in range(3):
         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
@@ -628,7 +622,7 @@
                          vc.data[i] + offset)
         slopes[i] *= -1.0/vri.n_samples
         dvs[i] = temp
-    for dti in range(vri.n_samples):
+    for _ in range(vri.n_samples):
         # Now we add the contribution from stars
         kdtree_utils.kd_res_rewind(ballq)
         for i in range(nstars):
@@ -797,13 +791,13 @@
                      np.float64_t max_t = 1.0) nogil:
     cdef int cur_ind[3]
     cdef int step[3]
-    cdef int x, y, i, n, flat_ind, hit, direction
+    cdef int x, y, i, hit, direction
     cdef np.float64_t intersect_t = 1.1
     cdef np.float64_t iv_dir[3]
     cdef np.float64_t tmax[3]
     cdef np.float64_t tdelta[3]
-    cdef np.float64_t dist, alpha, dt, exit_t, enter_t = -1.0
-    cdef np.float64_t tr, tl, temp_x, temp_y, dv
+    cdef np.float64_t exit_t = -1.0, enter_t = -1.0
+    cdef np.float64_t tl, temp_x, temp_y = -1
     if max_t > 1.0: max_t = 1.0
     direction = -1
     if vc.left_edge[0] <= v_pos[0] and v_pos[0] <= vc.right_edge[0] and \
@@ -1089,7 +1083,7 @@
     # http://paulbourke.net/miscellaneous/domefisheye/fisheye/
     # ...but all in Cython.
     cdef np.ndarray[np.float64_t, ndim=3] vp
-    cdef int i, j, k
+    cdef int i, j
     cdef np.float64_t r, phi, theta, px, py
     cdef np.float64_t fov_rad = fov * np.pi / 180.0
     cdef int nx = resolution/nimx


https://bitbucket.org/yt_analysis/yt/commits/336c81a6c4f2/
Changeset:   336c81a6c4f2
Branch:      yt
User:        MatthewTurk
Date:        2016-01-22 22:43:33+00:00
Summary:     Continuing linting Cython.
Affected #:  8 files

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/geometry/grid_visitors.pyx
--- a/yt/geometry/grid_visitors.pyx
+++ b/yt/geometry/grid_visitors.pyx
@@ -40,9 +40,10 @@
     # positions for child masks.  This may not be considerably more efficient
     # memory-wise, but it is easier to keep and save when going through
     # multiple grids and selectors.
-    cdef int i, j, k
+    cdef int i, j
     cdef np.int64_t si, ei
-    cdef GridTreeNode *g, *c
+    cdef GridTreeNode *g
+    cdef GridTreeNode *c
     free_tuples(data)
     g = data.grid
     data.child_tuples = <int**> malloc(sizeof(int*) * g.num_children)
@@ -116,7 +117,6 @@
 cdef void ires_cells(GridVisitorData *data, np.uint8_t selected) nogil:
     # Fill with the level value.
     if selected == 0: return
-    cdef int i
     cdef np.int64_t *ires = <np.int64_t*> data.array
     ires[data.index] = data.grid.level
     data.index += 1

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/utilities/lib/image_utilities.pyx
--- a/yt/utilities/lib/image_utilities.pyx
+++ b/yt/utilities/lib/image_utilities.pyx
@@ -20,7 +20,7 @@
         np.ndarray[np.float64_t, ndim=1] px,
         np.ndarray[np.float64_t, ndim=1] py,
         np.ndarray[np.float64_t, ndim=1] pv):
-    cdef int i, j, k, pi
+    cdef int i, j, pi
     cdef int np = px.shape[0]
     cdef int xs = buffer.shape[0]
     cdef int ys = buffer.shape[1]
@@ -67,7 +67,6 @@
     cdef int npart = px.shape[0]
     cdef int xs = buffer.shape[0]
     cdef int ys = buffer.shape[1]
-    cdef int v
     #iv = iclip(<int>(pv * 255), 0, 255)
     for pi in range(npart):
         j = <int> (xs * px[pi])

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/utilities/lib/interpolators.pyx
--- a/yt/utilities/lib/interpolators.pyx
+++ b/yt/utilities/lib/interpolators.pyx
@@ -27,7 +27,7 @@
                            np.ndarray[np.int32_t, ndim=1] x_is,
                            np.ndarray[np.float64_t, ndim=1] output):
     cdef double x, xp, xm
-    cdef int i, x_i, y_i
+    cdef int i, x_i
     for i in range(x_vals.shape[0]):
         x_i = x_is[i]
         x = x_vals[i]
@@ -128,7 +128,7 @@
     cdef np.float64_t iids[3]
     cdef np.float64_t opos[3]
     cdef np.float64_t ropos[3]
-    cdef int i, j
+    cdef int i
     for i in range(3):
         temp = input_left[i] + (rf * (input_field.shape[i] - 1))
         ids[i] = (temp - input_left[i])/(input_field.shape[i]-1)

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/utilities/lib/line_integral_convolution.pyx
--- a/yt/utilities/lib/line_integral_convolution.pyx
+++ b/yt/utilities/lib/line_integral_convolution.pyx
@@ -67,8 +67,7 @@
         np.ndarray[double, ndim=1] kernel):
     cdef int i,j,l,x,y
     cdef int h,w,kernellen
-    cdef int t
-    cdef double fx, fy, tx, ty
+    cdef double fx, fy
     cdef np.ndarray[double, ndim=2] result
 
     w = vectors.shape[0]

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/utilities/lib/marching_cubes.pyx
--- a/yt/utilities/lib/marching_cubes.pyx
+++ b/yt/utilities/lib/marching_cubes.pyx
@@ -60,14 +60,12 @@
 cdef void FillTriangleValues(np.ndarray[np.float64_t, ndim=1] values,
                              Triangle *first, int nskip = 1):
     cdef Triangle *this = first
-    cdef Triangle *last
     cdef int i = 0
     cdef int j
     while this != NULL:
         for j in range(nskip):
             values[i*nskip + j] = this.val[j]
         i += 1
-        last = this
         this = this.next
 
 cdef void WipeTriangles(Triangle *first):
@@ -179,7 +177,7 @@
     cdef np.float64_t idds[3]
     cdef np.float64_t *intdata = NULL
     cdef np.float64_t *sdata = NULL
-    cdef np.float64_t x, y, z, do_sample
+    cdef np.float64_t do_sample
     cdef np.ndarray[np.float64_t, ndim=3] sample
     cdef np.ndarray[np.float64_t, ndim=1] sampled
     cdef TriangleCollection triangles
@@ -254,7 +252,7 @@
     if do_sample == 0:
         FillAndWipeTriangles(vertices, triangles.first)
         return vertices
-    cdef int nskip
+    cdef int nskip = 0
     if do_sample == 1:
         nskip = 1
     elif do_sample == 2:

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/utilities/lib/mesh_construction.pyx
--- a/yt/utilities/lib/mesh_construction.pyx
+++ b/yt/utilities/lib/mesh_construction.pyx
@@ -119,7 +119,7 @@
     cdef void _build_from_indices(self, YTEmbreeScene scene,
                                   np.ndarray vertices_in,
                                   np.ndarray indices_in):
-        cdef int i, j, ind
+        cdef int i, j
         cdef int nv = vertices_in.shape[0]
         cdef int ne = indices_in.shape[0]
         cdef int nt = self.tpe*ne
@@ -253,7 +253,6 @@
                                   np.ndarray vertices_in,
                                   np.ndarray indices_in):
         cdef int i, j, ind, idim
-        cdef int nv = vertices_in.shape[0]
         cdef int ne = indices_in.shape[0]
         cdef int npatch = 6*ne;
 

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/utilities/lib/mesh_samplers.pyx
--- a/yt/utilities/lib/mesh_samplers.pyx
+++ b/yt/utilities/lib/mesh_samplers.pyx
@@ -180,7 +180,7 @@
 @cython.cdivision(True)
 cdef void sample_element(void* userPtr,
                          rtcr.RTCRay& ray) nogil:
-    cdef int ray_id, elem_id, i
+    cdef int ray_id, elem_id
     cdef double val
     cdef MeshDataContainer* data
 

diff -r 4d382da080fd4e47f7caee95aef43e726ab3766c -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca yt/utilities/lib/mesh_traversal.pyx
--- a/yt/utilities/lib/mesh_traversal.pyx
+++ b/yt/utilities/lib/mesh_traversal.pyx
@@ -62,15 +62,11 @@
         '''
 
         rtcs.rtcCommit(scene.scene_i)
-        cdef int vi, vj, i, j, ni, nj, nn
-        cdef np.int64_t offset
+        cdef int vi, vj, i, j
         cdef ImageContainer *im = self.image
-        cdef np.int64_t elemID
-        cdef np.float64_t value
         cdef np.float64_t *v_pos
         cdef np.float64_t *v_dir
         cdef np.int64_t nx, ny, size
-        cdef np.float64_t px, py
         cdef np.float64_t width[3]
         for i in range(3):
             width[i] = self.width[i]


https://bitbucket.org/yt_analysis/yt/commits/02df086ccb30/
Changeset:   02df086ccb30
Branch:      yt
User:        MatthewTurk
Date:        2016-01-23 03:17:51+00:00
Summary:     Lint the misc_utilities module
Affected #:  1 file

diff -r 336c81a6c4f2042ba9a9d0bde81567bda1a112ca -r 02df086ccb3003c020e1b1394b580a88e23cee8c yt/utilities/lib/misc_utilities.pyx
--- a/yt/utilities/lib/misc_utilities.pyx
+++ b/yt/utilities/lib/misc_utilities.pyx
@@ -166,7 +166,6 @@
                   np.ndarray[np.float64_t, ndim=2] qresult,
                   np.ndarray[np.float64_t, ndim=2] used):
     cdef int n, bini, binj
-    cdef np.int64_t bin
     cdef np.float64_t wval, bval
     for n in range(bins_x.shape[0]):
         bini = bins_x[n]
@@ -195,7 +194,6 @@
                   np.ndarray[np.float64_t, ndim=3] qresult,
                   np.ndarray[np.float64_t, ndim=3] used):
     cdef int n, bini, binj, bink
-    cdef np.int64_t bin
     cdef np.float64_t wval, bval
     for n in range(bins_x.shape[0]):
         bini = bins_x[n]
@@ -228,7 +226,7 @@
     cdef int nl = xs.shape[0]
     cdef np.float64_t alpha[4]
     cdef np.float64_t outa
-    cdef int i, j
+    cdef int i, j, xi, yi
     cdef int dx, dy, sx, sy, e2, err
     cdef np.int64_t x0, x1, y0, y1
     cdef int has_alpha = (image.shape[2] == 4)
@@ -278,7 +276,7 @@
                             yi0 = yi
 
                         if no_color:
-                            image[xi, yi0, 0] = fmin(alpha[i], image[xi, yi0, 0])
+                            image[xi, yi0, 0] = fmin(alpha[0], image[xi, yi0, 0])
                         elif has_alpha:
                             image[xi, yi0, 3] = outa = alpha[3] + image[xi, yi0, 3]*(1-alpha[3])
                             if outa != 0.0:
@@ -322,13 +320,10 @@
     cdef int ny = image.shape[1]
     cdef int nl = xs.shape[0]
     cdef np.float64_t alpha[4]
-    cdef np.float64_t outa
     cdef int i, j
     cdef int dx, dy, sx, sy, e2, err
     cdef np.int64_t x0, x1, y0, y1, yi0
     cdef np.float64_t z0, z1, dzx, dzy
-    cdef int has_alpha = (image.shape[2] == 4)
-    cdef int no_color = (image.shape[2] < 3)
     for j in range(0, nl, 2):
         # From wikipedia http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
         x0 = xs[j]
@@ -362,7 +357,7 @@
             elif (y0 < thick and sy == -1): break
             elif (y0 >= ny-thick+1 and sy == 1): break
             if x0 >= thick and x0 < nx-thick and y0 >= thick and y0 < ny-thick:
-                for xi in range(x0-thick/2, x0+(1+thick)/2):
+                for _ in range(x0-thick/2, x0+(1+thick)/2):
                     for yi in range(y0-thick/2, y0+(1+thick)/2):
                         if flip:
                             yi0 = ny - yi
@@ -494,7 +489,7 @@
 def kdtree_get_choices(np.ndarray[np.float64_t, ndim=3] data,
                        np.ndarray[np.float64_t, ndim=1] l_corner,
                        np.ndarray[np.float64_t, ndim=1] r_corner):
-    cdef int i, j, k, dim, n_unique, best_dim, n_best, n_grids, addit, my_split
+    cdef int i, j, k, dim, n_unique, best_dim, n_grids, my_split
     n_grids = data.shape[0]
     cdef np.float64_t **uniquedims
     cdef np.float64_t *uniques
@@ -505,6 +500,7 @@
                 alloca(2*n_grids * sizeof(np.float64_t))
     my_max = 0
     best_dim = -1
+    my_split = -1
     for dim in range(3):
         n_unique = 0
         uniques = uniquedims[dim]
@@ -536,6 +532,8 @@
         #print "Setting tarr: ", i, uniquedims[best_dim][i]
         tarr[i] = uniquedims[best_dim][i]
     tarr.sort()
+    if my_split < 0:
+        raise RuntimeError
     split = tarr[my_split]
     cdef np.ndarray[np.uint8_t, ndim=1] less_ids = np.empty(n_grids, dtype='uint8')
     cdef np.ndarray[np.uint8_t, ndim=1] greater_ids = np.empty(n_grids, dtype='uint8')
@@ -784,7 +782,7 @@
                 np.int64_t refine_by = 2
                 ):
     cdef int i, n
-    cdef np.int64_t tot, oi, oj, ok, rf
+    cdef np.int64_t tot = 0, oi, oj, ok, rf
     cdef np.int64_t iind[3]
     cdef np.int64_t oind[3]
     cdef np.int64_t dim[3]
@@ -865,11 +863,22 @@
                       period = None,
                       int check_period = 1):
     cdef np.float64_t ds_period[3]
-    cdef np.float64_t box_dds[3], box_idds[3], width[3], LE[3], RE[3]
-    cdef np.int64_t i, j, k, p, xi, yi, ji
-    cdef np.int64_t dims[3], ld[3], ud[3]
+    cdef np.float64_t box_dds[3]
+    cdef np.float64_t box_idds[3]
+    cdef np.float64_t width[3]
+    cdef np.float64_t LE[3]
+    cdef np.float64_t RE[3]
+    cdef np.int64_t i, j, k, p, xi, yi
+    cdef np.int64_t dims[3]
+    cdef np.int64_t ld[3]
+    cdef np.int64_t ud[3]
     cdef np.float64_t overlap[3]
-    cdef np.float64_t dsp, osp[3], odsp[3], sp[3], lfd[3], ufd[3]
+    cdef np.float64_t dsp
+    cdef np.float64_t osp[3]
+    cdef np.float64_t odsp[3]
+    cdef np.float64_t sp[3]
+    cdef np.float64_t lfd[3]
+    cdef np.float64_t ufd[3]
     # These are the temp vars we get from the arrays
     # Some periodicity helpers
     cdef int diter[3][2]


https://bitbucket.org/yt_analysis/yt/commits/937741845c20/
Changeset:   937741845c20
Branch:      yt
User:        MatthewTurk
Date:        2016-01-23 03:42:36+00:00
Summary:     More linting
Affected #:  8 files

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/analysis_modules/halo_finding/rockstar/rockstar_groupies.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_groupies.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_groupies.pyx
@@ -373,8 +373,7 @@
         # Define fof object
 
         # Find number of particles
-        cdef np.int64_t i, j, k, ind, offset
-        cdef np.int64_t num_particles = pind.shape[0]
+        cdef np.int64_t i, j, k, ind
         global global_particles
 
         # Allocate space for correct number of particles

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
@@ -181,13 +181,8 @@
     cdef unsigned long long pi,fi,i
     cdef np.int64_t local_parts = 0
     ds = rh.ds = rh.tsl.next()
-    block = int(str(filename).rsplit(".")[-1])
-    n = rh.block_ratio
 
     SCALE_NOW = 1.0/(ds.current_redshift+1.0)
-    # Now we want to grab data from only a subset of the grids for each reader.
-    all_fields = set(ds.derived_field_list + ds.field_list)
-
     # First we need to find out how many this reader is going to read in
     # if the number of readers > 1.
     dd = ds.all_data()
@@ -265,7 +260,7 @@
         global FILENAME, FILE_FORMAT, NUM_SNAPS, STARTING_SNAP, h0, Ol, Om
         global BOX_SIZE, PERIODIC, PARTICLE_MASS, NUM_BLOCKS, NUM_READERS
         global FORK_READERS_FROM_WRITERS, PARALLEL_IO_WRITER_PORT, NUM_WRITERS
-        global rh, SCALE_NOW, OUTBASE, MIN_HALO_OUTPUT_SIZE
+        global rh, SCALE_NOW, OUTBASE, MIN_HALO_OUTPUT_SIZE, OUTPUT_FORMAT
         global OVERLAP_LENGTH, TOTAL_PARTICLES, FORCE_RES, RESTART_SNAP
         if force_res is not None:
             FORCE_RES=np.float64(force_res)

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/utilities/lib/particle_mesh_operations.pyx
--- a/yt/utilities/lib/particle_mesh_operations.pyx
+++ b/yt/utilities/lib/particle_mesh_operations.pyx
@@ -178,10 +178,9 @@
                               np.ndarray[np.float64_t, ndim=1] pos_y,
                               np.ndarray[np.float64_t, ndim=1] pos_z):
     cdef np.float64_t idds[3]
-    cdef np.float64_t pp[3]
     cdef int dims[3]
     cdef int ind[3]
-    cdef int i, j, npart
+    cdef int i, npart
     npart = pos_x.shape[0]
     cdef np.ndarray[np.float64_t, ndim=1] sample
     sample = np.zeros(npart, dtype='float64')
@@ -348,9 +347,8 @@
     #every particle we are fed, we can assume it exists on our grid
     #must fill in the grid_particle_count array
     #and particle_indices for every grid
-    cdef long i,j,level
+    cdef long i, j
     cdef long npart = pos_x.shape[0]
-    cdef long ncells = left_edges.shape[0]
     cdef np.ndarray[np.int32_t, ndim=1] assigned       = np.zeros(npart,dtype='int32')
     cdef np.ndarray[np.int32_t, ndim=1] never_assigned = np.ones(npart,dtype='int32')
     for i in np.unique(grid.child_index_mask):

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/utilities/lib/pixelization_routines.pyx
--- a/yt/utilities/lib/pixelization_routines.pyx
+++ b/yt/utilities/lib/pixelization_routines.pyx
@@ -62,15 +62,16 @@
     cdef np.float64_t x_min, x_max, y_min, y_max
     cdef np.float64_t period_x = 0.0, period_y = 0.0
     cdef np.float64_t width, height, px_dx, px_dy, ipx_dx, ipx_dy
-    cdef int nx, ny, ndx, ndy
     cdef int i, j, p, xi, yi
     cdef int lc, lr, rc, rr
     cdef np.float64_t lypx, rypx, lxpx, rxpx, overlap1, overlap2
     # These are the temp vars we get from the arrays
     cdef np.float64_t oxsp, oysp, xsp, ysp, dxsp, dysp, dsp
     # Some periodicity helpers
-    cdef int xiter[2], yiter[2]
-    cdef np.float64_t xiterv[2], yiterv[2]
+    cdef int xiter[2]
+    cdef int yiter[2]
+    cdef np.float64_t xiterv[2]
+    cdef np.float64_t yiterv[2]
     cdef np.ndarray[np.float64_t, ndim=2] my_array
     if period is not None:
         period_x = period[0]
@@ -290,8 +291,7 @@
     cdef np.ndarray[np.float64_t, ndim=2] img
     cdef int i, j, nf, fi
     cdef np.float64_t x, y, z, zb
-    cdef np.float64_t dx, dy, inside
-    cdef np.float64_t theta1, dtheta1, phi1, dphi1
+    cdef np.float64_t dx, dy
     cdef np.float64_t theta0, phi0, theta_p, dtheta_p, phi_p, dphi_p
     cdef np.float64_t PI = np.pi
     cdef np.float64_t s2 = math.sqrt(2.0)
@@ -310,6 +310,7 @@
     # through the theta, phi arrays, it should be faster.
     dx = 2.0 / (img.shape[0] - 1)
     dy = 2.0 / (img.shape[1] - 1)
+    x = y = 0
     for fi in range(nf):
         theta_p = (theta[fi] + theta_offset) - PI
         dtheta_p = dtheta[fi]
@@ -385,8 +386,13 @@
     # and the centroid.
     # So, let's compute these vectors.  See above where these are written out
     # for ease of use.
-    cdef np.float64_t vec1[3], vec2[3], cp_vec[3], dp, npoint[3]
-    cdef np.uint8_t faces[MAX_NUM_FACES][2][2], nf
+    cdef np.float64_t vec1[3]
+    cdef np.float64_t vec2[3]
+    cdef np.float64_t cp_vec[3]
+    cdef np.float64_t npoint[3]
+    cdef np.float64_t dp
+    cdef np.uint8_t faces[MAX_NUM_FACES][2][2]
+    cdef np.uint8_t nf
     if nvertices == 4:
         faces = tetra_face_defs
         nf = TETRA_NF
@@ -448,12 +454,17 @@
     # mapped coordinate system, and check whether the result in in-bounds or not
     # Note that we have to have a pseudo-3D pixel buffer.  One dimension will
     # always be 1.
-    cdef np.float64_t pLE[3], pRE[3]
-    cdef np.float64_t LE[3], RE[3]
+    cdef np.float64_t pLE[3]
+    cdef np.float64_t pRE[3]
+    cdef np.float64_t LE[3]
+    cdef np.float64_t RE[3]
     cdef int use
-    cdef np.int64_t n, i, j, k, pi, pj, pk, ci, cj, ck
-    cdef np.int64_t pstart[3], pend[3]
-    cdef np.float64_t ppoint[3], idds[3], dds[3]
+    cdef np.int64_t n, i, pi, pj, pk, ci, cj
+    cdef np.int64_t pstart[3]
+    cdef np.int64_t pend[3]
+    cdef np.float64_t ppoint[3]
+    cdef np.float64_t idds[3]
+    cdef np.float64_t dds[3]
     cdef np.float64_t *vertices
     cdef np.float64_t *field_vals
     cdef int nvertices = conn.shape[1]
@@ -479,9 +490,13 @@
     if ndim == 2:
         assert(buff_size[2] == 1)
     
+    ax = -1
     for i in range(3):
         if buff_size[i] == 1:
             ax = i
+    if ax == -1:
+        raise RuntimeError
+    xax = yax = -1
     if ax == 0:
         xax = 1
         yax = 2
@@ -491,6 +506,8 @@
     elif ax == 2:
         xax = 0
         yax = 1
+    if xax == -1 or yax == -1:
+        raise RuntimeError
 
     # allocate temporary storage
     num_mapped_coords = sampler.num_mapped_coords

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/utilities/lib/points_in_volume.pyx
--- a/yt/utilities/lib/points_in_volume.pyx
+++ b/yt/utilities/lib/points_in_volume.pyx
@@ -85,7 +85,7 @@
                    np.ndarray[np.int32_t, ndim=3] mask,
                    int break_first):
     cdef int n[3]
-    cdef i, j, k, ax
+    cdef i, j, k
     cdef np.float64_t rds[3][3]
     cdef np.float64_t cur_pos[3]
     cdef np.float64_t rorigin[3]
@@ -171,7 +171,6 @@
     cdef np.float64_t a_vec[3][3]
     cdef np.float64_t sep_ax[15][3]
     cdef np.float64_t sep_vec[3]
-    cdef np.float64_t norm
     cdef np.ndarray[np.int32_t, ndim=1] good = np.zeros(n, dtype='int32')
     cdef np.ndarray[np.float64_t, ndim=2] grid_centers
     # Fill in our axis unit vectors
@@ -225,7 +224,7 @@
     cdef np.int64_t gend[3]
     cdef np.int64_t dw[3]
     cdef np.int64_t cxi, cyi, czi, gxi, gyi, gzi, ci, cj, ck
-    cdef int i, total
+    cdef int i, total = 0
     for i in range(3):
         dw[i] = domain_width[i]
         cgstart[i] = cg_start_index[i]

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/utilities/lib/quad_tree.pyx
--- a/yt/utilities/lib/quad_tree.pyx
+++ b/yt/utilities/lib/quad_tree.pyx
@@ -56,9 +56,8 @@
     self.weight_val = 1.0
 
 cdef void QTN_refine(QuadTreeNode *self, int nvals):
-    cdef int i, j, i1, j1
+    cdef int i, j
     cdef np.int64_t npos[2]
-    cdef QuadTreeNode *node
     cdef np.float64_t *tvals = <np.float64_t *> alloca(
             sizeof(np.float64_t) * nvals)
     for i in range(nvals): tvals[i] = 0.0
@@ -120,7 +119,6 @@
         self.merged = 1
         self.max_level = 0
         cdef int i, j
-        cdef QuadTreeNode *node
         cdef np.int64_t pos[2]
         cdef np.float64_t *vals = <np.float64_t *> malloc(
                 sizeof(np.float64_t)*nvals)
@@ -213,7 +211,6 @@
         elif method == "integrate" or method == 1:
             self.merged = 1
         cdef int curpos = 0
-        cdef QuadTreeNode *root
         self.num_cells = wval.shape[0]
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
@@ -255,7 +252,6 @@
             return -1
         if level > self.max_level:
             self.max_level = level
-        cdef np.int64_t fac
         for L in range(level):
             if node.children[0][0] == NULL:
                 QTN_refine(node, self.nvals)
@@ -332,7 +328,6 @@
             np.ndarray[np.int64_t, ndim=1] level):
         cdef int num = pxs.shape[0]
         cdef int p, rv
-        cdef np.float64_t *vals
         cdef np.int64_t pos[2]
         for p in range(num):
             pos[0] = pxs[p]
@@ -350,7 +345,6 @@
     def get_all(self, int count_only = 0, int method = 1):
         cdef int i, j, vi
         cdef int total = 0
-        vals = []
         self.merged = method
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
@@ -461,8 +455,9 @@
         cdef np.float64_t dds[2]
         cdef int nn[2]
         cdef int i, j
-        cdef np.float64_t bounds[4], opos[4]
-        cdef np.float64_t weight, value = 0.0
+        cdef np.float64_t bounds[4]
+        cdef np.float64_t opos[4]
+        cdef np.float64_t weight = 0.0, value = 0.0
         cdef np.float64_t *wval = NULL
         if weighted == 1:
             wval = &weight
@@ -471,7 +466,6 @@
         for i in range(2):
             nn[i] = buffer.shape[i]
             dds[i] = (bounds[i*2 + 1] - bounds[i*2])/nn[i]
-        cdef QuadTreeNode *node
         pos[0] = bounds[0]
         opos[0] = opos[1] = pos[0] + dds[0]
         for i in range(nn[0]):

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/utilities/lib/ragged_arrays.pyx
--- a/yt/utilities/lib/ragged_arrays.pyx
+++ b/yt/utilities/lib/ragged_arrays.pyx
@@ -84,12 +84,12 @@
         func = r_min
     else:
         raise NotImplementedError
-    cdef np.int64_t i, j, ind_ind, ind_arr
+    cdef np.int64_t i, ind_ind, ind_arr
     ind_ind = 0
     for i in range(sizes.size):
         # Each entry in sizes is the size of the array
         val = ival
-        for j in range(sizes[i]):
+        for _ in range(sizes[i]):
             ind_arr = indices[ind_ind]
             val = func(val, values[ind_arr])
             ind_ind += 1

diff -r 02df086ccb3003c020e1b1394b580a88e23cee8c -r 937741845c205265f74443c3cc3e8fce4df63db7 yt/utilities/lib/ray_integrators.pyx
--- a/yt/utilities/lib/ray_integrators.pyx
+++ b/yt/utilities/lib/ray_integrators.pyx
@@ -40,7 +40,7 @@
     """
     cdef int i, ii
     cdef int j, jj
-    cdef int k, kk
+    cdef int k
     cdef int n, nn
     nn = o_s.shape[3] # This might be slow
     cdef np.float64_t *temp = <np.float64_t *>malloc(sizeof(np.float64_t) * nn)
@@ -127,7 +127,7 @@
     # Find the first place the ray hits the grid on its path
     # Do left edge then right edge in each dim
     cdef int i, x, y
-    cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance
+    cdef np.float64_t tl, tr, intersect_t, enter_t
     cdef np.float64_t iv_dir[3]
     cdef np.float64_t tdelta[3]
     cdef np.float64_t tmax[3]
@@ -236,8 +236,7 @@
     # We're roughly following Amanatides & Woo on a ray-by-ray basis
     # Note that for now it's just shells, but this can and should be
     # generalized to transfer functions
-    cdef int i, x, y, vi
-    intersect_t = 1
+    cdef int i, vi
     dt_tolerance = 1e-6
     cdef int nv = ug.shape[0]
     cdef int nshells = shells.shape[0]
@@ -262,17 +261,14 @@
     cdef int x, y, i, n
     cdef int step[3]
     cdef np.float64_t intersect_t = 1
-    cdef np.float64_t dt_tolerance = 1e-6
-    cdef np.float64_t tl, tr, enter_t, exit_t
+    cdef np.float64_t tl, tr, enter_t
     cdef np.int64_t cur_ind[3]
     cdef np.float64_t tdelta[3]
     cdef np.float64_t tmax[3]
     cdef np.float64_t intersect[3]
-    cdef np.float64_t dt, dv
+    cdef np.float64_t dv
     cdef np.float64_t dist, alpha
-    cdef np.float64_t one = 1.0
     cdef int dims[3]
-    cdef np.float64_t rgba[4]
     cdef np.float64_t temp_x, temp_y
     for i in range(3):
         # As long as we're iterating, set some other stuff, too
@@ -305,7 +301,6 @@
         return
     # Now get the indices of the intersection
     for i in range(3): intersect[i] = u[i] + intersect_t * v[i]
-    cdef int ncells = 0
     for i in range(3):
         cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i])
         tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i]


https://bitbucket.org/yt_analysis/yt/commits/ca9caedfc0ff/
Changeset:   ca9caedfc0ff
Branch:      yt
User:        MatthewTurk
Date:        2016-01-23 03:47:17+00:00
Summary:     Linting selection routines
Affected #:  1 file

diff -r 937741845c205265f74443c3cc3e8fce4df63db7 -r ca9caedfc0ffdfa724116249b1e62dc889c684ec yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -191,9 +191,8 @@
         cdef np.float64_t RE[3]
         cdef np.float64_t sdds[3]
         cdef np.float64_t spos[3]
-        cdef int i, j, k, res, mi
+        cdef int i, j, k, res
         cdef Oct *ch
-        cdef np.uint8_t selected
         # Remember that pos is the *center* of the oct, and dds is the oct
         # width.  So to get to the edges, we add/subtract half of dds.
         for i in range(3):
@@ -359,7 +358,6 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     def fill_mesh_mask(self, mesh):
-        cdef int dim[3]
         cdef np.float64_t pos[3]
         cdef np.ndarray[np.int64_t, ndim=2] indices
         cdef np.ndarray[np.float64_t, ndim=2] coords
@@ -388,7 +386,6 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     def fill_mesh_cell_mask(self, mesh):
-        cdef int dim[3]
         cdef np.float64_t pos
         cdef np.float64_t le[3]
         cdef np.float64_t re[3]
@@ -434,7 +431,7 @@
         cdef np.ndarray[np.float64_t, ndim=1] odds = gobj.dds.d
         cdef np.ndarray[np.float64_t, ndim=1] oleft_edge = gobj.LeftEdge.d
         cdef np.ndarray[np.float64_t, ndim=1] oright_edge = gobj.RightEdge.d
-        cdef int i, j, k
+        cdef int i
         cdef np.float64_t dds[3]
         cdef np.float64_t left_edge[3]
         cdef np.float64_t right_edge[3]
@@ -495,10 +492,11 @@
         # aspect of which is the .grid attribute, along with index values and
         # void* pointers to arrays) and a possibly-pre-generated cached mask.
         # Each cell is visited with the grid visitor function.
-        cdef np.float64_t left_edge[3], right_edge[3]
+        cdef np.float64_t left_edge[3]
+        cdef np.float64_t right_edge[3]
         cdef np.float64_t dds[3]
-        cdef int dim[3], level, i
-        cdef int total = 0, this_level = 0
+        cdef int dim[3]
+        cdef int this_level = 0, level, i
         cdef np.float64_t pos[3]
         level = data.grid.level
         if level < self.min_level or level > self.max_level:
@@ -680,7 +678,6 @@
     @cython.cdivision(True)
     cdef int select_bbox(self, np.float64_t left_edge[3],
                                np.float64_t right_edge[3]) nogil:
-        cdef int i
         # point definitely can only be in one cell
         if (left_edge[0] <= self.p[0] < right_edge[0] and
             left_edge[1] <= self.p[1] < right_edge[1] and
@@ -710,8 +707,6 @@
         self.radius = _ensure_code(dobj.radius)
         self.radius2 = self.radius * self.radius
         center = _ensure_code(dobj.center)
-        cdef np.float64_t mi = np.finfo("float64").min
-        cdef np.float64_t ma = np.finfo("float64").max
         for i in range(3):
             self.center[i] = center[i]
             self.bbox[i][0] = self.center[i] - self.radius
@@ -869,8 +864,7 @@
     @cython.cdivision(True)
     cdef int select_bbox(self, np.float64_t left_edge[3],
                                np.float64_t right_edge[3]) nogil:
-        cdef int i, shift, included
-        cdef np.float64_t LE, RE
+        cdef int i
         for i in range(3):
             if (right_edge[i] < self.left_edge[i] and \
                 left_edge[i] >= self.right_edge_shift[i]) or \
@@ -882,7 +876,8 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     cdef int select_cell(self, np.float64_t pos[3], np.float64_t dds[3]) nogil:
-        cdef np.float64_t left_edge[3], right_edge[3]
+        cdef np.float64_t left_edge[3]
+        cdef np.float64_t right_edge[3]
         cdef int i
         if self.loose_selection:
             for i in range(3):
@@ -971,8 +966,8 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     cdef int select_point(self, np.float64_t pos[3]) nogil:
-        cdef np.float64_t h, d, r2, temp, spos
-        cdef int i, j, k
+        cdef np.float64_t h, d, r2, temp
+        cdef int i
         h = d = 0
         for i in range(3):
             temp = self.difference(pos[i], self.center[i], i)
@@ -1149,8 +1144,8 @@
         self.axis = dobj.axis
         self.coord = _ensure_code(dobj.coord)
 
-        ax = (self.axis+1) % 3
-        ay = (self.axis+2) % 3
+        self.ax = (self.axis+1) % 3
+        self.ay = (self.axis+2) % 3
 
     @cython.boundscheck(False)
     @cython.wraparound(False)
@@ -1467,7 +1462,6 @@
         if nv != 8:
             raise NotImplementedError
         cdef VolumeContainer vc
-        cdef int selected
         child_mask = np.ones((1,1,1), dtype="uint8")
         t = np.zeros((1,1,1), dtype="float64")
         dt = np.zeros((1,1,1), dtype="float64") - 1
@@ -1578,7 +1572,7 @@
                      np.ndarray[np.float64_t, ndim=2] left_edges,
                      np.ndarray[np.float64_t, ndim=2] right_edges,
                      np.ndarray[np.int32_t, ndim=2] levels):
-        cdef int i, n
+        cdef int n
         cdef int ng = left_edges.shape[0]
         cdef np.ndarray[np.uint8_t, ndim=1] gridi = np.zeros(ng, dtype='uint8')
         cdef np.ndarray[np.int64_t, ndim=1] oids = self.obj_ids


https://bitbucket.org/yt_analysis/yt/commits/2efe32fea809/
Changeset:   2efe32fea809
Branch:      yt
User:        MatthewTurk
Date:        2016-01-23 03:50:33+00:00
Summary:     Linting remaining files
Affected #:  1 file

diff -r ca9caedfc0ffdfa724116249b1e62dc889c684ec -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 yt/utilities/lib/ray_integrators.pyx
--- a/yt/utilities/lib/ray_integrators.pyx
+++ b/yt/utilities/lib/ray_integrators.pyx
@@ -52,7 +52,6 @@
             for n in range(nn):
                 temp[n] = i_s[ii,jj,n]
             for k in range(kmax-kmin):
-                kk = k + kmin#*kstride, which doesn't make any sense
                 for n in range(nn):
                     o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n])
                     temp[n] = o_s[i,j,k,n]
@@ -135,7 +134,6 @@
     cdef np.int64_t cur_ind[3]
     cdef np.int64_t step[3]
     intersect_t = 1
-    dt_tolerance = 1e-6
     # recall p = v * t + u
     #  where p is position, v is our vector, u is the start point
     for i in range(3):
@@ -237,7 +235,6 @@
     # Note that for now it's just shells, but this can and should be
     # generalized to transfer functions
     cdef int i, vi
-    dt_tolerance = 1e-6
     cdef int nv = ug.shape[0]
     cdef int nshells = shells.shape[0]
     cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64)


https://bitbucket.org/yt_analysis/yt/commits/e6b1c07426d5/
Changeset:   e6b1c07426d5
Branch:      yt
User:        MatthewTurk
Date:        2016-01-23 03:50:58+00:00
Summary:     Merging from upstream
Affected #:  42 files

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -1452,7 +1452,9 @@
 .. note::
    PyX must be installed, which can be accomplished either manually
    with ``pip install pyx`` or with the install script by setting
-   ``INST_PYX=1``.
+   ``INST_PYX=1``. If you are using python2, you must install pyx
+   version 0.12.1 with ``pip install pyx==0.12.1``, since that is 
+   the last version with python2 support.
 
 This module can take any of the plots mentioned above and create an
 EPS or PDF figure.  For example,
@@ -1499,3 +1501,31 @@
 margin, but it can be overridden by providing the keyword
 ``cb_location`` with a dict of either ``right, left, top, bottom``
 with the fields as the keys.
+
+You can also combine slices, projections, and phase plots. Here is
+an example that includes slices and phase plots:
+
+.. code-block:: python
+
+    from yt import SlicePlot, PhasePlot
+    from yt.visualization.eps_writer import multiplot_yt
+   
+    ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+
+    p1 = SlicePlot(ds, 0, 'density')
+    p1.set_width(10, 'kpc')
+   
+    p2 = SlicePlot(ds, 0, 'temperature')
+    p2.set_width(10, 'kpc')
+    p2.set_cmap('temperature', 'hot')
+
+    sph = ds.sphere(ds.domain_center, (10, 'kpc'))
+    p3 = PhasePlot(sph, 'radius', 'density', 'temperature',
+                   weight_field='cell_mass')
+
+    p4 = PhasePlot(sph, 'radius', 'density', 'pressure', 'cell_mass')
+
+    mp = multiplot_yt(2, 2, [p1, p2, p3, p4], savefig="yt", shrink_cb=0.9,
+                      bare_axes=False, yt_nocbar=False, margins=(0.5,0.5))
+
+    mp.save_fig('multi_slice_phase')

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/analysis_modules/sunyaev_zeldovich/projection.py
--- a/yt/analysis_modules/sunyaev_zeldovich/projection.py
+++ b/yt/analysis_modules/sunyaev_zeldovich/projection.py
@@ -19,7 +19,7 @@
 #-----------------------------------------------------------------------------
 
 from yt.utilities.physical_constants import sigma_thompson, clight, hcgs, kboltz, mh, Tcmb
-from yt.funcs import fix_axis, mylog, get_pbar
+from yt.funcs import fix_axis, get_pbar
 from yt.visualization.volume_rendering.off_axis_projection import \
     off_axis_projection
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
@@ -251,8 +251,8 @@
             less notable when the transfer function is smooth and
             broad. Default: True
         source : yt.data_objects.data_containers.YTSelectionContainer, optional
-            If specified, this will be the data source used for selecting regions to project.
-            Currently unsupported in yt 2.x.
+            If specified, this will be the data source used for selecting regions 
+            to project.
 
         Examples
         --------
@@ -264,30 +264,29 @@
         ctr, dctr = self.ds.coordinates.sanitize_center(center, L)
         res = (nx, nx)
 
-        if source is not None:
-            mylog.error("Source argument is not currently supported for off-axis S-Z projections.")
-            raise NotImplementedError
+        if source is None:
+            source = self.ds
 
         beta_par = generate_beta_par(L)
         self.ds.add_field(("gas","beta_par"), function=beta_par, units="g/cm**3")
         setup_sunyaev_zeldovich_fields(self.ds)
 
-        dens = off_axis_projection(self.ds, ctr, L, w, res, "density",
+        dens = off_axis_projection(source, ctr, L, w, res, "density",
                                    north_vector=north_vector, no_ghost=no_ghost)
-        Te = off_axis_projection(self.ds, ctr, L, w, res, "t_sz",
+        Te = off_axis_projection(source, ctr, L, w, res, "t_sz",
                                  north_vector=north_vector, no_ghost=no_ghost)/dens
-        bpar = off_axis_projection(self.ds, ctr, L, w, res, "beta_par",
+        bpar = off_axis_projection(source, ctr, L, w, res, "beta_par",
                                    north_vector=north_vector, no_ghost=no_ghost)/dens
-        omega1 = off_axis_projection(self.ds, ctr, L, w, res, "t_squared",
+        omega1 = off_axis_projection(source, ctr, L, w, res, "t_squared",
                                      north_vector=north_vector, no_ghost=no_ghost)/dens
         omega1 = omega1/(Te*Te) - 1.
         if self.high_order:
-            bperp2 = off_axis_projection(self.ds, ctr, L, w, res, "beta_perp_squared", 
+            bperp2 = off_axis_projection(source, ctr, L, w, res, "beta_perp_squared", 
                                          north_vector=north_vector, no_ghost=no_ghost)/dens
-            sigma1 = off_axis_projection(self.ds, ctr, L, w, res, "t_beta_par", 
+            sigma1 = off_axis_projection(source, ctr, L, w, res, "t_beta_par", 
                                          north_vector=north_vector, no_ghost=no_ghost)/dens
             sigma1 = sigma1/Te - bpar
-            kappa1 = off_axis_projection(self.ds, ctr, L, w, res, "beta_par_squared", 
+            kappa1 = off_axis_projection(source, ctr, L, w, res, "beta_par_squared", 
                                          north_vector=north_vector, no_ghost=no_ghost)/dens
             kappa1 -= bpar
         else:

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -293,6 +293,22 @@
     def _is_valid(cls, *args, **kwargs):
         return False
 
+    @classmethod
+    def _guess_candidates(cls, base, directories, files):
+        """
+        This is a class method that accepts a directory (base), a list of files
+        in that directory, and a list of subdirectories.  It should return a
+        list of filenames (defined relative to the supplied directory) and a
+        boolean as to whether or not further directories should be recursed.
+        
+        This function doesn't need to catch all possibilities, nor does it need
+        to filter possibilities.
+        """
+        return [], True
+
+    def close(self):
+        pass
+
     def __getitem__(self, key):
         """ Returns units, parameters, or conversion_factors in that order. """
         return self.parameters[key]

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/progressbar.py
--- a/yt/extern/progressbar.py
+++ /dev/null
@@ -1,370 +0,0 @@
-#!/usr/bin/python
-# -*- coding: iso-8859-1 -*-
-#
-# progressbar  - Text progressbar library for python.
-# Copyright (c) 2005 Nilton Volpato
-# 
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# 
-# This library 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
-# Lesser General Public License for more details.
-# 
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-
-"""Text progressbar library for python.
-
-This library provides a text mode progressbar. This is tipically used
-to display the progress of a long running operation, providing a
-visual clue that processing is underway.
-
-The ProgressBar class manages the progress, and the format of the line
-is given by a number of widgets. A widget is an object that may
-display diferently depending on the state of the progress. There are
-three types of widget:
-- a string, which always shows itself;
-- a ProgressBarWidget, which may return a diferent value every time
-it's update method is called; and
-- a ProgressBarWidgetHFill, which is like ProgressBarWidget, except it
-expands to fill the remaining width of the line.
-
-The progressbar module is very easy to use, yet very powerful. And
-automatically supports features like auto-resizing when available.
-"""
-from __future__ import print_function
-
-__author__ = "Nilton Volpato"
-__author_email__ = "first-name dot last-name @ gmail.com"
-__date__ = "2006-05-07"
-__version__ = "2.2"
-
-# Changelog
-#
-# 2006-05-07: v2.2 fixed bug in windows
-# 2005-12-04: v2.1 autodetect terminal width, added start method
-# 2005-12-04: v2.0 everything is now a widget (wow!)
-# 2005-12-03: v1.0 rewrite using widgets
-# 2005-06-02: v0.5 rewrite
-# 2004-??-??: v0.1 first version
-
-
-from yt.extern.six import string_types
-import sys, time
-from array import array
-try:
-    from fcntl import ioctl
-    import termios
-except ImportError:
-    pass
-import signal
-
-class ProgressBarWidget(object):
-    """This is an element of ProgressBar formatting.
-
-    The ProgressBar object will call it's update value when an update
-    is needed. It's size may change between call, but the results will
-    not be good if the size changes drastically and repeatedly.
-    """
-    def update(self, pbar):
-        """Returns the string representing the widget.
-
-        The parameter pbar is a reference to the calling ProgressBar,
-        where one can access attributes of the class for knowing how
-        the update must be made.
-
-        At least this function must be overriden."""
-        pass
-
-class ProgressBarWidgetHFill(object):
-    """This is a variable width element of ProgressBar formatting.
-
-    The ProgressBar object will call it's update value, informing the
-    width this object must the made. This is like TeX \\hfill, it will
-    expand to fill the line. You can use more than one in the same
-    line, and they will all have the same width, and together will
-    fill the line.
-    """
-    def update(self, pbar, width):
-        """Returns the string representing the widget.
-
-        The parameter pbar is a reference to the calling ProgressBar,
-        where one can access attributes of the class for knowing how
-        the update must be made. The parameter width is the total
-        horizontal width the widget must have.
-
-        At least this function must be overriden."""
-        pass
-
-
-class ETA(ProgressBarWidget):
-    "Widget for the Estimated Time of Arrival"
-    def format_time(self, seconds):
-        return time.strftime('%H:%M:%S', time.gmtime(seconds))
-    def update(self, pbar):
-        if pbar.currval == 0:
-            return 'ETA:  --:--:--'
-        elif pbar.finished:
-            return 'Time: %s' % self.format_time(pbar.seconds_elapsed)
-        else:
-            elapsed = pbar.seconds_elapsed
-            eta = elapsed * pbar.maxval / pbar.currval - elapsed
-            return 'ETA:  %s' % self.format_time(eta)
-
-class FileTransferSpeed(ProgressBarWidget):
-    "Widget for showing the transfer speed (useful for file transfers)."
-    def __init__(self):
-        self.fmt = '%6.2f %s'
-        self.units = ['B','K','M','G','T','P']
-    def update(self, pbar):
-        if pbar.seconds_elapsed < 2e-6:#== 0:
-            bps = 0.0
-        else:
-            bps = float(pbar.currval) / pbar.seconds_elapsed
-        spd = bps
-        for u in self.units:
-            if spd < 1000:
-                break
-            spd /= 1000
-        return self.fmt % (spd, u+'/s')
-
-class RotatingMarker(ProgressBarWidget):
-    "A rotating marker for filling the bar of progress."
-    def __init__(self, markers='|/-\\'):
-        self.markers = markers
-        self.curmark = -1
-    def update(self, pbar):
-        if pbar.finished:
-            return self.markers[0]
-        self.curmark = (self.curmark + 1)%len(self.markers)
-        return self.markers[self.curmark]
-
-class Percentage(ProgressBarWidget):
-    "Just the percentage done."
-    def update(self, pbar):
-        return '%3d%%' % pbar.percentage()
-
-class Bar(ProgressBarWidgetHFill):
-    "The bar of progress. It will strech to fill the line."
-    def __init__(self, marker='#', left='|', right='|'):
-        self.marker = marker
-        self.left = left
-        self.right = right
-    def _format_marker(self, pbar):
-        if isinstance(self.marker, string_types):
-            return self.marker
-        else:
-            return self.marker.update(pbar)
-    def update(self, pbar, width):
-        percent = pbar.percentage()
-        cwidth = int(width - len(self.left) - len(self.right))
-        marked_width = int(percent * cwidth / 100)
-        m = self._format_marker(pbar)
-        bar = (self.left + (m*marked_width).ljust(cwidth) + self.right)
-        return bar
-
-class ReverseBar(Bar):
-    "The reverse bar of progress, or bar of regress. :)"
-    def update(self, pbar, width):
-        percent = pbar.percentage()
-        cwidth = width - len(self.left) - len(self.right)
-        marked_width = int(percent * cwidth / 100)
-        m = self._format_marker(pbar)
-        bar = (self.left + (m*marked_width).rjust(cwidth) + self.right)
-        return bar
-
-default_widgets = [Percentage(), ' ', Bar()]
-class ProgressBar(object):
-    """This is the ProgressBar class, it updates and prints the bar.
-
-    The term_width parameter may be an integer. Or None, in which case
-    it will try to guess it, if it fails it will default to 80 columns.
-
-    The simple use is like this:
-    >>> pbar = ProgressBar().start()
-    >>> for i in xrange(100):
-    ...    # do something
-    ...    pbar.update(i+1)
-    ...
-    >>> pbar.finish()
-
-    But anything you want to do is possible (well, almost anything).
-    You can supply different widgets of any type in any order. And you
-    can even write your own widgets! There are many widgets already
-    shipped and you should experiment with them.
-
-    When implementing a widget update method you may access any
-    attribute or function of the ProgressBar object calling the
-    widget's update method. The most important attributes you would
-    like to access are:
-    - currval: current value of the progress, 0 <= currval <= maxval
-    - maxval: maximum (and final) value of the progress
-    - finished: True if the bar is have finished (reached 100%), False o/w
-    - start_time: first time update() method of ProgressBar was called
-    - seconds_elapsed: seconds elapsed since start_time
-    - percentage(): percentage of the progress (this is a method)
-    """
-    def __init__(self, maxval=100, widgets=default_widgets, term_width=None,
-                 fd=sys.stderr):
-        assert maxval > 0
-        self.maxval = maxval
-        self.widgets = widgets
-        self.fd = fd
-        self.signal_set = False
-        if term_width is None:
-            try:
-                self.handle_resize(None,None)
-                signal.signal(signal.SIGWINCH, self.handle_resize)
-                self.signal_set = True
-            except:
-                self.term_width = 79
-        else:
-            self.term_width = term_width
-
-        self.currval = 0
-        self.finished = False
-        self.prev_percentage = -1
-        self.start_time = None
-        self.seconds_elapsed = 0
-
-    def handle_resize(self, signum, frame):
-        h,w=array('h', ioctl(self.fd,termios.TIOCGWINSZ,'\0'*8))[:2]
-        self.term_width = w
-
-    def percentage(self):
-        "Returns the percentage of the progress."
-        return self.currval*100.0 / self.maxval
-
-    def _format_widgets(self):
-        r = []
-        hfill_inds = []
-        num_hfill = 0
-        currwidth = 0
-        for i, w in enumerate(self.widgets):
-            if isinstance(w, ProgressBarWidgetHFill):
-                r.append(w)
-                hfill_inds.append(i)
-                num_hfill += 1
-            elif isinstance(w, string_types):
-                r.append(w)
-                currwidth += len(w)
-            else:
-                weval = w.update(self)
-                currwidth += len(weval)
-                r.append(weval)
-        for iw in hfill_inds:
-            r[iw] = r[iw].update(self, (self.term_width-currwidth)/num_hfill)
-        return r
-
-    def _format_line(self):
-        return ''.join(self._format_widgets()).ljust(self.term_width)
-
-    def _need_update(self):
-        return int(self.percentage()) != int(self.prev_percentage)
-
-    def update(self, value):
-        "Updates the progress bar to a new value."
-        assert 0 <= value <= self.maxval
-        self.currval = value
-        if not self._need_update() or self.finished:
-            return
-        if not self.start_time:
-            self.start_time = time.time()
-        self.seconds_elapsed = time.time() - self.start_time
-        self.prev_percentage = self.percentage()
-        if value != self.maxval:
-            self.fd.write(self._format_line() + '\r')
-        else:
-            self.finished = True
-            self.fd.write(self._format_line() + '\n')
-
-    def start(self):
-        """Start measuring time, and prints the bar at 0%.
-
-        It returns self so you can use it like this:
-        >>> pbar = ProgressBar().start()
-        >>> for i in xrange(100):
-        ...    # do something
-        ...    pbar.update(i+1)
-        ...
-        >>> pbar.finish()
-        """
-        self.update(0)
-        return self
-
-    def finish(self):
-        """Used to tell the progress is finished."""
-        self.update(self.maxval)
-        if self.signal_set:
-            signal.signal(signal.SIGWINCH, signal.SIG_DFL)
-        
-
-
-
-
-
-if __name__=='__main__':
-    import os
-
-    def example1():
-        widgets = ['Test: ', Percentage(), ' ', Bar(marker=RotatingMarker()),
-                   ' ', ETA(), ' ', FileTransferSpeed()]
-        pbar = ProgressBar(widgets=widgets, maxval=10000000).start()
-        for i in range(1000000):
-            # do something
-            pbar.update(10*i+1)
-        pbar.finish()
-        print()
-
-    def example2():
-        class CrazyFileTransferSpeed(FileTransferSpeed):
-            "It's bigger between 45 and 80 percent"
-            def update(self, pbar):
-                if 45 < pbar.percentage() < 80:
-                    return 'Bigger Now ' + FileTransferSpeed.update(self,pbar)
-                else:
-                    return FileTransferSpeed.update(self,pbar)
-
-        widgets = [CrazyFileTransferSpeed(),' <<<', Bar(), '>>> ', Percentage(),' ', ETA()]
-        pbar = ProgressBar(widgets=widgets, maxval=10000000)
-        # maybe do something
-        pbar.start()
-        for i in range(2000000):
-            # do something
-            pbar.update(5*i+1)
-        pbar.finish()
-        print()
-
-    def example3():
-        widgets = [Bar('>'), ' ', ETA(), ' ', ReverseBar('<')]
-        pbar = ProgressBar(widgets=widgets, maxval=10000000).start()
-        for i in range(1000000):
-            # do something
-            pbar.update(10*i+1)
-        pbar.finish()
-        print()
-
-    def example4():
-        widgets = ['Test: ', Percentage(), ' ',
-                   Bar(marker='0',left='[',right=']'),
-                   ' ', ETA(), ' ', FileTransferSpeed()]
-        pbar = ProgressBar(widgets=widgets, maxval=500)
-        pbar.start()
-        for i in range(100,500+1,50):
-            time.sleep(0.2)
-            pbar.update(i)
-        pbar.finish()
-        print()
-
-
-    example1()
-    example2()
-    example3()
-    example4()
-

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/setup.py
--- a/yt/extern/setup.py
+++ b/yt/extern/setup.py
@@ -11,5 +11,6 @@
 def configuration(parent_package='', top_path=None):
     from numpy.distutils.misc_util import Configuration
     config = Configuration('extern', parent_package, top_path)
+    config.add_subpackage("tqdm")
     config.make_config_py()
     return config

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/tqdm/LICENSE
--- /dev/null
+++ b/yt/extern/tqdm/LICENSE
@@ -0,0 +1,22 @@
+https://github.com/tqdm/tqdm
+
+The MIT License (MIT)
+
+Copyright (c) 2013 noamraph
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/tqdm/__init__.py
--- /dev/null
+++ b/yt/extern/tqdm/__init__.py
@@ -0,0 +1,11 @@
+from ._tqdm import tqdm
+from ._tqdm import trange
+from ._tqdm import format_interval
+from ._tqdm import format_meter
+from ._tqdm_gui import tqdm_gui
+from ._tqdm_gui import tgrange
+from ._tqdm_pandas import tqdm_pandas
+from ._version import __version__  # NOQA
+
+__all__ = ['tqdm', 'tqdm_gui', 'trange', 'tgrange', 'format_interval',
+           'format_meter', 'tqdm_pandas', '__version__']

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/tqdm/_tqdm.py
--- /dev/null
+++ b/yt/extern/tqdm/_tqdm.py
@@ -0,0 +1,562 @@
+"""
+Customisable progressbar decorator for iterators.
+Includes a default (x)range iterator printing to stderr.
+
+Usage:
+  >>> from tqdm import trange[, tqdm]
+  >>> for i in trange(10): #same as: for i in tqdm(xrange(10))
+  ...     ...
+"""
+# future division is important to divide integers and get as
+# a result precise floating numbers (instead of truncated int)
+from __future__ import division, absolute_import
+# import compatibility functions and utilities
+from ._utils import _supports_unicode, _environ_cols_wrapper, _range, _unich, \
+    _term_move_up
+import sys
+from time import time
+
+
+__author__ = {"github.com/": ["noamraph", "obiwanus", "kmike", "hadim",
+                              "casperdcl", "lrq3000"]}
+__all__ = ['tqdm', 'trange', 'format_interval', 'format_meter']
+
+
+def format_sizeof(num, suffix=''):
+    """
+    Formats a number (greater than unity) with SI Order of Magnitude prefixes.
+
+    Parameters
+    ----------
+    num  : float
+        Number ( >= 1) to format.
+    suffix  : str, optional
+        Post-postfix [default: ''].
+
+    Returns
+    -------
+    out  : str
+        Number with Order of Magnitude SI unit postfix.
+    """
+    for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:
+        if abs(num) < 999.95:
+            if abs(num) < 99.95:
+                if abs(num) < 9.995:
+                    return '{0:1.2f}'.format(num) + unit + suffix
+                return '{0:2.1f}'.format(num) + unit + suffix
+            return '{0:3.0f}'.format(num) + unit + suffix
+        num /= 1000.0
+    return '{0:3.1f}Y'.format(num) + suffix
+
+
+def format_interval(t):
+    """
+    Formats a number of seconds as a clock time, [H:]MM:SS
+
+    Parameters
+    ----------
+    t  : int
+        Number of seconds.
+    Returns
+    -------
+    out  : str
+        [H:]MM:SS
+    """
+    mins, s = divmod(int(t), 60)
+    h, m = divmod(mins, 60)
+    if h:
+        return '{0:d}:{1:02d}:{2:02d}'.format(h, m, s)
+    else:
+        return '{0:02d}:{1:02d}'.format(m, s)
+
+
+def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False,
+                 unit='it', unit_scale=False, rate=None):
+    """
+    Return a string-based progress bar given some parameters
+
+    Parameters
+    ----------
+    n  : int
+        Number of finished iterations.
+    total  : int
+        The expected total number of iterations. If meaningless (), only
+        basic progress statistics are displayed (no ETA).
+    elapsed  : float
+        Number of seconds passed since start.
+    ncols  : int, optional
+        The width of the entire output message. If specified, dynamically
+        resizes the progress meter to stay within this bound
+        [default: None]. The fallback meter width is 10 for the progress bar
+        + no limit for the iterations counter and statistics. If 0, will not
+        print any meter (only stats).
+    prefix  : str, optional
+        Prefix message (included in total width) [default: ''].
+    ascii  : bool, optional
+        If not set, use unicode (smooth blocks) to fill the meter
+        [default: False]. The fallback is to use ASCII characters (1-9 #).
+    unit  : str, optional
+        The iteration unit [default: 'it'].
+    unit_scale  : bool, optional
+        If set, the number of iterations will printed with an appropriate
+        SI metric prefix (K = 10^3, M = 10^6, etc.) [default: False].
+    rate  : float, optional
+        Manual override for iteration rate.
+        If [default: None], uses n/elapsed.
+
+    Returns
+    -------
+    out  : Formatted meter and stats, ready to display.
+    """
+
+    # sanity check: total
+    if total and n > total:
+        total = None
+
+    elapsed_str = format_interval(elapsed)
+
+    # if unspecified, attempt to use rate = average speed
+    # (we allow manual override since predicting time is an arcane art)
+    if rate is None and elapsed:
+        rate = n / elapsed
+    rate_fmt = ((format_sizeof(rate) if unit_scale else
+                 '{0:5.2f}'.format(rate)) if elapsed else
+                '?') \
+        + unit + '/s'
+
+    if unit_scale:
+        n_fmt = format_sizeof(n)
+        total_fmt = format_sizeof(total) if total else None
+    else:
+        n_fmt = str(n)
+        total_fmt = str(total)
+
+    # total is known: we can predict some stats
+    if total:
+        # fractional and percentage progress
+        frac = n / total
+        percentage = frac * 100
+
+        remaining_str = format_interval((total - n) / rate) if rate else '?'
+
+        # format the stats displayed to the left and right sides of the bar
+        l_bar = (prefix if prefix else '') + '{0:3.0f}%|'.format(percentage)
+        r_bar = '| {0}/{1} [{2}<{3}, {4}]'.format(
+                n_fmt, total_fmt, elapsed_str, remaining_str, rate_fmt)
+
+        if ncols == 0:
+            return l_bar[:-1] + r_bar[1:]
+
+        # space available for bar's display
+        N_BARS = max(1, ncols - len(l_bar) - len(r_bar)) if ncols \
+            else 10
+
+        # format bar depending on availability of unicode/ascii chars
+        if ascii:
+            bar_length, frac_bar_length = divmod(
+                int(frac * N_BARS * 10), 10)
+
+            bar = '#' * bar_length
+            frac_bar = chr(48 + frac_bar_length) if frac_bar_length \
+                else ' '
+
+        else:
+            bar_length, frac_bar_length = divmod(int(frac * N_BARS * 8), 8)
+
+            bar = _unich(0x2588) * bar_length
+            frac_bar = _unich(0x2590 - frac_bar_length) \
+                if frac_bar_length else ' '
+
+        # whitespace padding
+        if bar_length < N_BARS:
+            full_bar = bar + frac_bar + \
+                ' ' * max(N_BARS - bar_length - 1, 0)
+        else:
+            full_bar = bar + \
+                ' ' * max(N_BARS - bar_length, 0)
+
+        return l_bar + full_bar + r_bar
+
+    # no total: no progressbar, ETA, just progress stats
+    else:
+        return (prefix if prefix else '') + '{0}{1} [{2}, {3}]'.format(
+            n_fmt, unit, elapsed_str, rate_fmt)
+
+
+def StatusPrinter(file):
+    """
+    Manage the printing and in-place updating of a line of characters.
+    Note that if the string is longer than a line, then in-place updating
+    may not work (it will print a new line at each refresh).
+    """
+    fp = file
+    if not getattr(fp, 'flush', False):  # pragma: no cover
+        fp.flush = lambda: None
+
+    last_printed_len = [0]  # closure over mutable variable (fast)
+
+    def print_status(s):
+        len_s = len(s)
+        fp.write('\r' + s + (' ' * max(last_printed_len[0] - len_s, 0)))
+        fp.flush()
+        last_printed_len[0] = len_s
+    return print_status
+
+
+class tqdm(object):
+    """
+    Decorate an iterable object, returning an iterator which acts exactly
+    like the orignal iterable, but prints a dynamically updating
+    progressbar every time a value is requested.
+    """
+    def __init__(self, iterable=None, desc=None, total=None, leave=False,
+                 file=sys.stderr, ncols=None, mininterval=0.1,
+                 maxinterval=10.0, miniters=None, ascii=None, disable=False,
+                 unit='it', unit_scale=False, dynamic_ncols=False,
+                 smoothing=0.3, nested=False, gui=False):
+        """
+        Parameters
+        ----------
+        iterable  : iterable, optional
+            Iterable to decorate with a progressbar.
+            Leave blank [default: None] to manually manage the updates.
+        desc  : str, optional
+            Prefix for the progressbar [default: None].
+        total  : int, optional
+            The number of expected iterations. If not given, len(iterable)
+            is used if possible. As a last resort, only basic progress
+            statistics are displayed (no ETA, no progressbar). If `gui` is
+            True and this parameter needs subsequent updating, specify an
+            initial arbitrary large positive integer, e.g. int(9e9).
+        leave  : bool, optional
+            If [default: False], removes all traces of the progressbar
+            upon termination of iteration.
+        file  : `io.TextIOWrapper` or `io.StringIO`, optional
+            Specifies where to output the progress messages
+            [default: sys.stderr]. Uses `file.write(str)` and `file.flush()`
+            methods.
+        ncols  : int, optional
+            The width of the entire output message. If specified,
+            dynamically resizes the progressbar to stay within this bound.
+            If [default: None], attempts to use environment width. The
+            fallback is a meter width of 10 and no limit for the counter and
+            statistics. If 0, will not print any meter (only stats).
+        mininterval  : float, optional
+            Minimum progress update interval, in seconds [default: 0.1].
+        maxinterval  : float, optional
+            Maximum progress update interval, in seconds [default: 10.0].
+        miniters  : int, optional
+            Minimum progress update interval, in iterations [default: None].
+        ascii  : bool, optional
+            If [default: None] or false, use unicode (smooth blocks) to fill
+            the meter. The fallback is to use ASCII characters `1-9 #`.
+        disable : bool
+            Whether to disable the entire progressbar wrapper
+            [default: False].
+        unit  : str, optional
+            String that will be used to define the unit of each iteration
+            [default: 'it'].
+        unit_scale  : bool, optional
+            If set, the number of iterations will be reduced/scaled
+            automatically and a metric prefix following the
+            International System of Units standard will be added
+            (kilo, mega, etc.) [default: False].
+        dynamic_ncols  : bool, optional
+            If set, constantly alters `ncols` to the environment (allowing
+            for window resizes) [default: False].
+        smoothing  : float
+            Exponential moving average smoothing factor for speed estimates
+            (ignored in GUI mode). Ranges from 0 (average speed) to 1
+            (current/instantaneous speed) [default: 0.3].
+        nested  : bool, optional
+            Whether this iterable is nested in another one also managed by
+            `tqdm` [default: False]. Allows display of multiple, nested
+            progress bars.
+        gui  : bool, optional
+            WARNING: internal paramer - do not use.
+            Use tqdm_gui(...) instead. If set, will attempt to use
+            matplotlib animations for a graphical output [default: false].
+
+        Returns
+        -------
+        out  : decorated iterator.
+        """
+        # Preprocess the arguments
+        if total is None and iterable is not None:
+            try:
+                total = len(iterable)
+            except (TypeError, AttributeError):
+                total = None
+
+        if ((ncols is None) and (file in (sys.stderr, sys.stdout))) or \
+                dynamic_ncols:
+            if dynamic_ncols:  # pragma: no cover
+                dynamic_ncols = _environ_cols_wrapper()
+                ncols = dynamic_ncols(file)
+            else:
+                ncols = _environ_cols_wrapper()(file)
+
+        if miniters is None:
+            miniters = 0
+            dynamic_miniters = True
+        else:
+            dynamic_miniters = False
+
+        if mininterval is None:
+            mininterval = 0
+
+        if maxinterval is None:
+            maxinterval = 0
+
+        if ascii is None:
+            ascii = not _supports_unicode(file)
+
+        if smoothing is None:
+            smoothing = 0
+
+        # Store the arguments
+        self.iterable = iterable
+        self.desc = desc + ': ' if desc else ''
+        self.total = total
+        self.leave = leave
+        self.fp = file
+        self.ncols = ncols
+        self.mininterval = mininterval
+        self.maxinterval = maxinterval
+        self.miniters = miniters
+        self.dynamic_miniters = dynamic_miniters
+        self.ascii = ascii
+        self.disable = disable
+        self.unit = unit
+        self.unit_scale = unit_scale
+        self.gui = gui
+        self.dynamic_ncols = dynamic_ncols
+        self.smoothing = smoothing
+        self.avg_rate = None
+        # if nested, at initial sp() call we replace '\r' by '\n' to
+        # not overwrite the outer progress bar
+        self.nested = nested
+
+        if not gui:
+            # Initialize the screen printer
+            self.sp = StatusPrinter(self.fp)
+            if not disable:
+                if self.nested:
+                    self.fp.write('\n')
+                self.sp(format_meter(0, total, 0,
+                        (dynamic_ncols(file) if dynamic_ncols else ncols),
+                        self.desc, ascii, unit, unit_scale))
+
+        # Init the time/iterations counters
+        self.start_t = self.last_print_t = time()
+        self.last_print_n = 0
+        self.n = 0
+
+    def __len__(self):
+        return len(self.iterable) if self.iterable else self.total
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *exc):
+        self.close()
+        return False
+
+    def __iter__(self):
+        ''' Backward-compatibility to use: for x in tqdm(iterable) '''
+
+        # Inlining instance variables as locals (speed optimisation)
+        iterable = self.iterable
+
+        # If the bar is disabled, then just walk the iterable
+        # (note: keep this check outside the loop for performance)
+        if self.disable:
+            for obj in iterable:
+                yield obj
+        else:
+            ncols = self.ncols
+            mininterval = self.mininterval
+            maxinterval = self.maxinterval
+            miniters = self.miniters
+            dynamic_miniters = self.dynamic_miniters
+            unit = self.unit
+            unit_scale = self.unit_scale
+            ascii = self.ascii
+            start_t = self.start_t
+            last_print_t = self.last_print_t
+            last_print_n = self.last_print_n
+            n = self.n
+            dynamic_ncols = self.dynamic_ncols
+            smoothing = self.smoothing
+            avg_rate = self.avg_rate
+
+            try:
+                sp = self.sp
+            except AttributeError:
+                raise DeprecationWarning('Please use tqdm_gui(...)'
+                                         ' instead of tqdm(..., gui=True)')
+
+            for obj in iterable:
+                yield obj
+                # Update and print the progressbar.
+                # Note: does not call self.update(1) for speed optimisation.
+                n += 1
+                delta_it = n - last_print_n
+                # check the counter first (avoid calls to time())
+                if delta_it >= miniters:
+                    cur_t = time()
+                    delta_t = cur_t - last_print_t
+                    if delta_t >= mininterval:
+                        elapsed = cur_t - start_t
+                        # EMA (not just overall average)
+                        if smoothing and delta_t:
+                            avg_rate = delta_it / delta_t \
+                                if avg_rate is None \
+                                else smoothing * delta_it / delta_t + \
+                                (1 - smoothing) * avg_rate
+
+                        sp(format_meter(
+                            n, self.total, elapsed,
+                            (dynamic_ncols(self.fp) if dynamic_ncols
+                             else ncols),
+                            self.desc, ascii, unit, unit_scale, avg_rate))
+
+                        # If no `miniters` was specified, adjust automatically
+                        # to the maximum iteration rate seen so far.
+                        if dynamic_miniters:
+                            if maxinterval and delta_t > maxinterval:
+                                # Set miniters to correspond to maxinterval
+                                miniters = delta_it * maxinterval / delta_t
+                            elif mininterval and delta_t:
+                                # EMA-weight miniters to converge
+                                # towards the timeframe of mininterval
+                                miniters = smoothing * delta_it * mininterval \
+                                    / delta_t + (1 - smoothing) * miniters
+                            else:
+                                miniters = smoothing * delta_it + \
+                                    (1 - smoothing) * miniters
+
+                        # Store old values for next call
+                        last_print_n = n
+                        last_print_t = cur_t
+
+            # Closing the progress bar.
+            # Update some internal variables for close().
+            self.last_print_n = last_print_n
+            self.n = n
+            self.close()
+
+    def update(self, n=1):
+        """
+        Manually update the progress bar, useful for streams
+        such as reading files.
+        E.g.:
+        >>> t = tqdm(total=filesize) # Initialise
+        >>> for current_buffer in stream:
+        ...    ...
+        ...    t.update(len(current_buffer))
+        >>> t.close()
+        The last line is highly recommended, but possibly not necessary if
+        `t.update()` will be called in such a way that `filesize` will be
+        exactly reached and printed.
+
+        Parameters
+        ----------
+        n  : int
+            Increment to add to the internal counter of iterations
+            [default: 1].
+        """
+        if self.disable:
+            return
+
+        if n < 1:
+            n = 1
+        self.n += n
+
+        delta_it = self.n - self.last_print_n  # should be n?
+        if delta_it >= self.miniters:
+            # We check the counter first, to reduce the overhead of time()
+            cur_t = time()
+            delta_t = cur_t - self.last_print_t
+            if delta_t >= self.mininterval:
+                elapsed = cur_t - self.start_t
+                # EMA (not just overall average)
+                if self.smoothing and delta_t:
+                    self.avg_rate = delta_it / delta_t \
+                        if self.avg_rate is None \
+                        else self.smoothing * delta_it / delta_t + \
+                        (1 - self.smoothing) * self.avg_rate
+
+                if not hasattr(self, "sp"):
+                    raise DeprecationWarning('Please use tqdm_gui(...)'
+                                             ' instead of tqdm(..., gui=True)')
+
+                self.sp(format_meter(
+                    self.n, self.total, elapsed,
+                    (self.dynamic_ncols(self.fp) if self.dynamic_ncols
+                     else self.ncols),
+                    self.desc, self.ascii, self.unit, self.unit_scale,
+                    self.avg_rate))
+
+                # If no `miniters` was specified, adjust automatically to the
+                # maximum iteration rate seen so far.
+                # e.g.: After running `tqdm.update(5)`, subsequent
+                # calls to `tqdm.update()` will only cause an update after
+                # at least 5 more iterations.
+                if self.dynamic_miniters:
+                    if self.maxinterval and delta_t > self.maxinterval:
+                        self.miniters = self.miniters * self.maxinterval \
+                            / delta_t
+                    elif self.mininterval and delta_t:
+                        self.miniters = self.smoothing * delta_it \
+                            * self.mininterval / delta_t + \
+                            (1 - self.smoothing) * self.miniters
+                    else:
+                        self.miniters = self.smoothing * delta_it + \
+                            (1 - self.smoothing) * self.miniters
+
+                # Store old values for next call
+                self.last_print_n = self.n
+                self.last_print_t = cur_t
+
+    def close(self):
+        """
+        Cleanup and (if leave=False) close the progressbar.
+        """
+        if self.disable:
+            return
+
+        endchar = '\r'
+        if self.nested:
+            endchar += _term_move_up()
+
+        if self.leave:
+            if self.last_print_n < self.n:
+                cur_t = time()
+                # stats for overall rate (no weighted average)
+                self.sp(format_meter(
+                    self.n, self.total, cur_t - self.start_t,
+                    (self.dynamic_ncols(self.fp) if self.dynamic_ncols
+                     else self.ncols),
+                    self.desc, self.ascii, self.unit, self.unit_scale))
+            if self.nested:
+                self.fp.write(endchar)
+            else:
+                self.fp.write('\n')
+        else:
+            self.sp('')
+            self.fp.write(endchar)
+
+    def set_description(self, desc=None):
+        """
+        Set/modify description of the progress bar.
+        """
+        self.desc = desc + ': ' if desc else ''
+
+
+def trange(*args, **kwargs):
+    """
+    A shortcut for tqdm(xrange(*args), **kwargs).
+    On Python3+ range is used instead of xrange.
+    """
+    return tqdm(_range(*args), **kwargs)

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/tqdm/_tqdm_gui.py
--- /dev/null
+++ b/yt/extern/tqdm/_tqdm_gui.py
@@ -0,0 +1,308 @@
+"""
+GUI progressbar decorator for iterators.
+Includes a default (x)range iterator printing to stderr.
+
+Usage:
+  >>> from tqdm_gui import tgrange[, tqdm_gui]
+  >>> for i in tgrange(10): #same as: for i in tqdm_gui(xrange(10))
+  ...     ...
+"""
+# future division is important to divide integers and get as
+# a result precise floating numbers (instead of truncated int)
+from __future__ import division, absolute_import
+# import compatibility functions and utilities
+from time import time
+from ._utils import _range
+# to inherit from the tqdm class
+from ._tqdm import tqdm, format_meter
+
+
+__author__ = {"github.com/": ["casperdcl", "lrq3000"]}
+__all__ = ['tqdm_gui', 'tgrange']
+
+
+class tqdm_gui(tqdm):  # pragma: no cover
+    """
+    Experimental GUI version of tqdm!
+    """
+    def __init__(self, *args, **kwargs):
+
+        # try:  # pragma: no cover
+        import matplotlib as mpl
+        import matplotlib.pyplot as plt
+        from collections import deque
+        # except ImportError:  # gui not available
+        #   kwargs['gui'] = False
+        # else:
+        kwargs['gui'] = True
+
+        super(tqdm_gui, self).__init__(*args, **kwargs)
+
+        # Initialize the GUI display
+        if self.disable or not kwargs['gui']:
+            return
+
+        self.fp.write('Warning: GUI is experimental/alpha\n')
+        self.mpl = mpl
+        self.plt = plt
+        self.sp = None
+
+        # Remember if external environment uses toolbars
+        self.toolbar = self.mpl.rcParams['toolbar']
+        self.mpl.rcParams['toolbar'] = 'None'
+
+        self.mininterval = max(self.mininterval, 0.5)
+        self.fig, ax = plt.subplots(figsize=(9, 2.2))
+        # self.fig.subplots_adjust(bottom=0.2)
+        if self.total:
+            self.xdata = []
+            self.ydata = []
+            self.zdata = []
+        else:
+            self.xdata = deque([])
+            self.ydata = deque([])
+            self.zdata = deque([])
+        self.line1, = ax.plot(self.xdata, self.ydata, color='b')
+        self.line2, = ax.plot(self.xdata, self.zdata, color='k')
+        ax.set_ylim(0, 0.001)
+        if self.total:
+            ax.set_xlim(0, 100)
+            ax.set_xlabel('percent')
+            self.fig.legend((self.line1, self.line2), ('cur', 'est'),
+                            loc='center right')
+            # progressbar
+            self.hspan = plt.axhspan(0, 0.001,
+                                     xmin=0, xmax=0, color='g')
+        else:
+            # ax.set_xlim(-60, 0)
+            ax.set_xlim(0, 60)
+            ax.invert_xaxis()
+            ax.set_xlabel('seconds')
+            ax.legend(('cur', 'est'), loc='lower left')
+        ax.grid()
+        # ax.set_xlabel('seconds')
+        ax.set_ylabel((self.unit if self.unit else 'it') + '/s')
+        if self.unit_scale:
+            plt.ticklabel_format(style='sci', axis='y',
+                                 scilimits=(0, 0))
+            ax.yaxis.get_offset_text().set_x(-0.15)
+
+        # Remember if external environment is interactive
+        self.wasion = plt.isinteractive()
+        plt.ion()
+        self.ax = ax
+
+    def __iter__(self):
+        # TODO: somehow allow the following:
+        # if not self.gui:
+        #   return super(tqdm_gui, self).__iter__()
+        iterable = self.iterable
+        if self.disable:
+            for obj in iterable:
+                yield obj
+            return
+
+        # ncols = self.ncols
+        mininterval = self.mininterval
+        miniters = self.miniters
+        dynamic_miniters = self.dynamic_miniters
+        unit = self.unit
+        unit_scale = self.unit_scale
+        ascii = self.ascii
+        start_t = self.start_t
+        last_print_t = self.last_print_t
+        last_print_n = self.last_print_n
+        n = self.n
+        # dynamic_ncols = self.dynamic_ncols
+        # smoothing = self.smoothing
+        # avg_rate = self.avg_rate
+
+        plt = self.plt
+        ax = self.ax
+        xdata = self.xdata
+        ydata = self.ydata
+        zdata = self.zdata
+        line1 = self.line1
+        line2 = self.line2
+
+        for obj in iterable:
+            yield obj
+            # Update and print the progressbar.
+            # Note: does not call self.update(1) for speed optimisation.
+            n += 1
+            delta_it = n - last_print_n
+            # check the counter first (avoid calls to time())
+            if delta_it >= miniters:
+                cur_t = time()
+                delta_t = cur_t - last_print_t
+                if delta_t >= mininterval:  # pragma: no cover
+                    elapsed = cur_t - start_t
+                    # Inline due to multiple calls
+                    total = self.total
+                    # instantaneous rate
+                    y = delta_it / delta_t
+                    # overall rate
+                    z = n / elapsed
+                    # update line data
+                    xdata.append(n * 100.0 / total if total else cur_t)
+                    ydata.append(y)
+                    zdata.append(z)
+
+                    # Discard old values
+                    # xmin, xmax = ax.get_xlim()
+                    # if (not total) and elapsed > xmin * 1.1:
+                    if (not total) and elapsed > 66:
+                        xdata.popleft()
+                        ydata.popleft()
+                        zdata.popleft()
+
+                    ymin, ymax = ax.get_ylim()
+                    if y > ymax or z > ymax:
+                        ymax = 1.1 * y
+                        ax.set_ylim(ymin, ymax)
+                        ax.figure.canvas.draw()
+
+                    if total:
+                        line1.set_data(xdata, ydata)
+                        line2.set_data(xdata, zdata)
+                        try:
+                            poly_lims = self.hspan.get_xy()
+                        except AttributeError:
+                            self.hspan = plt.axhspan(0, 0.001, xmin=0,
+                                                     xmax=0, color='g')
+                            poly_lims = self.hspan.get_xy()
+                        poly_lims[0, 1] = ymin
+                        poly_lims[1, 1] = ymax
+                        poly_lims[2] = [n / total, ymax]
+                        poly_lims[3] = [poly_lims[2, 0], ymin]
+                        if len(poly_lims) > 4:
+                            poly_lims[4, 1] = ymin
+                        self.hspan.set_xy(poly_lims)
+                    else:
+                        t_ago = [cur_t - i for i in xdata]
+                        line1.set_data(t_ago, ydata)
+                        line2.set_data(t_ago, zdata)
+
+                    ax.set_title(format_meter(
+                        n, total, elapsed, 0,
+                        self.desc, ascii, unit, unit_scale),
+                        fontname="DejaVu Sans Mono",
+                        fontsize=11)
+                    plt.pause(1e-9)
+
+                    # If no `miniters` was specified, adjust automatically
+                    # to the maximum iteration rate seen so far.
+                    if dynamic_miniters:
+                        miniters = max(miniters, delta_it)
+
+                    # Store old values for next call
+                    last_print_n = n
+                    last_print_t = cur_t
+
+        # Closing the progress bar.
+        # Update some internal variables for close().
+        self.last_print_n = last_print_n
+        self.n = n
+        self.close()
+
+    def update(self, n=1):
+        # if not self.gui:
+        #   return super(tqdm_gui, self).close()
+        if self.disable:
+            return
+
+        if n < 1:
+            n = 1
+        self.n += n
+
+        delta_it = self.n - self.last_print_n  # should be n?
+        if delta_it >= self.miniters:
+            # We check the counter first, to reduce the overhead of time()
+            cur_t = time()
+            delta_t = cur_t - self.last_print_t
+            if delta_t >= self.mininterval:
+                elapsed = cur_t - self.start_t
+                # Inline due to multiple calls
+                total = self.total
+                ax = self.ax
+
+                # instantaneous rate
+                y = delta_it / delta_t
+                # smoothed rate
+                z = self.n / elapsed
+                # update line data
+                self.xdata.append(self.n * 100.0 / total
+                                  if total else cur_t)
+                self.ydata.append(y)
+                self.zdata.append(z)
+
+                # Discard old values
+                if (not total) and elapsed > 66:
+                    self.xdata.popleft()
+                    self.ydata.popleft()
+                    self.zdata.popleft()
+
+                ymin, ymax = ax.get_ylim()
+                if y > ymax or z > ymax:
+                    ymax = 1.1 * y
+                    ax.set_ylim(ymin, ymax)
+                    ax.figure.canvas.draw()
+
+                if total:
+                    self.line1.set_data(self.xdata, self.ydata)
+                    self.line2.set_data(self.xdata, self.zdata)
+                    try:
+                        poly_lims = self.hspan.get_xy()
+                    except AttributeError:
+                        self.hspan = self.plt.axhspan(0, 0.001, xmin=0,
+                                                      xmax=0, color='g')
+                        poly_lims = self.hspan.get_xy()
+                    poly_lims[0, 1] = ymin
+                    poly_lims[1, 1] = ymax
+                    poly_lims[2] = [self.n / total, ymax]
+                    poly_lims[3] = [poly_lims[2, 0], ymin]
+                    if len(poly_lims) > 4:
+                        poly_lims[4, 1] = ymin
+                    self.hspan.set_xy(poly_lims)
+                else:
+                    t_ago = [cur_t - i for i in self.xdata]
+                    self.line1.set_data(t_ago, self.ydata)
+                    self.line2.set_data(t_ago, self.zdata)
+
+                ax.set_title(format_meter(
+                    self.n, total, elapsed, 0,
+                    self.desc, self.ascii, self.unit, self.unit_scale),
+                    fontname="DejaVu Sans Mono",
+                    fontsize=11)
+                self.plt.pause(1e-9)
+
+                # If no `miniters` was specified, adjust automatically to the
+                # maximum iteration rate seen so far.
+                if self.dynamic_miniters:
+                    self.miniters = max(self.miniters, delta_it)
+
+                # Store old values for next call
+                self.last_print_n = self.n
+                self.last_print_t = cur_t
+
+    def close(self):
+        # if not self.gui:
+        #   return super(tqdm_gui, self).close()
+        if self.disable:
+            return
+
+        # Restore toolbars
+        self.mpl.rcParams['toolbar'] = self.toolbar
+        # Return to non-interactive mode
+        if not self.wasion:
+            self.plt.ioff()
+        if not self.leave:
+            self.plt.close(self.fig)
+
+
+def tgrange(*args, **kwargs):
+    """
+    A shortcut for tqdm_gui(xrange(*args), **kwargs).
+    On Python3+ range is used instead of xrange.
+    """
+    return tqdm_gui(_range(*args), **kwargs)

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/tqdm/_tqdm_pandas.py
--- /dev/null
+++ b/yt/extern/tqdm/_tqdm_pandas.py
@@ -0,0 +1,58 @@
+# future division is important to divide integers and get as
+# a result precise floating numbers (instead of truncated int)
+from __future__ import absolute_import
+
+
+__author__ = "github.com/casperdcl"
+__all__ = ['tqdm_pandas']
+
+
+def tqdm_pandas(t):  # pragma: no cover
+    """
+    Registers the given `tqdm` instance with
+    `pandas.core.groupby.DataFrameGroupBy.progress_apply`.
+    It will even close() the `tqdm` instance upon completion.
+
+    Examples
+    --------
+    >>> import pandas as pd
+    >>> import numpy as np
+    >>> from tqdm import tqdm, tqdm_pandas
+    >>>
+    >>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
+    >>> tqdm_pandas(tqdm())  # can use tqdm_gui, optional kwargs, etc
+    >>> # Now you can use `progress_apply` instead of `apply`
+    >>> df.groupby(0).progress_apply(lambda x: x**2)
+
+    References
+    ----------
+    https://stackoverflow.com/questions/18603270/
+    progress-indicator-during-pandas-operations-python
+    """
+    from pandas.core.groupby import DataFrameGroupBy
+
+    def inner(groups, func, *args, **kwargs):
+        """
+        Parameters
+        ----------
+        groups  : DataFrameGroupBy
+            Grouped data.
+        func  : function
+            To be applied on the grouped data.
+
+        *args and *kwargs are transmitted to DataFrameGroupBy.apply()
+        """
+        t.total = len(groups) + 1  # pandas calls update once too many
+
+        def wrapper(*args, **kwargs):
+            t.update()
+            return func(*args, **kwargs)
+
+        result = groups.apply(wrapper, *args, **kwargs)
+
+        t.close()
+
+        return result
+
+    # Enable custom tqdm progress in pandas!
+    DataFrameGroupBy.progress_apply = inner

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/tqdm/_utils.py
--- /dev/null
+++ b/yt/extern/tqdm/_utils.py
@@ -0,0 +1,118 @@
+import os
+
+try:    # pragma: no cover
+    _range = xrange
+except NameError:    # pragma: no cover
+    _range = range
+
+
+try:    # pragma: no cover
+    _unich = unichr
+except NameError:    # pragma: no cover
+    _unich = chr
+
+try:  # pragma: no cover
+    import colorama
+    colorama.init()
+except ImportError:  # pragma: no cover
+    colorama = None
+
+
+def _is_utf(encoding):
+    return ('U8' == encoding) or ('utf' in encoding) or ('UTF' in encoding)
+
+
+def _supports_unicode(file):
+    if not getattr(file, 'encoding', None):
+        return False
+    return _is_utf(file.encoding)
+
+
+def _environ_cols_wrapper():  # pragma: no cover
+    """
+    Return a function which gets width and height of console
+    (linux,osx,windows,cygwin).
+    """
+    import platform
+    current_os = platform.system()
+    _environ_cols = None
+    if current_os == 'Windows':
+        _environ_cols = _environ_cols_windows
+        if _environ_cols is None:
+            _environ_cols = _environ_cols_tput
+    if current_os in ['Linux', 'Darwin'] or current_os.startswith('CYGWIN'):
+        _environ_cols = _environ_cols_linux
+    return _environ_cols
+
+
+def _environ_cols_windows(fp):  # pragma: no cover
+    try:
+        from ctypes import windll, create_string_buffer
+        import struct
+        from sys import stdin, stdout
+
+        io_handle = None
+        if fp == stdin:
+            io_handle = -10
+        elif fp == stdout:
+            io_handle = -11
+        else:  # assume stderr
+            io_handle = -12
+
+        h = windll.kernel32.GetStdHandle(io_handle)
+        csbi = create_string_buffer(22)
+        res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
+        if res:
+            (bufx, bufy, curx, cury, wattr, left, top, right, bottom,
+             maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw)
+            # nlines = bottom - top + 1
+            return right - left  # +1
+    except:
+        pass
+    return None
+
+
+def _environ_cols_tput(*args):  # pragma: no cover
+    """ cygwin xterm (windows) """
+    try:
+        import subprocess
+        import shlex
+        cols = int(subprocess.check_call(shlex.split('tput cols')))
+        # rows = int(subprocess.check_call(shlex.split('tput lines')))
+        return cols
+    except:
+        pass
+    return None
+
+
+def _environ_cols_linux(fp):  # pragma: no cover
+
+    # import os
+    # if fp is None:
+    #     try:
+    #         fp = os.open(os.ctermid(), os.O_RDONLY)
+    #     except:
+    #         pass
+    try:
+        from termios import TIOCGWINSZ
+        from fcntl import ioctl
+        from array import array
+    except ImportError:
+        return None
+    else:
+        try:
+            return array('h', ioctl(fp, TIOCGWINSZ, '\0' * 8))[1]
+        except:
+            try:
+                from os.environ import get
+            except ImportError:
+                return None
+            else:
+                return int(get('COLUMNS', 1)) - 1
+
+
+def _term_move_up():  # pragma: no cover
+    if os.name == 'nt':
+        if colorama is None:
+            return ''
+    return '\x1b[A'

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/extern/tqdm/_version.py
--- /dev/null
+++ b/yt/extern/tqdm/_version.py
@@ -0,0 +1,5 @@
+# Definition of the version number
+version_info = 3, 4, 0  # major, minor, patch, -extra
+
+# Nice string for the version
+__version__ = '.'.join(map(str, version_info)).replace('.-', '-').strip('.-')

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/fields/tests/test_fields.py
--- a/yt/fields/tests/test_fields.py
+++ b/yt/fields/tests/test_fields.py
@@ -126,8 +126,8 @@
         fields = list(_base_fields)
 
         for rf in requested:
-            if field.particle_type:
-                if rf not in particle_fields:
+            if rf[0] == 'io' or rf[0] == 'all':
+                if rf not in particle_fields or rf[1] not in particle_fields:
                     particle_fields.append(rf[1])
             else:
                 fields.append(rf)

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -448,6 +448,16 @@
             param, vals = [s.strip() for s in line.split("=")]
             if param == "amr.n_cell":
                 vals = self.domain_dimensions = np.array(vals.split(), dtype='int32')
+
+                # For 1D and 2D simulations in BoxLib usually only the relevant dimensions
+                # have a specified number of zones, but yt requires domain_dimensions to 
+                # have three elements, with 1 in the additional slots if we're not in 3D, 
+                # so append them as necessary.
+
+                if (len(vals) == 1):
+                    vals = self.domain_dimensions = np.array([vals[0], 1, 1])
+                elif (len(vals) == 2):
+                    vals = self.domain_dimensions = np.array([vals[0], vals[1], 1])
             elif param == "amr.ref_ratio":
                 vals = self.refine_by = int(vals[0])
             elif param == "Prob.lo_bc":

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -960,6 +960,14 @@
             return True
         return os.path.exists("%s.hierarchy" % args[0])
 
+    @classmethod
+    def _guess_candidates(cls, base, directories, files):
+        candidates = [_ for _ in files if _.endswith(".hierarchy")
+                      and os.path.exists(
+                        os.path.join(base, _.rsplit(".", 1)[0]))]
+        # Typically, Enzo won't have nested outputs.
+        return candidates, (len(candidates) == 0)
+
 class EnzoDatasetInMemory(EnzoDataset):
     _index_class = EnzoHierarchyInMemory
     _dataset_type = 'enzo_inline'

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/frontends/fits/data_structures.py
--- a/yt/frontends/fits/data_structures.py
+++ b/yt/frontends/fits/data_structures.py
@@ -433,9 +433,9 @@
         default_length_units += more_length_units
         file_units = []
         cunits = [self.wcs.wcs.cunit[i] for i in range(self.dimensionality)]
-        for i, unit in enumerate(cunits):
+        for unit in (_.to_string() for _ in cunits):
             if unit in default_length_units:
-                file_units.append(unit.name)
+                file_units.append(unit)
         if len(set(file_units)) == 1:
             length_factor = self.wcs.wcs.cdelt[0]
             length_unit = str(file_units[0])
@@ -540,6 +540,13 @@
             else:
                 self._setup_spec_cube()
 
+        # Now we can set up some of our parameters for convenience.
+        #self.parameters['wcs'] = dict(self.wcs.to_header())
+        for k, v in self.primary_header.items():
+            self.parameters[k] = v
+        # Remove potential default keys
+        self.parameters.pop('', None)
+
     def _setup_spec_cube(self):
 
         self.spec_cube = True
@@ -626,7 +633,7 @@
     @classmethod
     def _is_valid(cls, *args, **kwargs):
         ext = args[0].rsplit(".", 1)[-1]
-        if ext.upper() == "GZ":
+        if ext.upper() in ("GZ", "FZ"):
             # We don't know for sure that there will be > 1
             ext = args[0].rsplit(".", 1)[0].rsplit(".", 1)[-1]
         if ext.upper() not in ("FITS", "FTS"):
@@ -645,3 +652,17 @@
         except:
             pass
         return False
+
+    @classmethod
+    def _guess_candidates(cls, base, directories, files):
+        candidates = []
+        for fn, fnl in ((_, _.lower()) for _ in files):
+            if fnl.endswith(".fits") or \
+               fnl.endswith(".fits.gz") or \
+               fnl.endswith(".fits.fz"):
+                candidates.append(fn)
+        # FITS files don't preclude subdirectories
+        return candidates, True
+
+    def close(self):
+        self._handle.close()

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -411,4 +411,13 @@
             pass
         return False
 
+    @classmethod
+    def _guess_candidates(cls, base, directories, files):
+        candidates = [_ for _ in files if
+                      ("_hdf5_plt_cnt_" in _) or
+                      ("_hdf5_chk_" in _)]
+        # Typically, Flash won't have nested outputs.
+        return candidates, (len(candidates) == 0)
 
+    def close(self):
+        self._handle.close()

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -607,6 +607,17 @@
     number_of_particles = data.pop("number_of_particles", 0)
     # First we fix our field names
     field_units, data = unitify_data(data)
+
+    for field_name in data:
+        fshape = data[field_name].shape
+        dshape = tuple(domain_dimensions)
+        pshape = (number_of_particles, )
+        if fshape != dshape and fshape != pshape:
+            msg = ("Input data shape %s for field %s does not match provided "
+                   "domain_dimensions %s or number of particles %s")
+            msg = msg % (fshape, field_name, dshape, pshape)
+            raise RuntimeError(msg)
+
     sfh = StreamDictFieldHandler()
 
     if number_of_particles > 0:

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -38,10 +38,10 @@
 from math import floor, ceil
 from numbers import Number as numeric_type
 
-from yt.extern.six.moves import builtins, urllib
+from yt.extern.six.moves import urllib
 from yt.utilities.logger import ytLogger as mylog
 from yt.utilities.exceptions import YTInvalidWidthError
-import yt.extern.progressbar as pb
+from yt.extern.tqdm import tqdm
 from yt.units.yt_array import YTArray, YTQuantity
 from functools import wraps
 
@@ -336,6 +336,17 @@
 # Our progress bar types and how to get one
 #
 
+class TqdmProgressBar(object):
+    # This is a drop in replacement for pbar
+    # called tqdm
+    def __init__(self,title, maxval):
+        self._pbar = tqdm(leave=True,total=maxval,desc=title)
+
+    def update(self,*args,**kwargs):
+        self._pbar.update()
+    def finish(self):
+        self._pbar.close()
+
 class DummyProgressBar(object):
     # This progressbar gets handed if we don't
     # want ANY output
@@ -382,17 +393,11 @@
     maxval = max(maxval, 1)
     from yt.config import ytcfg
     if ytcfg.getboolean("yt", "suppressStreamLogging") or \
-       "__IPYTHON__" in dir(builtins) or \
        ytcfg.getboolean("yt", "__withintesting"):
         return DummyProgressBar()
     elif ytcfg.getboolean("yt", "__parallel"):
         return ParallelProgressBar(title, maxval)
-    widgets = [ title,
-            pb.Percentage(), ' ',
-            pb.Bar(marker=pb.RotatingMarker()),
-            ' ', pb.ETA(), ' ']
-    pbar = pb.ProgressBar(widgets=widgets,
-                          maxval=maxval).start()
+    pbar = TqdmProgressBar(title,maxval)
     return pbar
 
 def only_on_root(func, *args, **kwargs):

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/geometry/coordinates/cartesian_coordinates.py
--- a/yt/geometry/coordinates/cartesian_coordinates.py
+++ b/yt/geometry/coordinates/cartesian_coordinates.py
@@ -86,7 +86,7 @@
                 field_data = np.expand_dims(field_data, 1)
             # if this is a higher-order element, we demote to 1st order
             # here, for now.
-            elif field_data.shape[1] == 27 or field_data.shape[1] == 20:
+            elif field_data.shape[1] == 27:
                 # hexahedral
                 mylog.warning("High order elements not yet supported, " +
                               "dropping to 1st order.")

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -26,7 +26,6 @@
 import json
 import pprint
 
-
 from yt.config import ytcfg
 ytcfg["yt","__command_line"] = "True"
 from yt.startup_tasks import parser, subparsers
@@ -43,6 +42,8 @@
 from yt.visualization.plot_window import \
     SlicePlot, \
     ProjectionPlot
+from yt.utilities.exceptions import \
+    YTOutputNotIdentified
 
 # loading field plugins for backward compatibility, since this module
 # used to do "from yt.mods import *"
@@ -1098,6 +1099,75 @@
             print()
             pprint.pprint(rv)
 
+class YTSearchCmd(YTCommand):
+    args = (dict(short="-o", longname="--output",
+                 action="store", type=str,
+                 dest="output", default="yt_index.json",
+                 help="File in which to place output"),
+            dict(longname="--check-all", short="-a",
+                 help="Attempt to load every file",
+                 action="store_true", default=False,
+                 dest="check_all"),
+            dict(longname="--full", short="-f",
+                 help="Output full contents of parameter file",
+                 action="store_true", default=False,
+                 dest="full_output"),
+            )
+    description = \
+        """
+        Attempt to find outputs that yt can recognize in directories.
+        """
+    name = "search"
+    def __call__(self, args):
+        from yt.utilities.parameter_file_storage import \
+            output_type_registry
+        attrs = ("dimensionality", "refine_by", "domain_dimensions",
+                 "current_time", "domain_left_edge", "domain_right_edge",
+                 "unique_identifier", "current_redshift", 
+                 "cosmological_simulation", "omega_matter", "omega_lambda",
+                 "hubble_constant", "dataset_type")
+        candidates = []
+        for base, dirs, files in os.walk(".", followlinks=True):
+            print("(% 10i candidates) Examining %s" % (len(candidates), base))
+            recurse = []
+            if args.check_all:
+                candidates.extend([os.path.join(base, _) for _ in files])
+            for _, otr in sorted(output_type_registry.items()):
+                c, r = otr._guess_candidates(base, dirs, files)
+                candidates.extend([os.path.join(base, _) for _ in c])
+                recurse.append(r)
+            if len(recurse) > 0 and not all(recurse):
+                del dirs[:]
+        # Now we have a ton of candidates.  We're going to do something crazy
+        # and try to load each one.
+        records = []
+        for i, c in enumerate(sorted(candidates)):
+            print("(% 10i/% 10i) Evaluating %s" % (i, len(candidates), c))
+            try:
+                ds = load(c)
+            except YTOutputNotIdentified:
+                continue
+            record = {'filename': c}
+            for a in attrs:
+                v = getattr(ds, a, None)
+                if v is None:
+                    continue
+                if hasattr(v, "tolist"):
+                    v = v.tolist()
+                record[a] = v
+            if args.full_output:
+                params = {}
+                for p, v in ds.parameters.items():
+                    if hasattr(v, "tolist"):
+                        v = v.tolist()
+                    params[p] = v
+                record['params'] = params
+            records.append(record)
+            ds.close()
+        with open(args.output, "w") as f:
+            json.dump(records, f, indent=4)
+        print("Identified %s records output to %s" % (
+              len(records), args.output))
 
 def run_main():
     args = parser.parse_args()

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -423,6 +423,17 @@
     def __str__(self):
         return "You've used too many processors for this dataset."
 
+
+class YTElementTypeNotRecognized(YTException):
+    def __init__(self, dim, num_nodes):
+        self.dim = dim
+        self.num_nodes = num_nodes
+
+    def __str__(self):
+        return "Element type not recognized - dim = %s, num_nodes = %s" % (
+            self.dim, self.num_nodes)
+
+
 class YTDuplicateFieldInProfile(Exception):
     def __init__(self, field, new_spec, old_spec):
         self.field = field

diff -r 2efe32fea8098e881b5f1df7f22ef0ea9cafcc51 -r e6b1c07426d5b5c3d9142306f8695281b352c885 yt/utilities/file_handler.py
--- a/yt/utilities/file_handler.py
+++ b/yt/utilities/file_handler.py
@@ -1,5 +1,5 @@
 """
-Wrapper classes for h5py and netCDF4 file objects.
+A wrapper class for h5py file objects.
 
 
 
@@ -73,7 +73,7 @@
         super(FITSFileHandler, self).__del__()
 
     def close(self):
-        pass
+        self.handle.close()
 
 class NetCDF4FileHandler(object):
     def __init__(self, filename):

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

https://bitbucket.org/yt_analysis/yt/commits/ccd5c2bf28d0/
Changeset:   ccd5c2bf28d0
Branch:      yt
User:        ngoldbaum
Date:        2016-01-27 17:14:00+00:00
Summary:     Merged in MatthewTurk/yt (pull request #1956)

Clean Cython code
Affected #:  32 files

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 doc/source/analyzing/_static/axes_calculator.pyx
--- a/doc/source/analyzing/_static/axes_calculator.pyx
+++ b/doc/source/analyzing/_static/axes_calculator.pyx
@@ -1,7 +1,7 @@
 import numpy as np
 cimport numpy as np
 cimport cython
-from stdlib cimport malloc, free
+from libc.stdlib cimport malloc, free
 
 cdef extern from "axes.h":
     ctypedef struct ParticleCollection:
@@ -16,7 +16,9 @@
 def examine_axes(np.ndarray[np.float64_t, ndim=1] xpos,
                  np.ndarray[np.float64_t, ndim=1] ypos,
                  np.ndarray[np.float64_t, ndim=1] zpos):
-    cdef double ax1[3], ax2[3], ax3[3]
+    cdef double ax1[3]
+    cdef double ax2[3]
+    cdef double ax3[3]
     cdef ParticleCollection particles
     cdef int i
 

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/analysis_modules/halo_finding/rockstar/rockstar_groupies.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_groupies.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_groupies.pyx
@@ -373,8 +373,7 @@
         # Define fof object
 
         # Find number of particles
-        cdef np.int64_t i, j, k, ind, offset
-        cdef np.int64_t num_particles = pind.shape[0]
+        cdef np.int64_t i, j, k, ind
         global global_particles
 
         # Allocate space for correct number of particles

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
@@ -181,13 +181,8 @@
     cdef unsigned long long pi,fi,i
     cdef np.int64_t local_parts = 0
     ds = rh.ds = rh.tsl.next()
-    block = int(str(filename).rsplit(".")[-1])
-    n = rh.block_ratio
 
     SCALE_NOW = 1.0/(ds.current_redshift+1.0)
-    # Now we want to grab data from only a subset of the grids for each reader.
-    all_fields = set(ds.derived_field_list + ds.field_list)
-
     # First we need to find out how many this reader is going to read in
     # if the number of readers > 1.
     dd = ds.all_data()
@@ -265,7 +260,7 @@
         global FILENAME, FILE_FORMAT, NUM_SNAPS, STARTING_SNAP, h0, Ol, Om
         global BOX_SIZE, PERIODIC, PARTICLE_MASS, NUM_BLOCKS, NUM_READERS
         global FORK_READERS_FROM_WRITERS, PARALLEL_IO_WRITER_PORT, NUM_WRITERS
-        global rh, SCALE_NOW, OUTBASE, MIN_HALO_OUTPUT_SIZE
+        global rh, SCALE_NOW, OUTBASE, MIN_HALO_OUTPUT_SIZE, OUTPUT_FORMAT
         global OVERLAP_LENGTH, TOTAL_PARTICLES, FORCE_RES, RESTART_SNAP
         if force_res is not None:
             FORCE_RES=np.float64(force_res)

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/geometry/fake_octree.pyx
--- a/yt/geometry/fake_octree.pyx
+++ b/yt/geometry/fake_octree.pyx
@@ -60,7 +60,7 @@
     print "child", parent.file_ind, ind[0], ind[1], ind[2], cur_leaf, cur_level
     cdef int ddr[3]
     cdef int ii
-    cdef long i,j,k
+    cdef long i
     cdef float rf #random float from 0-1
     if cur_level >= max_level:
         return cur_leaf

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/geometry/grid_container.pyx
--- a/yt/geometry/grid_container.pyx
+++ b/yt/geometry/grid_container.pyx
@@ -163,7 +163,7 @@
                           SelectorObject selector):
         # This iterates over all root grids, given a selector+data, and then
         # visits each one and its children.
-        cdef int i, n
+        cdef int i
         # Because of confusion about mapping of children to parents, we are
         # going to do this the stupid way for now.
         cdef GridTreeNode *grid

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/geometry/grid_visitors.pyx
--- a/yt/geometry/grid_visitors.pyx
+++ b/yt/geometry/grid_visitors.pyx
@@ -40,9 +40,10 @@
     # positions for child masks.  This may not be considerably more efficient
     # memory-wise, but it is easier to keep and save when going through
     # multiple grids and selectors.
-    cdef int i, j, k
+    cdef int i, j
     cdef np.int64_t si, ei
-    cdef GridTreeNode *g, *c
+    cdef GridTreeNode *g
+    cdef GridTreeNode *c
     free_tuples(data)
     g = data.grid
     data.child_tuples = <int**> malloc(sizeof(int*) * g.num_children)
@@ -116,7 +117,6 @@
 cdef void ires_cells(GridVisitorData *data, np.uint8_t selected) nogil:
     # Fill with the level value.
     if selected == 0: return
-    cdef int i
     cdef np.int64_t *ires = <np.int64_t*> data.array
     ires[data.index] = data.grid.level
     data.index += 1

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -191,9 +191,8 @@
         cdef np.float64_t RE[3]
         cdef np.float64_t sdds[3]
         cdef np.float64_t spos[3]
-        cdef int i, j, k, res, mi
+        cdef int i, j, k, res
         cdef Oct *ch
-        cdef np.uint8_t selected
         # Remember that pos is the *center* of the oct, and dds is the oct
         # width.  So to get to the edges, we add/subtract half of dds.
         for i in range(3):
@@ -359,7 +358,6 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     def fill_mesh_mask(self, mesh):
-        cdef int dim[3]
         cdef np.float64_t pos[3]
         cdef np.ndarray[np.int64_t, ndim=2] indices
         cdef np.ndarray[np.float64_t, ndim=2] coords
@@ -388,7 +386,6 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     def fill_mesh_cell_mask(self, mesh):
-        cdef int dim[3]
         cdef np.float64_t pos
         cdef np.float64_t le[3]
         cdef np.float64_t re[3]
@@ -434,7 +431,7 @@
         cdef np.ndarray[np.float64_t, ndim=1] odds = gobj.dds.d
         cdef np.ndarray[np.float64_t, ndim=1] oleft_edge = gobj.LeftEdge.d
         cdef np.ndarray[np.float64_t, ndim=1] oright_edge = gobj.RightEdge.d
-        cdef int i, j, k
+        cdef int i
         cdef np.float64_t dds[3]
         cdef np.float64_t left_edge[3]
         cdef np.float64_t right_edge[3]
@@ -495,10 +492,11 @@
         # aspect of which is the .grid attribute, along with index values and
         # void* pointers to arrays) and a possibly-pre-generated cached mask.
         # Each cell is visited with the grid visitor function.
-        cdef np.float64_t left_edge[3], right_edge[3]
+        cdef np.float64_t left_edge[3]
+        cdef np.float64_t right_edge[3]
         cdef np.float64_t dds[3]
-        cdef int dim[3], level, i
-        cdef int total = 0, this_level = 0
+        cdef int dim[3]
+        cdef int this_level = 0, level, i
         cdef np.float64_t pos[3]
         level = data.grid.level
         if level < self.min_level or level > self.max_level:
@@ -680,7 +678,6 @@
     @cython.cdivision(True)
     cdef int select_bbox(self, np.float64_t left_edge[3],
                                np.float64_t right_edge[3]) nogil:
-        cdef int i
         # point definitely can only be in one cell
         if (left_edge[0] <= self.p[0] < right_edge[0] and
             left_edge[1] <= self.p[1] < right_edge[1] and
@@ -710,8 +707,6 @@
         self.radius = _ensure_code(dobj.radius)
         self.radius2 = self.radius * self.radius
         center = _ensure_code(dobj.center)
-        cdef np.float64_t mi = np.finfo("float64").min
-        cdef np.float64_t ma = np.finfo("float64").max
         for i in range(3):
             self.center[i] = center[i]
             self.bbox[i][0] = self.center[i] - self.radius
@@ -869,8 +864,7 @@
     @cython.cdivision(True)
     cdef int select_bbox(self, np.float64_t left_edge[3],
                                np.float64_t right_edge[3]) nogil:
-        cdef int i, shift, included
-        cdef np.float64_t LE, RE
+        cdef int i
         for i in range(3):
             if (right_edge[i] < self.left_edge[i] and \
                 left_edge[i] >= self.right_edge_shift[i]) or \
@@ -882,7 +876,8 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     cdef int select_cell(self, np.float64_t pos[3], np.float64_t dds[3]) nogil:
-        cdef np.float64_t left_edge[3], right_edge[3]
+        cdef np.float64_t left_edge[3]
+        cdef np.float64_t right_edge[3]
         cdef int i
         if self.loose_selection:
             for i in range(3):
@@ -971,8 +966,8 @@
     @cython.wraparound(False)
     @cython.cdivision(True)
     cdef int select_point(self, np.float64_t pos[3]) nogil:
-        cdef np.float64_t h, d, r2, temp, spos
-        cdef int i, j, k
+        cdef np.float64_t h, d, r2, temp
+        cdef int i
         h = d = 0
         for i in range(3):
             temp = self.difference(pos[i], self.center[i], i)
@@ -1149,8 +1144,8 @@
         self.axis = dobj.axis
         self.coord = _ensure_code(dobj.coord)
 
-        ax = (self.axis+1) % 3
-        ay = (self.axis+2) % 3
+        self.ax = (self.axis+1) % 3
+        self.ay = (self.axis+2) % 3
 
     @cython.boundscheck(False)
     @cython.wraparound(False)
@@ -1467,7 +1462,6 @@
         if nv != 8:
             raise NotImplementedError
         cdef VolumeContainer vc
-        cdef int selected
         child_mask = np.ones((1,1,1), dtype="uint8")
         t = np.zeros((1,1,1), dtype="float64")
         dt = np.zeros((1,1,1), dtype="float64") - 1
@@ -1578,7 +1572,7 @@
                      np.ndarray[np.float64_t, ndim=2] left_edges,
                      np.ndarray[np.float64_t, ndim=2] right_edges,
                      np.ndarray[np.int32_t, ndim=2] levels):
-        cdef int i, n
+        cdef int n
         cdef int ng = left_edges.shape[0]
         cdef np.ndarray[np.uint8_t, ndim=1] gridi = np.zeros(ng, dtype='uint8')
         cdef np.ndarray[np.int64_t, ndim=1] oids = self.obj_ids

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/alt_ray_tracers.pyx
--- a/yt/utilities/lib/alt_ray_tracers.pyx
+++ b/yt/utilities/lib/alt_ray_tracers.pyx
@@ -97,7 +97,7 @@
     """
     cdef int i, I
     cdef np.float64_t a, b, bsqrd, twoa
-    cdef np.ndarray[np.float64_t, ndim=1] dp, p1cart, p2cart, dpcart, t, s, \
+    cdef np.ndarray[np.float64_t, ndim=1] p1cart, p2cart, dpcart, t, s, \
                                           rleft, rright, zleft, zright, \
                                           cleft, cright, thetaleft, thetaright, \
                                           tmleft, tpleft, tmright, tpright, tsect
@@ -105,7 +105,6 @@
     cdef np.ndarray[np.float64_t, ndim=2] xyz, rztheta, ptemp, b1, b2, dsect
 
     # set up  points
-    dp = p2 - p1
     ptemp = np.array([p1, p2])
     ptemp = _cyl2cart(ptemp)
     p1cart = ptemp[0]

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/amr_kdtools.pyx
--- a/yt/utilities/lib/amr_kdtools.pyx
+++ b/yt/utilities/lib/amr_kdtools.pyx
@@ -277,7 +277,6 @@
                     int rank,
                     int size):
     cdef int i, j, nless, ngreater
-    cdef np.int64_t gid
     if not should_i_build(node, rank, size):
         return
 
@@ -468,7 +467,7 @@
                         np.uint8_t *less_ids,
                         np.uint8_t *greater_ids,
                        ):
-    cdef int i, j, k, dim, n_unique, best_dim, n_best, addit, my_split
+    cdef int i, j, k, dim, n_unique, best_dim, my_split
     cdef np.float64_t split
     cdef np.float64_t **uniquedims
     cdef np.float64_t *uniques
@@ -542,7 +541,7 @@
                        int rank,
                        int size):
     # Find a Split
-    cdef int i, j, k
+    cdef int i, j
 
     data = <np.float64_t ***> malloc(ngrids * sizeof(np.float64_t**))
     for i in range(ngrids):

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/basic_octree.pyx
--- a/yt/utilities/lib/basic_octree.pyx
+++ b/yt/utilities/lib/basic_octree.pyx
@@ -58,9 +58,8 @@
         self.max_level = imax(self.max_level, level)
 
 cdef void OTN_refine(OctreeNode *self, int incremental = 0):
-    cdef int i, j, k, i1, j1
+    cdef int i, j, k
     cdef np.int64_t npos[3]
-    cdef OctreeNode *node
     for i in range(2):
         npos[0] = self.pos[0] * 2 + i
         for j in range(2):
@@ -134,7 +133,6 @@
                   int nvals, int incremental = False):
         cdef int i, j, k
         self.incremental = incremental
-        cdef OctreeNode *node
         cdef np.int64_t pos[3]
         cdef np.float64_t *vals = <np.float64_t *> alloca(
                 sizeof(np.float64_t)*nvals)
@@ -231,7 +229,6 @@
     def get_all_from_level(self, int level, int count_only = 0):
         cdef int i, j, k
         cdef int total = 0
-        vals = []
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
                 for k in range(self.top_grid_dims[2]):
@@ -374,7 +371,6 @@
         # node in the list that is at the same or lower (coarser) level than
         # this node. This is useful in the treecode for skipping over nodes
         # that don't need to be inspected.
-        cdef int i, j, k
         cdef OctreeNode *initial_next
         cdef OctreeNode *temp_next
         initial_next = node.next
@@ -391,7 +387,6 @@
         # Set treecode = 1 if nodes with no mass are to be skipped in the
         # list.
         cdef int i, j, k, sum, top_grid_total, ii, jj, kk
-        cdef OctreeNode *this_node
         self.last_node = self.root_nodes[0][0][0]
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
@@ -429,9 +424,6 @@
         cdef np.float64_t angle, dist
         cdef OctreeNode *this_node
         cdef OctreeNode *pair_node
-        cdef int pair_count
-        cdef int to_break
-        to_break = 0
         this_node = self.root_nodes[0][0][0]
         while this_node is not NULL:
             # Iterate down the list to a node that either has no children and
@@ -499,7 +491,7 @@
         """
         # The real work is done in fbe_main(), this just sets things up
         # and returns the potential.
-        cdef int i, j, k, sum
+        cdef int i
         cdef np.float64_t potential
         potential = 0.0
         self.opening_angle = opening_angle

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/bitarray.pyx
--- a/yt/utilities/lib/bitarray.pyx
+++ b/yt/utilities/lib/bitarray.pyx
@@ -83,7 +83,7 @@
         arr : array, castable to uint8
             The array we set from.
         """
-        cdef np.uint64_t i, j, elem
+        cdef np.uint64_t i, j
         cdef np.uint8_t *btemp = self.buf
         arr = np.ascontiguousarray(arr)
         j = 0
@@ -108,7 +108,7 @@
             The uint8 values expanded into boolean values
 
         """
-        cdef np.uint64_t i, j, elem
+        cdef np.uint64_t i, j
         cdef np.uint8_t *btemp = self.buf
         cdef np.ndarray[np.uint8_t, ndim=1] output
         output = np.zeros(self.size, "uint8")

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/contour_finding.pyx
--- a/yt/utilities/lib/contour_finding.pyx
+++ b/yt/utilities/lib/contour_finding.pyx
@@ -199,7 +199,7 @@
         # This coalesces contour IDs, so that we have only the final name
         # resolutions -- the .join_id from a candidate.  So many items will map
         # to a single join_id.
-        cdef int i, j, k, ni, nj, nk, nc
+        cdef int i, ni, nc
         cdef CandidateContour *first = NULL
         cdef CandidateContour *temp
         cdef np.int64_t cid1, cid2
@@ -375,8 +375,8 @@
         pg = contours[node_ids[i]][2]
         vcs[i] = pg.container
     cdef np.ndarray[np.uint8_t] examined = np.zeros(n_nodes, "uint8")
-    for nid, cinfo in sorted(contours.items(), key = lambda a: -a[1][0]):
-        level, node_ind, pg, sl = cinfo
+    for _, cinfo in sorted(contours.items(), key = lambda a: -a[1][0]):
+        _, node_ind, pg, _ = cinfo
         construct_boundary_relationships(trunk, tree, node_ind,
             examined, vcs, node_ids)
         examined[node_ind] = 1
@@ -403,7 +403,7 @@
                 np.ndarray[np.int64_t, ndim=1] node_ids):
     # We only look at the boundary and find the nodes next to it.
     # Contours is a dict, keyed by the node.id.
-    cdef int i, j, off_i, off_j, oi, oj, level, ax, ax0, ax1, n1, n2
+    cdef int i, j, off_i, off_j, oi, oj, ax, ax0, ax1, n1, n2
     cdef np.int64_t c1, c2
     cdef Node adj_node
     cdef VolumeContainer *vc1
@@ -474,8 +474,7 @@
 def update_joins(np.ndarray[np.int64_t, ndim=2] joins,
                  np.ndarray[np.int64_t, ndim=3] contour_ids,
                  np.ndarray[np.int64_t, ndim=1] final_joins):
-    cdef np.int64_t new, old
-    cdef int i, j, nj, nf
+    cdef int j, nj, nf
     cdef int ci, cj, ck
     nj = joins.shape[0]
     nf = final_joins.shape[0]
@@ -530,9 +529,8 @@
         cdef Oct **neighbors = NULL
         cdef OctInfo oi
         cdef ContourID *c0
-        cdef ContourID *c1
         cdef np.int64_t moff = octree.get_domain_offset(domain_id + domain_offset)
-        cdef np.int64_t i, j, k, n, nneighbors, pind0, offset
+        cdef np.int64_t i, j, k, n, nneighbors = -1, pind0, offset
         cdef int counter = 0
         cdef int verbose = 0
         pcount = np.zeros_like(dom_ind)
@@ -540,7 +538,6 @@
         # First, we find the oct for each particle.
         pdoms = np.zeros(positions.shape[0], dtype="int64")
         pdoms -= -1
-        cdef np.int64_t *pdom = <np.int64_t*> pdoms.data
         # First we allocate our container
         cdef ContourID **container = <ContourID**> malloc(
             sizeof(ContourID*) * positions.shape[0])
@@ -572,7 +569,6 @@
         cdef np.int64_t *nind = <np.int64_t *> malloc(sizeof(np.int64_t)*nsize)
         counter = 0
         cdef np.int64_t frac = <np.int64_t> (doff.shape[0] / 20.0)
-        cdef int inside, skip_early
         if verbose == 1: print >> sys.stderr, "Will be outputting every", frac
         for i in range(doff.shape[0]):
             if verbose == 1 and counter >= frac:
@@ -658,7 +654,7 @@
         cdef ContourID *c0
         cdef ContourID *c1
         cdef np.int64_t pind1
-        cdef int i, j, k
+        cdef int i, j
         # We use pid here so that we strictly take new ones.
         # Note that pind0 will not monotonically increase, but
         c0 = container[pind0]
@@ -710,7 +706,6 @@
     cdef int i
     cdef np.float64_t r2, DR
     r2 = 0.0
-    cdef int inside = 0
     for i in range(3):
         if cpos[i] < edges[0][i]:
             return 0

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/depth_first_octree.pyx
--- a/yt/utilities/lib/depth_first_octree.pyx
+++ b/yt/utilities/lib/depth_first_octree.pyx
@@ -61,8 +61,6 @@
     cdef int child_i, child_j, child_k
     cdef OctreeGrid child_grid
     cdef OctreeGrid grid = grids[gi]
-    cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
-    cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
     cdef np.float64_t dx = grid.dx[0]
@@ -118,7 +116,6 @@
     cdef OctreeGrid grid = grids[gi-1]
     cdef int level = grid.level
     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
-    cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
     cdef np.float64_t dx = grid.dx[0]
@@ -126,10 +123,10 @@
     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
     cdef np.float64_t cx, cy, cz
     cdef int cp
+    s = None
     for i_off in range(i_f):
         i = i_off + i_i
         cx = (leftedges[0] + i*dx)
-        if i_f > 2: print k, cz
         for j_off in range(j_f):
             j = j_off + j_i
             cy = (leftedges[1] + j*dx)

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/element_mappings.pyx
--- a/yt/utilities/lib/element_mappings.pyx
+++ b/yt/utilities/lib/element_mappings.pyx
@@ -124,9 +124,6 @@
     cdef void map_real_to_unit(self, double* mapped_x, 
                                double* vertices, double* physical_x) nogil:
     
-        cdef int i
-        cdef double d
-        cdef double[3] bvec
         cdef double[3] col0
         cdef double[3] col1
         cdef double[3] col2
@@ -293,7 +290,7 @@
                                double* vertices,
                                double* physical_x) nogil:
         cdef int i
-        cdef double d, val
+        cdef double d
         cdef double[3] f 
         cdef double[3] r
         cdef double[3] s
@@ -800,7 +797,7 @@
                                double* vertices,
                                double* physical_x) nogil:
         cdef int i
-        cdef double d, val
+        cdef double d
         cdef double[2] f
         cdef double[2] x
         cdef double[4] A
@@ -897,8 +894,7 @@
                               double* x,
                               double* vertices,
                               double* phys_x) nogil:
-    cdef int i
-    cdef double rm, rp, sm, sp, tm, tp
+    cdef double rm, rp, sm, sp
 
     rm = 1.0 - x[0]
     rp = 1.0 + x[0]

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/field_interpolation_tables.pxd
--- a/yt/utilities/lib/field_interpolation_tables.pxd
+++ b/yt/utilities/lib/field_interpolation_tables.pxd
@@ -56,7 +56,7 @@
 @cython.cdivision(True)
 cdef inline np.float64_t FIT_get_value(FieldInterpolationTable *fit,
                                        np.float64_t dvs[6]) nogil:
-    cdef np.float64_t bv, dy, dd, tf, rv
+    cdef np.float64_t bv, dy, dd
     cdef int bin_id
     if dvs[fit.field_id] >= fit.bounds[1] or dvs[fit.field_id] <= fit.bounds[0]: return 0.0
     if not isnormal(dvs[fit.field_id]): return 0.0
@@ -76,8 +76,8 @@
                             np.float64_t *rgba, int n_fits,
                             FieldInterpolationTable fits[6],
                             int field_table_ids[6], int grey_opacity) nogil:
-    cdef int i, fid, use
-    cdef np.float64_t ta, tf, ttot, dot_prod
+    cdef int i, fid
+    cdef np.float64_t ta
     cdef np.float64_t istorage[6]
     cdef np.float64_t trgba[6]
     for i in range(6): istorage[i] = 0.0
@@ -106,8 +106,8 @@
         np.float64_t *rgba, int n_fits,
         FieldInterpolationTable fits[6],
         int field_table_ids[6], int grey_opacity) nogil:
-    cdef int i, fid, use
-    cdef np.float64_t ta, tf, dot_prod
+    cdef int i, fid
+    cdef np.float64_t ta, dot_prod
     cdef np.float64_t istorage[6]
     cdef np.float64_t trgba[6]
     dot_prod = 0.0

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/fortran_reader.pyx
--- a/yt/utilities/lib/fortran_reader.pyx
+++ b/yt/utilities/lib/fortran_reader.pyx
@@ -60,12 +60,12 @@
                    int nhydro_vars,
                    level_info):
     cdef int nchild = 8
-    cdef int i, Lev, next_record, nLevel
+    cdef int next_record = -1, nLevel = -1
     cdef int dummy_records[9]
-    cdef int readin
+    cdef int readin = -1
     cdef FILE *f = fopen(fn, "rb")
     fseek(f, offset, SEEK_SET)
-    for Lev in range(min_level + 1, max_level + 1):
+    for _ in range(min_level + 1, max_level + 1):
         fread(dummy_records, sizeof(int), 2, f);
         fread(&nLevel, sizeof(int), 1, f); FIX_LONG(nLevel)
         print level_info
@@ -101,24 +101,20 @@
     # nOct.  For those following along at home, we only need to read:
     #   iOctPr, iOctLv
     cdef int nchild = 8
-    cdef int i, Lev, cell_ind, iOct, nLevel, nLevCells, ic1
-    cdef np.int64_t next_record
+    cdef int iOct, nLevel, ic1
+    cdef np.int64_t next_record = -1
     cdef long long child_record
-    cdef int idc, cm
     cdef int iOctPs[3]
     cdef np.int64_t dummy_records[9]
-    cdef int readin
+    cdef int readin = -1
     cdef FILE *f = fopen(fn, "rb")
     fseek(f, offset, SEEK_SET)
-    cdef int Level
+    cdef int Level = -1
     cdef int * iNOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
     cdef int * iHOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
-    cell_ind = 0
-    cdef int total_cells = 0, total_masked
     cdef int iOctMax = 0
     level_offsets = [0]
-    idc = 0
-    for Lev in range(min_level + 1, max_level + 1):
+    for _ in range(min_level + 1, max_level + 1):
         fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
         fread(&Level, sizeof(int), 1, f); FIX_LONG(Level)
         fread(&iNOLL[Level], sizeof(int), 1, f); FIX_LONG(iNOLL[Level])
@@ -154,7 +150,6 @@
             fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
             assert readin==52
 
-        total_masked = 0
         level_offsets.append(ftell(f))
 
         #skip over the hydro variables
@@ -194,7 +189,7 @@
 
     cdef FILE *f = fopen(fn, "rb")
     cdef int j,l, cell_record_size = nhydro_vars * sizeof(float)
-    cdef float temp
+    cdef float temp = -1
     l=0
     fseek(f, root_grid_offset, SEEK_SET)
     # Now we seet out the cell we want
@@ -219,9 +214,9 @@
     # nhydro_vars is the number of columns- 3 (adjusting for vars)
     # this is normally 10=(8+2chem species)
     cdef int record_size = 2+1+1+nhydro_vars+2
-    cdef float temp
+    cdef float temp = -1.0
     cdef float varpad[2]
-    cdef int new_padding
+    cdef int new_padding = -1
     cdef int padding[3]
     cdef long offset = 8*grid_id*record_size*sizeof(float)
     fseek(f, level_offsets[grid_level] + offset, SEEK_SET)
@@ -251,7 +246,7 @@
               np.ndarray[np.float32_t, ndim=2] level_data,
               int level, int ref_factor,
               component_grid_info):
-    cdef int gi, i, j, k, domain, offset, grid_id
+    cdef int gi, i, j, k, grid_id
     cdef int ir, jr, kr
     cdef int offi, offj, offk, odind
     cdef np.int64_t di, dj, dk
@@ -267,8 +262,6 @@
         end_index[i] = start_index[i] + grid_dims[i]
     for gi in range(len(component_grid_info)):
         ogrid_info = component_grid_info[gi]
-        domain = ogrid_info[0]
-        #print "Loading", domain, ogrid_info
         grid_id = ogrid_info[1]
         og_start_index = ogrid_info[3:6] #the oct left edge
         for i in range(2*ref_factor):

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/geometry_utils.pyx
--- a/yt/utilities/lib/geometry_utils.pyx
+++ b/yt/utilities/lib/geometry_utils.pyx
@@ -498,9 +498,8 @@
                              np.ndarray[np.float64_t, ndim=3] triangles):
     cdef np.float64_t p0[3]
     cdef np.float64_t p1[3]
-    cdef np.float64_t p2[3]
     cdef np.float64_t p3[3]
-    cdef int i, j, k, count, i0, i1, i2, ntri, nlines
+    cdef int i, j, k, count, ntri, nlines
     nlines = 0
     ntri = triangles.shape[0]
     cdef PointSet *first

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -289,7 +289,7 @@
             self.extent_function = calculate_extent_null
             self.vector_function = generate_vector_info_null
         self.sampler = NULL
-        cdef int i, j
+        cdef int i
         # These assignments are so we can track the objects and prevent their
         # de-allocation from reference counts.  Note that we do this to the
         # "atleast_3d" versions.  Also, note that we re-assign the input
@@ -319,8 +319,7 @@
         # This routine will iterate over all of the vectors and cast each in
         # turn.  Might benefit from a more sophisticated intersection check,
         # like http://courses.csusm.edu/cs697exz/ray_box.htm
-        cdef int vi, vj, hit, i, j, k, ni, nj, nn, xi, yi
-        cdef np.int64_t offset
+        cdef int vi, vj, hit, i, j
         cdef np.int64_t iter[4]
         cdef VolumeContainer *vc = pg.container
         cdef ImageContainer *im = self.image
@@ -328,7 +327,6 @@
         if self.sampler == NULL: raise RuntimeError
         cdef np.float64_t *v_pos
         cdef np.float64_t *v_dir
-        cdef np.float64_t rgba[6]
         cdef np.float64_t max_t
         hit = 0
         cdef np.int64_t nx, ny, size
@@ -342,7 +340,6 @@
         size = nx * ny
         cdef ImageAccumulator *idata
         cdef np.float64_t width[3]
-        cdef int use_vec, max_i
         for i in range(3):
             width[i] = self.width[i]
         with nogil, parallel(num_threads = num_threads):
@@ -421,7 +418,6 @@
     # we assume this has vertex-centered data.
     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
                     + index[1] * (vc.dims[2] + 1) + index[2]
-    cdef np.float64_t slopes[6]
     cdef np.float64_t dp[3]
     cdef np.float64_t ds[3]
     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
@@ -456,7 +452,6 @@
                   n_samples = 10, **kwargs):
         ImageSampler.__init__(self, vp_pos, vp_dir, center, bounds, image,
                                x_vec, y_vec, width, **kwargs)
-        cdef int i
         # Now we handle tf_obj
         self.vra = <VolumeRenderAccumulator *> \
             malloc(sizeof(VolumeRenderAccumulator))
@@ -487,7 +482,6 @@
                     + index[1] * (vc.dims[2]) + index[2]
     if vc.mask[cell_offset] != 1:
         return
-    cdef np.float64_t slopes[6]
     cdef np.float64_t dp[3]
     cdef np.float64_t ds[3]
     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
@@ -524,7 +518,6 @@
     # we assume this has vertex-centered data.
     cdef int offset = index[0] * (vc.dims[1] + 1) * (vc.dims[2] + 1) \
                     + index[1] * (vc.dims[2] + 1) + index[2]
-    cdef np.float64_t slopes[6]
     cdef np.float64_t dp[3]
     cdef np.float64_t ds[3]
     cdef np.float64_t dt = (exit_t - enter_t) / vri.n_samples
@@ -562,7 +555,7 @@
                    np.ndarray[np.float64_t, ndim=1] pos_y,
                    np.ndarray[np.float64_t, ndim=1] pos_z,
                    np.ndarray[np.float64_t, ndim=2] star_colors):
-        cdef int i, n
+        cdef int i
         cdef np.float64_t *pointer = <np.float64_t *> star_colors.data
         for i in range(pos_x.shape[0]):
             kdtree_utils.kd_insert3(self.tree,
@@ -597,9 +590,10 @@
     cdef np.float64_t cell_left[3]
     cdef np.float64_t local_dds[3]
     cdef np.float64_t pos[3]
-    cdef int nstars, dti, i, j
+    cdef int nstars, i, j
     cdef np.float64_t *colors = NULL
     cdef np.float64_t gexp, gaussian, px, py, pz
+    px = py = pz = -1
     for i in range(3):
         dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i]
         dp[i] -= index[i] * vc.dds[i] + vc.left_edge[i]
@@ -628,7 +622,7 @@
                          vc.data[i] + offset)
         slopes[i] *= -1.0/vri.n_samples
         dvs[i] = temp
-    for dti in range(vri.n_samples):
+    for _ in range(vri.n_samples):
         # Now we add the contribution from stars
         kdtree_utils.kd_res_rewind(ballq)
         for i in range(nstars):
@@ -797,13 +791,13 @@
                      np.float64_t max_t = 1.0) nogil:
     cdef int cur_ind[3]
     cdef int step[3]
-    cdef int x, y, i, n, flat_ind, hit, direction
+    cdef int x, y, i, hit, direction
     cdef np.float64_t intersect_t = 1.1
     cdef np.float64_t iv_dir[3]
     cdef np.float64_t tmax[3]
     cdef np.float64_t tdelta[3]
-    cdef np.float64_t dist, alpha, dt, exit_t, enter_t = -1.0
-    cdef np.float64_t tr, tl, temp_x, temp_y, dv
+    cdef np.float64_t exit_t = -1.0, enter_t = -1.0
+    cdef np.float64_t tl, temp_x, temp_y = -1
     if max_t > 1.0: max_t = 1.0
     direction = -1
     if vc.left_edge[0] <= v_pos[0] and v_pos[0] <= vc.right_edge[0] and \
@@ -1089,7 +1083,7 @@
     # http://paulbourke.net/miscellaneous/domefisheye/fisheye/
     # ...but all in Cython.
     cdef np.ndarray[np.float64_t, ndim=3] vp
-    cdef int i, j, k
+    cdef int i, j
     cdef np.float64_t r, phi, theta, px, py
     cdef np.float64_t fov_rad = fov * np.pi / 180.0
     cdef int nx = resolution/nimx

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/image_utilities.pyx
--- a/yt/utilities/lib/image_utilities.pyx
+++ b/yt/utilities/lib/image_utilities.pyx
@@ -20,7 +20,7 @@
         np.ndarray[np.float64_t, ndim=1] px,
         np.ndarray[np.float64_t, ndim=1] py,
         np.ndarray[np.float64_t, ndim=1] pv):
-    cdef int i, j, k, pi
+    cdef int i, j, pi
     cdef int np = px.shape[0]
     cdef int xs = buffer.shape[0]
     cdef int ys = buffer.shape[1]
@@ -67,7 +67,6 @@
     cdef int npart = px.shape[0]
     cdef int xs = buffer.shape[0]
     cdef int ys = buffer.shape[1]
-    cdef int v
     #iv = iclip(<int>(pv * 255), 0, 255)
     for pi in range(npart):
         j = <int> (xs * px[pi])

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/interpolators.pyx
--- a/yt/utilities/lib/interpolators.pyx
+++ b/yt/utilities/lib/interpolators.pyx
@@ -27,7 +27,7 @@
                            np.ndarray[np.int32_t, ndim=1] x_is,
                            np.ndarray[np.float64_t, ndim=1] output):
     cdef double x, xp, xm
-    cdef int i, x_i, y_i
+    cdef int i, x_i
     for i in range(x_vals.shape[0]):
         x_i = x_is[i]
         x = x_vals[i]
@@ -128,7 +128,7 @@
     cdef np.float64_t iids[3]
     cdef np.float64_t opos[3]
     cdef np.float64_t ropos[3]
-    cdef int i, j
+    cdef int i
     for i in range(3):
         temp = input_left[i] + (rf * (input_field.shape[i] - 1))
         ids[i] = (temp - input_left[i])/(input_field.shape[i]-1)

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/line_integral_convolution.pyx
--- a/yt/utilities/lib/line_integral_convolution.pyx
+++ b/yt/utilities/lib/line_integral_convolution.pyx
@@ -67,8 +67,7 @@
         np.ndarray[double, ndim=1] kernel):
     cdef int i,j,l,x,y
     cdef int h,w,kernellen
-    cdef int t
-    cdef double fx, fy, tx, ty
+    cdef double fx, fy
     cdef np.ndarray[double, ndim=2] result
 
     w = vectors.shape[0]

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/marching_cubes.pyx
--- a/yt/utilities/lib/marching_cubes.pyx
+++ b/yt/utilities/lib/marching_cubes.pyx
@@ -60,14 +60,12 @@
 cdef void FillTriangleValues(np.ndarray[np.float64_t, ndim=1] values,
                              Triangle *first, int nskip = 1):
     cdef Triangle *this = first
-    cdef Triangle *last
     cdef int i = 0
     cdef int j
     while this != NULL:
         for j in range(nskip):
             values[i*nskip + j] = this.val[j]
         i += 1
-        last = this
         this = this.next
 
 cdef void WipeTriangles(Triangle *first):
@@ -179,7 +177,7 @@
     cdef np.float64_t idds[3]
     cdef np.float64_t *intdata = NULL
     cdef np.float64_t *sdata = NULL
-    cdef np.float64_t x, y, z, do_sample
+    cdef np.float64_t do_sample
     cdef np.ndarray[np.float64_t, ndim=3] sample
     cdef np.ndarray[np.float64_t, ndim=1] sampled
     cdef TriangleCollection triangles
@@ -254,7 +252,7 @@
     if do_sample == 0:
         FillAndWipeTriangles(vertices, triangles.first)
         return vertices
-    cdef int nskip
+    cdef int nskip = 0
     if do_sample == 1:
         nskip = 1
     elif do_sample == 2:

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/mesh_construction.pyx
--- a/yt/utilities/lib/mesh_construction.pyx
+++ b/yt/utilities/lib/mesh_construction.pyx
@@ -128,7 +128,7 @@
     cdef void _build_from_indices(self, YTEmbreeScene scene,
                                   np.ndarray vertices_in,
                                   np.ndarray indices_in):
-        cdef int i, j, ind
+        cdef int i, j
         cdef int nv = vertices_in.shape[0]
         cdef int ne = indices_in.shape[0]
         cdef int nt = self.tpe*ne
@@ -264,7 +264,6 @@
                                   np.ndarray indices_in,
                                   np.ndarray field_data):
         cdef int i, j, ind, idim
-        cdef int nv = vertices_in.shape[0]
         cdef int ne = indices_in.shape[0]
         cdef int npatch = 6*ne;
 

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/mesh_samplers.pyx
--- a/yt/utilities/lib/mesh_samplers.pyx
+++ b/yt/utilities/lib/mesh_samplers.pyx
@@ -310,7 +310,7 @@
 @cython.cdivision(True)
 cdef void sample_element(void* userPtr,
                          rtcr.RTCRay& ray) nogil:
-    cdef int ray_id, elem_id, i
+    cdef int ray_id, elem_id
     cdef double val
     cdef MeshDataContainer* data
 

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/mesh_traversal.pyx
--- a/yt/utilities/lib/mesh_traversal.pyx
+++ b/yt/utilities/lib/mesh_traversal.pyx
@@ -62,15 +62,11 @@
         '''
 
         rtcs.rtcCommit(scene.scene_i)
-        cdef int vi, vj, i, j, ni, nj, nn
-        cdef np.int64_t offset
+        cdef int vi, vj, i, j
         cdef ImageContainer *im = self.image
-        cdef np.int64_t elemID
-        cdef np.float64_t value
         cdef np.float64_t *v_pos
         cdef np.float64_t *v_dir
         cdef np.int64_t nx, ny, size
-        cdef np.float64_t px, py
         cdef np.float64_t width[3]
         for i in range(3):
             width[i] = self.width[i]

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/misc_utilities.pyx
--- a/yt/utilities/lib/misc_utilities.pyx
+++ b/yt/utilities/lib/misc_utilities.pyx
@@ -166,7 +166,6 @@
                   np.ndarray[np.float64_t, ndim=2] qresult,
                   np.ndarray[np.float64_t, ndim=2] used):
     cdef int n, bini, binj
-    cdef np.int64_t bin
     cdef np.float64_t wval, bval
     for n in range(bins_x.shape[0]):
         bini = bins_x[n]
@@ -195,7 +194,6 @@
                   np.ndarray[np.float64_t, ndim=3] qresult,
                   np.ndarray[np.float64_t, ndim=3] used):
     cdef int n, bini, binj, bink
-    cdef np.int64_t bin
     cdef np.float64_t wval, bval
     for n in range(bins_x.shape[0]):
         bini = bins_x[n]
@@ -228,7 +226,7 @@
     cdef int nl = xs.shape[0]
     cdef np.float64_t alpha[4]
     cdef np.float64_t outa
-    cdef int i, j
+    cdef int i, j, xi, yi
     cdef int dx, dy, sx, sy, e2, err
     cdef np.int64_t x0, x1, y0, y1
     cdef int has_alpha = (image.shape[2] == 4)
@@ -278,7 +276,7 @@
                             yi0 = yi
 
                         if no_color:
-                            image[xi, yi0, 0] = fmin(alpha[i], image[xi, yi0, 0])
+                            image[xi, yi0, 0] = fmin(alpha[0], image[xi, yi0, 0])
                         elif has_alpha:
                             image[xi, yi0, 3] = outa = alpha[3] + image[xi, yi0, 3]*(1-alpha[3])
                             if outa != 0.0:
@@ -322,13 +320,10 @@
     cdef int ny = image.shape[1]
     cdef int nl = xs.shape[0]
     cdef np.float64_t alpha[4]
-    cdef np.float64_t outa
     cdef int i, j
     cdef int dx, dy, sx, sy, e2, err
     cdef np.int64_t x0, x1, y0, y1, yi0
     cdef np.float64_t z0, z1, dzx, dzy
-    cdef int has_alpha = (image.shape[2] == 4)
-    cdef int no_color = (image.shape[2] < 3)
     for j in range(0, nl, 2):
         # From wikipedia http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
         x0 = xs[j]
@@ -362,7 +357,7 @@
             elif (y0 < thick and sy == -1): break
             elif (y0 >= ny-thick+1 and sy == 1): break
             if x0 >= thick and x0 < nx-thick and y0 >= thick and y0 < ny-thick:
-                for xi in range(x0-thick/2, x0+(1+thick)/2):
+                for _ in range(x0-thick/2, x0+(1+thick)/2):
                     for yi in range(y0-thick/2, y0+(1+thick)/2):
                         if flip:
                             yi0 = ny - yi
@@ -494,7 +489,7 @@
 def kdtree_get_choices(np.ndarray[np.float64_t, ndim=3] data,
                        np.ndarray[np.float64_t, ndim=1] l_corner,
                        np.ndarray[np.float64_t, ndim=1] r_corner):
-    cdef int i, j, k, dim, n_unique, best_dim, n_best, n_grids, addit, my_split
+    cdef int i, j, k, dim, n_unique, best_dim, n_grids, my_split
     n_grids = data.shape[0]
     cdef np.float64_t **uniquedims
     cdef np.float64_t *uniques
@@ -505,6 +500,7 @@
                 alloca(2*n_grids * sizeof(np.float64_t))
     my_max = 0
     best_dim = -1
+    my_split = -1
     for dim in range(3):
         n_unique = 0
         uniques = uniquedims[dim]
@@ -536,6 +532,8 @@
         #print "Setting tarr: ", i, uniquedims[best_dim][i]
         tarr[i] = uniquedims[best_dim][i]
     tarr.sort()
+    if my_split < 0:
+        raise RuntimeError
     split = tarr[my_split]
     cdef np.ndarray[np.uint8_t, ndim=1] less_ids = np.empty(n_grids, dtype='uint8')
     cdef np.ndarray[np.uint8_t, ndim=1] greater_ids = np.empty(n_grids, dtype='uint8')
@@ -784,7 +782,7 @@
                 np.int64_t refine_by = 2
                 ):
     cdef int i, n
-    cdef np.int64_t tot, oi, oj, ok, rf
+    cdef np.int64_t tot = 0, oi, oj, ok, rf
     cdef np.int64_t iind[3]
     cdef np.int64_t oind[3]
     cdef np.int64_t dim[3]
@@ -865,11 +863,22 @@
                       period = None,
                       int check_period = 1):
     cdef np.float64_t ds_period[3]
-    cdef np.float64_t box_dds[3], box_idds[3], width[3], LE[3], RE[3]
-    cdef np.int64_t i, j, k, p, xi, yi, ji
-    cdef np.int64_t dims[3], ld[3], ud[3]
+    cdef np.float64_t box_dds[3]
+    cdef np.float64_t box_idds[3]
+    cdef np.float64_t width[3]
+    cdef np.float64_t LE[3]
+    cdef np.float64_t RE[3]
+    cdef np.int64_t i, j, k, p, xi, yi
+    cdef np.int64_t dims[3]
+    cdef np.int64_t ld[3]
+    cdef np.int64_t ud[3]
     cdef np.float64_t overlap[3]
-    cdef np.float64_t dsp, osp[3], odsp[3], sp[3], lfd[3], ufd[3]
+    cdef np.float64_t dsp
+    cdef np.float64_t osp[3]
+    cdef np.float64_t odsp[3]
+    cdef np.float64_t sp[3]
+    cdef np.float64_t lfd[3]
+    cdef np.float64_t ufd[3]
     # These are the temp vars we get from the arrays
     # Some periodicity helpers
     cdef int diter[3][2]

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/particle_mesh_operations.pyx
--- a/yt/utilities/lib/particle_mesh_operations.pyx
+++ b/yt/utilities/lib/particle_mesh_operations.pyx
@@ -178,10 +178,9 @@
                               np.ndarray[np.float64_t, ndim=1] pos_y,
                               np.ndarray[np.float64_t, ndim=1] pos_z):
     cdef np.float64_t idds[3]
-    cdef np.float64_t pp[3]
     cdef int dims[3]
     cdef int ind[3]
-    cdef int i, j, npart
+    cdef int i, npart
     npart = pos_x.shape[0]
     cdef np.ndarray[np.float64_t, ndim=1] sample
     sample = np.zeros(npart, dtype='float64')
@@ -348,9 +347,8 @@
     #every particle we are fed, we can assume it exists on our grid
     #must fill in the grid_particle_count array
     #and particle_indices for every grid
-    cdef long i,j,level
+    cdef long i, j
     cdef long npart = pos_x.shape[0]
-    cdef long ncells = left_edges.shape[0]
     cdef np.ndarray[np.int32_t, ndim=1] assigned       = np.zeros(npart,dtype='int32')
     cdef np.ndarray[np.int32_t, ndim=1] never_assigned = np.ones(npart,dtype='int32')
     for i in np.unique(grid.child_index_mask):

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/pixelization_routines.pyx
--- a/yt/utilities/lib/pixelization_routines.pyx
+++ b/yt/utilities/lib/pixelization_routines.pyx
@@ -65,15 +65,16 @@
     cdef np.float64_t x_min, x_max, y_min, y_max
     cdef np.float64_t period_x = 0.0, period_y = 0.0
     cdef np.float64_t width, height, px_dx, px_dy, ipx_dx, ipx_dy
-    cdef int nx, ny, ndx, ndy
     cdef int i, j, p, xi, yi
     cdef int lc, lr, rc, rr
     cdef np.float64_t lypx, rypx, lxpx, rxpx, overlap1, overlap2
     # These are the temp vars we get from the arrays
     cdef np.float64_t oxsp, oysp, xsp, ysp, dxsp, dysp, dsp
     # Some periodicity helpers
-    cdef int xiter[2], yiter[2]
-    cdef np.float64_t xiterv[2], yiterv[2]
+    cdef int xiter[2]
+    cdef int yiter[2]
+    cdef np.float64_t xiterv[2]
+    cdef np.float64_t yiterv[2]
     cdef np.ndarray[np.float64_t, ndim=2] my_array
     if period is not None:
         period_x = period[0]
@@ -380,8 +381,7 @@
     cdef np.ndarray[np.float64_t, ndim=2] img
     cdef int i, j, nf, fi
     cdef np.float64_t x, y, z, zb
-    cdef np.float64_t dx, dy, inside
-    cdef np.float64_t theta1, dtheta1, phi1, dphi1
+    cdef np.float64_t dx, dy
     cdef np.float64_t theta0, phi0, theta_p, dtheta_p, phi_p, dphi_p
     cdef np.float64_t PI = np.pi
     cdef np.float64_t s2 = math.sqrt(2.0)
@@ -400,6 +400,7 @@
     # through the theta, phi arrays, it should be faster.
     dx = 2.0 / (img.shape[0] - 1)
     dy = 2.0 / (img.shape[1] - 1)
+    x = y = 0
     for fi in range(nf):
         theta_p = (theta[fi] + theta_offset) - PI
         dtheta_p = dtheta[fi]
@@ -475,8 +476,13 @@
     # and the centroid.
     # So, let's compute these vectors.  See above where these are written out
     # for ease of use.
-    cdef np.float64_t vec1[3], vec2[3], cp_vec[3], dp, npoint[3]
-    cdef np.uint8_t faces[MAX_NUM_FACES][2][2], nf
+    cdef np.float64_t vec1[3]
+    cdef np.float64_t vec2[3]
+    cdef np.float64_t cp_vec[3]
+    cdef np.float64_t npoint[3]
+    cdef np.float64_t dp
+    cdef np.uint8_t faces[MAX_NUM_FACES][2][2]
+    cdef np.uint8_t nf
     if nvertices == 4:
         faces = tetra_face_defs
         nf = TETRA_NF
@@ -538,12 +544,17 @@
     # mapped coordinate system, and check whether the result in in-bounds or not
     # Note that we have to have a pseudo-3D pixel buffer.  One dimension will
     # always be 1.
-    cdef np.float64_t pLE[3], pRE[3]
-    cdef np.float64_t LE[3], RE[3]
+    cdef np.float64_t pLE[3]
+    cdef np.float64_t pRE[3]
+    cdef np.float64_t LE[3]
+    cdef np.float64_t RE[3]
     cdef int use
-    cdef np.int64_t n, i, j, k, pi, pj, pk, ci, cj, ck
-    cdef np.int64_t pstart[3], pend[3]
-    cdef np.float64_t ppoint[3], idds[3], dds[3]
+    cdef np.int64_t n, i, pi, pj, pk, ci, cj
+    cdef np.int64_t pstart[3]
+    cdef np.int64_t pend[3]
+    cdef np.float64_t ppoint[3]
+    cdef np.float64_t idds[3]
+    cdef np.float64_t dds[3]
     cdef np.float64_t *vertices
     cdef np.float64_t *field_vals
     cdef int nvertices = conn.shape[1]
@@ -573,9 +584,13 @@
     if ndim == 2:
         assert(buff_size[2] == 1)
     
+    ax = -1
     for i in range(3):
         if buff_size[i] == 1:
             ax = i
+    if ax == -1:
+        raise RuntimeError
+    xax = yax = -1
     if ax == 0:
         xax = 1
         yax = 2
@@ -585,6 +600,8 @@
     elif ax == 2:
         xax = 0
         yax = 1
+    if xax == -1 or yax == -1:
+        raise RuntimeError
 
     # allocate temporary storage
     num_mapped_coords = sampler.num_mapped_coords

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/points_in_volume.pyx
--- a/yt/utilities/lib/points_in_volume.pyx
+++ b/yt/utilities/lib/points_in_volume.pyx
@@ -85,7 +85,7 @@
                    np.ndarray[np.int32_t, ndim=3] mask,
                    int break_first):
     cdef int n[3]
-    cdef i, j, k, ax
+    cdef i, j, k
     cdef np.float64_t rds[3][3]
     cdef np.float64_t cur_pos[3]
     cdef np.float64_t rorigin[3]
@@ -171,7 +171,6 @@
     cdef np.float64_t a_vec[3][3]
     cdef np.float64_t sep_ax[15][3]
     cdef np.float64_t sep_vec[3]
-    cdef np.float64_t norm
     cdef np.ndarray[np.int32_t, ndim=1] good = np.zeros(n, dtype='int32')
     cdef np.ndarray[np.float64_t, ndim=2] grid_centers
     # Fill in our axis unit vectors
@@ -225,7 +224,7 @@
     cdef np.int64_t gend[3]
     cdef np.int64_t dw[3]
     cdef np.int64_t cxi, cyi, czi, gxi, gyi, gzi, ci, cj, ck
-    cdef int i, total
+    cdef int i, total = 0
     for i in range(3):
         dw[i] = domain_width[i]
         cgstart[i] = cg_start_index[i]

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/quad_tree.pyx
--- a/yt/utilities/lib/quad_tree.pyx
+++ b/yt/utilities/lib/quad_tree.pyx
@@ -56,9 +56,8 @@
     self.weight_val = 1.0
 
 cdef void QTN_refine(QuadTreeNode *self, int nvals):
-    cdef int i, j, i1, j1
+    cdef int i, j
     cdef np.int64_t npos[2]
-    cdef QuadTreeNode *node
     cdef np.float64_t *tvals = <np.float64_t *> alloca(
             sizeof(np.float64_t) * nvals)
     for i in range(nvals): tvals[i] = 0.0
@@ -120,7 +119,6 @@
         self.merged = 1
         self.max_level = 0
         cdef int i, j
-        cdef QuadTreeNode *node
         cdef np.int64_t pos[2]
         cdef np.float64_t *vals = <np.float64_t *> malloc(
                 sizeof(np.float64_t)*nvals)
@@ -213,7 +211,6 @@
         elif method == "integrate" or method == 1:
             self.merged = 1
         cdef int curpos = 0
-        cdef QuadTreeNode *root
         self.num_cells = wval.shape[0]
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
@@ -255,7 +252,6 @@
             return -1
         if level > self.max_level:
             self.max_level = level
-        cdef np.int64_t fac
         for L in range(level):
             if node.children[0][0] == NULL:
                 QTN_refine(node, self.nvals)
@@ -332,7 +328,6 @@
             np.ndarray[np.int64_t, ndim=1] level):
         cdef int num = pxs.shape[0]
         cdef int p, rv
-        cdef np.float64_t *vals
         cdef np.int64_t pos[2]
         for p in range(num):
             pos[0] = pxs[p]
@@ -350,7 +345,6 @@
     def get_all(self, int count_only = 0, int method = 1):
         cdef int i, j, vi
         cdef int total = 0
-        vals = []
         self.merged = method
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
@@ -461,8 +455,9 @@
         cdef np.float64_t dds[2]
         cdef int nn[2]
         cdef int i, j
-        cdef np.float64_t bounds[4], opos[4]
-        cdef np.float64_t weight, value = 0.0
+        cdef np.float64_t bounds[4]
+        cdef np.float64_t opos[4]
+        cdef np.float64_t weight = 0.0, value = 0.0
         cdef np.float64_t *wval = NULL
         if weighted == 1:
             wval = &weight
@@ -471,7 +466,6 @@
         for i in range(2):
             nn[i] = buffer.shape[i]
             dds[i] = (bounds[i*2 + 1] - bounds[i*2])/nn[i]
-        cdef QuadTreeNode *node
         pos[0] = bounds[0]
         opos[0] = opos[1] = pos[0] + dds[0]
         for i in range(nn[0]):

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/ragged_arrays.pyx
--- a/yt/utilities/lib/ragged_arrays.pyx
+++ b/yt/utilities/lib/ragged_arrays.pyx
@@ -84,12 +84,12 @@
         func = r_min
     else:
         raise NotImplementedError
-    cdef np.int64_t i, j, ind_ind, ind_arr
+    cdef np.int64_t i, ind_ind, ind_arr
     ind_ind = 0
     for i in range(sizes.size):
         # Each entry in sizes is the size of the array
         val = ival
-        for j in range(sizes[i]):
+        for _ in range(sizes[i]):
             ind_arr = indices[ind_ind]
             val = func(val, values[ind_arr])
             ind_ind += 1

diff -r 29b4b633e95188794e985934b7d3cfe2d158ad78 -r ccd5c2bf28d081a7ce4b2e2faa4c08fe9d0c37b0 yt/utilities/lib/ray_integrators.pyx
--- a/yt/utilities/lib/ray_integrators.pyx
+++ b/yt/utilities/lib/ray_integrators.pyx
@@ -40,7 +40,7 @@
     """
     cdef int i, ii
     cdef int j, jj
-    cdef int k, kk
+    cdef int k
     cdef int n, nn
     nn = o_s.shape[3] # This might be slow
     cdef np.float64_t *temp = <np.float64_t *>malloc(sizeof(np.float64_t) * nn)
@@ -52,7 +52,6 @@
             for n in range(nn):
                 temp[n] = i_s[ii,jj,n]
             for k in range(kmax-kmin):
-                kk = k + kmin#*kstride, which doesn't make any sense
                 for n in range(nn):
                     o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n])
                     temp[n] = o_s[i,j,k,n]
@@ -127,7 +126,7 @@
     # Find the first place the ray hits the grid on its path
     # Do left edge then right edge in each dim
     cdef int i, x, y
-    cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance
+    cdef np.float64_t tl, tr, intersect_t, enter_t
     cdef np.float64_t iv_dir[3]
     cdef np.float64_t tdelta[3]
     cdef np.float64_t tmax[3]
@@ -135,7 +134,6 @@
     cdef np.int64_t cur_ind[3]
     cdef np.int64_t step[3]
     intersect_t = 1
-    dt_tolerance = 1e-6
     # recall p = v * t + u
     #  where p is position, v is our vector, u is the start point
     for i in range(3):
@@ -236,9 +234,7 @@
     # We're roughly following Amanatides & Woo on a ray-by-ray basis
     # Note that for now it's just shells, but this can and should be
     # generalized to transfer functions
-    cdef int i, x, y, vi
-    intersect_t = 1
-    dt_tolerance = 1e-6
+    cdef int i, vi
     cdef int nv = ug.shape[0]
     cdef int nshells = shells.shape[0]
     cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64)
@@ -262,17 +258,14 @@
     cdef int x, y, i, n
     cdef int step[3]
     cdef np.float64_t intersect_t = 1
-    cdef np.float64_t dt_tolerance = 1e-6
-    cdef np.float64_t tl, tr, enter_t, exit_t
+    cdef np.float64_t tl, tr, enter_t
     cdef np.int64_t cur_ind[3]
     cdef np.float64_t tdelta[3]
     cdef np.float64_t tmax[3]
     cdef np.float64_t intersect[3]
-    cdef np.float64_t dt, dv
+    cdef np.float64_t dv
     cdef np.float64_t dist, alpha
-    cdef np.float64_t one = 1.0
     cdef int dims[3]
-    cdef np.float64_t rgba[4]
     cdef np.float64_t temp_x, temp_y
     for i in range(3):
         # As long as we're iterating, set some other stuff, too
@@ -305,7 +298,6 @@
         return
     # Now get the indices of the intersection
     for i in range(3): intersect[i] = u[i] + intersect_t * v[i]
-    cdef int ncells = 0
     for i in range(3):
         cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i])
         tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i]

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