@@ -189,7 +189,7 @@ def _calc_memory_bytes_LPRec3d_tomobar(
189189 if detector_pad is True :
190190 detector_pad = __estimate_detectorHoriz_padding (non_slice_dims_shape [1 ])
191191 elif detector_pad is False :
192- detector_pad = 0
192+ detector_pad = 0
193193
194194 min_mem_usage_filter = False
195195 if "min_mem_usage_filter" in kwargs :
@@ -208,9 +208,9 @@ def _calc_memory_bytes_LPRec3d_tomobar(
208208 _CENTER_SIZE_MIN = 192 # must be divisible by 8
209209
210210 n = DetectorsLengthH
211- if ( power_of_2_cropping ) :
211+ if power_of_2_cropping :
212212 n_pow2 = 2 ** math .ceil (math .log2 (n ))
213- if ( 0.9 < n / n_pow2 ) :
213+ if 0.9 < n / n_pow2 :
214214 n = n_pow2
215215
216216 odd_horiz = False
@@ -309,10 +309,7 @@ def _calc_memory_bytes_LPRec3d_tomobar(
309309 DetectorsLengthH_prepad * DetectorsLengthH_prepad * np .float32 ().itemsize
310310 )
311311 ifft2_plan_slice_size = (
312- cufft_estimate_2d (
313- nx = 2 * n , ny = 2 * n , fft_type = CufftType .CUFFT_C2C
314- )
315- / 2
312+ cufft_estimate_2d (nx = 2 * n , ny = 2 * n , fft_type = CufftType .CUFFT_C2C ) / 2
316313 )
317314 circular_mask_size = np .prod (output_dims ) / 2 * np .int64 ().itemsize * 4
318315 after_recon_swapaxis_slice = recon_output_size
@@ -351,38 +348,74 @@ def add_to_memory_counters(amount, per_slice: bool):
351348 add_to_memory_counters (tmp_p_input_slice , True )
352349 if min_mem_usage_filter :
353350 add_to_memory_counters (rfft_plan_slice_size / 4 / projection_chunk_count , False )
354- add_to_memory_counters (irfft_plan_slice_size / 4 / projection_chunk_count , False )
351+ add_to_memory_counters (
352+ irfft_plan_slice_size / 4 / projection_chunk_count , False
353+ )
355354 add_to_memory_counters (padded_tmp_p_input_slice / projection_chunk_count , False )
356355
357356 add_to_memory_counters (rfft_result_size / projection_chunk_count , False )
358- add_to_memory_counters (filtered_rfft_result_size / projection_chunk_count , False )
357+ add_to_memory_counters (
358+ filtered_rfft_result_size / projection_chunk_count , False
359+ )
359360 add_to_memory_counters (- rfft_result_size / projection_chunk_count , False )
360- add_to_memory_counters (- padded_tmp_p_input_slice / projection_chunk_count , False )
361+ add_to_memory_counters (
362+ - padded_tmp_p_input_slice / projection_chunk_count , False
363+ )
361364
362- add_to_memory_counters (irfft_scratch_memory_size / projection_chunk_count , False )
363- add_to_memory_counters (- irfft_scratch_memory_size / projection_chunk_count , False )
365+ add_to_memory_counters (
366+ irfft_scratch_memory_size / projection_chunk_count , False
367+ )
368+ add_to_memory_counters (
369+ - irfft_scratch_memory_size / projection_chunk_count , False
370+ )
364371 add_to_memory_counters (irfft_result_size / projection_chunk_count , False )
365- add_to_memory_counters (- filtered_rfft_result_size / projection_chunk_count , False )
372+ add_to_memory_counters (
373+ - filtered_rfft_result_size / projection_chunk_count , False
374+ )
366375
367376 add_to_memory_counters (- irfft_result_size / projection_chunk_count , False )
368377 else :
369- add_to_memory_counters (rfft_plan_slice_size / chunk_count / projection_chunk_count * 2 , True )
370- add_to_memory_counters (irfft_plan_slice_size / chunk_count / projection_chunk_count * 2 , True )
378+ add_to_memory_counters (
379+ rfft_plan_slice_size / chunk_count / projection_chunk_count * 2 , True
380+ )
381+ add_to_memory_counters (
382+ irfft_plan_slice_size / chunk_count / projection_chunk_count * 2 , True
383+ )
371384 # add_to_memory_counters(irfft_scratch_memory_size / chunk_count / projection_chunk_count, True)
372385 for _ in range (0 , chunk_count ):
373- add_to_memory_counters (padded_tmp_p_input_slice / chunk_count / projection_chunk_count , True )
374-
375- add_to_memory_counters (rfft_result_size / chunk_count / projection_chunk_count , True )
376- add_to_memory_counters (filtered_rfft_result_size / chunk_count / projection_chunk_count , True )
377- add_to_memory_counters (- rfft_result_size / chunk_count / projection_chunk_count , True )
378- add_to_memory_counters (- padded_tmp_p_input_slice / chunk_count / projection_chunk_count , True )
379-
380- add_to_memory_counters (irfft_scratch_memory_size / chunk_count / projection_chunk_count , True )
381- add_to_memory_counters (- irfft_scratch_memory_size / chunk_count / projection_chunk_count , True )
382- add_to_memory_counters (irfft_result_size / chunk_count / projection_chunk_count , True )
383- add_to_memory_counters (- filtered_rfft_result_size / chunk_count / projection_chunk_count , True )
384-
385- add_to_memory_counters (- irfft_result_size / chunk_count / projection_chunk_count , True )
386+ add_to_memory_counters (
387+ padded_tmp_p_input_slice / chunk_count / projection_chunk_count , True
388+ )
389+
390+ add_to_memory_counters (
391+ rfft_result_size / chunk_count / projection_chunk_count , True
392+ )
393+ add_to_memory_counters (
394+ filtered_rfft_result_size / chunk_count / projection_chunk_count , True
395+ )
396+ add_to_memory_counters (
397+ - rfft_result_size / chunk_count / projection_chunk_count , True
398+ )
399+ add_to_memory_counters (
400+ - padded_tmp_p_input_slice / chunk_count / projection_chunk_count , True
401+ )
402+
403+ add_to_memory_counters (
404+ irfft_scratch_memory_size / chunk_count / projection_chunk_count , True
405+ )
406+ add_to_memory_counters (
407+ - irfft_scratch_memory_size / chunk_count / projection_chunk_count , True
408+ )
409+ add_to_memory_counters (
410+ irfft_result_size / chunk_count / projection_chunk_count , True
411+ )
412+ add_to_memory_counters (
413+ - filtered_rfft_result_size / chunk_count / projection_chunk_count , True
414+ )
415+
416+ add_to_memory_counters (
417+ - irfft_result_size / chunk_count / projection_chunk_count , True
418+ )
386419
387420 add_to_memory_counters (- padded_in_slice_size , True )
388421 add_to_memory_counters (- filter_size , False )
@@ -433,7 +466,7 @@ def _calc_memory_bytes_SIRT3d_tomobar(
433466 if detector_pad is True :
434467 detector_pad = __estimate_detectorHoriz_padding (non_slice_dims_shape [1 ])
435468 elif detector_pad is False :
436- detector_pad = 0
469+ detector_pad = 0
437470
438471 anglesnum = non_slice_dims_shape [0 ]
439472 DetectorsLengthH_padded = non_slice_dims_shape [1 ] + 2 * detector_pad
@@ -456,7 +489,7 @@ def _calc_memory_bytes_SIRT3d_tomobar(
456489 Res_times_R = Res
457490 C_times_res = out_data_size
458491
459- astra_projection = ( in_data_size + out_data_size )
492+ astra_projection = in_data_size + out_data_size
460493
461494 tot_memory_bytes = int (
462495 recon_data_size_original
@@ -483,7 +516,7 @@ def _calc_memory_bytes_CGLS3d_tomobar(
483516 if detector_pad is True :
484517 detector_pad = __estimate_detectorHoriz_padding (non_slice_dims_shape [1 ])
485518 elif detector_pad is False :
486- detector_pad = 0
519+ detector_pad = 0
487520
488521 anglesnum = non_slice_dims_shape [0 ]
489522 DetectorsLengthH_padded = non_slice_dims_shape [1 ] + 2 * detector_pad
@@ -535,7 +568,7 @@ def _calc_memory_bytes_FISTA3d_tomobar(
535568 if detector_pad is True :
536569 detector_pad = __estimate_detectorHoriz_padding (non_slice_dims_shape [1 ])
537570 elif detector_pad is False :
538- detector_pad = 0
571+ detector_pad = 0
539572
540573 anglesnum = non_slice_dims_shape [0 ]
541574 DetectorsLengthH_padded = non_slice_dims_shape [1 ] + 2 * detector_pad
0 commit comments