Skip to content

Config Reference

Complete reference for the COMPASS configuration schema. All configuration is validated by Pydantic models defined in compass.core.config_schema.

Top-level: CompassConfig

yaml
pixel: ...          # PixelConfig
solver: ...         # SolverConfig
source: ...         # SourceConfig
compute: ...        # ComputeConfig
experiment_name: "default"
output_dir: "./outputs"
seed: 42
FieldTypeDefaultDescription
experiment_namestr"default"Experiment identifier for output directory
output_dirstr"./outputs"Base output directory
seedint42Random seed for reproducibility

pixel: PixelConfig

yaml
pixel:
  pitch: 1.0
  unit_cell: [2, 2]
  bayer_map: [["R", "G"], ["G", "B"]]
  layers: ...       # LayersConfig
FieldTypeDefaultDescription
pitchfloat1.0Pixel pitch in um
unit_cell[int, int][2, 2]Unit cell size [rows, cols]
bayer_maplist[list[str]][["R","G"],["G","B"]]Color channel map

pixel.layers: LayersConfig

yaml
layers:
  air: {thickness: 1.0, material: "air"}
  microlens: ...
  planarization: {thickness: 0.3, material: "sio2"}
  color_filter: ...
  barl: ...
  silicon: ...

Interactive Pixel Stack Builder

Adjust the thickness of each layer in a BSI pixel cross-section. The visualization shows the vertical stack with refractive indices and a scale bar.

Total stack height:4.58 um
0.01.02.03.04.0Microlens0.60 umn=1.56Planarization0.30 umn=1.46Color Filter0.60 umn=1.55n=1.8Silicon3.00 umn=3.5DTI

pixel.layers.microlens: MicrolensConfig

FieldTypeDefaultDescription
enabledbooltrueEnable microlens
heightfloat0.6Lens sag height (um)
radius_xfloat0.48Semi-axis x (um)
radius_yfloat0.48Semi-axis y (um)
materialstr"polymer_n1p56"Lens material
profile.typestr"superellipse"Profile model
profile.nfloat2.5Squareness parameter
profile.alphafloat1.0Curvature parameter
shift.modestr"auto_cra"Shift mode: "none", "manual", "auto_cra"
shift.cra_degfloat0.0CRA for auto shift (degrees)
shift.shift_xfloat0.0Manual x-shift (um)
shift.shift_yfloat0.0Manual y-shift (um)
gapfloat0.0Inter-lens gap (um)

pixel.layers.color_filter: ColorFilterConfig

FieldTypeDefaultDescription
thicknessfloat0.6CFA thickness (um)
patternstr"bayer_rggb"Filter pattern
materialsdict{"R":"cf_red","G":"cf_green","B":"cf_blue"}Color-to-material mapping
grid.enabledbooltrueEnable metal grid
grid.widthfloat0.05Grid line width (um)
grid.heightfloat0.6Grid height (um)
grid.materialstr"tungsten"Grid material

pixel.layers.barl: BarlConfig

yaml
barl:
  layers:
    - {thickness: 0.010, material: "sio2"}
    - {thickness: 0.025, material: "hfo2"}

List of {thickness, material} pairs, ordered top to bottom.

pixel.layers.silicon: SiliconConfig

FieldTypeDefaultDescription
thicknessfloat3.0Silicon thickness (um)
materialstr"silicon"Substrate material
photodiode.position[float, float, float][0, 0, 0.5]PD offset (x, y, z) um
photodiode.size[float, float, float][0.7, 0.7, 2.0]PD extent (dx, dy, dz) um
dti.enabledbooltrueEnable DTI
dti.widthfloat0.1Trench width (um)
dti.depthfloat3.0Trench depth (um)
dti.materialstr"sio2"Fill material

solver: SolverConfig

yaml
solver:
  name: torcwa
  type: rcwa
  params:
    fourier_order: [9, 9]
    dtype: "complex64"
  convergence: ...
  stability: ...
FieldTypeDefaultDescription
namestr"torcwa"Solver backend name
typestr"rcwa""rcwa" or "fdtd"
paramsdict{"fourier_order": [9,9]}Solver-specific parameters

solver.convergence: ConvergenceConfig

FieldTypeDefaultDescription
auto_convergeboolfalseAuto Fourier order sweep
order_range[int, int][5, 25]Min/max Fourier order
qe_tolerancefloat0.01Convergence threshold
spacing_range[float, float] or nullnullGrid spacing range for FDTD

solver.stability: StabilityConfig

FieldTypeDefaultDescription
precision_strategystr"mixed""float32", "float64", "mixed", "adaptive"
allow_tf32boolfalseAllow TF32 on Ampere+ GPUs
eigendecomp_devicestr"cpu""cpu" or "gpu"
fourier_factorizationstr"li_inverse""naive", "li_inverse", "normal_vector"
energy_check.enabledbooltrueEnable energy balance check
energy_check.tolerancefloat0.02Max allowed
energy_check.auto_retry_float64booltrueAuto retry in float64 on failure
eigenvalue_broadeningfloat1e-10Degeneracy detection threshold
condition_number_warningfloat1e12Warn on ill-conditioned matrices

source: SourceConfig

yaml
source:
  type: planewave
  wavelength:
    mode: single
    value: 0.55
  angle:
    theta_deg: 0.0
    phi_deg: 0.0
  polarization: unpolarized
FieldTypeDefaultDescription
typestr"planewave""planewave" or "cone_illumination"
wavelength.modestr"single""single", "sweep", or "list"
wavelength.valuefloat0.55Single wavelength (um)
wavelength.sweep.startfloat0.38Sweep start (um)
wavelength.sweep.stopfloat0.78Sweep stop (um)
wavelength.sweep.stepfloat0.01Sweep step (um)
wavelength.valueslist[float]nullExplicit wavelength list
angle.theta_degfloat0.0Polar angle (degrees)
angle.phi_degfloat0.0Azimuthal angle (degrees)
polarizationstr"unpolarized""TE", "TM", or "unpolarized"

compute: ComputeConfig

yaml
compute:
  backend: auto
  gpu_id: 0
  num_workers: 4
FieldTypeDefaultDescription
backendstr"auto""auto", "cuda", "cpu", "mps"
gpu_idint0GPU device index
num_workersint4Worker threads for parallel tasks

Hydra config structure

COMPASS uses Hydra for modular configuration:

configs/
  config.yaml           # Main config with defaults
  pixel/
    default_bsi_1um.yaml
    default_bsi_0p8um.yaml
  solver/
    torcwa.yaml
    grcwa.yaml
    meent.yaml
    fdtd_flaport.yaml
  source/
    planewave.yaml
    wavelength_sweep.yaml
    cone_illumination.yaml
  compute/
    cuda.yaml
    cpu.yaml
    mps.yaml
  experiment/
    solver_comparison.yaml
    qe_benchmark.yaml
    roi_sweep.yaml

Override any parameter from the command line:

bash
python scripts/run_simulation.py \
    pixel.pitch=0.8 \
    solver.params.fourier_order=[11,11] \
    source.wavelength.mode=sweep