Skip to content

Commit 79575bb

Browse files
committed
rename functions
1 parent 560afd3 commit 79575bb

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

mkl_fft/_fft_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@
2626

2727
import numpy as np
2828

29-
__all__ = ["_check_norm", "_compute_fwd_scale"]
29+
__all__ = ["check_norm", "compute_fwd_scale"]
3030

3131

32-
def _check_norm(norm):
32+
def check_norm(norm):
3333
if norm not in (None, "ortho", "forward", "backward"):
3434
raise ValueError(
3535
f"Invalid norm value {norm} should be None, 'ortho', 'forward', "
3636
"or 'backward'."
3737
)
3838

3939

40-
def _compute_fwd_scale(norm, n, shape):
41-
_check_norm(norm)
40+
def compute_fwd_scale(norm, n, shape):
41+
check_norm(norm)
4242
if norm in (None, "backward"):
4343
return 1.0
4444

mkl_fft/_numpy_fft.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
import numpy as np
7777

7878
from . import _pydfti as mkl_fft # pylint: disable=no-name-in-module
79-
from ._fft_utils import _check_norm, _compute_fwd_scale
79+
from ._fft_utils import check_norm, compute_fwd_scale
8080
from ._float_utils import __downcast_float128_array
8181

8282

@@ -125,7 +125,7 @@ def _cook_nd_args(a, s=None, axes=None, invreal=False):
125125

126126

127127
def _swap_direction(norm):
128-
_check_norm(norm)
128+
check_norm(norm)
129129
_swap_direction_map = {
130130
"backward": "forward",
131131
None: "forward",
@@ -241,7 +241,7 @@ def fft(a, n=None, axis=-1, norm=None):
241241
"""
242242

243243
x = __downcast_float128_array(a)
244-
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
244+
fsc = compute_fwd_scale(norm, n, x.shape[axis])
245245

246246
return trycall(mkl_fft.fft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc})
247247

@@ -334,7 +334,7 @@ def ifft(a, n=None, axis=-1, norm=None):
334334
"""
335335

336336
x = __downcast_float128_array(a)
337-
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
337+
fsc = compute_fwd_scale(norm, n, x.shape[axis])
338338

339339
return trycall(mkl_fft.ifft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc})
340340

@@ -425,7 +425,7 @@ def rfft(a, n=None, axis=-1, norm=None):
425425
"""
426426

427427
x = __downcast_float128_array(a)
428-
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
428+
fsc = compute_fwd_scale(norm, n, x.shape[axis])
429429

430430
return trycall(mkl_fft.rfft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc})
431431

@@ -518,7 +518,7 @@ def irfft(a, n=None, axis=-1, norm=None):
518518
"""
519519

520520
x = __downcast_float128_array(a)
521-
fsc = _compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
521+
fsc = compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
522522

523523
return trycall(
524524
mkl_fft.irfft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc}
@@ -606,7 +606,7 @@ def hfft(a, n=None, axis=-1, norm=None):
606606
x = __downcast_float128_array(a)
607607
x = np.array(x, copy=True, dtype=complex)
608608
np.conjugate(x, out=x)
609-
fsc = _compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
609+
fsc = compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
610610

611611
return trycall(
612612
mkl_fft.irfft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc}
@@ -675,7 +675,7 @@ def ihfft(a, n=None, axis=-1, norm=None):
675675
norm = _swap_direction(norm)
676676
x = __downcast_float128_array(a)
677677
x = np.array(x, copy=True, dtype=float)
678-
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
678+
fsc = compute_fwd_scale(norm, n, x.shape[axis])
679679

680680
output = trycall(
681681
mkl_fft.rfft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc}
@@ -787,7 +787,7 @@ def fftn(a, s=None, axes=None, norm=None):
787787

788788
x = __downcast_float128_array(a)
789789
s, axes = _cook_nd_args(x, s, axes)
790-
fsc = _compute_fwd_scale(norm, s, x.shape)
790+
fsc = compute_fwd_scale(norm, s, x.shape)
791791

792792
return trycall(mkl_fft.fftn, (x,), {"s": s, "axes": axes, "fwd_scale": fsc})
793793

@@ -894,7 +894,7 @@ def ifftn(a, s=None, axes=None, norm=None):
894894

895895
x = __downcast_float128_array(a)
896896
s, axes = _cook_nd_args(x, s, axes)
897-
fsc = _compute_fwd_scale(norm, s, x.shape)
897+
fsc = compute_fwd_scale(norm, s, x.shape)
898898

899899
return trycall(
900900
mkl_fft.ifftn, (x,), {"s": s, "axes": axes, "fwd_scale": fsc}
@@ -1182,7 +1182,7 @@ def rfftn(a, s=None, axes=None, norm=None):
11821182

11831183
x = __downcast_float128_array(a)
11841184
s, axes = _cook_nd_args(x, s, axes)
1185-
fsc = _compute_fwd_scale(norm, s, x.shape)
1185+
fsc = compute_fwd_scale(norm, s, x.shape)
11861186

11871187
return trycall(
11881188
mkl_fft.rfftn, (x,), {"s": s, "axes": axes, "fwd_scale": fsc}
@@ -1326,7 +1326,7 @@ def irfftn(a, s=None, axes=None, norm=None):
13261326

13271327
x = __downcast_float128_array(a)
13281328
s, axes = _cook_nd_args(x, s, axes, invreal=True)
1329-
fsc = _compute_fwd_scale(norm, s, x.shape)
1329+
fsc = compute_fwd_scale(norm, s, x.shape)
13301330

13311331
return trycall(
13321332
mkl_fft.irfftn, (x,), {"s": s, "axes": axes, "fwd_scale": fsc}

mkl_fft/_pydfti.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,11 +1335,11 @@ def ifftn(x, s=None, axes=None, overwrite_x=False, fwd_scale=1.0):
13351335

13361336

13371337
def rfft2(x, s=None, axes=(-2, -1), fwd_scale=1.0):
1338-
return rfftn(x, s=s, axes=axes, fsc=fwd_scale)
1338+
return rfftn(x, s=s, axes=axes, fwd_scale=fwd_scale)
13391339

13401340

13411341
def irfft2(x, s=None, axes=(-2, -1), fwd_scale=1.0):
1342-
return irfftn(x, s=s, axes=axes, fsc=fwd_scale)
1342+
return irfftn(x, s=s, axes=axes, fwd_scale=fwd_scale)
13431343

13441344

13451345
def _remove_axis(s, axes, axis_to_remove):

mkl_fft/_scipy_fft.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import numpy as np
3434

3535
from . import _pydfti as mkl_fft # pylint: disable=no-name-in-module
36-
from ._fft_utils import _compute_fwd_scale
36+
from ._fft_utils import compute_fwd_scale
3737
from ._float_utils import __supported_array_or_not_implemented
3838

3939
__doc__ = """
@@ -235,7 +235,7 @@ def fft(
235235
):
236236
_check_plan(plan)
237237
x = _validate_input(a)
238-
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
238+
fsc = compute_fwd_scale(norm, n, x.shape[axis])
239239

240240
with Workers(workers):
241241
return mkl_fft.fft(
@@ -248,7 +248,7 @@ def ifft(
248248
):
249249
_check_plan(plan)
250250
x = _validate_input(a)
251-
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
251+
fsc = compute_fwd_scale(norm, n, x.shape[axis])
252252

253253
with Workers(workers):
254254
return mkl_fft.ifft(
@@ -303,7 +303,7 @@ def fftn(
303303
):
304304
_check_plan(plan)
305305
x = _validate_input(a)
306-
fsc = _compute_fwd_scale(norm, s, x.shape)
306+
fsc = compute_fwd_scale(norm, s, x.shape)
307307

308308
with Workers(workers):
309309
return mkl_fft.fftn(
@@ -316,7 +316,7 @@ def ifftn(
316316
):
317317
_check_plan(plan)
318318
x = _validate_input(a)
319-
fsc = _compute_fwd_scale(norm, s, x.shape)
319+
fsc = compute_fwd_scale(norm, s, x.shape)
320320

321321
with Workers(workers):
322322
return mkl_fft.ifftn(
@@ -327,7 +327,7 @@ def ifftn(
327327
def rfft(a, n=None, axis=-1, norm=None, workers=None, plan=None):
328328
_check_plan(plan)
329329
x = _validate_input(a)
330-
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
330+
fsc = compute_fwd_scale(norm, n, x.shape[axis])
331331

332332
with Workers(workers):
333333
return mkl_fft.rfft(x, n=n, axis=axis, fwd_scale=fsc)
@@ -336,7 +336,7 @@ def rfft(a, n=None, axis=-1, norm=None, workers=None, plan=None):
336336
def irfft(a, n=None, axis=-1, norm=None, workers=None, plan=None):
337337
_check_plan(plan)
338338
x = _validate_input(a)
339-
fsc = _compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
339+
fsc = compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
340340

341341
with Workers(workers):
342342
return mkl_fft.irfft(x, n=n, axis=axis, fwd_scale=fsc)
@@ -356,7 +356,7 @@ def rfftn(a, s=None, axes=None, norm=None, workers=None, plan=None):
356356
_check_plan(plan)
357357
x = _validate_input(a)
358358
s, axes = _cook_nd_args(x, s, axes)
359-
fsc = _compute_fwd_scale(norm, s, x.shape)
359+
fsc = compute_fwd_scale(norm, s, x.shape)
360360

361361
with Workers(workers):
362362
return mkl_fft.rfftn(x, s, axes, fwd_scale=fsc)
@@ -366,7 +366,7 @@ def irfftn(a, s=None, axes=None, norm=None, workers=None, plan=None):
366366
_check_plan(plan)
367367
x = _validate_input(a)
368368
s, axes = _cook_nd_args(x, s, axes, invreal=True)
369-
fsc = _compute_fwd_scale(norm, s, x.shape)
369+
fsc = compute_fwd_scale(norm, s, x.shape)
370370

371371
with Workers(workers):
372372
return mkl_fft.irfftn(x, s, axes, fwd_scale=fsc)

0 commit comments

Comments
 (0)