Skip to content

Commit

Permalink
Do not show contour plot in the unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys committed May 9, 2024
1 parent 87ee574 commit f3aea68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ def test_71_antenna_plot(self, field_test):
title="Contour at {}Hz".format(ffdata.frequency),
image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
convert_to_db=True,
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "contour.jpg"))

Expand All @@ -659,7 +660,10 @@ def test_71_antenna_plot(self, field_test):
assert os.path.exists(os.path.join(self.local_scratch.path, "2d2.jpg"))

ffdata.polar_plot_3d(
quantity="RealizedGain", image_path=os.path.join(self.local_scratch.path, "3d1.jpg"), convert_to_db=True
quantity="RealizedGain",
image_path=os.path.join(self.local_scratch.path, "3d1.jpg"),
convert_to_db=True,
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "3d1.jpg"))

Expand All @@ -686,6 +690,7 @@ def test_72_antenna_plot(self, array_test):
title="Contour at {}Hz".format(ffdata.frequency),
image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
convert_to_db=True,
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "contour.jpg"))

Expand Down Expand Up @@ -725,6 +730,7 @@ def test_72_antenna_plot(self, array_test):
title="Contour at {}Hz".format(ffdata1.frequency),
image_path=os.path.join(self.local_scratch.path, "contour1.jpg"),
convert_to_db=True,
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "contour1.jpg"))

Expand Down
4 changes: 2 additions & 2 deletions pyaedt/modules/solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ def plot_farfield_contour(

if image_path:
plt.savefig(image_path)
if show:
if show: # pragma: no cover
plt.show()

plt.rcParams["figure.figsize"] = default_figsize
Expand Down Expand Up @@ -1910,7 +1910,7 @@ def polar_plot_3d(
x = r * np.sin(theta_grid) * np.cos(phi_grid)
y = r * np.sin(theta_grid) * np.sin(phi_grid)
z = r * np.cos(theta_grid)
if show:
if show: # pragma: no cover
plot_3d_chart([x, y, z], xlabel="Theta", ylabel="Phi", title=title, snapshot_path=image_path)
else:
return x, y, z
Expand Down

0 comments on commit f3aea68

Please sign in to comment.