[yt-svn] commit/yt: ngoldbaum: Merged in MatthewTurk/yt (pull request #1956)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Jan 27 09:14:07 PST 2016
1 new commit in yt:
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