Run configuration¶
This page lists every field of the run configuration: its section, type,
default, meaning and valid values, and how a CCPi dvc_in file maps onto it.
It is for anyone writing or reviewing a config.yaml. The configuration is a
frozen dataclass tree, zvdvc.config.RunConfig, defined in
src/zvdvc/config.py.
Where a CCPi dvc_in key exists for a field, it is named in the tables.
Terms¶
- Run configuration
One YAML file (or
RunConfigobject) that describes a whole run. Everyzvdvcstage (plan,seed,run,finalize,solve) takes it as its only positional argument.- Section
A nested mapping of the YAML file:
volumes,subvolume,search(with an optionalthresholdsub-section),seedingandcluster. The fieldspoints,output,num_points_to_process,uncertainty_seedsandworkdirsit at the top level.- Axis order
Points and vectors are \((x, y, z)\) in voxels. Shapes and boxes of arrays are \((z, y, x)\).
cluster.tile_shapeis therefore \((z, y, x)\) andsearch.rigid_trans\((x, y, z)\).- Work directory
workdir, where the stages keepplan.json, the imported point store,seeds.npz,run_stats.json, event logs and the.stat/.dispsummaries.
Introduction¶
Load a configuration with RunConfig.from_yaml(path), build one from nested
plain data with RunConfig.from_dict(d), or import a CCPi input file with
RunConfig.from_ccpi(path). to_yaml(path) and to_dict() write it back
out; zvdvc synth writes a complete config.yaml this way.
Loading is strict (from_yaml and from_dict call
validate()):
a file that is not valid YAML raises
ValueError;an unknown key raises
ValueErrornaming it (config.search: unknown keys [...]);a missing required field (
volumes.reference,volumes.deformed,points,output, andgray_min/gray_maxwhenthresholdis given) raisesValueError(config: missing required key 'output');a value outside a fixed set of choices raises
ValueError(config.search.dof: 5 is not one of [3, 6, 12]);a list of the wrong length, a non-number for a number field, a non-integral number for an integer field, or a non-boolean for a boolean field raises
ValueError;a value out of range raises
ValueErrornaming the key and the rule (config.search.max_iterations: 300 is out of range; it must be between 1 and 255); the ranges are in the tables below;search.method: icgnandseeding.strategy: fftare refused as not implemented yet (M5);a field that is read but not used yet (
seeding.coarse_level,seeding.repair_passes,cluster.brick_dtype,cluster.scheduler) warns when set to anything but its default.
Omitted optional fields take the defaults below. Integers are accepted for float fields.
Once zvdvc plan has made a results store, seed and run refuse a config
that differs from the planned one in anything that changes results (every
setting but cluster, workdir, uncertainty_seeds,
seeding.repair_passes and the input and output paths), in the points or
output path, or in the volumes’ identity. plan refuses to reuse a store
made with other settings, volumes or points (Results store, “Run
fingerprint”).
Technical reference¶
Top level¶
field |
type |
default |
CCPi key |
meaning |
|---|---|---|---|---|
|
mapping |
required |
Image volumes; see volumes. |
|
|
string |
required |
|
Search points: a zarr-vectors store (a path ending |
|
string |
required |
|
The zarr-vectors results store written by the tiled pipeline (Results store). |
|
mapping |
defaults below |
Sample template; see subvolume. |
|
|
mapping |
defaults below |
Solver settings; see search. |
|
|
mapping |
defaults below |
Starting displacements; see seeding. |
|
|
mapping |
defaults below |
Tiles, devices and memory; see cluster. |
|
|
int or null |
|
|
Solve only the first N points in processing order (distance from the start point); the rest are |
|
int |
|
\(k \ge 0\). \(k > 0\): solve every |
|
|
string |
|
Work directory (created if missing). Give each run its own: the default is shared by every config that does not set one. |
volumes¶
zvdvc.config.VolumeSpec. See Image volumes for formats.
field |
type |
default |
CCPi key |
meaning |
|---|---|---|---|---|
|
string |
required |
|
Reference volume: an OME-Zarr group or array (a path ending |
|
string |
required |
|
Deformed volume, same shape as the reference. |
|
string |
|
The array inside an OME-Zarr group (the multiscale level). Ignored for arrays and flat files. |
|
|
3 ints or null |
|
|
Size of a |
|
string or null |
|
from |
numpy dtype of a |
|
int |
|
|
Bytes to skip at the start of a |
|
float |
|
Gaussian low-pass (voxels) applied to both volumes as they are read, \(\ge 0\); 0 is off, as in CCPi. About 1.0 removes most interpolation bias. Recorded in the results store; a resumed run with another value is refused. |
|
|
string |
|
How bricks reach the GPU: |
subvolume¶
zvdvc.config.SubvolumeSpec. See Correlation method, “Sample templates”.
field |
type |
default |
CCPi key |
meaning and valid values |
|---|---|---|---|---|
|
string |
|
|
|
|
float |
|
|
Cube side or sphere diameter, voxels, \(> 0\). |
|
int |
|
|
Samples per subvolume, 1 to 1 000 000. A cube rounds up to \(k^3\). |
|
3 floats |
|
|
Per-axis \((x, y, z)\) scale of the subvolume, each \(> 0\). |
|
int |
|
Random seed of the sphere template, \(\ge 0\). One template is shared by all points. |
search¶
zvdvc.config.SearchSpec. See Correlation method.
field |
type |
default |
CCPi key |
meaning and valid values |
|---|---|---|---|---|
|
int |
|
|
|
|
string |
|
|
|
|
string |
|
|
|
|
float |
|
|
Largest allowed \(\lVert\mathbf{u} - \text{seed}\rVert_\infty\), voxels, \(> 0\); also sizes the brick halo and the grid search. |
|
3 floats |
|
|
Rigid offset \((x, y, z)\) of the deformed volume, voxels: the seed where no other seed exists. |
|
float |
|
|
Step of the translation grid search, voxels, \(\ge 0\); 0 disables it. |
|
mapping or null |
|
|
Subvolume threshold test; see below. |
|
string |
|
|
|
|
int |
|
Gauss–Newton steps per point (CCPi’s |
|
|
float |
|
Stop when the objective changes by less than this, \(\ge 0\). |
|
|
float |
|
Stop when the translation step is shorter than this, voxels, \(\ge 0\). |
|
|
bool |
|
Mark points that reach |
search.threshold¶
zvdvc.config.ThresholdSpec. When present, a point whose fraction of
reference samples within [gray_min, gray_max] is below min_fraction is
THRESH_FAIL and is not searched.
field |
type |
default |
CCPi key |
meaning |
|---|---|---|---|---|
|
float |
required |
|
Lower grey level. |
|
float |
required |
|
Upper grey level, \(\ge\) |
|
float |
|
|
Minimum fraction of samples in range, 0 to 1. |
seeding¶
zvdvc.config.SeedingSpec. See Correlation method, “Seeding”.
field |
type |
default |
CCPi key |
meaning and valid values |
|---|---|---|---|---|
|
string |
|
|
|
|
3 floats or null |
|
|
\((x, y, z)\) the wavefront starts from; |
|
int |
|
Neighbours searched for |
|
|
float or null |
|
Wavefront shell width, voxels, \(> 0\); |
|
|
int |
|
|
|
|
int |
|
|
|
|
int |
|
Not used yet: the repair pass is not implemented (M5); another value warns. |
cluster¶
zvdvc.config.ClusterSpec. See Choose tiles, batches and chunk sizes.
field |
type |
default |
meaning and valid values |
|---|---|---|---|
|
3 ints |
|
Tile size in voxels, \((z, y, x)\), each \(\ge 1\). Must be a whole number of point-cloud chunks per axis (to within 1 %). When |
|
list of ints or null |
|
GPU ordinals for |
|
float |
|
In \((0, 1]\). Share of device memory the plan’s memory check may use (bricks in flight plus batch scratch). The worker sizes batches from half this share of free memory. |
|
int or null |
|
Points per batch; |
|
int |
|
\(\ge 1\). Tiles whose bricks are read ahead of the one being solved. The memory check multiplies the largest tile’s brick bytes by it. |
|
string |
|
|
|
string |
|
|
Derived value: the halo¶
RunConfig.halo() is the brick margin around a tile’s points, in voxels:
The \(+2\) covers the tricubic stencil. With the defaults (sphere 80,
disp_max 38) \(h = 80\). The spread of seeds within a tile is added at plan
time (Image volumes).
Complete annotated example¶
Every field, with its default unless the comment says otherwise. Only
volumes.reference, volumes.deformed, points and output are required.
volumes:
reference: data/scan/t00.ome.zarr # OME-Zarr, or .raw/.mhd/.npy
deformed: data/scan/t01.ome.zarr
array_path: "0" # level inside an OME-Zarr group
raw_shape_xyz: null # .raw only: [x, y, z]
raw_dtype: null # .raw only: e.g. "<u2" or "|u1"
raw_header_bytes: 0 # .raw only
prefilter_sigma: 0.0 # Gaussian low-pass (voxels); 0 = off, as CCPi
gpu_io: auto # host | kvikio | auto (kvikio when GPUDirect Storage is available)
points: data/scan/points.roi # .roi/.txt (imported by plan) or a .zarrvectors store
output: runs/t00_t01/results.zarrvectors
workdir: runs/t00_t01 # default: runs/default
subvolume:
geometry: sphere # cube | sphere
size: 80.0 # side or diameter, voxels
n_samples: 8000 # a cube rounds up to k^3
aspect: [1.0, 1.0, 1.0] # (x, y, z)
seed: 0 # template random seed
search:
dof: 6 # 3 | 6 | 12
objective: znssd # sad | ssd | zssd | nssd | znssd
interpolation: tricubic # nearest | trilinear | tricubic
disp_max: 38.0 # voxels, from the seed
rigid_trans: [0.0, 0.0, 0.0] # (x, y, z) voxels
basin_radius: 0.0 # translation grid-search step; 0 = off
threshold: # default: null (no threshold test)
gray_min: 27 # required when threshold is given
gray_max: 127 # required when threshold is given
min_fraction: 0.2
method: fagn # fagn (icgn: M5, refused)
max_iterations: 20
obj_tol: 1.0e-06
disp_tol: 0.01 # voxels
report_convg_fail: true # false = CCPi's behaviour
seeding:
strategy: wavefront # rigid | wavefront | coarse (fft: M5, refused)
start_point: null # (x, y, z); null = first point
n_neighbours: 75
shell_width: null # null = median point spacing
coarse_stride: 4
coarse_level: 1 # not used yet (M5); other values warn
repair_passes: 1 # not used yet (M5); other values warn
cluster:
tile_shape: [1024, 1024, 1024] # (z, y, x) voxels
devices: null # null = every visible GPU
gpu_memory_fraction: 0.8
batch_points: null # null = sized from free memory
prefetch_depth: 2
brick_dtype: native # not used; other values warn
scheduler: dynamic # not used; other values warn
num_points_to_process: null # null = all (in-memory solves only)
uncertainty_seeds: 0 # >0 adds displacement_sd
This example loads with RunConfig.from_yaml. The repository’s
configs/
holds three working configurations: synthetic_small.yaml (a 256³ synthetic
case), ccpi_central_grid.yaml (the iDVC example with CCPi’s own test
settings) and large_8xh100.yaml (a 4096³ production-style run).
Importing a CCPi dvc_in file¶
RunConfig.from_ccpi(path) reads a CCPi input file with
zvdvc.io.ccpi.read_dvc_input and converts it with
run_config_from_dvc_input
(io/ccpi.py).
Lines are key<whitespace>value. A line starting with # is a comment, and
a comment starts at ### or at a # after whitespace, so a # inside a
path is kept. Relative paths are resolved against the input file’s folder
(the zvdvc-dvc drop-in resolves them against the working directory
instead, as CCPi does).
CCPi key |
required |
RunConfig field |
|---|---|---|
|
yes |
|
|
yes |
|
|
yes |
|
|
yes |
|
|
yes |
|
|
no ( |
byte order of 16-bit data: |
|
no ( |
|
|
yes |
|
|
yes |
|
|
yes |
|
|
yes |
|
|
no ( |
|
|
no ( |
|
|
with |
|
|
no ( |
|
|
yes |
|
|
yes |
|
|
yes |
|
|
yes |
|
|
no ( |
|
|
no ( |
|
|
no |
|
|
no |
|
A missing required key raises ValueError listing every missing key. An
unknown key is ignored with a warning. The result is validated as a YAML
config is, and an error names the dvc_in key (subvol_npts: 0 is out of range; ...). The import also fixes the settings that make zvDVC
behave like CCPi: seeding.strategy: wavefront and
search.report_convg_fail: false. Every other field keeps its default (in
particular prefilter_sigma: 0, method: fagn, max_iterations: 20).
The reverse, zvdvc.io.ccpi.write_dvc_input(cfg, path, roi_path=..., output_base=...),
writes a CCPi input file equivalent to a configuration, which is how the CCPi
baseline runs on zvDVC’s test cases. See CCPi and iDVC file compatibility for the file
formats.