title: numpy: Invalid value encountered in true_divide
body: <p>I have two numpy arrays and I am trying to divide one with the other and at the same time, I want to make sure that the entries where the divisor is 0, should just be replaced with 0.</p>
  
  <p>So, I do something like:</p>
  
  <pre><code>log_norm_images = np.where(b_0 &gt; 0, np.divide(diff_images, b_0), 0)
  </code></pre>
  
  <p>This gives me a run time warning of:</p>
  
  <pre><code>RuntimeWarning: invalid value encountered in true_divide
  </code></pre>
  
  <p>Now, I wanted to see what was going on and I did the following:</p>
  
  <pre><code>xx = np.isfinite(diff_images)
  print (xx[xx == False])
  
  xx = np.isfinite(b_0)
  print (xx[xx == False])
  </code></pre>
  
  <p>However, both of these return empty arrays meaning that all the values in the arrays are finite. So, I am not sure where the invalid value is coming from. I am assuming checking b_0 > 0 in the np.where function takes care of the divide by 0.</p>
  
  <p>The shape of the two arrays are (96, 96, 55, 64) and (96, 96, 55, 1)</p>