From a0ec6c58e6a84b2f73a1716b4d2e61ed2ae769e9 Mon Sep 17 00:00:00 2001
From: Wolfgang Kastaun <wolfgang.kastaun@aei.mpg.de>
Date: Fri, 20 Dec 2024 18:42:22 +0100
Subject: [PATCH] minor cleanup

---
 lisainstrument/fixed_shift_dask.py  |  7 ++----
 lisainstrument/fixed_shift_numpy.py | 38 ++++++++++++++++-------------
 tests/test_dynamic_delay_dsp.py     |  2 +-
 3 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/lisainstrument/fixed_shift_dask.py b/lisainstrument/fixed_shift_dask.py
index 7ceea69..471a713 100644
--- a/lisainstrument/fixed_shift_dask.py
+++ b/lisainstrument/fixed_shift_dask.py
@@ -14,10 +14,7 @@ from typing_extensions import assert_never
 
 from lisainstrument.dynamic_delay_numpy import DynShiftBC
 from lisainstrument.fir_filters_dask import DaskArray1D, make_dask_array_1d
-from lisainstrument.fixed_shift_numpy import (
-    FixedShiftFactory,
-    make_fixed_shift_factory_lagrange,
-)
+from lisainstrument.fixed_shift_numpy import FixedShiftFactory, FixedShiftLagrange
 
 
 class FixedShiftDask:  # pylint: disable=too-few-public-methods
@@ -157,5 +154,5 @@ def make_fixed_shift_lagrange_dask(
     Returns:
         Fixed shift interpolator
     """
-    fac = make_fixed_shift_factory_lagrange(length)
+    fac = FixedShiftLagrange.factory(length)
     return FixedShiftDask(left_bound, right_bound, fac)
diff --git a/lisainstrument/fixed_shift_numpy.py b/lisainstrument/fixed_shift_numpy.py
index 25a0868..cf8d47d 100644
--- a/lisainstrument/fixed_shift_numpy.py
+++ b/lisainstrument/fixed_shift_numpy.py
@@ -80,6 +80,9 @@ class FixedShiftCore(Protocol):
         """
 
 
+FixedShiftFactory: TypeAlias = Callable[[float], FixedShiftCore]
+
+
 def make_fir_lagrange_fixed(length: int, frac_shift: float) -> DefFilterFIR:
     r"""Create FIR filter corresponding to non-integer shift using Lagrange interpolation
 
@@ -214,28 +217,29 @@ class FixedShiftLagrange(FixedShiftCore):
         a = make_numpy_array_1d_float(samples)
         return make_numpy_array_1d(self._filt(a))
 
+    @staticmethod
+    def factory(length: int) -> FixedShiftFactory:
+        """Factory for making FixedShiftLagrange instances
 
-FixedShiftFactory: TypeAlias = Callable[[float], FixedShiftCore]
-
+        Arguments:
+            length: number of Lagrange polynomials to use
 
-def make_fixed_shift_factory_lagrange(length: int) -> FixedShiftFactory:
-    """Factory for making FixedShiftLagrange instances
+        Returns:
+            Factory function for making FixedShiftLagrange instances from shift
+        """
 
-    Arguments:
-        length: number of Lagrange polynomials to use
+        def factory(shift: float) -> FixedShiftCore:
+            """FixedShiftLagrange instances from shift using preselected order
 
-    Returns:
-        Factory function for making FixedShiftLagrange instances from shift
-    """
+            Arguments:
+                shift: The fixed shift
 
-    def factory(shift: float) -> FixedShiftCore:
-        """FixedShiftLagrange instances from shift using preselected order
-        Arguments:
-            shift: The fixed shift
-        """
-        return FixedShiftLagrange(length, shift)
+            Returns:
+                FixedShiftLagrange instance
+            """
+            return FixedShiftLagrange(length, shift)
 
-    return factory
+        return factory
 
 
 class FixedShiftNumpy:  # pylint: disable=too-few-public-methods
@@ -365,5 +369,5 @@ def make_fixed_shift_lagrange_numpy(
     Returns:
         Fixed shift interpolator
     """
-    fac = make_fixed_shift_factory_lagrange(length)
+    fac = FixedShiftLagrange.factory(length)
     return FixedShiftNumpy(left_bound, right_bound, fac)
diff --git a/tests/test_dynamic_delay_dsp.py b/tests/test_dynamic_delay_dsp.py
index 3df4d4f..e1332cc 100644
--- a/tests/test_dynamic_delay_dsp.py
+++ b/tests/test_dynamic_delay_dsp.py
@@ -7,7 +7,7 @@ from lisainstrument.dynamic_delay_dask import (
     make_dynamic_shift_lagrange_dask,
     numpyfy_dask_multi,
 )
-from lisainstrument.dynamic_delay_dsp_dask import (
+from lisainstrument.dynamic_delay_dsp import (
     make_dynamic_shift_dsp_dask,
     make_dynamic_shift_dsp_numpy,
 )
-- 
GitLab