Release History¶
The changelog is maintained in CHANGES.rst at the repo root
and inlined below.
Unreleased¶
CLI¶
New flag
--split-by-trial-type(BooleanOptionalAction, defaultTrue) onffrprep: emit per-trial-type epoched and evoked files alongside the combined output. Pass--no-split-by-trial-typefor the previous single-combined behaviour. The legacy--by_event_typeflag is kept as a SUPPRESS’d alias for one release.New flag
--trial-types A B …to restrict per-trial-type outputs to a subset.New flag
--difference-pairs A:B [C:D …]to compute difference evokeds across explicit pairs. For 2-type datasets the difference is auto-emitted; for 3+ types this flag is required to opt in.New flag
--with-stimulionffrprep-download example(BooleanOptionalAction, defaultFalse): additionally fetches the BIDS/stimuli/directory needed by stimulus-aware analyses (e.g.corr_stim_to_resp) and augments everyevents.tsvwith the matchingstim_filecolumn.
Preprocessing¶
epoch_dataacceptstrial_types=to narrow the discovered event_id mapping to a subset; raisesValueErrorif a requested name is absent so typos surface immediately.save_preprocessing_outputsaccepts adict[str, mne.Epochs]in addition to a scalar Epochs; dict input writes_desc-preproc{Cond}_epo.fifper trial type and the per-file sidecar carries aConditionfield. Scalar input keeps today’s_desc-preproc_epo.fiffilename + singlePathreturn.save_preprocessing_nodewraps the split:split_by_trial_type=Truefans the input Epochs out into a{cond: epochs[cond]}dict before forwarding tosave_preprocessing_outputs._save_one_preproc_epochsnow passesevents+event_idthrough to theEpochsArrayreconstruction so trial-type metadata survives the save / load round-trip (previously stripped silently; broke the per-condition flow).
Analysis¶
save_analysis_outputsaccepts a structured payload{"by_type": dict, "combined": Evoked, "diff": dict}(any subset). Filenames:per-type:
_desc-evoked{Cond}.fifcombined:
_desc-evoked.fifdifference:
_desc-evokedDiff{A}Vs{B}.fif
Sidecars carry
Condition(per-type) orDifferenceOf: [A, B](diff); combined omits both. Scalar Evoked input is treated as the combined output.create_analysis_workflowwires a newbuild_analysis_payloadhelper that produces the structured payload from a single Epochs object; the workflow inputnode gainsdifference_pairs.New helpers in
ffrprep.analysis(from PR #35 + post-merge refactor):compute_phase_consistency/plot_phase_consistency/plot_phase_consistency_masked: phase-consistency across two polarities + sum / difference.corr_stim_to_resp/corr_resp_to_resp: cross-correlation peak r + lag. Now delegate to a shared_xcorr_normalizedhelper that also returns the full correlation curve for plotting.response_consistency: mean pairwise Pearson correlation across epochs.compute_fft: amplitude spectrum helper.
Analysis worker granularity changed from per-file to per-(task, run) group.
_collect_analysis_groupsstitches per-condition preproc files viamne.concatenate_epochs(withevent_idpreserved) and the workflow runs once per group.
Reporting¶
Per-(task, run) groups: each (task, run) gets one Raw section, one Epoched section per trial type, and per-type / combined / diff Evoked sections under one heading.
New summary rows on per-condition Evoked sections:
Stim correlation (peak r)+Stim correlation (lag, ms), derived from the BIDSstim_filecolumn inevents.tsv(silent no-op when the column or file is missing).
New figure on per-condition Evoked sections: stim ↔ response cross-correlation curve with the peak marked.
Combined Evoked sections add a second pair of rows / figure for the envelope correlation (combined ≈ ENV proxy in FFR, so
|hilbert(stim)|is the natural reference).Difference Evoked sections add a single raw-waveform stim correlation row + figure (diff ≈ TFS proxy).
Epoched sections (≥ 10 trials) gain a
Mean trial-to-trial rrow viaresponse_consistency.New Phase Consistency section per (task, run) when exactly two per-condition preproc files exist. Uses seaborn’s
flare_rcolormap; subplot titles surface the trial-type names. Default in single-subject reports is unmasked; group-level callers can passmask=Truefor the significance-masked variant.
Datasets¶
New
download_stimuli(dataset_path=None)fetches the OSF stimulus files into<dataset>/ffrprep_raw_data/stimuli/per the BIDS spec, then augments everysub-*/eeg/*_events.tsvwith astim_filecolumn based on atrial_type -> filenamelookup (STIM_FILE_MAP).Existing
download_example_data/download_raw_dataaccept awith_stimuli=Falsekwarg; True triggers the stimulus download after the EEG data.
Dependencies¶
New runtime dependency:
seaborn>=0.13(used solely for itsflare_rcolormap registration).
Internal¶
Build / run-provenance helpers updated for the per-condition filenames:
_check_preproc_output_or_raiseglob widened to*_desc-preproc*_epo.fif;_propagate_run_provenancederives the analysis base-stem viastr.partition("_desc-preproc").build_analysis_payloadimports its dependencies viaimportlib.import_moduleso the Nipype Function-node subprocess resolves them without inheriting the parent’s globals.test_system_pipelinehelper now points_derivatives_rootat the explicitoutput_dirargument (the BIDS-App--output-dirpositional is now honoured end-to-end).Production Docker image installs runtime deps only (
uv sync --frozen --no-dev); the in-imagetestsubcommand needs a separate--with-testsrebuild.