Repository: ContactEngineering/SurfaceTopography (language: python)

Issue:
Decorated  topographies cannot be translated 
```
    def __init__(self, topography, offset=(0, 0), info={}):
        """
        Keyword Arguments:
        topography  -- SurfaceTopography to translate
        offset -- Translation offset in number of grid points
        """
        super().__init__(topography, info=info)
>       assert isinstance(topography, Topography)
E       AssertionError

```


Discussion / hints:

Fix patch:
diff --git a/SurfaceTopography/ChangeLog.md b/SurfaceTopography/ChangeLog.md
index cd2059bf..ea60246c 100644
--- a/SurfaceTopography/ChangeLog.md
+++ b/SurfaceTopography/ChangeLog.md
@@ -1,6 +1,13 @@
 Change log for SurfaceTopography
 ================================
 
+v1.13.0 (13Jan24)
+-----------------
+
+- API: translating nonperiodic topography raises error
+- BUG: Fixed translation of decorated topographies not possible
+- BUG: Added missing test of periodicity before translation
+
 v1.12.2 (12Dec23)
 -----------------
 
diff --git a/SurfaceTopography/UniformLineScanAndTopography.py b/SurfaceTopography/UniformLineScanAndTopography.py
index d6ea7b2f..43c5dd25 100644
--- a/SurfaceTopography/UniformLineScanAndTopography.py
+++ b/SurfaceTopography/UniformLineScanAndTopography.py
@@ -850,7 +850,12 @@ def __init__(self, topography, offset=(0, 0), info={}):
         offset -- Translation offset in number of grid points
         """
         super().__init__(topography, info=info)
-        assert isinstance(topography, Topography)
+        if not isinstance(topography, UniformTopographyInterface):
+            raise ValueError(f"Should provide an instance of UniformTopographyInterface "
+                             f"but {type(topography)} provided")
+        if not topography.is_periodic:
+            raise ValueError("Only periodic topographies can be translated")
+
         self._offset = offset
 
     @property


Test patch:
diff --git a/test/test_pipeline.py b/test/test_pipeline.py
index d83601a7..6a3fdea1 100644
--- a/test/test_pipeline.py
+++ b/test/test_pipeline.py
@@ -49,7 +49,7 @@
 
 def test_translate():
     topography = Topography(np.array([[0, 1, 0], [0, 0, 0]]),
-                            physical_sizes=(4., 3.))
+                            physical_sizes=(4., 3.), periodic=True)
 
     assert (topography.translate(offset=(1, 0)).heights()
             ==
@@ -67,9 +67,16 @@ def test_translate():
                       [0, 0, 0]])).all()
 
 
+def test_nonperiodic_not_allowed():
+    topography = Topography(np.array([[0, 1, 0], [0, 0, 0]]),
+                            physical_sizes=(4., 3.),)
+    with pytest.raises(ValueError):
+        topography.translate(offset=(1, 0))
+
+
 def test_translate_setter():
     topography = Topography(np.array([[0, 1, 0], [0, 0, 0]]),
-                            physical_sizes=(4., 3.))
+                            physical_sizes=(4., 3.), periodic=True)
 
     translated_t = topography.translate()
 
@@ -78,6 +85,9 @@ def test_translate_setter():
             ==
             np.array([[0, 0, 0],
                       [0, 1, 0]])).all()
+    topography = Topography(np.array([[0, 1, 0], [0, 0, 0]]),
+                            physical_sizes=(4., 3.), periodic=True)
+    assert topography.translate(offset=(1, 0)).is_periodic
 
 
 def test_superpose():