From 08febf55a1b2a07a53ddf7f349ac92c4cfe8383b Mon Sep 17 00:00:00 2001 From: nutellaBear <48599863+LalithShiyam@users.noreply.github.com> Date: Fri, 29 Sep 2023 14:40:44 +0200 Subject: [PATCH] Update falconz.py --- falconz/falconz.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/falconz/falconz.py b/falconz/falconz.py index 4c74483..3660d2a 100644 --- a/falconz/falconz.py +++ b/falconz/falconz.py @@ -209,8 +209,9 @@ def main(): # choose start frame automatically if not specified if args.start_frame == 99: n_jobs = multiprocessing.cpu_count() - start_frame_file = determine_candidate_frames(candidate_frames, reference_file, falcon_dir, - round(n_jobs * PROPORTION_OF_CORES)) + # Calculate the number of cores to use, ensuring it's at least 1 + actual_n_jobs = max(1, round(n_jobs * PROPORTION_OF_CORES)) + start_frame_file = determine_candidate_frames(candidate_frames, reference_file, falcon_dir, actual_n_jobs) # find the index of the start_frame_file in the org_nifti_files list start_frame = org_nifti_files.index(start_frame_file) # everything from and after start_frame will be motion corrected and will be called moving frames