From 181b1ee9b74d0ed32c3af0ace2a246aa3ad86dc3 Mon Sep 17 00:00:00 2001 From: Michael Winkler Date: Mon, 24 Jun 2024 20:38:09 +0200 Subject: [PATCH 1/7] Renamed "lsc_child_in_parent" to "lcs_child_in_parent" --- weldx/tests/asdf_tests/test_asdf_core.py | 2 +- .../tests/transformations/test_cs_manager.py | 4 +-- weldx/transformations/cs_manager.py | 26 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/weldx/tests/asdf_tests/test_asdf_core.py b/weldx/tests/asdf_tests/test_asdf_core.py index bf02d11d3..b2a07fd63 100644 --- a/weldx/tests/asdf_tests/test_asdf_core.py +++ b/weldx/tests/asdf_tests/test_asdf_core.py @@ -366,7 +366,7 @@ def get_coordinate_system_manager_with_subsystems(nested: bool): # robot head system csm_head = tf.CoordinateSystemManager("head", "Head system") csm_head.add_cs("torch tcp", "head", lcs[3]) - csm_head.add_cs("camera tcp", "head", lcs[4], lsc_child_in_parent=False) + csm_head.add_cs("camera tcp", "head", lcs[4], lcs_child_in_parent=False) csm_head.add_cs("scanner 1 tcp", "head", lcs[5]) csm_head.add_cs("scanner 2 tcp", "head", lcs[6]) diff --git a/weldx/tests/transformations/test_cs_manager.py b/weldx/tests/transformations/test_cs_manager.py index 90250e493..768e16ada 100644 --- a/weldx/tests/transformations/test_cs_manager.py +++ b/weldx/tests/transformations/test_cs_manager.py @@ -56,7 +56,7 @@ def list_of_csm_and_lcs_instances(): csm_1.add_cs("lcs4", "lcs0", lcs[4]) csm_2 = CSM("lcs5", "csm2") - csm_2.add_cs("lcs3", "lcs5", lcs[5], lsc_child_in_parent=False) + csm_2.add_cs("lcs3", "lcs5", lcs[5], lcs_child_in_parent=False) csm_2.add_cs("lcs6", "lcs5", lcs[6]) csm_3 = CSM("lcs6", "csm3") @@ -64,7 +64,7 @@ def list_of_csm_and_lcs_instances(): csm_3.add_cs("lcs8", "lcs6", lcs[8]) csm_4 = CSM("lcs9", "csm4") - csm_4.add_cs("lcs3", "lcs9", lcs[9], lsc_child_in_parent=False) + csm_4.add_cs("lcs3", "lcs9", lcs[9], lcs_child_in_parent=False) csm_5 = CSM("lcs7", "csm5") csm_5.add_cs("lcs10", "lcs7", lcs[10]) diff --git a/weldx/transformations/cs_manager.py b/weldx/transformations/cs_manager.py index c118b5790..5e51e9a29 100644 --- a/weldx/transformations/cs_manager.py +++ b/weldx/transformations/cs_manager.py @@ -440,7 +440,7 @@ def add_cs( coordinate_system_name: str, reference_system_name: str, lcs: LocalCoordinateSystem, - lsc_child_in_parent: bool = True, + lcs_child_in_parent: bool = True, ): """Add a coordinate system to the coordinate system manager. @@ -469,7 +469,7 @@ def add_cs( An instance of `LocalCoordinateSystem` that describes how the new coordinate system is oriented in its parent system. - lsc_child_in_parent + lcs_child_in_parent If set to `True`, the passed `LocalCoordinateSystem` instance describes the new system orientation towards is parent. If `False`, it describes how the parent system is positioned in its new child system. @@ -508,7 +508,7 @@ def add_cs( f'Can not update coordinate system. "{reference_system_name}" is ' f"not a neighbor of {coordinate_system_name}" ) - if lsc_child_in_parent: + if lcs_child_in_parent: self._update_local_coordinate_system( coordinate_system_name, reference_system_name, @@ -523,7 +523,7 @@ def add_cs( else: self._check_coordinate_system_exists(reference_system_name) self._add_coordinate_system_node(coordinate_system_name) - if lsc_child_in_parent: + if lcs_child_in_parent: self._add_edges( coordinate_system_name, reference_system_name, @@ -648,7 +648,7 @@ def create_cs( coordinates: types_coordinates = None, time: types_time_like = None, time_ref: types_timestamp_like = None, - lsc_child_in_parent: bool = True, + lcs_child_in_parent: bool = True, ): """Create a coordinate system and add it to the coordinate system manager. @@ -674,7 +674,7 @@ def create_cs( Time data for time dependent coordinate systems. time_ref : Reference time for time dependent coordinate systems - lsc_child_in_parent : + lcs_child_in_parent : If set to `True`, the passed `LocalCoordinateSystem` instance describes the new system orientation towards is parent. If `False`, it describes how the parent system is positioned in its new child system. @@ -682,7 +682,7 @@ def create_cs( """ lcs = LocalCoordinateSystem(orientation, coordinates, time, time_ref) self.add_cs( - coordinate_system_name, reference_system_name, lcs, lsc_child_in_parent + coordinate_system_name, reference_system_name, lcs, lcs_child_in_parent ) def create_cs_from_euler( @@ -695,7 +695,7 @@ def create_cs_from_euler( coordinates: types_coordinates = None, time: types_time_like = None, time_ref: types_timestamp_like = None, - lsc_child_in_parent: bool = True, + lcs_child_in_parent: bool = True, ): """Create a coordinate system and add it to the coordinate system manager. @@ -735,7 +735,7 @@ def create_cs_from_euler( Time data for time dependent coordinate systems. time_ref : Reference time for time dependent coordinate systems - lsc_child_in_parent : + lcs_child_in_parent : If set to `True`, the passed `LocalCoordinateSystem` instance describes the new system orientation towards is parent. If `False`, it describes how the parent system is positioned in its new child system. @@ -746,7 +746,7 @@ def create_cs_from_euler( sequence, angles, degrees, coordinates, time, time_ref ) self.add_cs( - coordinate_system_name, reference_system_name, lcs, lsc_child_in_parent + coordinate_system_name, reference_system_name, lcs, lcs_child_in_parent ) def create_cs_from_axis_vectors( @@ -759,7 +759,7 @@ def create_cs_from_axis_vectors( coordinates: types_coordinates = None, time: types_time_like = None, time_ref: types_timestamp_like = None, - lsc_child_in_parent: bool = True, + lcs_child_in_parent: bool = True, ): """Create a coordinate system and add it to the `CoordinateSystemManager`. @@ -784,7 +784,7 @@ def create_cs_from_axis_vectors( Time data for time dependent coordinate systems (Default value = None) time_ref : Optional reference timestamp if ``time`` is a time delta. - lsc_child_in_parent : + lcs_child_in_parent : If set to `True`, the passed `LocalCoordinateSystem` instance describes the new system orientation towards is parent. If `False`, it describes how the parent system is positioned in its new child system. @@ -812,7 +812,7 @@ def create_cs_from_axis_vectors( x, y, z, coordinates, time, time_ref ) self.add_cs( - coordinate_system_name, reference_system_name, lcs, lsc_child_in_parent + coordinate_system_name, reference_system_name, lcs, lcs_child_in_parent ) def delete_cs(self, coordinate_system_name: str, delete_children: bool = False): From f70694615d0edb5f95f1ff5edf882ba904e60afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Tue, 25 Jun 2024 07:25:07 +0200 Subject: [PATCH 2/7] update CSM notebook --- .../transformations_02_coordinate_system_manager.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/tutorials/transformations_02_coordinate_system_manager.ipynb b/doc/src/tutorials/transformations_02_coordinate_system_manager.ipynb index 78d3ee4c5..8030a7943 100644 --- a/doc/src/tutorials/transformations_02_coordinate_system_manager.ipynb +++ b/doc/src/tutorials/transformations_02_coordinate_system_manager.ipynb @@ -70,7 +70,7 @@ " The position and orientation of the new coordinate system that will be passed in form of a `LocalCoordinateSystem` refer to this reference system\n", "3. A `LocalCoordinateSystem` that describes the position and orientation of the new coordinate system in its reference system.\n", "\n", - "In case you only have the inverse data, meaning the position and orientation of the reference system inside the new coordinate system, you can set the fourth parameter (`lsc_child_in_parent`) to `False` and use the corresponding data instead." + "In case you only have the inverse data, meaning the position and orientation of the reference system inside the new coordinate system, you can set the fourth parameter (`lcs_child_in_parent`) to `False` and use the corresponding data instead." ] }, { @@ -88,7 +88,7 @@ "\n", "csm.add_cs(\"specimen\", \"root\", lcs_specimen_in_root)\n", "csm.add_cs(\n", - " \"thermocouple\", \"specimen\", lcs_specimen_in_thermocouple, lsc_child_in_parent=False\n", + " \"thermocouple\", \"specimen\", lcs_specimen_in_thermocouple, lcs_child_in_parent=False\n", ")" ] }, @@ -102,7 +102,7 @@ "Similarly, there are functions for each of the `LocalCoordinateSystem`s construction methods (`from_euler`, `from_xyz`, etc.). \n", "The naming is simply `create_cs_` plus the name of the corresponding function of the `LoocalCoordinateSystem`. \n", "For example `construct_cs_from_euler` ([link tofunction documentation](https://weldx.readthedocs.io/en/latest/_autosummary/weldx.CoordinateSystemManager.create_cs_from_euler.html#weldx.CoordinateSystemManager.create_cs_from_euler)). \n", - "As with `add_cs`, the last parameter of all those methods is `lsc_child_in_parent` which can be set to `False` if the provided values represent the orientation and coordinates of the reference system in the new child system." + "As with `add_cs`, the last parameter of all those methods is `lcs_child_in_parent` which can be set to `False` if the provided values represent the orientation and coordinates of the reference system in the new child system." ] }, { @@ -218,7 +218,7 @@ "metadata": {}, "source": [ "However, note that the returned coordinate system is not necessarily identical to the one that we used during the definition.\n", - "If we were setting the `lsc_child_in_parent` during the addition of the coordinate system to `False`, we provided the inverse transformation:" + "If we were setting the `lcs_child_in_parent` during the addition of the coordinate system to `False`, we provided the inverse transformation:" ] }, { From 52bb7c1cc1bb5008af677de72539ef3e66f72b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Tue, 25 Jun 2024 07:37:43 +0200 Subject: [PATCH 3/7] add deprecation warning --- weldx/transformations/cs_manager.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/weldx/transformations/cs_manager.py b/weldx/transformations/cs_manager.py index 5e51e9a29..1cb4ff002 100644 --- a/weldx/transformations/cs_manager.py +++ b/weldx/transformations/cs_manager.py @@ -14,7 +14,7 @@ from weldx import util from weldx.core import TimeSeries -from weldx.exceptions import WeldxException +from weldx.exceptions import WeldxDeprecationWarning, WeldxException from weldx.geometry import SpatialData from weldx.time import Time, types_time_like, types_timestamp_like from weldx.util import check_matplotlib_available, dataclass_nested_eq @@ -441,6 +441,7 @@ def add_cs( reference_system_name: str, lcs: LocalCoordinateSystem, lcs_child_in_parent: bool = True, + lsc_child_in_parent: bool = True, ): """Add a coordinate system to the coordinate system manager. @@ -473,8 +474,22 @@ def add_cs( If set to `True`, the passed `LocalCoordinateSystem` instance describes the new system orientation towards is parent. If `False`, it describes how the parent system is positioned in its new child system. + lsc_child_in_parent + DEPRECATED. Use ``lcs_child_in_parent`` instead. """ + if not lsc_child_in_parent: + warnings.warn( + ( + "Argument 'lsc_child_in_parent' is deprecated" + " and will be removed in 0.7 please use 'lcs_child_in_parent'" + ), + category=WeldxDeprecationWarning, + stacklevel=2, + ) + if lcs_child_in_parent: + lcs_child_in_parent = lsc_child_in_parent + if not isinstance(lcs, LocalCoordinateSystem): raise TypeError( "'local_coordinate_system' must be an instance of LocalCoordinateSystem" From 98d81b921e7785ce8cb56f2f07e9a86087da245d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Tue, 25 Jun 2024 07:40:20 +0200 Subject: [PATCH 4/7] update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34885d40a..3fa3b5472 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes +## 0.6.9 (unreleased) + +### Fixes + +- rename (fix typo) argument to `lcs_child_in_parent` in `CoordinateSystemManager.add_cs` \[{pull}`936`\]. + ## 0.6.8 (07.06.2024) ### Changes From cd30683597a45e64bb70c0f9b5ab4541e281d4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Tue, 25 Jun 2024 09:07:14 +0200 Subject: [PATCH 5/7] pin numpy<2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 446fd1bf1..eaba32ef1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ dependencies = [ "ipython", "meshio", "networkx>=2.8.2", - "numpy>=1.20", + "numpy>=1.20",<2, "pandas>=1.5", "pint>=0.18", "pint-xarray>=0.3", From f64aa4529d4599c4d4d0156f8c69b8809857c717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Tue, 25 Jun 2024 09:08:01 +0200 Subject: [PATCH 6/7] pin numpy<2 for rtd --- doc/rtd_environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rtd_environment.yml b/doc/rtd_environment.yml index 295cc22de..9c6638dc8 100644 --- a/doc/rtd_environment.yml +++ b/doc/rtd_environment.yml @@ -5,7 +5,7 @@ dependencies: - python=3.10 - setuptools_scm # weldx base dependencies - - numpy>=1.18 + - numpy>=1.18,<2 - pandas>=1.0 - xarray>=0.15 - pint>=0.11 From 4a74c2573fe2fed8dfc28864113933a604e36c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Tue, 25 Jun 2024 09:10:55 +0200 Subject: [PATCH 7/7] lint --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index eaba32ef1..87e0ceea4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ dependencies = [ "ipython", "meshio", "networkx>=2.8.2", - "numpy>=1.20",<2, + "numpy>=1.20,<2", "pandas>=1.5", "pint>=0.18", "pint-xarray>=0.3",