From 34b76484f08578602e7d7c4ea932a5fdce846840 Mon Sep 17 00:00:00 2001 From: Chris McComb Date: Wed, 3 Jan 2024 18:42:25 -0500 Subject: [PATCH] Better --- trussme/truss.py | 4 +--- trussme/visualize.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/trussme/truss.py b/trussme/truss.py index 9d26d2c..4ce10d3 100644 --- a/trussme/truss.py +++ b/trussme/truss.py @@ -97,9 +97,7 @@ def fos_yielding(self) -> float: @property def fos_buckling(self) -> float: """float: Smallest buckling FOS of any member in the truss""" - return min( - [m.fos_buckling if m.fos_buckling > 0 else numpy.inf for m in self.members] - ) + return min([m.fos_buckling for m in self.members]) @property def fos(self) -> float: diff --git a/trussme/visualize.py b/trussme/visualize.py index 828f2a2..b621518 100644 --- a/trussme/visualize.py +++ b/trussme/visualize.py @@ -51,7 +51,7 @@ def plot_truss( force_colormap = matplotlib.colors.LinearSegmentedColormap.from_list( "force", - numpy.array([[1.0, 0.0, 0.0], [0.7, 0.7, 0.7], [0.0, 0.0, 1.0]]), + numpy.array([[1.0, 0.0, 0.0], [0.8, 0.8, 0.8], [0.0, 0.0, 1.0]]), ) for member in truss.members: @@ -81,7 +81,7 @@ def plot_truss( else "r" ) elif deflected_shape == "force": - color = matplotlib.pyplot.cm.bwr(member.force / (2 * scaler) + 0.5) + color = force_colormap(member.force / (2 * scaler) + 0.5) elif deflected_shape is None: break else: