@@ -471,7 +471,8 @@ def _create_tally_mesh_image(self, tally, tally_value, scores, nuclides, view=No
471471 cv = self .currentView
472472
473473 sp = self .statepoint
474- mesh = tally .find_filter (openmc .MeshFilter ).mesh
474+ mesh_filter = tally .find_filter (openmc .MeshFilter )
475+ mesh = mesh_filter .mesh
475476
476477 def _do_op (array , tally_value , ax = 0 ):
477478 if tally_value == 'mean' :
@@ -496,8 +497,16 @@ def _do_op(array, tally_value, ax=0):
496497 v_ind = 2
497498 ax = 1
498499
500+ # adjust corners of the mesh for a translation
501+ # applied to the mesh filter
502+ lower_left = mesh .lower_left
503+ upper_right = mesh .upper_right
504+ if hasattr (mesh_filter , 'translation' ) and mesh_filter .translation is not None :
505+ lower_left += mesh_filter .translation
506+ upper_right += mesh_filter .translation
507+
499508 # reduce data to the visible slice of the mesh values
500- k = int ((view .origin [ax ] - mesh . lower_left [ax ]) // mesh .width [ax ])
509+ k = int ((view .origin [ax ] - lower_left [ax ]) // mesh .width [ax ])
501510
502511 # setup slice
503512 data_slice = [None , None , None ]
@@ -559,8 +568,8 @@ def _do_op(array, tally_value, ax=0):
559568 image_data = data [::- 1 , ...]
560569
561570 # return data extents (in cm) for the tally
562- extents = [mesh . lower_left [h_ind ], mesh . upper_right [h_ind ],
563- mesh . lower_left [v_ind ], mesh . upper_right [v_ind ]]
571+ extents = [lower_left [h_ind ], upper_right [h_ind ],
572+ lower_left [v_ind ], upper_right [v_ind ]]
564573
565574 return image_data , extents , data_min , data_max
566575
0 commit comments