Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket 1406 cancel calculation #1892

Merged
merged 2 commits into from Aug 17, 2021
Merged

Conversation

rjbourne
Copy link
Contributor

This PR adds a cancel button to the generic scattering calculator to cancel computations between each chunk of Q values. If the computation is cancelled the remainder of the Iq values are filled in with NaN. The ticket for this request suggests using calcthread.isquit(), however the current code uses twisted.internet threads as opposed to the calcthread class in sasview. As far as I can tell there is no inbuilt way to detect an interruption in these threads, so a boolean flag is used. Upon cancelling the calculation the compute/cancel button becomes disabled until the current chunk of Q values have been computed.

Currently the areas of the graph with NaN values are simply not updated, which can cause odd effects on the graph when cancelling a calculation. This is because the numpy.nan_to_num function in the current code is not correctly implemented, an issue fixed in #1888.

fixes #1406

Copy link
Member

@rozyczko rozyczko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and performs as expected.
Using QThreads should probably be preferred in this Qt app, but back when I wrote it, it didn't really behave properly.
It could probably be good to remove twisted and use QThreads throughout.

@butlerpd butlerpd merged commit a18f684 into main Aug 17, 2021
@rjbourne rjbourne deleted the ticket-1406-cancel-calculation branch August 18, 2021 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add cancel button to generic scattering panel
3 participants