@@ -149,12 +149,12 @@ def divide_segment_into_chunks(num_frames, chunk_size):
149149
150150
151151def divide_recording_into_chunks (recording , chunk_size ):
152- all_chunks = []
152+ recording_slices = []
153153 for segment_index in range (recording .get_num_segments ()):
154154 num_frames = recording .get_num_samples (segment_index )
155155 chunks = divide_segment_into_chunks (num_frames , chunk_size )
156- all_chunks .extend ([(segment_index , frame_start , frame_stop ) for frame_start , frame_stop in chunks ])
157- return all_chunks
156+ recording_slices .extend ([(segment_index , frame_start , frame_stop ) for frame_start , frame_stop in chunks ])
157+ return recording_slices
158158
159159
160160def ensure_n_jobs (recording , n_jobs = 1 ):
@@ -387,13 +387,13 @@ def __init__(
387387 f"chunk_duration={ chunk_duration_str } " ,
388388 )
389389
390- def run (self , all_chunks = None ):
390+ def run (self , recording_slices = None ):
391391 """
392392 Runs the defined jobs.
393393 """
394394
395- if all_chunks is None :
396- all_chunks = divide_recording_into_chunks (self .recording , self .chunk_size )
395+ if recording_slices is None :
396+ recording_slices = divide_recording_into_chunks (self .recording , self .chunk_size )
397397
398398 if self .handle_returns :
399399 returns = []
@@ -402,17 +402,17 @@ def run(self, all_chunks=None):
402402
403403 if self .n_jobs == 1 :
404404 if self .progress_bar :
405- all_chunks = tqdm (all_chunks , ascii = True , desc = self .job_name )
405+ recording_slices = tqdm (recording_slices , ascii = True , desc = self .job_name )
406406
407407 worker_ctx = self .init_func (* self .init_args )
408- for segment_index , frame_start , frame_stop in all_chunks :
408+ for segment_index , frame_start , frame_stop in recording_slices :
409409 res = self .func (segment_index , frame_start , frame_stop , worker_ctx )
410410 if self .handle_returns :
411411 returns .append (res )
412412 if self .gather_func is not None :
413413 self .gather_func (res )
414414 else :
415- n_jobs = min (self .n_jobs , len (all_chunks ))
415+ n_jobs = min (self .n_jobs , len (recording_slices ))
416416
417417 # parallel
418418 with ProcessPoolExecutor (
@@ -421,10 +421,10 @@ def run(self, all_chunks=None):
421421 mp_context = mp .get_context (self .mp_context ),
422422 initargs = (self .func , self .init_func , self .init_args , self .max_threads_per_process ),
423423 ) as executor :
424- results = executor .map (function_wrapper , all_chunks )
424+ results = executor .map (function_wrapper , recording_slices )
425425
426426 if self .progress_bar :
427- results = tqdm (results , desc = self .job_name , total = len (all_chunks ))
427+ results = tqdm (results , desc = self .job_name , total = len (recording_slices ))
428428
429429 for res in results :
430430 if self .handle_returns :
0 commit comments