Skip to content

Commit

Permalink
merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvalentine94 committed Mar 14, 2024
2 parents df63325 + adfa602 commit 68978dc
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 252 deletions.
37 changes: 9 additions & 28 deletions jade/expoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,14 @@ def __init__(self, *args, **kwargs):
# Default to False
multiplerun = False
# Recover session and testname
session = args[2]
testname = str(args[1]["Folder Name"])
session = args[3]
testname = args[2]
super().__init__(*args, **kwargs)
# The experimental data needs to be loaded
self.path_exp_res = os.path.join(session.path_exp_res, testname)

# Add the raw path data (not created because it is a comparison)
if self.mcnp:
out = os.path.dirname(self.atlas_path_mcnp)
elif self.d1s:
out = os.path.dirname(self.atlas_path_d1s)
elif self.serpent:
out = os.path.dirname(self.atlas_path_serpent)
elif self.openmc:
out = os.path.dirname(self.atlas_path_openmc)

out = os.path.dirname(self.atlas_path)
raw_path = os.path.join(out, "Raw_Data")
if not os.path.exists(raw_path):
os.mkdir(raw_path)
Expand Down Expand Up @@ -156,14 +148,7 @@ def build_atlas(self):
None.
"""
# Build a temporary folder for images
if self.mcnp:
tmp_path = os.path.join(self.atlas_path_mcnp, "tmp")
elif self.d1s:
tmp_path = os.path.join(self.atlas_path_d1s, "tmp")
elif self.openmc:
tmp_path = os.path.join(self.atlas_path_openmc, "tmp")
elif self.serpent:
tmp_path = os.path.join(self.atlas_path_serpent, "tmp")
tmp_path = os.path.join(self.atlas_path, "tmp")

os.mkdir(tmp_path)

Expand All @@ -179,11 +164,7 @@ def build_atlas(self):
# Fill the atlas
atlas = self._build_atlas(tmp_path, atlas)

# Save Atlas
if self.mcnp:
atlas.save(self.atlas_path_mcnp)
elif self.d1s:
atlas.save(self.atlas_path_d1s)
atlas.save(self.atlas_path)
# Remove tmp images
shutil.rmtree(tmp_path)

Expand Down Expand Up @@ -795,7 +776,7 @@ def _dump_ce_table(self):
todump = todump.dropna(subset=["Max " + x_lab])
ft = ft.dropna(subset=["Max " + x_lab])
ex_outpath = os.path.join(
self.excel_path_mcnp, self.testname + "_" + x_ax + "_CE_tables.xlsx"
self.excel_path, self.testname + "_" + x_ax + "_CE_tables.xlsx"
)

# Create a Pandas Excel writer using XlsxWriter as the engine.
Expand Down Expand Up @@ -1160,7 +1141,7 @@ def _pp_excel_comparison(self):
self.case_tree_df.sort_values(indexes, axis=0, inplace=True)
# Build ExcelWriter object
filepath = os.path.join(
self.excel_path_mcnp, "Tiara_Fission_Cells_CE_tables.xlsx"
self.excel_path, "Tiara_Fission_Cells_CE_tables.xlsx"
)
with pd.ExcelWriter(filepath, engine="xlsxwriter") as writer:

Expand Down Expand Up @@ -1454,7 +1435,7 @@ def _pp_excel_comparison(self):
self._exp_comp_case_check(indexes=indexes)
# Create ExcelWriter object
filepath = os.path.join(
self.excel_path_mcnp, "Tiara_Bonner_Spheres_CE_tables.xlsx"
self.excel_path, "Tiara_Bonner_Spheres_CE_tables.xlsx"
)
with pd.ExcelWriter(filepath, engine="xlsxwriter") as writer:
# Loop over shield material/energy combinations
Expand Down Expand Up @@ -1641,7 +1622,7 @@ def _pp_excel_comparison(self):
names = ["Library", ""]
column_index = pd.MultiIndex.from_tuples(column_names, names=names)
# filepath = self.excel_path_mcnp + '\\' + self.testname + '_CE_tables.xlsx'
filepath = os.path.join(self.excel_path_mcnp, f"{self.testname}_CE_tables.xlsx")
filepath = os.path.join(self.excel_path, f"{self.testname}_CE_tables.xlsx")
with pd.ExcelWriter(filepath, engine="xlsxwriter") as writer:
# TODO Replace when other transport codes implemented.
code = "mcnp"
Expand Down
22 changes: 14 additions & 8 deletions jade/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def pploop(session: Session):
if ans:
lib = to_single_pp[0]
# Check active tests
# to_perform = session.check_active_tests('Post-Processing')
to_perform = session.check_active_tests('Post-Processing')
# For the moment no pp is foreseen for experimental benchmarks
# to_perf_exp = session.check_active_tests('Post-Processing',
# exp=True)
Expand All @@ -596,7 +596,9 @@ def pploop(session: Session):
"\n ########################### POST-PROCESSING STARTED ###########################\n"
)
# Core function
pp.postprocessBenchmark(session, lib)
print(to_perform)
for code, testnames in to_perform.items():
pp.postprocessBenchmark(session, lib_input, code, testnames)
# for testname in to_perform:
# try:
# pp.postprocessBenchmark(session, lib, testname)
Expand Down Expand Up @@ -633,10 +635,12 @@ def pploop(session: Session):

# Execute single pp
for lib in to_single_pp:
for testname in to_perform:
print("to single pp", to_single_pp)
for code, testnames in to_perform.items():
print("to_perform", to_perform)
try:
print(" Single PP of library " + lib + " required")
pp.postprocessBenchmark(session, lib)
pp.postprocessBenchmark(session, lib_input, code, testnames)
session.log.adjourn(
"""
Additional Post-Processing of library:"""
Expand All @@ -652,9 +656,10 @@ def pploop(session: Session):
continue

# Execute Comparison
for testname in to_perform:
print(to_perform)
for code, testnames in to_perform.items():
try:
pp.compareBenchmark(session, lib_input, testname)
pp.compareBenchmark(session, lib_input, code, testnames)
except PermissionError as e:
clear_screen()
print(pp_menu)
Expand Down Expand Up @@ -706,9 +711,10 @@ def pploop(session: Session):

# Execute Comparison
lib_input = EXP_TAG + "-" + lib_input # Insert the exp tag
for testname in to_perform:
print(to_perform)
for code, testname in to_perform.items():
try:
pp.compareBenchmark(session, lib_input, testname, exp=True)
pp.compareBenchmark(session, lib_input, code, testname, exp=True)
except PermissionError as e:
clear_screen()
print(pp_menu)
Expand Down
Loading

0 comments on commit 68978dc

Please sign in to comment.