Configuration and .env¶
Every parameter of the pipeline lives in one configuration, validated by pydantic
models (sidenor_ladle.config.models): an unknown key or a value of the wrong type is
reported when the configuration is loaded, never in the middle of a long run.
Order of precedence¶
flowchart LR
d["1. defaults<br/>of the code"] --> f["2. configuration file<br/>TOML / YAML / JSON"] --> e["3. .env and<br/>TFM_* variables"] --> c["4. command-line options<br/>--data-root ..."] --> s["5. --set block.key=value"]
The last one wins. The configuration file is, in this order: --config, the variable
TFM_CONFIG, or the first of config/config.toml, config/config.yaml,
config/config.json found in the current folder.
Configuration files¶
config/config.toml lists every parameter with its default value and a comment. YAML
and JSON are equivalent; the former config.json of version 3 is still accepted (keys
starting with _ are comments and are ignored).
sidenor-ladle config show # effective configuration, TOML
sidenor-ladle config show -f yaml > config/config.yaml
sidenor-ladle -c config/config.yaml run
sidenor-ladle config init --format yaml # every default value + .env.example
Change a value for one run without editing a file:
sidenor-ladle -s masks.bit_used_for_features=4 -s "masks.trim.cameras=[0, 2, 3]" run --from 5
Private and machine-specific values: .env¶
Paths that reveal user names or the layout of the plant's VM, and any future credential
(database password, API token), are never committed. They are read from a .env file
with python-dotenv (variables already set in the shell win over the file):
| Variable | Configuration key |
|---|---|
TFM_DATA_ROOT |
paths.data_root |
TFM_THICKNESS_DIR |
paths.thickness_dir |
TFM_OUTPUT_ROOT |
paths.output_root |
TFM_MANUAL_READING_FILE |
ladle_identity.manual_reading_file |
TFM_CONFIG |
default configuration file |
TFM_LOG_LEVEL |
logging level of the command line |
cp .env.example .env # .env is listed in .gitignore
sidenor-ladle --env-file /secure/place/vm.env run
Blocks¶
| Block | Used by | Main parameters |
|---|---|---|
paths |
all | data_root, thickness_dir, output_root (from .env) |
steps |
all | output sub-folder of each step |
bin_format |
01, 04, 12 | header size, sync word, image size |
inventory |
01 | t_shell, t_bath, hotspot_thresholds, workers |
thickness_records |
02 | image_period, zero_mm_is_missing |
campaigns |
03 | quality flags: min_shell_px_frame, setup_days, drop_first_of_repeated, identity check |
masks (+ masks.trim) |
04, 05, 06, 12 | thresholds and kernels of masks A-F, bit_used_for_features, workers |
features |
05 | thresholds, zone cuts, reduced set |
bands |
06, 11, 13 | n_bands, min_px, new_worn_heats |
split |
06-12 | test_ladles, val_ladles (must not overlap) |
sequences |
07 | window, max_heat_gap |
centering |
08 | features centred by camera |
thickness_target |
09 | near_known_heats |
signal_diagnostic |
10 | features, group sizes, figure features |
baselines |
11 | input sets, anchors, algorithm settings |
audit |
12 | samples, colour scales, exclude_test_ladles |
band_evolution |
13 | campaigns drawn, scale |
ladle_number_check |
check | enhancement (CLAHE, unsharp masking) |
attribution_check |
check | time window, sample, camera preference |
ladle_identity |
check | classifier, folds, epochs, known cases |
data_quality_check |
checks | first days, cameras, sheet sizes |
report |
reports | formats, image_downsample, plotlyjs, figure_files |
The API reference documents every field.