feat: FFT Calcuation Utility

Change-Id: I5662a4f4c0edd8792fd8f4e5609dcd2181c9d876
diff --git a/dcs/utils/__init__.py b/dcs/utils/__init__.py
new file mode 100644
index 0000000..119d80c
--- /dev/null
+++ b/dcs/utils/__init__.py
@@ -0,0 +1,7 @@
+#  SPDX-License-Identifier: MPL-2.0
+#    Copyright (c) 2022 Philipp Le <philipp@philipple.de>.
+#  This Source Code Form is subject to the terms of the Mozilla Public
+#  License, v. 2.0. If a copy of the MPL was not distributed with this
+#  file, You can obtain one at https://mozilla.org/MPL/2.0/.
+
+from .fft import swap_freq, abs_log_fft
diff --git a/dcs/utils/fft.py b/dcs/utils/fft.py
new file mode 100644
index 0000000..4acde7f
--- /dev/null
+++ b/dcs/utils/fft.py
@@ -0,0 +1,20 @@
+#  SPDX-License-Identifier: MPL-2.0
+#    Copyright (c) 2022 Philipp Le <philipp@philipple.de>.
+#  This Source Code Form is subject to the terms of the Mozilla Public
+#  License, v. 2.0. If a copy of the MPL was not distributed with this
+#  file, You can obtain one at https://mozilla.org/MPL/2.0/.
+
+import numpy as np
+
+
+def swap_freq(x: np.ndarray, axis: int = 0) -> np.ndarray:
+    transposed = np.swapaxes(x, 0, axis)
+    swapped = np.zeros(transposed.shape, dtype=np.complex128)
+    length = transposed.shape[0]
+    swapped[int(length/2):, ] = transposed[:int(length/2), ]
+    swapped[:int(length/2), ] = transposed[int(length/2):, ]
+    return np.swapaxes(swapped, axis, 0)
+
+
+def abs_log_fft(x: np.ndarray, factor: float = 20, axis: int = 0) -> np.ndarray:
+    return factor * np.log10(np.abs(swap_freq(np.fft.fft(x), axis)) / len(x))