Passed
Pull Request — master (#353)
by Fernando
01:17
created

FourierTransform.fourier_transform()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
import numpy as np
2
3
4
class FourierTransform:
5
6
    @staticmethod
7
    def fourier_transform(array: np.ndarray) -> np.ndarray:
8
        transformed = np.fft.fftn(array)
9
        fshift = np.fft.fftshift(transformed)
10
        return fshift
11
12
    @staticmethod
13
    def inv_fourier_transform(fshift: np.ndarray) -> np.ndarray:
14
        f_ishift = np.fft.ifftshift(fshift)
15
        img_back = np.fft.ifftn(f_ishift)
16
        return img_back
17