mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Merge pull request #583 from smharper/pyapi_angle_filters
Implement azimuthal and polar filters in Pandas output
This commit is contained in:
commit
bdee3f6142
1 changed files with 13 additions and 0 deletions
|
|
@ -735,6 +735,19 @@ class Filter(object):
|
|||
filter_bins = filter_bins
|
||||
df = pd.concat([df, pd.DataFrame({self.type + ' [MeV]' : filter_bins})])
|
||||
|
||||
elif self.type in ('azimuthal', 'polar'):
|
||||
# Extract the lower and upper angle bounds, then repeat and tile
|
||||
# them as necessary to account for other filters.
|
||||
lo_bins = np.repeat(self.bins[:-1], self.stride)
|
||||
hi_bins = np.repeat(self.bins[1:], self.stride)
|
||||
tile_factor = data_size / len(lo_bins)
|
||||
lo_bins = np.tile(lo_bins, tile_factor)
|
||||
hi_bins = np.tile(hi_bins, tile_factor)
|
||||
|
||||
# Add the new angle columns to the DataFrame.
|
||||
df.loc[:, self.type + ' low'] = lo_bins
|
||||
df.loc[:, self.type + ' high'] = hi_bins
|
||||
|
||||
# universe, material, surface, cell, and cellborn filters
|
||||
else:
|
||||
filter_bins = np.repeat(self.bins, self.stride)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue