title: timeout/stopping scipy curve_fit in a thread
body: <p>I have a GUI in which a python thread performs a scipy.curve_fit call. This can sometimes take a while and I would like to limit it to a certain time limit. If it takes longer than this I would like the thread to raise and error or return a default value.</p>
  
  <p>I have searched around for different ways to do this. I can't make the thread regularly check for a timeout variable as when it starts running the curve_fit call it won't do anything else till it is finished.</p>
  
  <p>Obviously this problem is not restricted to the curve_fit function but any library function that could take a long time to return, which I put in a thread.</p>
  
  <p>Is this the best way to kill the thread?:
  <a href="https://stackoverflow.com/questions/323972/is-there-any-way-to-kill-a-thread-in-python">Is there any way to kill a Thread in Python?</a></p>
  
  <p>Is there a better more Pythonic way of doing this that I am missing?</p>
  
  <p>Thank you for your help.</p>