JohannesBuchner / BXA

Bayesian X-ray analysis (nested sampling for Xspec and Sherpa)
https://johannesbuchner.github.io/BXA/
GNU General Public License v3.0
57 stars 19 forks source link

BXASolver run cannot be interrupted in jupyter lab #45

Open ivvv opened 1 year ago

ivvv commented 1 year ago

Description

Running solver.run() cannot be interrupted in jupyter lab.

What I Did

Running this in a jupyter lab cell:

solver = bxa.BXASolver(transformations=transformations, outputfiles_basename=outputfiles_basename)
results = solver.run(resume=True)

Trying to interrupt the process/kernel does not work, the iterations go on and on. The only remedy is to restart the kernel which leads to losing the session.

I am not sure if this is BXA or ultranest issue, there should be a possibility to make the iterations interruptible somehow.

Thanks, Ivan

JohannesBuchner commented 1 year ago

It is probably an xspec issue actually, xspec may catch KeyboardInterrupt signals and python/jupyter/... does not know about it. You'd have to look at how xspec registers/overwrites signals.

JohannesBuchner commented 1 year ago

I think if you keep hammering the process with Ctrl-Cs (cell selected, keep it pressed), eventually you hit it where it is within the python/ultranest code execution, not within the xspec C execution, and this can stop the iterating.

ivvv commented 1 year ago

I guess this issue can be closed. Before raising the issue I looked for 'interrupt' in all issues and couldn't find anything. So, maybe some information in the docs on this particular behaviour would be useful for others.

I have not checked if using BXA with sherpa is ok in this respect, i.e. the process can be stopped in a "normal" way.