Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated code #620

Merged
merged 8 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ fixes

- fix broken `Time.all_close` to now work as intended `[#603]
<https://github.com/BAMWelDX/weldx/pull/603>`__

- fix `weldx.asdf.util.get_yaml_header` to work correctly with windows line endings.
`[#609] <https://github.com/BAMWelDX/weldx/pull/609>`__
- fix `weldx.asdf.util.get_yaml_header` to work correctly with windows
line endings. `[#609] <https://github.com/BAMWelDX/weldx/pull/609>`__

documentation
=============
Expand All @@ -65,6 +64,9 @@ ASDF
deprecations
============

- removed ``welding.util.lcs_coords_from_ts`` `[#620]
<https://github.com/BAMWelDX/weldx/pull/620>`__

dependencies
============

Expand Down Expand Up @@ -878,7 +880,7 @@ added
object represents a unity transformation step. `[#177]
<https://github.com/BAMWelDX/weldx/pull/177>`__

- added `welding.util.lcs_coords_from_ts` function `[#199]
- added ``welding.util.lcs_coords_from_ts`` function `[#199]
<https://github.com/BAMWelDX/weldx/pull/199>`__

- add a tutorial with advanced use case for combining groove
Expand Down
8 changes: 3 additions & 5 deletions tutorials/experiment_design_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"from weldx import Q_\n",
"from weldx import LocalCoordinateSystem as LCS\n",
"from weldx import get_groove\n",
"from weldx.welding.util import lcs_coords_from_ts, sine"
"from weldx.welding.util import sine"
]
},
{
Expand Down Expand Up @@ -235,11 +235,10 @@
"outputs": [],
"source": [
"sine_y = sine(f=Q_(1, \"Hz\"), amp=Q_([[0, 1, 0]], \"mm\"))\n",
"coords = lcs_coords_from_ts(sine_y, time)\n",
"csm.add_cs(\n",
" coordinate_system_name=\"tcp_sine_y\",\n",
" reference_system_name=\"tcp_wire\",\n",
" lcs=LCS(coordinates=coords),\n",
" lcs=LCS(coordinates=sine_y),\n",
")"
]
},
Expand All @@ -257,11 +256,10 @@
"outputs": [],
"source": [
"sine_z = sine(f=Q_(1, \"Hz\"), amp=Q_([[0, 0, 2]], \"mm\"), bias=Q_([0, 0, 0], \"mm\"))\n",
"coords = lcs_coords_from_ts(sine_z, time)\n",
"csm.add_cs(\n",
" coordinate_system_name=\"tcp_sine_z\",\n",
" reference_system_name=\"tcp_wire\",\n",
" lcs=LCS(coordinates=coords),\n",
" lcs=LCS(coordinates=sine_z),\n",
")"
]
},
Expand Down
7 changes: 3 additions & 4 deletions tutorials/welding_example_02_weaving.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
" util,\n",
" welding,\n",
")\n",
"from weldx.welding.util import lcs_coords_from_ts, sine"
"from weldx.welding.util import sine"
]
},
{
Expand Down Expand Up @@ -495,7 +495,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Use the `lcs_coords_from_ts` function to create the translation coordinate vectors at our specified timestamps."
"We define a new `LocalCoordinateSystem` and interpolate it our specified timestamps."
]
},
{
Expand All @@ -505,8 +505,7 @@
"outputs": [],
"source": [
"t = pd.timedelta_range(start=\"0s\", end=\"8s\", freq=\"25ms\")\n",
"ts_sine_data = lcs_coords_from_ts(ts_sine, t)\n",
"tcp_sine2 = LocalCoordinateSystem(coordinates=ts_sine_data)"
"tcp_sine2 = LocalCoordinateSystem(coordinates=ts_sine).interp_time(t)"
]
},
{
Expand Down
22 changes: 0 additions & 22 deletions weldx/asdf/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
types_path_and_file_like,
types_path_like,
)
from weldx.util import deprecated

_USE_WELDX_FILE = False
_INVOKE_SHOW_HEADER = False
Expand Down Expand Up @@ -259,21 +258,6 @@ def readline_replace_eol():
return code.decode("utf-8")


@deprecated("0.4.0", "0.5.0", " _write_buffer was renamed to write_buffer")
def _write_buffer(*args, **kwargs):
return write_buffer(*args, **kwargs)


@deprecated("0.4.0", "0.5.0", " _read_buffer was renamed to read_buffer")
def _read_buffer(*args, **kwargs):
return read_buffer(*args, **kwargs)


@deprecated("0.4.0", "0.5.0", " _write_read_buffer was renamed to write_read_buffer")
def _write_read_buffer(*args, **kwargs):
return write_read_buffer(*args, **kwargs)


def notebook_fileprinter(file: types_path_and_file_like, lexer="YAML"):
"""Print the code from file/BytesIO to notebook cell with syntax highlighting.

Expand Down Expand Up @@ -358,12 +342,6 @@ def view_tree(file: types_path_and_file_like, path: Tuple = None, **kwargs):
return JSON(yaml_dict, **kwargs)


@deprecated("0.4.0", "0.5.0", " asdf_json_repr was renamed to view_tree")
def asdf_json_repr(file: Union[str, Path, BytesIO], path: Tuple = None, **kwargs):
"""See `view_tree` function."""
return view_tree(file, path, **kwargs)


def _fullname(obj):
"""Get the fully qualified class name of an object."""
if isinstance(obj, str):
Expand Down
2 changes: 1 addition & 1 deletion weldx/visualization/k3d_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def __init__(

self._trace = k3d.line(
np.array(lcs.coordinates.values, dtype="float32"), # type: ignore
shader="line",
shader="thick",
width=0.1, # change with .set_trait("width", value)
color=color,
name=name if name is None else f"{name} (line)",
Expand Down
36 changes: 0 additions & 36 deletions weldx/welding/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
from typing import Union

import numpy as np
import pandas as pd
import pint
import xarray as xr

from weldx.constants import Q_, WELDX_UNIT_REGISTRY
from weldx.core import MathematicalExpression, TimeSeries
from weldx.util import deprecated
from weldx.welding.groove.iso_9692_1 import IsoBaseGroove

__all__ = ["compute_welding_speed"]
Expand Down Expand Up @@ -49,39 +46,6 @@ def sine(
return TimeSeries(expr)


@deprecated(
"0.4.1",
"0.5.0",
"The 'LocalCoordinateSystem' now supports 'TimeSeries' as coordinates rendering "
"this function obsolete.",
)
def lcs_coords_from_ts(
ts: TimeSeries, time: Union[pd.DatetimeIndex, pint.Quantity]
) -> xr.DataArray:
"""Create translation coordinates from a TimeSeries at specific timesteps.

Parameters
----------
ts:
TimeSeries that describes the coordinate motion as a 3D vector.
time
Timestamps used for interpolation.
TODO: add support for pd.DateTimeindex as well

Returns
-------
xarray.DataArray :
A DataArray with correctly labeled dimensions to be used for LCS creation.

"""
ts_data = ts.interp_time(time=time).data_array
# assign vector coordinates and convert to mm
ts_data = ts_data.rename({"dim_1": "c"}).assign_coords({"c": ["x", "y", "z"]})
ts_data.data = ts_data.data.to("mm").magnitude
ts_data["time"] = pd.TimedeltaIndex(ts_data["time"].data)
return ts_data


@WELDX_UNIT_REGISTRY.check(None, "[length]/[time]", "[length]")
def compute_welding_speed(
groove: IsoBaseGroove,
Expand Down