title: Finding the calculation that generates a NaN
body: <p>I have a moderately large piece (a few thousand lines) of Python/Numpy/Scipy code that is throwing up NaNs with certain inputs. I've looked for, and found, some of the usual suspects (<code>log(0)</code> and the like), but none of the obvious ones seem to be the culprits in this case. </p>
  
  <p>Is there a relatively painless way (i.e., apart from putting exception handling code around each potential culprit), to find out where these NaNs are coming from?</p>