Merge pull request #1091 from janmalec/local-develop

Fixed array range in the python score setter and updated example to m…
This commit is contained in:
Paul Romano 2018-10-15 11:06:31 -05:00 committed by GitHub
commit 28d4667755
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 352 additions and 516 deletions

File diff suppressed because one or more lines are too long

View file

@ -2774,7 +2774,7 @@ class TransportXS(MGXS):
p1_tally = p1_tally.get_slice(filters=[openmc.LegendreFilter],
filter_bins=[('P1',)],
squeeze=True)
p1_tally.scores = ['scatter-1']
p1_tally._scores = ['scatter-1']
# Compute total cross section
total_xs = self.tallies['total'] / self.tallies['flux (tracklength)']

View file

@ -376,7 +376,7 @@ class Tally(IDManagerMixin):
def scores(self, scores):
cv.check_type('tally scores', scores, MutableSequence)
for i, score in enumerate(scores[:-1]):
for i, score in enumerate(scores):
# If the score is already in the Tally, raise an error
if score in scores[i+1:]:
msg = 'Unable to add a duplicate score "{0}" to Tally ID="{1}" ' \
@ -390,7 +390,7 @@ class Tally(IDManagerMixin):
for deprecated in ['scatter-', 'nu-scatter-', 'scatter-p',
'nu-scatter-p', 'scatter-y', 'nu-scatter-y',
'flux-y', 'total-y']:
if score.startswith(deprecated):
if score.strip().startswith(deprecated):
msg = score.strip() + ' is no longer supported.'
raise ValueError(msg)
scores[i] = score.strip()