Merge branch 'plot_mat' into from_hdf5

This commit is contained in:
Adam Nelson 2016-11-21 20:36:49 -05:00
commit 92f9ccbb49
2 changed files with 31 additions and 23 deletions

View file

@ -511,6 +511,9 @@ class IncidentNeutron(EqualityMixin):
rxs = [data[mt] for mt in SUM_RULES[mt_sum] if mt in data]
if len(rxs) > 0:
data.summed_reactions[mt_sum] = rx = Reaction(mt_sum)
if rx.mt == 18 and 'total_nu' in group:
tgroup = group['total_nu']
rx.derived_products.append(Product.from_hdf5(tgroup))
for T in data.temperatures:
rx.xs[T] = Sum([rx_i.xs[T] for rx_i in rxs])

View file

@ -1,5 +1,6 @@
from numbers import Integral, Real
from six import string_types
from itertools import chain
import numpy as np
@ -427,38 +428,42 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None,
funcs.append(pw_funcs)
else:
funcs.append(nuc[mt].xs[nucT])
elif mt == 5 and mt in nuc:
# Only consider the (n,misc) products if neutrons are
# included in the outgoing channel since (n,misc) is only
# explicitly needed for scatter cross sections.
for prod in nuc[mt].products:
if prod.particle == 'neutron' and \
prod.emission_mode in ('total', 'prompt'):
if yields[i]:
func = openmc.data.Combination(
[nuc[mt].xs[nucT], prod.yield_],
[np.multiply])
else:
func = nuc[mt].xs[nucT]
funcs.append(func)
break
else:
funcs.append(lambda x: 0.)
elif mt in nuc:
if yields[i]:
for prod in nuc[mt].products:
# Get the total yield first if available. This will be
# used primarily for fission.
for prod in chain(nuc[mt].products,
nuc[mt].derived_products):
if prod.particle == 'neutron' and \
prod.emission_mode in ('total', 'prompt'):
prod.emission_mode == 'total':
func = openmc.data.Combination(
[nuc[mt].xs[nucT], prod.yield_],
[np.multiply])
funcs.append(func)
break
else:
# Assume the yield is 1
funcs.append(nuc[mt].xs[nucT])
# Total doesn't exist so we have to create from
# prompt and delayed. This is used for scatter
# multiplication.
func = None
for prod in chain(nuc[mt].products,
nuc[mt].derived_products):
if prod.particle == 'neutron' and \
prod.emission_mode != 'total':
if func:
func = openmc.data.Combination(
[prod.yield_, func], [np.add])
else:
func = prod.yield_
if func:
funcs.append(openmc.data.Combination(
[func, nuc[mt].xs[nucT]], [np.multiply]))
else:
# If func is still None, then there were no
# products. In that case, assume the yield is
# one as its not provided for some summed
# reactions like MT=4
funcs.append(nuc[mt].xs[nucT])
else:
funcs.append(nuc[mt].xs[nucT])
elif mt == UNITY_MT: