IPython has some data API's that could be very useful here. In particular, look at
The idea here is to run your simulation in a thread, calling
publish_data periodically to collect data and make it available in the main thread. One can then run plotting from the main thread, or connect from another IPython instance and access the data from a
view. (This would be useful for a parallel computation where one can first gather the information from multiple processes, then publish it for other processes to access.)
Part of this should be a way for the computation to check some flags in the main thread, to allow the user to start and stop the computation.