Skip to content

Commit f509b19

Browse files
committed
improved selection of OB
1 parent 98fb8a8 commit f509b19

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

notebooks/__code/normalization_tof/normalization_tof.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,6 @@ def check_sample(self):
389389
self.dict_sample[_run] = {}
390390
self.dict_short_name_full_path["sample"][os.path.basename(_run)] = _run
391391

392-
print(f"DEBUGGING")
393-
print(f"{type(_run)= }")
394-
print(f"{_run = }")
395-
print(f"{len(_run) = }")
396-
397392
_is_spectra_file_found, spectra_file_name = NormalizationTof._is_spectra_file_found_and_list(_run)
398393
if not _is_spectra_file_found:
399394
self.spectra_file_found = False
@@ -562,10 +557,16 @@ def check_ob(self):
562557
display(HTML(f"<span style='color:red'>Warning: Different number of TIFF files found in selected OB runs: {self.check_nbr_tiff[DataType.ob]}</span>"))
563558
notebook_logging.info(f"WARNING: Different number of TIFF files found in selected OB runs: {self.check_nbr_tiff[DataType.ob]}")
564559

560+
elif len(self.check_nbr_tiff[DataType.ob]) == 0: # check_nbr_tiff[DataType.ob] is not empty
561+
display(HTML(f"<span style='color:red'>Empty OB run selected!</span>"))
562+
notebook_logging.info("WARNING: Not valid OB runs found!")
563+
565564
else:
566-
if self.check_nbr_tiff[DataType.ob][0] != self.check_nbr_tiff[DataType.sample][0]:
567-
display(HTML(f"<span style='color:red'>Not valid OB runs found (different number of OB and sample TIFF files)!</span>"))
568-
notebook_logging.info("WARNING: Not valid OB runs found!")
565+
566+
if len(self.check_nbr_tiff[DataType.sample]) > 0 and len(self.check_nbr_tiff[DataType.ob]) > 0:
567+
if self.check_nbr_tiff[DataType.ob][0] != self.check_nbr_tiff[DataType.sample][0]:
568+
display(HTML(f"<span style='color:red'>Not valid OB runs found (different number of OB and sample TIFF files)!</span>"))
569+
notebook_logging.info("WARNING: Not valid OB runs found!")
569570

570571
def select_dc_run_numbers(self):
571572
self.select_folder(instruction="Browse dc top folder", next_function=self.dc_folder_selected)
@@ -1549,6 +1550,7 @@ def dc_folder_selected(self, folder_selected):
15491550

15501551
def save_ob_run_numbers_selected(self, folder_selected):
15511552
self.ob_run_numbers_selected = folder_selected
1553+
self.ob_dir = os.path.dirname(folder_selected[0])
15521554

15531555
def save_dc_run_numbers_selected(self, folder_selected):
15541556
self.dc_run_numbers_selected = folder_selected

0 commit comments

Comments
 (0)