Repository: emsig/emg3d

Issue:
`emg3d.TxMagneticDipole` shows wrong coordinates.
```
> src = emg3d.TxMagneticDipole(coordinates=[0.0, 0.0, 0.0, 0.0, -0.5, 0.5])
> src
TxMagneticDipole: 1.0 A;
    e1={0.0; 0.7; 0.0} m; e2={-0.7; 0.0; 0.0} m
```
which are just the first two points of it,
```
> src.points
array([[ 0.        ,  0.70710678,  0.        ],
       [-0.70710678,  0.        ,  0.        ],
       [ 0.        , -0.70710678,  0.        ],
       [ 0.70710678,  0.        ,  0.        ],
       [ 0.        ,  0.70710678,  0.        ]])
```

Discussion:

Patch:
diff --git a/emg3d/electrodes.py b/emg3d/electrodes.py
index 8a31385..e31ec0f 100644
--- a/emg3d/electrodes.py
+++ b/emg3d/electrodes.py
@@ -323,7 +323,7 @@ class Dipole(Wire):
 
             if is_flat:
                 # Re-arrange for points.
-                points = np.array([coordinates[::2], coordinates[1::2]])
+                points = coordinates.reshape((2, 3), order='F')
 
                 # Store original input.
                 self._coordinates = coordinates
@@ -375,10 +375,20 @@ class Dipole(Wire):
 
         # Finite dipole.
         else:
-            s1 = (f"    e1={{{self.points[0, 0]:,.1f}; "
-                  f"{self.points[0, 1]:,.1f}; {self.points[0, 2]:,.1f}}} m; ")
-            s2 = (f"e2={{{self.points[1, 0]:,.1f}; "
-                  f"{self.points[1, 1]:,.1f}; {self.points[1, 2]:,.1f}}} m")
+
+            # Finite magnetic dipole.
+            if self._xtype == 'magnetic':
+                if self.coordinates.ndim == 1:
+                    points = self.coordinates
+                else:
+                    points = self.coordinates.ravel('F')
+            else:
+                points = self.points.ravel('F')
+
+            s1 = (f"    e1={{{points[0]:,.1f}; "
+                  f"{points[2]:,.1f}; {points[4]:,.1f}}} m; ")
+            s2 = (f"e2={{{points[1]:,.1f}; "
+                  f"{points[3]:,.1f}; {points[5]:,.1f}}} m")
 
         return s0 + s1 + s2 if len(s1+s2) < 80 else s0 + s1 + "\n    " + s2
 


Test patch:
diff --git a/tests/test_electrodes.py b/tests/test_electrodes.py
index baa98ba..d0a5e06 100644
--- a/tests/test_electrodes.py
+++ b/tests/test_electrodes.py
@@ -273,6 +273,8 @@ def test_tx_magnetic_dipole():
     s5a = electrodes.TxMagneticDipole(
             (-1, 1, -1, 1, -np.sqrt(2), np.sqrt(2)), strength=np.pi)
     s5b = electrodes.TxMagneticDipole.from_dict(s5a.to_dict())
+    rep = s5b.__repr__()
+    assert "m; e2={1.0; 1.0; " in rep
     assert s5a == s5b
     s6a = electrodes.TxMagneticDipole(
             [[-1, -1, -np.sqrt(2)], [1, 1, np.sqrt(2)]], strength=np.pi)
@@ -287,7 +289,7 @@ def test_tx_magnetic_dipole():
 
     rep = s6b.__repr__()
     assert "3.1 A" in rep
-    assert "m; e2={-0.7" in rep
+    assert "m; e2={1.0; 1.0; " in rep
 
 
 def test_tx_electric_wire():