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

Visualizing 1D geometry with 'k3d' #451

Open
cme147 opened this issue Aug 14, 2024 · 1 comment
Open

Visualizing 1D geometry with 'k3d' #451

cme147 opened this issue Aug 14, 2024 · 1 comment
Assignees
Labels
bug Something isn't working dependency Issues (possibly) related to dependency

Comments

@cme147
Copy link

cme147 commented Aug 14, 2024

When attempting to visualize a 1D geometry using the 'k3d' backend in 'vedo' a TraitError occurs. Below is a code example that reproduces the error:

from splinepy.helpme.create import line
from vedo import settings

settings.default_backend = 'k3d'
curve = line(([0.0, 0.0], [1.0, 1.0]))
curve.show()

Error Message: TraitError: The 'width' trait of a Line instance expected a float or a dict, not the float32 np.float32(0.11313708).

@j042 j042 self-assigned this Aug 14, 2024
@j042 j042 added bug Something isn't working dependency Issues (possibly) related to dependency labels Aug 14, 2024
@j042
Copy link
Member

j042 commented Aug 14, 2024

If you don't mind switching numpy version, a quick fix is to use numpy 1.

pip install --force-reinstall numpy==1.26

You could also just uninstall and install.
Afterwards, you can check the version using splinepy -v.

I think this has something to do with NEP 50. So, an alternative quick fix is to set the promotion state to legacy:

np._set_promotion_state("legacy")
...
spline.show()
...
np._set_promotion_state("weak")  # set back to default

Ideally, as suggested in numpy migration guide, we should explicitly cast it to float. The nearest dependency that we can work on is vedo. I can also create a PR for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependency Issues (possibly) related to dependency
Projects
None yet
Development

No branches or pull requests

3 participants