-
Notifications
You must be signed in to change notification settings - Fork 182
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
NF: Sphere, Geometry & Material #946
Conversation
Hello @m-agour! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-12-16 15:56:33 UTC |
I will fix the pep8 and upload the tests |
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.
fury/actor/__init__.py
Outdated
@@ -0,0 +1 @@ | |||
from .actor import sphere |
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.
please, use absolute import
fury/actor/actor.py
Outdated
import fury.primitive as fp | ||
import numpy as np | ||
from fury.v2.actor.materials import _create_mesh_material | ||
from fury.v2.actor.geometry import buffer_to_geometry, create_mesh |
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.
import order incorrect,
fury/actor/actor.py
Outdated
opacity=1, | ||
material='phong', | ||
enable_picking=True | ||
): |
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.
do not forget docstring
fury/actor/actor.py
Outdated
if faces is None and vertices is None: | ||
vertices, faces = fp.prim_sphere(phi=phi, theta=theta) |
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.
what happens if only vertices is None ? will it work?
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.
what happens if only vertices is None ? will it work?
@skoudoro No, It will not work and I can't imagine any use case for giving the vertices and faces of a sphere to create a sphere. Do you think we should remove it or keep it?
fury/actor/actor.py
Outdated
scales=scales, | ||
) | ||
big_verts, big_faces, big_colors, _ = res | ||
print(big_colors) |
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.
print to remove
fury/actor/geometry.py
Outdated
@@ -0,0 +1,32 @@ | |||
from pygfx import Geometry, Mesh |
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.
not sure geometry should be under actor folder
fury/actor/actor.py
Outdated
@@ -0,0 +1,54 @@ | |||
import fury.primitive as fp |
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.
not sure actor should be under actor folder. let's keep it simple and create submodule later
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.
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.
Please take a look at requesting changes and move faster on this @m-agour .
Thanks!
fury/actor/actor.py
Outdated
@@ -0,0 +1,54 @@ | |||
import fury.primitive as fp |
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.
fury/actor/materials.py
Outdated
pick_write=enable_picking, | ||
color_mode='vertex' if color is None else 'auto', | ||
color=color if color is not None else (1, 1, 1, opacity if color is None else 1), | ||
) |
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.
Throw an exception if the material does not equal to one of the configured types.
I think it is over-engineering @maharshi-gor. Let's keep it simple and split when we feel the need.
odf can be used in other field like Geophysics, Astrophysics and Cosmology. We want fury to be generic. if odf is in |
6b40a10
to
4e15a30
Compare
Also, try to squash your commit @m-agour please! |
Thank you @skoudoro @maharshi-gor for your reviews I am already working on them and would finish them by tomorrow the 14th. |
768a0af
to
a05fe70
Compare
NF: mesh material NF: geometry & mesh NF: added sphere actor RF: init actors BF: fix `sphere` opacity RF: pep8 issues fix & absolute import RF: convert `actor` module into fury/actor.py DOC: updated Sphere&material docstring
a05fe70
to
d4c7660
Compare
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.
Hi @m-agour,
Thank you for the update. Here some initial review before trying it.
Also, Can you run pre-commit to make to follow the standard?
pip install pre-commit
pre-commit install
pre-commit run my_py_files
fury/actor.py
Outdated
Spheres positions. | ||
colors : ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,) | ||
RGB or RGBA (for opacity) R, G, B, and A should be in the range [0, 1]. | ||
radii : float or ndarray, shape (N,) |
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.
, optional
to add
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.
you just missed this one
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.
Can you update this?
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.
Ok, overall, it looks good!
Thank you for this @m-agour. I need to try it locally, butI think it is ready to be merged.
@maharshi-gor, Do you want to give it a look? if no news, I will go ahead and merge it tomorrow.
I haven't tried as I need to device the tutorial on this. But looking at the PR LGTM. I will give feedback as I have those tutorials ready. |
Thank you, @skoudoro and @maharshi-gor for your reviews! |
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.
Hi @m-agour,
After testing this PR, it can not be merged unfortunately.
- Please, add some tests for material, geometry, utils and update the previous one for sphere actor.
- See my comment below to address
fury/actor.py
Outdated
Spheres positions. | ||
colors : ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,) | ||
RGB or RGBA (for opacity) R, G, B, and A should be in the range [0, 1]. | ||
radii : float or ndarray, shape (N,) |
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.
Can you update this?
fury/actor.py
Outdated
>>> from fury import window, actor | ||
>>> scene = window.Scene() | ||
>>> centers = np.random.rand(5, 3) | ||
>>> colors = np.random.rand(5, 3) | ||
>>> sphere_actor = actor.sphere(centers, colors, radii=0.5) | ||
>>> scene.add(sphere_actor) | ||
>>> # window.show(scene) |
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.
this example does not work. Can you update it ? ( window.show
does not exist, missing numpy import)
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'm on it @skoudoro
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.
Thank you for the last update @m-agour. Looks good to me, merging
Added Sphere actor.