title: Dividing point clouds into quadrants in python
body: <p>Suppose I have an array of 30 points in 3 dimensions cast as a numpy array in python:</p>
  
  <pre><code>import numpy as np
  b = np.round(np.random.random((30,3))*20)
  b = b - b.mean(axis=0)
  </code></pre>
  
  <p>I want to separate these points into eight quadrants with reference to the "center of mass" of the point cloud. I could do something like this:</p>
  
  <pre><code>for a in (b, -b):
      q_list = a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&gt;0][a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&gt;0][:,2]&gt;0]
      quad_list.append(q_list * sign)
      q_list = a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&gt;0][a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&gt;0][:,2]&lt;=0]
      quad_list.append(q_list * sign)             
      q_list = a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&lt;=0][a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&lt;=0][:,2]&gt;0]
      quad_list.append(q_list * sign)              
      q_list = a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&lt;=0][a[a[:,0]&gt;0.][a[a[:,0]&gt;0.][:,1]&lt;=0][:,2]&lt;=0]
      quad_list.append(q_list * sign)
      sign *= -1
  </code></pre>
  
  <p>This works fine, of course. It returns a list with eight arrays of position coordinates, each of which contains only the points that lie in a particular quadrant. However I get the feeling that there should be clearer, more concise way to handle this. Suggestions?</p>