Commit 6fa4b23
committed
Add fix_rbc_release_tr.py script for TR bandpass bug
Lets users of an RBC data release re-derive a correctly-bandpassed
cleaned BOLD and all downstream metrics, by patching the template-space
`desc-head_bold.nii.gz` header (TR=0.0 on disk) with the TR read from
the native-space `desc-preproc_bold.nii.gz` before regression.
Outputs land under a parallel `--output-dir` tree using the published
release's filename conventions:
* cleaned BOLD + bandpass-filtered regressors
* ALFF / fALFF / ReHo at `desc-sm6`, `desc-smZstd`, `desc-zstd`
* Atlas-based mean timeseries (`.1D`, `(n_timepoints, n_rois)`)
* Pearson + nilearn partial-correlation matrices, per atlas
Metrics compose `rbc.workflows.metrics.single_session_metrics` and
`rbc.core.metrics.standardization.compute_zscore`. Atlas resolution
goes through `rbc_resources.ATLAS_REGISTRY` so the release-name -> file
mapping survives filename changes inside `rbc_resources`.
The script ships with PEP 723 inline metadata so it can be invoked
standalone via `uv run --script` without a clone. `--skip-metrics`
falls back to BOLD-only behavior. `--verify` scans every discoverable
run (header-only reads) and reports buggy / clean / inconclusive
counts. `RBC_WORK_DIR` is scoped to the script's tempdir for the
duration of the run so all niwrap exec folders get cleaned up.
The TR-restore helper is inlined in the script (mirrors
`rbc.core.functional.resampling._restore_tr`) so standalone PEP 723
runs against an unmodified `main` don't trip an ImportError on a
symbol that isn't yet public.1 parent 253c9a8 commit 6fa4b23
3 files changed
Lines changed: 1205 additions & 0 deletions
0 commit comments