serpent-tools
serpent-tools copied to clipboard
ENH Plot multiple fixed arguments for detectors
Summary of enhancement
Capabilities to plot several slices of detector data at once. Consider the example file bwr_det0.m
. If one reads the whole file and obtains the xymesh
detector with
import serpentTools
d = serpentTools.readDataFile('bwr_det0.m')['xymesh']
one can plot the tally data either with mesh plots or using the plot
command, fixing the energy axis as
d.plot('xmesh', fixed={'energy': 0})
and obtain
There is a lot in this figure, and it is difficult to identify what lines correspond to what y-mesh plotted.
When completed, this enhancment will allow the user to plot along multiple axis, e.g. several y-mesh indexes, with one plot command.
By passing a tuple of values to the fixed
dictionary for ymesh
, one should be able to plot
Note the labels were added after the fact during my plot and are not indicative of the intended label. Instead, maybe add labels as the index, or allow the user to pass the labels through the
labels
argument.
The slice
method does support this functionality, as demonstrated below
d.slice({'energy': 0, 'ymesh': (0, 4, 9)})
[[8.19312e+17 7.18519e+17 6.90079e+17 6.22241e+17 5.97257e+17 5.97732e+17 5.23973e+17 5.18163e+17 4.47478e+17 4.42897e+17 4.16117e+17 4.57879e+17 4.83234e+17 5.27784e+17 5.48377e+17 5.90254e+17 6.06511e+17 6.77493e+17 8.22194e+17 8.80335e+17]
[6.13839e+17 4.68601e+17 3.36648e+17 2.89372e+17 2.16846e+17 1.42831e+17 7.55625e+16 1.29467e+17 1.71221e+17 1.85019e+17 1.82318e+17 2.02328e+17 1.56334e+17 7.99477e+16 1.49016e+17 1.93624e+17 3.16721e+17 3.47858e+17 4.54319e+17 5.98720e+17]
[4.53951e+17 3.73311e+17 2.59601e+17 2.11590e+17 2.07343e+17 1.82712e+17 1.98584e+17 2.38914e+17 3.17940e+17 3.76533e+17 4.43764e+17 3.72477e+17 3.25579e+17 1.87763e+17 1.68373e+17 1.88161e+17 2.14719e+17 2.60612e+17 3.42182e+17 4.72639e+17]]
Passing a similar dictionary into plot
gets some errors with matplotlib, as the data is not the right shape.