diff --git a/yt/data_objects/construction_data_containers.py b/yt/data_objects/construction_data_containers.py index 6f86a5176d0..c4979d97b0c 100644 --- a/yt/data_objects/construction_data_containers.py +++ b/yt/data_objects/construction_data_containers.py @@ -11,7 +11,6 @@ from more_itertools import always_iterable from tqdm import tqdm -from yt.config import ytcfg from yt.data_objects.field_data import YTFieldData from yt.data_objects.selection_objects.data_selection_objects import ( YTSelectionContainer1D, @@ -497,6 +496,8 @@ def _mrep(self): return MinimalProjectionData(self) def deserialize(self, fields): + from yt.config import ytcfg + if not ytcfg.get("yt", "serialize"): return False for field in fields: @@ -516,6 +517,8 @@ def deserialize(self, fields): return deserialized_successfully def serialize(self): + from yt.config import ytcfg + if not ytcfg.get("yt", "serialize"): return self._mrep.store(self.ds.parameter_filename + ".yt") @@ -1882,6 +1885,8 @@ def export_obj( ... ) """ + from yt.config import ytcfg + if color_map is None: color_map = ytcfg.get("yt", "default_colormap") if self.vertices is None: @@ -2001,6 +2006,8 @@ def _export_obj( emit_field_max=None, emit_field_min=None, ): + from yt.config import ytcfg + if color_map is None: color_map = ytcfg.get("yt", "default_colormap") if plot_index is None: @@ -2213,6 +2220,8 @@ def export_blender( ... ) """ + from yt.config import ytcfg + if color_map is None: color_map = ytcfg.get("yt", "default_colormap") if self.vertices is None: @@ -2258,6 +2267,8 @@ def _export_blender( emit_field_max=None, emit_field_min=None, ): + from yt.config import ytcfg + if color_map is None: color_map = ytcfg.get("yt", "default_colormap") if plot_index is None: @@ -2359,6 +2370,8 @@ def export_ply( ... ] >>> surf.export_ply("my_galaxy.ply", bounds=bounds) """ + from yt.config import ytcfg + if color_map is None: color_map = ytcfg.get("yt", "default_colormap") if self.vertices is None: @@ -2394,6 +2407,8 @@ def _export_ply( color_log=True, sample_type="face", ): + from yt.config import ytcfg + if color_map is None: color_map = ytcfg.get("yt", "default_colormap") if hasattr(filename, "read"): @@ -2548,6 +2563,8 @@ def export_sketchfab( ... ) ... """ + from yt.config import ytcfg + if color_map is None: color_map = ytcfg.get("yt", "default_colormap") api_key = api_key or ytcfg.get("yt", "sketchfab_api_key") diff --git a/yt/data_objects/image_array.py b/yt/data_objects/image_array.py index c18c0e58f45..272ce82d98d 100644 --- a/yt/data_objects/image_array.py +++ b/yt/data_objects/image_array.py @@ -2,7 +2,6 @@ import numpy as np -from yt.config import ytcfg from yt.units.yt_array import YTArray from yt.visualization.image_writer import write_bitmap, write_image @@ -387,6 +386,8 @@ def write_image( >>> im_arr.write_image("test_ImageArray.png") """ + from yt.config import ytcfg + if cmap_name is None: cmap_name = ytcfg.get("yt", "default_colormap") if filename is not None and filename[-4:] != ".png": diff --git a/yt/data_objects/index_subobjects/grid_patch.py b/yt/data_objects/index_subobjects/grid_patch.py index 8e7ed4ae3e0..3fc03b9eeae 100644 --- a/yt/data_objects/index_subobjects/grid_patch.py +++ b/yt/data_objects/index_subobjects/grid_patch.py @@ -5,7 +5,6 @@ import numpy as np import yt.geometry.particle_deposit as particle_deposit -from yt.config import ytcfg from yt.data_objects.selection_objects.data_selection_objects import ( YTSelectionContainer, ) @@ -20,8 +19,6 @@ from yt.utilities.lib.mesh_utilities import clamp_edges from yt.utilities.nodal_data_utils import get_nodal_slices -RECONSTRUCT_INDEX = bool(ytcfg.get("yt", "reconstruct_index")) - class AMRGridPatch(YTSelectionContainer): _spatial = True @@ -163,6 +160,8 @@ def _prepare_grid(self): # This is definitely the slowest part of generating the index # Now we give it pointers to all of its attributes # Note that to keep in line with Enzo, we have broken PEP-8 + from yt.config import ytcfg + h = self.index # cache it my_ind = self.id - self._id_offset self.ActiveDimensions = h.grid_dimensions[my_ind] @@ -170,7 +169,7 @@ def _prepare_grid(self): self.RightEdge = h.grid_right_edge[my_ind] # This can be expensive so we allow people to disable this behavior # via a config option - if RECONSTRUCT_INDEX: + if ytcfg.get("yt", "reconstruct_index"): if is_sequence(self.Parent) and len(self.Parent) > 0: p = self.Parent[0] else: diff --git a/yt/data_objects/particle_trajectories.py b/yt/data_objects/particle_trajectories.py index 5d988d6d77a..ee5526157a0 100644 --- a/yt/data_objects/particle_trajectories.py +++ b/yt/data_objects/particle_trajectories.py @@ -1,6 +1,5 @@ import numpy as np -from yt.config import ytcfg from yt.data_objects.field_data import YTFieldData from yt.funcs import get_pbar, mylog from yt.units.yt_array import array_like_field @@ -59,6 +58,7 @@ class ParticleTrajectories: def __init__( self, outputs, indices, fields=None, suppress_logging=False, ptype=None ): + from yt.config import ytcfg indices.sort() # Just in case the caller wasn't careful self.field_data = YTFieldData() @@ -218,6 +218,7 @@ def _get_data(self, fields): The trajectory collection itself is a dict of 2D numpy arrays, with shape (num_indices, num_steps) """ + from yt.config import ytcfg missing_fields = [field for field in fields if field not in self.field_data] if not missing_fields: diff --git a/yt/data_objects/static_output.py b/yt/data_objects/static_output.py index 7295c6a6ba6..a93c3c95284 100644 --- a/yt/data_objects/static_output.py +++ b/yt/data_objects/static_output.py @@ -14,7 +14,6 @@ from unyt.exceptions import UnitConversionError, UnitParseError from yt._maintenance.deprecation import issue_deprecation_warning -from yt.config import ytcfg from yt.data_objects.particle_filters import filter_registry from yt.data_objects.particle_unions import ParticleUnion from yt.data_objects.region_expression import RegionExpression @@ -57,7 +56,9 @@ _cached_datasets = weakref.WeakValueDictionary() -_ds_store = ParameterFileStore() + +# TODO: this needs an actual solution +_ds_store = None # ParameterFileStore() def _unsupported_object(ds, obj_name): @@ -149,6 +150,8 @@ class Dataset(abc.ABC): domain_center = MutableAttribute(True) def __new__(cls, filename=None, *args, **kwargs): + from yt.config import ytcfg + if not isinstance(filename, str): obj = object.__new__(cls) # The Stream frontend uses a StreamHandler object to pass metadata diff --git a/yt/data_objects/time_series.py b/yt/data_objects/time_series.py index ab241b01391..bc08fff2fb3 100644 --- a/yt/data_objects/time_series.py +++ b/yt/data_objects/time_series.py @@ -8,7 +8,6 @@ import numpy as np from more_itertools import always_iterable -from yt.config import ytcfg from yt.data_objects.analyzer_objects import AnalysisTask, create_quantity_proxy from yt.data_objects.particle_trajectories import ParticleTrajectories from yt.funcs import is_sequence, mylog @@ -193,6 +192,8 @@ def _get_filenames_from_glob_pattern(outputs): Helper function to DatasetSeries.__new__ handle a special case where "outputs" is assumed to be really a pattern string """ + from yt.config import ytcfg + pattern = outputs epattern = os.path.expanduser(pattern) data_dir = ytcfg.get("yt", "test_data_dir") diff --git a/yt/fields/xray_emission_fields.py b/yt/fields/xray_emission_fields.py index 60532aec855..49eb17c5156 100644 --- a/yt/fields/xray_emission_fields.py +++ b/yt/fields/xray_emission_fields.py @@ -2,7 +2,6 @@ import numpy as np -from yt.config import ytcfg from yt.fields.derived_field import DerivedField from yt.funcs import mylog, only_on_root, parse_h5_attr from yt.units.yt_array import YTArray, YTQuantity @@ -20,6 +19,8 @@ def _get_data_file(table_type, data_dir=None): + from yt.config import ytcfg + data_file = "%s_emissivity_v%d.h5" % (table_type, data_version[table_type]) if data_dir is None: supp_data_dir = ytcfg.get("yt", "supp_data_dir") diff --git a/yt/frontends/amrvac/data_structures.py b/yt/frontends/amrvac/data_structures.py index 4cf8dc32986..ba7a8c569d3 100644 --- a/yt/frontends/amrvac/data_structures.py +++ b/yt/frontends/amrvac/data_structures.py @@ -15,7 +15,6 @@ import numpy as np from more_itertools import always_iterable -from yt.config import ytcfg from yt.data_objects.index_subobjects.grid_patch import AMRGridPatch from yt.data_objects.static_output import Dataset from yt.funcs import mylog, setdefaultattr @@ -191,6 +190,7 @@ def __init__( """ # note: geometry_override and parfiles are specific to this frontend + from yt.config import ytcfg self._geometry_override = geometry_override super().__init__( diff --git a/yt/frontends/fits/data_structures.py b/yt/frontends/fits/data_structures.py index 580681d0eff..fc582a533b9 100644 --- a/yt/frontends/fits/data_structures.py +++ b/yt/frontends/fits/data_structures.py @@ -9,7 +9,6 @@ import numpy.core.defchararray as np_char from more_itertools import always_iterable -from yt.config import ytcfg from yt.data_objects.index_subobjects.grid_patch import AMRGridPatch from yt.data_objects.static_output import Dataset from yt.funcs import mylog, setdefaultattr @@ -330,6 +329,7 @@ def __init__( units_override=None, unit_system="cgs", ): + from yt.config import ytcfg if parameters is None: parameters = {} diff --git a/yt/frontends/owls/fields.py b/yt/frontends/owls/fields.py index 5bf919f202d..1fc4af06e97 100644 --- a/yt/frontends/owls/fields.py +++ b/yt/frontends/owls/fields.py @@ -2,7 +2,6 @@ import numpy as np -from yt.config import ytcfg from yt.fields.species_fields import ( add_species_field_by_density, add_species_field_by_fraction, @@ -319,6 +318,7 @@ def setup_fluid_fields(self): # exist it will download the data from http://yt-project.org/data # ------------------------------------------------------------- def _get_owls_ion_data_dir(self): + from yt.config import ytcfg txt = "Attempting to download ~ 30 Mb of owls ion data from %s to %s." data_file = "owls_ion_data.tar.gz" diff --git a/yt/frontends/ramses/definitions.py b/yt/frontends/ramses/definitions.py index d446312fe47..63eeb5dda16 100644 --- a/yt/frontends/ramses/definitions.py +++ b/yt/frontends/ramses/definitions.py @@ -1,8 +1,7 @@ # These functions are RAMSES-specific import re -from yt.config import ytcfg -from yt.funcs import mylog +# from yt.funcs import mylog def ramses_header(hvals): @@ -69,6 +68,8 @@ def ramses_header(hvals): "gas_tracer": 0, } +# TODO: this needs an actual solution +""" if ytcfg.has_section("ramses-families"): for key in particle_families.keys(): val = ytcfg.get("ramses-families", key, fallback=None) @@ -77,3 +78,4 @@ def ramses_header(hvals): "Changing family %s from %s to %s", key, particle_families[key], val ) particle_families[key] = val +""" diff --git a/yt/frontends/ramses/field_handlers.py b/yt/frontends/ramses/field_handlers.py index a50cfae95eb..257cefb9cbd 100644 --- a/yt/frontends/ramses/field_handlers.py +++ b/yt/frontends/ramses/field_handlers.py @@ -3,7 +3,6 @@ import os from typing import List -from yt.config import ytcfg from yt.funcs import mylog from yt.utilities.cython_fortran_utils import FortranFile @@ -305,6 +304,8 @@ class HydroFieldFileHandler(FieldFileHandler): @classmethod def detect_fields(cls, ds): # Try to get the detected fields + from yt.config import ytcfg + detected_fields = cls.get_detected_fields(ds) if detected_fields: return detected_fields diff --git a/yt/frontends/ramses/particle_handlers.py b/yt/frontends/ramses/particle_handlers.py index 39866edb4f8..cc79d4f7ab5 100644 --- a/yt/frontends/ramses/particle_handlers.py +++ b/yt/frontends/ramses/particle_handlers.py @@ -1,7 +1,6 @@ import abc import os -from yt.config import ytcfg from yt.funcs import mylog from yt.utilities.cython_fortran_utils import FortranFile @@ -60,6 +59,8 @@ def __init_subclass__(cls, *args, **kwargs): return cls def __init__(self, domain): + from yt.config import ytcfg + self.setup_handler(domain) # Attempt to read the list of fields from the config file diff --git a/yt/geometry/geometry_handler.py b/yt/geometry/geometry_handler.py index e37f58097a2..bf244a301e8 100644 --- a/yt/geometry/geometry_handler.py +++ b/yt/geometry/geometry_handler.py @@ -4,7 +4,6 @@ import numpy as np -from yt.config import ytcfg from yt.units.yt_array import YTArray, uconcatenate from yt.utilities.exceptions import YTFieldNotFound from yt.utilities.io_handler import io_registry @@ -54,6 +53,8 @@ def _initialize_state_variables(self): self.num_grids = None def _initialize_data_storage(self): + from yt.config import ytcfg + if not ytcfg.get("yt", "serialize"): return fn = self.ds.storage_filename diff --git a/yt/geometry/grid_geometry_handler.py b/yt/geometry/grid_geometry_handler.py index 332e1255c63..88481cc35a0 100644 --- a/yt/geometry/grid_geometry_handler.py +++ b/yt/geometry/grid_geometry_handler.py @@ -5,7 +5,6 @@ import numpy as np from yt.arraytypes import blankRecordArray -from yt.config import ytcfg from yt.fields.derived_field import ValidateSpatial from yt.fields.field_detector import FieldDetector from yt.funcs import ensure_numpy_array, iter_fields @@ -402,6 +401,8 @@ def _chunk_io( preload_fields=None, chunk_sizing="auto", ): + from yt.config import ytcfg + # local_only is only useful for inline datasets and requires # implementation by subclasses. if preload_fields is None: diff --git a/yt/testing.py b/yt/testing.py index a22944c0168..f6198ffe6e4 100644 --- a/yt/testing.py +++ b/yt/testing.py @@ -16,7 +16,6 @@ from numpy.random import RandomState from unyt.exceptions import UnitOperationError -from yt.config import ytcfg from yt.funcs import is_sequence from yt.loaders import load from yt.units.yt_array import YTArray, YTQuantity @@ -932,6 +931,8 @@ def inner_func(*args, **kwargs): def requires_file(req_file): from nose import SkipTest + from yt.config import ytcfg + path = ytcfg.get("yt", "test_data_dir") def ffalse(func): @@ -962,6 +963,8 @@ def true_wrapper(*args, **kwargs): def disable_dataset_cache(func): @functools.wraps(func) def newfunc(*args, **kwargs): + from yt.config import ytcfg + restore_cfg_state = False if not ytcfg.get("yt", "skip_dataset_cache"): ytcfg["yt", "skip_dataset_cache"] = True @@ -1341,6 +1344,8 @@ def requires_backend(backend): """ import pytest + from yt.config import ytcfg + def ffalse(func): # returning a lambda : None causes an error when using pytest. Having # a function (skip) that returns None does work, but pytest marks the diff --git a/yt/utilities/logger.py b/yt/utilities/logger.py index fccc8fea7cd..1745e3b4a2a 100644 --- a/yt/utilities/logger.py +++ b/yt/utilities/logger.py @@ -1,7 +1,8 @@ import logging -import sys -from yt.config import ytcfg +# import sys + +# from yt.config import ytcfg # This next bit is grabbed from: # http://stackoverflow.com/questions/384076/how-can-i-make-the-python-logging-output-to-be-colored @@ -60,11 +61,13 @@ def set_log_level(level): ufstring = "%(name)-3s: [%(levelname)-9s] %(asctime)s %(message)s" cfstring = "%(name)-3s: [%(levelname)-18s] %(asctime)s %(message)s" +# TODO: this needs an actual solution +""" if ytcfg.get("yt", "stdout_stream_logging"): stream = sys.stdout else: stream = sys.stderr - +""" ytLogger = logging.getLogger("yt") @@ -113,10 +116,13 @@ def disable_stream_logging(): ytLogger.addHandler(h) +# TODO: this needs an actual solution +""" def colorize_logging(): f = logging.Formatter(cfstring) ytLogger.handlers[0].setFormatter(f) yt_sh.emit = add_coloring_to_emit_ansi(yt_sh.emit) +""" def uncolorize_logging(): @@ -131,6 +137,9 @@ def uncolorize_logging(): pass +# TODO: this needs an actual solution +""" + _level = min(max(ytcfg.get("yt", "log_level"), 0), 50) if ytcfg.get("yt", "suppress_stream_logging"): @@ -149,3 +158,4 @@ def uncolorize_logging(): if ytcfg.get("yt", "colored_logs"): colorize_logging() +""" diff --git a/yt/utilities/parallel_tools/parallel_analysis_interface.py b/yt/utilities/parallel_tools/parallel_analysis_interface.py index b64ba701f70..a4ede882a72 100644 --- a/yt/utilities/parallel_tools/parallel_analysis_interface.py +++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py @@ -10,7 +10,6 @@ from more_itertools import always_iterable import yt.utilities.logger -from yt.config import ytcfg from yt.data_objects.image_array import ImageArray from yt.funcs import is_sequence from yt.units.unit_registry import UnitRegistry @@ -84,6 +83,8 @@ def enable_parallelism(suppress_logging=False, communicator=None): The MPI communicator to use. This controls which processes yt can see. If not specified, will be set to COMM_WORLD. """ + from yt.config import ytcfg + global parallel_capable, MPI try: from mpi4py import MPI as _MPI @@ -162,6 +163,8 @@ class ObjectIterator: """ def __init__(self, pobj, just_list=False, attr="_grids"): + from yt.config import ytcfg + self.pobj = pobj if hasattr(pobj, attr) and getattr(pobj, attr) is not None: gs = getattr(pobj, attr) @@ -1217,6 +1220,8 @@ def partition_index_2d(self, axis): return True, reg def partition_index_3d(self, ds, padding=0.0, rank_ratio=1): + from yt.config import ytcfg + LE, RE = np.array(ds.left_edge), np.array(ds.right_edge) # We need to establish if we're looking at a subvolume, in which case # we *do* want to pad things. diff --git a/yt/utilities/parameter_file_storage.py b/yt/utilities/parameter_file_storage.py index f9e733e5157..374c5b0db3b 100644 --- a/yt/utilities/parameter_file_storage.py +++ b/yt/utilities/parameter_file_storage.py @@ -2,7 +2,6 @@ import os.path from itertools import islice -from yt.config import ytcfg from yt.funcs import mylog from yt.utilities.object_registries import output_type_registry from yt.utilities.parallel_tools.parallel_analysis_interface import ( @@ -54,6 +53,8 @@ def __init__(self, in_memory=False): Otherwise, use read-only settings. """ + from yt.config import ytcfg + if not self._register: return if ytcfg.get("yt", "store_parameter_files"): @@ -82,6 +83,8 @@ def init_db(self): # these will be broadcast def _get_db_name(self): + from yt.config import ytcfg + base_file_name = ytcfg.get("yt", "parameter_file_store") if not os.access(os.path.expanduser("~/"), os.W_OK): return os.path.abspath(base_file_name) @@ -170,6 +173,8 @@ def get_recent(self, n=10): @parallel_simple_proxy def _write_out(self): + from yt.config import ytcfg + if self._read_only: return fn = self._get_db_name() diff --git a/yt/visualization/image_writer.py b/yt/visualization/image_writer.py index 4b184e65063..72cf7c3a585 100644 --- a/yt/visualization/image_writer.py +++ b/yt/visualization/image_writer.py @@ -2,7 +2,6 @@ import numpy as np -from yt.config import ytcfg from yt.funcs import mylog from yt.units.yt_array import YTQuantity from yt.utilities import png_writer as pw @@ -197,6 +196,8 @@ def write_image(image, filename, color_bounds=None, cmap_name=None, func=lambda >>> frb1 = FixedResolutionBuffer(sl, (0.2, 0.3, 0.4, 0.5), (1024, 1024)) >>> write_image(frb1[("gas", "density")], "saved.png") """ + from yt.config import ytcfg + if cmap_name is None: cmap_name = ytcfg.get("yt", "default_colormap") if len(image.shape) == 3: @@ -233,6 +234,8 @@ def apply_colormap(image, color_bounds=None, cmap_name=None, func=lambda x: x): to_plot : uint8 image with colorbar applied. """ + from yt.config import ytcfg + if cmap_name is None: cmap_name = ytcfg.get("yt", "default_colormap") from yt.data_objects.image_array import ImageArray @@ -391,6 +394,8 @@ def write_projection( ... take_log=True, ... ) """ + from yt.config import ytcfg + if cmap_name is None: cmap_name = ytcfg.get("yt", "default_colormap") import matplotlib.colors diff --git a/yt/visualization/plot_container.py b/yt/visualization/plot_container.py index d97a067fd77..bd56358b900 100644 --- a/yt/visualization/plot_container.py +++ b/yt/visualization/plot_container.py @@ -10,7 +10,6 @@ from matplotlib.font_manager import FontProperties from more_itertools.more import always_iterable -from yt.config import ytcfg from yt.data_objects.time_series import DatasetSeries from yt.funcs import dictWithFactory, ensure_dir, is_sequence, iter_fields, mylog from yt.units import YTQuantity @@ -242,6 +241,8 @@ def __init__(self, data_source, figure_size, fontsize): self.setup_defaults() def setup_defaults(self): + from yt.config import ytcfg + def default_from_config(keys, defaults): _keys = list(always_iterable(keys)) _defaults = list(always_iterable(defaults)) diff --git a/yt/visualization/plot_window.py b/yt/visualization/plot_window.py index 0612453ea82..6f598e9363c 100644 --- a/yt/visualization/plot_window.py +++ b/yt/visualization/plot_window.py @@ -10,7 +10,6 @@ from packaging.version import Version from unyt.exceptions import UnitConversionError -from yt.config import ytcfg from yt.data_objects.image_array import ImageArray from yt.frontends.ytdata.data_structures import YTSpatialPlotDataset from yt.funcs import fix_axis, fix_unitary, is_sequence, iter_fields, mylog, obj_length @@ -290,6 +289,8 @@ def fdel(self): frb = property(**frb()) def _recreate_frb(self): + from yt.config import ytcfg + old_fields = None # If we are regenerating an frb, we want to know what fields we had before if self._frb is not None: diff --git a/yt/visualization/volume_rendering/render_source.py b/yt/visualization/volume_rendering/render_source.py index 8a569699a79..b741a878879 100644 --- a/yt/visualization/volume_rendering/render_source.py +++ b/yt/visualization/volume_rendering/render_source.py @@ -3,7 +3,6 @@ import numpy as np -from yt.config import ytcfg from yt.data_objects.image_array import ImageArray from yt.funcs import ensure_numpy_array, is_sequence, mylog from yt.geometry.grid_geometry_handler import GridIndex @@ -35,18 +34,19 @@ ) from .zbuffer_array import ZBuffer +# TODO: migrate this to yt.config try: from yt.utilities.lib.embree_mesh import mesh_traversal # Catch ValueError in case size of objects in Cython change except (ImportError, ValueError): mesh_traversal = NotAModule("pyembree") - ytcfg["yt", "ray_tracing_engine"] = "yt" + # ytcfg["yt", "ray_tracing_engine"] = "yt" try: from yt.utilities.lib.embree_mesh import mesh_construction # Catch ValueError in case size of objects in Cython change except (ImportError, ValueError): mesh_construction = NotAModule("pyembree") - ytcfg["yt", "ray_tracing_engine"] = "yt" + # ytcfg["yt", "ray_tracing_engine"] = "yt" def invalidate_volume(f): @@ -666,6 +666,8 @@ class MeshSource(OpaqueSource): def __init__(self, data_source, field): r"""Initialize a new unstructured mesh source for rendering.""" + from yt.config import ytcfg + super().__init__() self.data_source = data_source_or_all(data_source) field = self.data_source._determine_fields(field)[0] @@ -1318,6 +1320,8 @@ class GridSource(LineSource): def __init__( self, data_source, alpha=0.3, cmap=None, min_level=None, max_level=None ): + from yt.config import ytcfg + self.data_source = data_source_or_all(data_source) corners = [] levels = [] diff --git a/yt/visualization/volume_rendering/scene.py b/yt/visualization/volume_rendering/scene.py index 90f9b449107..d7259197f85 100644 --- a/yt/visualization/volume_rendering/scene.py +++ b/yt/visualization/volume_rendering/scene.py @@ -5,7 +5,6 @@ import numpy as np -from yt.config import ytcfg from yt.funcs import mylog from yt.units.dimensions import length from yt.units.unit_registry import UnitRegistry @@ -758,6 +757,8 @@ def annotate_grids( >>> im = sc.render() """ + from yt.config import ytcfg + if cmap is None: cmap = ytcfg.get("yt", "default_colormap") grids = GridSource(