I have a simple loop to plot some accumulating values in some simulation that takes a long time to compute. I reduced it to following MCVE:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
counter = 0
yvalues = [0]
for k in range(1000):
for l in range(10_000_000):
counter += 1 + np.tanh(counter)
print(k, l, counter)
yvalues.append(counter)
plt.plot(yvalues)
plt.draw()
fig.canvas.flush_events()
The problem is that after a while I get a notification that "PyCharm is not responding", even though the program is still running and working perfectly well.
The message alone is not the problem yet, but if you just ignore this warning and do not press Wait the program will stop and display
Process finished with exit code 137 (interrupted by signal 9: SIGKILL)
(The same thing happens when you just press Force Quit.)
Does anyone know why this is happening and how to avoid it?
It makes it impossible to run this simulation e.g. overnight as you constantly have to look out for this warning and press Wait again.