Skip to content

Commit 09093a4

Browse files
author
autopep8
committed
Automated autopep8 fixes
1 parent afdd4d9 commit 09093a4

File tree

3 files changed

+68
-25
lines changed

3 files changed

+68
-25
lines changed

openmc_dagmc_wrapper/Geometry.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def make_root(self):
8989
vac_surf = self.create_sphere_of_vacuum_surface()
9090
region = -vac_surf & -reflective_1 & +reflective_2
9191

92-
containing_cell = openmc.Cell(cell_id=9999, region=region, fill=dag_univ)
92+
containing_cell = openmc.Cell(
93+
cell_id=9999, region=region, fill=dag_univ)
9394

9495
root = [containing_cell]
9596
return root
@@ -122,13 +123,31 @@ def create_cube_of_vacuum_surfaces(self):
122123
bbox[0][0] = 0.0
123124
bbox[0][1] = 0.0
124125

125-
lower_x = openmc.XPlane(bbox[0][0], surface_id=9999, boundary_type="vacuum")
126-
upper_x = openmc.XPlane(bbox[1][0], surface_id=9998, boundary_type="vacuum")
127-
128-
lower_y = openmc.YPlane(bbox[0][1], surface_id=9997, boundary_type="vacuum")
129-
upper_y = openmc.YPlane(bbox[1][1], surface_id=9996, boundary_type="vacuum")
130-
131-
lower_z = openmc.ZPlane(bbox[0][2], surface_id=9995, boundary_type="vacuum")
132-
upper_z = openmc.ZPlane(bbox[1][2], surface_id=9994, boundary_type="vacuum")
126+
lower_x = openmc.XPlane(
127+
bbox[0][0],
128+
surface_id=9999,
129+
boundary_type="vacuum")
130+
upper_x = openmc.XPlane(
131+
bbox[1][0],
132+
surface_id=9998,
133+
boundary_type="vacuum")
134+
135+
lower_y = openmc.YPlane(
136+
bbox[0][1],
137+
surface_id=9997,
138+
boundary_type="vacuum")
139+
upper_y = openmc.YPlane(
140+
bbox[1][1],
141+
surface_id=9996,
142+
boundary_type="vacuum")
143+
144+
lower_z = openmc.ZPlane(
145+
bbox[0][2],
146+
surface_id=9995,
147+
boundary_type="vacuum")
148+
upper_z = openmc.ZPlane(
149+
bbox[1][2],
150+
surface_id=9994,
151+
boundary_type="vacuum")
133152

134153
return [lower_x, upper_x, lower_y, upper_y, lower_z, upper_z]

openmc_dagmc_wrapper/Tally.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ class CellTallies:
154154
h5m_filename
155155
"""
156156

157-
def __init__(self, tally_types, targets=[None], materials=None, h5m_filename=None):
157+
def __init__(
158+
self,
159+
tally_types,
160+
targets=[None],
161+
materials=None,
162+
h5m_filename=None):
158163
self.tallies = []
159164
self.tally_types = tally_types
160165
self.targets = targets
@@ -171,8 +176,10 @@ def __init__(self, tally_types, targets=[None], materials=None, h5m_filename=Non
171176
for score in self.tally_types:
172177
for target in all_targets:
173178
self.tallies.append(
174-
CellTally(tally_type=score, target=target, materials=materials)
175-
)
179+
CellTally(
180+
tally_type=score,
181+
target=target,
182+
materials=materials))
176183

177184

178185
class TetMeshTally(Tally):
@@ -224,13 +231,22 @@ def __init__(self, tally_types, filenames):
224231
self.tally_types = tally_types
225232
for score in self.tally_types:
226233
for filename in filenames:
227-
self.tallies.append(TetMeshTally(tally_type=score, filename=filename))
234+
self.tallies.append(
235+
TetMeshTally(
236+
tally_type=score,
237+
filename=filename))
228238

229239

230240
class MeshTally3D(Tally):
231241
def __init__(
232-
self, tally_type, mesh_resolution=(100, 100, 100), bounding_box=None, **kwargs
233-
):
242+
self,
243+
tally_type,
244+
mesh_resolution=(
245+
100,
246+
100,
247+
100),
248+
bounding_box=None,
249+
**kwargs):
234250
self.tally_type = tally_type
235251
self.mesh_resolution = mesh_resolution
236252
super().__init__(tally_type, **kwargs)
@@ -455,7 +471,9 @@ def compute_filters(tally_type):
455471
energy_function_filter_n = openmc.EnergyFunctionFilter(
456472
energy_bins_n, dose_coeffs_n
457473
)
458-
additional_filters = [neutron_particle_filter, energy_function_filter_n]
474+
additional_filters = [
475+
neutron_particle_filter,
476+
energy_function_filter_n]
459477
elif tally_type == "photon_effective_dose":
460478
energy_function_filter_p = openmc.EnergyFunctionFilter(
461479
energy_bins_p, dose_coeffs_p

openmc_dagmc_wrapper/utils.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def find_fusion_energy_per_reaction(reactants: str) -> float:
114114
0.5 * (fusion_energy_of_trition_ev + fusion_energy_of_proton_ev)
115115
) + (0.5 * (fusion_energy_of_he3_ev + fusion_energy_of_neutron_ev))
116116
else:
117-
raise ValueError("Only fuel types of DD and DT are currently supported")
117+
raise ValueError(
118+
"Only fuel types of DD and DT are currently supported")
118119

119120
fusion_energy_per_reaction_j = fusion_energy_per_reaction_ev * 1.602176487e-19
120121

@@ -298,9 +299,7 @@ def process_results(
298299
# flux is in units of cm per source particle
299300
# dose coefficients have units of pico Sv cm^2
300301
results[tally.name]["effective dose per source particle pSv cm3"] = {
301-
"result": tally_result,
302-
"std. dev.": tally_std_dev,
303-
}
302+
"result": tally_result, "std. dev.": tally_std_dev, }
304303

305304
if fusion_power is not None:
306305
results[tally.name]["pSv cm3 per second"] = {
@@ -317,9 +316,10 @@ def process_results(
317316
elif "_on_2D_mesh" in tally.name:
318317
# score = tally.name.split("_")[0]
319318
_save_2d_mesh_tally_as_png(
320-
tally=tally,
321-
filename=tally.name.replace("(", "").replace(")", "").replace(",", "-"),
322-
)
319+
tally=tally, filename=tally.name.replace(
320+
"(", "").replace(
321+
")", "").replace(
322+
",", "-"), )
323323

324324
elif "_on_3D_mesh" in tally.name:
325325
print(f"processing {tally.name}")
@@ -364,8 +364,14 @@ def process_results(
364364
tally_label=tally.name,
365365
tally_data=data,
366366
error_data=error,
367-
outfile=tally.name.replace("(", "").replace(")", "").replace(",", "-")
368-
+ ".vtk",
367+
outfile=tally.name.replace(
368+
"(",
369+
"").replace(
370+
")",
371+
"").replace(
372+
",",
373+
"-") +
374+
".vtk",
369375
)
370376

371377
elif "_on_3D_u_mesh" in tally.name:

0 commit comments

Comments
 (0)