I'm not familiar with numpy, but here is a simple class that can stop and resume:
class Program():
def run(self):
while 1:
try:
self.do_something()
except KeyboardInterrupt:
break
def do_something(self):
print("Doing something")
# usage:
a = Program()
a.run()
# will print a lot of statements
# if you hit CTRL+C it will stop
# then you can run it again with a.run()