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

Schema updates for current and upcoming asdf changes #910

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Release Notes

## 0.7.0 (unreleased)

### Dependencies

- remove upper pin for `asdf` \[{pull}`910`\].

### ASDF

- update schemas for upcoming ASDF standard 1.6.0 \[{pull}`910`\].

# Release Notes

## 0.6.9 (19.11.2024)

### Changes
Expand Down
3 changes: 1 addition & 2 deletions devtools/scripts/update_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from weldx.asdf.constants import (
WELDX_EXTENSION_URI,
WELDX_EXTENSION_VERSION,
WELDX_MANIFEST_URI,
)
from weldx.asdf.util import get_converter_for_tag

Expand All @@ -23,7 +22,7 @@ def update_manifest(
Loader=yaml.SafeLoader,
)

manifest["id"] = WELDX_MANIFEST_URI
manifest["id"] = WELDX_EXTENSION_URI
manifest["extension_uri"] = WELDX_EXTENSION_URI

# keep only ASDF schema mappings
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dynamic = [
"version", # version gets derived from git by setuptools_scm.
]
dependencies = [
"asdf>=2.15.1,<4",
"asdf>=2.15.1",
"bidict",
"boltons",
"bottleneck>=1.3.3",
Expand Down
5 changes: 5 additions & 0 deletions weldx/asdf/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@
# 2. file exists, but should be updated with new tree
if created:
asdf_file = asdf.AsdfFile(tree=tree, **asdffile_kwargs)
if asdf.__version__ >= "4.0.0":
# Starting in asdf 4 passing a tree to AsdfFile will
# not automatically validate the tree. For those versions
# we call validate here to check the tree.
asdf_file.validate()

Check warning on line 393 in weldx/asdf/file.py

View check run for this annotation

Codecov / codecov/patch

weldx/asdf/file.py#L393

Added line #L393 was not covered by tests
with self._config_context():
asdf_file.write_to(filename_or_path_like, **write_kwargs)
# Now set the file handle to the newly created AsdfFile instance.
Expand Down
11 changes: 6 additions & 5 deletions weldx/asdf/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import functools
import re

from asdf.asdf import SerializationContext
import asdf

if asdf.__version__ >= "3.0.0":
from asdf.extension import SerializationContext
else:
from asdf.asdf import SerializationContext

Check warning on line 11 in weldx/asdf/types.py

View check run for this annotation

Codecov / codecov/patch

weldx/asdf/types.py#L11

Added line #L11 was not covered by tests
from asdf.extension import Converter
from asdf.versioning import AsdfSpec
from boltons.iterutils import remap

from weldx.constants import META_ATTR, USER_ATTR
Expand Down Expand Up @@ -117,7 +121,4 @@
if version is None:
return tag

if isinstance(version, AsdfSpec):
version = str(version.spec)

return f"{tag}-{version}"
8 changes: 6 additions & 2 deletions weldx/asdf/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

import asdf
import pint
from asdf.asdf import SerializationContext

if asdf.__version__ >= "3.0.0":
from asdf.extension import SerializationContext
else:
from asdf.asdf import SerializationContext

Check warning on line 19 in weldx/asdf/util.py

View check run for this annotation

Codecov / codecov/patch

weldx/asdf/util.py#L19

Added line #L19 was not covered by tests
from asdf.config import AsdfConfig, get_config
from asdf.extension import Extension
from asdf.tagged import TaggedDict, TaggedList, TaggedString
Expand Down Expand Up @@ -502,7 +506,7 @@

def get_weldx_extension(ctx: SerializationContext | AsdfConfig) -> Extension:
"""Grab the weldx extension from list of current active extensions."""
if isinstance(ctx, asdf.asdf.SerializationContext):
if isinstance(ctx, SerializationContext):
extensions = ctx.extension_manager.extensions
elif isinstance(ctx, asdf.config.AsdfConfig):
extensions = ctx.extensions
Expand Down
2 changes: 1 addition & 1 deletion weldx/manifests/weldx-0.1.0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
id: asdf://weldx.bam.de/weldx/manifests/weldx-0.1.0
id: asdf://weldx.bam.de/weldx/extensions/weldx-0.1.0
extension_uri: asdf://weldx.bam.de/weldx/extensions/weldx-0.1.0
title: weldx extension manifest for tag mapping
description: Manifest listing all tag URIs with schema URIs supported by weldx
Expand Down
2 changes: 1 addition & 1 deletion weldx/manifests/weldx-0.1.1.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
id: asdf://weldx.bam.de/weldx/manifests/weldx-0.1.1
id: asdf://weldx.bam.de/weldx/extensions/weldx-0.1.1
extension_uri: asdf://weldx.bam.de/weldx/extensions/weldx-0.1.1
title: weldx extension manifest for tag mapping
description: Manifest listing all tag URIs with schema URIs supported by weldx
Expand Down
2 changes: 1 addition & 1 deletion weldx/manifests/weldx-0.1.2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
id: asdf://weldx.bam.de/weldx/manifests/weldx-0.1.2
id: asdf://weldx.bam.de/weldx/extensions/weldx-0.1.2
extension_uri: asdf://weldx.bam.de/weldx/extensions/weldx-0.1.2
title: weldx extension manifest for tag mapping
description: Manifest listing all tag URIs with schema URIs supported by weldx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description: |
examples:
-
- A simple `SpatialData` with triangulation
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/geometry/spatial_data-0.1.0>
coordinates: !core/ndarray-1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |
examples:
-
- A simple `SpatialData` with triangulation
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/geometry/spatial_data-0.1.1>
coordinates: !<asdf://weldx.bam.de/weldx/tags/units/quantity-0.1.0>
Expand All @@ -32,6 +33,7 @@ examples:
shape: [2, 3]
-
- A `SpatialData` object with data in three dimensions
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/geometry/spatial_data-0.1.1>
coordinates: !<asdf://weldx.bam.de/weldx/tags/core/data_array-0.1.0>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ examples:
value: 10.0
-
- A time_series describing a sine oscillation in 3d space along the z-axis
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/time_series-0.1.0>
expression: !<asdf://weldx.bam.de/weldx/tags/core/mathematical_expression-0.1.0>
Expand Down
2 changes: 2 additions & 0 deletions weldx/schemas/weldx.bam.de/weldx/core/time_series-0.1.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ examples:
value: 10.0
-
- A time series of 4 discrete points
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/time_series-0.1.1>
values: !core/ndarray-1.0.0
Expand All @@ -33,6 +34,7 @@ examples:
interpolation: step
-
- A time_series describing a sine oscillation in 3d space along the z-axis
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/time_series-0.1.1>
expression: !<asdf://weldx.bam.de/weldx/tags/core/mathematical_expression-0.1.0>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description: |
examples:
-
- A constant transformation describing a translation of 1 mm into the z direction
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.0>
coordinates: !<asdf://weldx.bam.de/weldx/tags/core/variable-0.1.0>
Expand All @@ -26,6 +27,7 @@ examples:
- |
A time dependent transformation describing a linear movement from 5 mm to 295 mm
over 20 seconds along the x-axis direction.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.0>
time: !<asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-0.1.0>
Expand All @@ -50,6 +52,7 @@ examples:
shape: [2, 3]
-
- A static transformation describing an euler rotation of 45 degree around the x-axis.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.0>
orientations: !<asdf://weldx.bam.de/weldx/tags/core/variable-0.1.0>
Expand All @@ -67,6 +70,7 @@ examples:
- |
A time dependent transformation describing an euler rotation around the y-axis from 0 degree to 120 degree
over 20 seconds.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.0>
time: !<asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-0.1.0>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description: |
examples:
-
- A constant transformation describing a translation of 1 mm into the z direction
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.1>
coordinates: !<asdf://weldx.bam.de/weldx/tags/core/variable-0.1.0>
Expand All @@ -26,6 +27,7 @@ examples:
- |
A time dependent transformation describing a linear movement from 5 mm to 295 mm
over 20 seconds along the x-axis direction.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.1>
time: !<asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-0.1.0>
Expand All @@ -50,6 +52,7 @@ examples:
shape: [2, 3]
-
- A static transformation describing an euler rotation of 45 degree around the x-axis.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.1>
orientations: !<asdf://weldx.bam.de/weldx/tags/core/variable-0.1.0>
Expand All @@ -67,6 +70,7 @@ examples:
- |
A time dependent transformation describing an euler rotation around the y-axis from 0 degree to 120 degree
over 20 seconds.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.1>
time: !<asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-0.1.0>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description: |
examples:
-
- A "xyz" euler rotation with 10, 20 and 60 degree angles as euler representation.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/rotation-0.1.0>
angles: !<asdf://weldx.bam.de/weldx/tags/units/quantity-0.1.0>
Expand All @@ -22,6 +23,7 @@ examples:
sequence: xyz
-
- The quaternion rotation representation
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/rotation-0.1.0>
quaternions: !core/ndarray-1.0.0
Expand All @@ -30,6 +32,7 @@ examples:
shape: [4]
-
- The matrix rotation representation.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/rotation-0.1.0>
matrix: !core/ndarray-1.0.0
Expand All @@ -41,6 +44,7 @@ examples:
shape: [3, 3]
-
- The rotation vector representation.
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/core/transformations/rotation-0.1.0>
rotvec: !core/ndarray-1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ properties:
examples:
-
- Two seams with a single layer and bead, but the first seam has two weldments while the second has only one.
- asdf-standard-1.5.0
- |
!<tag:stsci.edu:asdf/core/asdf-1.1.0>
weld_seam:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ required: [weld_seam]
examples:
-
- Two seams with a single layer and bead, but the first seam has two weldments while the second has only one.
- asdf-standard-1.5.0
- |
!<tag:stsci.edu:asdf/core/asdf-1.1.0>
weld_seam:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ required: [process, equipment, workpiece, measurements, welding_current, welding
examples:
-
- A simple welding application
- asdf-standard-1.5.0
- |
!<tag:stsci.edu:asdf/core/asdf-1.1.0>
TCP: !<asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-0.1.0>
Expand Down
2 changes: 1 addition & 1 deletion weldx/schemas/weldx.bam.de/weldx/groove/terms-0.1.0.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/terms-0.1.0"
id: "asdf://weldx.bam.de/weldx/schemas/groove/terms-0.1.0"

title: |
DIN EN ISO 9692-1 definitions
Expand Down
1 change: 1 addition & 0 deletions weldx/schemas/weldx.bam.de/weldx/process/GMAW-0.1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ examples:
tag: CLOOS/pulse
-
- A spray arc process where the voltage decreases linearly from 40 V to 20 V over 10 s
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/process/CLOOS/spray_arc-0.1.0>
base_process: spray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ examples:
max: !<asdf://weldx.bam.de/weldx/tags/time/timedelta-0.1.0> P0DT0H0M10S
-
- An irregular timedeltaindex representing timestamps at 0 s, 4 s, 6 s and 10 s
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-0.1.0>
values: !core/ndarray-1.0.0
Expand Down
2 changes: 2 additions & 0 deletions weldx/schemas/weldx.bam.de/weldx/units/quantity-0.1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ examples:
units: !<asdf://weldx.bam.de/weldx/tags/units/units-0.1.0> kilometer
-
- A quantity with an array of values
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/units/quantity-0.1.0>
value: !core/ndarray-1.0.0 [1, 2, 3, 4]
units: !<asdf://weldx.bam.de/weldx/tags/units/units-0.1.0> ampere
-
- A quantity with an n-dimensional array of values
- asdf-standard-1.5.0
- |
!<asdf://weldx.bam.de/weldx/tags/units/quantity-0.1.0>
value: !core/ndarray-1.0.0
Expand Down
7 changes: 6 additions & 1 deletion weldx/tags/base_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

from uuid import UUID

from asdf.asdf import SerializationContext
import asdf

if asdf.__version__ >= "3.0.0":
from asdf.extension import SerializationContext
else:
from asdf.asdf import SerializationContext

Check warning on line 10 in weldx/tags/base_types.py

View check run for this annotation

Codecov / codecov/patch

weldx/tags/base_types.py#L10

Added line #L10 was not covered by tests

from weldx.asdf.types import WeldxConverter

Expand Down
Loading