Skip to content

Commit

Permalink
Fixing an oopsie
Browse files Browse the repository at this point in the history
  • Loading branch information
cmccomb committed Jan 3, 2024
1 parent eb3332c commit 309504f
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions trussme/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,11 @@ def plot_truss(
ax.axis("equal")
ax.set_axis_off()

def _make_segment_data(colors, fractions):
return {
"red": ([fractions[idx], c[0], c[0]] for idx, c in enumerate(colors)),
"green": ([fractions[idx], c[1], c[1]] for idx, c in enumerate(colors)),
"blue": ([fractions[idx], c[2], c[2]] for idx, c in enumerate(colors)),
}

scaler: float = numpy.max(numpy.abs([member.force for member in truss.members]))

force_colormap = matplotlib.colors.LinearSegmentedColormap(
force_colormap = matplotlib.colors.LinearSegmentedColormap.from_list(
"force",
segmentdata=_make_segment_data(
[(1.0, 0.0, 0.0), (0.7, 0.7, 0.7), (0.0, 0.0, 1.0)],
[0.00, 0.50, 1.00],
),
N=256,
[(1.0, 0.0, 0.0), (0.7, 0.7, 0.7), (0.0, 0.0, 1.0)],
)

for member in truss.members:
Expand All @@ -88,7 +77,7 @@ def _make_segment_data(colors, fractions):
if deflected_shape == "fos":
color = (
"g"
if numpy.min(member.fos_buckling, member.fos_yieling) > fos_threshold
if numpy.min(member.fos_buckling, member.fos_yielding) > fos_threshold
else "r"
)
elif deflected_shape == "force":
Expand Down

0 comments on commit 309504f

Please sign in to comment.