mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Fix Python 3 error in openmc.tallies module (due to map() not returning list in
Python 3).
This commit is contained in:
parent
f8faf1bb5b
commit
77e6baf2b5
1 changed files with 12 additions and 12 deletions
|
|
@ -651,7 +651,7 @@ class Tally(object):
|
|||
|
||||
Raises
|
||||
------
|
||||
KeyError : An error when the argument passed to the 'nuclide'
|
||||
KeyError : An error when the argument passed to the 'nuclide'
|
||||
parameter cannot be found in the Tally.
|
||||
"""
|
||||
|
||||
|
|
@ -694,7 +694,7 @@ class Tally(object):
|
|||
|
||||
Raises
|
||||
------
|
||||
ValueError: An error when the argument passed to the 'score'
|
||||
ValueError: An error when the argument passed to the 'score'
|
||||
parameter cannot be found in the Tally.
|
||||
"""
|
||||
|
||||
|
|
@ -816,7 +816,7 @@ class Tally(object):
|
|||
self.get_filter_index(filter.type, bin))
|
||||
|
||||
# Apply cross-product sum between all filter bin indices
|
||||
filter_indices = map(sum, itertools.product(*filter_indices))
|
||||
filter_indices = list(map(sum, itertools.product(*filter_indices)))
|
||||
|
||||
# If user did not specify any specific Filters, use them all
|
||||
else:
|
||||
|
|
@ -874,7 +874,7 @@ class Tally(object):
|
|||
This routine constructs a Pandas DataFrame object for the Tally data
|
||||
with columns annotated by filter, nuclide and score bin information.
|
||||
This capability has been tested for Pandas >=v0.13.1. However, if p
|
||||
possible, it is recommended to use the v0.16 or newer versions of
|
||||
possible, it is recommended to use the v0.16 or newer versions of
|
||||
Pandas since this this routine uses the Multi-index Pandas feature.
|
||||
|
||||
Parameters
|
||||
|
|
@ -951,7 +951,7 @@ class Tally(object):
|
|||
|
||||
# Append Mesh ID as outermost index of mult-index
|
||||
mesh_id = filter.mesh.id
|
||||
mesh_key = 'mesh {0}'.format(mesh_id)
|
||||
mesh_key = 'mesh {0}'.format(mesh_id)
|
||||
|
||||
# Find mesh dimensions - use 3D indices for simplicity
|
||||
if (len(filter.mesh.dimension) == 3):
|
||||
|
|
@ -1013,8 +1013,8 @@ class Tally(object):
|
|||
# offsets to OpenCG LocalCoords linked lists
|
||||
offsets_to_coords = {}
|
||||
|
||||
# Use OpenCG to compute LocalCoords linked list for
|
||||
# each region and store in dictionary
|
||||
# Use OpenCG to compute LocalCoords linked list for
|
||||
# each region and store in dictionary
|
||||
for region in range(num_regions):
|
||||
coords = opencg_geometry.findRegion(region)
|
||||
path = opencg.get_path(coords)
|
||||
|
|
@ -1023,7 +1023,7 @@ class Tally(object):
|
|||
# If this region is in Cell corresponding to the
|
||||
# distribcell filter bin, store it in dictionary
|
||||
if cell_id == filter.bins[0]:
|
||||
offset = openmc_geometry.get_offset(path,
|
||||
offset = openmc_geometry.get_offset(path,
|
||||
filter.offset)
|
||||
offsets_to_coords[offset] = coords
|
||||
|
||||
|
|
@ -1053,7 +1053,7 @@ class Tally(object):
|
|||
lat_y_key = (level_key, 'lat', 'y')
|
||||
lat_z_key = (level_key, 'lat', 'z')
|
||||
|
||||
# Allocate NumPy arrays for each CSG level and
|
||||
# Allocate NumPy arrays for each CSG level and
|
||||
# each Multi-index column in the DataFrame
|
||||
level_dict[univ_key] = np.empty(num_offsets)
|
||||
level_dict[cell_key] = np.empty(num_offsets)
|
||||
|
|
@ -1113,9 +1113,9 @@ class Tally(object):
|
|||
tile_factor = data_size / len(level_bins)
|
||||
level_bins = np.tile(level_bins, tile_factor)
|
||||
level_dict[level_key] = level_bins
|
||||
|
||||
|
||||
# Append the multi-index column to the DataFrame
|
||||
df = pd.concat([df, pd.DataFrame(level_dict)],
|
||||
df = pd.concat([df, pd.DataFrame(level_dict)],
|
||||
axis=1)
|
||||
|
||||
# Create DataFrame column for distribcell instances IDs
|
||||
|
|
@ -1132,7 +1132,7 @@ class Tally(object):
|
|||
bins = filter.bins
|
||||
num_bins = filter.num_bins
|
||||
|
||||
# Create strings for
|
||||
# Create strings for
|
||||
template = '{0:.1e} - {1:.1e}'
|
||||
filter_bins = []
|
||||
for i in range(num_bins):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue