title: numpy.where() clause error
body: <p>Briefly... here is the problem:</p>
  
  <pre><code>import numpy as np
  a = np.array([ 0, 1, 2, 3, 4, 5, 6, 100, 8, 9])
  np.where(a==100, -1, a[a])
  </code></pre>
  
  <p>What I expect to get is:  <code>0, 1, 2, 3, 4, 5, 6, -1, 8, 9</code>
  Instead I'm getting: <code>index 100 out of bounds 0&lt;=index&lt;10</code></p>
  
  <p>I admit that the index is invalid but is shouldn't eval a[100] but -1 instead... as far as I understand numpy.where() command structure.</p>
  
  <p>What I'm doing wrong in this example?</p>
  
  <p>Just to clarify what I actually trying to do here is more detailed code:
  It is a lookup table array remapping procedure:</p>
  
  <pre><code>import numpy as np
  
  # gamma-ed look-up table array
  lut = np.power(np.linspace(0, 1, 32), 1/2.44)*255.0
  
  def gamma(x):
      ln = (len(lut)-1)
      idx = np.uint8(x*ln)
      frac = x*ln - idx
      return np.where( frac == 0.0,
                      lut[idx],
                      lut[idx]+(lut[idx+1]-lut[idx])*frac)
  
  # some linear values array to remap
  lin = np.linspace(0, 1, 64)
  
  # final look-up remap
  gamma_lin = gamma(lin)
  </code></pre>