File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 66from pathlib import Path
77import math
88from numbers import Integral , Real
9+ import os
910import random
1011import re
1112from tempfile import NamedTemporaryFile , TemporaryDirectory
@@ -1159,26 +1160,29 @@ def plot(
11591160 x_max = (origin [x ] + 0.5 * width [0 ]) * axis_scaling_factor [axis_units ]
11601161 y_min = (origin [y ] - 0.5 * width [1 ]) * axis_scaling_factor [axis_units ]
11611162 y_max = (origin [y ] + 0.5 * width [1 ]) * axis_scaling_factor [axis_units ]
1163+
1164+ mg_cross_sections = os .devnull
11621165
11631166 # Determine whether any materials contains macroscopic data and if so,
11641167 # set energy mode accordingly and check that mg cross sections path is accessible
11651168 for mat in self .geometry .get_all_materials ().values ():
11661169 if mat ._macroscopic is not None :
11671170 self .settings .energy_mode = 'multi-group'
11681171 try :
1169- openmc . config [ ' mg_cross_sections' ] = Path (openmc .config ['mg_cross_sections' ]).resolve ()
1172+ mg_cross_sections = Path (openmc .config ['mg_cross_sections' ]).resolve ()
11701173 except KeyError :
11711174 raise RuntimeError ("'mg_cross_sections' path must be set before plotting." )
11721175 break
1173-
1174- # Get ID map from the C API
1175- id_map = self .id_map (
1176- origin = origin ,
1177- width = width ,
1178- pixels = pixels ,
1179- basis = basis ,
1180- color_overlaps = show_overlaps
1181- )
1176+
1177+ with openmc .config .patch ('mg_cross_sections' , mg_cross_sections ):
1178+ # Get ID map from the C API
1179+ id_map = self .id_map (
1180+ origin = origin ,
1181+ width = width ,
1182+ pixels = pixels ,
1183+ basis = basis ,
1184+ color_overlaps = show_overlaps
1185+ )
11821186
11831187 # Generate colors if not provided
11841188 if colors is None and seed is not None :
You can’t perform that action at this time.
0 commit comments