serpent-tools
serpent-tools copied to clipboard
[ENH] Cylindrical plot for detectors
SERPENT allows detectors to be defined against cylindrical (r, theta, z) meshes, as well as Cartesian. We should support a simple plot routine for this as well. We may have to refactor our meshPlot
to be more specific, i.e. cartPlot
, hexPlot
, cylPlot
.
I'd be interesting in working on this
to a future contributor:
matplotlib can project plots to color coordinates so something like
import numpy as np
import matplotlib.pyplot as plt
import serpentTools
det = serpentTools.read("case.i_det0.m")
mesh_det = det['some_cyl_mesh']
actualTallies = mesh_det.tallies
# mesh grid to use with pcolor
phi, r = np.meshgrid(mesh_det.grids['PHI'][:, -1] / 180 * np.pi, mesh_det.grids['R'][:, -1])
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'}, figsize=(8, 8))
c = ax.pcolor(phi, r, actualTallies.T, shading='nearest')
fig.colorbar(c, ax=ax)
# turn off angle axis
ax.get_xaxis().set_visible(False)
will help this