Skip to content

Commit

Permalink
Invalidate grains table for failed clustering
Browse files Browse the repository at this point in the history
Previously, if the user re-ran the clustering, and no grains were
found, the grains table would not be invalidated, and some results
would appear.

Invalidate the grains table so that this does not happen.

Fixes: #1715

Signed-off-by: Patrick Avery <[email protected]>
  • Loading branch information
psavery committed Jul 10, 2024
1 parent fdeb6ed commit 6c5e8a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions hexrdgui/indexing/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ def generate_grains_table(self):
num_grains = self.qbar.shape[1]
if num_grains == 0:
print('No grains found')
self.grains_table = None
return

plural = 's' if num_grains != 1 else ''
Expand Down
6 changes: 5 additions & 1 deletion hexrdgui/rerun_clustering_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path

from PySide6.QtWidgets import QDialog, QFileDialog
from PySide6.QtCore import Qt
from PySide6.QtCore import QTimer, Qt

from hexrdgui.async_worker import AsyncWorker
from hexrdgui.hexrd_config import HexrdConfig
Expand Down Expand Up @@ -89,6 +89,10 @@ def on_finished():
runner.accept_progress()
runner.confirm_indexing_results()

if runner.grains_table is None:
# The previous step must have failed. Show again.
QTimer.singleShot(0, self.exec)

def on_rejected():
# Since this is a QueuedConnection, we need to accept progress here
runner.accept_progress()
Expand Down

0 comments on commit 6c5e8a4

Please sign in to comment.