diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4c6c3f177..ea68150b1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -27,6 +27,9 @@ changes - The ``wx_property_tag`` validator now also accepts lists of different tags. [:pull:`670`] When multiple tags are passed, validation will fail if *none* of the supplied patterns match. +- Due to a `pandas` update, using the + operator with `Time` and either a `pandas.TimedeltaIndex` or `pandas.DatetimeIndex` + now only works if the `Time` instance is on the left-hand side. [:pull:`684`] + fixes ===== diff --git a/weldx/asdf/cli/welding_schema.py b/weldx/asdf/cli/welding_schema.py index 575e826cb..4b65aad82 100644 --- a/weldx/asdf/cli/welding_schema.py +++ b/weldx/asdf/cli/welding_schema.py @@ -28,21 +28,23 @@ def single_pass_weld_example( import pandas as pd from asdf.tags.core import Software - # importing the weldx package with prevalent default abbreviations - import weldx import weldx.geometry as geo import weldx.measurement as msm - from weldx import Q_, GmawProcess - from weldx import LocalCoordinateSystem as lcs - from weldx import TimeSeries, WXRotation, get_groove - from weldx.asdf.util import get_schema_path, write_buffer - from weldx.constants import META_ATTR - from weldx.core import MathematicalExpression + + # importing the weldx package with prevalent default abbreviations + import weldx.transformations as tf + from weldx.asdf.util import get_schema_path, write_buffer, write_read_buffer + from weldx.constants import META_ATTR, Q_ + from weldx.core import MathematicalExpression, TimeSeries from weldx.tags.aws.process.gas_component import GasComponent from weldx.tags.aws.process.shielding_gas_for_procedure import ( ShieldingGasForProcedure, ) from weldx.tags.aws.process.shielding_gas_type import ShieldingGasType + from weldx.tags.processes.process import GmawProcess + from weldx.transformations.local_cs import LocalCoordinateSystem as lcs + from weldx.transformations.rotation import WXRotation + from weldx.welding.groove.iso_9692_1 import get_groove from weldx.welding.util import sine # Timestamp @@ -73,7 +75,7 @@ def single_pass_weld_example( # Setup the Coordinate System Manager (CSM) # crete a new coordinate system manager with default base coordinate system - csm = weldx.transformations.CoordinateSystemManager("base") + csm = tf.CoordinateSystemManager("base") # add the workpiece coordinate system csm.add_cs( @@ -298,7 +300,7 @@ def single_pass_weld_example( model_path = get_schema_path("single_pass_weld-0.1.0.yaml") # pre-validate? - weldx.asdf.util.write_read_buffer( + write_read_buffer( tree, asdffile_kwargs=dict(custom_schema=str(model_path)), ) diff --git a/weldx/asdf/file.py b/weldx/asdf/file.py index 99dc0b09f..faa6b318a 100644 --- a/weldx/asdf/file.py +++ b/weldx/asdf/file.py @@ -426,7 +426,7 @@ def software_history_entry(self): def software_history_entry(self, value: dict): """Set the software used for making history entries.""" if value is None: - from weldx import __version__ as version + from weldx._version import __version__ as version self._DEFAULT_SOFTWARE_ENTRY = { "name": "weldx", diff --git a/weldx/asdf/util.py b/weldx/asdf/util.py index bd0d50c67..9fb992a5b 100644 --- a/weldx/asdf/util.py +++ b/weldx/asdf/util.py @@ -116,7 +116,7 @@ def show(wx): if _use_weldx_file: write_kwargs = dict(all_array_storage="inline") - from weldx import WeldxFile + from weldx.asdf.file import WeldxFile with WeldxFile( tree=tree, @@ -171,7 +171,7 @@ def read_buffer( if _use_weldx_file is None: _use_weldx_file = _USE_WELDX_FILE if _use_weldx_file: - from weldx import WeldxFile + from weldx.asdf.file import WeldxFile return WeldxFile(buffer, asdffile_kwargs=open_kwargs) diff --git a/weldx/tags/debug/test_shape_validator.py b/weldx/tags/debug/test_shape_validator.py index 3b766a9b6..7c43a1594 100644 --- a/weldx/tags/debug/test_shape_validator.py +++ b/weldx/tags/debug/test_shape_validator.py @@ -4,8 +4,9 @@ import pandas as pd import pint -from weldx import Q_, TimeSeries from weldx.asdf.util import dataclass_serialization_class +from weldx.constants import Q_ +from weldx.core import TimeSeries __all__ = ["ShapeValidatorTestClass", "ShapeValidatorTestClassConverter"] diff --git a/weldx/tags/debug/test_unit_validator.py b/weldx/tags/debug/test_unit_validator.py index b1e4cb856..f36a8e367 100644 --- a/weldx/tags/debug/test_unit_validator.py +++ b/weldx/tags/debug/test_unit_validator.py @@ -3,8 +3,8 @@ import numpy as np import pint -from weldx import Q_ from weldx.asdf.util import dataclass_serialization_class +from weldx.constants import Q_ __all__ = ["UnitValidatorTestClass", "UnitValidatorTestClassConverter"] diff --git a/weldx/tests/asdf_tests/test_asdf_gmaw_process.py b/weldx/tests/asdf_tests/test_asdf_gmaw_process.py index fb3c61349..be92035ae 100644 --- a/weldx/tests/asdf_tests/test_asdf_gmaw_process.py +++ b/weldx/tests/asdf_tests/test_asdf_gmaw_process.py @@ -2,8 +2,8 @@ import pytest -from weldx import Q_ from weldx.asdf.util import write_read_buffer +from weldx.constants import Q_ from weldx.core import TimeSeries from weldx.welding.processes import GmawProcess diff --git a/weldx/tests/asdf_tests/test_asdf_measurement.py b/weldx/tests/asdf_tests/test_asdf_measurement.py index a94675f88..c540df770 100644 --- a/weldx/tests/asdf_tests/test_asdf_measurement.py +++ b/weldx/tests/asdf_tests/test_asdf_measurement.py @@ -1,7 +1,7 @@ import pytest -from weldx import Q_ from weldx.asdf.util import write_read_buffer +from weldx.constants import Q_ from weldx.core import MathematicalExpression from weldx.measurement import ( Error, diff --git a/weldx/tests/asdf_tests/test_asdf_time.py b/weldx/tests/asdf_tests/test_asdf_time.py index 589b12277..1b2ba049e 100644 --- a/weldx/tests/asdf_tests/test_asdf_time.py +++ b/weldx/tests/asdf_tests/test_asdf_time.py @@ -3,8 +3,8 @@ import pandas as pd import pytest -from weldx import Time from weldx.asdf.util import write_buffer, write_read_buffer +from weldx.time import Time @pytest.mark.parametrize( diff --git a/weldx/tests/asdf_tests/test_asdf_util.py b/weldx/tests/asdf_tests/test_asdf_util.py index 5b0b7dfe6..db5cd6398 100644 --- a/weldx/tests/asdf_tests/test_asdf_util.py +++ b/weldx/tests/asdf_tests/test_asdf_util.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from weldx import WeldxFile +from weldx.asdf.file import WeldxFile from weldx.asdf.util import ( dataclass_serialization_class, get_highest_tag_version, diff --git a/weldx/tests/asdf_tests/test_asdf_validators.py b/weldx/tests/asdf_tests/test_asdf_validators.py index af4787fd2..013c17100 100644 --- a/weldx/tests/asdf_tests/test_asdf_validators.py +++ b/weldx/tests/asdf_tests/test_asdf_validators.py @@ -4,10 +4,11 @@ import pytest from asdf import ValidationError -from weldx import Q_, TimeSeries from weldx.asdf.types import WxSyntaxError from weldx.asdf.util import write_buffer, write_read_buffer from weldx.asdf.validators import _custom_shape_validator +from weldx.constants import Q_ +from weldx.core import TimeSeries from weldx.tags.debug.test_property_tag import PropertyTagTestClass from weldx.tags.debug.test_shape_validator import ShapeValidatorTestClass from weldx.tags.debug.test_unit_validator import UnitValidatorTestClass diff --git a/weldx/tests/asdf_tests/test_weldx_file.py b/weldx/tests/asdf_tests/test_weldx_file.py index ab6c0c584..5f447ab12 100644 --- a/weldx/tests/asdf_tests/test_weldx_file.py +++ b/weldx/tests/asdf_tests/test_weldx_file.py @@ -12,9 +12,8 @@ import xarray as xr from jsonschema import ValidationError -from weldx import WeldxFile from weldx.asdf.cli.welding_schema import single_pass_weld_example -from weldx.asdf.file import _PROTECTED_KEYS, DEFAULT_ARRAY_INLINE_THRESHOLD +from weldx.asdf.file import _PROTECTED_KEYS, DEFAULT_ARRAY_INLINE_THRESHOLD, WeldxFile from weldx.asdf.util import get_schema_path from weldx.constants import META_ATTR from weldx.types import SupportsFileReadWrite diff --git a/weldx/tests/test_config.py b/weldx/tests/test_config.py index 43cf3c1d6..3f6d4f02f 100644 --- a/weldx/tests/test_config.py +++ b/weldx/tests/test_config.py @@ -4,7 +4,7 @@ import asdf import pytest -from weldx import WeldxFile +from weldx.asdf.file import WeldxFile from weldx.config import QualityStandard, add_quality_standard, enable_quality_standard from weldx.constants import META_ATTR from weldx.measurement import MeasurementEquipment diff --git a/weldx/tests/test_geometry.py b/weldx/tests/test_geometry.py index abe65d0f6..9dfd007cf 100644 --- a/weldx/tests/test_geometry.py +++ b/weldx/tests/test_geometry.py @@ -15,9 +15,10 @@ import weldx.geometry as geo import weldx.tests._helpers as helpers import weldx.transformations as tf -from weldx import Q_, CoordinateSystemManager +from weldx.constants import Q_ from weldx.geometry import SpatialData from weldx.transformations import WXRotation +from weldx.transformations.cs_manager import CoordinateSystemManager from ._helpers import matrix_is_close, vector_is_close diff --git a/weldx/tests/test_time.py b/weldx/tests/test_time.py index b2c99859c..50154e6ef 100644 --- a/weldx/tests/test_time.py +++ b/weldx/tests/test_time.py @@ -13,8 +13,10 @@ from pandas import Timestamp, date_range from pint import DimensionalityError -from weldx import Q_, LocalCoordinateSystem, TimeSeries +from weldx.constants import Q_ +from weldx.core import TimeSeries from weldx.time import Time, types_time_like +from weldx.transformations.local_cs import LocalCoordinateSystem def _initialize_delta_type(cls_type, values, unit): diff --git a/weldx/tests/transformations/test_cs_manager.py b/weldx/tests/transformations/test_cs_manager.py index 1160c4fdf..2f75ba24d 100644 --- a/weldx/tests/transformations/test_cs_manager.py +++ b/weldx/tests/transformations/test_cs_manager.py @@ -11,8 +11,9 @@ from pandas import Timestamp as TS # noqa import weldx.transformations as tf -from weldx import Q_, SpatialData +from weldx.constants import Q_ from weldx.core import MathematicalExpression, TimeSeries +from weldx.geometry import SpatialData from weldx.tests._helpers import get_test_name, matrix_is_close from weldx.time import Time, types_time_like, types_timestamp_like from weldx.transformations import CoordinateSystemManager as CSM # noqa diff --git a/weldx/tests/transformations/test_local_cs.py b/weldx/tests/transformations/test_local_cs.py index a45cd093a..53f4e3108 100644 --- a/weldx/tests/transformations/test_local_cs.py +++ b/weldx/tests/transformations/test_local_cs.py @@ -13,7 +13,7 @@ import weldx.transformations as tf import weldx.util as ut -from weldx import Q_ +from weldx.constants import Q_ from weldx.core import MathematicalExpression, TimeSeries from weldx.tests._helpers import get_test_name from weldx.time import Time diff --git a/weldx/transformations/cs_manager.py b/weldx/transformations/cs_manager.py index f25f06638..6cfb7d7f8 100644 --- a/weldx/transformations/cs_manager.py +++ b/weldx/transformations/cs_manager.py @@ -26,8 +26,6 @@ import matplotlib.axes import networkx as nx - import weldx # noqa - _DEFAULT_LEN_UNIT = UREG.millimeters _DEFAULT_ANG_UNIT = UREG.rad @@ -193,7 +191,7 @@ def __eq__(self, other: Any): @property def lcs(self) -> list[LocalCoordinateSystem]: - """Get a list of all attached `~weldx.transformations.LocalCoordinateSystem` \ + """Get a list of all attached `LocalCoordinateSystem` \ instances. Only the defined systems and not the automatically generated inverse systems @@ -201,9 +199,8 @@ def lcs(self) -> list[LocalCoordinateSystem]: Returns ------- - List[~weldx.transformations.LocalCoordinateSystem] : - List of all attached `~weldx.transformations.LocalCoordinateSystem` - instances. + list[LocalCoordinateSystem] : + List of all attached `LocalCoordinateSystem` instances. """ return [ @@ -214,14 +211,12 @@ def lcs(self) -> list[LocalCoordinateSystem]: @property def lcs_time_dependent(self) -> list[LocalCoordinateSystem]: - """Get a list of all attached time dependent \ - `~weldx.transformations.LocalCoordinateSystem` instances. + """Get a list of all attached time dependent `LocalCoordinateSystem` instances. Returns ------- - List[~weldx.transformations.LocalCoordinateSystem] : - List of all attached time dependent - `~weldx.transformations.LocalCoordinateSystem` instances + list[LocalCoordinateSystem] : + List of all attached time dependent `LocalCoordinateSystem` instances """ return [lcs for lcs in self.lcs if lcs.is_time_dependent] @@ -473,19 +468,17 @@ def add_cs( Name of the parent system. This must have been already added. lcs An instance of - `~weldx.transformations.LocalCoordinateSystem` that describes how the new + `LocalCoordinateSystem` that describes how the new coordinate system is oriented in its parent system. lsc_child_in_parent - If set to `True`, the passed - `~weldx.transformations.LocalCoordinateSystem` instance describes + 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. """ if not isinstance(lcs, LocalCoordinateSystem): raise TypeError( - "'local_coordinate_system' must be an instance of " - + "weldx.transformations.LocalCoordinateSystem" + "'local_coordinate_system' must be an instance of LocalCoordinateSystem" ) if ( @@ -650,7 +643,7 @@ def create_cs( """Create a coordinate system and add it to the coordinate system manager. This function uses the ``__init__`` method of the - `~weldx.transformations.LocalCoordinateSystem` class. + `LocalCoordinateSystem` class. Parameters ---------- @@ -672,8 +665,7 @@ def create_cs( time_ref : Reference time for time dependent coordinate systems lsc_child_in_parent : - If set to `True`, the passed - `~weldx.transformations.LocalCoordinateSystem` instance describes + 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. @@ -697,8 +689,8 @@ def create_cs_from_euler( ): """Create a coordinate system and add it to the coordinate system manager. - This function uses the `~weldx.transformations.LocalCoordinateSystem.from_euler` - method of the `~weldx.transformations.LocalCoordinateSystem` class. + This function uses the `LocalCoordinateSystem.from_euler` method of the + `LocalCoordinateSystem` class. Parameters ---------- @@ -734,8 +726,7 @@ def create_cs_from_euler( time_ref : Reference time for time dependent coordinate systems lsc_child_in_parent : - If set to `True`, the passed - `~weldx.transformations.LocalCoordinateSystem` instance describes + 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. @@ -762,9 +753,8 @@ def create_cs_from_axis_vectors( ): """Create a coordinate system and add it to the `CoordinateSystemManager`. - This function uses the - `~weldx.transformations.LocalCoordinateSystem.from_axis_vectors` - method of the `~weldx.transformations.LocalCoordinateSystem` class. + This function uses the `LocalCoordinateSystem.from_axis_vectors` + method of the `LocalCoordinateSystem` class. Parameters ---------- @@ -785,8 +775,7 @@ def create_cs_from_axis_vectors( time_ref : Optional reference timestamp if ``time`` is a time delta. lsc_child_in_parent : - If set to `True`, the passed - `~weldx.transformations.LocalCoordinateSystem` instance describes + 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. @@ -900,7 +889,7 @@ def get_child_system_names( Returns ------- - List[str]: + list[str]: List of child systems. """ @@ -928,7 +917,7 @@ def coordinate_system_names(self) -> list: Returns ------- - List : + list : List of coordinate system names. """ @@ -940,7 +929,7 @@ def data_names(self) -> list[str]: Returns ------- - List[str] : + list[str] : Names of the attached data sets """ @@ -1084,7 +1073,7 @@ def get_cs( Returns ------- - `~weldx.transformations.LocalCoordinateSystem` : + `LocalCoordinateSystem` : The requested coordinate system. Notes @@ -1150,15 +1139,14 @@ def get_cs( reference times. Therefore an exception is raised. If your intention is to add a reference time to the resulting coordinate system, you should call this function without a specified reference time and add it explicitly to the - returned `~weldx.transformations.LocalCoordinateSystem`. + returned `LocalCoordinateSystem`. **Information regarding the implementation:** It is important to mention that all coordinate systems that are involved in the transformation should be interpolated to a common time line before they are - combined using the `~weldx.transformations.LocalCoordinateSystem` 's __add__ - and __sub__ functions. + combined using the `LocalCoordinateSystem` 's __add__ and __sub__ functions. If this is not done before, serious interpolation errors for rotations can occur. The reason is, that those operators also perform time interpolations if the timestamps of 2 systems do not match. When chaining multiple @@ -1642,7 +1630,7 @@ def time_union( """Get the time union of all or selected local coordinate systems. If neither the `CoordinateSystemManager` nor its attached - `~weldx.transformations.LocalCoordinateSystem` instances possess a reference + `LocalCoordinateSystem` instances possess a reference time, the returned ``Time`` object would not contain one either. Parameters @@ -1896,7 +1884,7 @@ def unmerge(self) -> list[CoordinateSystemManager]: Returns ------- - List[`~weldx.transformations.CoordinateSystemManager`] : + list[`CoordinateSystemManager`] : A list containing previously merged `CoordinateSystemManager` instances. """ @@ -1941,7 +1929,7 @@ def subsystem_names(self) -> list[str]: Returns ------- - List[str]: + list[str]: List with subsystem names. """ @@ -1953,7 +1941,7 @@ def subsystems(self) -> list[CoordinateSystemManager]: Returns ------- - List : + list : List containing all the subsystems. """