diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-05 22:19:19 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-05 22:19:19 -0400 |
commit | dfc293fb05103f3dbc0e86a07222de52018f6bcf (patch) | |
tree | 651bc6c242094d3411844c2825736d9556c635fd | |
parent | 643f3df7b8538d5c52ea782ec3c22406cadc7c6e (diff) | |
download | chroma-dfc293fb05103f3dbc0e86a07222de52018f6bcf.tar.gz chroma-dfc293fb05103f3dbc0e86a07222de52018f6bcf.tar.bz2 chroma-dfc293fb05103f3dbc0e86a07222de52018f6bcf.zip |
update bounding box construction for nodes to determine each bound in a single call by calling np.min() and np.max() along an axis
-rw-r--r-- | geometry.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/geometry.py b/geometry.py index d80b730..b513112 100644 --- a/geometry.py +++ b/geometry.py @@ -283,8 +283,8 @@ class Geometry(object): i1 = np.searchsorted(zvalues_mesh, z) i2 = np.searchsorted(zvalues_mesh, z, side='right') - self.lower_bounds[i] = np.min(self.mesh.assemble(slice(i1,i2), group=False), axis=0) - self.upper_bounds[i] = np.max(self.mesh.assemble(slice(i1,i2), group=False), axis=0) + self.lower_bounds[i] = self.mesh.assemble(slice(i1,i2), group=False).min(axis=0) + self.upper_bounds[i] = self.mesh.assemble(slice(i1,i2), group=False).max(axis=0) self.node_map[i] = i1 self.node_length[i] = i2-i1 @@ -325,15 +325,8 @@ class Geometry(object): i += begin_last_layer + bit_shifted_zvalues.size - self.lower_bounds[i] = \ - [np.min(self.lower_bounds[i1:i2,0]), - np.min(self.lower_bounds[i1:i2,1]), - np.min(self.lower_bounds[i1:i2,2])] - - self.upper_bounds[i] = \ - [np.max(self.upper_bounds[i1:i2,0]), - np.max(self.upper_bounds[i1:i2,1]), - np.max(self.upper_bounds[i1:i2,2])] + self.lower_bounds[i] = self.lower_bounds[i1:i2].min(axis=0) + self.upper_bounds[i] = self.upper_bounds[i1:i2].max(axis=0) self.node_map[i] = i1 self.node_length[i] = i2-i1 |