title: numpy slice assignment
body: <p>I've searching a efficient and elegant way to do this. I'll hope the example will explain my concern.</p>
  
  <p>We've got an np.array like this:</p>
  
  <pre><code>omega = np.array([1.03415121504, 1.29595060284, 1.55774999064, 1.81954937844,
                    ...
                    2.08134876623, 2.37359445321, -2.11179506541, -1.84999567761])
  </code></pre>
  
  <p>And now I want to manipulate it, like</p>
  
  <pre><code>omega[omega &lt; 0.0] = omega + 2 * np.pi
  omega[omega &gt;= 2 * np.pi] = omega - 2 * np.pi
  </code></pre>
  
  <p>The second statement may overwrite the computed values of the fist statement, and then there's an intersection. I found np.piecewise, but this doesn't provides such an behavior.</p>
  
  <p>How can I achieve this (efficient)?</p>
  
  <p>The corrent behavior is like that (but very unefficient/inelegant):</p>
  
  <pre><code>tmp = []
  for o in omega:
      if o &lt; 0.0:
          tmp.append(o + 2 * np.pi)
      elif o &gt;= (2 * np.pi):
          tmp.append(o - 2 * np.pi)
      else:
          tmp.append(o)
  omega = np.array(tmp)
  </code></pre>
  
  <p>Therefore someone made experiences with numpy's nditer for such purposes? (Especially about performance / efficency)</p>