pipeline.yml Reference

pipeline.yml is the top-level declarative configuration. It defines all derivative computations, links to datasets, and controls execution.

Top-Level Keys

naming_version: 1               # required since 0.4.0
datasets: datasets.yml          # path to datasets.yml (or an inline mapping)
mount_point: local              # active mount point (matches key in datasets.yml)
new_definitions: custom_nodes.py  # optional: custom node module(s)

n_jobs: null                    # optional: parallelism (null = serial, -1 = all cores)
joblib_backend: loky            # optional: joblib backend
joblib_prefer: processes        # optional: joblib prefer hint

DerivativeDefinitions:
  <DerivativeName>:
    ...

DerivativeList:
  - <DerivativeName>
  - ...

naming_version

Required since 0.4.0. Must be exactly naming_version: 1. It declares that the configuration follows the 0.4.0 naming, output-layout and completion rules. A configuration without it, or with another value, is refused before anything runs by every entry point (all CLI subcommands, the TUI, run_pipeline, iterate_derivative_pipeline, build_derivative_dataframe, …):

neurodags: error: pipeline configuration 'pipeline.yml' has no top-level 'naming_version'. neurodags 0.4.0 requires 'naming_version: 1'. To upgrade a neurodags 0.3.x configuration and its outputs, preview with `neurodags migrate pipeline.yml`, then run it again with --apply (see the 'Migrating to 0.4' guide).

datasets

Path to datasets.yml, or an inline mapping of datasets (same fields as in datasets.yml Reference). A relative path is resolved from the pipeline YAML location.

Relative paths inside the datasets definitions (source_root, file_pattern, exclude_pattern, derivatives_path) are resolved against the directory of the YAML file that contains them: the datasets YAML, or pipeline.yml for an inline mapping (changed in 0.4.0; they used to be relative to the current working directory). For a configuration passed as a dict to the Python API, pass base_dir= to run_pipeline / iterate_derivative_pipeline / build_derivative_dataframe; relative dataset paths without it are an error. See Relative paths for the full table.

mount_point

Selects which environment’s paths to use from datasets.yml. Must match a key in each dataset’s source_root / file_pattern / derivatives_path maps.

It is the default only: -m/--mount-point on the command line, mount_point= in the Python API, or the NEURODAGS_MOUNT_POINT environment variable select another mount without editing the YAML (see Choosing the mount point).

new_definitions

Path (or list of paths) to Python modules that register custom nodes. Loaded before any derivatives execute.

new_definitions: custom_nodes.py

# or multiple files:
new_definitions:
  - custom_nodes/nodes_a.py
  - /abs/path/to/nodes_b.py

Relative paths resolved from the pipeline YAML location. Each module is executed once on import.


DerivativeDefinitions

Each key is a derivative name (see Derivative names). The value is a derivative definition:

DerivativeDefinitions:
  MyDerivative:
    save: True             # default True
    overwrite: False       # default False
    for_dataframe: False   # default False
    nodes:
      - id: 0
        ...
      - id: 1
        ...

Derivative names

Outputs are written as <source>@<name><artifact suffix>, with the name exactly as written here (fit_w_l06 → @fit_w_l06, BandPower → @BandPower). The same spelling is used everywhere: DerivativeList, reuse steps (derivative: fit_w_l06.nc), --derivative, dataframe columns and status. Names must match ^[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9])?$, be YAML strings (quote keys such as "Yes"), be unique ignoring case, not be SourceFile, and not define both X and X-<digits>; every entry point rejects invalid names before anything runs.

See File Naming and Output Layout for all naming rules: output files, .done manifests and markers, references, the output layout, chained names (the last @ separates source and derivative) and dataframe column names.

Derivative Flags

Key

Type

Default

Description

save

bool

True

Persist output artifacts to disk. False = compute but don’t write.

overwrite

bool

False

Force recompute even if the unit is done (valid .done manifest).

for_dataframe

bool

False

Include this derivative when calling build_derivative_dataframe.

Node Steps

Each entry in nodes is a step with a unique id. Steps execute in topological order. A step is either a compute step (runs a node function) or a reuse step (loads a derivative from disk).

Compute Step

- id: 1
  node: my_node_name
  args:
    input_data: id.0     # reference to step 0's output
    param_a: 42
    param_b: [1, 40]
  • node: name of a registered node function

  • args: keyword arguments passed to the node; values of the form id.<N> resolve to the artifact produced by step N

Reuse Step (load derivative from disk or in-memory)

- id: 0
  derivative: CleanedEEG.fif
  • derivative: <DerivativeName><suffix> — resolves the named derivative for the current file and selects the artifact whose suffix is exactly <suffix> (CleanedEEG.fif selects .fif, never .report.html); the name is written as in DerivativeDefinitions, which is also its on-disk spelling (see Derivative references)

  • A bare <DerivativeName> is allowed only when the derivative has exactly one artifact

  • Use SourceFile to load the raw input file

If the upstream derivative is already done on disk, the selected artifact’s file is loaded. If it has not been written yet (it is computed in the same run, or has save: false), the selected artifact of the in-memory NodeResult is used. Selection is the same in both cases.

Selecting one artifact from a multi-artifact derivative

When an upstream derivative is a splitter — a node that returns one artifact per condition, segment type, or split key — write the artifact’s full suffix:

- id: 0
  derivative: EpochSplitter.EO_baseline.fif   # selects only the .EO_baseline.fif artifact

EpochSplitter.fif does not select .EO_baseline.fif: suffixes are compared for equality, not by their ending. A suffix the upstream derivative did not produce, or a bare EpochSplitter, fails the consuming unit with neurodags.dag.ArtifactSelectionError listing the available suffixes ('.EC_baseline.fif', '.EO_baseline.fif'). There is no fallback to another artifact or to the whole result.

# Splitter example
DerivativeDefinitions:
  EpochSplitter:
    nodes:
      - id: 0
        derivative: SourceFile
      - id: 1
        node: split_by_condition    # returns .EO_baseline.fif, .EC_baseline.fif, …
        args:
          mne_object: id.0

  EO_Features:
    nodes:
      - id: 0
        derivative: EpochSplitter.EO_baseline.fif   # only EO_baseline epochs
      - id: 1
        node: compute_features
        args:
          epochs: id.0

id.N References

id.<N> in args resolves to the output of step N. When a step produces multiple artifacts, the artifact matching the node’s expected argument type is selected by the _unwrap_for_arg heuristic (first .fif for MNE objects, first artifact otherwise). To select a specific artifact from a multi-artifact upstream derivative, use the derivative: Name.suffix reuse step (see above) rather than relying on id.<N> heuristics.

Field access: id.N.field

When step N produces a mapping (a dict — e.g. a parser node such as bids_parse), a downstream arg can pull a single field with id.<N>.<field>:

- id: 1
  node: bids_parse
  args: {path: id.0}          # -> {"subject": "001", "task": "rest", ...}
- id: 2
  node: my_processing_node
  args:
    raw:     id.0
    subject: id.1.subject      # "001"
    task:    id.1.task         # "rest"

Field-key constraint. . is the reference separator, so an addressable field must be a plain identifier — letters, digits and underscores, not starting with a digit. Dotted, dashed, or nested paths (id.1.a.b, id.1.some-key) are not supported and raise a clear error; keep parser output flat with identifier keys (BIDS entities already comply). Values are unconstrained. To consume the whole mapping instead, reference id.N (no field) and index it inside the node.


Sharing Arguments with Anchors and Merge Keys

When many derivatives share the same node arguments, define them once with a YAML anchor (&name) and pull them into each args mapping with a merge key (<<: *name):

_defaults: &fitargs
  n_iter: 100
  alphas: [1.0, 1000.0, 20]

DerivativeDefinitions:
  FitA:
    nodes:
      - {id: 1, node: my_fit, args: {<<: *fitargs, space: a}}
  FitB:
    nodes:
      - id: 1
        node: my_fit
        args:
          <<: *fitargs
          n_iter: 5        # overrides the merged value
          space: b

Standard YAML merge semantics apply:

  • Keys written in the mapping itself override merged ones (FitB above runs with n_iter: 5).

  • <<: [*a, *b] merges several anchors; when they share a key, the earlier one wins.

The anchor can live under any top-level key that neurodags does not use; _defaults is a good convention. Unknown top-level keys are ignored by the loader and by neurodags validate, so the helper key needs no extra configuration. An anchor must be defined before it is used, so put the helper key above DerivativeDefinitions.

Duplicate keys are still rejected: writing the same key twice in one mapping (including inside the anchored mapping) raises Duplicate key '<key>' at line L, column C. Overriding a key that came from a merge, as in FitB, is not a duplicate.


DerivativeList

Controls which derivatives execute and in what order. Derivatives not listed here are defined but never run. Comment out entries to skip without removing definitions:

DerivativeList:
  - CleanedEEG
  - CrossSpectralDensity
  - PowerSpectrum
  # - SpectralEntropy     # skip this one
  - BandPower

Complete Example

naming_version: 1
datasets: datasets.yml
mount_point: local
new_definitions: custom_nodes.py

DerivativeDefinitions:
  CleanedEEG:
    nodes:
      - id: 0
        derivative: SourceFile
      - id: 1
        node: basic_preprocessing
        args:
          mne_object: id.0
          resample: 256
          filter_args:
            l_freq: 0.5
            h_freq: 110

  CrossSpectralDensity:
    nodes:
      - id: 0
        derivative: CleanedEEG.fif
      - id: 1
        node: welch_csd
        args:
          data: id.0
          n_fft: 1024

  Coherence:
    nodes:
      - id: 0
        derivative: CrossSpectralDensity.nc
      - id: 1
        node: compute_coherence
        args:
          csd: id.0
          bands:
            alpha: [8, 12]

  PowerSpectrum:
    for_dataframe: True
    nodes:
      - id: 0
        derivative: CrossSpectralDensity.nc
      - id: 1
        node: extract_auto_spectra
        args:
          csd: id.0

  SpectralEntropy:
    overwrite: True
    nodes:
      - id: 0
        derivative: PowerSpectrum.nc
      - id: 1
        node: spectral_entropy
        args:
          psd: id.0

  BandPower:
    save: False
    nodes:
      - id: 0
        derivative: PowerSpectrum.nc
      - id: 1
        node: extract_bands
        args:
          psd: id.0
          bands:
            alpha: [8, 12]
            beta: [13, 30]

  AlphaNetworkCoupling:
    nodes:
      - id: 0
        derivative: BandPower.nc
      - id: 1
        derivative: Coherence.nc
      - id: 2
        node: correlate_power_connectivity
        args:
          bandpower: id.0
          coherence: id.1
          band: alpha

DerivativeList:
  - CleanedEEG
  - CrossSpectralDensity
  - PowerSpectrum
  # - SpectralEntropy
  - Coherence
  - BandPower
  - AlphaNetworkCoupling

This pipeline corresponds to the following DAG:

SourceFile
  └─ CleanedEEG
       └─ CrossSpectralDensity
            ├─ PowerSpectrum (for_dataframe)
            │    ├─ SpectralEntropy (overwrite=True)
            │    └─ BandPower (save=False)
            │         └─ AlphaNetworkCoupling ←─ Coherence
            └─ Coherence