Skip to content

Conversation

MikeSullivan7
Copy link
Collaborator

@MikeSullivan7 MikeSullivan7 commented Jul 8, 2025

Issue Closes #2714

Description

Replaced use of QThread with TaskWorkerThread in the Live Viewer to safely handle exceptions during intensity profile calculations. This prevents crashes from uncaught errors in background threads.

  • Refactored to use TaskWorkerThread for model.calc_mean_chunk to safely catch exceptions from background threads
  • Switched to np.ma.MaskedArray for tracking image means, allowing clear handling of corrupt or unreadable files
  • Updated presenter.update_image_list to work with masked arrays and improve mean update logic

Developer Testing

  • I have verified unit tests pass locally: python -m pytest -vs
  • Manually tested Live Viewer with valid and corrupt images

Acceptance Criteria and Reviewer Testing

  • Unit tests pass locally: python -m pytest -vs
  • Manually tested Live Viewer
  • Errors are logged and UI remains responsive

@coveralls
Copy link

coveralls commented Jul 9, 2025

Coverage Status

coverage: 70.839% (+0.09%) from 70.753%
when pulling f5eb534 on 2714_live_viewer_TaskWorkerThread
into 81ba3c9 on main.

@ashleymeigh2 ashleymeigh2 self-requested a review July 14, 2025 11:36
@JackEAllen JackEAllen moved this from Review to In Progress in Mantid Imaging Work Jul 17, 2025
@JackEAllen JackEAllen added this to the Release 3.1.0 milestone Jul 24, 2025
@MikeSullivan7 MikeSullivan7 marked this pull request as ready for review July 28, 2025 12:05
@MikeSullivan7 MikeSullivan7 moved this from In Progress to Review in Mantid Imaging Work Jul 28, 2025
@MikeSullivan7 MikeSullivan7 force-pushed the 2714_live_viewer_TaskWorkerThread branch from bd5e3f5 to f5eb534 Compare July 28, 2025 13:50
Copy link
Collaborator

@ashleymeigh2 ashleymeigh2 left a comment

Choose a reason for hiding this comment

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

Nice work replacing QThread with TaskWorkerThread — this is a solid improvement for stability and exception handling.

@ashleymeigh2 ashleymeigh2 added this pull request to the merge queue Jul 29, 2025
Merged via the queue into main with commit bbba5a3 Jul 29, 2025
9 checks passed
@ashleymeigh2 ashleymeigh2 deleted the 2714_live_viewer_TaskWorkerThread branch July 29, 2025 11:05
@github-project-automation github-project-automation bot moved this from Review to Done in Mantid Imaging Work Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Live Viewer: use TaskWorkerThread to catch exceptions
5 participants