Skip to content

Commit

Permalink
support string units in get_groove (#416)
Browse files Browse the repository at this point in the history
* enable string quantity syntax in get_groove and update tutorial

* formatting and wording

* update CHANGELOG.md

* simplify

* formatting
  • Loading branch information
CagtayFabry authored Jul 13, 2021
1 parent 047d699 commit bed9527
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 32 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### added

- add support for quality standards. Further information can be found in the corresponding new tutorial.
- add support for quality standards. Further information can be found in the corresponding new tutorial.
[[#211]](https://github.com/BAMWelDX/weldx/pull/211)
- added `asdf.util.get_schema_path` helper function [[#325]](https://github.com/BAMWelDX/weldx/pull/325)
- added `util.compare_nested` to check equality of two nested data
Expand Down Expand Up @@ -41,13 +41,12 @@
- Removed `Data` class
- Updated asdf schemas of all modified classes and the ones that contained references to those classes
- allow input of string quantities in `MathematicalExpression` parameters and a few other
places [[#402]](https://github.com/BAMWelDX/weldx/pull/402)
places [[#402]](https://github.com/BAMWelDX/weldx/pull/402) [[#416]](https://github.com/BAMWelDX/weldx/pull/416)
- `LocalCoordinateSystem.__init__` now accepts a `TimeSeries` as input. All methods of the `CoordinateSystemManager`
also support this new behavior [[#366]](https://github.com/BAMWelDX/weldx/pull/366)
- During the creation of a `WeldxFile` the path of a passed custom schema is resolved automatically
[[#412]](https://github.com/BAMWelDX/weldx/pull/412).


### documentation

- Add new tutorial about the `MeasurementChain` [[#326]](https://github.com/BAMWelDX/weldx/pull/326)
Expand Down
38 changes: 10 additions & 28 deletions tutorials/groove_types_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"* Converting a groove to a profile\n",
"* Using `plot` on a profile constructed by a groove\n",
"* All possible groove types as plot\n",
"* saving and loading grooves with ASDF\n",
"* Saving and loading grooves to/from weldx files\n",
"\n",
"First starting with the imports:"
"First starting with the imports needed for this tutorial:"
]
},
{
Expand All @@ -31,14 +31,7 @@
"metadata": {},
"outputs": [],
"source": [
"# ASDF imports\n",
"import asdf\n",
"\n",
"# Creating grooves\n",
"import weldx\n",
"from weldx import Q_ as Quantity # pint quantity from the weldx package\n",
"from weldx.asdf.extension import WeldxAsdfExtension, WeldxExtension\n",
"from weldx.welding.groove.iso_9692_1 import get_groove"
"from weldx import WeldxFile, get_groove"
]
},
{
Expand All @@ -58,21 +51,12 @@
"metadata": {},
"outputs": [],
"source": [
"# Workpiece thickness (note the use of 'cm')\n",
"t = Quantity(1, \"cm\")\n",
"# groove angle\n",
"alpha = Quantity(55, \"deg\")\n",
"# root gap\n",
"b = Quantity(2, \"mm\")\n",
"# root face\n",
"c = Quantity(1, \"mm\")\n",
"\n",
"v_groove = get_groove(\n",
" groove_type=\"VGroove\",\n",
" workpiece_thickness=t,\n",
" groove_angle=alpha,\n",
" root_gap=b,\n",
" root_face=c,\n",
" workpiece_thickness=\"1 cm\", # (note the use of 'cm')\n",
" groove_angle=\"55 deg\",\n",
" root_gap=\"2 mm\",\n",
" root_face=\"1 mm\",\n",
")\n",
"\n",
"display(v_groove)\n",
Expand Down Expand Up @@ -188,10 +172,8 @@
"metadata": {},
"source": [
"## using ASDF\n",
"All groove types can be saved to *weldx*-files.\n",
"\n",
"All groove types can be saved to _ASDF_-files with the included schemas and _ASDF_-extension from the weldx-package.\n",
"Note that these schemas and extensions are being handled automatically and you do not have\n",
"to worry about these.\n",
"Here we demonstrate the writing of the groove data into a buffer (in-memory file):"
]
},
Expand All @@ -202,7 +184,7 @@
"outputs": [],
"source": [
"tree = dict(test_v_groove=v_groove)\n",
"file = weldx.WeldxFile(tree=tree)"
"file = WeldxFile(tree=tree)"
]
},
{
Expand Down Expand Up @@ -236,7 +218,7 @@
"outputs": [],
"source": [
"file_copy = file.write_to()\n",
"data = weldx.WeldxFile(file_copy)\n",
"data = WeldxFile(file_copy)\n",
"data[\"test_v_groove\"]"
]
},
Expand Down
2 changes: 1 addition & 1 deletion weldx/welding/groove/iso_9692_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,7 @@ def get_groove(
_mapping = groove_cls._mapping

# convert function arguments to groove arguments
args = {k: _loc[v] for k, v in _mapping.items() if _loc[v] is not None}
args = {k: Q_(_loc[v]) for k, v in _mapping.items() if _loc[v] is not None}
if _loc["code_number"] is not None:
args["code_number"] = _loc["code_number"]

Expand Down

0 comments on commit bed9527

Please sign in to comment.