Repository: BAMWelDX/weldx

Issue:
CSM.__eq__ does not consider attached data
This is a really low priority issue since CSM comparison is mainly used in tests, but as the title says, attached data is not considered during the comparison.

Discussion:
github-actions[bot]: ## Unit Test Results
       1 files  ±0         1 suites  ±0   1m 25s [:stopwatch:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols "duration of all tests") -1s
1 931 tests +1  1 931 [:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols "passed tests") +1  0 [:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols "skipped / disabled tests") ±0  0 [:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols "failed tests") ±0 

Results for commit a58accff. ± Comparison against base commit 23ad669b.

codecov[bot]: # [Codecov](https://codecov.io/gh/BAMWelDX/weldx/pull/648?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX) Report
> Merging [#648](https://codecov.io/gh/BAMWelDX/weldx/pull/648?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX) (ef53145) into [master](https://codecov.io/gh/BAMWelDX/weldx/commit/04327b7981ac6bf2bd577826a488b1f7cc69e6ee?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX) (04327b7) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/BAMWelDX/weldx/pull/648/graphs/tree.svg?width=650&height=150&src=pr&token=wdof1qQTsn&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX)](https://codecov.io/gh/BAMWelDX/weldx/pull/648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX)

```diff
@@           Coverage Diff           @@
##           master     #648   +/-   ##
=======================================
  Coverage   94.49%   94.50%           
=======================================
  Files          93       93           
  Lines        6018     6021    +3     
=======================================
+ Hits         5687     5690    +3     
  Misses        331      331           
```


| [Impacted Files](https://codecov.io/gh/BAMWelDX/weldx/pull/648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX) | Coverage Δ | |
|---|---|---|
| [weldx/geometry.py](https://codecov.io/gh/BAMWelDX/weldx/pull/648/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX#diff-d2VsZHgvZ2VvbWV0cnkucHk=) | `97.49% <100.00%> (ø)` | |
| [weldx/transformations/cs\_manager.py](https://codecov.io/gh/BAMWelDX/weldx/pull/648/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX#diff-d2VsZHgvdHJhbnNmb3JtYXRpb25zL2NzX21hbmFnZXIucHk=) | `98.77% <100.00%> (+<0.01%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/BAMWelDX/weldx/pull/648?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/BAMWelDX/weldx/pull/648?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX). Last update [22f6e1e...ef53145](https://codecov.io/gh/BAMWelDX/weldx/pull/648?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BAMWelDX).


Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index dd121c5..2d31cf3 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -57,6 +57,10 @@ dependencies
 -  Removed ``ipykernel`` dependency. `[#634]
    <https://github.com/BAMWelDX/weldx/pull/634>`__
 
+-  The ``K3D`` implementation now uses the experimental
+   ``weldx-widgets`` backend if available `[#636]
+   <https://github.com/BAMWelDX/weldx/pull/636>`__
+
 ********************
  0.5.1 (04.11.2021)
 ********************
diff --git a/weldx/transformations/cs_manager.py b/weldx/transformations/cs_manager.py
index e37abcc..1ae944e 100644
--- a/weldx/transformations/cs_manager.py
+++ b/weldx/transformations/cs_manager.py
@@ -149,7 +149,6 @@ class CoordinateSystemManager:
 
     def __eq__(self, other: Any):
         """Test equality of CSM instances."""
-        # todo: also check data  -> add tests
         if not isinstance(other, self.__class__):
             return False
 
@@ -175,17 +174,19 @@ class CoordinateSystemManager:
         for node in graph_0.nodes:
             if node not in graph_1.nodes:
                 return False
+            n0 = graph_0.nodes[node]
+            n1 = graph_1.nodes[node]
+            if not util.compare_nested(n0, n1):
+                return False
 
         # check edges
         for edge in graph_0.edges:
             if edge not in graph_1.edges:
                 return False
 
-        # check coordinate systems
-        for edge in graph_0.edges:
-            lcs_0 = self.graph.edges[(edge[0], edge[1])]["transformation"]
-            lcs_1 = other.graph.edges[(edge[0], edge[1])]["transformation"]
-            if lcs_0 != lcs_1:
+            e0 = graph_0.edges[edge]
+            e1 = graph_1.edges[edge]
+            if not util.compare_nested(e0, e1):
                 return False
 
         return True
diff --git a/weldx/visualization/__init__.py b/weldx/visualization/__init__.py
index fafa89a..1843035 100644
--- a/weldx/visualization/__init__.py
+++ b/weldx/visualization/__init__.py
@@ -1,5 +1,16 @@
 """Visualization of spatial data, coordinate systems (cs), and cs manager."""
-from .k3d_impl import CoordinateSystemManagerVisualizerK3D, SpatialDataVisualizer
+try:
+    from warnings import warn
+
+    from weldx_widgets.visualization.csm_k3d import (
+        CoordinateSystemManagerVisualizerK3D,
+        SpatialDataVisualizer,
+    )
+
+    warn("Using experimental 'weldx-widgets' implementation.", UserWarning)
+except ImportError:
+    from .k3d_impl import CoordinateSystemManagerVisualizerK3D, SpatialDataVisualizer
+
 from .matplotlib_impl import (
     axes_equal,
     draw_coordinate_system_matplotlib,


Test patch:
diff --git a/weldx/tests/transformations/test_cs_manager.py b/weldx/tests/transformations/test_cs_manager.py
index 34276b8..302dbb5 100644
--- a/weldx/tests/transformations/test_cs_manager.py
+++ b/weldx/tests/transformations/test_cs_manager.py
@@ -737,6 +737,18 @@ def test_comparison_wrong_type():
     assert (csm != 4) is True
 
 
+def test_comparison_data():
+    csm1 = tf.CoordinateSystemManager("root", "csm")
+    csm2 = tf.CoordinateSystemManager("root", "csm")
+    data = np.arange(12).reshape((4, 3))
+    csm1.assign_data(data, data_name="foo", reference_system="root")
+    csm2.assign_data(data, data_name="foo", reference_system="root")
+
+    assert csm1 == csm2
+    csm2.assign_data(data, data_name="bar", reference_system="root")
+    assert csm1 != csm2
+
+
 # test_time_union ----------------------------------------------------------------------