Pipeline configuration#
What dirconn-bids computes is set by one TOML file, given with --config (see Command line).
Every key is optional: an omitted key takes its default, and a file with only
[estimation]
methods = ["gc", "pdc"]
is a complete configuration. Unknown keys and sections are errors, and so are values of the wrong
type or out of range. dirconn-bids validate-config FILE checks a file without running anything
and prints its hash.
The file#
Sections.
[input],[prepare](with[prepare.lock]),[estimation](with[estimation.bands]and one sub-table per method),[statistics],[controls],[output]and[execution], plus the top-levelschema_version.No null in TOML. TOML has no null value, so the nullable fields (
prepare.resample_hzandinput.description) are switched off with the string"null"(any case), in the file or with--set key=null. The configuration that dirconn writes back (dirconn.tomlin the output) uses the same string.Per-method options. A sub-table of
[estimation]that is not one of its fields holds the keyword arguments of the estimator of that name:[estimation] methods = ["gc"] [estimation.gc] method = "state_space"
It is stored as
estimation.params.gc.method. Options may be given only for methods listed inestimation.methods; an option the estimator does not have makes its task fail.dirconn-bids list-methodslists the method names, and API reference the options of each estimator.estimation.orderandestimation.order_maxare passed asorderandmax_orderto the estimators that have these options, unless the sub-table sets them.Checks across sections. With
prepare.resample_hzset, every band’s upper edge must lie below half of it (the Nyquist frequency).statistics.test = "analytic"is refused whenestimation.methodslists a frequency-resolved method (seestatistics.test).
Hashes#
config_hash (printed by validate-config and recorded in provenance.json) is a digest of
the whole configuration. analysis_hash covers only the sections that change the numbers:
prepare, estimation, statistics and controls. It is part of every task key, and an
output directory refuses a run whose analysis hash or input section differ from the ones it was
created with; output and execution may change between runs (see Command line).
Fields#
Types are TOML types; a list of two numbers is written [4.0, 8.0].
schema_versionInteger, default
1. Version of the configuration format; only 1 is accepted.
[input]: what is read#
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
|
|
|
|
list of strings |
|
BIDS data types searched. |
|
list of strings |
|
Kinds of region-level nodes kept (the |
|
string or |
|
The |
[prepare]: preparation before estimation#
The steps run in this order: padding of the bad segments, resampling, z-score, event lock. Each is recorded in the data history that every result carries in its provenance.
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
number > 0, or |
|
Target sampling rate in Hz; |
|
boolean |
|
Standardise each channel over its valid samples. A channel with zero variance makes the task fail. |
|
|
|
|
|
number >= 0 |
|
Extra seconds masked on both sides of every bad segment ( |
|
list of strings |
|
|
|
number |
|
Start of the epoch relative to the event, in seconds. |
|
number |
|
End of the epoch relative to the event, in seconds; must be above |
[estimation]: connectivity#
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
list of strings, not empty |
|
Methods to run, by their registry names ( |
|
integer >= 1, or |
|
Model order of the model-based methods, or the criterion that selects it. A
criterion selects the order once per recording, on the prepared record, and
every method with an order (and TRGC) uses it, also on the surrogates of its test;
the null distribution therefore does not include the variability of the
selection. The selection (criterion curves) is in each result’s provenance and in
the recording’s diagnostics file. An |
|
integer >= 1 |
|
Largest order a criterion may select. |
|
|
|
Named frequency bands; at least one. A frequency-resolved result is reduced to one value
per band and tested per band; the tests of all bands use the same surrogates (each
surrogate is fitted once and reduced to every band). Giving |
|
|
|
How a spectrum is reduced to the value of a band. |
|
list of |
|
Frequency ranges (for example line noise, |
|
any TOML value |
none |
Keyword argument |
[statistics]: significance tests#
Every test is corrected over the pairs of its band; the choice of test and surrogate is discussed in Statistics in dirconn and Surrogate data and what a surrogate test can tell you.
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
number > 0 |
|
Block length of |
|
integer >= 1 |
|
Number of surrogates per test. |
|
number in (0, 1) |
|
Significance level applied to the corrected p-values. |
|
|
|
Multiple-comparison correction over the pairs of a band. |
[controls]: control analyses#
Run once per recording by its controls task.
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
boolean |
|
Also compute time-reversed Granger causality (TRGC, with |
|
boolean |
|
Measure the spectral dynamic range of each channel across the bands and record it, with an assumption check, in the diagnostics file of the recording. |
[output]#
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
boolean |
|
Write the long |
[execution]#
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
integer |
|
Base seed of the significance tests. Each task derives its own seed from it and its task
key, and band |
|
boolean |
|
Stop at the first failing task instead of recording it and going on. With |
The default file#
The built-in default (src/dirconn/workflows/_data/default_config.toml), with a comment on
every key:
# dirconn participant pipeline: default configuration.
# Every key is optional in a user file; omitted keys take the values below.
# TOML has no null: write the string "null" (or `--set key=null`) to turn a nullable option
# (prepare.resample_hz, input.description) off.
schema_version = 1
[input]
level = "roi" # "roi" (parcellated sources) or "sensor"
datatypes = ["meg", "eeg", "ieeg"] # BIDS data types to include
node_kinds = ["cortical", "direct"] # kinds of nodes to keep
description = "DK" # parcellation (BIDS desc entity)
[prepare]
resample_hz = 250.0 # target sampling rate; every band edge must be < half of it
zscore = true # standardise each channel
bad_segments = "mask" # "mask" bad annotations out of the estimate, or "ignore"
pad_bad_seconds = 0.0 # extra seconds masked around each bad segment
[prepare.lock]
events = [] # event names to lock to; empty = continuous data
tmin = -1.0 # window start relative to the event, seconds
tmax = 1.0 # window end relative to the event, seconds
[estimation]
methods = ["gc"] # names from the method registry
order = "bic" # integer, or "aic" / "bic" / "hqc" / "cv"
order_max = 30 # upper bound for criterion-based order selection
reduce = "mean" # band reduction: "mean", "median", "max", "peak_freq"
exclude_freqs = [] # [[lo, hi], ...] ranges left out of band reduction
# Per-method options go in sub-tables named after the method, for example:
# [estimation.gc]
# method = "state_space"
#
# Options the library leaves without a default get one from the pipeline (override them here):
# mtgc, imcoh, psi: segment_length = 2.0 on continuous records (frequency resolution 0.5 Hz);
# whole epochs on epoched records
# wdtf: window = 2.0 on continuous records, 0.5 on epoched records (step: half a window)
# psi: bands = the bands below (one value per band; a band must not contain
# another band's centre); [estimation.psi] must not set bands
[estimation.bands] # named bands in Hz, lo < hi
theta = [4.0, 8.0]
beta_low = [13.0, 20.0]
beta_high = [20.0, 30.0]
[statistics]
test = "surrogate" # "surrogate", "analytic" or "none"
surrogate = "auto" # auto = block_shuffle (continuous) / trial_shuffle (epoched);
# or phase_randomize, aaft, iaaft, circular_shift, trial_shuffle, block_shuffle
block_seconds = 5.0 # block length of block_shuffle, in seconds
n_surrogates = 200
alpha = 0.05
correction = "fdr_bh" # "fdr_bh", "bonferroni" or "none"
[controls]
time_reversal = true # also compute time-reversed controls
spectral_range_check = true # check bands against the usable spectral range
[output]
long_table = true # write the long-format results table
[execution]
seed = 20261115
fail_fast = false # stop at the first failing task