Source and Report Configuration#
This page covers rank resolution, covariance, forward and source modeling, MNE parameter maps, report settings, and source visualization.
Rank Policy#
rank_policy is a processing-level field and defaults to "auto". It is
resolved on the exact final experimental Raw or saved Epochs after bad-channel
exclusion and restriction to channels shared with the noise input. The resolved
rank dictionary is then the default for covariance estimation and source
reconstruction. It is written to resolved-rank.json and routed to source
imaging so all default consumers use the same explicit dictionary rather than
estimating rank again.
Allowed values are "auto" (empirical target-data rank), "info",
"full", an MNE rank dictionary such as [meg: 60], or null as an
alias for the default automatic policy. Function-level MNE rank keys and
the compatibility field source.LCMV.n_rank remain supported as explicit
overrides. See
Rank, Covariance, and Source Imaging for precedence, LCMV’s two covariance matrices,
empty-room compatibility checks, and examples.
Covariance#
Field |
Default |
Meaning |
|---|---|---|
|
|
Writes covariance matrix and spectrum figures. |
|
|
|
|
|
Task entity used to locate the paired ICA-clean noise recording. |
|
|
Event correction for epoch-based covariance; normally matches epochs. |
|
tmin 0, tmax null, method auto, mag reject 4e-12, reject annotations |
MNE keyword arguments passed to |
|
stim auto, shortest 1, minimum duration 0 |
MNE find-events arguments used for fallback event extraction in epoch covariance. |
|
event 1, -0.2 to 0.0 s, mag picks |
MNE Epochs arguments that define baseline epochs. |
|
tmin null, tmax null |
MNE keyword arguments passed to |
The compute_raw_covariance and covariance maps are passed as kwargs to
their namesake MNE functions. MEGFlow adds the resolved rank from
rank_policy unless that function-level map explicitly supplies rank.
For epoch covariance, covariance.epochs follows the same direct
mne.Epochs contract as epochs.epochs.
bl-cov.fif is always produced for a full source run. The same covariance
process also writes lcmv-data-cov.fif only when the effective
source.source_methods contains LCMV. That data covariance is computed
from the exact final source Raw or saved Epochs, not from newly reconstructed
epochs. Minimum-norm-only runs do not compute it. resolved-rank.json is
always written and records the target rank and ordered common channels consumed
by source imaging.
For type: raw, MEGFlow replaces task-<experimental> in the ICA-clean
continuous filename with task-<raw_covariance_task_id>. The paired task must
have been imported and processed through ICA. The task id may contain letters,
numbers, and hyphens. Pairing retains all other filename entities, so subject,
session, run, acquisition, and suffix must already describe the intended pair.
The paired clean file is a channel dependency, not a path guessed from an
output directory. Covariance therefore waits for the current run’s noise record
even when task scheduling finishes the experiment first. A missing pair fails
the full source run instead of silently omitting it, and one noise recording may
serve multiple experimental tasks when their other entities match. A recording
identified as a raw-covariance reference is cleaned through ICA but is excluded
from its own epoch, covariance, forward, and source branches, even when its own
recording profile otherwise inherits epoch covariance. When epochs.preproc
is not empty, the same operations are applied in memory to the paired noise
recording before raw covariance is computed.
Target and noise inputs are restricted to common good channels in target order. With the default rank policy, rank is resolved from the target experimental input. For raw noise, MEGFlow also checks that the empirical noise-input rank can support that target rank. See Rank, Covariance, and Source Imaging for the complete contract and the limitation of independently applied ICA projections.
Worked examples: dSPM and LCMV Covariance and Raw or Empty-Room Covariance.
BEM, Coregistration, Forward, and Source#
Field |
Default |
Meaning |
|---|---|---|
|
|
BEM surface subdivision grade. |
|
|
Single-layer MEG BEM conductivity. |
|
|
Generates transform-alignment figures. |
|
|
Distance used to omit headshape points before fitting. |
|
|
Scalp expansion used by MNE coregistration. |
|
200 iterations; fiducial/HSP/HPI weights from the Docker config |
Initial MNE ICP fit. |
|
200 iterations; HSP-only weight 10 |
Fine-tuning ICP fit. |
|
unset |
Reuses a supplied transform instead of fitting a new one. |
|
|
Label used in forward output naming. |
|
|
Cortical surface and source-space spacing. |
|
|
Source input mode: |
|
|
Generates source figures. |
|
|
Any implemented inverse methods: MNE-family methods and/or |
|
|
Channel type selected for evoked/source input. |
|
|
Source-space spacing and output label. |
|
loose auto, depth 0.8, fixed auto |
Passed to |
|
lambda2 1/9, method dSPM, normal orientation |
Passed to |
|
falls back to |
Passed to |
|
tmin 0.01, tmax 0.4, method auto |
Passed to |
|
reg 0.05, pick_ori null, unit-noise-gain-invariant normalization |
Passed to |
|
empty |
Passed to the matching epoched or continuous MNE LCMV application function. |
|
unset |
Compatibility integer/string/dictionary override used after the
corresponding function-level |
|
peak, both hemispheres, lateral view |
Peak- or label/time-based visualization selection. |
Coregistration is implemented with MNE Coregistration. Source kwargs correspond to make_inverse_operator and make_lcmv. The complete rank precedence and conditional covariance behavior are described in Rank, Covariance, and Source Imaging.
Worked examples: Full MEG with Existing Anatomy and dSPM and LCMV Covariance.
MNE Parameter Passthrough Example#
The following representative settings use MNE argument names directly. MEGFlow
routes Raw/Epochs/events inputs, removes its own control fields, injects the
resolved default rank where appropriate, and forwards the remaining maps to the
named MNE functions. They may be placed in defaults, a dataset profile, or
a recording profile. Maps are recursively merged across those levels.
params {
megflow {
defaults {
// These maps use the keyword names of the corresponding MNE APIs.
epochs = [
event_source: "find_events",
find_events: [stim_channel: "STI 014", shortest_event: 1],
epochs: [
event_id: 1, tmin: -0.2, tmax: 0.8, baseline: [null, 0.0],
picks: "meg", preload: true, proj: false, decim: 2,
reject: [mag: 4e-12], reject_tmin: -0.1, reject_tmax: 0.6,
reject_by_annotation: true, event_repeated: "merge"
]
]
covariance = [
type: "epochs",
epochs: [event_id: 1, tmin: -0.2, tmax: 0.0,
baseline: null, picks: "meg", preload: true],
covariance: [
keep_sample_mean: true, tmin: null, tmax: null,
method: "empirical", cv: 3, n_jobs: 1
],
compute_raw_covariance: [
tmin: 0.0, tmax: null, tstep: 0.2,
method: "empirical", reject_by_annotation: true, n_jobs: 1
]
]
source = [
type: "epochs",
source_methods: ["dSPM", "LCMV"],
dSPM: [
make_inverse_operator: [
loose: "auto", depth: 0.8, fixed: "auto", use_cps: true
],
apply_inverse: [
lambda2: 0.1111111111111111, method: "dSPM", pick_ori: "normal"
],
apply_inverse_raw: [
lambda2: 0.1111111111111111, method: "dSPM",
start: null, stop: null, buffer_size: 1000
]
],
LCMV: [
data_covariance: [tmin: 0.01, tmax: 0.4, method: "empirical"],
make_lcmv: [
reg: 0.05, pick_ori: null,
weight_norm: "unit-noise-gain-invariant", inversion: "matrix"
],
apply_lcmv: [verbose: "INFO"],
apply_lcmv_raw: [start: null, stop: null, verbose: "INFO"]
]
]
}
}
}
These are API passthrough capabilities, not universal scientific defaults. Filter bands, epoch windows, rejection limits, covariance intervals, inverse orientation, and beamformer regularization must still be selected for the dataset and hypothesis. MEGFlow 1.0.0 pins MNE 1.8.0; validate new kwargs against that runtime even when consulting newer MNE stable documentation.
For an actual OSL-Ephys stage that is not part of the default recipe, see OSL-Ephys Recipe Passthrough.
Report#
Field |
Docker default |
Meaning |
|---|---|---|
|
|
Bad-channel count alarm. |
|
|
Bad-segment count alarm. |
|
|
Mean coregistration-distance alarm. |
|
|
Maximum coregistration-distance alarm. |
|
|
Rejected-epoch fraction alarm. |
|
|
Time span represented by detailed artifact overview images. |
|
|
Warns when no ECG component is reported. |
|
|
Warns when no EOG component is reported. |
|
|
|
Source Visualization#
Source reconstruction figures use the maximal-activation peak by default. To
inspect a predefined response window, set source.visualization with a
time point and an anatomical ROI. MEGFlow selects the nearest source-estimate
sample at that time, restricts the search to matching FreeSurfer aparc
labels, and saves figures with the selection name in the filename.
params {
megflow {
defaults {
source {
visualize = true
epoch_label = "char_onset"
source_methods = ["dSPM"]
visualization {
name = "temporal_124ms"
mode = "label"
roi = "temporal"
time = 0.124
hemi = "both"
}
}
}
}
}
Common ROI aliases include temporal or auditory for temporal-lobe
responses and occipital or visual for occipital responses. hemi can
be lh, rh, or both. Leaving visualization unset preserves the
default peak-based figure names. When views is omitted, MEGFlow selects a
lateral, medial, or ventral view from the anatomical label of the
selected vertex so that its marker remains visible. Set views explicitly to
override this behavior.