Skip to content

Commit

Permalink
hint for imshow polar
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Dec 7, 2023
1 parent f76eb7d commit 1a941d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# this example creates a simple CylindricalMesh tally and performs an openmc
# simulation to populate the tally. Slices of the resulting tally is then
# plotted using the openmc_cylindrical_plotter
# plotted using the openmc_cylindrical_plotter. In this example both heating
# tallies are combined. This is just a simple tally to show the feature.
# The natural use case is combining neutron and photon dose tallies which must
# be done as separate tallies due to the different energy function filters but
# we often want to combine the neutron and photon dose to get total dose

import openmc
import numpy as np
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# this example creates a simple CylindricalMesh tally and performs an openmc
# simulation to populate the tally. Slices of the resulting tally is then
# plotted using the openmc_cylindrical_plotter
# plotted using the openmc_cylindrical_plotter. In this example both heating
# tallies are combined. This is just a simple tally to show the feature.
# The natural use case is combining neutron and photon dose tallies which must
# be done as separate tallies due to the different energy function filters but
# we often want to combine the neutron and photon dose to get total dose


import openmc
import numpy as np
Expand Down
9 changes: 7 additions & 2 deletions src/openmc_cylindrical_mesh_plotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

_default_outline_kwargs = {"colors": "black", "linestyles": "solid", "linewidths": 1}

# zero values with logscale produce noise / fuzzy on the time but setting interpolation to none solves this
default_imshow_kwargs = {"interpolation": "none"}

def _check_inputs(plot_basis, score, geometry_basis, axis_units, volume_normalization, outline, tally):

Expand Down Expand Up @@ -211,8 +213,6 @@ def plot_mesh_tally_rz_slice(
axes.set_xlabel(xlabel)
axes.set_ylabel(ylabel)

# zero values with logscale produce noise / fuzzy on the time but setting interpolation to none solves this
default_imshow_kwargs = {"interpolation": "none"}
default_imshow_kwargs.update(kwargs)

if isinstance(tally, typing.Sequence):
Expand Down Expand Up @@ -387,6 +387,8 @@ def plot_mesh_tally_phir_slice(
theta = np.linspace(mesh.phi_grid[0], mesh.phi_grid[-1], len(mesh.phi_grid) - 1)
r = np.linspace(mesh.r_grid[0], mesh.r_grid[-1], len(mesh.r_grid) - 1)

# default_imshow_kwargs.update(kwargs)

if isinstance(tally, typing.Sequence):
for counter, one_tally in enumerate(tally):
new_data = _get_tally_data(
Expand Down Expand Up @@ -419,6 +421,9 @@ def plot_mesh_tally_phir_slice(
if colorbar:
fig.colorbar(im, **colorbar_kwargs)

# todo see if moving from a contourf to imshow can work
# https://stackoverflow.com/questions/54209640/imshow-in-polar-coordinates

# if outline and geometry is not None:
# import matplotlib.image as mpimg

Expand Down

0 comments on commit 1a941d2

Please sign in to comment.