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

Fix progress bar not working for geometric and plastic analysis #296

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/sectionproperties/analysis/plastic_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def calculate_plastic_properties(
if verbose:
self.print_verbose(d=y_pc, root_result=r, axis="x-axis")

if progress and task:
if progress and task is not None:
progress.update(task_id=task, advance=1)

# 1b) Calculate y-axis plastic centroid
Expand All @@ -112,7 +112,7 @@ def calculate_plastic_properties(
if verbose:
self.print_verbose(d=x_pc, root_result=r, axis="y-axis")

if progress and task:
if progress and task is not None:
progress.update(task_id=task, advance=1)

# 2) Calculate plastic properties for principal axis
Expand Down Expand Up @@ -152,7 +152,7 @@ def calculate_plastic_properties(
if verbose:
self.print_verbose(d=y22_pc, root_result=r, axis="11-axis")

if progress and task:
if progress and task is not None:
progress.update(task_id=task, advance=1)

# 2b) Calculate 22-axis plastic centroid
Expand All @@ -178,7 +178,7 @@ def calculate_plastic_properties(
if verbose:
self.print_verbose(d=x11_pc, root_result=r, axis="22-axis")

if progress and task:
if progress and task is not None:
progress.update(task_id=task, advance=1)

# if there are no materials specified, calculate shape factors
Expand Down Expand Up @@ -220,7 +220,7 @@ def calculate_plastic_properties(
section.section_props.s22 / section.section_props.z22_minus
)

if progress and task:
if progress and task is not None:
progress.update(
task_id=task,
description="[bold green]:white_check_mark: Plastic analysis complete",
Expand Down
14 changes: 5 additions & 9 deletions src/sectionproperties/analysis/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def calculate_geom(progress: Progress | None = None) -> None:
self.section_props.iyy_g += iyy_g * e
self.section_props.ixy_g += ixy_g * e

if progress and task:
if progress and task is not None:
progress.update(task_id=task, advance=1)

self.section_props.nu_eff = (
Expand All @@ -270,7 +270,7 @@ def calculate_geom(progress: Progress | None = None) -> None:
node_list=self.mesh["vertices"]
)

if progress and task:
if progress and task is not None:
msg = "[bold green]:white_check_mark: Geometric analysis complete"
progress.update(task_id=task, description=msg)

Expand Down Expand Up @@ -880,7 +880,7 @@ def calculate_geom(progress: Progress | None = None) -> None:
self.section_props.iyy_g += iyy_g * e
self.section_props.ixy_g += ixy_g * e

if progress and task:
if progress and task is not None:
progress.update(task_id=task, advance=1)

# calculate elastic centroid location
Expand Down Expand Up @@ -916,7 +916,7 @@ def calculate_geom(progress: Progress | None = None) -> None:
else:
self.section_props.phi = np.arctan2(ixx_c - i11_c, ixy_c) * 180 / np.pi

if progress and task:
if progress and task is not None:
msg = "[bold green]:white_check_mark: Geometric analysis complete"
progress.update(task_id=task, description=msg)

Expand Down Expand Up @@ -1055,7 +1055,7 @@ def solve_warping() -> np.ndarray:
progress_table = Table.grid()
panel = Panel.fit(
renderable=progress,
title="[bold]Warping Analysis",
title="[bold]Warping (Frame) Analysis",
border_style="red",
padding=(1, 1),
)
Expand Down Expand Up @@ -1565,10 +1565,6 @@ def plot_mesh(

cmap = ListedColormap(colors=color_array) # custom colormap

# from rich.pretty import pprint
# pprint(len(self._mesh_nodes))
# pprint(self._mesh_elements.max())

# plot the mesh colors
ax.tripcolor(
self._mesh_nodes[:, 0],
Expand Down
Loading