From c31df4415105543858065f3835aa6e8ad0ce2000 Mon Sep 17 00:00:00 2001 From: Cagtay Fabry <43667554+CagtayFabry@users.noreply.github.com> Date: Wed, 18 Aug 2021 09:21:11 +0200 Subject: [PATCH] new asdf extension API (#467) see CHANGELOG.md for changes --- .deepsource.toml | 1 + .github/workflows/pytest_asdf.yml | 28 +- CHANGELOG.md | 17 +- MANIFEST.in | 3 +- devtools/conda.recipe/meta.yaml | 4 +- devtools/scripts/update_manifest.py | 57 ++ doc/conf.py | 10 +- doc/nitpick_ignore | 5 + doc/standard/shape-validation.rst | 6 +- doc/standard/unit-validation.rst | 2 +- doc/standard/welding-processes.rst | 32 +- setup.cfg | 23 +- tutorials/custom_metadata.ipynb | 2 +- tutorials/measurement_example.ipynb | 2 +- tutorials/quality_standards.ipynb | 16 +- weldx/__init__.py | 11 +- weldx/asdf/__init__.py | 8 +- weldx/asdf/_extension.py | 47 ++ weldx/asdf/cli/welding_schema.py | 12 +- weldx/asdf/constants.py | 23 +- weldx/asdf/extension.py | 109 ++-- weldx/asdf/file.py | 6 +- .../single_pass_weld-1.0.0.schema.yaml | 454 ---------------- .../weldx/measurement/measurement-1.0.0.yaml | 25 - .../weldx/process/CLOOS/spray_arc-1.0.0.yaml | 25 - .../weldx.bam.de/weldx/time/time-1.0.0.yaml | 63 --- weldx/asdf/tags/__init__.py | 1 - weldx/asdf/tags/weldx/base_types.py | 24 - weldx/asdf/tags/weldx/core/data_array.py | 79 --- weldx/asdf/tags/weldx/core/dataset.py | 78 --- .../weldx/core/mathematical_expression.py | 29 - weldx/asdf/tags/weldx/core/time_series.py | 85 --- .../local_coordinate_system.py | 105 ---- .../weldx/core/transformations/rotation.py | 102 ---- weldx/asdf/tags/weldx/debug/__init__.py | 1 - .../tags/weldx/debug/test_property_tag.py | 41 -- weldx/asdf/tags/weldx/groove/iso_9692_1.py | 53 -- .../weldx/measurement/measurement_chain.py | 25 - weldx/asdf/tags/weldx/processes/process.py | 34 -- weldx/asdf/tags/weldx/time/__init__.py | 13 - weldx/asdf/tags/weldx/time/datetimeindex.py | 55 -- weldx/asdf/tags/weldx/time/time.py | 25 - weldx/asdf/tags/weldx/time/timedelta.py | 26 - weldx/asdf/tags/weldx/time/timedeltaindex.py | 56 -- weldx/asdf/tags/weldx/time/timestamp.py | 26 - weldx/asdf/tags/weldx/unit/pint_quantity.py | 34 -- weldx/asdf/types.py | 117 ++-- weldx/asdf/util.py | 139 +++-- weldx/asdf/validators.py | 36 +- weldx/manifests/weldx-1.0.0.yaml | 242 +++++++++ .../weldx/aws/design/base_metal-1.0.0.yaml | 3 +- .../weldx/aws/design/connection-1.0.0.yaml | 3 +- .../aws/design/joint_penetration-1.0.0.yaml | 3 +- .../weldx/aws/design/sub_assembly-1.0.0.yaml | 3 +- .../weldx/aws/design/weld_details-1.0.0.yaml | 7 +- .../weldx/aws/design/weldment-1.0.0.yaml | 3 +- .../weldx/aws/design/workpiece-1.0.0.yaml | 3 +- .../process/arc_welding_process-1.0.0.yaml | 3 +- .../aws/process/gas_component-1.0.0.yaml | 5 +- .../shielding_gas_for_procedure-1.0.0.yaml | 11 +- .../aws/process/shielding_gas_type-1.0.0.yaml | 9 +- .../weldx/core/data_array-1.0.0.yaml | 11 +- .../weldx/core/dataset-1.0.0.yaml | 15 +- .../weldx/core/dimension-1.0.0.yaml | 3 +- .../weldx.bam.de/weldx/core/file-1.0.0.yaml | 17 +- .../core/geometry/spatial_data-1.0.0.yaml | 5 +- .../weldx/core/graph/di_edge-1.0.0.yaml | 15 +- .../weldx/core/graph/di_graph-1.0.0.yaml | 27 +- .../weldx/core/graph/di_node-1.0.0.yaml | 19 +- .../core/mathematical_expression-1.0.0.yaml | 5 +- .../weldx/core/time_series-1.0.0.yaml | 17 +- .../coordinate_system_hierarchy-1.0.0.yaml | 43 +- ...nate_system_hierarchy_subsystem-1.0.0.yaml | 9 +- .../coordinate_transformation-1.0.0.yaml | 17 +- .../local_coordinate_system-1.0.0.yaml | 57 +- .../core/transformations/rotation-1.0.0.yaml | 11 +- .../weldx/core/variable-1.0.0.yaml | 3 +- .../datamodels/single_pass_weld-1.0.0.yaml | 501 ++++++++++++++++++ .../weldx/debug/test_property_tag-1.0.0.yaml | 5 +- .../debug/test_shape_validator-1.0.0.yaml | 13 +- .../debug/test_unit_validator-1.0.0.yaml | 3 +- .../measurement_equipment-1.0.0.yaml | 19 +- .../iso_9692_1_2013_12/DHUGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/DHVGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/DUGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/DVGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/FFGroove-1.0.0.yaml | 15 +- .../iso_9692_1_2013_12/HUGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/HVGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/IGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/UGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/UVGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/VGroove-1.0.0.yaml | 5 +- .../iso_9692_1_2013_12/VVGroove-1.0.0.yaml | 5 +- .../weldx/groove/terms-1.0.0.yaml | 2 +- .../weldx/measurement/error-1.0.0.yaml | 5 +- .../weldx/measurement/measurement-1.0.0.yaml | 28 + .../measurement/measurement_chain-1.0.0.yaml | 71 ++- .../weldx/measurement/signal-1.0.0.yaml | 11 +- .../signal_transformation-1.0.0.yaml | 21 +- .../weldx/measurement/source-1.0.0.yaml | 17 +- .../weldx/process/CLOOS/pulse-1.0.0.yaml | 3 +- .../weldx/process/CLOOS/spray_arc-1.0.0.yaml | 28 + .../weldx/process/GMAW-1.0.0.yaml | 35 +- .../weldx/process/generic-1.0.0.yaml | 2 +- .../weldx/process/terms-1.0.0.yaml | 36 +- .../weldx/time/datetimeindex-1.0.0.yaml | 13 +- .../weldx.bam.de/weldx/time/time-1.0.0.yaml | 68 +++ .../weldx/time/timedelta-1.0.0.yaml | 5 +- .../weldx/time/timedeltaindex-1.0.0.yaml | 23 +- .../weldx/time/timestamp-1.0.0.yaml | 9 +- .../weldx/unit/dimension-1.0.0.yaml | 3 +- .../weldx.bam.de/weldx/uuid-1.0.0.yaml | 5 +- weldx/{asdf/tags/weldx => tags}/__init__.py | 0 .../{asdf/tags/weldx => tags}/aws/__init__.py | 0 .../weldx => tags}/aws/design/__init__.py | 0 .../weldx => tags}/aws/design/base_metal.py | 4 +- .../weldx => tags}/aws/design/connection.py | 4 +- .../aws/design/joint_penetration.py | 4 +- .../weldx => tags}/aws/design/sub_assembly.py | 4 +- .../weldx => tags}/aws/design/weld_details.py | 4 +- .../weldx => tags}/aws/design/weldment.py | 4 +- .../weldx => tags}/aws/design/workpiece.py | 4 +- .../weldx => tags}/aws/process/__init__.py | 0 .../aws/process/arc_welding_process.py | 8 +- .../aws/process/gas_component.py | 4 +- .../process/shielding_gas_for_procedure.py | 4 +- .../aws/process/shielding_gas_type.py | 4 +- weldx/tags/base_types.py | 24 + .../tags/weldx => tags}/core/__init__.py | 2 +- .../tags/weldx => tags}/core/common_types.py | 92 ++-- weldx/tags/core/data_array.py | 43 ++ weldx/tags/core/dataset.py | 41 ++ weldx/{asdf/tags/weldx => tags}/core/file.py | 74 +-- .../weldx => tags}/core/geometry/__init__.py | 0 .../core/geometry/spatial_data.py | 17 +- weldx/{asdf/tags/weldx => tags}/core/graph.py | 57 +- weldx/tags/core/mathematical_expression.py | 26 + weldx/tags/core/time_series.py | 55 ++ .../core/transformations/__init__.py | 0 .../coordinate_system_hierarchy.py | 201 ++----- .../local_coordinate_system.py | 66 +++ weldx/tags/core/transformations/rotation.py | 63 +++ weldx/tags/debug/__init__.py | 1 + weldx/tags/debug/test_property_tag.py | 23 + .../debug/test_shape_validator.py | 8 +- .../debug/test_unit_validator.py | 8 +- .../tags/weldx => tags}/equipment/__init__.py | 0 .../equipment/measurement_equipment.py | 8 +- .../tags/weldx => tags}/groove/__init__.py | 0 weldx/tags/groove/iso_9692_1.py | 50 ++ .../weldx => tags}/measurement/__init__.py | 0 .../tags/weldx => tags}/measurement/error.py | 4 +- .../weldx => tags}/measurement/measurement.py | 4 +- weldx/tags/measurement/measurement_chain.py | 23 + .../tags/weldx => tags}/measurement/signal.py | 8 +- .../measurement/signal_transformation.py | 4 +- .../tags/weldx => tags}/measurement/source.py | 4 +- .../tags/weldx => tags}/processes/__init__.py | 0 weldx/tags/processes/process.py | 32 ++ weldx/tags/time/__init__.py | 1 + weldx/tags/time/datetimeindex.py | 51 ++ weldx/tags/time/time.py | 23 + weldx/tags/time/timedelta.py | 20 + weldx/tags/time/timedeltaindex.py | 53 ++ weldx/tags/time/timestamp.py | 23 + .../tags/weldx => tags}/unit/__init__.py | 0 weldx/tags/unit/pint_quantity.py | 37 ++ .../tests/asdf_tests/test_asdf_aws_schema.py | 29 +- weldx/tests/asdf_tests/test_asdf_core.py | 2 +- weldx/tests/asdf_tests/test_asdf_util.py | 55 +- .../tests/asdf_tests/test_asdf_validators.py | 8 +- weldx/tests/asdf_tests/test_weldx_file.py | 8 +- .../manifests/test_standard-1.0.0.yaml | 2 +- ...ve_measurement_equipment_schema-1.0.0.yaml | 8 +- weldx/welding/groove/iso_9692_1.py | 4 +- 176 files changed, 2595 insertions(+), 2455 deletions(-) create mode 100644 devtools/scripts/update_manifest.py create mode 100644 weldx/asdf/_extension.py delete mode 100644 weldx/asdf/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml delete mode 100644 weldx/asdf/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml delete mode 100644 weldx/asdf/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml delete mode 100644 weldx/asdf/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml delete mode 100644 weldx/asdf/tags/__init__.py delete mode 100644 weldx/asdf/tags/weldx/base_types.py delete mode 100644 weldx/asdf/tags/weldx/core/data_array.py delete mode 100644 weldx/asdf/tags/weldx/core/dataset.py delete mode 100644 weldx/asdf/tags/weldx/core/mathematical_expression.py delete mode 100644 weldx/asdf/tags/weldx/core/time_series.py delete mode 100644 weldx/asdf/tags/weldx/core/transformations/local_coordinate_system.py delete mode 100644 weldx/asdf/tags/weldx/core/transformations/rotation.py delete mode 100644 weldx/asdf/tags/weldx/debug/__init__.py delete mode 100644 weldx/asdf/tags/weldx/debug/test_property_tag.py delete mode 100644 weldx/asdf/tags/weldx/groove/iso_9692_1.py delete mode 100644 weldx/asdf/tags/weldx/measurement/measurement_chain.py delete mode 100644 weldx/asdf/tags/weldx/processes/process.py delete mode 100644 weldx/asdf/tags/weldx/time/__init__.py delete mode 100644 weldx/asdf/tags/weldx/time/datetimeindex.py delete mode 100644 weldx/asdf/tags/weldx/time/time.py delete mode 100644 weldx/asdf/tags/weldx/time/timedelta.py delete mode 100644 weldx/asdf/tags/weldx/time/timedeltaindex.py delete mode 100644 weldx/asdf/tags/weldx/time/timestamp.py delete mode 100644 weldx/asdf/tags/weldx/unit/pint_quantity.py create mode 100644 weldx/manifests/weldx-1.0.0.yaml rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/design/base_metal-1.0.0.yaml (95%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/design/connection-1.0.0.yaml (92%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/design/joint_penetration-1.0.0.yaml (92%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/design/sub_assembly-1.0.0.yaml (84%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/design/weld_details-1.0.0.yaml (76%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/design/weldment-1.0.0.yaml (77%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/design/workpiece-1.0.0.yaml (84%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/process/arc_welding_process-1.0.0.yaml (89%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/process/gas_component-1.0.0.yaml (82%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_for_procedure-1.0.0.yaml (83%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_type-1.0.0.yaml (75%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/data_array-1.0.0.yaml (69%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/dataset-1.0.0.yaml (65%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/dimension-1.0.0.yaml (83%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/file-1.0.0.yaml (75%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0.yaml (88%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/graph/di_edge-1.0.0.yaml (50%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/graph/di_graph-1.0.0.yaml (52%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/graph/di_node-1.0.0.yaml (50%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/mathematical_expression-1.0.0.yaml (84%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/time_series-1.0.0.yaml (81%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy-1.0.0.yaml (58%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy_subsystem-1.0.0.yaml (81%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/transformations/coordinate_transformation-1.0.0.yaml (62%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/transformations/local_coordinate_system-1.0.0.yaml (54%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/transformations/rotation-1.0.0.yaml (86%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/core/variable-1.0.0.yaml (92%) create mode 100644 weldx/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.yaml rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/debug/test_property_tag-1.0.0.yaml (69%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/debug/test_shape_validator-1.0.0.yaml (73%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/debug/test_unit_validator-1.0.0.yaml (91%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/equipment/measurement_equipment-1.0.0.yaml (59%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0.yaml (87%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0.yaml (84%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0.yaml (87%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0.yaml (85%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0.yaml (78%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0.yaml (81%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0.yaml (78%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0.yaml (71%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0.yaml (81%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0.yaml (83%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0.yaml (82%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0.yaml (83%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/groove/terms-1.0.0.yaml (94%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/measurement/error-1.0.0.yaml (76%) create mode 100644 weldx/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/measurement/measurement_chain-1.0.0.yaml (57%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/measurement/signal-1.0.0.yaml (70%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/measurement/signal_transformation-1.0.0.yaml (69%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/measurement/source-1.0.0.yaml (54%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/process/CLOOS/pulse-1.0.0.yaml (75%) create mode 100644 weldx/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/process/GMAW-1.0.0.yaml (52%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/process/generic-1.0.0.yaml (77%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/process/terms-1.0.0.yaml (70%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/time/datetimeindex-1.0.0.yaml (77%) create mode 100644 weldx/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/time/timedelta-1.0.0.yaml (69%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/time/timedeltaindex-1.0.0.yaml (69%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/time/timestamp-1.0.0.yaml (74%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/unit/dimension-1.0.0.yaml (91%) rename weldx/{asdf => }/schemas/weldx.bam.de/weldx/uuid-1.0.0.yaml (77%) rename weldx/{asdf/tags/weldx => tags}/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/aws/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/aws/design/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/aws/design/base_metal.py (88%) rename weldx/{asdf/tags/weldx => tags}/aws/design/connection.py (81%) rename weldx/{asdf/tags/weldx => tags}/aws/design/joint_penetration.py (82%) rename weldx/{asdf/tags/weldx => tags}/aws/design/sub_assembly.py (79%) rename weldx/{asdf/tags/weldx => tags}/aws/design/weld_details.py (76%) rename weldx/{asdf/tags/weldx => tags}/aws/design/weldment.py (77%) rename weldx/{asdf/tags/weldx => tags}/aws/design/workpiece.py (72%) rename weldx/{asdf/tags/weldx => tags}/aws/process/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/aws/process/arc_welding_process.py (90%) rename weldx/{asdf/tags/weldx => tags}/aws/process/gas_component.py (74%) rename weldx/{asdf/tags/weldx => tags}/aws/process/shielding_gas_for_procedure.py (91%) rename weldx/{asdf/tags/weldx => tags}/aws/process/shielding_gas_type.py (77%) create mode 100644 weldx/tags/base_types.py rename weldx/{asdf/tags/weldx => tags}/core/__init__.py (69%) rename weldx/{asdf/tags/weldx => tags}/core/common_types.py (51%) create mode 100644 weldx/tags/core/data_array.py create mode 100644 weldx/tags/core/dataset.py rename weldx/{asdf/tags/weldx => tags}/core/file.py (71%) rename weldx/{asdf/tags/weldx => tags}/core/geometry/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/core/geometry/spatial_data.py (57%) rename weldx/{asdf/tags/weldx => tags}/core/graph.py (76%) create mode 100644 weldx/tags/core/mathematical_expression.py create mode 100644 weldx/tags/core/time_series.py rename weldx/{asdf/tags/weldx => tags}/core/transformations/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/core/transformations/coordinate_system_hierarchy.py (65%) create mode 100644 weldx/tags/core/transformations/local_coordinate_system.py create mode 100644 weldx/tags/core/transformations/rotation.py create mode 100644 weldx/tags/debug/__init__.py create mode 100644 weldx/tags/debug/test_property_tag.py rename weldx/{asdf/tags/weldx => tags}/debug/test_shape_validator.py (79%) rename weldx/{asdf/tags/weldx => tags}/debug/test_unit_validator.py (75%) rename weldx/{asdf/tags/weldx => tags}/equipment/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/equipment/measurement_equipment.py (59%) rename weldx/{asdf/tags/weldx => tags}/groove/__init__.py (100%) create mode 100644 weldx/tags/groove/iso_9692_1.py rename weldx/{asdf/tags/weldx => tags}/measurement/__init__.py (100%) rename weldx/{asdf/tags/weldx => tags}/measurement/error.py (66%) rename weldx/{asdf/tags/weldx => tags}/measurement/measurement.py (64%) create mode 100644 weldx/tags/measurement/measurement_chain.py rename weldx/{asdf/tags/weldx => tags}/measurement/signal.py (60%) rename weldx/{asdf/tags/weldx => tags}/measurement/signal_transformation.py (63%) rename weldx/{asdf/tags/weldx => tags}/measurement/source.py (63%) rename weldx/{asdf/tags/weldx => tags}/processes/__init__.py (100%) create mode 100644 weldx/tags/processes/process.py create mode 100644 weldx/tags/time/__init__.py create mode 100644 weldx/tags/time/datetimeindex.py create mode 100644 weldx/tags/time/time.py create mode 100644 weldx/tags/time/timedelta.py create mode 100644 weldx/tags/time/timedeltaindex.py create mode 100644 weldx/tags/time/timestamp.py rename weldx/{asdf/tags/weldx => tags}/unit/__init__.py (100%) create mode 100644 weldx/tags/unit/pint_quantity.py diff --git a/.deepsource.toml b/.deepsource.toml index 20a367e53..149b0d2f8 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -10,6 +10,7 @@ exclude_patterns = [ "scripts/**", "weldx/_version.py", "weldx/asdf/**", + "weldx/tags/**", ] [[analyzers]] diff --git a/.github/workflows/pytest_asdf.yml b/.github/workflows/pytest_asdf.yml index a792cdffb..98e817405 100644 --- a/.github/workflows/pytest_asdf.yml +++ b/.github/workflows/pytest_asdf.yml @@ -7,7 +7,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04] + os: [ubuntu-latest] py: ['3.8'] steps: - uses: actions/checkout@v2 @@ -19,4 +19,28 @@ jobs: pip install -e .[test] - name: run asdf schema pytest run: | - pytest --asdf-tests --ignore=weldx/tests/ --no-cov weldx/asdf/schemas/ + pytest --asdf-tests --ignore=weldx/tests/ --no-cov weldx/schemas/ + + validate_manifest: + name: validate weldx manifest + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: pip installs + run: | + python -m pip install git+https://github.com/asdf-format/asdf.git + - uses: jannekem/run-python-script-action@v1 + with: + script: | + from pathlib import Path + import asdf + import yaml + schema = asdf.schema.load_schema( + "asdf://asdf-format.org/core/schemas/extension_manifest-1.0.0" + ) + for f in Path("./weldx/manifests/").glob("*.yaml"): + manifest = yaml.safe_load(open(f).read()) + asdf.schema.validate(manifest, schema=schema) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78fb11ace..07693650b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,7 @@ ### fixes - `WeldxFile.show_asdf_header` prints output on console, before it only returned the header as parsed dict and string - representation. Also tweaked efficency by not writing binary + representation. Also tweaked efficiency by not writing binary blocks [[#459]](https://github.com/BAMWelDX/weldx/pull/459). ### documentation @@ -46,6 +46,21 @@ ### ASDF - add ``time/time`` schema to support `Time` class [[#463]](https://github.com/BAMWelDX/weldx/pull/463). +- rework ASDF extension to new asdf 2.8 API [[#467]](https://github.com/BAMWelDX/weldx/pull/467) + - move schema files to ``weldx/schemas`` + - create extension manifest in ``weldx/manifests``. The manifest also contains tag mappings for legacy tag names for + backwards compatibility. + - move tag module to ``weldx/tags`` + - refactor all asdf uris to new ``asdf://`` naming convention, + see https://asdf.readthedocs.io/en/latest/asdf/extending/uris.html#entities-identified-by-uri + - replaced all referenced weldx tag versions in schemas with ``1.*`` + - refactor ``asdf://weldx.bam.de/weldx/schemas/datamodels/single_pass_weld-1.0.0.schema`` + to ``asdf://weldx.bam.de/weldx/schemas/datamodels/single_pass_weld-1.0.0`` and enable schema test + - add legacy class for validators support in ``weldx.asdf._extension.py`` + - asdf utility functions `weldx.asdf.util.uri_match`, `weldx.asdf.util.get_converter_for_tag` + and `weldx.asdf.util.get_weldx_extension` + - add ``devtools/scripts/update_manifest.py`` to auto update manifest from extension metadata + - custom shape validation must now be implemented via staticmethod ``WeldxConverter.shape_from_tagged`` ### deprecations diff --git a/MANIFEST.in b/MANIFEST.in index 2cfc01acc..fad08b89f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ -recursive-include weldx/asdf/schemas *.yaml +recursive-include weldx/schemas *.yaml +recursive-include weldx/manifests *.yaml prune .binder prune .github diff --git a/devtools/conda.recipe/meta.yaml b/devtools/conda.recipe/meta.yaml index 5aac5db69..3d52ea976 100644 --- a/devtools/conda.recipe/meta.yaml +++ b/devtools/conda.recipe/meta.yaml @@ -10,7 +10,7 @@ source: build: number: 0 noarch: python - script: pip install . -v + script: {{ PYTHON }} -m pip install . -vv entry_points: {% for e in data['entry_points']['console_scripts'] %} - {{ e }} @@ -37,6 +37,8 @@ test: - weldx - weldx.visualization commands: + - pip check + - welding_schema --help - pytest --pyargs weldx.tests -n auto --dist=loadfile about: diff --git a/devtools/scripts/update_manifest.py b/devtools/scripts/update_manifest.py new file mode 100644 index 000000000..08d286a39 --- /dev/null +++ b/devtools/scripts/update_manifest.py @@ -0,0 +1,57 @@ +from pathlib import Path + +import yaml + +from weldx.asdf.types import _legacy_tag_from_new_tag +from weldx.asdf.util import get_converter_for_tag + + +def update_manifest( + search_dir: str = "../../schemas", + out: str = "../../manifests/weldx-1.0.0.yaml", +): + """Create manifest file from existing schemas.""" + # read existing manifest + manifest = yaml.load( + Path(out).read_text(), + Loader=yaml.SafeLoader, + ) + + # keep only ASDF schema mappings + manifest["tags"] = [ + mapping + for mapping in manifest["tags"] + if mapping["schema_uri"].startswith("http://stsci.edu/schemas") + ] + + schemas = Path(search_dir).rglob("*.yaml") + + for schema in schemas: + content = yaml.load( + schema.read_text(), + Loader=yaml.SafeLoader, + ) + if "id" in content: # should be schema file + uri: str = content["id"] + tag = uri.replace("/schemas/", "/tags/") + if get_converter_for_tag(tag): # check if converter is implemented + manifest["tags"].append(dict(tag_uri=tag, schema_uri=uri)) + manifest["tags"].append( + dict(tag_uri=_legacy_tag_from_new_tag(tag), schema_uri=uri) + ) # legacy_tag + else: + print(f"No converter for URI: {schema}") + + with open(Path(out), "w") as outfile: + outfile.write("%YAML 1.1\n---\n") + yaml.dump( + manifest, + outfile, + default_flow_style=False, + sort_keys=False, + ) + outfile.write("...\n") + + +if __name__ == "__main__": + update_manifest() diff --git a/doc/conf.py b/doc/conf.py index 3194fd9fd..d4029c5c2 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -53,7 +53,7 @@ def _prevent_sphinx_circular_imports_bug(): raise import weldx.visualization # load visualization (currently no auto-import in pkg). -from weldx.asdf.constants import SCHEMA_PATH, WELDX_TAG_BASE +from weldx.asdf.constants import SCHEMA_PATH, WELDX_TAG_URI_BASE # -- copy tutorial files to doc folder ------------------------------------------------- tutorials_dir = pathlib.Path("./tutorials") @@ -196,10 +196,10 @@ def _prevent_sphinx_circular_imports_bug(): # -- sphinx-asdf configuration ------------------------------------------------- # This variable indicates the top-level directory containing schemas. # The path is relative to the location of conf.py in the package -asdf_schema_path = os.path.relpath(SCHEMA_PATH) +asdf_schema_path = os.path.relpath(str(SCHEMA_PATH)) # This variable indicates the standard prefix that is common to all schemas # provided by the package. -asdf_schema_standard_prefix = "weldx.bam.de/weldx" +asdf_schema_standard_prefix = "" # SCHEMA_PATH already points to final schema dir # enable references to the ASDF Standard documentation asdf_schema_reference_mappings = [ @@ -208,7 +208,7 @@ def _prevent_sphinx_circular_imports_bug(): "http://asdf-standard.readthedocs.io/en/latest/generated/stsci.edu/asdf/", ), ( - WELDX_TAG_BASE, + WELDX_TAG_URI_BASE, "http://weldx.readthedocs.io/en/latest/generated/weldx.bam.de/weldx/", ), ] @@ -274,7 +274,7 @@ def _prevent_sphinx_circular_imports_bug(): # "numba": ("https://numba.pydata.org/numba-doc/latest", None), "pint": ("https://pint.readthedocs.io/en/stable", None), "jsonschema": ("https://python-jsonschema.readthedocs.io/en/stable/", None), - "asdf": ("https://asdf.readthedocs.io/en/stable/", None), + "asdf": ("https://asdf.readthedocs.io/en/latest/", None), "networkx": ("https://networkx.org/documentation/stable/", None), "IPython": ("https://ipython.readthedocs.io/en/stable/", None), "k3d": ("https://k3d-jupyter.org/", None), diff --git a/doc/nitpick_ignore b/doc/nitpick_ignore index 4e7bb32fc..e21c1ee79 100644 --- a/doc/nitpick_ignore +++ b/doc/nitpick_ignore @@ -52,3 +52,8 @@ py:obj left py:obj right py:meth scipy.stats.special_ortho_group py:obj mrp[i] + +# asdf +py:class iterable of asdf.extension.Compressor instances +py:class See the class docstring for details on keyword +py:class iterable of str diff --git a/doc/standard/shape-validation.rst b/doc/standard/shape-validation.rst index 6700febf0..fd3071d17 100644 --- a/doc/standard/shape-validation.rst +++ b/doc/standard/shape-validation.rst @@ -223,7 +223,7 @@ The following custom types can be validate with ``wx_shape`` even though the might not always define a shape property in itself. - ``number`` will validate like ``shape: [1]`` -- ``tag:weldx.bam.de:weldx/time/timedeltaindex-1.0.0`` will validate +- ``asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-1.0.0`` will validate against the length of the ``TimedeltaIndex`` even if no data is stored. @@ -237,8 +237,8 @@ Here is a more complex example demonstration some of the above points. %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" - id: "http://weldx.bam.de/schemas/weldx/debug/test_shape_validator-1.0.0" - tag: "tag:weldx.bam.de:weldx/debug/test_shape_validator-1.0.0" + id: "asdf://weldx.bam.de/weldx/schemas/debug/test_shape_validator-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/debug/test_shape_validator-1.0.0" title: | simple demonstration and test schema for wx_shape validator syntax diff --git a/doc/standard/unit-validation.rst b/doc/standard/unit-validation.rst index 60b28d6e7..3920abbc0 100644 --- a/doc/standard/unit-validation.rst +++ b/doc/standard/unit-validation.rst @@ -48,7 +48,7 @@ this more complex example for details: .. code:: yaml - tag: "tag:weldx.bam.de:weldx/debug/test_unit_validator-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/debug/test_unit_validator-1.0.0" title: | simple demonstration schema for wx_unit validator diff --git a/doc/standard/welding-processes.rst b/doc/standard/welding-processes.rst index 3e2fec967..86eff1d29 100644 --- a/doc/standard/welding-processes.rst +++ b/doc/standard/welding-processes.rst @@ -10,7 +10,7 @@ base GMAW process schema ------------------------ The main layout of any GMAW process is defined in the -``http://weldx.bam.de/schemas/weldx/process/terms-1.0.0`` schema as +``asdf://weldx.bam.de/weldx/schemas/process/terms-1.0.0`` schema as ``base_process``: .. code:: yaml @@ -29,7 +29,7 @@ The main layout of any GMAW process is defined in the type: string parameters: type: object - wx_property_tag: "tag:weldx.bam.de:weldx/core/time_series-*" + wx_property_tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-*" meta: type: object required: [base_process,manufacturer,power_source,parameters] @@ -55,15 +55,15 @@ simple generic GMAW process definition -------------------------------------- The most generic tag implementation of any arc welding process is -provided by ``tag:weldx.bam.de:weldx/process/GMAW-1.0.0``: +provided by ``asdf://weldx.bam.de/weldx/tags/process/GMAW-1.0.0``: .. code:: yaml %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" - id: "http://weldx.bam.de/schemas/weldx/process/GMAW-1.0.0" - tag: "tag:weldx.bam.de:weldx/process/GMAW-1.0.0" + id: "asdf://weldx.bam.de/weldx/schemas/process/GMAW-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/process/GMAW-1.0.0" title: | Generic GMAW process definition. @@ -117,13 +117,13 @@ that the ``parameters`` property always includes a ``wire_feedrate`` and wire_feedrate: description: | Nominal average wire feedrate. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.0.0" wx_unit: "m/s" voltage: description: | Nominal target voltage for spray arc processes. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.0.0" wx_unit: "V" combining process schemas @@ -167,8 +167,8 @@ parameters: %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" - id: "http://weldx.bam.de/schemas/weldx/process/CLOOS/spray_arc-1.0.0" - tag: "tag:weldx.bam.de:weldx/process/CLOOS/spray_arc-1.0.0" + id: "asdf://weldx.bam.de/weldx/schemas/process/CLOOS/spray_arc-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/process/CLOOS/spray_arc-1.0.0" title: | CLOOS spray arc process. @@ -182,10 +182,10 @@ parameters: type: object properties: impedance: - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.0.0" wx_unit: "percent" characteristic: - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.0.0" wx_unit: "V/A" required: [impedance, characteristic] @@ -221,20 +221,20 @@ And here is the resulting ASDF snippet: .. code:: yaml - spray: ! + spray: ! base_process: spray manufacturer: CLOOS parameters: - characteristic: ! + characteristic: ! unit: volt / ampere values: 5 - impedance: ! + impedance: ! unit: percent values: 10.0 - voltage: ! + voltage: ! unit: volt values: 40.0 - wire_feedrate: ! + wire_feedrate: ! unit: meter / minute values: 10.0 power_source: Quinto diff --git a/setup.cfg b/setup.cfg index 3dd6785d7..c124746d3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -53,7 +53,6 @@ install_requires = k3d !=2.10 meshio psutil - include_package_data = True [options.extras_require] @@ -64,10 +63,11 @@ test = nbval [options.entry_points] -asdf_extensions = - weldx = weldx.asdf.extension:WeldxExtension - weldx-asdf = weldx.asdf.extension:WeldxAsdfExtension - +asdf.extensions = + weldx = weldx.asdf.extension:get_extensions + weldx_validators = weldx.asdf._extension:WeldxValidatorExtension +asdf.resource_mappings = + weldx_schemas = weldx.asdf.extension:get_resource_mappings console_scripts = welding_schema = weldx.asdf.cli.welding_schema:main @@ -92,20 +92,20 @@ exclude = # convention numpy is currently equivalent to ignoring 'D107', 'D203', 'D212', 'D213', 'D402', 'D413' convention = numpy match = (?!__)(?!_version)(?!conftest).*\.py -match_dir = [^\.][^\docs].* +match_dir = [^\.][^\docs][^\tags].* [tool:pytest] -addopts = --tb=short --color=yes -rs --cov=weldx --cov-report=term-missing:skip-covered --doctest-modules +addopts = --tb=short --color=yes -rsw --cov=weldx --cov-report=term-missing:skip-covered --doctest-modules #addopts = --tb=short --color=yes -rs -p no:cov testpaths = weldx # custom test markers, see https://docs.pytest.org/en/latest/example/markers.html#mark-examples markers = slow: marks tests as slow to run (skipped by default, enable with --runslow option) -asdf_schema_root = weldx/asdf/schemas +asdf_schema_root = weldx/schemas #asdf_schema_tests_enabled = true -asdf_schema_skip_tests = - weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml +#asdf_schema_skip_tests = +# weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml norecursedirs = doc [isort] @@ -130,7 +130,6 @@ exclude_lines = [mypy] python_version = 3.9 - files=weldx ignore_missing_imports = True strict_optional = False @@ -142,6 +141,8 @@ show_column_numbers = True [mypy-weldx.asdf.*] ignore_errors = True +[mypy-weldx.tags.*] +ignore_errors = True [mypy-weldx.tests.*] ignore_errors = True # remove after refactoring the geometry module diff --git a/tutorials/custom_metadata.ipynb b/tutorials/custom_metadata.ipynb index 3051fb7f0..9ad6d6559 100644 --- a/tutorials/custom_metadata.ipynb +++ b/tutorials/custom_metadata.ipynb @@ -79,7 +79,7 @@ "As we can see, our custom metadata gets serialized into the ASDF tree:\n", "```yaml\n", "wx_metadata:\n", - " calibration: ! {value: '2020-06-01T00:00:00'}\n", + " calibration: ! {value: '2020-06-01T00:00:00'}\n", " wx_user:\n", " notes: [wallmounted, The cable seems to be a bit loose.]\n", "```\n", diff --git a/tutorials/measurement_example.ipynb b/tutorials/measurement_example.ipynb index a57cb1eb4..ef596c069 100644 --- a/tutorials/measurement_example.ipynb +++ b/tutorials/measurement_example.ipynb @@ -193,7 +193,7 @@ "metadata": {}, "outputs": [], "source": [ - "from weldx.asdf.tags.weldx.core.mathematical_expression import MathematicalExpression\n", + "from weldx.tags.core.mathematical_expression import MathematicalExpression\n", "\n", "current_AD_func = MathematicalExpression(\n", " expression=\"a * x + b\", \n", diff --git a/tutorials/quality_standards.ipynb b/tutorials/quality_standards.ipynb index 5762d1446..c40ce00d5 100644 --- a/tutorials/quality_standards.ipynb +++ b/tutorials/quality_standards.ipynb @@ -186,8 +186,8 @@ "%YAML 1.1\n", "---\n", "$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\n", - "id: \"http://weldx.bam.de/schemas/weldx/equipment/measurement_equipment-1.0.0\"\n", - "tag: \"tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0\"\n", + "id: \"asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0\"\n", + "tag: \"asdf://weldx.bam.de/weldx/tags/equipment/measurement_equipment-1.0.0\"\n", "\n", "title: |\n", " A piece of measurement equipment.\n", @@ -202,11 +202,11 @@ " sources:\n", " type: array\n", " items:\n", - " tag: \"tag:weldx.bam.de:weldx/measurement/source-1.0.0\"\n", + " tag: \"asdf://weldx.bam.de/weldx/tags/measurement/source-1.0.0\"\n", " transformations:\n", " type: array\n", " items:\n", - " tag: \"tag:weldx.bam.de:weldx/measurement/signal_transformation-1.0.0\"\n", + " tag: \"asdf://weldx.bam.de/weldx/tags/measurement/signal_transformation-1.0.0\"\n", "\n", "propertyOrder: [name, sources, transformations]\n", "required: [name]\n", @@ -246,8 +246,8 @@ "%YAML 1.1\n", "---\n", "$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\n", - "id: \"http://weldx.bam.de/schemas/weldx/equipment/measurement_equipment-1.0.0\"\n", - "tag: \"tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0\"\n", + "id: \"asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0\"\n", + "tag: \"asdf://weldx.bam.de/weldx/tags/equipment/measurement_equipment-1.0.0\"\n", "\n", "title: |\n", " A piece of measurement equipment.\n", @@ -349,7 +349,7 @@ "\n", "# mappings\n", "tags:\n", - "- uri: \"http://weldx.bam.de/schemas/weldx/equipment/measurement_equipment-1.0.0\"\n", + "- uri: \"asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0\"\n", " file: \"my_measurement_equipment_schema-1.0.0\"\n", "\"\"\"" ] @@ -392,7 +392,7 @@ "If you are not sure about the exact URI just have a look into the original schema of the object.\n", "You can find all schemas [here](../standard.rst).\n", "In our example we want to replace the schema for the URI\n", - "`http://weldx.bam.de/schemas/weldx/equipment/measurement_equipment-1.0.0`.\n", + "`asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0`.\n", "Additionally, each item of the YAML list needs a `file` property which specifies the relative file path of the new\n", "schema inside the `schemas` directory, omitting the file extension.\n", "So in our case we use `file: \"my_measurement_equipment_schema-1.0.0`\n", diff --git a/weldx/__init__.py b/weldx/__init__.py index ebe55dc90..0a5fc26bb 100644 --- a/weldx/__init__.py +++ b/weldx/__init__.py @@ -25,10 +25,6 @@ import weldx.welding import weldx.time -# asdf extensions and tags -import weldx.asdf -from weldx.asdf.file import WeldxFile - # class imports to weldx namespace from weldx.config import Config from weldx.core import MathematicalExpression, TimeSeries @@ -51,6 +47,13 @@ from weldx.welding.groove.iso_9692_1 import get_groove from weldx.time import Time +# tags (this will partially import weldx.asdf but not the extension) +from weldx import tags + +# asdf extensions +import weldx.asdf +from weldx.asdf.file import WeldxFile + __all__ = ( "ArcSegment", "CoordinateSystemManager", diff --git a/weldx/asdf/__init__.py b/weldx/asdf/__init__.py index 2341ecb00..456ea2002 100644 --- a/weldx/asdf/__init__.py +++ b/weldx/asdf/__init__.py @@ -1,8 +1,6 @@ """This submodule contains ASDF related weldx extensions and schemas.""" # isort:skip_file -from weldx.asdf import tags # implement tags before the asdf extensions -from weldx.asdf import constants, util -from weldx.asdf.extension import WeldxAsdfExtension, WeldxExtension -# class imports to weldx.asdf namespace -from weldx.asdf.tags.weldx.core.file import ExternalFile +from weldx import tags # implement tags before the asdf extensions here just to be safe + +from . import constants, file, types, util diff --git a/weldx/asdf/_extension.py b/weldx/asdf/_extension.py new file mode 100644 index 000000000..b5cc9d7eb --- /dev/null +++ b/weldx/asdf/_extension.py @@ -0,0 +1,47 @@ +"""Legacy asdf extension code to add custom validators.""" + +from asdf.extension import AsdfExtension +from asdf.types import CustomType +from asdf.util import filepath_to_url + +from .constants import SCHEMA_PATH, WELDX_SCHEMA_URI_BASE, WELDX_TAG_URI_BASE +from .validators import wx_property_tag_validator, wx_shape_validator, wx_unit_validator + +WELDX_URL_MAPPING = [ + ( + WELDX_SCHEMA_URI_BASE, + filepath_to_url(str(SCHEMA_PATH)) + "/{url_suffix}.yaml", + ) +] + + +class WeldxLegacyValidatorType(CustomType): + """Dummy legacy class to register weldx validators using legacy asdf API.""" + + organization = "weldx.bam.de" + standard = "weldx" + name = "legacy/validators" + version = "1.0.0" + types = [] + validators = { + "wx_property_tag": wx_property_tag_validator, + "wx_unit": wx_unit_validator, + "wx_shape": wx_shape_validator, + } + versioned_siblings = [] + + +class WeldxValidatorExtension(AsdfExtension): + """Legacy extension class registering weldx validators.""" + + @property + def types(self): + return [WeldxLegacyValidatorType()] + + @property + def tag_mapping(self): + return [(WELDX_TAG_URI_BASE, WELDX_SCHEMA_URI_BASE + "{tag_suffix}")] + + @property + def url_mapping(self): + return WELDX_URL_MAPPING diff --git a/weldx/asdf/cli/welding_schema.py b/weldx/asdf/cli/welding_schema.py index 3fee59078..d64d386dd 100644 --- a/weldx/asdf/cli/welding_schema.py +++ b/weldx/asdf/cli/welding_schema.py @@ -33,13 +33,13 @@ def single_pass_weld_example( from weldx import Q_, GmawProcess from weldx import LocalCoordinateSystem as lcs from weldx import TimeSeries, WXRotation, get_groove - from weldx.asdf.tags.weldx.aws.process.gas_component import GasComponent - from weldx.asdf.tags.weldx.aws.process.shielding_gas_for_procedure import ( - ShieldingGasForProcedure, - ) - from weldx.asdf.tags.weldx.aws.process.shielding_gas_type import ShieldingGasType from weldx.asdf.util import get_schema_path, write_buffer from weldx.core import MathematicalExpression + 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.welding.util import sine # Timestamp @@ -292,7 +292,7 @@ def single_pass_weld_example( wx_metadata={"welder": "A.W. Elder"}, ) - model_path = get_schema_path("single_pass_weld-1.0.0.schema.yaml") + model_path = get_schema_path("single_pass_weld-1.0.0.yaml") # pre-validate? weldx.asdf.util.write_read_buffer( diff --git a/weldx/asdf/constants.py b/weldx/asdf/constants.py index c8b896c26..3b01de978 100644 --- a/weldx/asdf/constants.py +++ b/weldx/asdf/constants.py @@ -1,15 +1,12 @@ -import os -from pathlib import Path +from weldx.constants import WELDX_PATH -from asdf.util import filepath_to_url +SCHEMA_PATH = WELDX_PATH / "schemas/weldx.bam.de/weldx" +MANIFEST_PATH = WELDX_PATH / "manifests" -SCHEMA_PATH = str(Path(__file__).resolve().parents[0] / "schemas") -WELDX_SCHEMA_URI_BASE = "http://weldx.bam.de/schemas/" -WELDX_TAG_BASE = "tag:weldx.bam.de:weldx" -WELDX_URL_MAPPING = [ - ( - WELDX_SCHEMA_URI_BASE, - filepath_to_url(os.path.join(SCHEMA_PATH, "weldx.bam.de")) - + "/{url_suffix}.yaml", - ) -] +WELDX_URI_BASE = "asdf://weldx.bam.de/weldx/" +WELDX_TAG_URI_BASE = "asdf://weldx.bam.de/weldx/tags/" +WELDX_SCHEMA_URI_BASE = "asdf://weldx.bam.de/weldx/schemas/" +WELDX_EXTENSION_URI_BASE = "asdf://weldx.bam.de/weldx/extensions/" + +WELDX_EXTENSION_VERSION = "1.0.0" +WELDX_EXTENSION_URI = f"{WELDX_EXTENSION_URI_BASE}weldx-{WELDX_EXTENSION_VERSION}" diff --git a/weldx/asdf/extension.py b/weldx/asdf/extension.py index 4ef05ad11..b54d3332d 100644 --- a/weldx/asdf/extension.py +++ b/weldx/asdf/extension.py @@ -1,50 +1,67 @@ -# Licensed under a 3-clause BSD style license - see LICENSE -# -*- coding: utf-8 -*- +from typing import List -from asdf.extension import AsdfExtension, BuiltinExtension +from asdf.extension import ManifestExtension +from asdf.resource import DirectoryResourceMapping -from weldx.asdf.constants import ( +from .constants import ( + MANIFEST_PATH, + SCHEMA_PATH, + WELDX_EXTENSION_URI, + WELDX_EXTENSION_URI_BASE, WELDX_SCHEMA_URI_BASE, - WELDX_TAG_BASE, - WELDX_URL_MAPPING, + WELDX_TAG_URI_BASE, ) - -from .types import _weldx_asdf_types, _weldx_types - -__all__ = ["WeldxExtension", "WeldxAsdfExtension"] - - -class WxSyntaxError(Exception): - """Exception raising on custom weldx ASDF syntax errors.""" - - -class WeldxExtension(AsdfExtension): - """Extension class registering types with both tags and schemas defined by weldx.""" - - @property - def types(self): - # There are no types yet! - return _weldx_types - - @property - def tag_mapping(self): - return [(WELDX_TAG_BASE, WELDX_SCHEMA_URI_BASE + "weldx{tag_suffix}")] - - @property - def url_mapping(self): - return WELDX_URL_MAPPING - - @property - def yaml_tag_handles(self): - return {"!weldx!": "tag:weldx.bam.de:weldx/"} - - -class WeldxAsdfExtension(BuiltinExtension): - """This extension is used to register custom tag types that have schemas defined - by ASDF, but have tag implementations defined in the weldx package - - """ - - @property - def types(self): - return _weldx_asdf_types +from .types import WeldxConverter +from .validators import wx_property_tag_validator, wx_shape_validator, wx_unit_validator + + +# RESOURCES ---------------------------------------------------------------------------- +def get_extension_resource_mapping() -> DirectoryResourceMapping: + """Get the weldx manifest resource mapping.""" + mapping = DirectoryResourceMapping( + MANIFEST_PATH, + WELDX_EXTENSION_URI_BASE, + recursive=True, + filename_pattern="*.yaml", + stem_filename=True, + ) + return mapping + + +def get_schema_resource_mapping() -> DirectoryResourceMapping: + """Get the weldx schema resource mapping.""" + mapping = DirectoryResourceMapping( + SCHEMA_PATH, + WELDX_SCHEMA_URI_BASE, + recursive=True, + filename_pattern="*.yaml", + stem_filename=True, + ) + return mapping + + +def get_resource_mappings() -> List[DirectoryResourceMapping]: + """Get list of all weldx resource mappings.""" + return [get_extension_resource_mapping(), get_schema_resource_mapping()] + + +# Extension ---------------------------------------------------------------------------- +class WeldxExtension(ManifestExtension): + """weldx extension class""" + + converters = (cls() for cls in WeldxConverter.__subclasses__()) + legacy_class_names = [ + "weldx.asdf.extension.WeldxAsdfExtension", + "weldx.asdf.extension.WeldxExtension", + ] + yaml_tag_handles = {"!weldx!": WELDX_TAG_URI_BASE} + validators = { # not active yet + "wx_property_tag": wx_property_tag_validator, + "wx_unit": wx_unit_validator, + "wx_shape": wx_shape_validator, + } + + +def get_extensions() -> List[ManifestExtension]: + """Get a list of all weldx extensions.""" + return [WeldxExtension.from_uri(WELDX_EXTENSION_URI)] diff --git a/weldx/asdf/file.py b/weldx/asdf/file.py index 5059dfc88..520548878 100644 --- a/weldx/asdf/file.py +++ b/weldx/asdf/file.py @@ -13,10 +13,10 @@ from asdf.util import get_file_type from jsonschema import ValidationError -from weldx.asdf import WeldxAsdfExtension, WeldxExtension -from weldx.asdf.util import get_schema_path, get_yaml_header, view_tree from weldx.types import SupportsFileReadWrite, types_file_like, types_path_and_file_like +from .util import get_schema_path, get_yaml_header, view_tree + __all__ = [ "WeldxFile", ] @@ -162,7 +162,7 @@ def __init__( f" Should be one of {_supported}." ) - extensions = [WeldxExtension(), WeldxAsdfExtension()] + extensions = None # If we have data to write, we do it first, so a WeldxFile is always in sync. if tree or new_file_created: asdf_file = AsdfFile( diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml b/weldx/asdf/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml deleted file mode 100644 index b5c8fd2f2..000000000 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.schema.yaml +++ /dev/null @@ -1,454 +0,0 @@ -%YAML 1.1 ---- -$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/datamodels/single_pass_weld-1.0.0.schema" - -title: | - Single pass, single wire GMAW weldment. -description: | - Schema describing a simple single pass welding application along a linear weld seam with constant groove shape. - - The idea of the schema is to define an abstract welding experiment with actual current and voltage measurements attached. - - This schema requires the following entries to be present: - - workpiece - - TCP - - welding_current - - welding_voltage - - measurements - - equipment - - Other entries are optional as listed in the schema description. - - The workpiece is defined by two properties: - - the base metal type - - the workpiece geometry defined by the combination of - - the groove shape (following ISO 9692-1) - - the total seam length - - It is assumed that the complete workpiece length is equal to the seam length. - Outside the welding groove shape, no information is given regarding the outer shape of the workpiece. - Additional information about the workpiece should be stored in the `wx_user` entries of the appropriate properties. - More complex workpiece data can be attached as custom data to the associated coordinate system. - - The TCP property is used to describe the path of the welding TCP along the weld seam. - For this schema, the TCP information is expected to be a linear movement between two points at a constant weld speed. - The TCP reference frame is the workpiece base coordinate system, starting at the beginning of the weld seam. - The x-axis coordinates will indicate the start- and end-point of the welding process along the workpiece length. - The y- and z-coordinates determine the position of the TCP in relation to the cross-sectional groove plane. - - The welding_current and welding_voltage entries refer to signals containing the final measurement data of corresponding dimensions [current] and [voltage]. - Additional details of the measurements can be attached via user fields here or in the respective measurement-chain. - - The measurements entry contains the full information about all measurements and their associated measurement chains. - - The equipment property provides a list of the measurement equipment used. - -type: object -properties: - process: - description: | - Metadata describing the GMAW process. - type: object - properties: - welding_process: - $ref: "http://weldx.bam.de/schemas/weldx/process/GMAW-1.0.0" - shielding_gas: - tag: "tag:weldx.bam.de:weldx/aws/process/shielding_gas_for_procedure-1.0.0" - weld_speed: - description: | - The constant weld speed of the welding TCP movement. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" - wx_unit: "m/s" - wx_shape: [1] - welding_wire: - description: | - Object describing the welding wire used. - type: object - properties: - diameter: - description: | - The diameter of the welding wire. - tag: "tag:stsci.edu:asdf/unit/quantity-1.*" - wx_unit: "m" - wx_shape: [1] - class: - description: | - The wire classification according to DIN EN ISO 14341, DIN EN 12072 or similar standards. - Addition standard details should be stored in the wx_user property. - type: string - required: [diameter] - required: [welding_process, shielding_gas, weld_speed, welding_wire] - welding_current: - description: | - The signal representing the welding current measurement. - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.0.0" - wx_unit: "A" - welding_voltage: - description: | - The signal representing the welding voltage measurement. - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.0.0" - wx_unit: "V" - TCP: - description: | - Transformation describing the welding TCP movement in relation to the groove coordinates. - - The movement describes a linear motion between two points along the weld seam at constant velocity. - tag: "tag:weldx.bam.de:weldx/core/transformations/local_coordinate_system-1.0.0" - wx_shape: - time: [2~] - coordinate_systems: - description: | - The expanded coordinate system setup describing the welding experiment and associated coordinate systems in detail. - tag: "tag:weldx.bam.de:weldx/core/transformations/coordinate_system_hierarchy-1.0.0" - equipment: - description: | - A list of equipments used for measurements and describing the weld seam. - type: array - items: - tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0" - measurements: - description: | - List of all measurements associated with the experiment. - type: array - items: - tag: "tag:weldx.bam.de:weldx/measurement/measurement-1.0.0" - workpiece: - description: | - The workpiece to be welded defined by the base metal and the geometric description of the weld seam. - type: object - properties: - base_metal: - description: | - The base metal composition of the workpiece. - type: object - properties: - common_name: - description: | - The common description of the base metal composition or classification as listed in the standard. - type: string - standard: - description: | - The standard listing and describing the base metal compositions. - type: string - required: [common_name, standard] - geometry: - description: | - Description of the workpiece geometry consisting of the groove shape and the total seam length. - type: object - properties: - groove_shape: - description: | - Constant groove shape of the weld seam. - tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/*-1.*" - seam_length: - description: | - Length of the linear weld seam. - tag: "tag:stsci.edu:asdf/unit/quantity-1.*" - wx_unit: "m" - required: [groove_shape, seam_length] - required: [base_metal, geometry] - reference_timestamp: - description: | - An optional timestamp indicating the start of the welding process. - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.0.0" - wx_metadata: - description: | - General metadata container. - type: object - wx_user: - description: | - Metadata container for additional user documentation of the experiment. - type: object -required: [equipment,workpiece,measurements,welding_current,welding_voltage,TCP] - -examples: - - - - A simple welding application - - | - TCP: ! - time: ! - values: !core/ndarray-1.0.0 - data: [0, 29000000000] - datatype: int64 - shape: [2] - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M29S} - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M29S} - orientations: ! - name: orientations - dimensions: [c, v] - dtype: - name: coordinates - dimensions: [time, c] - dtype: - name: Coordinate system manager 0 - root_system_name: base - subsystems: [] - coordinate_systems: - - ! - name: workpiece - reference_system: base - transformation: ! {} - - ! - name: tcp_wire - reference_system: workpiece - transformation: ! - time: ! - values: !core/ndarray-1.0.0 - data: [0, 29000000000] - datatype: int64 - shape: [2] - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M29S} - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M29S} - orientations: ! - name: orientations - dimensions: [c, v] - dtype: - name: coordinates - dimensions: [time, c] - dtype: - name: tcp_contact - reference_system: tcp_wire - transformation: ! - coordinates: ! - name: coordinates - dimensions: [c] - dtype: - name: HKS P1000-S3 - sources: - - &id003 ! - name: Current Sensor - output_signal: &id002 ! - signal_type: analog - unit: V - error: ! - deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.1} - - &id007 ! - name: Voltage Sensor - output_signal: &id001 ! - signal_type: analog - unit: V - error: ! - deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.1} - data_transformations: - - &id008 ! - name: AD conversion voltage measurement - input_signal: *id001 - output_signal: &id009 ! - signal_type: digital - unit: '' - error: ! - deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.01} - func: ! - expression: a*x + b - parameters: - a: !unit/quantity-1.1.0 {unit: 1 / volt, value: 3276.8} - b: !unit/quantity-1.1.0 {unit: dimensionless, value: 0.0} - - ! - name: Beckhoff ELM3002-0000 - sources: [] - data_transformations: - - &id004 ! - name: AD conversion current measurement - input_signal: *id002 - output_signal: &id005 ! - signal_type: digital - unit: '' - error: ! - deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.01} - func: ! - expression: a*x + b - parameters: - a: !unit/quantity-1.1.0 {unit: 1 / volt, value: 3276.8} - b: !unit/quantity-1.1.0 {unit: dimensionless, value: 0.0} - measurements: - - ! - name: welding current measurement - data: - - &id006 ! - name: Welding current - data: ! - attributes: {} - coordinates: - - ! - name: time - dimensions: [time] - dtype: - name: data - dimensions: [time] - dtype: - name: welding current measurement chain - data_source: *id003 - data_processors: - - *id004 - - ! - name: Calibration current measurement - input_signal: *id005 - output_signal: &id012 ! - signal_type: digital - unit: A - data: *id006 - error: ! - deviation: 0.0 - func: ! - expression: a*x + b - parameters: - a: !unit/quantity-1.1.0 {unit: ampere, value: 0.030517578125} - b: !unit/quantity-1.1.0 {unit: ampere, value: 0.0} - wx_metadata: - software: &id011 !core/software-1.0.0 {name: Beckhoff TwinCAT ScopeView, version: 3.4.3143} - - ! - name: welding voltage measurement - data: - - &id010 ! - name: Welding voltage - data: ! - attributes: {} - coordinates: - - ! - name: time - dimensions: [time] - dtype: - name: data - dimensions: [time] - dtype: - name: welding voltage measurement chain - data_source: *id007 - data_processors: - - *id008 - - ! - name: Calibration voltage measurement - input_signal: *id009 - output_signal: &id013 ! - signal_type: digital - unit: V - data: *id010 - error: ! - deviation: 0.0 - func: ! - expression: a*x + b - parameters: - a: !unit/quantity-1.1.0 {unit: volt, value: 0.0030517578125} - b: !unit/quantity-1.1.0 {unit: volt, value: 0.0} - wx_metadata: - software: *id011 - process: - shielding_gas: ! - use_torch_shielding_gas: true - torch_shielding_gas: ! - gas_component: - - ! - gas_chemical_name: argon - gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 82} - - ! - gas_chemical_name: carbon dioxide - gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 18} - common_name: SG - torch_shielding_gas_flowrate: !unit/quantity-1.1.0 {unit: liter / minute, value: 20} - weld_speed: !unit/quantity-1.1.0 {unit: millimeter / second, value: 10} - welding_process: ! - base_process: pulse - manufacturer: CLOOS - meta: {modulation: UI} - parameters: - base_current: ! - unit: ampere - value: 60.0 - pulse_duration: ! - unit: millisecond - value: 5.0 - pulse_frequency: ! - unit: hertz - value: 100.0 - pulse_voltage: ! - unit: volt - value: 40.0 - wire_feedrate: ! - unit: meter / minute - value: 10.0 - power_source: Quinto - tag: CLOOS/pulse - welding_wire: - diameter: !unit/quantity-1.1.0 {unit: millimeter, value: 1.2} - reference_timestamp: ! {value: '2020-11-09T12:00:00'} - welding_current: *id012 - welding_voltage: *id013 - workpiece: - base_metal: {common_name: S355J2+N, standard: 'DIN EN 10225-2:2011'} - geometry: - groove_shape: ! - t: !unit/quantity-1.1.0 {unit: millimeter, value: 5} - alpha: !unit/quantity-1.1.0 {unit: degree, value: 50} - b: !unit/quantity-1.1.0 {unit: millimeter, value: 1} - c: !unit/quantity-1.1.0 {unit: millimeter, value: 1} - code_number: ['1.3', '1.5'] - seam_length: !unit/quantity-1.1.0 {unit: millimeter, value: 300} - wx_metadata: {welder: A.W. Elder} -... diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml b/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml deleted file mode 100644 index ef32ba047..000000000 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml +++ /dev/null @@ -1,25 +0,0 @@ -%YAML 1.1 ---- -$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/measurement/measurement-1.0.0" -tag: "tag:weldx.bam.de:weldx/measurement/measurement-1.0.0" - -title: | - Schema that describes a measurement -type: object -properties: - name: - type: string - data: - type: array - items: - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" - - measurement_chain: - tag: "tag:weldx.bam.de:weldx/measurement/measurement_chain-1.0.0" - - -propertyOrder: [name, data, measurement_chain] -required: [name, data] -flowStyle: block -... \ No newline at end of file diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml b/weldx/asdf/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml deleted file mode 100644 index 215835777..000000000 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml +++ /dev/null @@ -1,25 +0,0 @@ -%YAML 1.1 ---- -$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/process/CLOOS/spray_arc-1.0.0" -tag: "tag:weldx.bam.de:weldx/process/CLOOS/spray_arc-1.0.0" - -title: | - CLOOS spray arc process. - -allOf: - - $ref: "../generic-1.0.0#/spray" - - type: object - properties: - parameters: - type: object - properties: - impedance: - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" - wx_unit: "percent" - characteristic: - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" - wx_unit: "V/A" - required: [impedance,characteristic] - -... \ No newline at end of file diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml b/weldx/asdf/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml deleted file mode 100644 index 31b657dff..000000000 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml +++ /dev/null @@ -1,63 +0,0 @@ -%YAML 1.1 ---- -$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/time/time-1.0.0" -tag: "tag:weldx.bam.de:weldx/time/time-1.0.0" - -title: | - Represents a single or multiple timestamps or timedeltas. - -examples: - - - - A single timedelta of 2 seconds - - | - ! - values: ! {value: P0DT0H0M2S} - - - - A timedelta series from 0 s to 4 s with a 2 s frequency - - | - ! - values: ! - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M4S} - freq: 2S - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M4S} - - - - A single timestamp - - | - ! - values: ! {value: '2021-08-01T00:00:00'} - - - - An absolute time index with a 1 s frequency - - | - ! - values: ! - start: ! {value: '2021-01-01T00:00:00'} - end: ! {value: '2021-01-01T00:00:02'} - freq: S - min: ! {value: '2021-01-01T00:00:00'} - max: ! {value: '2021-01-01T00:00:02'} - reference_time: ! {value: '2021-01-01T00:00:00'} - -type: object -properties: - values: - description: | - The time values that are represented by the Time object. - type: object - oneOf: - - tag: "tag:weldx.bam.de:weldx/time/timedelta-1.*" - - tag: "tag:weldx.bam.de:weldx/time/timedeltaindex-1.*" - - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" - - tag: "tag:weldx.bam.de:weldx/time/datetimeindex-1.*" - - reference_time: - description: | - Indicates a specific reference timestamp for the time object. - type: object - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" - -required: [values] -propertyOrder: [values, reference_time] -... diff --git a/weldx/asdf/tags/__init__.py b/weldx/asdf/tags/__init__.py deleted file mode 100644 index 3f7a4a944..000000000 --- a/weldx/asdf/tags/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import weldx diff --git a/weldx/asdf/tags/weldx/base_types.py b/weldx/asdf/tags/weldx/base_types.py deleted file mode 100644 index 9ac832196..000000000 --- a/weldx/asdf/tags/weldx/base_types.py +++ /dev/null @@ -1,24 +0,0 @@ -"""Module providing ASDF implementations for basic python types.""" -from uuid import UUID - -from weldx.asdf.types import WeldxType - - -# UUID --------------------------------------------------------------------------------- -class UuidTypeASDF(WeldxType): - """Implements a version 4 UUID.""" - - name = "uuid" - version = "1.0.0" - types = [UUID] - requires = ["weldx"] - - @classmethod - def to_tree(cls, node: UUID, ctx): - """convert to python dict""" - return dict(uuid=str(node)) - - @classmethod - def from_tree(cls, tree, ctx): - """Reconstruct form tree.""" - return UUID(tree["uuid"]) diff --git a/weldx/asdf/tags/weldx/core/data_array.py b/weldx/asdf/tags/weldx/core/data_array.py deleted file mode 100644 index 3408ab8c1..000000000 --- a/weldx/asdf/tags/weldx/core/data_array.py +++ /dev/null @@ -1,79 +0,0 @@ -"""Serialization for xarray.DataArray.""" -from xarray import DataArray - -import weldx.asdf.tags.weldx.core.common_types as ct -from weldx.asdf.types import WeldxType - - -class XarrayDataArrayASDF(WeldxType): - """Serialization class for xarray.DataArray.""" - - name = "core/data_array" - version = "1.0.0" - types = [DataArray] - requires = ["weldx"] - handle_dynamic_subclasses = True - - @classmethod - def to_tree(cls, node: DataArray, ctx): - """ - Convert an instance of the 'xarray.DataArray' type into YAML representations. - - Parameters - ---------- - node : - Instance of the 'xarray.DataArray' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'xarray.DataArray' - type to be serialized. - - """ - attributes = node.attrs - coordinates = [ - ct.Variable(name, coord_data.dims, coord_data.data, attrs=coord_data.attrs) - for name, coord_data in node.coords.items() - ] - data = ct.Variable("data", node.dims, node.data, attrs={}) - - tree = { - "attributes": attributes, - "coordinates": coordinates, - "data": data, - } - - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """Convert basic types representing YAML trees into an 'xarray.DataArray'. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - xarray.DataArray : - An instance of the 'xarray.DataArray' type. - - """ - data = tree["data"].data - dims = tree["data"].dimensions - coords = {c.name: (c.dimensions, c.data, c.attrs) for c in tree["coordinates"]} - attrs = tree["attributes"] - - da = DataArray(data=data, coords=coords, dims=dims, attrs=attrs) - da.name = None # we currently do not use the name attribute - # (but since it gets automatically derived if not set, we define it now. - - return da diff --git a/weldx/asdf/tags/weldx/core/dataset.py b/weldx/asdf/tags/weldx/core/dataset.py deleted file mode 100644 index 876ab3710..000000000 --- a/weldx/asdf/tags/weldx/core/dataset.py +++ /dev/null @@ -1,78 +0,0 @@ -from xarray import Dataset - -import weldx.asdf.tags.weldx.core.common_types as ct -from weldx.asdf.types import WeldxType - - -class XarrayDatasetASDF(WeldxType): - """Serialization class for xarray.Dataset""" - - name = "core/dataset" - version = "1.0.0" - types = [Dataset] - requires = ["weldx"] - handle_dynamic_subclasses = True - - @classmethod - def to_tree(cls, node: Dataset, ctx): - """ - Convert an instance of the 'xarray.Dataset' type into YAML representations. - - Parameters - ---------- - node : - Instance of the 'xarray.Dataset' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'xarray.Dataset' type to be - serialized. - - """ - attributes = node.attrs - coordinates = [ - ct.Variable(name, da.dims, da.data, da.attrs) - for name, da in node.coords.items() - ] - dimensions = [ct.Dimension(name, length) for name, length in node.dims.items()] - variables = [ - ct.Variable(name, da.dims, da.data, da.attrs) - for name, da in node.data_vars.items() - ] - - tree = { - "attributes": attributes, - "coordinates": coordinates, - "dimensions": dimensions, - "variables": variables, - } - - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into an 'xarray.Dataset'. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - xarray.Dataset : - An instance of the 'xarray.Dataset' type. - - """ - data_vars = {v.name: (v.dimensions, v.data, v.attrs) for v in tree["variables"]} - coords = {c.name: (c.dimensions, c.data, c.attrs) for c in tree["coordinates"]} - - return Dataset(data_vars=data_vars, coords=coords, attrs=tree["attributes"]) diff --git a/weldx/asdf/tags/weldx/core/mathematical_expression.py b/weldx/asdf/tags/weldx/core/mathematical_expression.py deleted file mode 100644 index 7808d8d37..000000000 --- a/weldx/asdf/tags/weldx/core/mathematical_expression.py +++ /dev/null @@ -1,29 +0,0 @@ -import sympy - -from weldx.asdf.types import WeldxType -from weldx.core import MathematicalExpression - -__all__ = ["MathematicalExpression", "MathematicalExpressionType"] - - -class MathematicalExpressionType(WeldxType): - """Serialization class for sympy style math expressions.""" - - name = "core/mathematical_expression" - version = "1.0.0" - types = [MathematicalExpression] - requires = ["weldx"] - handle_dynamic_subclasses = True - - @classmethod - def to_tree(cls, node: MathematicalExpression, ctx): - """convert to tagged tree and remove all None entries from node dictionary""" - tree = {"expression": node.expression.__str__(), "parameters": node.parameters} - return tree - - @classmethod - def from_tree(cls, tree, ctx): - obj = MathematicalExpression( - sympy.sympify(tree["expression"]), parameters=tree["parameters"] - ) - return obj diff --git a/weldx/asdf/tags/weldx/core/time_series.py b/weldx/asdf/tags/weldx/core/time_series.py deleted file mode 100644 index 1742577d6..000000000 --- a/weldx/asdf/tags/weldx/core/time_series.py +++ /dev/null @@ -1,85 +0,0 @@ -"""Contains the serialization class for the weldx.core.TimeSeries.""" - -import numpy as np -import pint - -from weldx.asdf.types import WeldxType -from weldx.constants import Q_ -from weldx.core import TimeSeries - - -class TimeSeriesTypeASDF(WeldxType): - """Serialization class for weldx.core.TimeSeries""" - - name = "core/time_series" - version = "1.0.0" - types = [TimeSeries] - requires = ["weldx"] - handle_dynamic_subclasses = True - - @classmethod - def to_tree(cls, node: TimeSeries, ctx): - """ - Convert an 'weldx.core.TimeSeries' instance into YAML representations. - - Parameters - ---------- - node : - Instance of the 'weldx.core.TimeSeries' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'weldx.core.TimeSeries' - type to be serialized. - - """ - - if isinstance(node.data, pint.Quantity): - if node.shape == tuple([1]): # constant - return { - "unit": str(node.units), - "value": node.data.magnitude[0], - } - else: - return { - "time": node.time.as_pandas_index(), - "unit": str(node.units), - "shape": node.shape, - "interpolation": node.interpolation, - "values": node.data.magnitude, - } - return {"expression": node.data, "unit": str(node.units), "shape": node.shape} - - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into an 'weldx.core.TimeSeries'. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - weldx.core.TimeSeries : - An instance of the 'weldx.core.TimeSeries' type. - - """ - if "value" in tree: # constant - values = Q_(np.asarray(tree["value"]), tree["unit"]) - return TimeSeries(values) - elif "values" in tree: - time = tree["time"] - interpolation = tree["interpolation"] - values = Q_(tree["values"], tree["unit"]) - return TimeSeries(values, time, interpolation) - - return TimeSeries(tree["expression"]) # mathexpression diff --git a/weldx/asdf/tags/weldx/core/transformations/local_coordinate_system.py b/weldx/asdf/tags/weldx/core/transformations/local_coordinate_system.py deleted file mode 100644 index 9a65efbeb..000000000 --- a/weldx/asdf/tags/weldx/core/transformations/local_coordinate_system.py +++ /dev/null @@ -1,105 +0,0 @@ -import pint - -from weldx.asdf.tags.weldx.core.common_types import Variable -from weldx.asdf.types import WeldxType -from weldx.asdf.validators import wx_shape_validator -from weldx.core import TimeSeries -from weldx.transformations import LocalCoordinateSystem - - -class LocalCoordinateSystemASDF(WeldxType): - """Serialization class for weldx.transformations.LocalCoordinateSystem""" - - name = "core/transformations/local_coordinate_system" - version = "1.0.0" - types = [LocalCoordinateSystem] - requires = ["weldx"] - handle_dynamic_subclasses = True - validators = {"wx_shape": wx_shape_validator} - - @classmethod - def to_tree(cls, node: LocalCoordinateSystem, ctx): - """ - Convert a 'LocalCoordinateSystem' instance into YAML representations. - - Parameters - ---------- - node : - Instance of the 'LocalCoordinateSystem' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'LocalCoordinateSystem' - type to be serialized. - - """ - tree = {} - - orientations = None - if not node.is_unity_rotation: - orientations = Variable( - "orientations", node.orientation.dims, node.orientation.data - ) - if "time" not in node.orientation.coords: - ctx.set_array_storage(orientations.data, "inline") - tree["orientations"] = orientations - - coordinates = None - if isinstance(node.coordinates, TimeSeries): - tree["coordinates"] = node.coordinates - elif not node.is_unity_translation: - coordinates = Variable( - "coordinates", node.coordinates.dims, node.coordinates.data - ) - if "time" not in node.coordinates.coords: - if isinstance(coordinates.data, pint.Quantity): - ctx.set_array_storage(coordinates.data.magnitude, "inline") - else: - ctx.set_array_storage(coordinates.data, "inline") - tree["coordinates"] = coordinates - - if "time" in node.dataset.coords: - tree["time"] = node.time.as_timedelta_index() - - if node.reference_time is not None: - tree["reference_time"] = node.reference_time - - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into a 'LocalCoordinateSystem'. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - LocalCoordinateSystem : - An instance of the 'LocalCoordinateSystem' type. - - """ - orientations = tree.get("orientations") - if orientations is not None: - orientations = orientations.data - - coordinates = tree.get("coordinates") - if coordinates is not None and not isinstance(coordinates, TimeSeries): - coordinates = tree["coordinates"].data - - return LocalCoordinateSystem( - orientation=orientations, - coordinates=coordinates, - time=tree.get("time"), - time_ref=tree.get("reference_time"), - ) diff --git a/weldx/asdf/tags/weldx/core/transformations/rotation.py b/weldx/asdf/tags/weldx/core/transformations/rotation.py deleted file mode 100644 index b6e82873a..000000000 --- a/weldx/asdf/tags/weldx/core/transformations/rotation.py +++ /dev/null @@ -1,102 +0,0 @@ -import numpy as np -from scipy.spatial.transform import Rotation - -from weldx.asdf.types import WeldxType -from weldx.asdf.validators import wx_unit_validator -from weldx.constants import Q_ -from weldx.transformations.rotation import WXRotation - - -class WXRotationTypeASDF(WeldxType): - """Serialization class for the 'Scipy.Rotation' type""" - - name = "core/transformations/rotation" - version = "1.0.0" - types = [Rotation] - requires = ["weldx"] - handle_dynamic_subclasses = True - validators = {"wx_unit": wx_unit_validator} - - @classmethod - def to_tree(cls, node: Rotation, ctx): - """ - Convert an instance of the 'Dimension' type into YAML representations. - - Parameters - ---------- - node : - Instance of the 'Dimension' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'Dimension' type to be - serialized. - - """ - tree = {} - - if not hasattr(node, "wx_meta"): # default to quaternion representation - tree["quaternions"] = node.as_quat() - elif node.wx_meta["constructor"] == "from_quat": - tree["quaternions"] = node.as_quat() - elif node.wx_meta["constructor"] == "from_matrix": - tree["matrix"] = node.as_matrix() - elif node.wx_meta["constructor"] == "from_rotvec": - tree["rotvec"] = node.as_rotvec() - elif node.wx_meta["constructor"] == "from_euler": - seq_str = node.wx_meta["seq"] - if not len(seq_str) == 3: - if all([c in "xyz" for c in seq_str]): - seq_str = seq_str + "".join([c for c in "xyz" if c not in seq_str]) - elif all([c in "XYZ" for c in seq_str]): - seq_str = seq_str + "".join([c for c in "XYZ" if c not in seq_str]) - else: # pragma: no cover - raise ValueError("Mix of intrinsic and extrinsic euler angles.") - - angles = node.as_euler(seq_str, degrees=node.wx_meta["degrees"]) - angles = np.squeeze(angles[..., : len(node.wx_meta["seq"])]) - - if node.wx_meta["degrees"]: - angles = Q_(angles, "degree") - else: - angles = Q_(angles, "rad") - - tree["sequence"] = node.wx_meta["seq"] - tree["angles"] = angles - - else: # pragma: no cover - raise NotImplementedError("unknown or missing constructor") - - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into custom types. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - Dimension : - An instance of the 'Dimension' type. - - """ - if "quaternions" in tree: - return WXRotation.from_quat(tree["quaternions"]) - elif "matrix" in tree: - return WXRotation.from_matrix(tree["matrix"]) - elif "rotvec" in tree: - return WXRotation.from_rotvec(tree["rotvec"]) - elif "angles" in tree: - return WXRotation.from_euler(seq=tree["sequence"], angles=tree["angles"]) diff --git a/weldx/asdf/tags/weldx/debug/__init__.py b/weldx/asdf/tags/weldx/debug/__init__.py deleted file mode 100644 index b8bbdb9bd..000000000 --- a/weldx/asdf/tags/weldx/debug/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import test_property_tag, test_unit_validator diff --git a/weldx/asdf/tags/weldx/debug/test_property_tag.py b/weldx/asdf/tags/weldx/debug/test_property_tag.py deleted file mode 100644 index 02d4c6374..000000000 --- a/weldx/asdf/tags/weldx/debug/test_property_tag.py +++ /dev/null @@ -1,41 +0,0 @@ -from dataclasses import dataclass - -import pandas as pd - -from weldx.asdf.types import WeldxType -from weldx.asdf.validators import wx_property_tag_validator - -__all__ = ["PropertyTagTestClass", "PropertyTagTestClassType"] - - -@dataclass -class PropertyTagTestClass: - """Helper class to test the shape validator""" - - prop1: pd.Timestamp = pd.Timestamp("2020-01-01") - prop2: pd.Timestamp = pd.Timestamp("2020-01-02") - prop3: pd.Timestamp = pd.Timestamp("2020-01-03") - - -class PropertyTagTestClassType(WeldxType): - """Helper class to test the shape validator""" - - name = "debug/test_property_tag" - version = "1.0.0" - types = [PropertyTagTestClass] - requires = ["weldx"] - handle_dynamic_subclasses = True - validators = { - "wx_property_tag": wx_property_tag_validator, - } - - @classmethod - def to_tree(cls, node: PropertyTagTestClass, ctx): - """convert to tagged tree and remove all None entries from node dictionary""" - tree = node.__dict__ - return tree - - @classmethod - def from_tree(cls, tree, ctx): - obj = PropertyTagTestClass(**tree) - return obj diff --git a/weldx/asdf/tags/weldx/groove/iso_9692_1.py b/weldx/asdf/tags/weldx/groove/iso_9692_1.py deleted file mode 100644 index b2a082caa..000000000 --- a/weldx/asdf/tags/weldx/groove/iso_9692_1.py +++ /dev/null @@ -1,53 +0,0 @@ -"""ISO 9692-1 welding groove type definitions""" - - -from asdf.tagged import tag_object - -from weldx.asdf.constants import WELDX_TAG_BASE -from weldx.asdf.types import WeldxType -from weldx.asdf.validators import wx_unit_validator -from weldx.welding.groove.iso_9692_1 import IsoBaseGroove, _groove_name_to_type - -_ISO_GROOVE_SCHEMA = "groove/iso_9692_1_2013_12/" - - -def _get_class_from_tag(instance_tag: str): - groove_tag = instance_tag.rpartition("/iso_9692_1_2013_12/")[-1] - return groove_tag.rpartition("-")[0] - - -class IsoGrooveType(WeldxType): - """ASDF Groove type.""" - - name = [_ISO_GROOVE_SCHEMA + g for g in _groove_name_to_type.keys()] - version = "1.0.0" - types = [IsoBaseGroove] - requires = ["weldx"] - validators = {"wx_unit": wx_unit_validator} - - @classmethod - def to_tree(cls, node: IsoBaseGroove, ctx): - """Convert tree and remove all None entries from node dictionary.""" - tree = node.__dict__ - return tree - - @classmethod - def to_tree_tagged(cls, node: IsoBaseGroove, ctx): - """Serialize tree with custom tag definition.""" - tree = cls.to_tree(node, ctx) - tag = ( - WELDX_TAG_BASE - + "/" - + _ISO_GROOVE_SCHEMA - + type(node).__name__ - + "-" - + str(cls.version) - ) - return tag_object(tag, tree, ctx=ctx) - - @classmethod - def from_tree_tagged(cls, tree, ctx): - """Convert from tagged tree to a groove.""" - groove_name = _get_class_from_tag(tree._tag) - groove = _groove_name_to_type[groove_name](**tree) - return groove diff --git a/weldx/asdf/tags/weldx/measurement/measurement_chain.py b/weldx/asdf/tags/weldx/measurement/measurement_chain.py deleted file mode 100644 index 2851474e9..000000000 --- a/weldx/asdf/tags/weldx/measurement/measurement_chain.py +++ /dev/null @@ -1,25 +0,0 @@ -from weldx.asdf.types import WeldxType -from weldx.measurement import MeasurementChain - -__all__ = [ - "MeasurementChain", - "MeasurementChainType", -] - - -class MeasurementChainType(WeldxType): - """Serialization class for measurement chains""" - - name = "measurement/measurement_chain" - version = "1.0.0" - types = [MeasurementChain] - requires = ["weldx"] - handle_dynamic_subclasses = True - - @classmethod - def to_tree(cls, node: MeasurementChain, ctx): - return node.to_dict() - - @classmethod - def from_tree(cls, tree, ctx) -> MeasurementChain: - return MeasurementChain.from_dict(tree) diff --git a/weldx/asdf/tags/weldx/processes/process.py b/weldx/asdf/tags/weldx/processes/process.py deleted file mode 100644 index 365ec02bd..000000000 --- a/weldx/asdf/tags/weldx/processes/process.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Welding process ASDF classes.""" - -from asdf.tagged import tag_object - -from weldx.asdf.types import WeldxType -from weldx.welding.processes import GmawProcess - - -class GmawProcessTypeAsdf(WeldxType): - """Custom serialization class for GmawProcess.""" - - name = ["process/GMAW", "process/CLOOS/spray_arc", "process/CLOOS/pulse"] - version = "1.0.0" - types = [GmawProcess] - requires = ["weldx"] - - @classmethod - def to_tree(cls, node: GmawProcess, ctx): - """Convert tree and remove all None entries from node dictionary.""" - tree = node.__dict__ - return tree - - @classmethod - def to_tree_tagged(cls, node: GmawProcess, ctx): - """Serialize tree with custom tag definition.""" - tree = cls.to_tree(node, ctx) - tag = "tag:weldx.bam.de:weldx/process/" + tree["tag"] + "-" + str(cls.version) - return tag_object(tag, tree, ctx=ctx) - - @classmethod - def from_tree(cls, tree, ctx): - """Read tree object into dataclass.""" - obj = GmawProcess(**tree) - return obj diff --git a/weldx/asdf/tags/weldx/time/__init__.py b/weldx/asdf/tags/weldx/time/__init__.py deleted file mode 100644 index 79e60c939..000000000 --- a/weldx/asdf/tags/weldx/time/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from .datetimeindex import DatetimeIndexType -from .time import TimeType -from .timedelta import TimedeltaType -from .timedeltaindex import TimedeltaIndexType -from .timestamp import TimestampType - -__all__ = [ - "TimestampType", - "DatetimeIndexType", - "TimedeltaType", - "TimedeltaIndexType", - "TimeType", -] diff --git a/weldx/asdf/tags/weldx/time/datetimeindex.py b/weldx/asdf/tags/weldx/time/datetimeindex.py deleted file mode 100644 index ce840e152..000000000 --- a/weldx/asdf/tags/weldx/time/datetimeindex.py +++ /dev/null @@ -1,55 +0,0 @@ -from typing import List - -import numpy as np -import pandas as pd -from asdf.tagged import TaggedDict - -from weldx.asdf.types import WeldxType - -__all__ = ["DatetimeIndexType"] - - -class DatetimeIndexType(WeldxType): - """A simple implementation of serializing pandas DatetimeIndex.""" - - name = "time/datetimeindex" - version = "1.0.0" - types = [pd.DatetimeIndex] - - @classmethod - def to_tree(cls, node: pd.DatetimeIndex, ctx): - """Serialize DatetimeIndex to tree.""" - tree = {} - if node.inferred_freq is not None: - tree["freq"] = node.inferred_freq - else: - tree["values"] = node.values.astype(np.int64) - - tree["start"] = node[0] - tree["end"] = node[-1] - tree["min"] = node.min() - tree["max"] = node.max() - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """Construct DatetimeIndex from tree.""" - if "freq" in tree: - return pd.date_range( - start=tree["start"], end=tree["end"], freq=tree["freq"] - ) - values = tree["values"] - return pd.DatetimeIndex(values) - - @staticmethod - def shape_from_tagged(tree: TaggedDict) -> List[int]: - """Calculate the shape (length of TDI) from static tagged tree instance.""" - if "freq" in tree: - temp = pd.date_range( - start=tree["start"]["value"], - end=tree["end"]["value"], - freq=tree["freq"], - ) - return [len(temp)] - else: - return tree["values"]["shape"] diff --git a/weldx/asdf/tags/weldx/time/time.py b/weldx/asdf/tags/weldx/time/time.py deleted file mode 100644 index 740a0aa72..000000000 --- a/weldx/asdf/tags/weldx/time/time.py +++ /dev/null @@ -1,25 +0,0 @@ -from weldx.asdf.types import WeldxType -from weldx.time import Time - -__all__ = ["TimeType"] - - -class TimeType(WeldxType): - """A simple implementation of serializing a Time instance.""" - - name = "time/time" - version = "1.0.0" - types = [Time] - - @classmethod - def to_tree(cls, node: Time, ctx): - """Serialize timedelta to tree.""" - tree = dict() - tree["values"] = node.as_pandas() - tree["reference_time"] = node._time_ref - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """Construct Time from tree.""" - return Time(tree["values"], tree.get("reference_time")) diff --git a/weldx/asdf/tags/weldx/time/timedelta.py b/weldx/asdf/tags/weldx/time/timedelta.py deleted file mode 100644 index 4ee0d6e9b..000000000 --- a/weldx/asdf/tags/weldx/time/timedelta.py +++ /dev/null @@ -1,26 +0,0 @@ -import pandas as pd - -from weldx.asdf.types import WeldxType - -__all__ = ["TimedeltaType"] - - -class TimedeltaType(WeldxType): - """A simple implementation of serializing a single pandas Timedelta.""" - - name = "time/timedelta" - version = "1.0.0" - types = [pd.Timedelta] - - @classmethod - def to_tree(cls, node: pd.Timedelta, ctx): - """Serialize timedelta to tree.""" - tree = {} - tree["value"] = node.isoformat() - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """Construct timedelta from tree.""" - value = tree["value"] - return pd.Timedelta(value) diff --git a/weldx/asdf/tags/weldx/time/timedeltaindex.py b/weldx/asdf/tags/weldx/time/timedeltaindex.py deleted file mode 100644 index a6f7b328d..000000000 --- a/weldx/asdf/tags/weldx/time/timedeltaindex.py +++ /dev/null @@ -1,56 +0,0 @@ -from typing import List - -import numpy as np -import pandas as pd -from asdf.tagged import TaggedDict - -from weldx.asdf.types import WeldxType - -__all__ = ["TimedeltaIndexType"] - - -class TimedeltaIndexType(WeldxType): - """A simple implementation of serializing pandas TimedeltaIndex.""" - - name = "time/timedeltaindex" - version = "1.0.0" - types = [pd.TimedeltaIndex] - - @classmethod - def to_tree(cls, node: pd.TimedeltaIndex, ctx): - """Serialize TimedeltaIndex to tree.""" - tree = {} - if node.inferred_freq is not None: - tree["freq"] = node.inferred_freq - else: - tree["values"] = node.values.astype(np.int64) - - tree["start"] = node[0] - tree["end"] = node[-1] - tree["min"] = node.min() - tree["max"] = node.max() - - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """Construct TimedeltaIndex from tree.""" - if "freq" in tree: - return pd.timedelta_range( - start=tree["start"], end=tree["end"], freq=tree["freq"] - ) - values = tree["values"] - return pd.TimedeltaIndex(values) - - @staticmethod - def shape_from_tagged(tree: TaggedDict) -> List[int]: - """Calculate the shape (length of TDI) from static tagged tree instance.""" - if "freq" in tree: - tdi_temp = pd.timedelta_range( - start=tree["start"]["value"], - end=tree["end"]["value"], - freq=tree["freq"], - ) - return [len(tdi_temp)] - else: - return tree["values"]["shape"] diff --git a/weldx/asdf/tags/weldx/time/timestamp.py b/weldx/asdf/tags/weldx/time/timestamp.py deleted file mode 100644 index d4aae89f1..000000000 --- a/weldx/asdf/tags/weldx/time/timestamp.py +++ /dev/null @@ -1,26 +0,0 @@ -import pandas as pd - -from weldx.asdf.types import WeldxType - -__all__ = ["TimestampType"] - - -class TimestampType(WeldxType): - """A simple implementation of serializing a single pandas Timestamp.""" - - name = "time/timestamp" - version = "1.0.0" - types = [pd.Timestamp] - - @classmethod - def to_tree(cls, node: pd.Timestamp, ctx): - """Serialize timestamp to tree.""" - tree = {} - tree["value"] = node.isoformat() - return tree - - @classmethod - def from_tree(cls, tree, ctx): - """Construct timestamp from tree.""" - value = tree["value"] - return pd.Timestamp(value) diff --git a/weldx/asdf/tags/weldx/unit/pint_quantity.py b/weldx/asdf/tags/weldx/unit/pint_quantity.py deleted file mode 100644 index 7b57f78ae..000000000 --- a/weldx/asdf/tags/weldx/unit/pint_quantity.py +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed under a 3-clause BSD style license - see LICENSE -# -*- coding: utf-8 -*- - -import pint - -from weldx.asdf.types import WeldxAsdfType -from weldx.constants import Q_ - -__all__ = ["PintQuantityType"] - - -class PintQuantityType(WeldxAsdfType): - """A simple implementation of serializing a pint quantity as asdf quantity.""" - - name = "unit/quantity" - version = "1.1.0" - types = [pint.Quantity] - - @classmethod - def to_tree(cls, node: pint.Quantity, ctx): - tree = {} - value = node.magnitude - if not value.shape: - value = value.item() # convert scalars to native Python numeric types - tree["value"] = value - tree["unit"] = str(node.units) - return tree - - @classmethod - def from_tree(cls, tree, ctx): - value = tree["value"] - unit = tree["unit"] - quantity = Q_(value, unit) - return quantity diff --git a/weldx/asdf/types.py b/weldx/asdf/types.py index 582ceab7f..2cc0deb07 100644 --- a/weldx/asdf/types.py +++ b/weldx/asdf/types.py @@ -1,103 +1,128 @@ -# Licensed under a 3-clause BSD style license - see LICENSE -# -*- coding: utf-8 -*- - import functools +import re +from copy import copy +from typing import List -from asdf.types import CustomType, ExtensionTypeMeta +from asdf.asdf import SerializationContext +from asdf.extension import Converter +from asdf.versioning import AsdfSpec from boltons.iterutils import remap META_ATTR = "wx_metadata" USER_ATTR = "wx_user" __all__ = [ - "WeldxType", - "WeldxAsdfType", - "_weldx_types", - "_weldx_asdf_types", "META_ATTR", "USER_ATTR", + "WeldxConverter", + "WxSyntaxError", ] -_weldx_types = set() -_weldx_asdf_types = set() +_new_tag_regex = re.compile(r"asdf://weldx.bam.de/weldx/tags/(.*)-(\d+.\d+.\d+|1.\*)") + +class WxSyntaxError(Exception): + """Exception raising on custom weldx ASDF syntax errors.""" -def to_tree_metadata(func): - """Wrapper that will add the metadata and userdata field for to_tree methods. + +def to_yaml_tree_metadata(func): + """Wrapper that will add the metadata and userdata field for ``to_yaml_tree`` methods. Also removes all "None" values from the initial tree. Behavior should be similar to ASDF defaults pre v2.8 (ASDF GH #863). """ @functools.wraps(func) - def to_tree_wrapped(cls, node, ctx): # need cls for classmethod - """Call default to_tree method and add metadata fields.""" - tree = func(node, ctx) - - tree = remap(tree, lambda p, k, v: v is not None) # drop all None values + def to_yaml_tree_wrapped(self, obj, tag, ctx): + """Call default to_yaml_tree method and add metadata fields.""" + tree = func(self, obj, tag, ctx) for key in [META_ATTR, USER_ATTR]: - attr = getattr(node, key, None) + attr = getattr(obj, key, None) if attr: tree[key] = attr + + tree = remap(tree, lambda p, k, v: v is not None) # drop all None values return tree - return to_tree_wrapped + return to_yaml_tree_wrapped -def from_tree_metadata(func): +def from_yaml_tree_metadata(func): """Wrapper that will add reading metadata and userdata during form_tree methods.""" @functools.wraps(func) - def from_tree_wrapped(cls, tree: dict, ctx): # need cls for classmethod - """Call default from_tree method and add metadata attributes.""" + def from_yaml_tree_wrapped(self, tree: dict, tag, ctx): + """Call default from_yaml_tree method and add metadata attributes.""" meta_dict = {} for key in [META_ATTR, USER_ATTR]: value = tree.pop(key, None) if value: meta_dict[key] = value - obj = func(tree, ctx) + obj = func(self, tree, tag, ctx) for key, value in meta_dict.items(): setattr(obj, key, value) return obj - return from_tree_wrapped + return from_yaml_tree_wrapped + +class WeldxConverterMeta(type(Converter)): + """Metaclass to modify tree methods.""" -class WeldxTypeMeta(ExtensionTypeMeta): - """Metaclass to populate _weldx_types and _weldx_asdf_types.""" + def __new__(mcs, name, bases, attrs): + cls = super().__new__(mcs, name, bases, attrs) - def __new__(mcls, name, bases, attrs): - cls = super().__new__(mcls, name, bases, attrs) + # legacy tag definitions + if name := getattr(cls, "name", None): + setattr( + cls, + "tags", + [format_tag(name, "1.*")], + ) - if cls.organization == "weldx.bam.de" and cls.standard == "weldx": - _weldx_types.add(cls) - elif cls.organization == "stsci.edu" and cls.standard == "asdf": - _weldx_asdf_types.add(cls) + # wrap original to/from_yaml_tree method to include metadata attributes + cls.to_yaml_tree = to_yaml_tree_metadata(cls.to_yaml_tree) + cls.from_yaml_tree = from_yaml_tree_metadata(cls.from_yaml_tree) - # wrap original to/from_tree method to include metadata attributes - cls.to_tree = classmethod(to_tree_metadata(cls.to_tree)) - cls.from_tree = classmethod(from_tree_metadata(cls.from_tree)) + for tag in copy(cls.tags): + if tag.startswith("asdf://weldx.bam.de/weldx/tags/"): + cls.tags.append(_legacy_tag_from_new_tag(tag)) return cls -class WeldxType(CustomType, metaclass=WeldxTypeMeta): - """This class represents types that have schemas and tags that are defined - within weldx. +class WeldxConverter(Converter, metaclass=WeldxConverterMeta): + """Base class to inherit from for custom converter classes.""" - """ + tags: List[str] = [] + + def types(self): + raise NotImplementedError - organization = "weldx.bam.de" - standard = "weldx" + def to_yaml_tree(self, obj, tag: str, ctx: SerializationContext): + raise NotImplementedError + def from_yaml_tree(self, node: dict, tag: str, ctx: SerializationContext): + raise NotImplementedError -class WeldxAsdfType(CustomType, metaclass=WeldxTypeMeta): - """This class represents types that have schemas that are defined in the ASDF - standard, but have tags that are implemented within weldx. +def format_tag(tag_name, version=None, organization="weldx.bam.de", standard="weldx"): """ + Format a YAML tag to new style asdf:// syntax. + """ + tag = "asdf://{0}/{1}/tags/{2}".format(organization, standard, tag_name) + + if version is None: + return tag + + if isinstance(version, AsdfSpec): + version = str(version.spec) + + return "{0}-{1}".format(tag, version) + - organization = "stsci.edu" - standard = "asdf" +def _legacy_tag_from_new_tag(tag: str): + name, version = _new_tag_regex.search(tag).groups() + return f"tag:weldx.bam.de:weldx/{name}-{version}" diff --git a/weldx/asdf/util.py b/weldx/asdf/util.py index e81bf82fc..240c9077c 100644 --- a/weldx/asdf/util.py +++ b/weldx/asdf/util.py @@ -1,15 +1,15 @@ """Utilities for asdf files.""" from io import BytesIO from pathlib import Path -from typing import Callable, Tuple, Type, Union +from typing import Any, Callable, Dict, List, Tuple, Type, Union from warnings import warn import asdf +from asdf.asdf import SerializationContext +from asdf.tagged import TaggedDict +from asdf.util import uri_match as asdf_uri_match from boltons.iterutils import get_path -from weldx.asdf.constants import SCHEMA_PATH -from weldx.asdf.extension import WeldxAsdfExtension, WeldxExtension -from weldx.asdf.types import WeldxType from weldx.types import ( SupportsFileReadOnly, SupportsFileReadWrite, @@ -19,6 +19,9 @@ ) from weldx.util import deprecated +from .constants import SCHEMA_PATH, WELDX_EXTENSION_URI +from .types import WeldxConverter + __all__ = [ "get_schema_path", "read_buffer", @@ -46,7 +49,7 @@ def get_schema_path(schema: str) -> Path: # pragma: no cover """ schema = schema.split(".yaml")[0] - p = Path(SCHEMA_PATH) + p = SCHEMA_PATH schemas = list(p.glob(f"**/{schema}.yaml")) if len(schemas) == 0: raise ValueError(f"No matching schema for filename '{schema}'.") @@ -85,9 +88,7 @@ def write_buffer( write_kwargs = {} buff = BytesIO() - with asdf.AsdfFile( - tree, extensions=[WeldxExtension(), WeldxAsdfExtension()], **asdffile_kwargs - ) as ff: + with asdf.AsdfFile(tree, extensions=None, **asdffile_kwargs) as ff: ff.write_to(buff, **write_kwargs) buff.seek(0) return buff @@ -116,7 +117,7 @@ def read_buffer(buffer: BytesIO, open_kwargs: dict = None): buffer.seek(0) with asdf.open( buffer, - extensions=[WeldxExtension(), WeldxAsdfExtension()], + extensions=None, **open_kwargs, ) as af: data = af.tree @@ -292,13 +293,24 @@ def asdf_json_repr(file: Union[str, Path, BytesIO], path: Tuple = None, **kwargs return view_tree(file, path, **kwargs) +def _fullname(obj): + """Get the fully qualified class name of an object.""" + if isinstance(obj, str): + return obj + + cls = obj.__class__ + module = cls.__module__ + if module == "builtins": # no need for builtin prefix + return cls.__qualname__ + return module + "." + cls.__qualname__ + + def dataclass_serialization_class( class_type: Type, class_name: str, version: str, - to_tree_mod: Callable = None, - from_tree_mod: Callable = None, - validators: dict = None, + to_yaml_tree_mod: Callable = None, + from_yaml_tree_mod: Callable = None, sort_string_lists: bool = True, ) -> Type: """Generate a asdf serialization class for a python dataclass. @@ -311,14 +323,14 @@ def dataclass_serialization_class( The value that should ba stored as the classes name property version : The version number - to_tree_mod : + to_yaml_tree_mod : A method that applies additional modifications to the tree during the - ``to_tree`` function call - from_tree_mod : + ``to_yaml_tree`` function call + from_yaml_tree_mod : A method that applies additional modifications to the tree during the - ``from_tree`` function call - validators : - Dict of validator keys and instances. + ``from_yaml_tree`` function call + sort_string_lists : + Sort string lists before serialization. Returns ------- @@ -327,43 +339,94 @@ def dataclass_serialization_class( """ v = version - if validators is None: - validators = {} - vals = validators def _noop(tree): return tree - if to_tree_mod is None: - to_tree_mod = _noop - if from_tree_mod is None: - from_tree_mod = _noop + if to_yaml_tree_mod is None: + to_yaml_tree_mod = _noop + if from_yaml_tree_mod is None: + from_yaml_tree_mod = _noop if sort_string_lists: - original_to_tree_mod = to_tree_mod + original_to_yaml_tree_mod = to_yaml_tree_mod def _sort_string_list(tree): for k, v in tree.items(): if isinstance(v, list) and all(isinstance(item, str) for item in v): tree[k] = sorted(v) - return original_to_tree_mod(tree) + return original_to_yaml_tree_mod(tree) - to_tree_mod = _sort_string_list + to_yaml_tree_mod = _sort_string_list - class _SerializationClass(WeldxType): + class _SerializationClass(WeldxConverter): name = class_name version = v types = [class_type] - requires = ["weldx"] - handle_dynamic_subclasses = True - validators = vals + __module__ = class_type.__module__ + __qualname__ = class_type.__qualname__ + "Converter" - @classmethod - def to_tree(cls, node, ctx): - return to_tree_mod(node.__dict__) + def to_yaml_tree( + self, obj: class_type, tag: str, ctx: SerializationContext + ) -> dict: + """Convert to python dict.""" + return to_yaml_tree_mod(obj.__dict__) - @classmethod - def from_tree(cls, tree, ctx): - return class_type(**from_tree_mod(tree)) + def from_yaml_tree( + self, node: dict, tag: str, ctx: SerializationContext + ) -> class_type: + """Reconstruct from yaml node.""" + return class_type(**from_yaml_tree_mod(node)) return _SerializationClass + + +def get_weldx_extension(ctx: asdf.asdf.SerializationContext): + """Grab the weldx extension from list of current active extensions.""" + extensions = [ + ext + for ext in ctx.extension_manager.extensions + if str(ext.extension_uri) == WELDX_EXTENSION_URI + ] + if not len(extensions) == 1: + raise ValueError("Could not determine correct weldx extension.") + return extensions[0] + + +def uri_match(patterns: Union[str, List[str]], uri: str) -> bool: + """Returns `True` if the ASDF URI matches any of the listed patterns. + + See Also + -------- + asdf.util.uri_match + + """ + if isinstance(patterns, str): + return asdf_uri_match(patterns, uri) + return any(asdf_uri_match(p, uri) for p in patterns) + + +def get_converter_for_tag(tag: str) -> Union[type, None]: + """Get the converter class that handles a given tag.""" + converters = [s for s in WeldxConverter.__subclasses__() if uri_match(s.tags, tag)] + if len(converters) > 1: + warn(f"Found more than one converter class for {tag=}", UserWarning) + if converters: + return converters[0] + return None + + +def _get_instance_shape( + instance_dict: Union[TaggedDict, Dict[str, Any]] +) -> Union[List[int], None]: + """Get the shape of an ASDF instance from its tagged dict form.""" + if isinstance(instance_dict, (float, int)): # test against [1] for scalar values + return [1] + elif "shape" in instance_dict: + return instance_dict["shape"] + elif isinstance(instance_dict, asdf.types.tagged.Tagged): + # try calling shape_from_tagged for custom types + converter = get_converter_for_tag(instance_dict._tag) + if hasattr(converter, "shape_from_tagged"): + return converter.shape_from_tagged(instance_dict) + return None diff --git a/weldx/asdf/validators.py b/weldx/asdf/validators.py index 01ab81340..ddc5bc723 100644 --- a/weldx/asdf/validators.py +++ b/weldx/asdf/validators.py @@ -1,18 +1,18 @@ import re -from typing import Any, Callable, Dict, Iterator, List, Mapping, OrderedDict, Union +from typing import Any, Callable, Dict, Iterator, List, Mapping, OrderedDict -import asdf from asdf import ValidationError from asdf.schema import _type_to_tag -from asdf.tagged import TaggedDict from asdf.util import uri_match -from weldx.asdf.extension import WxSyntaxError -from weldx.asdf.tags.weldx.time.datetimeindex import DatetimeIndexType -from weldx.asdf.tags.weldx.time.timedeltaindex import TimedeltaIndexType from weldx.constants import Q_ from weldx.constants import WELDX_UNIT_REGISTRY as UREG +from .types import WxSyntaxError +from .util import _get_instance_shape + +__all__ = ["wx_unit_validator", "wx_shape_validator", "wx_property_tag_validator"] + def _walk_validator( instance: OrderedDict, @@ -363,30 +363,6 @@ def _compare_lists(_list, list_expected): return dict_values -def _get_instance_shape(instance_dict: Union[TaggedDict, Dict[str, Any]]) -> List[int]: - """Get the shape of an ASDF instance from its tagged dict form.""" - if isinstance(instance_dict, (float, int)): # test against [1] for scalar values - return [1] - elif "shape" in instance_dict: - return instance_dict["shape"] - elif isinstance(instance_dict, asdf.types.tagged.Tagged): - # add custom type implementations - if "weldx/time/timedeltaindex" in instance_dict._tag: - return TimedeltaIndexType.shape_from_tagged(instance_dict) - elif "weldx/time/datetimeindex" in instance_dict._tag: - return DatetimeIndexType.shape_from_tagged(instance_dict) - elif "weldx/core/time_series" in instance_dict._tag: - return [1] # scalar - elif "asdf/unit/quantity" in instance_dict._tag: - if isinstance(instance_dict["value"], dict): # ndarray - return _get_instance_shape(instance_dict["value"]) - return [1] # scalar - elif "weldx/core/variable" in instance_dict._tag: - return _get_instance_shape(instance_dict["data"]) - - return None - - def _custom_shape_validator(dict_test: Dict[str, Any], dict_expected: Dict[str, Any]): """Validate dimensions which are stored in two dictionaries dict_test and dict_expected. diff --git a/weldx/manifests/weldx-1.0.0.yaml b/weldx/manifests/weldx-1.0.0.yaml new file mode 100644 index 000000000..293317dd2 --- /dev/null +++ b/weldx/manifests/weldx-1.0.0.yaml @@ -0,0 +1,242 @@ +%YAML 1.1 +--- +id: asdf://weldx.bam.de/weldx/manifests/weldx-1.0.0 +extension_uri: asdf://weldx.bam.de/weldx/extensions/weldx-1.0.0 +title: weldx extension manifest for tag mapping +description: Manifest listing all tag URIs with schema URIs supported by weldx +tags: +- tag_uri: tag:stsci.edu:asdf/unit/quantity-1.1.0 + schema_uri: http://stsci.edu/schemas/asdf/unit/quantity-1.1.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/uuid-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/uuid-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/uuid-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/uuid-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/design/base_metal-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/base_metal-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/design/base_metal-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/base_metal-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/design/connection-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/connection-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/design/connection-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/connection-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/design/joint_penetration-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/joint_penetration-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/design/joint_penetration-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/joint_penetration-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/design/sub_assembly-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/sub_assembly-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/design/sub_assembly-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/sub_assembly-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/design/weldment-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/weldment-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/design/weldment-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/weldment-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/design/weld_details-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/weld_details-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/design/weld_details-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/weld_details-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/design/workpiece-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/workpiece-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/design/workpiece-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/design/workpiece-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/process/arc_welding_process-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/arc_welding_process-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/process/arc_welding_process-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/arc_welding_process-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/process/gas_component-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/gas_component-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/process/gas_component-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/gas_component-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/process/shielding_gas_for_procedure-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/shielding_gas_for_procedure-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/process/shielding_gas_for_procedure-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/shielding_gas_for_procedure-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/aws/process/shielding_gas_type-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/shielding_gas_type-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/aws/process/shielding_gas_type-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/aws/process/shielding_gas_type-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/dataset-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/dataset-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/dataset-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/dataset-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/data_array-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/data_array-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/data_array-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/data_array-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/dimension-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/dimension-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/dimension-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/dimension-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/file-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/file-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/file-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/file-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/mathematical_expression-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/mathematical_expression-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/mathematical_expression-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/mathematical_expression-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/time_series-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/time_series-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/time_series-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/time_series-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/variable-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/variable-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/variable-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/variable-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/geometry/spatial_data-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/geometry/spatial_data-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/geometry/spatial_data-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/geometry/spatial_data-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/graph/di_edge-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/graph/di_edge-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/graph/di_edge-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/graph/di_edge-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/graph/di_graph-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/graph/di_graph-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/graph/di_graph-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/graph/di_graph-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/graph/di_node-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/graph/di_node-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/graph/di_node-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/graph/di_node-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/transformations/coordinate_system_hierarchy-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_system_hierarchy-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/transformations/coordinate_system_hierarchy-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_system_hierarchy-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/transformations/coordinate_system_hierarchy_subsystem-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_system_hierarchy_subsystem-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/transformations/coordinate_system_hierarchy_subsystem-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_system_hierarchy_subsystem-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/transformations/coordinate_transformation-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_transformation-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/transformations/coordinate_transformation-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_transformation-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/local_coordinate_system-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/transformations/local_coordinate_system-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/local_coordinate_system-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/core/transformations/rotation-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/rotation-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/core/transformations/rotation-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/core/transformations/rotation-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/debug/test_property_tag-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/debug/test_property_tag-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/debug/test_property_tag-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/debug/test_property_tag-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/debug/test_shape_validator-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/debug/test_shape_validator-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/debug/test_shape_validator-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/debug/test_shape_validator-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/debug/test_unit_validator-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/debug/test_unit_validator-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/debug/test_unit_validator-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/debug/test_unit_validator-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/equipment/measurement_equipment-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/DHUGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DHUGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DHUGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/DHVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DHVGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DHVGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/DUGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DUGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DUGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/DVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DVGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DVGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/FFGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/FFGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/FFGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/HUGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/HUGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/HUGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/HVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/HVGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/HVGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/IGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/IGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/IGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/UGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/UGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/UGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/UVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/UVGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/UVGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/VGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/VGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/VGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/VVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/VVGroove-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/VVGroove-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/measurement/error-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/error-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/measurement/error-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/error-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/measurement/measurement-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/measurement-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/measurement/measurement-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/measurement-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/measurement/measurement_chain-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/measurement_chain-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/measurement/measurement_chain-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/measurement_chain-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/measurement/signal-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/signal-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/measurement/signal-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/signal-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/measurement/signal_transformation-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/signal_transformation-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/measurement/signal_transformation-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/signal_transformation-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/measurement/source-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/source-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/measurement/source-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/measurement/source-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/process/GMAW-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/process/GMAW-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/process/GMAW-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/process/GMAW-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/process/CLOOS/pulse-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/process/CLOOS/pulse-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/process/CLOOS/pulse-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/process/CLOOS/pulse-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/process/CLOOS/spray_arc-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/process/CLOOS/spray_arc-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/process/CLOOS/spray_arc-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/process/CLOOS/spray_arc-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/time/datetimeindex-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/datetimeindex-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/time/datetimeindex-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/datetimeindex-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/time/time-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/time-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/time/time-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/time-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/time/timedelta-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/timedelta-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/time/timedelta-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/timedelta-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/timedeltaindex-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/time/timedeltaindex-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/timedeltaindex-1.0.0 +- tag_uri: asdf://weldx.bam.de/weldx/tags/time/timestamp-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/timestamp-1.0.0 +- tag_uri: tag:weldx.bam.de:weldx/time/timestamp-1.0.0 + schema_uri: asdf://weldx.bam.de/weldx/schemas/time/timestamp-1.0.0 +... diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/base_metal-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/design/base_metal-1.0.0.yaml similarity index 95% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/base_metal-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/design/base_metal-1.0.0.yaml index 6efecb036..05a7c25e8 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/base_metal-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/design/base_metal-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/design/base_metal-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/design/base_metal-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/design/base_metal-1.0.0" title: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/connection-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/design/connection-1.0.0.yaml similarity index 92% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/connection-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/design/connection-1.0.0.yaml index 691fd5e1a..3529facde 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/connection-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/design/connection-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/design/connection-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/design/connection-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/design/connection-1.0.0" title: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/joint_penetration-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/design/joint_penetration-1.0.0.yaml similarity index 92% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/joint_penetration-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/design/joint_penetration-1.0.0.yaml index 91ec66a9f..f41b9f764 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/joint_penetration-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/design/joint_penetration-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/design/joint_penetration-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/design/joint_penetration-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/design/joint_penetration-1.0.0" title: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/sub_assembly-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/design/sub_assembly-1.0.0.yaml similarity index 84% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/sub_assembly-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/design/sub_assembly-1.0.0.yaml index eab753150..d4cac342a 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/sub_assembly-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/design/sub_assembly-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/design/sub_assembly-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/design/sub_assembly-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/design/sub_assembly-1.0.0" title: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/weld_details-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/design/weld_details-1.0.0.yaml similarity index 76% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/weld_details-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/design/weld_details-1.0.0.yaml index f73809e37..ae3427222 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/weld_details-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/design/weld_details-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/design/weld_details-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/design/weld_details-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/design/weld_details-1.0.0" title: | @@ -14,8 +13,8 @@ properties: description: | AWS 3.0, p. 19 : "Detailed Description of mating configuration of two components, sufficient information for shop preparation of the components." TODO CLASS oneOf: - - tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0" - - tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0" + - tag: "asdf://weldx.bam.de/weldx/tags/groove/**-1.*" + - tag: "tag:weldx.bam.de:weldx/groove/**-1.*" # legacy_tag weld_sizes: description: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/weldment-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/design/weldment-1.0.0.yaml similarity index 77% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/weldment-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/design/weldment-1.0.0.yaml index f63a5d88f..4d3818809 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/weldment-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/design/weldment-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/design/weldment-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/design/weldment-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/design/weldment-1.0.0" title: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/workpiece-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/design/workpiece-1.0.0.yaml similarity index 84% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/workpiece-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/design/workpiece-1.0.0.yaml index 86180e4c4..3b98f3484 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/design/workpiece-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/design/workpiece-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/design/workpiece-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/design/workpiece-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/design/workpiece-1.0.0" title: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/arc_welding_process-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/process/arc_welding_process-1.0.0.yaml similarity index 89% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/arc_welding_process-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/process/arc_welding_process-1.0.0.yaml index 2ef2c72ce..4793c734f 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/arc_welding_process-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/process/arc_welding_process-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/process/arc_welding_process-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/process/arc_welding_process-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/process/arc_welding_process-1.0.0" title: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/gas_component-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/process/gas_component-1.0.0.yaml similarity index 82% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/gas_component-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/process/gas_component-1.0.0.yaml index 0018f0ac0..05806b2de 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/gas_component-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/process/gas_component-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/process/gas_component-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/process/gas_component-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/process/gas_component-1.0.0" title: | Shielding gas component @@ -13,7 +12,7 @@ examples: - - A single argon gas component - | - ! + ! gas_chemical_name: argon gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 82} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_for_procedure-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_for_procedure-1.0.0.yaml similarity index 83% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_for_procedure-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_for_procedure-1.0.0.yaml index 447cccda7..31d7ad306 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_for_procedure-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_for_procedure-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/process/shielding_gas_for_procedure-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/process/shielding_gas_for_procedure-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/process/shielding_gas_for_procedure-1.0.0" title: | GMAW process shielding gas @@ -13,14 +12,14 @@ examples: - - A shielding gas mixture of 82% argon and 18% CO2 with 20 l/min flowrate. - | - ! + ! use_torch_shielding_gas: true - torch_shielding_gas: ! + torch_shielding_gas: ! gas_component: - - ! + - ! gas_chemical_name: argon gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 82} - - ! + - ! gas_chemical_name: carbon dioxide gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 18} common_name: SG diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_type-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_type-1.0.0.yaml similarity index 75% rename from weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_type-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_type-1.0.0.yaml index ea3708e3d..7a25bc06b 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_type-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/aws/process/shielding_gas_type-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/aws/process/shielding_gas_type-1.0.0" -tag: "tag:weldx.bam.de:weldx/aws/process/shielding_gas_type-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/aws/process/shielding_gas_type-1.0.0" title: | GMAW shielding gas @@ -14,12 +13,12 @@ examples: - - A shielding gas mixture of 82% argon and 18% CO2. - | - ! + ! gas_component: - - ! + - ! gas_chemical_name: argon gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 82} - - ! + - ! gas_chemical_name: carbon dioxide gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 18} common_name: SG diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/data_array-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/data_array-1.0.0.yaml similarity index 69% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/data_array-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/data_array-1.0.0.yaml index 55d85b2e5..2ea02e1ee 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/data_array-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/data_array-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/data_array-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/data_array-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/data_array-1.0.0" title: | Schema that describes a data_array @@ -21,11 +20,15 @@ properties: An array of variables that represent coordinates. type: array items: - tag: "tag:weldx.bam.de:weldx/core/variable-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/variable-1.*" + - tag: "tag:weldx.bam.de:weldx/core/variable-1.*" # legacy_tag data: description: | The actual data. - tag: "tag:weldx.bam.de:weldx/core/variable-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/variable-1.*" + - tag: "tag:weldx.bam.de:weldx/core/variable-1.*" # legacy_tag required: [attributes, coordinates, data] propertyOrder: [attributes, coordinates, data] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/dataset-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/dataset-1.0.0.yaml similarity index 65% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/dataset-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/dataset-1.0.0.yaml index 73b139ca4..4671c8a8a 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/dataset-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/dataset-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/dataset-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/dataset-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/dataset-1.0.0" title: | Schema that describes a dataset @@ -21,19 +20,25 @@ properties: An array of dimensions. type: array items: - tag: "tag:weldx.bam.de:weldx/core/dimension-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/dimension-1.*" + - tag: "tag:weldx.bam.de:weldx/core/dimension-1.*" # legacy_tag coordinates: description: | An array of variables that represent coordinates. type: array items: - tag: "tag:weldx.bam.de:weldx/core/variable-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/variable-1.*" + - tag: "tag:weldx.bam.de:weldx/core/variable-1.*" # legacy_tag variables: description: | An array of variables. type: array items: - tag: "tag:weldx.bam.de:weldx/core/variable-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/variable-1.*" + - tag: "tag:weldx.bam.de:weldx/core/variable-1.*" # legacy_tag required: [dimensions, coordinates, variables] propertyOrder: [attributes, dimensions, coordinates, variables] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/dimension-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/dimension-1.0.0.yaml similarity index 83% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/dimension-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/dimension-1.0.0.yaml index 98075c4ce..ad23ecd7c 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/dimension-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/dimension-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/dimension-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/dimension-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/dimension-1.0.0" title: | Schema that describes a dimension diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/file-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/file-1.0.0.yaml similarity index 75% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/file-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/file-1.0.0.yaml index 51149d392..04d02e709 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/file-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/file-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/weldx/core/file-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/file-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/file-1.0.0" title: | Schema for a file. @@ -14,14 +13,14 @@ examples: - - Full description of a pdf-file without its content - | - ! + ! filename: file.pdf suffix: pdf hostname: my_computer directory: C:/Users/some_user/my_files size: 90571 - created: ! {value: '2020-12-09T12:51:20.653744500'} - modified: ! {value: '2020-12-10T13:14:17.362481500'} + created: ! {value: '2020-12-09T12:51:20.653744500'} + modified: ! {value: '2020-12-10T13:14:17.362481500'} content_hash: {algorithm: SHA-256, value: 5a6270ea5e2662c6489ee9e9c2201645e1b3cdadf0e3a621cca213a29ff4ae32} type: object @@ -41,11 +40,15 @@ properties: created: description: | The timestamp when the file was created. - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/time/timestamp-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" # legacy_tag modified: description: | The timestamp when the file was modified last. - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/time/timestamp-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" # legacy_tag hostname: description: | The name of the host machine accessing the file. diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0.yaml similarity index 88% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0.yaml index c6e78bf71..527705320 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/weldx/core/geometry/spatial_data-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/geometry/spatial_data-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/geometry/spatial_data-1.0.0" title: | Schema for a point cloud. @@ -13,7 +12,7 @@ examples: - - A simple `SpatialData` with triangulation - | - ! + ! coordinates: !core/ndarray-1.0.0 data: - [0.0, 0.0, 0.0] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_edge-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/graph/di_edge-1.0.0.yaml similarity index 50% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_edge-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/graph/di_edge-1.0.0.yaml index ac8db13a7..b662dffe8 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_edge-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/graph/di_edge-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/graph/di_edge-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/graph/di_edge-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/graph/di_edge-1.0.0" title: | Graph edge. @@ -13,16 +12,16 @@ examples: - - An edge pointing to node A. - | - ! + ! direction: fwd - target_node: ! + target_node: ! name: A - - An edge pointing from node B. - | - ! + ! direction: bwd - target_node: ! + target_node: ! name: B type: object @@ -31,7 +30,9 @@ properties: type: string enum: [fwd, bwd] target_node: - tag: "tag:weldx.bam.de:weldx/core/graph/di_node-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/graph/di_node-1.*" + - tag: "tag:weldx.bam.de:weldx/core/graph/di_node-1.*" # legacy_tag attributes: type: object diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_graph-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/graph/di_graph-1.0.0.yaml similarity index 52% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_graph-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/graph/di_graph-1.0.0.yaml index 5cc554115..27dcf71dc 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_graph-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/graph/di_graph-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/graph/di_graph-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/graph/di_graph-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/graph/di_graph-1.0.0" title: | Directed Graph. @@ -16,35 +15,35 @@ examples: - - A directed graph with two branches - | - ! - root_node: ! + ! + root_node: ! name: A attributes: {node_attr: 3.14} edges: - - ! + - ! direction: fwd attributes: {edge_attr: 42} - target_node: ! + target_node: ! name: B attributes: {node_attr: 3.14} edges: - - ! + - ! direction: fwd attributes: {edge_attr: 42} - target_node: ! + target_node: ! name: H attributes: {node_attr: 3.14} - - ! + - ! direction: fwd attributes: {edge_attr: 42} - target_node: ! + target_node: ! name: C attributes: {node_attr: 3.14} edges: - - ! + - ! direction: bwd attributes: {edge_attr: 42} - target_node: ! + target_node: ! name: D attributes: {node_attr: 3.14} @@ -52,7 +51,9 @@ examples: type: object properties: root_node: - tag: "tag:weldx.bam.de:weldx/core/graph/di_node-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/graph/di_node-1.*" + - tag: "tag:weldx.bam.de:weldx/core/graph/di_node-1.*" # legacy_tag required: [root_node] ... diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_node-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/graph/di_node-1.0.0.yaml similarity index 50% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_node-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/graph/di_node-1.0.0.yaml index 1377b5c50..9fe601393 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/graph/di_node-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/graph/di_node-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/graph/di_node-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/graph/di_node-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/graph/di_node-1.0.0" title: | Node of a directed graph. @@ -11,23 +10,23 @@ examples: - - A simple node without any child edges. - | - ! + ! name: A - - A simple node without any child edges and a simple attribute. - | - ! + ! name: A attributes: {node_attr: 3.14} - - A node with one child node. - | - ! + ! name: A edges: - - ! + - ! direction: fwd - target_node: ! + target_node: ! name: B type: object @@ -35,11 +34,13 @@ properties: name: oneOf: - type: string - - tag: "tag:weldx.bam.de:weldx/uuid-1.0.0" + - tag: "asdf://weldx.bam.de/weldx/tags/uuid-1.0.0" edges: type: array items: - tag: "tag:weldx.bam.de:weldx/core/graph/di_edge-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/graph/di_edge-1.*" + - tag: "tag:weldx.bam.de:weldx/core/graph/di_edge-1.*" # legacy_tag attributes: type: object diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/mathematical_expression-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/mathematical_expression-1.0.0.yaml similarity index 84% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/mathematical_expression-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/mathematical_expression-1.0.0.yaml index 1fb4ac9d7..cc3faa5ca 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/mathematical_expression-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/mathematical_expression-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/mathematical_expression-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/mathematical_expression-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/mathematical_expression-1.0.0" title: | Schema that describes a mathematical_expression. @@ -16,7 +15,7 @@ examples: - - A linear mathematical expression - | - ! + ! expression: a*x + b parameters: a: !unit/quantity-1.1.0 {unit: volt, value: 1.2} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/time_series-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/time_series-1.0.0.yaml similarity index 81% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/time_series-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/time_series-1.0.0.yaml index 46c569bd3..362bcc3de 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/time_series-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/time_series-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/weldx/core/time_series-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/time_series-1.0.0" title: | Schema that describes a time series. @@ -13,14 +12,14 @@ examples: - - A time_series describing a constant value in time. - | - ! + ! unit: millimeter / second value: 10.0 - - A time_series describing a sine oscillation in 3d space along the z-axis - | - ! - expression: ! + ! + expression: ! expression: a*sin(o*t + p) + b parameters: a: !unit/quantity-1.1.0 @@ -61,7 +60,9 @@ oneOf: expression: description: | A mathematical expression that describes the time dependent behaviour. - tag: "tag:weldx.bam.de:weldx/core/mathematical_expression-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/mathematical_expression-1.*" + - tag: "tag:weldx.bam.de:weldx/core/mathematical_expression-1.*" # legacy_tag unit: description: | Resulting unit of the data when the expression is evaluated. @@ -79,7 +80,9 @@ oneOf: time: description: | A set of time deltas. - tag: "tag:weldx.bam.de:weldx/time/timedeltaindex-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timedeltaindex-1.*" # legacy_tag unit: description: | Unit of the data. diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy-1.0.0.yaml similarity index 58% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy-1.0.0.yaml index 5413e6f8b..d4711213e 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/transformations/coordinate_system_hierarchy-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/transformations/coordinate_system_hierarchy-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/transformations/coordinate_system_hierarchy-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_system_hierarchy-1.0.0" title: | Schema that describes a local coordinate system hierarchy @@ -15,29 +14,29 @@ examples: - - A CSM with two static transformations and no subsystems. - | - ! + ! name: Coordinate system manager 0 root_system_name: base subsystems: [] coordinate_systems: - - ! + - ! name: workpiece reference_system: base - transformation: ! {} - - ! + transformation: ! {} + - ! name: tcp_wire reference_system: workpiece - transformation: ! - time: ! + transformation: ! + time: ! values: !core/ndarray-1.0.0 data: [0, 29000000000] datatype: int64 shape: [2] - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M29S} - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M29S} - orientations: ! + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M29S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M29S} + orientations: ! name: orientations dimensions: [c, v] dtype: + coordinates: ! name: coordinates dimensions: [time, c] dtype: + ! name: Subsystem T parent_system: Base CSM root_cs: workpiece @@ -35,7 +34,9 @@ properties: reference_time: description: | A timestamp that serves as reference point for all attached coordinate systems. - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/time/timestamp-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" # legacy_tag root_cs: description: | diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/transformations/coordinate_transformation-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/transformations/coordinate_transformation-1.0.0.yaml similarity index 62% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/transformations/coordinate_transformation-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/transformations/coordinate_transformation-1.0.0.yaml index eeda8a4a9..fa5977de1 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/transformations/coordinate_transformation-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/transformations/coordinate_transformation-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/transformations/coordinate_transformation-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/transformations/coordinate_transformation-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/transformations/coordinate_transformation-1.0.0" title: | Schema that describes the transformation between 2 coordinate systems. @@ -13,20 +12,20 @@ examples: - - A uniform coordinate transformation between a "base" and a "workpiece" system. - | - ! + ! name: workpiece reference_system: base - transformation: ! {} + transformation: ! {} - - | A coordinate transformation describing a constant offset of -10 mm in z-direction between the "tcp_wire" and "tcp_contact" systems - | - ! + ! name: tcp_contact reference_system: tcp_wire - transformation: ! - coordinates: ! + transformation: ! + coordinates: ! name: coordinates dimensions: [c] dtype: - coordinates: ! + ! + coordinates: ! name: coordinates dimensions: [c] dtype: - time: ! + ! + time: ! values: !core/ndarray-1.0.0 data: [0, 20000000000] datatype: int64 shape: [2] - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M20S} - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M20S} - coordinates: ! + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M20S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M20S} + coordinates: ! name: coordinates dimensions: [time, c] dtype: - orientations: ! + ! + orientations: ! name: orientations dimensions: [c, v] dtype: - time: ! + ! + time: ! values: !core/ndarray-1.0.0 data: [0, 20000000000] datatype: int64 shape: [2] - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M20S} - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M20S} - orientations: ! + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M20S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M20S} + orientations: ! name: orientations dimensions: [time, c, v] dtype: + ! angles: !unit/quantity-1.1.0 unit: degree value: !core/ndarray-1.0.0 @@ -24,7 +23,7 @@ examples: - - The quaternion rotation representation - | - ! + ! quaternions: !core/ndarray-1.0.0 data: [-0.012161306594124677, 0.19272730326230897, 0.4774233251326969, 0.8571903276509837] datatype: float64 @@ -32,7 +31,7 @@ examples: - - The matrix rotation representation. - | - ! + ! matrix: !core/ndarray-1.0.0 data: - [0.46984631039295427, -0.8231729446455007, 0.3187957775971679] @@ -43,7 +42,7 @@ examples: - - The rotation vector representation. - | - ! + ! rotvec: !core/ndarray-1.0.0 data: [-0.02555091083053722, 0.404920154109444, 1.0030666289407963] datatype: float64 diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/core/variable-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/core/variable-1.0.0.yaml similarity index 92% rename from weldx/asdf/schemas/weldx.bam.de/weldx/core/variable-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/core/variable-1.0.0.yaml index ed0093fda..98196fda2 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/core/variable-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/core/variable-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/core/variable-1.0.0" -tag: "tag:weldx.bam.de:weldx/core/variable-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/core/variable-1.0.0" title: | Schema that describes a variable. diff --git a/weldx/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.yaml new file mode 100644 index 000000000..7698d911b --- /dev/null +++ b/weldx/schemas/weldx.bam.de/weldx/datamodels/single_pass_weld-1.0.0.yaml @@ -0,0 +1,501 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "asdf://weldx.bam.de/weldx/schemas/datamodels/single_pass_weld-1.0.0" + +title: | + Single pass, single wire GMAW weldment. +description: | + Schema describing a simple single pass welding application along a linear weld seam with constant groove shape. + + The idea of the schema is to define an abstract welding experiment with actual current and voltage measurements attached. + + This schema requires the following entries to be present: + - workpiece + - TCP + - welding_current + - welding_voltage + - measurements + - equipment + + Other entries are optional as listed in the schema description. + + The workpiece is defined by two properties: + - the base metal type + - the workpiece geometry defined by the combination of + - the groove shape (following ISO 9692-1) + - the total seam length + + It is assumed that the complete workpiece length is equal to the seam length. + Outside the welding groove shape, no information is given regarding the outer shape of the workpiece. + Additional information about the workpiece should be stored in the `wx_user` entries of the appropriate properties. + More complex workpiece data can be attached as custom data to the associated coordinate system. + + The TCP property is used to describe the path of the welding TCP along the weld seam. + For this schema, the TCP information is expected to be a linear movement between two points at a constant weld speed. + The TCP reference frame is the workpiece base coordinate system, starting at the beginning of the weld seam. + The x-axis coordinates will indicate the start- and end-point of the welding process along the workpiece length. + The y- and z-coordinates determine the position of the TCP in relation to the cross-sectional groove plane. + + The welding_current and welding_voltage entries refer to signals containing the final measurement data of corresponding dimensions [current] and [voltage]. + Additional details of the measurements can be attached via user fields here or in the respective measurement-chain. + + The `measurements` entry contains the full information about all measurements and their associated measurement chains. + + The equipment property provides a list of the measurement equipment used. + +type: object +properties: + process: + description: | + Metadata describing the GMAW process. + type: object + properties: + welding_process: + $ref: "asdf://weldx.bam.de/weldx/schemas/process/GMAW-1.0.0" + shielding_gas: + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/aws/process/shielding_gas_for_procedure-1.*" + - tag: "tag:weldx.bam.de:weldx/aws/process/shielding_gas_for_procedure-1.*" # legacy_tag + weld_speed: + description: | + The constant weld speed of the welding TCP movement. + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag + wx_unit: "m/s" + wx_shape: [1] + welding_wire: + description: | + Object describing the welding wire used. + type: object + properties: + diameter: + description: | + The diameter of the welding wire. + tag: "tag:stsci.edu:asdf/unit/quantity-1.*" + wx_unit: "m" + wx_shape: [1] + class: + description: | + The wire classification according to DIN EN ISO 14341, DIN EN 12072 or similar standards. + Addition standard details should be stored in the wx_user property. + type: string + required: [diameter] + required: [welding_process, shielding_gas, weld_speed, welding_wire] + welding_current: + description: | + The signal representing the welding current measurement. + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/signal-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.*" # legacy_tag + wx_unit: "A" + welding_voltage: + description: | + The signal representing the welding voltage measurement. + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/signal-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.*" # legacy_tag + wx_unit: "V" + TCP: + description: | + Transformation describing the welding TCP movement in relation to the groove coordinates. + + The movement describes a linear motion between two points along the weld seam at constant velocity. + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/transformations/local_coordinate_system-1.*" + - tag: "tag:weldx.bam.de:weldx/core/transformations/local_coordinate_system-1.*" # legacy_tag + wx_shape: + time: [2~] + coordinate_systems: + description: | + The expanded coordinate system setup describing the welding experiment and associated coordinate systems in detail. + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/transformations/coordinate_system_hierarchy-1.*" + - tag: "tag:weldx.bam.de:weldx/core/transformations/coordinate_system_hierarchy-1.*" # legacy_tag + equipment: + description: | + A list of equipments used for measurements and describing the weld seam. + type: array + items: + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/equipment/measurement_equipment-1.*" + - tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.*" # legacy_tag + measurements: + description: | + List of all measurements associated with the experiment. + type: array + items: + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/measurement-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/measurement-1.*" # legacy_tag + workpiece: + description: | + The workpiece to be welded defined by the base metal and the geometric description of the weld seam. + type: object + properties: + base_metal: + description: | + The base metal composition of the workpiece. + type: object + properties: + common_name: + description: | + The common description of the base metal composition or classification as listed in the standard. + type: string + standard: + description: | + The standard listing and describing the base metal compositions. + type: string + required: [common_name, standard] + geometry: + description: | + Description of the workpiece geometry consisting of the groove shape and the total seam length. + type: object + properties: + groove_shape: + description: | + Constant groove shape of the weld seam. + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/groove/iso_9692_1_2013_12/*-1.*" + - tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/*-1.*" # legacy_tag + seam_length: + description: | + Length of the linear weld seam. + tag: "tag:stsci.edu:asdf/unit/quantity-1.*" + wx_unit: "m" + required: [groove_shape, seam_length] + required: [base_metal, geometry] + reference_timestamp: + description: | + An optional timestamp indicating the start of the welding process. + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/time/timestamp-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" # legacy_tag + wx_metadata: + description: | + General metadata container. + type: object + wx_user: + description: | + Metadata container for additional user documentation of the experiment. + type: object +required: [equipment,workpiece,measurements,welding_current,welding_voltage,TCP] + +examples: + - + - A simple welding application + - | + ! + TCP: ! + time: ! + values: !core/ndarray-1.0.0 + data: [0, 29000000000] + datatype: int64 + shape: [2] + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M29S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M29S} + orientations: ! + name: orientations + dimensions: [c, v] + dtype: + name: coordinates + dimensions: [time, c] + dtype: + name: Coordinate system manager 0 + root_system_name: base + subsystems: [] + coordinate_systems: + - ! + name: workpiece + reference_system: base + transformation: ! {} + - ! + name: tcp_wire + reference_system: workpiece + transformation: ! + time: ! + values: !core/ndarray-1.0.0 + data: [0, 29000000000] + datatype: int64 + shape: [2] + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M29S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M29S} + orientations: ! + name: orientations + dimensions: [c, v] + dtype: + name: coordinates + dimensions: [time, c] + dtype: + name: tcp_contact + reference_system: tcp_wire + transformation: ! + coordinates: ! + name: coordinates + dimensions: [c] + dtype: + name: HKS P1000-S3 + sources: + - &id003 ! + name: Current Sensor + output_signal: &id004 ! + signal_type: analog + unit: V + error: ! + deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.1} + - &id011 ! + name: Voltage Sensor + output_signal: &id012 ! + signal_type: analog + unit: V + error: ! + deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.1} + transformations: [] + - &id005 ! + name: Beckhoff ELM3002-0000 + sources: [] + transformations: + - &id006 ! + name: AD conversion current measurement + error: ! + deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.01} + func: ! + expression: a*x + b + parameters: + a: !unit/quantity-1.1.0 {unit: 1 / volt, value: 3276.8} + b: !unit/quantity-1.1.0 {unit: dimensionless, value: 0.0} + type_transformation: AD + - &id013 ! + name: AD conversion voltage measurement + error: ! + deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.01} + func: ! + expression: a*x + b + parameters: + a: !unit/quantity-1.1.0 {unit: 1 / volt, value: 3276.8} + b: !unit/quantity-1.1.0 {unit: dimensionless, value: 0.0} + type_transformation: AD + measurements: + - ! + name: welding current measurement + data: + - &id007 ! + &id001 values: &id002 !core/ndarray-1.0.0 + data: [300.0, 299.9999999999999, 299.99999999999983, 299.99999999999915, 299.9999999999996, + 300.00000000000006] + datatype: float64 + shape: [6] + time: ! + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M10S} + freq: 2S + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M10S} + unit: ampere + shape: [6] + interpolation: step + *id001 : *id002 + measurement_chain: ! + name: welding current measurement chain + data_source: *id003 + graph: ! + root_node: ! + name: Current Sensor + attributes: + signal: *id004 + edges: + - ! + direction: fwd + attributes: + equipment: *id005 + transformation: *id006 + target_node: ! + name: AD conversion current measurement + attributes: + signal: ! + signal_type: digital + unit: dimensionless + edges: + - ! + direction: fwd + attributes: + transformation: ! + name: Calibration current measurement + error: ! + deviation: 0.0 + func: ! + expression: a*x + b + parameters: + a: !unit/quantity-1.1.0 {unit: ampere, value: 0.030517578125} + b: !unit/quantity-1.1.0 {unit: ampere, value: 0.0} + wx_metadata: + software: !core/software-1.0.0 {name: Beckhoff TwinCAT ScopeView, + version: 3.4.3143} + target_node: ! + name: Calibration current measurement + attributes: + signal: &id015 ! + signal_type: digital + unit: ampere + data: *id007 + source_equipment: *id008 + - ! + name: welding voltage measurement + data: + - &id014 ! + &id009 values: &id010 !core/ndarray-1.0.0 + data: [40.299500249940486, 40.29950024994045, 40.299500249940436, 40.29950024994042, + 40.29950024994049, 40.299500249940564] + datatype: float64 + shape: [6] + time: ! + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M10S} + freq: 2S + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M10S} + unit: volt + shape: [6] + interpolation: step + *id009 : *id010 + measurement_chain: ! + name: welding voltage measurement chain + data_source: *id011 + graph: ! + root_node: ! + name: Voltage Sensor + attributes: + signal: *id012 + edges: + - ! + direction: fwd + attributes: + equipment: *id005 + transformation: *id013 + target_node: ! + name: AD conversion voltage measurement + attributes: + signal: ! + signal_type: digital + unit: dimensionless + edges: + - ! + direction: fwd + attributes: + transformation: ! + name: Calibration voltage measurement + error: ! + deviation: 0.0 + func: ! + expression: a*x + b + parameters: + a: !unit/quantity-1.1.0 {unit: volt, value: 0.0030517578125} + b: !unit/quantity-1.1.0 {unit: volt, value: 0.0} + wx_metadata: + software: !core/software-1.0.0 {name: Beckhoff TwinCAT ScopeView, + version: 3.4.3143} + target_node: ! + name: Calibration voltage measurement + attributes: + signal: &id016 ! + signal_type: digital + unit: volt + data: *id014 + source_equipment: *id008 + process: + shielding_gas: ! + use_torch_shielding_gas: true + torch_shielding_gas: ! + gas_component: + - ! + gas_chemical_name: argon + gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 82} + - ! + gas_chemical_name: carbon dioxide + gas_percentage: !unit/quantity-1.1.0 {unit: percent, value: 18} + common_name: SG + torch_shielding_gas_flowrate: !unit/quantity-1.1.0 {unit: liter / minute, value: 20} + weld_speed: ! + unit: millimeter / second + value: 10 + welding_process: ! + base_process: pulse + manufacturer: CLOOS + meta: {modulation: UI} + parameters: + base_current: ! + unit: ampere + value: 60.0 + pulse_duration: ! + unit: millisecond + value: 5.0 + pulse_frequency: ! + unit: hertz + value: 100.0 + pulse_voltage: ! + unit: volt + value: 40.0 + wire_feedrate: ! + unit: meter / minute + value: 10.0 + power_source: Quinto + tag: CLOOS/pulse + welding_wire: + diameter: !unit/quantity-1.1.0 {unit: millimeter, value: 1.2} + reference_timestamp: ! {value: '2020-11-09T12:00:00'} + welding_current: *id015 + welding_voltage: *id016 + workpiece: + base_metal: {common_name: S355J2+N, standard: 'DIN EN 10225-2:2011'} + geometry: + groove_shape: ! + t: !unit/quantity-1.1.0 {unit: millimeter, value: 5} + alpha: !unit/quantity-1.1.0 {unit: degree, value: 50} + b: !unit/quantity-1.1.0 {unit: millimeter, value: 1} + c: !unit/quantity-1.1.0 {unit: millimeter, value: 1} + code_number: ['1.3', '1.5'] + seam_length: !unit/quantity-1.1.0 {unit: millimeter, value: 300} + wx_metadata: {welder: A.W. Elder} +... diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_property_tag-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/debug/test_property_tag-1.0.0.yaml similarity index 69% rename from weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_property_tag-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/debug/test_property_tag-1.0.0.yaml index 94e35e753..d33cba2bb 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_property_tag-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/debug/test_property_tag-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/debug/test_property_tag-1.0.0" -tag: "tag:weldx.bam.de:weldx/debug/test_property_tag-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/debug/test_property_tag-1.0.0" title: | Test wx_property_type validation. @@ -12,5 +11,5 @@ description: | So far only one specific tag can be used. type: object additionalProperties: true # must be true to allow any property -wx_property_tag: "tag:weldx.bam.de:weldx/time/timestamp-*" +wx_property_tag: "asdf://weldx.bam.de/weldx/tags/time/timestamp-*" ... \ No newline at end of file diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_shape_validator-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/debug/test_shape_validator-1.0.0.yaml similarity index 73% rename from weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_shape_validator-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/debug/test_shape_validator-1.0.0.yaml index 38438c34f..4ac55286a 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_shape_validator-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/debug/test_shape_validator-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/debug/test_shape_validator-1.0.0" -tag: "tag:weldx.bam.de:weldx/debug/test_shape_validator-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/debug/test_shape_validator-1.0.0" title: | simple demonstration and test schema for wx_shape validator syntax @@ -33,7 +32,9 @@ properties: wx_shape: [1] timeseries: - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_shape: [1] nested_prop: @@ -48,8 +49,10 @@ properties: time_prop: oneOf: - - tag: "tag:weldx.bam.de:weldx/time/timedeltaindex-1.0.0" - - tag: "tag:weldx.bam.de:weldx/time/datetimeindex-1.0.0" + - tag: "asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-1.0.0" + - tag: "tag:weldx.bam.de:weldx/time/timedeltaindex-1.0.0" # legacy_tag + - tag: "asdf://weldx.bam.de/weldx/tags/time/datetimeindex-1.0.0" + - tag: "tag:weldx.bam.de:weldx/time/datetimeindex-1.0.0" # legacy_tag optional_prop: tag: "tag:stsci.edu:asdf/core/ndarray-1.*" diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_unit_validator-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/debug/test_unit_validator-1.0.0.yaml similarity index 91% rename from weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_unit_validator-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/debug/test_unit_validator-1.0.0.yaml index f68712527..9f82509aa 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/debug/test_unit_validator-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/debug/test_unit_validator-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/debug/test_unit_validator-1.0.0" -tag: "tag:weldx.bam.de:weldx/debug/test_unit_validator-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/debug/test_unit_validator-1.0.0" title: | simple demonstration schema for wx_unit validator diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/equipment/measurement_equipment-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/equipment/measurement_equipment-1.0.0.yaml similarity index 59% rename from weldx/asdf/schemas/weldx.bam.de/weldx/equipment/measurement_equipment-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/equipment/measurement_equipment-1.0.0.yaml index a9835f656..4403d867c 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/equipment/measurement_equipment-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/equipment/measurement_equipment-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/equipment/measurement_equipment-1.0.0" -tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0" title: | A piece of measurement equipment. @@ -14,16 +13,16 @@ examples: - - A analog to digital conversion equipment with a linear signal transformation. - | - ! + ! name: Beckhoff ELM3002-0000 sources: [] transformations: - - &id004 ! + - &id004 ! name: AD conversion current measurement type_transformation: AD - error: ! + error: ! deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.01} - func: ! + func: ! expression: a*x + b parameters: a: !unit/quantity-1.1.0 {unit: 1 / volt, value: 3276.8} @@ -36,11 +35,15 @@ properties: sources: type: array items: - tag: "tag:weldx.bam.de:weldx/measurement/source-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/source-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/source-1.*" # legacy_tag transformations: type: array items: - tag: "tag:weldx.bam.de:weldx/measurement/signal_transformation-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/signal_transformation-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/signal_transformation-1.*" # legacy_tag propertyOrder: [name, sources, transformations] required: [name] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0.yaml similarity index 87% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0.yaml index 2a50a0d11..04dc81405 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DHUGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DHUGroove-1.0.0" title: | DHUGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple DHU-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 32} beta_1: !unit/quantity-1.1.0 {unit: degree, value: 10} beta_2: !unit/quantity-1.1.0 {unit: degree, value: 20} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0.yaml similarity index 84% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0.yaml index b0f161979..b8176c45e 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DHVGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DHVGroove-1.0.0" title: | DHVGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple DHV-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 11} beta_1: !unit/quantity-1.1.0 {unit: degree, value: 35} beta_2: !unit/quantity-1.1.0 {unit: degree, value: 60} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0.yaml similarity index 87% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0.yaml index 431e08692..0e9672e5f 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DUGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DUGroove-1.0.0" title: | DUGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple DU-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 33} beta_1: !unit/quantity-1.1.0 {unit: degree, value: 8} beta_2: !unit/quantity-1.1.0 {unit: degree, value: 12} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0.yaml similarity index 85% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0.yaml index 492787754..8fabd8481 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/DVGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/DVGroove-1.0.0" title: | DVGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple DV-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 19} alpha_1: !unit/quantity-1.1.0 {unit: degree, value: 40} alpha_2: !unit/quantity-1.1.0 {unit: degree, value: 60} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0.yaml similarity index 78% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0.yaml index b2bc38c2d..510aee278 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/FFGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/FFGroove-1.0.0" title: | FFGroove representation. @@ -11,13 +10,13 @@ examples: - - A code 1.12 FF-Groove - | - ! + ! t_1: !unit/quantity-1.1.0 {unit: millimeter, value: 5} code_number: '1.12' - - A code 3.1.1 FF-Groove - | - ! + ! t_1: !unit/quantity-1.1.0 {unit: millimeter, value: 5} t_2: !unit/quantity-1.1.0 {unit: millimeter, value: 7} alpha: !unit/quantity-1.1.0 {unit: degree, value: 80} @@ -26,7 +25,7 @@ examples: - - A code 3.1.2 FF-Groove - | - ! + ! t_1: !unit/quantity-1.1.0 {unit: millimeter, value: 2} t_2: !unit/quantity-1.1.0 {unit: millimeter, value: 5} b: !unit/quantity-1.1.0 {unit: millimeter, value: 1} @@ -34,7 +33,7 @@ examples: - - A code 3.1.3 FF-Groove - | - ! + ! t_1: !unit/quantity-1.1.0 {unit: millimeter, value: 2} t_2: !unit/quantity-1.1.0 {unit: millimeter, value: 5} alpha: !unit/quantity-1.1.0 {unit: degree, value: 80} @@ -43,7 +42,7 @@ examples: - - A code 4.1.2 FF-Groove - | - ! + ! t_1: !unit/quantity-1.1.0 {unit: millimeter, value: 2} t_2: !unit/quantity-1.1.0 {unit: millimeter, value: 5} alpha: !unit/quantity-1.1.0 {unit: degree, value: 80} @@ -52,7 +51,7 @@ examples: - - A code 4.1.3 FF-Groove - | - ! + ! t_1: !unit/quantity-1.1.0 {unit: millimeter, value: 2} t_2: !unit/quantity-1.1.0 {unit: millimeter, value: 5} b: !unit/quantity-1.1.0 {unit: millimeter, value: 1} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0.yaml similarity index 81% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0.yaml index 9b309c920..4862124c9 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/HUGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/HUGroove-1.0.0" title: | HUGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple HU-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 18} beta: !unit/quantity-1.1.0 {unit: degree, value: 15} R: !unit/quantity-1.1.0 {unit: millimeter, value: 8} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0.yaml similarity index 78% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0.yaml index 7e3bc4c8d..e807ec683 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/HVGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/HVGroove-1.0.0" title: | HVGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple HV-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 9} beta: !unit/quantity-1.1.0 {unit: degree, value: 55} b: !unit/quantity-1.1.0 {unit: millimeter, value: 2} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0.yaml similarity index 71% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0.yaml index c0c8b9a74..ee81e1770 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/IGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/IGroove-1.0.0" title: | IGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple I-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 4} b: !unit/quantity-1.1.0 {unit: millimeter, value: 4} code_number: [1.2.1, 1.2.2, '2.1'] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0.yaml similarity index 81% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0.yaml index f4f12d40a..a65d46bb1 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/UGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/UGroove-1.0.0" title: | UGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple U-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 15} beta: !unit/quantity-1.1.0 {unit: degree, value: 9} R: !unit/quantity-1.1.0 {unit: millimeter, value: 6} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0.yaml similarity index 83% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0.yaml index c7a7d8e73..d2dba6944 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/UVGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/UVGroove-1.0.0" title: | UVGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple UV-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 12} alpha: !unit/quantity-1.1.0 {unit: degree, value: 60} beta: !unit/quantity-1.1.0 {unit: degree, value: 11} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0.yaml similarity index 82% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0.yaml index 70f0ace8a..c67dd19ff 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/VGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/VGroove-1.0.0" title: | VGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple V-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 15} alpha: !unit/quantity-1.1.0 {unit: degree, value: 40} b: !unit/quantity-1.1.0 {unit: millimeter, value: 2} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0.yaml similarity index 83% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0.yaml index 4ed9413dd..2dbcbf13d 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0" -tag: "tag:weldx.bam.de:weldx/groove/iso_9692_1_2013_12/VVGroove-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/VVGroove-1.0.0" title: | VVGroove representation. @@ -11,7 +10,7 @@ examples: - - A simple VV-Groove - | - ! + ! t: !unit/quantity-1.1.0 {unit: millimeter, value: 12} alpha: !unit/quantity-1.1.0 {unit: degree, value: 70} beta: !unit/quantity-1.1.0 {unit: degree, value: 13} diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/terms-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/groove/terms-1.0.0.yaml similarity index 94% rename from weldx/asdf/schemas/weldx.bam.de/weldx/groove/terms-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/groove/terms-1.0.0.yaml index d8f5d6f40..695174ef7 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/groove/terms-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/groove/terms-1.0.0.yaml @@ -1,7 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/groove/iso_9692_1_2013_12/terms-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/groove/iso_9692_1_2013_12/terms-1.0.0" title: | DIN EN ISO 9692-1 definitions diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/error-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/measurement/error-1.0.0.yaml similarity index 76% rename from weldx/asdf/schemas/weldx.bam.de/weldx/measurement/error-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/measurement/error-1.0.0.yaml index d4827502b..df9583fa9 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/error-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/measurement/error-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/measurement/error-1.0.0" -tag: "tag:weldx.bam.de:weldx/measurement/error-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/measurement/error-1.0.0" title: | Measurement error description. @@ -13,7 +12,7 @@ examples: - - An error representing a deviation of 0.1%. - | - ! + ! deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.1} type: object diff --git a/weldx/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml new file mode 100644 index 000000000..8e18c782d --- /dev/null +++ b/weldx/schemas/weldx.bam.de/weldx/measurement/measurement-1.0.0.yaml @@ -0,0 +1,28 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "asdf://weldx.bam.de/weldx/schemas/measurement/measurement-1.0.0" + +title: | + Schema that describes a measurement +type: object +properties: + name: + type: string + data: + type: array + items: + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag + + measurement_chain: + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/measurement_chain-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/measurement_chain-1.*" # legacy_tag + + +propertyOrder: [name, data, measurement_chain] +required: [name, data] +flowStyle: block +... \ No newline at end of file diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/measurement_chain-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/measurement/measurement_chain-1.0.0.yaml similarity index 57% rename from weldx/asdf/schemas/weldx.bam.de/weldx/measurement/measurement_chain-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/measurement/measurement_chain-1.0.0.yaml index 79eb89bd2..de57f65dd 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/measurement_chain-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/measurement/measurement_chain-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/measurement/measurement_chain-1.0.0" -tag: "tag:weldx.bam.de:weldx/measurement/measurement_chain-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/measurement/measurement_chain-1.0.0" title: | Schema that describes a measurement_chain @@ -18,57 +17,57 @@ example: A measurement chain representing a current measurement. It consists of 2 transformations, an AD conversion and subsequent application of the calibration data. - | - ! + ! name: Welding current measurement chain - data_source: ! + data_source: ! name: Current sensor - output_signal: &id001 ! + output_signal: &id001 ! signal_type: analog unit: V - error: ! + error: ! deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.2} - graph: ! - root_node: ! + graph: ! + root_node: ! name: Current sensor attributes: signal: *id001 edges: - - ! + - ! direction: fwd attributes: - transformation: ! + transformation: ! name: AD conversion - error: ! + error: ! deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.025} - func: ! + func: ! expression: a*x parameters: a: !unit/quantity-1.1.0 {unit: 1 / volt, value: 1} type_transformation: AD - target_node: ! + target_node: ! name: AD conversion attributes: - signal: ! + signal: ! signal_type: digital unit: dimensionless edges: - - ! + - ! direction: fwd attributes: - transformation: ! + transformation: ! name: Calibration - error: ! + error: ! deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.1} - func: ! + func: ! expression: a*x + b parameters: a: !unit/quantity-1.1.0 {unit: ampere, value: 75} b: !unit/quantity-1.1.0 {unit: ampere, value: 25} type_transformation: DD - target_node: ! + target_node: ! name: Calibration attributes: - signal: ! + signal: ! signal_type: digital unit: ampere @@ -77,7 +76,9 @@ definitions: description: | A graph node that represents a measurement signal. allOf: - - tag: "tag:weldx.bam.de:weldx/core/graph/di_node-1.0.0" + - oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/graph/di_node-1.0.0" + - tag: "tag:weldx.bam.de:weldx/core/graph/di_node-1.0.0" # legacy_tag - type: object properties: attributes: @@ -86,7 +87,9 @@ definitions: signal: description: | The measurement signal - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/signal-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.*" # legacy_tag required: [signal] edges: type: array @@ -99,7 +102,9 @@ definitions: description: | A graph edge that represents a signal transformation. allOf: - - tag: "tag:weldx.bam.de:weldx/core/graph/di_edge-1.0.0" + - oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/graph/di_edge-1.0.0" + - tag: "tag:weldx.bam.de:weldx/core/graph/di_edge-1.0.0" # legacy_tag - type: object properties: attributes: @@ -108,11 +113,15 @@ definitions: transformation: description: | The performed transformation. - tag: "tag:weldx.bam.de:weldx/measurement/signal_transformation-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/signal_transformation-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/signal_transformation-1.*" # legacy_tag equipment: description: | The equipment that performs the transformation - tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/equipment/measurement_equipment-1.*" + - tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.*" # legacy_tag required: [transformation] target_node: $ref: "#/definitions/signal_node" @@ -131,13 +140,17 @@ properties: data_source: description: | The source that generates the first signal and is the first element of the chain. - tag: "tag:weldx.bam.de:weldx/measurement/source-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/source-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/source-1.*" # legacy_tag graph: description: | The measurement chain depicted by a graph. Signals are represented by the nodes and transformations by the edges. allOf: - - tag: "tag:weldx.bam.de:weldx/core/graph/di_graph-1.0.0" + - oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/graph/di_graph-1.0.0" + - tag: "tag:weldx.bam.de:weldx/core/graph/di_graph-1.0.0" # legacy_tag - type: object properties: root_node: @@ -146,7 +159,9 @@ properties: source_equipment: description: | The equipment that produces the source signal. - tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/equipment/measurement_equipment-1.*" + - tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.*" # legacy_tag propertyOrder: [name, data_source, graph, source_equipment] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/signal-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/measurement/signal-1.0.0.yaml similarity index 70% rename from weldx/asdf/schemas/weldx.bam.de/weldx/measurement/signal-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/measurement/signal-1.0.0.yaml index 926ef82bc..2bb83c24d 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/signal-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/measurement/signal-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/measurement/signal-1.0.0" -tag: "tag:weldx.bam.de:weldx/measurement/signal-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/measurement/signal-1.0.0" title: | Representation of a measurement signal with optional data attached. @@ -12,13 +11,13 @@ examples: - - A signal representing an analog voltage measurement without data. - | - ! + ! signal_type: analog unit: V - - A digital dimensionless signal. - | - ! + ! signal_type: digital unit: '' @@ -35,7 +34,9 @@ properties: data: description: | Measurement data that was produced by the signal. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag propertyOrder: [signal_type, unit, data] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/signal_transformation-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/measurement/signal_transformation-1.0.0.yaml similarity index 69% rename from weldx/asdf/schemas/weldx.bam.de/weldx/measurement/signal_transformation-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/measurement/signal_transformation-1.0.0.yaml index 64331eb38..34829f1b9 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/signal_transformation-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/measurement/signal_transformation-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/measurement/signal_transformation-1.0.0" -tag: "tag:weldx.bam.de:weldx/measurement/signal_transformation-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/measurement/signal_transformation-1.0.0" title: | Signal transformation step. @@ -13,19 +12,19 @@ examples: - - A simple analog-digital conversion without a function that affects the signal values - | - ! + ! name: AD conversion - error: ! + error: ! deviation: !unit/quantity-1.1.0 { unit: percent, value: 0.5 } type_transformation: AD - - A transformation that calculates amperes based on volts using a given function - | - ! + ! name: Volt-Ampere-Conversion - error: ! + error: ! deviation: !unit/quantity-1.1.0 { unit: percent, value: 1.5 } - func: ! + func: ! expression: a*x + b parameters: a: !unit/quantity-1.1.0 { unit: ampere / volt, value: 3 } @@ -40,11 +39,15 @@ properties: error: description: | The error caused by the transformation - tag: "tag:weldx.bam.de:weldx/measurement/error-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/error-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/error-1.*" # legacy_tag func: description: | A mathematical expression that describes the relation between the values of the output and input signal - tag: "tag:weldx.bam.de:weldx/core/mathematical_expression-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/mathematical_expression-1.*" + - tag: "tag:weldx.bam.de:weldx/core/mathematical_expression-1.*" # legacy_tag type_transformation: description: | A string of length 2 containing an arbitrary combination of the letters A (for analog) and D (for digital). The diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/source-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/measurement/source-1.0.0.yaml similarity index 54% rename from weldx/asdf/schemas/weldx.bam.de/weldx/measurement/source-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/measurement/source-1.0.0.yaml index 8aa5858e2..a8a440c29 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/measurement/source-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/measurement/source-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/measurement/source-1.0.0" -tag: "tag:weldx.bam.de:weldx/measurement/source-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/measurement/source-1.0.0" title: | Schema that describes a measurement source. @@ -11,12 +10,12 @@ examples: - - The source of a current measurement outputting an analog signal. - | - ! + ! name: Current Sensor - output_signal: ! + output_signal: ! signal_type: analog unit: V - error: ! + error: ! deviation: !unit/quantity-1.1.0 {unit: percent, value: 0.1} type: object @@ -28,11 +27,15 @@ properties: output_signal: description: | The signal that is produced by the source. - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/signal-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/signal-1.*" # legacy_tag error: description: | The error of the source. - tag: "tag:weldx.bam.de:weldx/measurement/error-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/measurement/error-1.*" + - tag: "tag:weldx.bam.de:weldx/measurement/error-1.*" # legacy_tag required: [name, output_signal] propertyOrder: [name, output_signal, error] diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/process/CLOOS/pulse-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/process/CLOOS/pulse-1.0.0.yaml similarity index 75% rename from weldx/asdf/schemas/weldx.bam.de/weldx/process/CLOOS/pulse-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/process/CLOOS/pulse-1.0.0.yaml index a4926fcfe..53d53a041 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/process/CLOOS/pulse-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/process/CLOOS/pulse-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/process/CLOOS/pulse-1.0.0" -tag: "tag:weldx.bam.de:weldx/process/CLOOS/pulse-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/process/CLOOS/pulse-1.0.0" title: | CLOOS GMAW pulsed processes. diff --git a/weldx/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml new file mode 100644 index 000000000..bb306769a --- /dev/null +++ b/weldx/schemas/weldx.bam.de/weldx/process/CLOOS/spray_arc-1.0.0.yaml @@ -0,0 +1,28 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "asdf://weldx.bam.de/weldx/schemas/process/CLOOS/spray_arc-1.0.0" + +title: | + CLOOS spray arc process. + +allOf: + - $ref: "../generic-1.0.0#/spray" + - type: object + properties: + parameters: + type: object + properties: + impedance: + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag + wx_unit: "percent" + characteristic: + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag + wx_unit: "V/A" + required: [impedance,characteristic] + +... \ No newline at end of file diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/process/GMAW-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/process/GMAW-1.0.0.yaml similarity index 52% rename from weldx/asdf/schemas/weldx.bam.de/weldx/process/GMAW-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/process/GMAW-1.0.0.yaml index 2e96a7e72..af48befe4 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/process/GMAW-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/process/GMAW-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/process/GMAW-1.0.0" -tag: "tag:weldx.bam.de:weldx/process/GMAW-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/process/GMAW-1.0.0" title: | Generic GMAW process definition. @@ -11,24 +10,24 @@ examples: - - A constant pulsed GMAW process for a CLOOS Quinto power source - | - ! + ! base_process: pulse manufacturer: CLOOS meta: {modulation: UI} parameters: - base_current: ! + base_current: ! unit: ampere value: 60.0 - pulse_duration: ! + pulse_duration: ! unit: millisecond value: 5.0 - pulse_frequency: ! + pulse_frequency: ! unit: hertz value: 100.0 - pulse_voltage: ! + pulse_voltage: ! unit: volt value: 40.0 - wire_feedrate: ! + wire_feedrate: ! unit: meter / minute value: 10.0 power_source: Quinto @@ -36,35 +35,35 @@ examples: - - A spray arc process where the voltage decreases linearly from 40 V to 20 V over 10 s - | - ! + ! base_process: spray manufacturer: CLOOS parameters: - characteristic: ! + characteristic: ! unit: volt / ampere value: 5.0 - impedance: ! + impedance: ! unit: percent value: 10.0 - voltage: ! + voltage: ! &id001 values: &id002 !core/ndarray-1.0.0 data: [40.0, 20.0] datatype: float64 shape: [2] - time: ! + time: ! values: !core/ndarray-1.0.0 data: [0, 10000000000] datatype: int64 shape: [2] - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M10S} - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M10S} + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M10S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M10S} unit: volt shape: [2] interpolation: linear *id001 : *id002 - wire_feedrate: ! + wire_feedrate: ! unit: meter / minute value: 10.0 power_source: Quinto diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/process/generic-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/process/generic-1.0.0.yaml similarity index 77% rename from weldx/asdf/schemas/weldx.bam.de/weldx/process/generic-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/process/generic-1.0.0.yaml index 69b46a695..27684bed1 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/process/generic-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/process/generic-1.0.0.yaml @@ -1,7 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/process/generic-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/process/generic-1.0.0" title: | Generic GMAW processes diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/process/terms-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/process/terms-1.0.0.yaml similarity index 70% rename from weldx/asdf/schemas/weldx.bam.de/weldx/process/terms-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/process/terms-1.0.0.yaml index 73038ee0e..3c61dd3c9 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/process/terms-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/process/terms-1.0.0.yaml @@ -1,7 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/process/terms-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/process/terms-1.0.0" title: | GMAW process definitions @@ -19,7 +19,7 @@ base_process: type: string parameters: type: object - wx_property_tag: "tag:weldx.bam.de:weldx/core/time_series-*" + wx_property_tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-*" meta: type: object required: [base_process,manufacturer,power_source,parameters] @@ -101,49 +101,65 @@ parameters: wire_feedrate: description: | Nominal average wire feedrate. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "m/s" voltage: description: | Nominal target voltage for spray arc processes. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "V" pulse_voltage: description: | Nominal target pulse voltage. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "V" pulse_current: description: | Nominal target pulse current. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "A" pulse_duration: description: | Nominal target pulse duration. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "s" pulse_frequency: description: | Nominal target pulse frequency. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "Hz" base_voltage: description: | Nominal target base voltage. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "V" base_current: description: | Nominal target base current. - tag: "tag:weldx.bam.de:weldx/core/time_series-1.0.0" + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/core/time_series-1.*" + - tag: "tag:weldx.bam.de:weldx/core/time_series-1.*" # legacy_tag wx_unit: "A" ... \ No newline at end of file diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/time/datetimeindex-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/time/datetimeindex-1.0.0.yaml similarity index 77% rename from weldx/asdf/schemas/weldx.bam.de/weldx/time/datetimeindex-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/time/datetimeindex-1.0.0.yaml index 00128057c..2c754d226 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/time/datetimeindex-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/time/datetimeindex-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/time/datetimeindex-1.0.0" -tag: "tag:weldx.bam.de:weldx/time/datetimeindex-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/time/datetimeindex-1.0.0" title: | Represents an array of timestamps following pandas.DatetimeIndex. @@ -11,12 +10,12 @@ examples: - - A regular datetimeindex starting at 2020-01-01 and a 1 day interval till 2020-01-06 - | - ! - start: ! {value: '2020-01-01T00:00:00'} - end: ! {value: '2020-01-05T00:00:00'} + ! + start: ! {value: '2020-01-01T00:00:00'} + end: ! {value: '2020-01-05T00:00:00'} freq: D - min: ! {value: '2020-01-01T00:00:00'} - max: ! {value: '2020-01-05T00:00:00'} + min: ! {value: '2020-01-01T00:00:00'} + max: ! {value: '2020-01-05T00:00:00'} definitions: values: diff --git a/weldx/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml new file mode 100644 index 000000000..6f1fa22cb --- /dev/null +++ b/weldx/schemas/weldx.bam.de/weldx/time/time-1.0.0.yaml @@ -0,0 +1,68 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "asdf://weldx.bam.de/weldx/schemas/time/time-1.0.0" + +title: | + Represents a single or multiple timestamps or timedeltas. + +examples: + - + - A single timedelta of 2 seconds + - | + ! + values: ! {value: P0DT0H0M2S} + - + - A timedelta series from 0 s to 4 s with a 2 s frequency + - | + ! + values: ! + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M4S} + freq: 2S + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M4S} + - + - A single timestamp + - | + ! + values: ! {value: '2021-08-01T00:00:00'} + - + - An absolute time index with a 1 s frequency + - | + ! + values: ! + start: ! {value: '2021-01-01T00:00:00'} + end: ! {value: '2021-01-01T00:00:02'} + freq: S + min: ! {value: '2021-01-01T00:00:00'} + max: ! {value: '2021-01-01T00:00:02'} + reference_time: ! {value: '2021-01-01T00:00:00'} + +type: object +properties: + values: + description: | + The time values that are represented by the Time object. + type: object + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/time/timedelta-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timedelta-1.*" # legacy_tag + - tag: "asdf://weldx.bam.de/weldx/tags/time/timedeltaindex-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timedeltaindex-1.*" # legacy_tag + - tag: "asdf://weldx.bam.de/weldx/tags/time/timestamp-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" # legacy_tag + - tag: "asdf://weldx.bam.de/weldx/tags/time/datetimeindex-1.*" + - tag: "tag:weldx.bam.de:weldx/time/datetimeindex-1.*" # legacy_tag + + reference_time: + description: | + Indicates a specific reference timestamp for the time object. + type: object + oneOf: + - tag: "asdf://weldx.bam.de/weldx/tags/time/timestamp-1.*" + - tag: "tag:weldx.bam.de:weldx/time/timestamp-1.*" # legacy_tag + +required: [values] +propertyOrder: [values, reference_time] +... diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/time/timedelta-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/time/timedelta-1.0.0.yaml similarity index 69% rename from weldx/asdf/schemas/weldx.bam.de/weldx/time/timedelta-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/time/timedelta-1.0.0.yaml index d19510cbd..8fccedae3 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/time/timedelta-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/time/timedelta-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/time/timedelta-1.0.0" -tag: "tag:weldx.bam.de:weldx/time/timedelta-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/time/timedelta-1.0.0" title: | Represents a difference between two instances in time. @@ -11,7 +10,7 @@ examples: - - A timedelta of 10 s - | - ! {value: P0DT0H0M10S} + ! {value: P0DT0H0M10S} type: object properties: diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/time/timedeltaindex-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/time/timedeltaindex-1.0.0.yaml similarity index 69% rename from weldx/asdf/schemas/weldx.bam.de/weldx/time/timedeltaindex-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/time/timedeltaindex-1.0.0.yaml index 2c65e20c6..bafc651b4 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/time/timedeltaindex-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/time/timedeltaindex-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/time/timedeltaindex-1.0.0" -tag: "tag:weldx.bam.de:weldx/time/timedeltaindex-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/time/timedeltaindex-1.0.0" title: | Represents an array of timedeltas following pandas.TimedeltaIndex. @@ -11,24 +10,24 @@ examples: - - A regular spaced timedeltaindex ranging from 0 s to 10 s with a 2 s frequency - | - ! - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M10S} + ! + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M10S} freq: 2S - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M10S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M10S} - - An irregular timedeltaindex representing timestamps at 0 s, 4 s, 6 s and 10 s - | - ! + ! values: !core/ndarray-1.0.0 data: [0, 4000000000, 6000000000, 10000000000] datatype: int64 shape: [4] - start: ! {value: P0DT0H0M0S} - end: ! {value: P0DT0H0M10S} - min: ! {value: P0DT0H0M0S} - max: ! {value: P0DT0H0M10S} + start: ! {value: P0DT0H0M0S} + end: ! {value: P0DT0H0M10S} + min: ! {value: P0DT0H0M0S} + max: ! {value: P0DT0H0M10S} definitions: values: diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/time/timestamp-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/time/timestamp-1.0.0.yaml similarity index 74% rename from weldx/asdf/schemas/weldx.bam.de/weldx/time/timestamp-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/time/timestamp-1.0.0.yaml index 13d39c6e4..c62ce12c0 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/time/timestamp-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/time/timestamp-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/time/timestamp-1.0.0" -tag: "tag:weldx.bam.de:weldx/time/timestamp-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/time/timestamp-1.0.0" title: | Represents a single instance in time. @@ -11,15 +10,15 @@ examples: - - A timestamp representing the date 2020-01-01 12:00:00 (without timezone information) - | - ! {value: '2020-01-01T00:00:00'} + ! {value: '2020-01-01T00:00:00'} - - A timestamp representing the date 2020-01-01 12:00:00 in UTC time - | - ! {value: '2020-01-01T12:00:00+00:00'} + ! {value: '2020-01-01T12:00:00+00:00'} - - A timestamp representing the date 2020-01-01 12:00:00 in CET time - | - ! {value: '2020-01-01T12:00:00+01:00'} + ! {value: '2020-01-01T12:00:00+01:00'} type: object properties: diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/unit/dimension-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/unit/dimension-1.0.0.yaml similarity index 91% rename from weldx/asdf/schemas/weldx.bam.de/weldx/unit/dimension-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/unit/dimension-1.0.0.yaml index 6ea628cc1..18b4b9f30 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/unit/dimension-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/unit/dimension-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/unit/dimension-1.0.0" -tag: "tag:weldx.bam.de:weldx/unit/dimension-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/unit/dimension-1.0.0" title: | Describes the dimension of a quantity. diff --git a/weldx/asdf/schemas/weldx.bam.de/weldx/uuid-1.0.0.yaml b/weldx/schemas/weldx.bam.de/weldx/uuid-1.0.0.yaml similarity index 77% rename from weldx/asdf/schemas/weldx.bam.de/weldx/uuid-1.0.0.yaml rename to weldx/schemas/weldx.bam.de/weldx/uuid-1.0.0.yaml index a5650113b..d2b777db4 100644 --- a/weldx/asdf/schemas/weldx.bam.de/weldx/uuid-1.0.0.yaml +++ b/weldx/schemas/weldx.bam.de/weldx/uuid-1.0.0.yaml @@ -1,8 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/uuid-1.0.0" -tag: "tag:weldx.bam.de:weldx/uuid-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/uuid-1.0.0" title: | Version 4 UUID @@ -13,7 +12,7 @@ examples: - - A version 4 UUID string - | - ! + ! uuid: 448414c4-da7a-4832-9219-5e6042c2e96e type: object diff --git a/weldx/asdf/tags/weldx/__init__.py b/weldx/tags/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/__init__.py rename to weldx/tags/__init__.py diff --git a/weldx/asdf/tags/weldx/aws/__init__.py b/weldx/tags/aws/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/aws/__init__.py rename to weldx/tags/aws/__init__.py diff --git a/weldx/asdf/tags/weldx/aws/design/__init__.py b/weldx/tags/aws/design/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/aws/design/__init__.py rename to weldx/tags/aws/design/__init__.py diff --git a/weldx/asdf/tags/weldx/aws/design/base_metal.py b/weldx/tags/aws/design/base_metal.py similarity index 88% rename from weldx/asdf/tags/weldx/aws/design/base_metal.py rename to weldx/tags/aws/design/base_metal.py index 2ddf923df..4de08d197 100644 --- a/weldx/asdf/tags/weldx/aws/design/base_metal.py +++ b/weldx/tags/aws/design/base_metal.py @@ -4,7 +4,7 @@ from weldx.asdf.util import dataclass_serialization_class -__all__ = ["BaseMetal", "BaseMetalType"] +__all__ = ["BaseMetal", "BaseMetalConverter"] @dataclass @@ -29,7 +29,7 @@ class BaseMetal: applied_coating_specification: str = None -BaseMetalType = dataclass_serialization_class( +BaseMetalConverter = dataclass_serialization_class( class_type=BaseMetal, class_name="aws/design/base_metal", version="1.0.0", diff --git a/weldx/asdf/tags/weldx/aws/design/connection.py b/weldx/tags/aws/design/connection.py similarity index 81% rename from weldx/asdf/tags/weldx/aws/design/connection.py rename to weldx/tags/aws/design/connection.py index 1ffeeb937..f96dc2dc2 100644 --- a/weldx/asdf/tags/weldx/aws/design/connection.py +++ b/weldx/tags/aws/design/connection.py @@ -5,7 +5,7 @@ from .joint_penetration import JointPenetration from .weld_details import WeldDetails -__all__ = ["Connection", "ConnectionType"] +__all__ = ["Connection", "ConnectionConverter"] @dataclass @@ -18,7 +18,7 @@ class Connection: weld_details: WeldDetails -ConnectionType = dataclass_serialization_class( +ConnectionConverter = dataclass_serialization_class( class_type=Connection, class_name="aws/design/connection", version="1.0.0", diff --git a/weldx/asdf/tags/weldx/aws/design/joint_penetration.py b/weldx/tags/aws/design/joint_penetration.py similarity index 82% rename from weldx/asdf/tags/weldx/aws/design/joint_penetration.py rename to weldx/tags/aws/design/joint_penetration.py index 93d6a2ba3..832ebacc5 100644 --- a/weldx/asdf/tags/weldx/aws/design/joint_penetration.py +++ b/weldx/tags/aws/design/joint_penetration.py @@ -4,7 +4,7 @@ from weldx.asdf.util import dataclass_serialization_class -__all__ = ["JointPenetration", "JointPenetrationType"] +__all__ = ["JointPenetration", "JointPenetrationConverter"] @dataclass @@ -21,7 +21,7 @@ class JointPenetration: depth_of_fusion: float = None -JointPenetrationType = dataclass_serialization_class( +JointPenetrationConverter = dataclass_serialization_class( class_type=JointPenetration, class_name="aws/design/joint_penetration", version="1.0.0", diff --git a/weldx/asdf/tags/weldx/aws/design/sub_assembly.py b/weldx/tags/aws/design/sub_assembly.py similarity index 79% rename from weldx/asdf/tags/weldx/aws/design/sub_assembly.py rename to weldx/tags/aws/design/sub_assembly.py index 561141721..274f04015 100644 --- a/weldx/asdf/tags/weldx/aws/design/sub_assembly.py +++ b/weldx/tags/aws/design/sub_assembly.py @@ -6,7 +6,7 @@ from .connection import Connection from .workpiece import Workpiece -__all__ = ["SubAssembly", "SubAssemblyType"] +__all__ = ["SubAssembly", "SubAssemblyConverter"] @dataclass @@ -17,7 +17,7 @@ class SubAssembly: connection: Connection -SubAssemblyType = dataclass_serialization_class( +SubAssemblyConverter = dataclass_serialization_class( class_type=SubAssembly, class_name="aws/design/sub_assembly", version="1.0.0", diff --git a/weldx/asdf/tags/weldx/aws/design/weld_details.py b/weldx/tags/aws/design/weld_details.py similarity index 76% rename from weldx/asdf/tags/weldx/aws/design/weld_details.py rename to weldx/tags/aws/design/weld_details.py index d8d68b140..b5cf07798 100644 --- a/weldx/asdf/tags/weldx/aws/design/weld_details.py +++ b/weldx/tags/aws/design/weld_details.py @@ -4,7 +4,7 @@ from weldx.asdf.util import dataclass_serialization_class -__all__ = ["WeldDetails", "WeldDetailsType"] +__all__ = ["WeldDetails", "WeldDetailsConverter"] @dataclass @@ -16,6 +16,6 @@ class WeldDetails: number_of_passes: int -WeldDetailsType = dataclass_serialization_class( +WeldDetailsConverter = dataclass_serialization_class( class_type=WeldDetails, class_name="aws/design/weld_details", version="1.0.0" ) diff --git a/weldx/asdf/tags/weldx/aws/design/weldment.py b/weldx/tags/aws/design/weldment.py similarity index 77% rename from weldx/asdf/tags/weldx/aws/design/weldment.py rename to weldx/tags/aws/design/weldment.py index 22da2962a..31ea3ccd1 100644 --- a/weldx/asdf/tags/weldx/aws/design/weldment.py +++ b/weldx/tags/aws/design/weldment.py @@ -5,7 +5,7 @@ from .sub_assembly import SubAssembly -__all__ = ["Weldment", "WeldmentType"] +__all__ = ["Weldment", "WeldmentConverter"] @dataclass @@ -15,6 +15,6 @@ class Weldment: sub_assembly: List[SubAssembly] -WeldmentType = dataclass_serialization_class( +WeldmentConverter = dataclass_serialization_class( class_type=Weldment, class_name="aws/design/weldment", version="1.0.0" ) diff --git a/weldx/asdf/tags/weldx/aws/design/workpiece.py b/weldx/tags/aws/design/workpiece.py similarity index 72% rename from weldx/asdf/tags/weldx/aws/design/workpiece.py rename to weldx/tags/aws/design/workpiece.py index da5554caf..e9e6c44eb 100644 --- a/weldx/asdf/tags/weldx/aws/design/workpiece.py +++ b/weldx/tags/aws/design/workpiece.py @@ -2,7 +2,7 @@ from weldx.asdf.util import dataclass_serialization_class -__all__ = ["Workpiece", "WorkpieceType"] +__all__ = ["Workpiece", "WorkpieceConverter"] @dataclass @@ -12,6 +12,6 @@ class Workpiece: geometry: str -WorkpieceType = dataclass_serialization_class( +WorkpieceConverter = dataclass_serialization_class( class_type=Workpiece, class_name="aws/design/workpiece", version="1.0.0" ) diff --git a/weldx/asdf/tags/weldx/aws/process/__init__.py b/weldx/tags/aws/process/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/aws/process/__init__.py rename to weldx/tags/aws/process/__init__.py diff --git a/weldx/asdf/tags/weldx/aws/process/arc_welding_process.py b/weldx/tags/aws/process/arc_welding_process.py similarity index 90% rename from weldx/asdf/tags/weldx/aws/process/arc_welding_process.py rename to weldx/tags/aws/process/arc_welding_process.py index 5173de763..6b5c5af14 100644 --- a/weldx/asdf/tags/weldx/aws/process/arc_welding_process.py +++ b/weldx/tags/aws/process/arc_welding_process.py @@ -2,7 +2,7 @@ from weldx.asdf.util import dataclass_serialization_class -__all__ = ["ArcWeldingProcess", "ArcWeldingProcessType"] +__all__ = ["ArcWeldingProcess", "ArcWeldingProcessConverter"] _name_to_abbr = { "atomicHydrogenWelding": "AHW", @@ -59,13 +59,13 @@ def __init__(self, name_or_abbreviation): ) -def _from_tree(tree): +def _from_yaml_tree(tree): return dict(name_or_abbreviation=tree["name"]) -ArcWeldingProcessType = dataclass_serialization_class( +ArcWeldingProcessConverter = dataclass_serialization_class( class_type=ArcWeldingProcess, class_name="aws/process/arc_welding_process", version="1.0.0", - from_tree_mod=_from_tree, + from_yaml_tree_mod=_from_yaml_tree, ) diff --git a/weldx/asdf/tags/weldx/aws/process/gas_component.py b/weldx/tags/aws/process/gas_component.py similarity index 74% rename from weldx/asdf/tags/weldx/aws/process/gas_component.py rename to weldx/tags/aws/process/gas_component.py index 81a4b64c2..c0ccfd092 100644 --- a/weldx/asdf/tags/weldx/aws/process/gas_component.py +++ b/weldx/tags/aws/process/gas_component.py @@ -4,7 +4,7 @@ from weldx.asdf.util import dataclass_serialization_class -__all__ = ["GasComponent", "GasComponentType"] +__all__ = ["GasComponent", "GasComponentConverter"] @dataclass @@ -15,6 +15,6 @@ class GasComponent: gas_percentage: pint.Quantity -GasComponentType = dataclass_serialization_class( +GasComponentConverter = dataclass_serialization_class( class_type=GasComponent, class_name="aws/process/gas_component", version="1.0.0" ) diff --git a/weldx/asdf/tags/weldx/aws/process/shielding_gas_for_procedure.py b/weldx/tags/aws/process/shielding_gas_for_procedure.py similarity index 91% rename from weldx/asdf/tags/weldx/aws/process/shielding_gas_for_procedure.py rename to weldx/tags/aws/process/shielding_gas_for_procedure.py index 81a8811dc..631a43524 100644 --- a/weldx/asdf/tags/weldx/aws/process/shielding_gas_for_procedure.py +++ b/weldx/tags/aws/process/shielding_gas_for_procedure.py @@ -6,7 +6,7 @@ from .shielding_gas_type import ShieldingGasType -__all__ = ["ShieldingGasForProcedure", "ShieldingGasForProcedureType"] +__all__ = ["ShieldingGasForProcedure", "ShieldingGasForProcedureConverter"] @dataclass @@ -24,7 +24,7 @@ class ShieldingGasForProcedure: trailing_shielding_gas_flowrate: pint.Quantity = None -ShieldingGasForProcedureType = dataclass_serialization_class( +ShieldingGasForProcedureConverter = dataclass_serialization_class( class_type=ShieldingGasForProcedure, class_name="aws/process/shielding_gas_for_procedure", version="1.0.0", diff --git a/weldx/asdf/tags/weldx/aws/process/shielding_gas_type.py b/weldx/tags/aws/process/shielding_gas_type.py similarity index 77% rename from weldx/asdf/tags/weldx/aws/process/shielding_gas_type.py rename to weldx/tags/aws/process/shielding_gas_type.py index a31f9fb99..0756ffa61 100644 --- a/weldx/asdf/tags/weldx/aws/process/shielding_gas_type.py +++ b/weldx/tags/aws/process/shielding_gas_type.py @@ -5,7 +5,7 @@ from .gas_component import GasComponent -__all__ = ["ShieldingGasType", "ShieldingGasTypeType"] +__all__ = ["ShieldingGasType", "ShieldingGasTypeConverter"] @dataclass @@ -17,7 +17,7 @@ class ShieldingGasType: designation: str = None -ShieldingGasTypeType = dataclass_serialization_class( +ShieldingGasTypeConverter = dataclass_serialization_class( class_type=ShieldingGasType, class_name="aws/process/shielding_gas_type", version="1.0.0", diff --git a/weldx/tags/base_types.py b/weldx/tags/base_types.py new file mode 100644 index 000000000..6c15658e9 --- /dev/null +++ b/weldx/tags/base_types.py @@ -0,0 +1,24 @@ +"""Module providing ASDF implementations for basic python types.""" +from uuid import UUID + +from asdf.asdf import SerializationContext + +from weldx.asdf.types import WeldxConverter + +__all__ = ["UuidConverter"] + + +# UUID --------------------------------------------------------------------------------- +class UuidConverter(WeldxConverter): + """Implements a version 4 UUID.""" + + tags = ["asdf://weldx.bam.de/weldx/tags/uuid-1.*"] + types = [UUID] + + def to_yaml_tree(self, obj: UUID, tag: str, ctx: SerializationContext) -> dict: + """Convert to python dict.""" + return dict(uuid=str(obj)) + + def from_yaml_tree(self, node: dict, tag: str, ctx: SerializationContext): + """Reconstruct from tree.""" + return UUID(node["uuid"]) diff --git a/weldx/asdf/tags/weldx/core/__init__.py b/weldx/tags/core/__init__.py similarity index 69% rename from weldx/asdf/tags/weldx/core/__init__.py rename to weldx/tags/core/__init__.py index d8304ff88..8803911ec 100644 --- a/weldx/asdf/tags/weldx/core/__init__.py +++ b/weldx/tags/core/__init__.py @@ -8,4 +8,4 @@ time_series, transformations, ) -from .graph import DiEdge, DiEdgeTypeASDF, DiGraphTypeASDF, DiNode +from .graph import DiEdge, DiEdgeConverter, DiGraphConverter, DiNode diff --git a/weldx/asdf/tags/weldx/core/common_types.py b/weldx/tags/core/common_types.py similarity index 51% rename from weldx/asdf/tags/weldx/core/common_types.py rename to weldx/tags/core/common_types.py index 505cdf038..303fd4d0c 100644 --- a/weldx/asdf/tags/weldx/core/common_types.py +++ b/weldx/tags/core/common_types.py @@ -4,11 +4,12 @@ import numpy as np import pint +from asdf.tagged import TaggedDict from pandas.api.types import is_datetime64_any_dtype as is_datetime from pandas.api.types import is_timedelta64_dtype as is_timedelta -from weldx.asdf.types import WeldxType -from weldx.asdf.util import dataclass_serialization_class +from weldx.asdf.types import WeldxConverter +from weldx.asdf.util import _get_instance_shape, dataclass_serialization_class from weldx.constants import Q_ @@ -23,7 +24,7 @@ class Dimension: length: int -DimensionTypeASDF = dataclass_serialization_class( +DimensionConverter = dataclass_serialization_class( class_type=Dimension, class_name="core/dimension", version="1.0.0" ) @@ -39,14 +40,12 @@ class Variable: attrs: Mapping[Hashable, Any] = dataclasses.field(default_factory=dict) -class VariableTypeASDF(WeldxType): +class VariableConverter(WeldxConverter): """Serialization class for a Variable""" name = "core/variable" version = "1.0.0" types = [Variable] - requires = ["weldx"] - handle_dynamic_subclasses = True @staticmethod def convert_time_dtypes(data: np.ndarray): @@ -71,78 +70,47 @@ def convert_time_dtypes(data: np.ndarray): return data.astype(np.int64) return data - @classmethod - def to_tree(cls, node: Variable, ctx): - """ - Convert an instance of the 'Variable' type into YAML representations. - - Parameters - ---------- - node : - Instance of the 'Variable' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'Variable' type to be - serialized. - - """ - - if isinstance(node.data, pint.Quantity): - unit = str(node.data.units) - data = node.data.magnitude + def to_yaml_tree(self, obj: Variable, tag: str, ctx) -> dict: + """Convert to python dict.""" + if isinstance(obj.data, pint.Quantity): + unit = str(obj.data.units) + data = obj.data.magnitude else: unit = None - data = node.data - dtype = node.data.dtype.str - data = cls.convert_time_dtypes(data=data) + data = obj.data + dtype = obj.data.dtype.str + data = self.convert_time_dtypes(data=data) if not data.shape: # scalar data = data.item() tree = { - "name": node.name, - "dimensions": node.dimensions, + "name": obj.name, + "dimensions": obj.dimensions, "dtype": dtype, "data": data, - "attrs": node.attrs if node.attrs else None, + "attrs": obj.attrs if obj.attrs else None, } if unit: tree["unit"] = unit return tree - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into custom types. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - Variable : - An instance of the 'Variable' type. - - """ - dtype = np.dtype(tree["dtype"]) + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + dtype = np.dtype(node["dtype"]) # TODO: it would be ideal, if asdf would handle time types natively. if dtype.char in ("M", "m"): # handle np.timedelta64 and np.datetime64 - data = np.array(tree["data"], dtype=dtype) + data = np.array(node["data"], dtype=dtype) # assert data.base is tree["data"] else: - data = tree["data"] # let asdf handle np arrays with its own wrapper. - if "unit" in tree: # convert to pint.Quantity - data = Q_(data, tree["unit"]) + data = node["data"] # let asdf handle np arrays with its own wrapper. + if "unit" in node: # convert to pint.Quantity + data = Q_(data, node["unit"]) - attrs = tree.get("attrs", None) + attrs = node.get("attrs", None) - return Variable(tree["name"], tree["dimensions"], data, attrs) + return Variable(node["name"], node["dimensions"], data, attrs) + + @staticmethod + def shape_from_tagged(node: TaggedDict) -> List[int]: + """Calculate the shape from static tagged tree instance.""" + return _get_instance_shape(node["data"]) diff --git a/weldx/tags/core/data_array.py b/weldx/tags/core/data_array.py new file mode 100644 index 000000000..d1df8e60c --- /dev/null +++ b/weldx/tags/core/data_array.py @@ -0,0 +1,43 @@ +"""Serialization for xarray.DataArray.""" +from xarray import DataArray + +import weldx.tags.core.common_types as ct +from weldx.asdf.types import WeldxConverter + + +class XarrayDataArrayConverter(WeldxConverter): + """Serialization class for xarray.DataArray.""" + + name = "core/data_array" + version = "1.0.0" + types = [DataArray] + + def to_yaml_tree(self, obj: DataArray, tag: str, ctx) -> dict: + """Convert to python dict.""" + attributes = obj.attrs + coordinates = [ + ct.Variable(name, coord_data.dims, coord_data.data, attrs=coord_data.attrs) + for name, coord_data in obj.coords.items() + ] + data = ct.Variable("data", obj.dims, obj.data, attrs={}) + + tree = { + "attributes": attributes, + "coordinates": coordinates, + "data": data, + } + + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Convert basic types representing YAML trees into an `xarray.DataArray`.""" + data = node["data"].data + dims = node["data"].dimensions + coords = {c.name: (c.dimensions, c.data, c.attrs) for c in node["coordinates"]} + attrs = node["attributes"] + + da = DataArray(data=data, coords=coords, dims=dims, attrs=attrs) + da.name = None # we currently do not use the name attribute + # (but since it gets automatically derived if not set, we define it now. + + return da diff --git a/weldx/tags/core/dataset.py b/weldx/tags/core/dataset.py new file mode 100644 index 000000000..c2e6f020d --- /dev/null +++ b/weldx/tags/core/dataset.py @@ -0,0 +1,41 @@ +from xarray import Dataset + +import weldx.tags.core.common_types as ct +from weldx.asdf.types import WeldxConverter + + +class XarrayDatasetConverter(WeldxConverter): + """Serialization class for xarray.Dataset""" + + name = "core/dataset" + version = "1.0.0" + types = [Dataset] + + def to_yaml_tree(self, obj: Dataset, tag: str, ctx) -> dict: + """Convert to python dict.""" + attributes = obj.attrs + coordinates = [ + ct.Variable(name, da.dims, da.data, da.attrs) + for name, da in obj.coords.items() + ] + dimensions = [ct.Dimension(name, length) for name, length in obj.dims.items()] + variables = [ + ct.Variable(name, da.dims, da.data, da.attrs) + for name, da in obj.data_vars.items() + ] + + tree = { + "attributes": attributes, + "coordinates": coordinates, + "dimensions": dimensions, + "variables": variables, + } + + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + data_vars = {v.name: (v.dimensions, v.data, v.attrs) for v in node["variables"]} + coords = {c.name: (c.dimensions, c.data, c.attrs) for c in node["coordinates"]} + + return Dataset(data_vars=data_vars, coords=coords, attrs=node["attributes"]) diff --git a/weldx/asdf/tags/weldx/core/file.py b/weldx/tags/core/file.py similarity index 71% rename from weldx/asdf/tags/weldx/core/file.py rename to weldx/tags/core/file.py index 57669d9a3..63b409c8e 100644 --- a/weldx/asdf/tags/weldx/core/file.py +++ b/weldx/tags/core/file.py @@ -11,7 +11,7 @@ import numpy as np import pandas as pd -from weldx.asdf.types import WeldxType +from weldx.asdf.types import WeldxConverter # Python class ------------------------------------------------------------------------- @@ -136,36 +136,16 @@ def write_to(self, directory: Union[str, Path], file_system=None): # ASDF Serialization ------------------------------------------------------------------- -class FileTypeASDF(WeldxType): +class ExternalFileConverter(WeldxConverter): """Serialization class for `weldx.core.ExternalFile`.""" name = "core/file" version = "1.0.0" types = [ExternalFile] - requires = ["weldx"] - handle_dynamic_subclasses = True - @classmethod - def to_tree(cls, node: ExternalFile, ctx): - """ - Convert an 'weldx.core.ExternalFile' instance into YAML representations. - - Parameters - ---------- - node : - Instance of the 'weldx.core.ExternalFile' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the - 'weldx.core.ExternalFile' type to be serialized. - - """ - tree = deepcopy(node.__dict__) + def to_yaml_tree(self, obj: ExternalFile, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = deepcopy(obj.__dict__) path = tree.pop("path", None) buffer = tree.pop("buffer", None) @@ -175,53 +155,35 @@ def to_tree(cls, node: ExternalFile, ctx): if save_content: if buffer is None: - buffer = node.get_file_content() + buffer = obj.get_file_content() tree["content"] = np.frombuffer(buffer, dtype=np.uint8) if buffer is None: if hash_value is None and path is not None: - hash_value = node.calculate_hash(path, node.hashing_algorithm) + hash_value = obj.calculate_hash(path, obj.hashing_algorithm) else: - hash_value = node.calculate_hash(buffer, node.hashing_algorithm) + hash_value = obj.calculate_hash(buffer, obj.hashing_algorithm) if hash_value is not None: tree["content_hash"] = {"algorithm": algorithm, "value": hash_value} return tree - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into an - 'weldx.core.ExternalFile'. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - weldx.core.ExternalFile : - An instance of the 'weldx.core.ExternalFile' type. - - """ - buffer = tree.pop("content", None) + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + buffer = node.pop("content", None) if buffer is not None: buffer = buffer.tobytes() - tree["buffer"] = buffer + node["buffer"] = buffer - hash_data = tree.pop("content_hash", None) + hash_data = node.pop("content_hash", None) if hash_data is not None: - tree["hashing_algorithm"] = hash_data["algorithm"] - tree["hash"] = hash_data["value"] + node["hashing_algorithm"] = hash_data["algorithm"] + node["hash"] = hash_data["value"] if buffer is not None: - hash_buffer = ExternalFile.calculate_hash(buffer, tree["hashing_algorithm"]) - if hash_buffer != tree["hash"]: # pragma: no cover + hash_buffer = ExternalFile.calculate_hash(buffer, node["hashing_algorithm"]) + if hash_buffer != node["hash"]: # pragma: no cover raise Exception( "The stored hash does not match the stored contents' hash." ) - return ExternalFile(**tree) + return ExternalFile(**node) diff --git a/weldx/asdf/tags/weldx/core/geometry/__init__.py b/weldx/tags/core/geometry/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/core/geometry/__init__.py rename to weldx/tags/core/geometry/__init__.py diff --git a/weldx/asdf/tags/weldx/core/geometry/spatial_data.py b/weldx/tags/core/geometry/spatial_data.py similarity index 57% rename from weldx/asdf/tags/weldx/core/geometry/spatial_data.py rename to weldx/tags/core/geometry/spatial_data.py index 68c6f1f84..384e22152 100644 --- a/weldx/asdf/tags/weldx/core/geometry/spatial_data.py +++ b/weldx/tags/core/geometry/spatial_data.py @@ -6,29 +6,22 @@ from weldx.geometry import SpatialData -def _to_tree_mod(tree): +def _to_yaml_tree_mod(tree): tree = deepcopy(tree) tree["coordinates"] = tree["coordinates"].data return tree -def from_tree_mod(tree): +def _from_yaml_tree_mod(tree): if "coordinates" in tree: tree["coordinates"] = np.asarray(tree["coordinates"]) return tree -SpatialDataTypeASDF = dataclass_serialization_class( +SpatialDataConverter = dataclass_serialization_class( class_type=SpatialData, class_name="core/geometry/spatial_data", version="1.0.0", - to_tree_mod=_to_tree_mod, - from_tree_mod=from_tree_mod, + to_yaml_tree_mod=_to_yaml_tree_mod, + from_yaml_tree_mod=_from_yaml_tree_mod, ) - - -# @classmethod -# def to_tree(cls, node: SpatialData, ctx): -# tree = deepcopy(node.__dict__) -# tree["coordinates"] = tree["coordinates"].data -# return tree diff --git a/weldx/asdf/tags/weldx/core/graph.py b/weldx/tags/core/graph.py similarity index 76% rename from weldx/asdf/tags/weldx/core/graph.py rename to weldx/tags/core/graph.py index 85329a193..e9a2175fc 100644 --- a/weldx/asdf/tags/weldx/core/graph.py +++ b/weldx/tags/core/graph.py @@ -4,7 +4,7 @@ import networkx as nx -from weldx.asdf.types import WeldxType +from weldx.asdf.types import WeldxConverter # DiEdge ------------------------------------------------------------------------------- @@ -17,25 +17,22 @@ class DiEdge: direction: str = "fwd" -class DiEdgeTypeASDF(WeldxType): +class DiEdgeConverter(WeldxConverter): """ASDF type for `DiEdge`.""" name = "core/graph/di_edge" version = "1.0.0" types = [DiEdge] - requires = ["weldx"] - @classmethod - def to_tree(cls, node: DiEdge, ctx): + def to_yaml_tree(self, obj: DiEdge, tag: str, ctx) -> dict: """Convert to python dict.""" - if not node.attributes: - node.attributes = None - return node.__dict__ + if not obj.attributes: + obj.attributes = None + return obj.__dict__ - @classmethod - def from_tree(cls, tree, ctx): - """Reconstruct form tree.""" - return DiEdge(**tree) + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + return DiEdge(**node) # DiNode ------------------------------------------------------------------------------- @@ -48,25 +45,22 @@ class DiNode: attributes: dict = field(default_factory=dict) -class DiNodeTypeASDF(WeldxType): +class DiNodeConverter(WeldxConverter): """ASDF type for `DiNode`.""" name = "core/graph/di_node" version = "1.0.0" types = [DiNode] - requires = ["weldx"] - @classmethod - def to_tree(cls, node: DiNode, ctx): + def to_yaml_tree(self, obj: DiNode, tag: str, ctx) -> dict: """Convert to python dict.""" - if not node.attributes: - node.attributes = None - return node.__dict__ + if not obj.attributes: + obj.attributes = None + return obj.__dict__ - @classmethod - def from_tree(cls, tree, ctx): - """Reconstruct from tree.""" - return DiNode(**tree) + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + return DiNode(**node) # Graph -------------------------------------------------------------------------------- @@ -152,26 +146,23 @@ def build_graph(current_node: DiNode, graph: nx.DiGraph = None) -> nx.DiGraph: return graph -class DiGraphTypeASDF(WeldxType): +class DiGraphConverter(WeldxConverter): """Serialization class for `networkx.DiGraph`.""" name = "core/graph/di_graph" version = "1.0.0" types = [nx.DiGraph] - requires = ["weldx"] - @classmethod - def to_tree(cls, node: nx.DiGraph, ctx): + def to_yaml_tree(self, obj: nx.DiGraph, tag: str, ctx) -> dict: """Check graph structure and build nested dictionary.""" - if not nx.is_tree(node): # no cycles, single tree + if not nx.is_tree(obj): # no cycles, single tree raise ValueError("Graph must represent a tree.") - keep_uuid = getattr(node, "_wx_keep_uuid_name", False) + keep_uuid = getattr(obj, "_wx_keep_uuid_name", False) - root = build_tree(node, tuple(node.nodes)[0], keep_uuid=keep_uuid) + root = build_tree(obj, tuple(obj.nodes)[0], keep_uuid=keep_uuid) return dict(root_node=root) - @classmethod - def from_tree(cls, tree, ctx): + def from_yaml_tree(self, node: dict, tag: str, ctx): """Rebuild directed graph from nested dictionary structure.""" - return build_graph(tree["root_node"]) + return build_graph(node["root_node"]) diff --git a/weldx/tags/core/mathematical_expression.py b/weldx/tags/core/mathematical_expression.py new file mode 100644 index 000000000..b4b592ee4 --- /dev/null +++ b/weldx/tags/core/mathematical_expression.py @@ -0,0 +1,26 @@ +import sympy + +from weldx.asdf.types import WeldxConverter +from weldx.core import MathematicalExpression + +__all__ = ["MathematicalExpression", "MathematicalExpressionConverter"] + + +class MathematicalExpressionConverter(WeldxConverter): + """Serialization class for sympy style math expressions.""" + + name = "core/mathematical_expression" + version = "1.0.0" + types = [MathematicalExpression] + + def to_yaml_tree(self, obj: MathematicalExpression, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = {"expression": obj.expression.__str__(), "parameters": obj.parameters} + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + obj = MathematicalExpression( + sympy.sympify(node["expression"]), parameters=node["parameters"] + ) + return obj diff --git a/weldx/tags/core/time_series.py b/weldx/tags/core/time_series.py new file mode 100644 index 000000000..fa7eff2d5 --- /dev/null +++ b/weldx/tags/core/time_series.py @@ -0,0 +1,55 @@ +"""Contains the serialization class for the weldx.core.TimeSeries.""" +from typing import List + +import numpy as np +import pint +from asdf.tagged import TaggedDict + +from weldx.asdf.types import WeldxConverter +from weldx.constants import Q_ +from weldx.core import TimeSeries + + +class TimeSeriesConverter(WeldxConverter): + """Serialization class for weldx.core.TimeSeries""" + + name = "core/time_series" + version = "1.0.0" + types = [TimeSeries] + + def to_yaml_tree(self, obj: TimeSeries, tag: str, ctx) -> dict: + """Convert to python dict.""" + if isinstance(obj.data, pint.Quantity): + if obj.shape == tuple([1]): # constant + return { + "unit": str(obj.units), + "value": obj.data.magnitude[0], + } + return { + "time": obj.time.as_pandas_index(), + "unit": str(obj.units), + "shape": obj.shape, + "interpolation": obj.interpolation, + "values": obj.data.magnitude, + } + return {"expression": obj.data, "unit": str(obj.units), "shape": obj.shape} + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + if "value" in node: # constant + values = Q_(np.asarray(node["value"]), node["unit"]) + return TimeSeries(values) + if "values" in node: + time = node["time"] + interpolation = node["interpolation"] + values = Q_(node["values"], node["unit"]) + return TimeSeries(values, time, interpolation) + + return TimeSeries(node["expression"]) # mathexpression + + @staticmethod + def shape_from_tagged(node: TaggedDict) -> List[int]: + """Calculate the shape from static tagged tree instance.""" + if "shape" in node: # this should not be reached but lets make sure + return node["shape"] + return [1] # scalar diff --git a/weldx/asdf/tags/weldx/core/transformations/__init__.py b/weldx/tags/core/transformations/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/core/transformations/__init__.py rename to weldx/tags/core/transformations/__init__.py diff --git a/weldx/asdf/tags/weldx/core/transformations/coordinate_system_hierarchy.py b/weldx/tags/core/transformations/coordinate_system_hierarchy.py similarity index 65% rename from weldx/asdf/tags/weldx/core/transformations/coordinate_system_hierarchy.py rename to weldx/tags/core/transformations/coordinate_system_hierarchy.py index 7b904ae6a..17d74151a 100644 --- a/weldx/asdf/tags/weldx/core/transformations/coordinate_system_hierarchy.py +++ b/weldx/tags/core/transformations/coordinate_system_hierarchy.py @@ -4,7 +4,7 @@ from pandas import Timestamp -from weldx.asdf.types import WeldxType +from weldx.asdf.types import WeldxConverter from weldx.transformations import CoordinateSystemManager, LocalCoordinateSystem @@ -17,66 +17,28 @@ class CoordinateTransformation: transformation: LocalCoordinateSystem -class CoordinateTransformationASDF(WeldxType): +class CoordinateTransformationConverter(WeldxConverter): """Serialization class for CoordinateTransformation""" name = "core/transformations/coordinate_transformation" version = "1.0.0" types = [CoordinateTransformation] - requires = ["weldx"] - handle_dynamic_subclasses = True - validators = {} - @classmethod - def to_tree(cls, node: CoordinateTransformation, ctx): - """ - Convert a 'CoordinateTransformation' instance into YAML representations. - - Parameters - ---------- - node : - Instance of the 'CoordinateTransformation' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'CoordinateTransformation' - type to be serialized. - - """ + def to_yaml_tree(self, obj: CoordinateTransformation, tag: str, ctx) -> dict: + """Convert to python dict.""" tree = { - "name": node.name, - "reference_system": node.reference_system, - "transformation": node.transformation, + "name": obj.name, + "reference_system": obj.reference_system, + "transformation": obj.transformation, } return tree - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into a 'CoordinateTransformation'. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - CoordinateTransformation : - An instance of the 'CoordinateTransformation' type. - - """ + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" return CoordinateTransformation( - name=tree["name"], - reference_system=tree["reference_system"], - transformation=tree["transformation"], + name=node["name"], + reference_system=node["reference_system"], + transformation=node["transformation"], ) @@ -97,75 +59,38 @@ def __post_init__(self): self.members = sorted(self.members) -class CoordinateSystemManagerSubsystemASDF(WeldxType): +class CoordinateSystemManagerSubsystemConverter(WeldxConverter): """Serialization class for a CoordinateSystemManagerSubsystem instance""" name = "core/transformations/coordinate_system_hierarchy_subsystem" version = "1.0.0" types = [CoordinateSystemManagerSubsystem] - requires = ["weldx"] - handle_dynamic_subclasses = True - validators = {} - - @classmethod - def to_tree(cls, node: CoordinateSystemManagerSubsystem, ctx): - """Convert a 'CoordinateSystemManagerSubsystem' instance into YAML repr. - Parameters - ---------- - node : - Instance of the 'CoordinateSystemManagerSubsystem' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the - 'CoordinateSystemManagerSubsystem' type to be serialized. - - """ + def to_yaml_tree( + self, obj: CoordinateSystemManagerSubsystem, tag: str, ctx + ) -> dict: + """Convert to python dict.""" tree = { - "name": node.name, - "root_cs": node.root_cs, - "reference_time": node.reference_time, - "parent_system": node.parent_system, - "subsystem_names": node.subsystems, - "members": node.members, + "name": obj.name, + "root_cs": obj.root_cs, + "reference_time": obj.reference_time, + "parent_system": obj.parent_system, + "subsystem_names": obj.subsystems, + "members": obj.members, } return tree - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts YAML trees into a 'CoordinateSystemManagerSubsystem'. + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + return node - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - Returns - ------- - CoordinateSystemManagerSubsystem : - An instance of the 'CoordinateSystemManagerSubsystem - """ - return tree - - -class CoordinateSystemManagerASDF(WeldxType): +class CoordinateSystemManagerConverter(WeldxConverter): """Serialization class for weldx.transformations.LocalCoordinateSystem""" name = "core/transformations/coordinate_system_hierarchy" version = "1.0.0" types = [CoordinateSystemManager] - requires = ["weldx"] - handle_dynamic_subclasses = True - validators = {} @classmethod def _extract_all_subsystems( @@ -366,26 +291,9 @@ def _add_coordinate_systems_to_manager( leaf_nodes = leaf_nodes_next lcs_data_list = lcs_data_list_next - @classmethod - def to_tree(cls, node: CoordinateSystemManager, ctx): - """Convert a 'CoordinateSystemManager' instance into YAML representations. - - Parameters - ---------- - node : - Instance of the 'CoordinateSystemManager' type to be serialized. - - ctx : - An instance of the 'AsdfFile' object that is being written out. - - Returns - ------- - A basic YAML type ('dict', 'list', 'str', 'int', 'float', or - 'complex') representing the properties of the 'CoordinateSystemManager' - type to be serialized. - - """ - graph = deepcopy(node.graph) # TODO: Check if deepcopy is necessary + def to_yaml_tree(self, obj: CoordinateSystemManager, tag: str, ctx) -> dict: + """Convert to python dict.""" + graph = deepcopy(obj.graph) # TODO: Check if deepcopy is necessary # remove automatically computed edges (inverted directions) remove_edges = [] @@ -404,58 +312,41 @@ def to_tree(cls, node: CoordinateSystemManager, ctx): ) ] - subsystem_data = cls._extract_subsystem_data(node) + subsystem_data = self._extract_subsystem_data(obj) subsystems = [ subsystem.name for subsystem in subsystem_data - if subsystem.parent_system == node.name + if subsystem.parent_system == obj.name ] spatial_data = None - if len(node._data) > 0: + if len(obj._data) > 0: spatial_data = [ dict(name=k, coordinate_system=v.coordinate_system_name, data=v.data) - for k, v in node._data.items() + for k, v in obj._data.items() ] tree = { - "name": node.name, - "reference_time": node.reference_time, + "name": obj.name, + "reference_time": obj.reference_time, "subsystem_names": subsystems, "subsystems": subsystem_data, - "root_system_name": node.root_system_name, + "root_system_name": obj.root_system_name, "coordinate_systems": coordinate_system_data, "spatial_data": spatial_data, } return tree - @classmethod - def from_tree(cls, tree, ctx): - """ - Converts basic types representing YAML trees into a 'CoordinateSystemManager'. - - Parameters - ---------- - tree : - An instance of a basic Python type (possibly nested) that - corresponds to a YAML subtree. - ctx : - An instance of the 'AsdfFile' object that is being constructed. - - Returns - ------- - CoordinateSystemManager : - An instance of the 'CoordinateSystemManager' type. - - """ + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" reference_time = None - if "reference_time" in tree: - reference_time = tree["reference_time"] + if "reference_time" in node: + reference_time = node["reference_time"] csm = CoordinateSystemManager( - tree["root_system_name"], tree["name"], time_ref=reference_time + node["root_system_name"], node["name"], time_ref=reference_time ) - subsystem_data_list = tree["subsystems"] + subsystem_data_list = node["subsystems"] for subsystem_data in subsystem_data_list: subsystem_reference_time = None @@ -468,10 +359,10 @@ def from_tree(cls, tree, ctx): ) subsystem_data["lcs"] = [] - cls._add_coordinate_systems_to_subsystems(tree, csm, subsystem_data_list) - cls._merge_subsystems(tree, csm, subsystem_data_list) + self._add_coordinate_systems_to_subsystems(node, csm, subsystem_data_list) + self._merge_subsystems(node, csm, subsystem_data_list) - if (spatial_data := tree.get("spatial_data")) is not None: + if (spatial_data := node.get("spatial_data")) is not None: for item in spatial_data: csm.assign_data(item["data"], item["name"], item["coordinate_system"]) diff --git a/weldx/tags/core/transformations/local_coordinate_system.py b/weldx/tags/core/transformations/local_coordinate_system.py new file mode 100644 index 000000000..dc92bfac0 --- /dev/null +++ b/weldx/tags/core/transformations/local_coordinate_system.py @@ -0,0 +1,66 @@ +from weldx.asdf.types import WeldxConverter +from weldx.core import TimeSeries +from weldx.tags.core.common_types import Variable +from weldx.transformations import LocalCoordinateSystem + + +class LocalCoordinateSystemConverter(WeldxConverter): + """Serialization class for weldx.transformations.LocalCoordinateSystem""" + + name = "core/transformations/local_coordinate_system" + version = "1.0.0" + types = [LocalCoordinateSystem] + + def to_yaml_tree(self, obj: LocalCoordinateSystem, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = {} + + orientations = None + if not obj.is_unity_rotation: + orientations = Variable( + "orientations", obj.orientation.dims, obj.orientation.data + ) + # TODO: restore inlining + # if "time" not in node.orientation.coords: + # ctx.set_array_storage(orientations.data, "inline") + tree["orientations"] = orientations + + coordinates = None + if isinstance(obj.coordinates, TimeSeries): + tree["coordinates"] = obj.coordinates + elif not obj.is_unity_translation: + coordinates = Variable( + "coordinates", obj.coordinates.dims, obj.coordinates.data + ) + # TODO: restore inlining + # if "time" not in node.coordinates.coords: + # if isinstance(coordinates.data, pint.Quantity): + # ctx.set_array_storage(coordinates.data.magnitude, "inline") + # else: + # ctx.set_array_storage(coordinates.data, "inline") + tree["coordinates"] = coordinates + + if "time" in obj.dataset.coords: + tree["time"] = obj.time.as_timedelta_index() + + if obj.reference_time is not None: + tree["reference_time"] = obj.reference_time + + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + orientations = node.get("orientations") + if orientations is not None: + orientations = orientations.data + + coordinates = node.get("coordinates") + if coordinates is not None and not isinstance(coordinates, TimeSeries): + coordinates = node["coordinates"].data + + return LocalCoordinateSystem( + orientation=orientations, + coordinates=coordinates, + time=node.get("time"), + time_ref=node.get("reference_time"), + ) diff --git a/weldx/tags/core/transformations/rotation.py b/weldx/tags/core/transformations/rotation.py new file mode 100644 index 000000000..560857bcc --- /dev/null +++ b/weldx/tags/core/transformations/rotation.py @@ -0,0 +1,63 @@ +import numpy as np +from scipy.spatial.transform import Rotation + +from weldx.asdf.types import WeldxConverter +from weldx.constants import Q_ +from weldx.transformations.rotation import WXRotation + + +class WXRotationConverter(WeldxConverter): + """Serialization class for the 'Scipy.Rotation' type""" + + name = "core/transformations/rotation" + version = "1.0.0" + types = [Rotation, WXRotation] + + def to_yaml_tree(self, obj: Rotation, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = {} + + if not hasattr(obj, "wx_meta"): # default to quaternion representation + tree["quaternions"] = obj.as_quat() + elif obj.wx_meta["constructor"] == "from_quat": + tree["quaternions"] = obj.as_quat() + elif obj.wx_meta["constructor"] == "from_matrix": + tree["matrix"] = obj.as_matrix() + elif obj.wx_meta["constructor"] == "from_rotvec": + tree["rotvec"] = obj.as_rotvec() + elif obj.wx_meta["constructor"] == "from_euler": + seq_str = obj.wx_meta["seq"] + if not len(seq_str) == 3: + if all(c in "xyz" for c in seq_str): + seq_str = seq_str + "".join([c for c in "xyz" if c not in seq_str]) + elif all(c in "XYZ" for c in seq_str): + seq_str = seq_str + "".join([c for c in "XYZ" if c not in seq_str]) + else: # pragma: no cover + raise ValueError("Mix of intrinsic and extrinsic euler angles.") + + angles = obj.as_euler(seq_str, degrees=obj.wx_meta["degrees"]) + angles = np.squeeze(angles[..., : len(obj.wx_meta["seq"])]) + + if obj.wx_meta["degrees"]: + angles = Q_(angles, "degree") + else: + angles = Q_(angles, "rad") + + tree["sequence"] = obj.wx_meta["seq"] + tree["angles"] = angles + + else: # pragma: no cover + raise NotImplementedError("unknown or missing constructor") + + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct from tree.""" + if "quaternions" in node: + return WXRotation.from_quat(node["quaternions"]) + if "matrix" in node: + return WXRotation.from_matrix(node["matrix"]) + if "rotvec" in node: + return WXRotation.from_rotvec(node["rotvec"]) + if "angles" in node: + return WXRotation.from_euler(seq=node["sequence"], angles=node["angles"]) diff --git a/weldx/tags/debug/__init__.py b/weldx/tags/debug/__init__.py new file mode 100644 index 000000000..b22728f80 --- /dev/null +++ b/weldx/tags/debug/__init__.py @@ -0,0 +1 @@ +from . import test_property_tag, test_shape_validator, test_unit_validator diff --git a/weldx/tags/debug/test_property_tag.py b/weldx/tags/debug/test_property_tag.py new file mode 100644 index 000000000..17d374c3d --- /dev/null +++ b/weldx/tags/debug/test_property_tag.py @@ -0,0 +1,23 @@ +from dataclasses import dataclass + +import pandas as pd + +from weldx.asdf.util import dataclass_serialization_class + +__all__ = ["PropertyTagTestClass", "PropertyTagTestClassConverter"] + + +@dataclass +class PropertyTagTestClass: + """Helper class to test the shape validator""" + + prop1: pd.Timestamp = pd.Timestamp("2020-01-01") + prop2: pd.Timestamp = pd.Timestamp("2020-01-02") + prop3: pd.Timestamp = pd.Timestamp("2020-01-03") + + +PropertyTagTestClassConverter = dataclass_serialization_class( + class_type=PropertyTagTestClass, + class_name="debug/test_property_tag", + version="1.0.0", +) diff --git a/weldx/asdf/tags/weldx/debug/test_shape_validator.py b/weldx/tags/debug/test_shape_validator.py similarity index 79% rename from weldx/asdf/tags/weldx/debug/test_shape_validator.py rename to weldx/tags/debug/test_shape_validator.py index dd0087b8c..4ad2e3742 100644 --- a/weldx/asdf/tags/weldx/debug/test_shape_validator.py +++ b/weldx/tags/debug/test_shape_validator.py @@ -6,9 +6,8 @@ from weldx import Q_, TimeSeries from weldx.asdf.util import dataclass_serialization_class -from weldx.asdf.validators import wx_shape_validator -__all__ = ["ShapeValidatorTestClass", "ShapeValidatorTestClassType"] +__all__ = ["ShapeValidatorTestClass", "ShapeValidatorTestClassConverter"] @dataclass @@ -32,11 +31,8 @@ class ShapeValidatorTestClass: optional_prop: np.ndarray = None -ShapeValidatorTestClassType = dataclass_serialization_class( +ShapeValidatorTestClassConverter = dataclass_serialization_class( class_type=ShapeValidatorTestClass, class_name="debug/test_shape_validator", version="1.0.0", - validators={ - "wx_shape": wx_shape_validator, - }, ) diff --git a/weldx/asdf/tags/weldx/debug/test_unit_validator.py b/weldx/tags/debug/test_unit_validator.py similarity index 75% rename from weldx/asdf/tags/weldx/debug/test_unit_validator.py rename to weldx/tags/debug/test_unit_validator.py index c65232c2d..f8f81d6c8 100644 --- a/weldx/asdf/tags/weldx/debug/test_unit_validator.py +++ b/weldx/tags/debug/test_unit_validator.py @@ -5,9 +5,8 @@ from weldx import Q_ from weldx.asdf.util import dataclass_serialization_class -from weldx.asdf.validators import wx_unit_validator -__all__ = ["UnitValidatorTestClass", "UnitValidatorTestClassType"] +__all__ = ["UnitValidatorTestClass", "UnitValidatorTestClassConverter"] @dataclass @@ -23,11 +22,8 @@ class UnitValidatorTestClass: simple_prop: dict = field(default_factory=lambda: dict(value=float(3), unit="m")) -UnitValidatorTestClassType = dataclass_serialization_class( +UnitValidatorTestClassConverter = dataclass_serialization_class( class_type=UnitValidatorTestClass, class_name="debug/test_unit_validator", version="1.0.0", - validators={ - "wx_unit": wx_unit_validator, - }, ) diff --git a/weldx/asdf/tags/weldx/equipment/__init__.py b/weldx/tags/equipment/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/equipment/__init__.py rename to weldx/tags/equipment/__init__.py diff --git a/weldx/asdf/tags/weldx/equipment/measurement_equipment.py b/weldx/tags/equipment/measurement_equipment.py similarity index 59% rename from weldx/asdf/tags/weldx/equipment/measurement_equipment.py rename to weldx/tags/equipment/measurement_equipment.py index 755956999..df43009d7 100644 --- a/weldx/asdf/tags/weldx/equipment/measurement_equipment.py +++ b/weldx/tags/equipment/measurement_equipment.py @@ -1,18 +1,18 @@ from weldx.asdf.util import dataclass_serialization_class from weldx.measurement import MeasurementEquipment -__all__ = ["MeasurementEquipment", "MeasurementEquipmentType"] +__all__ = ["MeasurementEquipment", "MeasurementEquipmentConverter"] -def _from_tree_mod(tree): +def _from_yaml_tree_mod(tree): if "sources" not in tree: tree["sources"] = None return tree -MeasurementEquipmentType = dataclass_serialization_class( +MeasurementEquipmentConverter = dataclass_serialization_class( class_type=MeasurementEquipment, class_name="equipment/measurement_equipment", version="1.0.0", - from_tree_mod=_from_tree_mod, + from_yaml_tree_mod=_from_yaml_tree_mod, ) diff --git a/weldx/asdf/tags/weldx/groove/__init__.py b/weldx/tags/groove/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/groove/__init__.py rename to weldx/tags/groove/__init__.py diff --git a/weldx/tags/groove/iso_9692_1.py b/weldx/tags/groove/iso_9692_1.py new file mode 100644 index 000000000..1dbb5888c --- /dev/null +++ b/weldx/tags/groove/iso_9692_1.py @@ -0,0 +1,50 @@ +"""ISO 9692-1 welding groove type definitions""" + +from asdf.util import uri_match + +from weldx.asdf.types import WeldxConverter, format_tag +from weldx.asdf.util import get_weldx_extension +from weldx.welding.groove.iso_9692_1 import IsoBaseGroove, _groove_name_to_type + +__all__ = ["IsoGrooveConverter"] + +_ISO_GROOVE_SCHEMA = "groove/iso_9692_1_2013_12/" + + +def _get_class_from_tag(instance_tag: str): + groove_tag = instance_tag.rpartition("/iso_9692_1_2013_12/")[-1] + return groove_tag.rpartition("-")[0] + + +class IsoGrooveConverter(WeldxConverter): + """ASDF Groove type.""" + + tags = [ + format_tag(tag_name=_ISO_GROOVE_SCHEMA + g, version="1.*") + for g in _groove_name_to_type.keys() + ] + types = IsoBaseGroove.__subclasses__() + + def to_yaml_tree(self, obj: IsoBaseGroove, tag: str, ctx) -> dict: + """Convert to python dict.""" + return obj.__dict__ + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Convert from yaml node and tag to a groove.""" + groove_name = _get_class_from_tag(tag) + groove = _groove_name_to_type[groove_name](**node) + return groove + + def select_tag(self, obj, tags, ctx): + """Select the highest supported new style tag according to groove name.""" + _snip = _ISO_GROOVE_SCHEMA + type(obj).__name__ + # select only new style tags + selection = [tag for tag in self.tags if tag.startswith("asdf://")] + # select the matching pattern + selection = [tag for tag in selection if _snip in tag] + if not len(selection) == 1: + raise ValueError("Found multiple groove tags for selection.") + + ext = get_weldx_extension(ctx) + tag = [t.tag_uri for t in ext.tags if uri_match(selection[0], t.tag_uri)] + return tag[0] diff --git a/weldx/asdf/tags/weldx/measurement/__init__.py b/weldx/tags/measurement/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/measurement/__init__.py rename to weldx/tags/measurement/__init__.py diff --git a/weldx/asdf/tags/weldx/measurement/error.py b/weldx/tags/measurement/error.py similarity index 66% rename from weldx/asdf/tags/weldx/measurement/error.py rename to weldx/tags/measurement/error.py index 9039218ef..0a6defbc4 100644 --- a/weldx/asdf/tags/weldx/measurement/error.py +++ b/weldx/tags/measurement/error.py @@ -1,9 +1,9 @@ from weldx.asdf.util import dataclass_serialization_class from weldx.measurement import Error -__all__ = ["Error", "ErrorType"] +__all__ = ["Error", "ErrorConverter"] -ErrorType = dataclass_serialization_class( +ErrorConverter = dataclass_serialization_class( class_type=Error, class_name="measurement/error", version="1.0.0" ) diff --git a/weldx/asdf/tags/weldx/measurement/measurement.py b/weldx/tags/measurement/measurement.py similarity index 64% rename from weldx/asdf/tags/weldx/measurement/measurement.py rename to weldx/tags/measurement/measurement.py index 9bc685b85..26b3ced9b 100644 --- a/weldx/asdf/tags/weldx/measurement/measurement.py +++ b/weldx/tags/measurement/measurement.py @@ -1,9 +1,9 @@ from weldx.asdf.util import dataclass_serialization_class from weldx.measurement import Measurement -__all__ = ["Measurement", "MeasurementType"] +__all__ = ["Measurement", "MeasurementConverter"] -MeasurementType = dataclass_serialization_class( +MeasurementConverter = dataclass_serialization_class( class_type=Measurement, class_name="measurement/measurement", version="1.0.0" ) diff --git a/weldx/tags/measurement/measurement_chain.py b/weldx/tags/measurement/measurement_chain.py new file mode 100644 index 000000000..81ced19d9 --- /dev/null +++ b/weldx/tags/measurement/measurement_chain.py @@ -0,0 +1,23 @@ +from weldx.asdf.types import WeldxConverter +from weldx.measurement import MeasurementChain + +__all__ = [ + "MeasurementChain", + "MeasurementChainConverter", +] + + +class MeasurementChainConverter(WeldxConverter): + """Serialization class for measurement chains""" + + name = "measurement/measurement_chain" + version = "1.0.0" + types = [MeasurementChain] + + def to_yaml_tree(self, obj: MeasurementChain, tag: str, ctx) -> dict: + """Convert to python dict.""" + return obj.to_dict() + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Reconstruct from tree.""" + return MeasurementChain.from_dict(node) diff --git a/weldx/asdf/tags/weldx/measurement/signal.py b/weldx/tags/measurement/signal.py similarity index 60% rename from weldx/asdf/tags/weldx/measurement/signal.py rename to weldx/tags/measurement/signal.py index 2c57c8d29..a3be96c67 100644 --- a/weldx/asdf/tags/weldx/measurement/signal.py +++ b/weldx/tags/measurement/signal.py @@ -1,18 +1,18 @@ from weldx.asdf.util import dataclass_serialization_class from weldx.measurement import Signal -__all__ = ["Signal", "SignalType"] +__all__ = ["Signal", "SignalConverter"] -def _from_tree_mod(tree): +def _from_yaml_tree_mod(tree): if "data" not in tree: tree["data"] = None return tree -SignalType = dataclass_serialization_class( +SignalConverter = dataclass_serialization_class( class_type=Signal, class_name="measurement/signal", version="1.0.0", - from_tree_mod=_from_tree_mod, + from_yaml_tree_mod=_from_yaml_tree_mod, ) diff --git a/weldx/asdf/tags/weldx/measurement/signal_transformation.py b/weldx/tags/measurement/signal_transformation.py similarity index 63% rename from weldx/asdf/tags/weldx/measurement/signal_transformation.py rename to weldx/tags/measurement/signal_transformation.py index ceb7b1d05..3e9517557 100644 --- a/weldx/asdf/tags/weldx/measurement/signal_transformation.py +++ b/weldx/tags/measurement/signal_transformation.py @@ -1,10 +1,10 @@ from weldx.asdf.util import dataclass_serialization_class from weldx.measurement import SignalTransformation -__all__ = ["SignalTransformation", "SignalTransformationType"] +__all__ = ["SignalTransformation", "SignalTransformationConverter"] -SignalTransformationType = dataclass_serialization_class( +SignalTransformationConverter = dataclass_serialization_class( class_type=SignalTransformation, class_name="measurement/signal_transformation", version="1.0.0", diff --git a/weldx/asdf/tags/weldx/measurement/source.py b/weldx/tags/measurement/source.py similarity index 63% rename from weldx/asdf/tags/weldx/measurement/source.py rename to weldx/tags/measurement/source.py index c7435e004..4427b7fbd 100644 --- a/weldx/asdf/tags/weldx/measurement/source.py +++ b/weldx/tags/measurement/source.py @@ -1,9 +1,9 @@ from weldx.asdf.util import dataclass_serialization_class from weldx.measurement import SignalSource -__all__ = ["SignalSource", "SignalSourceType"] +__all__ = ["SignalSource", "SignalSourceConverter"] -SignalSourceType = dataclass_serialization_class( +SignalSourceConverter = dataclass_serialization_class( class_type=SignalSource, class_name="measurement/source", version="1.0.0" ) diff --git a/weldx/asdf/tags/weldx/processes/__init__.py b/weldx/tags/processes/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/processes/__init__.py rename to weldx/tags/processes/__init__.py diff --git a/weldx/tags/processes/process.py b/weldx/tags/processes/process.py new file mode 100644 index 000000000..adc37b7d0 --- /dev/null +++ b/weldx/tags/processes/process.py @@ -0,0 +1,32 @@ +"""Welding process ASDF classes.""" + +from weldx.asdf.types import WeldxConverter, format_tag +from weldx.welding.processes import GmawProcess + +__all__ = ["GmawProcessConverter"] + + +class GmawProcessConverter(WeldxConverter): + """Custom serialization class for GmawProcess.""" + + tags = [ + "asdf://weldx.bam.de/weldx/tags/process/GMAW-1.0.0", + "asdf://weldx.bam.de/weldx/tags/process/CLOOS/spray_arc-1.0.0", + "asdf://weldx.bam.de/weldx/tags/process/CLOOS/pulse-1.0.0", + ] + types = [GmawProcess] + + def to_yaml_tree(self, obj: GmawProcess, tag: str, ctx) -> dict: + """Convert to python dict.""" + return obj.__dict__ + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Convert from yaml node.""" + return GmawProcess(**node) + + def select_tag(self, obj: GmawProcess, tags, ctx): + """Select new style tag according to groove name.""" + tag = format_tag(tag_name="process/" + obj.tag, version="1.0.0") + if tag not in self.tags: + raise ValueError("The generated process tag is not supported") + return tag diff --git a/weldx/tags/time/__init__.py b/weldx/tags/time/__init__.py new file mode 100644 index 000000000..cc4f76c22 --- /dev/null +++ b/weldx/tags/time/__init__.py @@ -0,0 +1 @@ +from . import datetimeindex, time, timedelta, timedeltaindex, timestamp diff --git a/weldx/tags/time/datetimeindex.py b/weldx/tags/time/datetimeindex.py new file mode 100644 index 000000000..e19769fc1 --- /dev/null +++ b/weldx/tags/time/datetimeindex.py @@ -0,0 +1,51 @@ +from typing import List + +import numpy as np +import pandas as pd +from asdf.tagged import TaggedDict + +from weldx.asdf.types import WeldxConverter + +__all__ = ["DatetimeIndexConverter"] + + +class DatetimeIndexConverter(WeldxConverter): + """A simple implementation of serializing pandas DatetimeIndex.""" + + name = "time/datetimeindex" + version = "1.0.0" + types = [pd.DatetimeIndex] + + def to_yaml_tree(self, obj: pd.DatetimeIndex, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = {} + if obj.inferred_freq is not None: + tree["freq"] = obj.inferred_freq + else: + tree["values"] = obj.values.astype(np.int64) + + tree["start"] = obj[0] + tree["end"] = obj[-1] + tree["min"] = obj.min() + tree["max"] = obj.max() + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct DatetimeIndex from tree.""" + if "freq" in node: + return pd.date_range( + start=node["start"], end=node["end"], freq=node["freq"] + ) + return pd.DatetimeIndex(node["values"]) + + @staticmethod + def shape_from_tagged(node: TaggedDict) -> List[int]: + """Calculate the shape (length of TDI) from static tagged tree instance.""" + if "freq" in node: + temp = pd.date_range( + start=node["start"]["value"], + end=node["end"]["value"], + freq=node["freq"], + ) + return [len(temp)] + return node["values"]["shape"] diff --git a/weldx/tags/time/time.py b/weldx/tags/time/time.py new file mode 100644 index 000000000..991d776e0 --- /dev/null +++ b/weldx/tags/time/time.py @@ -0,0 +1,23 @@ +from weldx.asdf.types import WeldxConverter +from weldx.time import Time + +__all__ = ["TimeConverter"] + + +class TimeConverter(WeldxConverter): + """A simple implementation of serializing a Time instance.""" + + name = "time/time" + version = "1.0.0" + types = [Time] + + def to_yaml_tree(self, obj: Time, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = dict() + tree["values"] = obj.as_pandas() + tree["reference_time"] = obj._time_ref + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct Time from tree.""" + return Time(node["values"], node.get("reference_time")) diff --git a/weldx/tags/time/timedelta.py b/weldx/tags/time/timedelta.py new file mode 100644 index 000000000..9d44991bb --- /dev/null +++ b/weldx/tags/time/timedelta.py @@ -0,0 +1,20 @@ +import pandas as pd + +from weldx.asdf.types import WeldxConverter + +__all__ = ["TimedeltaConverter"] + + +class TimedeltaConverter(WeldxConverter): + """A simple implementation of serializing a single pandas Timedelta.""" + + tags = ["asdf://weldx.bam.de/weldx/tags/time/timedelta-1.*"] + types = [pd.Timedelta] + + def to_yaml_tree(self, obj: pd.Timedelta, tag, ctx) -> dict: + """Convert to python dict.""" + return dict(value=obj.isoformat()) + + def from_yaml_tree(self, node, tag, ctx): + """Construct timedelta from tree.""" + return pd.Timedelta(node["value"]) diff --git a/weldx/tags/time/timedeltaindex.py b/weldx/tags/time/timedeltaindex.py new file mode 100644 index 000000000..5511c12bf --- /dev/null +++ b/weldx/tags/time/timedeltaindex.py @@ -0,0 +1,53 @@ +from typing import List + +import numpy as np +import pandas as pd +from asdf.tagged import TaggedDict + +from weldx.asdf.types import WeldxConverter + +__all__ = ["TimedeltaIndexConverter"] + + +class TimedeltaIndexConverter(WeldxConverter): + """A simple implementation of serializing pandas TimedeltaIndex.""" + + name = "time/timedeltaindex" + version = "1.0.0" + types = [pd.TimedeltaIndex] + + def to_yaml_tree(self, obj: pd.TimedeltaIndex, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = {} + if obj.inferred_freq is not None: + tree["freq"] = obj.inferred_freq + else: + tree["values"] = obj.values.astype(np.int64) + + tree["start"] = obj[0] + tree["end"] = obj[-1] + tree["min"] = obj.min() + tree["max"] = obj.max() + + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct TimedeltaIndex from tree.""" + if "freq" in node: + return pd.timedelta_range( + start=node["start"], end=node["end"], freq=node["freq"] + ) + values = node["values"] + return pd.TimedeltaIndex(values) + + @staticmethod + def shape_from_tagged(node: TaggedDict) -> List[int]: + """Calculate the shape from static tagged tree instance.""" + if "freq" in node: + tdi_temp = pd.timedelta_range( + start=node["start"]["value"], + end=node["end"]["value"], + freq=node["freq"], + ) + return [len(tdi_temp)] + return node["values"]["shape"] diff --git a/weldx/tags/time/timestamp.py b/weldx/tags/time/timestamp.py new file mode 100644 index 000000000..a78f308e8 --- /dev/null +++ b/weldx/tags/time/timestamp.py @@ -0,0 +1,23 @@ +import pandas as pd + +from weldx.asdf.types import WeldxConverter + +__all__ = ["TimestampConverter"] + + +class TimestampConverter(WeldxConverter): + """A simple implementation of serializing a single pandas Timestamp.""" + + name = "time/timestamp" + version = "1.0.0" + types = [pd.Timestamp] + + def to_yaml_tree(self, obj: pd.Timestamp, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = {} + tree["value"] = obj.isoformat() + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Construct timestamp from tree.""" + return pd.Timestamp(node["value"]) diff --git a/weldx/asdf/tags/weldx/unit/__init__.py b/weldx/tags/unit/__init__.py similarity index 100% rename from weldx/asdf/tags/weldx/unit/__init__.py rename to weldx/tags/unit/__init__.py diff --git a/weldx/tags/unit/pint_quantity.py b/weldx/tags/unit/pint_quantity.py new file mode 100644 index 000000000..cf26241dd --- /dev/null +++ b/weldx/tags/unit/pint_quantity.py @@ -0,0 +1,37 @@ +from typing import List + +import pint +from asdf.tagged import TaggedDict + +from weldx.asdf.types import WeldxConverter +from weldx.asdf.util import _get_instance_shape +from weldx.constants import Q_ + + +class PintQuantityConverter(WeldxConverter): + """A simple implementation of serializing a pint quantity as asdf quantity.""" + + tags = ["tag:stsci.edu:asdf/unit/quantity-1.*"] + types = ["pint.quantity.build_quantity_class..Quantity"] + + def to_yaml_tree(self, obj: pint.Quantity, tag: str, ctx) -> dict: + """Convert to python dict.""" + tree = {} + value = obj.magnitude + if not value.shape: + value = value.item() # convert scalars to native Python numeric types + tree["value"] = value + tree["unit"] = str(obj.units) + return tree + + def from_yaml_tree(self, node: dict, tag: str, ctx): + """Reconstruct from tree.""" + quantity = Q_(node["value"], node["unit"]) + return quantity + + @staticmethod + def shape_from_tagged(node: TaggedDict) -> List[int]: + """Calculate the shape from static tagged tree instance.""" + if isinstance(node["value"], dict): # ndarray + return _get_instance_shape(node["value"]) + return [1] # scalar diff --git a/weldx/tests/asdf_tests/test_asdf_aws_schema.py b/weldx/tests/asdf_tests/test_asdf_aws_schema.py index de7e228b5..83ccfc889 100644 --- a/weldx/tests/asdf_tests/test_asdf_aws_schema.py +++ b/weldx/tests/asdf_tests/test_asdf_aws_schema.py @@ -1,26 +1,25 @@ """Test ASDF serialization of AWS schema definitions.""" import pytest +from weldx.asdf.util import write_read_buffer +from weldx.constants import Q_ + # weld design ----------------------------------------------------------------- -from weldx.asdf.tags.weldx.aws.design.base_metal import BaseMetal -from weldx.asdf.tags.weldx.aws.design.connection import Connection +from weldx.tags.aws.design.base_metal import BaseMetal +from weldx.tags.aws.design.connection import Connection # weld design ----------------------------------------------------------------- -from weldx.asdf.tags.weldx.aws.design.joint_penetration import JointPenetration -from weldx.asdf.tags.weldx.aws.design.sub_assembly import SubAssembly -from weldx.asdf.tags.weldx.aws.design.weld_details import WeldDetails -from weldx.asdf.tags.weldx.aws.design.weldment import Weldment -from weldx.asdf.tags.weldx.aws.design.workpiece import Workpiece +from weldx.tags.aws.design.joint_penetration import JointPenetration +from weldx.tags.aws.design.sub_assembly import SubAssembly +from weldx.tags.aws.design.weld_details import WeldDetails +from weldx.tags.aws.design.weldment import Weldment +from weldx.tags.aws.design.workpiece import Workpiece # welding process ----------------------------------------------------------------- -from weldx.asdf.tags.weldx.aws.process.arc_welding_process import ArcWeldingProcess -from weldx.asdf.tags.weldx.aws.process.gas_component import GasComponent -from weldx.asdf.tags.weldx.aws.process.shielding_gas_for_procedure import ( - ShieldingGasForProcedure, -) -from weldx.asdf.tags.weldx.aws.process.shielding_gas_type import ShieldingGasType -from weldx.asdf.util import write_read_buffer -from weldx.constants import Q_ +from weldx.tags.aws.process.arc_welding_process import ArcWeldingProcess +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.util import compare_nested # iso groove ----------------------------------------------------------------- diff --git a/weldx/tests/asdf_tests/test_asdf_core.py b/weldx/tests/asdf_tests/test_asdf_core.py index bff66f58e..88ae9c8a8 100644 --- a/weldx/tests/asdf_tests/test_asdf_core.py +++ b/weldx/tests/asdf_tests/test_asdf_core.py @@ -13,12 +13,12 @@ from scipy.spatial.transform import Rotation import weldx.transformations as tf -from weldx.asdf.tags.weldx.core.file import ExternalFile from weldx.asdf.util import write_buffer, write_read_buffer from weldx.constants import Q_ from weldx.core import MathematicalExpression as ME # nopep8 from weldx.core import TimeSeries from weldx.geometry import SpatialData +from weldx.tags.core.file import ExternalFile from weldx.tests._helpers import get_test_name from weldx.transformations import WXRotation diff --git a/weldx/tests/asdf_tests/test_asdf_util.py b/weldx/tests/asdf_tests/test_asdf_util.py index 4369333b0..279be187f 100644 --- a/weldx/tests/asdf_tests/test_asdf_util.py +++ b/weldx/tests/asdf_tests/test_asdf_util.py @@ -45,18 +45,18 @@ def test_get_yaml_header(create_file_and_buffer, index, parse): assert "asdf_library" in header -def _to_tree_mod(tree): +def _to_yaml_tree_mod(tree): tree["a"] += ["d"] return tree -def _from_tree_mod(tree): +def _from_yaml_tree_mod(tree): tree["a"] += ["e"] return tree @pytest.mark.parametrize( - "val_a, exp_val_a_tree, exp_val_a_dc, to_tree_mod, from_tree_mod," + "val_a, exp_val_a_tree, exp_val_a_dc, to_yaml_tree_mod, from_yaml_tree_mod," "sort_string_lists", [ (["c", "b", "a"], ["a", "b", "c"], ["a", "b", "c"], None, None, True), @@ -64,41 +64,52 @@ def _from_tree_mod(tree): # not a pure string list -> no sorting (["c", 1, "a"], ["c", 1, "a"], ["c", 1, "a"], None, None, True), (["c", 1, "a"], ["c", 1, "a"], ["c", 1, "a"], None, None, False), - # check to_tree_mod is called - (["c", "b"], ["b", "c", "d"], ["b", "c", "d"], _to_tree_mod, None, True), - (["c", "b"], ["c", "b", "d"], ["c", "b", "d"], _to_tree_mod, None, False), - # check_from_tree_mod is called - (["c"], ["c", "d"], ["c", "d", "e"], _to_tree_mod, _from_tree_mod, False), - (["c"], ["c"], ["c", "e"], None, _from_tree_mod, False), + # check to_yaml_tree_mod is called + (["c", "b"], ["b", "c", "d"], ["b", "c", "d"], _to_yaml_tree_mod, None, True), + (["c", "b"], ["c", "b", "d"], ["c", "b", "d"], _to_yaml_tree_mod, None, False), + # check_from_yaml_tree_mod is called + ( + ["c"], + ["c", "d"], + ["c", "d", "e"], + _to_yaml_tree_mod, + _from_yaml_tree_mod, + False, + ), + (["c"], ["c"], ["c", "e"], None, _from_yaml_tree_mod, False), ], ) def test_dataclass_serialization_class( - val_a, exp_val_a_tree, exp_val_a_dc, to_tree_mod, from_tree_mod, sort_string_lists + val_a, + exp_val_a_tree, + exp_val_a_dc, + to_yaml_tree_mod, + from_yaml_tree_mod, + sort_string_lists, ): """Test the `dataclass_serialization_class` function. The test defines a dataclass and its corresponding serialization class using - `dataclass_serialization_class`. It first calls to_tree to get tree from the - generated serialization class. Afterwards the tree is used with the `from_tree` - method to construct a new dataclass instance. The results of the function calls are - checked against the expected values. + `dataclass_serialization_class`. It first calls ``to_yaml_tree`` to get tree from + the generated serialization class. Afterwards the tree is used with the + ``from_yaml_tree`` method to construct a new dataclass instance. The results of the + function calls are checked against the expected values. Parameters ---------- val_a : Initial value of the dataclasses' variable a exp_val_a_tree : - Expected value of the variable a in the tree after `to_tree` was run + Expected value of the variable a in the tree after `to_yaml_tree` was run exp_val_a_dc : Expected value of the variable a of the reconstructed dataclass - to_tree_mod : + to_yaml_tree_mod : The value passed as corresponding function parameter - from_tree_mod : + from_yaml_tree_mod : The value passed as corresponding function parameter sort_string_lists The value passed as corresponding function parameter - """ @dataclass @@ -113,15 +124,15 @@ class _DataClass: class_name="Test", version="1.0.0", sort_string_lists=sort_string_lists, - to_tree_mod=to_tree_mod, - from_tree_mod=from_tree_mod, + to_yaml_tree_mod=to_yaml_tree_mod, + from_yaml_tree_mod=from_yaml_tree_mod, ) - tree = dataclass_asdf.to_tree(dc, None) + tree = dataclass_asdf().to_yaml_tree(dc, None, None) assert tree["b"] == 2 assert tree["a"] == exp_val_a_tree - dc_restored = dataclass_asdf.from_tree(tree, None) + dc_restored = dataclass_asdf().from_yaml_tree(tree, None, None) assert dc_restored.b == 2 assert dc_restored.a == exp_val_a_dc diff --git a/weldx/tests/asdf_tests/test_asdf_validators.py b/weldx/tests/asdf_tests/test_asdf_validators.py index 9086f0c29..af8930bf2 100644 --- a/weldx/tests/asdf_tests/test_asdf_validators.py +++ b/weldx/tests/asdf_tests/test_asdf_validators.py @@ -5,12 +5,12 @@ from asdf import ValidationError from weldx import Q_, TimeSeries -from weldx.asdf.extension import WxSyntaxError -from weldx.asdf.tags.weldx.debug.test_property_tag import PropertyTagTestClass -from weldx.asdf.tags.weldx.debug.test_shape_validator import ShapeValidatorTestClass -from weldx.asdf.tags.weldx.debug.test_unit_validator import UnitValidatorTestClass +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.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 from weldx.util import compare_nested diff --git a/weldx/tests/asdf_tests/test_weldx_file.py b/weldx/tests/asdf_tests/test_weldx_file.py index 77726e7cb..01df0776c 100644 --- a/weldx/tests/asdf_tests/test_weldx_file.py +++ b/weldx/tests/asdf_tests/test_weldx_file.py @@ -303,7 +303,7 @@ def test_history(self): def test_custom_schema(schema_arg): """Check the property complex_schema is being set.""" buff, _ = single_pass_weld_example(None) - schema = get_schema_path("datamodels/single_pass_weld-1.0.0.schema.yaml") + schema = get_schema_path("datamodels/single_pass_weld-1.0.0.yaml") kwargs = {schema_arg: schema} if schema_arg == "asdffile_kwargs": kwargs = {"asdffile_kwargs": {"custom_schema": schema}} @@ -314,7 +314,7 @@ def test_custom_schema(schema_arg): @staticmethod def test_custom_schema_resolve_path(): """Schema paths should be resolved internally.""" - schema = "single_pass_weld-1.0.0.schema" + schema = "single_pass_weld-1.0.0" with pytest.raises(ValidationError) as e: WeldxFile(custom_schema=schema) assert "required property" in e.value.message @@ -328,8 +328,8 @@ def test_custom_schema_not_existent(): @staticmethod def test_custom_schema_real_file(tmpdir): """Passing real paths.""" - assert not pathlib.Path("single_pass_weld-1.0.0.schema").exists() - shutil.copy(get_schema_path("single_pass_weld-1.0.0.schema"), ".") + assert not pathlib.Path("single_pass_weld-1.0.0").exists() + shutil.copy(get_schema_path("single_pass_weld-1.0.0"), ".") with pytest.raises(ValueError): WeldxFile(custom_schema="no") diff --git a/weldx/tests/data/quality_standard/resources/test_organization/manifests/test_standard-1.0.0.yaml b/weldx/tests/data/quality_standard/resources/test_organization/manifests/test_standard-1.0.0.yaml index d5f8a4d6d..a15c0ba5b 100644 --- a/weldx/tests/data/quality_standard/resources/test_organization/manifests/test_standard-1.0.0.yaml +++ b/weldx/tests/data/quality_standard/resources/test_organization/manifests/test_standard-1.0.0.yaml @@ -8,5 +8,5 @@ asdf_standard_requirement: 1.0.0 # mappings tags: -- uri: "http://weldx.bam.de/schemas/weldx/equipment/measurement_equipment-1.0.0" +- uri: "asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0" file: "alternative_measurement_equipment_schema-1.0.0" \ No newline at end of file diff --git a/weldx/tests/data/quality_standard/resources/test_organization/schemas/alternative_measurement_equipment_schema-1.0.0.yaml b/weldx/tests/data/quality_standard/resources/test_organization/schemas/alternative_measurement_equipment_schema-1.0.0.yaml index c57bc950a..9ce5d125b 100644 --- a/weldx/tests/data/quality_standard/resources/test_organization/schemas/alternative_measurement_equipment_schema-1.0.0.yaml +++ b/weldx/tests/data/quality_standard/resources/test_organization/schemas/alternative_measurement_equipment_schema-1.0.0.yaml @@ -1,8 +1,8 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://weldx.bam.de/schemas/weldx/equipment/measurement_equipment-1.0.0" -tag: "tag:weldx.bam.de:weldx/equipment/measurement_equipment-1.0.0" +id: "asdf://weldx.bam.de/weldx/schemas/equipment/measurement_equipment-1.0.0" +tag: "asdf://weldx.bam.de/weldx/tags/equipment/measurement_equipment-1.0.0" title: | A piece of measurement equipment. @@ -17,11 +17,11 @@ properties: sources: type: array items: - tag: "tag:weldx.bam.de:weldx/measurement/source-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/measurement/source-1.0.0" data_transformations: type: array items: - tag: "tag:weldx.bam.de:weldx/measurement/data_transformation-1.0.0" + tag: "asdf://weldx.bam.de/weldx/tags/measurement/data_transformation-1.0.0" wx_metadata: type: object properties: diff --git a/weldx/welding/groove/iso_9692_1.py b/weldx/welding/groove/iso_9692_1.py index a50f9549c..6eea47023 100644 --- a/weldx/welding/groove/iso_9692_1.py +++ b/weldx/welding/groove/iso_9692_1.py @@ -1652,7 +1652,7 @@ def get_groove( special_depth: pint.Quantity = None, code_number=None, ) -> IsoBaseGroove: - """Create a Groove from weldx.asdf.tags.weldx.core.groove. + """Create a Groove from weldx.tags.core.groove. Parameters ---------- @@ -1707,7 +1707,7 @@ def get_groove( Returns ------- type - an Groove from weldx.asdf.tags.weldx.core.groove + an Groove from weldx.tags.core.groove Examples --------