generalized the insertion of the momemt order in statepoint.py

This commit is contained in:
samuel shaner 2015-10-20 19:46:59 +00:00
parent 4fcdd7f0d6
commit 82483b6490

View file

@ -1,6 +1,6 @@
import copy
import sys
import re
import numpy as np
import openmc
@ -429,14 +429,12 @@ class StatePoint(object):
# Add the scores to the Tally
for j, score in enumerate(scores):
score = score.decode()
# If this is a scattering moment, insert the scattering order
if '-n' in score and 'delayed' not in score:
score = score.replace('-n', '-' + moments[j].decode())
elif '-pn' in score:
score = score.replace('-pn', '-' + moments[j].decode())
elif '-yn' in score:
score = score.replace('-yn', '-' + moments[j].decode())
# If this is a moment, use generic moment order
regexp = re.compile(r'-n$|-pn$|-yn$')
if regexp.search(score) is not None:
score = score.strip(regexp.findall(score)[0])
score += '-' + moments[j]
tally.add_score(score)