From 85af75c459da55b3d77cf15e5b556b61ca97aa4b Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Mar 2018 13:58:58 -0500 Subject: [PATCH] Address comments on #985 --- openmc/filter.py | 4 ++-- openmc/plots.py | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/openmc/filter.py b/openmc/filter.py index 6cb81d97a..26629dafe 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -753,7 +753,7 @@ class MeshFilter(Filter): if n_dim == 3: # Construct 3-tuple of x,y,z cell indices for a 3D mesh nx, ny, nz = self.mesh.dimension - x = bin_index % nx + 1 + x = (bin_index % nx) + 1 y = (bin_index % (nx * ny)) // nx + 1 z = bin_index // (nx * ny) + 1 return (x, y, z) @@ -761,7 +761,7 @@ class MeshFilter(Filter): elif n_dim == 2: # Construct 2-tuple of x,y cell indices for a 2D mesh nx, ny = self.mesh.dimension - x = bin_index % nx + 1 + x = (bin_index % nx) + 1 y = bin_index // nx + 1 return (x, y) else: diff --git a/openmc/plots.py b/openmc/plots.py index a948c2a48..8eff78b1d 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -651,9 +651,16 @@ class Plot(IDManagerMixin): return element - def to_image(self, openmc_exec='openmc', cwd='.', convert_exec='convert'): + def to_ipython_image(self, openmc_exec='openmc', cwd='.', + convert_exec='convert'): """Render plot as an image + This method runs OpenMC in plotting mode to produce a bitmap image which + is then converted to a .png file and loaded in as an + :class:`IPython.display.Image` object. As such, it requires that your + model geometry, materials, and settings have already been exported to + XML. + Parameters ---------- openmc_exec : str