Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Configuration

quantEM has a global configuration system (quantem.core.config, modeled on Dask’s config) controlling the compute device, numerical precision, and visualization defaults.

Reading and setting values

from quantem.core import config

config.get("device")
config.get("viz.cmap")

config.set({"precision": "float64"})

config.set also works as a context manager for temporary overrides:

with config.set({"device": "cuda:1"}):
    ...

Code inside the block runs on cuda:1, and the previous value is restored on exit.

Persistent configuration

The active configuration can be written to a YAML file that is read back on import:

config.write()

This writes ~/.config/quantem/config.yaml.

The configuration directory can be relocated with the QUANTEM_CONFIG environment variable.

Main keys

KeyDefaultMeaning
devicecpuCompute device (see GPU configuration)
precisionfloat32Float precision (float32 or float64)
dtype_real / dtype_complexfloat32 / complex64Real and complex dtypes
verbose1Global verbosity
viz.cmapgrayDefault image colormap
viz.phase_cmapmagmaDefault colormap for phase images
viz.real_space_unitsADefault real-space units
viz.reciprocal_space_unitsA^-1Default reciprocal-space units
viz.colors.set / viz.colors.paired(lists)Categorical color cycles for plots
mkl.threads2MKL thread count
cupy.fft-cache-size0 MBCuPy FFT plan cache size