Skip to content

Commit 1c2e57f

Browse files
committed
fixed bug when exporting all images. this refs #230
1 parent 7de87cc commit 1c2e57f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

notebooks/__code/normalization_tof/normalization_for_timepix.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ def export_ob_images(ob_run_numbers,
409409
spectra_file_name):
410410
"""export ob images to the output folder"""
411411
logging.info(f"> Exporting combined ob images to {output_folder} ...")
412-
list_ob_runs_number_only = [isolate_run_number(_ob_run_number) for _ob_run_number in ob_run_numbers]
412+
logging.info(f"\t{ob_run_numbers = }")
413+
list_ob_runs_number_only = [str(isolate_run_number_from_full_path(_ob_run_number)) for _ob_run_number in ob_run_numbers]
413414
if len(list_ob_runs_number_only) == 1:
414415
ob_output_folder = os.path.join(output_folder, f"ob_{list_ob_runs_number_only[0]}")
415416
else:
@@ -455,6 +456,12 @@ def make_tiff(data: list, filename: str = "", metadata: dict = None) -> None:
455456
new_image.save(filename)
456457

457458

459+
def isolate_run_number_from_full_path(run_number_full_path: str) -> str:
460+
"""isolate the run number from the full path"""
461+
run_number = os.path.basename(run_number_full_path)
462+
return isolate_run_number(run_number)
463+
464+
458465
def isolate_run_number(run_number_full_path: str) -> int:
459466
run_number = os.path.basename(run_number_full_path)
460467
run_number = run_number.split("_")[1]

notebooks/__code/normalization_tof/normalization_tof.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def manually_set_runs(self):
9595
self.sample_run_numbers_widget = widgets.Textarea(value=str_sample_run_numbers,
9696
placeholder="",
9797
layout=widgets.Layout(width='400px'))
98-
ob_label = widgets.Label(value="List of ob run numbers (ex: 8703)")
98+
ob_label = widgets.Label(value="List of ob run numbers (ex: 8703, 8705)")
9999
self.ob_run_numbers_widget = widgets.Textarea(value=str_ob_run_numbers,
100100
placeholder="",
101101
layout=widgets.Layout(width='400px'))

0 commit comments

Comments
 (0)