Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add weldx file wrapper #341

Merged
merged 70 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c6b7ac1
initial import weldx file and test
marscher Apr 16, 2021
041b525
import lift in base
marscher Apr 16, 2021
b004da4
fix some tests, added sync (wrapper for update) to avoid conflict wit…
marscher Apr 16, 2021
a00d058
added tests, some features
marscher Apr 19, 2021
0d9c1f0
case for readonly files
marscher Apr 19, 2021
014313b
skip read_only test due to asdf bug.
marscher Apr 20, 2021
8f86a42
refactor custom schema
marscher Apr 20, 2021
9328787
use new parse option for get_yaml_header
marscher Apr 20, 2021
80ea737
made file arg optional (use bytebuffer as default)
marscher Apr 20, 2021
529187d
work on files
marscher Apr 20, 2021
2b04719
added more tests, added error handling
marscher Apr 22, 2021
19ad612
fix history test
marscher Apr 22, 2021
0dd801e
minor
marscher Apr 23, 2021
977b88c
fix invalid file type error msg
marscher Apr 23, 2021
cbfcc12
amend changelog
marscher Apr 23, 2021
0eb690a
types module including file-like types
marscher Apr 27, 2021
db4436d
use types_path_and_file_like
marscher Apr 27, 2021
4723865
fix custom schema
marscher Apr 27, 2021
b0aa836
use WeldxFile in custom_metadata.ipynb
marscher Apr 27, 2021
0279a4d
use WeldxFile in GMAW_process.ipynb
marscher Apr 27, 2021
60ff52a
use WeldxFile in GMAW_process.ipynb
marscher Apr 27, 2021
2bc2aa7
use write_args from ctor in write_to
marscher Apr 27, 2021
0b01e04
use WeldxFile in more notebooks
marscher Apr 27, 2021
2d54b13
clear output
marscher Apr 27, 2021
52b6b2d
fix jupyter json repr
marscher Apr 28, 2021
186dd0d
minor
marscher Apr 26, 2021
2e4408a
linting fun
marscher Apr 29, 2021
df1ffb9
pydocstyle
marscher Apr 29, 2021
aade856
pydocstyle
marscher Apr 29, 2021
bceb629
Merge remote-tracking branch 'origin/master' into add_weldx_file_wrapper
marscher Apr 29, 2021
5cc45f2
[pytest] enable doctests
marscher Apr 29, 2021
ba8ea46
[pydocstyle] use numpy convention
marscher Apr 29, 2021
4b77ebc
more docstrings
marscher Apr 29, 2021
9aa019e
add is_interactive_session
marscher Apr 29, 2021
e00f964
fix docstest failure
marscher Apr 29, 2021
37f604d
[pytest] do not try to collect tests from doc dir
marscher Apr 29, 2021
56e15c8
linting hell
marscher Apr 29, 2021
e49ccf2
fix buffer created with read-only
marscher Apr 29, 2021
c68376d
workaround for type deduction in sphinx.
marscher Apr 29, 2021
1b3d6a4
sync files prior showing header, cpy to tmp buff, if not (displaying …
marscher Apr 29, 2021
d027437
fix is_interactive_session
marscher Apr 29, 2021
96bde9e
three possibilites to visualize (plain str, syntax highlighted yaml, …
marscher Apr 29, 2021
5f17897
fix doctest: windows creates 32bit ints
marscher Apr 30, 2021
ade9fb6
linting, static
marscher Apr 30, 2021
047cf4e
docstrings, all variable
marscher Apr 30, 2021
48aa286
f
marscher Apr 30, 2021
d505784
ignore unresolved type annotation as it would require importing ipython
marscher Apr 30, 2021
6bee1b6
[gha/static_analysis] unpin pydocstyle
marscher Apr 30, 2021
53116b3
file-types, proper deprecation
marscher Apr 30, 2021
71273eb
remove metadata
marscher Apr 30, 2021
1e582fe
clear output
marscher Apr 30, 2021
376727c
fix docstyle
marscher Apr 30, 2021
487056a
Merge branch 'master' into add_weldx_file_wrapper
marscher May 3, 2021
36ac901
properly ignore missing docstrings in test
marscher May 3, 2021
5f5e103
fix import
marscher May 3, 2021
6331c8f
added types to api docs
marscher May 3, 2021
624705b
Update weldx/asdf/file.py
marscher May 4, 2021
ccc8f29
Update weldx/asdf/file.py
marscher May 4, 2021
6d36b7c
Update weldx/asdf/file.py
marscher May 4, 2021
b6f1b37
Update weldx/asdf/file.py
marscher May 4, 2021
f692b6c
simplify test
marscher May 3, 2021
3a33818
fix instance check
marscher May 3, 2021
df93ff4
fix instance check
marscher May 3, 2021
fc70747
minor [ci skip]
marscher May 4, 2021
1fc94ee
validate software entries
marscher May 4, 2021
eeaf6ee
clean up
marscher May 4, 2021
a381566
fix docstr, imports
marscher May 4, 2021
f1e2543
small comment on private function. [ci skip]
marscher May 4, 2021
1b7f85f
disable interactive widgets
marscher May 4, 2021
dbe3b62
be clear on returned type
marscher May 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- 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
structures. [[#328]](https://github.com/BAMWelDX/weldx/pull/328)
- added `WeldxFile` wrapper to handle asdf files with
history and schemas more easily. [[#341]](https://github.com/BAMWelDX/weldx/pull/341).

### changes

Expand Down
26 changes: 11 additions & 15 deletions tutorials/GMAW_process.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
"metadata": {},
"outputs": [],
"source": [
"import asdf\n",
"import weldx\n",
"from weldx import Q_\n",
"from weldx.asdf.extension import WeldxAsdfExtension, WeldxExtension\n",
"from weldx.core import TimeSeries as TS\n",
"from weldx.welding.processes import GmawProcess"
]
Expand Down Expand Up @@ -130,7 +128,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## using ASDF"
"## using ASDF\n",
"We write the dictionary containing our structured data to an ASDF file using the WeldxFile\n",
"class. We pass the tree as a named keyword argument.\n",
"The tree will be serialized to ASDF in memory, and we can have a look at the ASDF header."
]
},
{
Expand All @@ -145,20 +146,15 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"buffer = weldx.asdf.util._write_buffer(tree)\n",
"weldx.asdf.util.notebook_fileprinter(buffer)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
marscher marked this conversation as resolved.
Show resolved Hide resolved
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"data = weldx.asdf.util._read_buffer(buffer)"
"file = weldx.WeldxFile(tree=tree)\n",
"file.show_asdf_header()"
]
}
],
Expand Down
13 changes: 6 additions & 7 deletions tutorials/custom_metadata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's look at the ASDF file contents with our metadata:"
"Now let's look at the ASDF file contents with our metadata. We will find our data\n",
"at the very end after the ASDF header."
]
},
{
Expand All @@ -78,10 +79,9 @@
"metadata": {},
"outputs": [],
"source": [
"from weldx.asdf.util import _write_buffer, notebook_fileprinter\n",
"\n",
"buffer = _write_buffer({\"sensor\": HKS_sensor})\n",
"notebook_fileprinter(buffer)"
"from weldx import WeldxFile\n",
"file = WeldxFile(tree={\"sensor\": HKS_sensor})\n",
"file.show_asdf_header()"
]
},
{
Expand All @@ -104,9 +104,8 @@
"metadata": {},
"outputs": [],
"source": [
"from weldx.asdf.util import _read_buffer\n",
"data = WeldxFile(file.write_to())\n",
"\n",
"data = _read_buffer(buffer)\n",
"display(data[\"sensor\"].wx_metadata)\n",
"display(data[\"sensor\"].wx_user)"
]
Expand Down
327 changes: 293 additions & 34 deletions tutorials/groove_types_01.ipynb

Large diffs are not rendered by default.

19 changes: 7 additions & 12 deletions tutorials/measurement_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -472,25 +472,20 @@
" # \"data_sources\": sources,\n",
" # \"data_processors\": processors,\n",
"}\n",
"buffer = weldx.asdf.util._write_buffer(tree)"
"file = weldx.WeldxFile(tree=tree)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"weldx.asdf.util.notebook_fileprinter(buffer)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"data = weldx.asdf.util._read_buffer(buffer)"
"file.show_asdf_header()"
]
}
],
Expand Down
7 changes: 4 additions & 3 deletions tutorials/welding_example_01_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## using ASDF"
"## using ASDF\n",
"Now we write all of our structured data to an ASDF file and have a look at the ASDF header."
]
},
{
Expand All @@ -574,7 +575,7 @@
"metadata": {},
"outputs": [],
"source": [
"buffer = weldx.asdf.util._write_buffer(tree)"
"file = weldx.WeldxFile(tree=tree)"
]
},
{
Expand All @@ -583,7 +584,7 @@
"metadata": {},
"outputs": [],
"source": [
"weldx.asdf.util.notebook_fileprinter(buffer)"
"file.show_asdf_header()"
]
}
],
Expand Down
2 changes: 2 additions & 0 deletions weldx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

# asdf extensions and tags
import weldx.asdf
from weldx.asdf.file import WeldxFile

# class imports to weldx namespace
from weldx.constants import WELDX_QUANTITY as Q_
Expand Down Expand Up @@ -55,6 +56,7 @@
"Shape",
"SpatialData",
"Trace",
"WeldxFile",
"asdf",
"core",
"geometry",
Expand Down
Loading