def get_radial_power_by_tally(self, state, tally_id, index=None, eps=0):
"""Get the radial power of a specific tally with a known ID
Parameters:
-----------
state: openmc.StatePoint with this Mesh_Group's tally results
tally_id: int; id of the desired openmc.Tally
index: int; index of the z-layer within the Tally's mesh.
If the index is None, the sum of all the Tally's
layers will be returned.
[Default: None]
Returns:
--------
xyarray: numpy.array of the radial power profile
"""
tally = state.tallies[tally_id]
talvals = tally.get_values()
nz = len(talvals)//(self._nx*self._ny)
talvals.shape = (nz, self._ny, self._nx)
talvals = np.flip(talvals, 1)
if index:
xyarray = talvals[index, :, :]
else:
xyarray = np.zeros((self._ny, self._nx))
for i in range(nz):
xyarray += talvals[i, :, :]
xyarray[xyarray <= eps] = np.NaN
return xyarray
评论列表
文章目录