@@ -17,11 +17,7 @@ class Tally(openmc.Tally):
1717 specified materials or volumes.
1818 """
1919
20- def __init__ (
21- self ,
22- tally_type ,
23- ** kwargs
24- ):
20+ def __init__ (self , tally_type , ** kwargs ):
2521
2622 self .tally_type = tally_type
2723 super ().__init__ (** kwargs )
@@ -61,9 +57,12 @@ def tally_type(self, value):
6157
6258 def set_score (self ):
6359 flux_scores = [
64- "neutron_fast_flux" , "photon_fast_flux" ,
65- "neutron_spectra" , "photon_spectra" ,
66- "neutron_effective_dose" , "photon_effective_dose"
60+ "neutron_fast_flux" ,
61+ "photon_fast_flux" ,
62+ "neutron_spectra" ,
63+ "photon_spectra" ,
64+ "neutron_effective_dose" ,
65+ "photon_effective_dose" ,
6766 ]
6867
6968 if self .tally_type == "TBR" :
@@ -155,29 +154,25 @@ class CellTallies:
155154 h5m_filename
156155 """
157156
158- def __init__ (
159- self ,
160- tally_types ,
161- targets = [None ],
162- materials = None ,
163- h5m_filename = None ):
157+ def __init__ (self , tally_types , targets = [None ], materials = None , h5m_filename = None ):
164158 self .tallies = []
165159 self .tally_types = tally_types
166160 self .targets = targets
167161 self .materials = materials
168162 self .h5m_filename = h5m_filename
169163
170- if self .targets == ' all_volumes' :
164+ if self .targets == " all_volumes" :
171165 all_targets = di .get_volumes_from_h5m (self .h5m_filename )
172- elif self .targets == ' all_materials' :
166+ elif self .targets == " all_materials" :
173167 all_targets = di .get_materials_from_h5m (self .h5m_filename )
174168 else :
175169 all_targets = self .targets
176170
177171 for score in self .tally_types :
178172 for target in all_targets :
179- self .tallies .append (CellTally (
180- tally_type = score , target = target , materials = materials ))
173+ self .tallies .append (
174+ CellTally (tally_type = score , target = target , materials = materials )
175+ )
181176
182177
183178class TetMeshTally (Tally ):
@@ -208,11 +203,9 @@ def create_unstructured_mesh(self):
208203 # format
209204 library = "moab"
210205 else :
211- msg = ("only h5m or exo files are accepted as valid "
212- "filename values" )
206+ msg = "only h5m or exo files are accepted as valid " "filename values"
213207 raise ValueError (msg )
214- self .umesh = openmc .UnstructuredMesh (
215- self .filename , library = library )
208+ self .umesh = openmc .UnstructuredMesh (self .filename , library = library )
216209
217210
218211class TetMeshTallies :
@@ -231,17 +224,12 @@ def __init__(self, tally_types, filenames):
231224 self .tally_types = tally_types
232225 for score in self .tally_types :
233226 for filename in filenames :
234- self .tallies .append (
235- TetMeshTally (tally_type = score , filename = filename ))
227+ self .tallies .append (TetMeshTally (tally_type = score , filename = filename ))
236228
237229
238230class MeshTally3D (Tally ):
239231 def __init__ (
240- self ,
241- tally_type ,
242- mesh_resolution = (100 , 100 , 100 ),
243- bounding_box = None ,
244- ** kwargs
232+ self , tally_type , mesh_resolution = (100 , 100 , 100 ), bounding_box = None , ** kwargs
245233 ):
246234 self .tally_type = tally_type
247235 self .mesh_resolution = mesh_resolution
@@ -253,8 +241,7 @@ def __init__(
253241 def add_mesh_filter (self , bounding_box ):
254242
255243 if isinstance (bounding_box , str ):
256- self .bounding_box = find_bounding_box (
257- h5m_filename = bounding_box )
244+ self .bounding_box = find_bounding_box (h5m_filename = bounding_box )
258245 else :
259246 self .bounding_box = bounding_box
260247
@@ -277,10 +264,7 @@ class MeshTallies3D:
277264 """
278265
279266 def __init__ (
280- self ,
281- tally_types ,
282- meshes_resolution = (100 , 100 , 100 ),
283- bounding_box = None
267+ self , tally_types , meshes_resolution = (100 , 100 , 100 ), bounding_box = None
284268 ):
285269 self .tallies = []
286270 self .tally_types = tally_types
@@ -289,7 +273,8 @@ def __init__(
289273 MeshTally3D (
290274 tally_type = tally_type ,
291275 mesh_resolution = meshes_resolution ,
292- bounding_box = bounding_box )
276+ bounding_box = bounding_box ,
277+ )
293278 )
294279
295280
@@ -305,11 +290,7 @@ class MeshTally2D(Tally):
305290 """
306291
307292 def __init__ (
308- self ,
309- tally_type ,
310- plane ,
311- mesh_resolution = (400 , 400 ),
312- bounding_box = None
293+ self , tally_type , plane , mesh_resolution = (400 , 400 ), bounding_box = None
313294 ):
314295 self .tally_type = tally_type
315296 self .plane = plane
@@ -403,8 +384,7 @@ def set_bounding_box(self, bounding_box):
403384
404385 if isinstance (bounding_box , str ):
405386 self .bbox_from_h5 = True
406- self .bounding_box = find_bounding_box (
407- h5m_filename = bounding_box )
387+ self .bounding_box = find_bounding_box (h5m_filename = bounding_box )
408388 else :
409389 self .bbox_from_h5 = False
410390 self .bounding_box = bounding_box
@@ -434,9 +414,11 @@ def __init__(
434414 for plane in planes :
435415 self .tallies .append (
436416 MeshTally2D (
437- tally_type = tally_type , plane = plane ,
417+ tally_type = tally_type ,
418+ plane = plane ,
438419 mesh_resolution = meshes_resolution ,
439- bounding_box = bounding_box )
420+ bounding_box = bounding_box ,
421+ )
440422 )
441423
442424
@@ -471,12 +453,12 @@ def compute_filters(tally_type):
471453 additional_filters = [photon_particle_filter , energy_filter ]
472454 elif tally_type == "neutron_effective_dose" :
473455 energy_function_filter_n = openmc .EnergyFunctionFilter (
474- energy_bins_n , dose_coeffs_n )
475- additional_filters = [
476- neutron_particle_filter , energy_function_filter_n ]
456+ energy_bins_n , dose_coeffs_n
457+ )
458+ additional_filters = [ neutron_particle_filter , energy_function_filter_n ]
477459 elif tally_type == "photon_effective_dose" :
478460 energy_function_filter_p = openmc .EnergyFunctionFilter (
479- energy_bins_p , dose_coeffs_p )
480- additional_filters = [
481- photon_particle_filter , energy_function_filter_p ]
461+ energy_bins_p , dose_coeffs_p
462+ )
463+ additional_filters = [ photon_particle_filter , energy_function_filter_p ]
482464 return additional_filters
0 commit comments