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
Fix for function from_meshio #3049
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3049 +/- ##
==========================================
- Coverage 94.39% 94.38% -0.02%
==========================================
Files 76 76
Lines 16556 16566 +10
==========================================
+ Hits 15628 15635 +7
- Misses 928 931 +3 |
Thanks for the PR and finding this!
This is because of this: >>> x = np.array([[0, 1], [2, 3]], dtype=np.uint64)
>>> x.dtype, np.full((len(x), 1), 0).dtype
(dtype('uint64'), dtype('int64'))
>>> (np.int_(1) + np.uint64(1)).dtype
dtype('float64') I'm wondering if we should also change the hstack line, to always match the dtype of the input. That way we can avoid type promotion on the np.hstack line. |
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.
Thanks for adding in the 2D test @keurfonluu. This LGTM, and as a side benefit we've marginally improved coverage.
* ensure cells are int64 * check dtype * test from_meshio with 2d mesh * fix isort Co-authored-by: Alex Kaszynski <akascap@gmail.com>
Overview
pyvista.from_meshio
when cells data type isnp.uint64
.Details
The following code raises an error:
This error is due to
np.hstack
somehow returning an array of typenp.float64
when input array data type isnp.uint64
:Output: