Skip to content

Commit

Permalink
Alex' pull request review
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoBittes committed Aug 8, 2024
1 parent 4c92ab5 commit 7e77b82
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docs/source/api/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Paths
through Session it is possible to recover many paths to the
different folders that constitutes the JADE tree (see also :ref:`folders`).
Status
the Status object has informations on which libraries have
the Status object has information on which libraries have
been assessed or post-processed.
Configuration
the Configuration object is the one that handles the
Expand Down Expand Up @@ -50,8 +50,8 @@ module.
In JADE the object representing a benchmark is the Test object (or MultipleTest object
in case the benchmark is composed by more than one run). This object is responsible
for the creation of the MCNP input and for its run. A vital attribute of the benchmark
is its associated Input object (`<https://f4enix.readthedocs.io/en/latest/_autosummary/f4enix.input.MCNPinput.html>`_) or one of its children. In case the benchmark is run
with d1s code, an irradiation file and a reaction file (`<https://f4enix.readthedocs.io/en/latest/_autosummary/f4enix.input.d1suned.html>`) are also associated with the
is its associated Input object (`Input object <https://f4enix.readthedocs.io/en/latest/_autosummary/f4enix.input.MCNPinput.html>`_) or one of its children. In case the benchmark is run
with d1s code, an irradiation file and a reaction file (`D1S files <https://f4enix.readthedocs.io/en/latest/_autosummary/f4enix.input.d1suned.html>`_) are also associated with the
test.

Post-processing
Expand Down
3 changes: 3 additions & 0 deletions docs/source/nutshell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ JADE is an open source, Python 3 based software able to:
* Run simulations on such inputs;
* Automatically parse and post-process all the generated transport codes outputs.

MCNP input and output handling is performed by F4Enix (`f4enix documentation <https://f4enix.readthedocs.io/en/latest/>`_).
This package contains a range of utilities for the creation and post-processing of MCNP files.

The benchmarks implemented by default are divided between computational
and experimental benchmarks. The post-processing output includes:

Expand Down
8 changes: 4 additions & 4 deletions jade/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _read_code_version(self, pathtofile: os.PathLike) -> str | None:
return None

def _read_mcnp_code_version(self, pathtofile: os.PathLike) -> str | None:
if self.testname in ['Sphere', 'SphereSDDR']:
if self.testname in ["Sphere", "SphereSDDR"]:
if not os.path.exists(pathtofile):
# this can happen the first time
return None
Expand Down Expand Up @@ -1093,9 +1093,9 @@ def __init__(self, mctal_file, output_file, meshtal_file=None):
self.tallydata[tallynum] = tallydata
self.totalbin[tallynum] = None
# Create fake tallies to be added to the mctal
faketally = Tally(tallynum)
faketally.tallyComment = [comment]
self.mctal.tallies.append(faketally)
dummyTally = Tally(tallynum)
dummyTally.tallyComment = [comment]
self.mctal.tallies.append(dummyTally)
else:
continue

Expand Down
2 changes: 1 addition & 1 deletion jade/utilitiesgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from jade.acepyne import Library
import jade.resources as pkg_res
from importlib.resources import files, as_file
from importlib.resources import files

JADE_RESOURCES = files(pkg_res)

Expand Down
10 changes: 7 additions & 3 deletions tests/computational_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_executeBenchmarksRoutines(session_mock: MockUpSession):
executeBenchmarksRoutines(session_mock, lib, runoption, exp)


def test_select_lib(monkeypatch):
def test_select_lib_1(monkeypatch):
# monkeypatch the "input" function
lm = LibManager(os.path.join(resources, "xsdir"))
# Good trials
Expand All @@ -101,12 +101,16 @@ def test_select_lib(monkeypatch):
selectedlib = select_lib(lm, ["mcnp"])
assert selectedlib == lib


def test_select_lib_2(monkeypatch):
# monkeypatch the "input" function
lm = LibManager(os.path.join(resources, "xsdir"))
# Good trials
# Not found
for lib in ["44c", '{"21c": "44c", "44c": "71c"}', "21c-44c"]:
monkeypatch.setattr("builtins.input", lambda _: lib)
try:
selectedlib = select_lib(lm, ["mcnp"])
print(lib)
select_lib(lm, ["mcnp"])
assert False
except ValueError:
assert True
8 changes: 6 additions & 2 deletions tests/expoutput_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def lm(self):
df_lib, activationfile=ACTIVATION_FILE, isotopes_file=ISOTOPES_FILE
)

def test_benchmarkoutput(self, session_mock: MockUpSession, lm: LibManager):
def test_benchmarkoutput(self, session_mock: MockUpSession):

code = "mcnp"
testname = "ITER_1D"
Expand All @@ -77,9 +77,11 @@ def test_benchmarkoutput(self, session_mock: MockUpSession, lm: LibManager):
["32c", "31c"], code, testname, session_mock
)
self.benchoutput_comp.compare()
assert self.benchoutput_31c.raw_data[24]["Error"].iloc[10] == 0.7602
assert self.benchoutput_31c.raw_data[94]["Cells"].iloc[2] == 54
assert True

def test_benchmarkoutputmesh(self, session_mock: MockUpSession, lm: LibManager):
def test_benchmarkoutputmesh(self, session_mock: MockUpSession):
code = "mcnp"
testname = "WCLL_TBM_1D"
os.makedirs(session_mock.path_comparison)
Expand All @@ -92,6 +94,8 @@ def test_benchmarkoutputmesh(self, session_mock: MockUpSession, lm: LibManager):
["32c", "31c"], code, testname, session_mock
)
self.benchoutput_comp.compare()
assert self.benchoutput_31c.raw_data[214]["Error"].iloc[74] == 0.028364
assert self.benchoutput_31c.raw_data[244]["Cor A"].iloc[78] == 1084.20
assert True

def test_spectrumoutput(self, session_mock: MockUpSession):
Expand Down

0 comments on commit 7e77b82

Please sign in to comment.