Skip to content

Commit

Permalink
Change time() to perf_counter()
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesPageot committed Jul 19, 2024
1 parent 0ed6995 commit cbcf5a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions functions/compute_fieldmap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import nibabel as nib
import click
from time import time
from time import perf_counter

def is_nifti(filepath):
"""
Expand Down Expand Up @@ -119,16 +119,16 @@ def compute_fieldmap(input_file, output_file):
None
"""
if is_nifti(input_file):
tic = time()
start_time = perf_counter()
print('Start')
susceptibility_distribution, image_resolution, affine_matrix = load_sus_dist(input_file)
print('Susceptibility distribution loaded')
fieldmap = compute_bz(susceptibility_distribution, image_resolution)
print('Fieldmap simulated')
save_to_nifti(fieldmap, affine_matrix, output_file)
print('Saving to NIfTI format')
tac = time()
print(f'End. Runtime: {tac-tic:.2f} seconds')
end_time = perf_counter()
print(f'End. Runtime: {end_time-start_time:.2f} seconds')
else:
print("The input file must be NIfTI.")

Expand Down

0 comments on commit cbcf5a2

Please sign in to comment.