mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Merge pull request #2251 from paulromano/universe-plot-ppm
Handle possibility of .ppm file in Universe.plot
This commit is contained in:
commit
e2f6f5d1ee
2 changed files with 7 additions and 2 deletions
|
|
@ -171,7 +171,9 @@ def _get_plot_image(plot, cwd):
|
|||
stem = plot.filename if plot.filename is not None else f'plot_{plot.id}'
|
||||
png_file = Path(cwd) / f'{stem}.png'
|
||||
if not png_file.exists():
|
||||
raise FileNotFoundError(f"Could not find .png image for plot {plot.id}")
|
||||
raise FileNotFoundError(
|
||||
f"Could not find .png image for plot {plot.id}. Your version of "
|
||||
"OpenMC may not be built against libpng.")
|
||||
|
||||
return Image(str(png_file))
|
||||
|
||||
|
|
|
|||
|
|
@ -358,7 +358,10 @@ class Universe(UniverseBase):
|
|||
model.plot_geometry(False, cwd=tmpdir, openmc_exec=openmc_exec)
|
||||
|
||||
# Read image from file
|
||||
img = mpimg.imread(Path(tmpdir) / f'plot_{plot.id}.png')
|
||||
img_path = Path(tmpdir) / f'plot_{plot.id}.png'
|
||||
if not img_path.is_file():
|
||||
img_path = img_path.with_suffix('.ppm')
|
||||
img = mpimg.imread(img_path)
|
||||
|
||||
# Create a figure sized such that the size of the axes within
|
||||
# exactly matches the number of pixels specified
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue