Skip to content

Commit

Permalink
use defaultdict
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Romano <[email protected]>
  • Loading branch information
yardasol and paulromano committed Nov 22, 2022
1 parent d45c37b commit c63d287
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tests/regression_tests/deplete_with_transport/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from math import floor
import shutil
from pathlib import Path
from collections import defaultdict

from difflib import unified_diff
import numpy as np
Expand Down Expand Up @@ -122,18 +123,11 @@ def test_full(run_in_tmpdir, problem, multiproc):
n_tallies = np.empty(N + 1, dtype=int)

# Get statepoint files for all BOS points and EOL
runtimes = {}
runtimes = defaultdict(list)
for n in range(N + 1):
statepoint = openmc.StatePoint(f"openmc_simulation_n{n}.h5")
runtime = statepoint.runtime
if n == 0:
for measure, time in runtime.items():
runtimes.update({measure: np.array([time])})
else:
for measure, time in runtime.items():
current = runtimes[measure]
updated = np.append(current, time)
runtimes.update({measure: updated})
for measure, time in statepoint.runtime.items():
runtimes[measure].append(time)
k_n = statepoint.keff
k_state[n] = [k_n.nominal_value, k_n.std_dev]
n_tallies[n] = len(statepoint.tallies)
Expand Down

0 comments on commit c63d287

Please sign in to comment.