serpent-tools icon indicating copy to clipboard operation
serpent-tools copied to clipboard

[ENH] Cylindrical plot for detectors

Open drewejohnson opened this issue 6 years ago • 2 comments

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.

drewejohnson avatar May 23 '18 17:05 drewejohnson

I'd be interesting in working on this

MattKrecicki avatar Mar 05 '19 18:03 MattKrecicki

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

veeshy avatar Sep 28 '21 17:09 veeshy