From b6f57b516e7860e8f28ec4cb0dfb04419d15278f Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 19 Jan 2024 09:29:40 -0500 Subject: [PATCH] RF: Remove indirect import of math.factorial --- gradunwarp/core/unwarp_resample.py | 5 ++--- gradunwarp/core/utils.py | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/gradunwarp/core/unwarp_resample.py b/gradunwarp/core/unwarp_resample.py index a66da46..330a1ac 100644 --- a/gradunwarp/core/unwarp_resample.py +++ b/gradunwarp/core/unwarp_resample.py @@ -12,7 +12,6 @@ from scipy import ndimage from . import utils from .utils import CoordsVector as CV -from .utils import factorial from . import globals from .globals import siemens_max_det import nibabel as nib @@ -382,8 +381,8 @@ def siemens_B(alpha, beta, r, cosine_theta, theta, phi, R0): # this is Siemens normalization if m > 0: normfact = math.pow(-1, m) * \ - math.sqrt(float((2 * n + 1) * factorial(n - m)) \ - / float(2 * factorial(n + m))) + math.sqrt(float((2 * n + 1) * math.factorial(n - m)) \ + / float(2 * math.factorial(n + m))) _p *= normfact b += f * _p * f2 return b diff --git a/gradunwarp/core/utils.py b/gradunwarp/core/utils.py index c3d9804..f6d82d4 100644 --- a/gradunwarp/core/utils.py +++ b/gradunwarp/core/utils.py @@ -5,7 +5,6 @@ # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## from collections import namedtuple -import math import numpy as np import nibabel as nib @@ -25,5 +24,3 @@ def transform_coordinates(A, M): def get_vol_affine(infile): nibimage = nib.load(infile) return np.asanyarray(nibimage.dataobj), nibimage.affine - -factorial = math.factorial