Skip to content

test_scoring_card

converter.tests.fluka.test_scoring_card

detectors_json

detectors_json(project_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
12
13
14
@pytest.fixture(scope='module')
def detectors_json(project_fluka_json) -> dict:
    return project_fluka_json['detectorManager']

detectors_json_2

detectors_json_2(project2_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
22
23
24
@pytest.fixture(scope='module')
def detectors_json_2(project2_fluka_json: dict) -> dict:
    return project2_fluka_json['detectorManager']

detectors_json_3

detectors_json_3(project3_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
32
33
34
@pytest.fixture(scope='module')
def detectors_json_3(project3_fluka_json: dict) -> dict:
    return project3_fluka_json['detectorManager']

detectors_json_4

detectors_json_4(project4_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
42
43
44
@pytest.fixture(scope='module')
def detectors_json_4(project4_fluka_json: dict) -> dict:
    return project4_fluka_json['detectorManager']

expected_card

expected_card()

Returns expected Fluka scoring card sets

Source code in yaptide/converter/tests/fluka/test_scoring_card.py
47
48
49
50
51
52
53
54
55
def expected_card() -> str:
    """Returns expected Fluka scoring card sets"""
    lines = """
USRBIN          10.0  ALL-PART     -21.0      0.05       5.0       6.0Fluence
USRBIN         -0.05      -5.0      -6.0       1.0     100.0     120.0&
AUXSCORE      USRBIN -100100.0                 1.0       1.0       1.0
"""

    return lines.strip()

expected_scores

expected_scores()

Returns expected Fluka scoring card sets

Source code in yaptide/converter/tests/fluka/test_scoring_card.py
58
59
60
61
62
63
64
65
66
67
@pytest.fixture(scope='module')
def expected_scores() -> str:
    """Returns expected Fluka scoring card sets"""
    lines = """
USRBIN          10.0  ALL-PART     -21.0      0.05       5.0       6.0Fluence
USRBIN         -0.05      -5.0      -6.0       1.0     100.0     120.0&
AUXSCORE      USRBIN -100100.0                 1.0       1.0       1.0
"""

    return lines.strip()

expected_scores_2

expected_scores_2()

Returns expected Fluka scoring card sets

Source code in yaptide/converter/tests/fluka/test_scoring_card.py
70
71
72
73
74
75
76
77
78
79
80
81
82
@pytest.fixture(scope='module')
def expected_scores_2() -> str:
    """Returns expected Fluka scoring card sets"""
    lines = """
USRBIN          10.0  ALL-PART     -21.0      0.05       5.0       6.0Fluence
USRBIN         -0.05      -5.0      -6.0       1.0     100.0     120.0&
AUXSCORE      USRBIN -100100.0                 1.0       1.0       1.0
USRBIN          10.0      DOSE     -22.0      12.5      25.0      37.5MyDose
USRBIN           7.5      15.0      22.5      10.0     100.0     150.0&
AUXSCORE      USRBIN   NEUTRON                 2.0       2.0       1.0
"""

    return lines.strip()

expected_scores_4

expected_scores_4()

Returns expected Fluka scoring card sets

Source code in yaptide/converter/tests/fluka/test_scoring_card.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@pytest.fixture(scope='module')
def expected_scores_4() -> str:
    """Returns expected Fluka scoring card sets"""
    lines = """
USRBIN          10.0      DOSE     -21.0       2.5       2.5      21.0D_Total
USRBIN          -2.5      -2.5       3.0       1.0       1.0     100.0&
USRBIN          10.0      DOSE     -21.0       2.5       2.5      21.0D_Proton
USRBIN          -2.5      -2.5       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN    PROTON                 2.0       2.0       1.0
USRBIN          10.0      DOSE     -21.0       2.5       2.5      21.0D_He3
USRBIN          -2.5      -2.5       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN  3-HELIUM                 3.0       3.0       1.0
USRBIN          10.0      DOSE     -21.0       2.5       2.5      21.0D_C_Cus
USRBIN          -2.5      -2.5       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN-1200600.0                 4.0       4.0       1.0
USRBIN          10.0      DOSE     -21.0       2.5       2.5      21.0D_He_Cus
USRBIN          -2.5      -2.5       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN -400200.0                 5.0       5.0       1.0
USRBIN          10.0      DOSE     -21.0       2.5       2.5      21.0D_B_Cus
USRBIN          -2.5      -2.5       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN -900400.0                 6.0       6.0       1.0
USRBIN          11.0  ALL-PART     -22.0       2.5       0.0      21.0F_Total
USRBIN           0.0       0.0       3.0       1.0       1.0     100.0&
USRBIN          11.0    PROTON     -22.0       2.5       0.0      21.0F_Proton
USRBIN           0.0       0.0       3.0       1.0       1.0     100.0&
USRBIN          11.0  3-HELIUM     -22.0       2.5       0.0      21.0F_He3
USRBIN           0.0       0.0       3.0       1.0       1.0     100.0&
USRBIN          11.0  ALL-PART     -22.0       2.5       0.0      21.0F_C_Cus
USRBIN           0.0       0.0       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN-1200600.0                10.0      10.0       1.0
USRBIN          11.0  ALL-PART     -22.0       2.5       0.0      21.0F_He_Cus
USRBIN           0.0       0.0       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN -400200.0                11.0      11.0       1.0
USRBIN          11.0  ALL-PART     -22.0       2.5       0.0      21.0F_B_Cus
USRBIN           0.0       0.0       3.0       1.0       1.0     100.0&
AUXSCORE      USRBIN -900400.0                12.0      12.0       1.0
"""

    return lines.strip()

expected_scores_cylinder

expected_scores_cylinder()

Returns expected Fluka scoring card sets

Source code in yaptide/converter/tests/fluka/test_scoring_card.py
85
86
87
88
89
90
91
92
93
@pytest.fixture(scope='module')
def expected_scores_cylinder() -> str:
    """Returns expected Fluka scoring card sets"""
    lines = """
USRBIN          11.0      DOSE     -21.0       3.0       0.0      21.0Dose1
USRBIN           0.0       0.0       3.0       1.0       1.0     100.0&
"""

    return lines.strip()

scorings_json

scorings_json(project_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
7
8
9
@pytest.fixture(scope='module')
def scorings_json(project_fluka_json) -> dict:
    return project_fluka_json['scoringManager']

scorings_json_2

scorings_json_2(project2_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
17
18
19
@pytest.fixture(scope='module')
def scorings_json_2(project2_fluka_json: dict) -> dict:
    return project2_fluka_json['scoringManager']

scorings_json_3

scorings_json_3(project3_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
27
28
29
@pytest.fixture(scope='module')
def scorings_json_3(project3_fluka_json: dict) -> dict:
    return project3_fluka_json['scoringManager']

scorings_json_4

scorings_json_4(project4_fluka_json)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
37
38
39
@pytest.fixture(scope='module')
def scorings_json_4(project4_fluka_json: dict) -> dict:
    return project4_fluka_json['scoringManager']

test_scoring_card

test_scoring_card(
    detectors_json, scorings_json, expected_scores
)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
137
138
139
140
141
def test_scoring_card(detectors_json: dict, scorings_json: dict, expected_scores: str) -> None:
    scorings = parse_scorings(detectors_json, scorings_json)
    scorings_card = ScoringsCard(scorings)

    assert str(scorings_card) == expected_scores

test_scoring_card_multiple_scorings

test_scoring_card_multiple_scorings(
    detectors_json_2, scorings_json_2, expected_scores_2
)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
144
145
146
147
148
def test_scoring_card_multiple_scorings(detectors_json_2: dict, scorings_json_2: dict, expected_scores_2: str) -> None:
    scorings = parse_scorings(detectors_json_2, scorings_json_2)
    scorings_card = ScoringsCard(scorings)

    assert str(scorings_card) == expected_scores_2

test_scoring_cylinder_detector

test_scoring_cylinder_detector(
    detectors_json_3,
    scorings_json_3,
    expected_scores_cylinder,
)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
151
152
153
154
155
156
def test_scoring_cylinder_detector(detectors_json_3: dict, scorings_json_3: dict,
                                   expected_scores_cylinder: str) -> None:
    scorings = parse_scorings(detectors_json_3, scorings_json_3)
    scorings_card = ScoringsCard(scorings)

    assert str(scorings_card) == expected_scores_cylinder

test_scoring_dose_and_fluence_with_two_detectors

test_scoring_dose_and_fluence_with_two_detectors(
    detectors_json_4, scorings_json_4, expected_scores_4
)
Source code in yaptide/converter/tests/fluka/test_scoring_card.py
159
160
161
162
163
164
def test_scoring_dose_and_fluence_with_two_detectors(detectors_json_4: dict, scorings_json_4: dict,
                                                     expected_scores_4: str) -> None:
    scorings = parse_scorings(detectors_json_4, scorings_json_4)
    scorings_card = ScoringsCard(scorings)

    assert str(scorings_card) == expected_scores_4