diff --git a/openmc/model/model.py b/openmc/model/model.py index ad898fd0ad..bc0796ea74 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -624,15 +624,9 @@ class Model: openmc.lib.materials[domain_id].volume = \ vol_calc.volumes[domain_id].n - def plot_geometry(self, output=True, cwd='.', openmc_exec='openmc', - convert=True, convert_exec='convert'): + def plot_geometry(self, output=True, cwd='.', openmc_exec='openmc'): """Creates plot images as specified by the Model.plots attribute - If convert is True, this function requires that a program is installed - to convert PPM files to PNG files. Typically, that would be - `ImageMagick `_ which includes a - `convert` command. - .. versionadded:: 0.13.0 Parameters @@ -645,10 +639,7 @@ class Model: openmc_exec : str, optional Path to OpenMC executable. Defaults to 'openmc'. This only applies to the case when not using the C API. - convert : bool, optional - Whether or not to attempt to convert from PPM to PNG - convert_exec : str, optional - Command that can convert PPM files into PNG files + """ if len(self.plots) == 0: @@ -664,15 +655,6 @@ class Model: self.export_to_xml() openmc.plot_geometry(output=output, openmc_exec=openmc_exec) - if convert: - for p in self.plots: - if p.filename is not None: - ppm_file = f'{p.filename}.ppm' - else: - ppm_file = f'plot_{p.id}.ppm' - png_file = ppm_file.replace('.ppm', '.png') - subprocess.check_call([convert_exec, ppm_file, png_file]) - def _change_py_lib_attribs(self, names_or_ids, value, obj_type, attrib_name, density_units='atom/b-cm'): # Method to do the same work whether it is a cell or material and diff --git a/tests/unit_tests/test_model.py b/tests/unit_tests/test_model.py index b1021a2694..994130f89a 100644 --- a/tests/unit_tests/test_model.py +++ b/tests/unit_tests/test_model.py @@ -332,27 +332,17 @@ def test_plots(run_in_tmpdir, pin_model_attributes, mpi_intracomm): # check that a plot was made and that the expected ppm and png files are # there - # We will only test convert if it is on the system, so as not to add an - # extra dependency just for tests - convert = which('convert') is not None - if convert: - exts = ['ppm', 'png'] - else: - exts = ['ppm'] - # We will run the test twice, the first time without C API, the second with for i in range(2): if i == 1: test_model.init_lib(output=False, intracomm=mpi_intracomm) - test_model.plot_geometry(output=False, convert=convert) + test_model.plot_geometry(output=False) - # Now look for the files, expect to find test.ppm, plot_2.ppm, and if - # convert is True, test.png, plot_2.png - for fname in ['test.', 'plot_2.']: - for ext in exts: - test_file = Path(f'./{fname}{ext}') - assert test_file.exists() - test_file.unlink() + # Now look for the files + for fname in ('test.png', 'plot_2.png'): + test_file = Path(fname) + assert test_file.exists() + test_file.unlink() test_model.finalize_lib()