Skip to content

Commit 8d93bbd

Browse files
authored
Merge pull request ElpadoCan#150 from SchmollerLab/main
Correctly detect no spots files present
2 parents 426c7cf + c1269d4 commit 8d93bbd

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

spotmax/gui.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -642,12 +642,12 @@ def initHighlightRefChannelObjImage(self):
642642

643643
def warnNoSpotsFilesFound(self, spotmax_out_path):
644644
txt = html_func.paragraph(f"""
645-
There are no valid files in the following folder:<br><br>
646-
<code>{spotmax_out_path}</code><br><br>
647-
This could be because the number of detected spots was 0,
648-
you did not run any analysis yet, or the analysis ended
649-
with errors.<br><br>
650-
If you need help with this feel free to reach out on or
645+
There are no valid files in the following folder:
646+
<copiable>{spotmax_out_path}</copiable><br>
647+
This could be because the <b>number of detected spots was 0</b>,
648+
you did <b>not run any analysis</b> yet, or the analysis ended
649+
<b>with errors</b>.<br><br>
650+
If you need help with this, feel free to reach out on or
651651
{html_func.href('GitHub page', issues_url)}.
652652
""")
653653
msg = acdc_widgets.myMessageBox(wrapText=False)
@@ -664,7 +664,11 @@ def addSpotsCoordinatesTriggered(self, checked=True, selected_file=None):
664664
df_spots_files[_posData.spotmax_out_path] = (
665665
_posData.getSpotmaxSingleSpotsfiles()
666666
)
667-
if not df_spots_files:
667+
668+
any_spots_file_found = any(
669+
df_files for df_files in df_spots_files.values()
670+
)
671+
if not df_spots_files or any_spots_file_found:
668672
self.warnNoSpotsFilesFound(posData.spotmax_out_path)
669673
return
670674

spotmax/io.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,11 @@ def load_spots_table(spotmax_out_path, filename, filepath=None):
716716
filepath = os.path.join(spotmax_out_path, filename)
717717
if not os.path.exists(filepath):
718718
return
719-
if filename.endswith('csv'):
719+
720+
if not filename:
721+
return
722+
723+
if filename.endswith('.csv'):
720724
df = pd.read_csv(filepath, index_col=['frame_i', 'Cell_ID'])
721725
elif filename.endswith('.h5'):
722726
df = _load_spots_table_h5(filepath)

0 commit comments

Comments
 (0)