Skip to content

Commit

Permalink
Merge pull request #939 from robinroy03/doc-err-fix
Browse files Browse the repository at this point in the history
[WIP] Doc warnings
  • Loading branch information
skoudoro authored Oct 12, 2024
2 parents 143a878 + e91834e commit a09d2ce
Show file tree
Hide file tree
Showing 65 changed files with 284 additions and 209 deletions.
11 changes: 7 additions & 4 deletions docs/examples/collision-particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def collision():
box_directions = np.array([[0, 1, 0]])
box_colors = np.array([[1, 1, 1, 0.2]])
box_actor = actor.box(
box_centers, box_directions, box_colors, scales=(box_lx, box_ly, box_lz)
box_centers,
directions=box_directions,
colors=box_colors,
scales=(box_lx, box_ly, box_lz),
)
scene.add(box_actor)

Expand All @@ -135,7 +138,7 @@ def collision():
scene.add(sphere_actor)

showm = window.ShowManager(
scene, size=(900, 768), reset_camera=True, order_transparent=True
scene=scene, size=(900, 768), reset_camera=True, order_transparent=True
)

tb = ui.TextBlock2D(bold=True)
Expand All @@ -146,7 +149,7 @@ def collision():
counter = itertools.count()

vertices = utils.vertices_from_actor(sphere_actor)
vcolors = utils.colors_from_actor(sphere_actor, "colors")
vcolors = utils.colors_from_actor(sphere_actor, array_name="colors")
no_vertices_per_sphere = len(vertices) / num_particles
initial_vertices = vertices.copy() - np.repeat(xyz, no_vertices_per_sphere, axis=0)

Expand Down Expand Up @@ -175,4 +178,4 @@ def timer_callback(_obj, _event):
if interactive:
showm.start()

window.record(showm.scene, size=(900, 768), out_path="simple_collisions.png")
window.record(scene=showm.scene, size=(900, 768), out_path="simple_collisions.png")
8 changes: 5 additions & 3 deletions docs/examples/viz_animated_surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def create_surface(x, y, equation, colormap_name):
scene.set_camera(
position=(4.45, -21, 12), focal_point=(4.45, 0.0, 0.0), view_up=(0.0, 0.0, 1.0)
)
showm = fury.window.ShowManager(scene, size=(600, 600))
showm = fury.window.ShowManager(scene=scene, size=(600, 600))

###############################################################################
# Creating a grid to interact with surfaces individually.
Expand All @@ -137,7 +137,7 @@ def create_surface(x, y, equation, colormap_name):
text = []
for i in range(4):
t_actor = fury.actor.vector_text(
"Function " + str(i + 1), pos=(0, 0, 0), scale=(0.17, 0.2, 0.2)
text="Function " + str(i + 1), pos=(0, 0, 0), scale=(0.17, 0.2, 0.2)
)
text.append(t_actor)

Expand Down Expand Up @@ -207,4 +207,6 @@ def timer_callback(_obj, _event):
if interactive:
showm.start()

fury.window.record(showm.scene, size=(600, 600), out_path="viz_animated_surfaces.png")
fury.window.record(
scene=showm.scene, size=(600, 600), out_path="viz_animated_surfaces.png"
)
2 changes: 1 addition & 1 deletion docs/examples/viz_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
if interactive:
fury.window.show(scene, size=(600, 600))

fury.window.record(scene, out_path="viz_arrow.png", size=(600, 600))
fury.window.record(scene=scene, out_path="viz_arrow.png", size=(600, 600))
12 changes: 6 additions & 6 deletions docs/examples/viz_bezier_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

scene = fury.window.Scene()
showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
scene=scene, size=(900, 768), reset_camera=False, order_transparent=True
)


Expand Down Expand Up @@ -113,7 +113,7 @@
showm.start()

fury.window.record(
scene,
scene=scene,
out_path="viz_keyframe_animation_bezier_1.png",
size=(900, 768),
)
Expand All @@ -125,7 +125,7 @@

scene = fury.window.Scene()
show_manager = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
scene=scene, size=(900, 768), reset_camera=False, order_transparent=True
)

###############################################################################
Expand All @@ -144,7 +144,7 @@

###############################################################################
# Create an ``Animation`` and adding the sphere actor to it.
animation = fury.animation.Animation(sphere)
animation = fury.animation.Animation(actors=sphere)

###############################################################################
# Setting Cubic Bezier keyframes
Expand Down Expand Up @@ -179,7 +179,7 @@
###############################################################################
# Initializing the timeline to be able to control the playback of the
# animation.
timeline = fury.animation.Timeline(animation, playback_panel=True)
timeline = fury.animation.Timeline(animations=animation, playback_panel=True)

###############################################################################
# We only need to add the ``Timeline`` to the ``ShowManager``
Expand All @@ -191,5 +191,5 @@
show_manager.start()

fury.window.record(
showm.scene, out_path="viz_keyframe_animation_bezier_2.png", size=(900, 768)
scene=showm.scene, out_path="viz_keyframe_animation_bezier_2.png", size=(900, 768)
)
22 changes: 16 additions & 6 deletions docs/examples/viz_billboard_sdf_spheres.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
if interactive:
fury.window.show(scene)
else:
fury.window.record(scene, size=(600, 600), out_path="viz_regular_spheres.png")
fury.window.record(scene=scene, size=(600, 600), out_path="viz_regular_spheres.png")

###############################################################################
# Now, let's explore our scene to understand what we have created. Traditional
Expand All @@ -92,7 +92,9 @@
if interactive:
fury.window.show(scene)
else:
fury.window.record(scene, size=(600, 600), out_path="viz_low_res_wireframe.png")
fury.window.record(
scene=scene, size=(600, 600), out_path="viz_low_res_wireframe.png"
)

###############################################################################
# Let's clean the scene and play with the parameters `phi` and `theta`.
Expand All @@ -106,7 +108,9 @@
if interactive:
fury.window.show(scene)
else:
fury.window.record(scene, size=(600, 600), out_path="viz_hi_res_wireframe.png")
fury.window.record(
scene=scene, size=(600, 600), out_path="viz_hi_res_wireframe.png"
)

###############################################################################
# As you might have noticed, these parameters control the resolution of the
Expand Down Expand Up @@ -137,7 +141,9 @@
if interactive:
fury.window.show(scene)
else:
fury.window.record(scene, size=(600, 600), out_path="viz_billboards_wireframe.png")
fury.window.record(
scene=scene, size=(600, 600), out_path="viz_billboards_wireframe.png"
)

###############################################################################
# If you interacted with this actor, you might have noticed how it always
Expand Down Expand Up @@ -187,7 +193,9 @@
if interactive:
fury.window.show(scene)
else:
fury.window.record(scene, size=(600, 600), out_path="viz_billboards_circles.png")
fury.window.record(
scene=scene, size=(600, 600), out_path="viz_billboards_circles.png"
)

###############################################################################
# Hold on, those actors don't look exactly like the ones we created using
Expand Down Expand Up @@ -280,7 +288,9 @@
if interactive:
fury.window.show(scene)
else:
fury.window.record(scene, size=(600, 600), out_path="viz_billboards_spheres.png")
fury.window.record(
scene=scene, size=(600, 600), out_path="viz_billboards_spheres.png"
)

###############################################################################
# References
Expand Down
8 changes: 5 additions & 3 deletions docs/examples/viz_brownian_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def particle(
):
_origin = np.asarray(_origin, dtype=float)
position = np.tile(origin, (_num_total_steps, 1))
path_actor = fury.actor.line([position], colors, linewidth=_path_thickness)
path_actor = fury.actor.line([position], colors=colors, linewidth=_path_thickness)
path_actor.position = position
path_actor.delta = _delta
path_actor.num_total_steps = _num_total_steps
Expand Down Expand Up @@ -98,7 +98,7 @@ def update_path(act, counter_step):
position=(0, 0, 40), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)
)
showm = fury.window.ShowManager(
scene, size=(600, 600), reset_camera=True, order_transparent=True
scene=scene, size=(600, 600), reset_camera=True, order_transparent=True
)


Expand Down Expand Up @@ -155,4 +155,6 @@ def timer_callback(_obj, _event):

showm.add_timer_callback(True, 30, timer_callback)
showm.start()
fury.window.record(showm.scene, size=(600, 600), out_path="viz_brownian_motion.png")
fury.window.record(
scene=showm.scene, size=(600, 600), out_path="viz_brownian_motion.png"
)
4 changes: 3 additions & 1 deletion docs/examples/viz_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,6 @@ def change_icon_callback(i_ren, _obj, _button):
if interactive:
show_manager.start()

fury.window.record(show_manager.scene, size=current_size, out_path="viz_button.png")
fury.window.record(
scene=show_manager.scene, size=current_size, out_path="viz_button.png"
)
16 changes: 10 additions & 6 deletions docs/examples/viz_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
scene = fury.window.Scene()

showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
scene=scene, size=(900, 768), reset_camera=False, order_transparent=True
)


Expand Down Expand Up @@ -60,11 +60,11 @@
###############################################################################
# Creating "FURY" text
# ====================
fury_text = fury.actor.vector_text("FURY", pos=(-4.3, 15, 0), scale=(2, 2, 2))
fury_text = fury.actor.vector_text(text="FURY", pos=(-4.3, 15, 0), scale=(2, 2, 2))

###############################################################################
# Creating an ``Animation`` to animate the opacity of ``fury_text``
text_anim = Animation(fury_text, loop=False)
text_anim = Animation(actors=fury_text, loop=False)

###############################################################################
# opacity is set to 0 at time 29 and set to one at time 35.
Expand All @@ -87,14 +87,16 @@
# and radius.
actors = [
fury.actor.sphere(
np.array([[0, 0, 0]]), np.random.random([1, 3]), np.random.random([1, 3])
np.array([[0, 0, 0]]),
np.random.random([1, 3]),
radii=np.random.random([1, 3]),
)
]

###########################################################################
# create a timeline to animate this actor (single actor or list of actors)
# Actors can be added later using `Timeline.add_actor(actor)`
animation = Animation(actors)
animation = Animation(actors=actors)

# We generate random position and scale values from time=0 to time=49 each
# two seconds.
Expand Down Expand Up @@ -176,4 +178,6 @@
if interactive:
showm.start()

fury.window.record(scene, out_path="viz_keyframe_animation_camera.png", size=(900, 768))
fury.window.record(
scene=scene, out_path="viz_keyframe_animation_camera.png", size=(900, 768)
)
2 changes: 1 addition & 1 deletion docs/examples/viz_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
if interactive:
show_manager.start()

fury.window.record(show_manager.scene, out_path="card_ui.png", size=(1000, 1000))
fury.window.record(scene=show_manager.scene, out_path="card_ui.png", size=(1000, 1000))
2 changes: 1 addition & 1 deletion docs/examples/viz_card_sprite_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ def sprite_to_vtk():
if interactive:
show_manager.start()

fury.window.record(show_manager.scene, out_path="card_ui.png", size=(1000, 1000))
fury.window.record(scene=show_manager.scene, out_path="card_ui.png", size=(1000, 1000))
4 changes: 2 additions & 2 deletions docs/examples/viz_check_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def toggle_color(checkboxes):
figure_dict = {"cube": cube, "sphere": sphere, "cone": cone, "arrow": arrow}
check_box = ui.Checkbox(
list(figure_dict),
list(figure_dict),
checked_labels=list(figure_dict),
padding=1,
font_size=18,
font_family="Arial",
Expand Down Expand Up @@ -161,4 +161,4 @@ def toggle_color(checkboxes):
if interactive:
show_manager.start()

window.record(show_manager.scene, size=current_size, out_path="viz_checkbox.png")
window.record(scene=show_manager.scene, size=current_size, out_path="viz_checkbox.png")
26 changes: 14 additions & 12 deletions docs/examples/viz_color_interpolators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
scene = window.Scene()

showm = window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
scene=scene, size=(900, 768), reset_camera=False, order_transparent=True
)


Expand All @@ -41,23 +41,23 @@

###############################################################################
# Static labels for different interpolators (for show)
linear_text = actor.vector_text("Linear", (-2.64, -1, 0))
lab_text = actor.vector_text("LAB", (-0.37, -1, 0))
hsv_text = actor.vector_text("HSV", (1.68, -1, 0))
xyz_text = actor.vector_text("XYZ", (3.6, -1, 0))
step_text = actor.vector_text("Step", (5.7, -1, 0))
linear_text = actor.vector_text(text="Linear", pos=(-2.64, -1, 0))
lab_text = actor.vector_text(text="LAB", pos=(-0.37, -1, 0))
hsv_text = actor.vector_text(text="HSV", pos=(1.68, -1, 0))
xyz_text = actor.vector_text(text="XYZ", pos=(3.6, -1, 0))
step_text = actor.vector_text(text="Step", pos=(5.7, -1, 0))
scene.add(step_text, lab_text, linear_text, hsv_text, xyz_text)

###############################################################################
# Creating an animation to animate the actor.
# Also cube actor is provided for each timeline to handle as follows:
# ``Animation(actor)``, ``Animation(list_of_actors)``, or actors can be added
# later using ``animation.add()`` or ``animation.add_actor()``
anim_linear_color = Animation(actor.cube(cubes_pos[0]))
anim_LAB_color = Animation(actor.cube(cubes_pos[1]))
anim_HSV_color = Animation(actor.cube(cubes_pos[2]))
anim_XYZ_color = Animation(actor.cube(cubes_pos[3]))
anim_step_color = Animation(actor.cube(cubes_pos[4]))
anim_linear_color = Animation(actors=actor.cube(cubes_pos[0]))
anim_LAB_color = Animation(actors=actor.cube(cubes_pos[1]))
anim_HSV_color = Animation(actors=actor.cube(cubes_pos[2]))
anim_XYZ_color = Animation(actors=actor.cube(cubes_pos[3]))
anim_step_color = Animation(actors=actor.cube(cubes_pos[4]))

###############################################################################
# Creating a timeline to control all the animations (one for each color
Expand Down Expand Up @@ -108,4 +108,6 @@
if interactive:
showm.start()

window.record(scene, out_path="viz_keyframe_animation_colors.png", size=(900, 768))
window.record(
scene=scene, out_path="viz_keyframe_animation_colors.png", size=(900, 768)
)
2 changes: 1 addition & 1 deletion docs/examples/viz_combobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ def change_color(combobox):
if interactive:
showm.start()

window.record(showm.scene, out_path="combobox_ui.png", size=(400, 400))
window.record(scene=showm.scene, out_path="combobox_ui.png", size=(400, 400))
2 changes: 1 addition & 1 deletion docs/examples/viz_cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
if interactive:
window.show(scene, size=(600, 600))

window.record(scene, out_path="viz_cone.png", size=(600, 600))
window.record(scene=scene, out_path="viz_cone.png", size=(600, 600))
6 changes: 4 additions & 2 deletions docs/examples/viz_custom_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def interpolate(t):

scene = window.Scene()
showm = window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
scene=scene, size=(900, 768), reset_camera=False, order_transparent=True
)


Expand Down Expand Up @@ -164,4 +164,6 @@ def interpolate(t):
if interactive:
showm.start()

window.record(scene, out_path="viz_keyframe_custom_interpolator.png", size=(900, 768))
window.record(
scene=scene, out_path="viz_keyframe_custom_interpolator.png", size=(900, 768)
)
4 changes: 3 additions & 1 deletion docs/examples/viz_drawpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@
drawing_canvas.draw_shape(shape_type="circle", current_position=(275, 275))
drawing_canvas.shape_list[-1].resize((50, 50))

fury.window.record(showm.scene, size=current_size, out_path="viz_drawpanel.png")
fury.window.record(
scene=showm.scene, size=current_size, out_path="viz_drawpanel.png"
)
Loading

0 comments on commit a09d2ce

Please sign in to comment.