Commit 7b6fcddb authored by mikf's avatar mikf Committed by mmpe

Floris2

parent 36b1d6cc
......@@ -119,7 +119,15 @@ class SpacingComp(ConstraintComponent):
from matplotlib.pyplot import Circle
import matplotlib.pyplot as plt
ax = ax or plt.gca()
for x, y in zip(self.x, self.y):
if isinstance(self.x, tuple):
x_plot = self.x[0]
else:
x_plot = self.x
if isinstance(self.y, tuple):
y_plot = self.y[0]
else:
y_plot = self.y
for x, y in zip(x_plot, y_plot):
circle = Circle((x, y), self.min_spacing / 2, color='k', ls='--', fill=False)
ax.add_artist(circle)
......
......@@ -88,12 +88,10 @@ class XYPlotComp(NoPlot):
def setup(self):
NoPlot.setup(self)
if topfarm.x_key in self.problem.design_vars:
self.min_x, self.max_x = self.problem.design_vars[topfarm.x_key][1:-1]
units_x = self.problem.design_vars[topfarm.x_key][-1]
else:
units_x = None
if topfarm.y_key in self.problem.design_vars:
self.min_y, self.max_y = self.problem.design_vars[topfarm.y_key][1:-1]
units_y = self.problem.design_vars[topfarm.y_key][-1]
else:
units_y = None
......@@ -192,13 +190,15 @@ class XYPlotComp(NoPlot):
# find limits
if (topfarm.x_key in self.problem.design_vars and
isinstance(self.problem.design_vars[topfarm.x_key], tuple)):
min_x, max_x = self.min_x, self.max_x
isinstance(self.problem.design_vars[topfarm.x_key], tuple) and
len(self.problem.design_vars[topfarm.x_key]) == 4):
min_x, max_x = self.problem.design_vars[topfarm.x_key][1:-1]
else:
min_x, max_x = min(inputs[topfarm.x_key]), max(inputs[topfarm.x_key])
if (topfarm.y_key in self.problem.design_vars and
isinstance(self.problem.design_vars[topfarm.y_key], tuple)):
min_y, max_y = self.min_y, self.max_y
isinstance(self.problem.design_vars[topfarm.y_key], tuple) and
len(self.problem.design_vars[topfarm.y_key]) == 4):
min_y, max_y = self.problem.design_vars[topfarm.y_key][1:-1]
else:
min_y, max_y = min(inputs[topfarm.y_key]), max(inputs[topfarm.y_key])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment