Skip to content

Commit

Permalink
removed output filename option
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Feb 25, 2022
1 parent de6d86a commit 2a9503c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
17 changes: 0 additions & 17 deletions dagmc_geometry_slice_plotter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def plot_slice_of_dagmc_geometry(
plane_origin: Tuple[float, float, float] = None,
plane_normal: Tuple[float, float, float] = [0, 0, 1],
rotate_plot: float = 0,
output_filename: Optional[str] = None,
):
"""Slices through a 3D DAGMC geometry file (h5m format) and produces a
matplotlib plot of the slice.
Expand All @@ -28,9 +27,6 @@ def plot_slice_of_dagmc_geometry(
rotate_plot: the angle in degrees to rotate the plot by. Useful when
used in conjunction with changing plane_normal to orientate the
plot correctly.
output_filename: if specified then a the plot will be saved as an image
with default settings. Alternatively the returned plot object can
be saved using that matplotlib .savefig() method.
Return:
A matplotlib.pyplot object
Expand All @@ -42,7 +38,6 @@ def plot_slice_of_dagmc_geometry(
plane_origin=plane_origin,
plane_normal=plane_normal,
rotate_plot=rotate_plot,
output_filename=output_filename,
)

else:
Expand All @@ -52,7 +47,6 @@ def plot_slice_of_dagmc_geometry(
plane_origin=plane_origin,
plane_normal=plane_normal,
rotate_plot=rotate_plot,
output_filename=output_filename,
)

return slice
Expand All @@ -63,7 +57,6 @@ def plot_slice_of_dagmc_file(
plane_origin: Tuple[float, float, float] = None,
plane_normal: Tuple[float, float, float] = [0, 0, 1],
rotate_plot: float = 0,
output_filename: Optional[str] = None,
) -> plt:
"""Slices through a 3D DAGMC geometry file (h5m format) and produces a
matplotlib plot of the slice.
Expand All @@ -77,9 +70,6 @@ def plot_slice_of_dagmc_file(
rotate_plot: the angle in degrees to rotate the plot by. Useful when
used in conjunction with changing plane_normal to orientate the
plot correctly.
output_filename: if specified then a the plot will be saved as an image
with default settings. Alternatively the returned plot object can
be saved using that matplotlib .savefig() method.
Return:
A matplotlib.pyplot object
Expand All @@ -95,7 +85,6 @@ def plot_slice_of_dagmc_file(
plane_origin=plane_origin,
plane_normal=plane_normal,
rotate_plot=rotate_plot,
output_filename=output_filename,
)

return plot
Expand All @@ -106,7 +95,6 @@ def plot_slice_of_trimesh_object(
plane_origin: Tuple[float, float, float] = None,
plane_normal: Tuple[float, float, float] = [0, 0, 1],
rotate_plot: float = 0,
output_filename: Optional[str] = None,
) -> plt:
"""Slices through a trimesh_mesh_object and produces a matplotlib plot of
the slice. Accepts a trimesh_mesh_object which avoids reloading the mesh
Expand All @@ -123,9 +111,6 @@ def plot_slice_of_trimesh_object(
rotate_plot: the angle in degrees to rotate the plot by. Useful when
used in conjunction with changing plane_normal to orientate the
plot correctly.
output_filename: if specified then a the plot will be saved as an image
with default settings. Alternatively the returned plot object can
be saved using that matplotlib .savefig() method.
Return:
A matplotlib.pyplot object
Expand Down Expand Up @@ -167,6 +152,4 @@ def plot_slice_of_trimesh_object(
else:
plt.plot(*discrete.T, color="black", linewidth=1)

if output_filename:
plt.savefig(output_filename, dpi=300)
return plt
4 changes: 2 additions & 2 deletions tests/test_plot_slice_of_dagmc_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def test_create_default_plot_file(self):

os.system("rm test_plot.png")

plot_slice_of_dagmc_file(
plot = plot_slice_of_dagmc_file(
dagmc_filename=self.h5m_filename_smaller,
output_filename="test_plot.png",
)
plot.savefig("test_plot.png")

assert Path("test_plot.png").is_file()
4 changes: 2 additions & 2 deletions tests/test_plot_slice_of_trimesh_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def test_create_default_plot_file(self):

os.system("rm test_plot.png")

plot_slice_of_trimesh_object(
plot = plot_slice_of_trimesh_object(
trimesh_mesh_object=self.trimesh_mesh_object_smaller,
output_filename="test_plot.png",
)
plot.savefig("test_plot.png")

assert Path("test_plot.png").is_file()

0 comments on commit 2a9503c

Please sign in to comment.