-
Notifications
You must be signed in to change notification settings - Fork 10
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 from_file and write_to_file to SpatialData #265
Conversation
Codecov Report
@@ Coverage Diff @@
## master #265 +/- ##
=======================================
Coverage 99.65% 99.65%
=======================================
Files 75 75
Lines 4009 4019 +10
=======================================
+ Hits 3995 4005 +10
Misses 14 14
Continue to review full report at Codecov.
|
weldx/geometry.py
Outdated
@@ -2328,6 +2329,26 @@ def __post_init__(self): | |||
if not self.triangles.ndim == 2: | |||
raise ValueError("SpatialData triangulation must be a 2d array") | |||
|
|||
@staticmethod | |||
def from_file(file_name: str) -> "SpatialData": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pathlib.Path
also seems to be supported by meshio so we might add that to the type hints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I am currently experimenting with it and writing the test ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think a test is necessary here actually since this is such a thin wrapping, I would be fine with #noqa
as well 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already there and it actually found a bug in the write_to_file
:p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the library is leaking file handles. But by using a sane OS this ain't a problem :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Hello @vhirtham! Thanks for updating this PR.
|
Changes
from_file
andwrite_to_file
toSpatialData
Checks
update example/tutorial notebooks