Skip to content

Commit

Permalink
RF: Remove indirect import of math.factorial
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jan 19, 2024
1 parent 3853fae commit b6f57b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 2 additions & 3 deletions gradunwarp/core/unwarp_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions gradunwarp/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
from collections import namedtuple
import math

import numpy as np
import nibabel as nib
Expand All @@ -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

0 comments on commit b6f57b5

Please sign in to comment.