Skip to content

Commit

Permalink
Merge branch 'master' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
CagtayFabry authored Jul 4, 2024
2 parents d61615c + 9fd9208 commit 68dfc62
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/rtd_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand All @@ -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",
")"
]
},
Expand All @@ -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."
]
},
{
Expand Down Expand Up @@ -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:"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion weldx/tests/asdf_tests/test_asdf_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
4 changes: 2 additions & 2 deletions weldx/tests/transformations/test_cs_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ 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")
csm_3.add_cs("lcs7", "lcs6", lcs[7])
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])
Expand Down
41 changes: 28 additions & 13 deletions weldx/transformations/cs_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -440,6 +440,7 @@ def add_cs(
coordinate_system_name: str,
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.
Expand Down Expand Up @@ -469,12 +470,26 @@ 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.
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"
Expand Down Expand Up @@ -508,7 +523,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,
Expand All @@ -523,7 +538,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,
Expand Down Expand Up @@ -648,7 +663,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.
Expand All @@ -674,15 +689,15 @@ 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.
"""
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(
Expand All @@ -695,7 +710,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.
Expand Down Expand Up @@ -735,7 +750,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.
Expand All @@ -746,7 +761,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(
Expand All @@ -759,7 +774,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`.
Expand All @@ -784,7 +799,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.
Expand Down Expand Up @@ -812,7 +827,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):
Expand Down

0 comments on commit 68dfc62

Please sign in to comment.