Configuration Reference¶
XPCS Viewer is configured through environment variables. All variables have sensible defaults and are optional.
Backend Configuration¶
These variables control the computational backend (JAX vs. NumPy) and GPU device selection.
Variable |
Default |
Description |
|---|---|---|
|
|
Backend selection. |
|
|
Enable GPU device for JAX computations. Requires JAX with GPU support
( |
|
|
When GPU is requested but unavailable, fall back to CPU instead of raising an error. |
|
|
Maximum fraction of GPU memory JAX may use (0.0 to 1.0). Maps to
|
JAX Platform Variables (passed through to JAX):
Variable |
Default |
Description |
|---|---|---|
|
(unset) |
Force JAX platform: |
|
|
Enable float64 support (required for scientific precision). XPCS Viewer sets this automatically. |
|
|
GPU memory fraction. Set automatically from |
Examples¶
Force NumPy backend (no JAX dependency):
export XPCS_USE_JAX=false
python -m xpcsviewer
Enable GPU acceleration:
export XPCS_USE_JAX=true
export XPCS_USE_GPU=true
export XPCS_GPU_MEMORY_FRACTION=0.8
python -m xpcsviewer
Force CPU-only JAX (useful for debugging):
export XPCS_USE_JAX=true
export JAX_PLATFORMS=cpu
python -m xpcsviewer
Logging Configuration¶
These variables control the logging system. See Logging Guide for detailed usage examples.
Variable |
Default |
Description |
|---|---|---|
|
|
Log level: |
|
|
Log format: |
|
|
Directory for log files. Created automatically if it does not exist. |
|
|
Custom log file path. Overrides the default file within |
|
|
Maximum log file size in megabytes before rotation. |
|
|
Number of rotated log files to keep. |
|
|
Default rate limit for |
|
|
Path sanitization mode in logs: |
|
|
Enable session correlation IDs in log records. Set to |
|
|
Set to |
Examples¶
Enable debug logging with JSON format:
export PYXPCS_LOG_LEVEL=DEBUG
export PYXPCS_LOG_FORMAT=JSON
python -m xpcsviewer
Reduce log file size for constrained environments:
export PYXPCS_LOG_MAX_SIZE=2
export PYXPCS_LOG_BACKUP_COUNT=3
python -m xpcsviewer
Disable path sanitization for development:
export PYXPCS_LOG_SANITIZE_PATHS=none
python -m xpcsviewer
Documentation Build¶
Variable |
Default |
Description |
|---|---|---|
|
(unset) |
Set to |
Combining Configuration¶
A typical production configuration for a GPU-equipped workstation at a beamline:
# Backend: JAX with GPU
export XPCS_USE_JAX=true
export XPCS_USE_GPU=true
export XPCS_GPU_MEMORY_FRACTION=0.7
# Logging: structured JSON, moderate verbosity
export PYXPCS_LOG_LEVEL=INFO
export PYXPCS_LOG_FORMAT=JSON
export PYXPCS_LOG_SANITIZE_PATHS=hash
# Suppress Qt noise
export PYXPCS_SUPPRESS_QT_WARNINGS=1
python -m xpcsviewer
A development configuration for debugging:
# Backend: NumPy for deterministic behavior
export XPCS_USE_JAX=false
# Logging: verbose, unsanitized paths
export PYXPCS_LOG_LEVEL=DEBUG
export PYXPCS_LOG_FORMAT=TEXT
export PYXPCS_LOG_SANITIZE_PATHS=none
python -m xpcsviewer