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
vhirtham authored Mar 9, 2022
2 parents f00bb78 + 880207c commit 97b71ff
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches

Expand Down Expand Up @@ -74,10 +74,10 @@ jobs:
name: pypi build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: '3.8'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Grep for PR number in CHANGELOG.rst
run: grep -P ':pull:`${{github.event.number}}`' CHANGELOG.rst
4 changes: 2 additions & 2 deletions .github/workflows/citation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
name: Validate CITATION.cff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/cache@v2
with:
path: ~/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
nbsphinx_execute: 'always'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cache conda
uses: actions/cache@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
os: [ubuntu-latest]
py: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.py }}

Expand Down Expand Up @@ -88,10 +88,10 @@ jobs:
os: [macos-latest, windows-latest]
py: ['3.8']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.py }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pytest_asdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
name: pytest asdf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-python@v1
- uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: pip installs
Expand All @@ -28,8 +28,8 @@ jobs:
name: validate weldx manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: pip installs
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Lint
Expand All @@ -25,8 +25,8 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: pip installs
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def _workaround_imports_typechecking():
import meshio # noqa
import pandas # noqa
import pint # noqa
import sympy # noqa
import xarray # noqa


Expand Down
20 changes: 13 additions & 7 deletions weldx/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,13 +1443,15 @@ def _get_component(v, i):

me = self._series.data
subs = [(k, _get_component(v.data, i)) for k, v in me.parameters.items()]
return me.expression.subs(subs).diff(self._series.position_dim_name) ** 2

sym = sympy.sympify(self._series.position_dim_name)
return me.expression.subs(subs).diff(sym) ** 2

def _get_derivative_expression(self) -> MathematicalExpression:
"""Get the derivative of an expression as `MathematicalExpression`."""
expr = MathematicalExpression(
self._series.data.expression.diff(self._series.position_dim_name)
)
sym = sympy.sympify(self._series.position_dim_name)
der = self._series.data.expression.diff(sym)
expr = MathematicalExpression(der)

# parameters might not be present anymore in the derived expression
params = {
Expand All @@ -1467,7 +1469,10 @@ def _get_tangent_vec_discrete(self, position: float) -> np.ndarray:
idx_low = np.abs(pos_data - position).argmin()
if pos_data[idx_low] > position or idx_low + 1 == len(pos_data):
idx_low -= 1
vals = self._series.evaluate(s=[pos_data[idx_low], pos_data[idx_low + 1]]).data

pdn = self._series.position_dim_name
coords = {pdn: [pos_data[idx_low], pos_data[idx_low + 1]]}
vals = self._series.evaluate(**coords).data
return (vals[1] - vals[0]).m

def _get_length_expr(self) -> MathematicalExpression:
Expand Down Expand Up @@ -1524,7 +1529,7 @@ def _get_lcs_from_coords_and_tangent(
pdn = self._series.position_dim_name

if coords.coords[pdn].size == 1:
coords = coords.isel(s=0)
coords = coords.isel(**{pdn: 0})

x = tangent
z = [0, 0, 1] if x.size == 3 else [[0, 0, 1] for _ in range(x.shape[0])]
Expand Down Expand Up @@ -1658,7 +1663,8 @@ def __init__(
else:
self._sign_winding = -1

expr = "(x*sin(s)+w*y*(cos(s)-1))*r "
pdn = SpatialSeries._position_dim_name
expr = f"(x*sin({pdn})+w*y*(cos({pdn})-1))*r "
params = dict(
x=Q_([1, 0, 0], "mm"),
y=Q_([0, 1, 0], "mm"),
Expand Down

0 comments on commit 97b71ff

Please sign in to comment.