nirspipe.pipeline.hyper.wtc_aggregate#
Merge the per-dyad WTC band-mean tables into one long table per study.
nirspipe-hyper writes one group-<id>_task-<task>_stat-wtc_relmat.tsv per dyad and
task, and more beside it for the ROI means and the nulls. This
produces the stitched tables, with group_id and task carried as columns so nothing
about a row depends on the filename it came from.
What counts as one kind is not a list kept here: it is the set of entities a file carries
besides its group and its task. Two files merge together exactly when everything but those
two agrees, which is the rule a merged name follows as well -- the merged table is the
inputs’ own name with group- and task- taken out, so it lands at the root, where
having no analysis unit in the name is what marks a table as cross-dyad.
Only long tables merge. A wide matrix stays with its dyad: the long tables carry the same values one row per pairing, which is the shape that stacks across dyads.
The merge refuses more than it warns: nothing downstream of a concatenated TSV can recover which band a given row used.
Module Contents#
Functions#
Every per-dyad table under output_dir, grouped into the merges it would produce. |
|
Concatenate the per-dyad tables of one kind, as |
|
Write one kind’s merged table to output_dir, with a sidecar naming its inputs. |
|
Every merge the tree supports, one table per kind. The paths written. |
Data#
API#
- nirspipe.pipeline.hyper.wtc_aggregate.logger = 'get_logger(...)'#
- nirspipe.pipeline.hyper.wtc_aggregate.merge_kinds(output_dir: pathlib.Path) dict[tuple, list[Path]]#
Every per-dyad table under output_dir, grouped into the merges it would produce.
The discovery half of
write_aggregate_wtc(), separate so a command can report what is on disk without merging it.
- nirspipe.pipeline.hyper.wtc_aggregate.aggregate_wtc(output_dir: pathlib.Path, sources: list[Path]) pandas.DataFrame#
Concatenate the per-dyad tables of one kind, as
merge_kinds()grouped them.Returns an empty frame when every input was unreadable or empty, so a study that never ran WTC is not an error.
- nirspipe.pipeline.hyper.wtc_aggregate.write_aggregate_wtc(output_dir: pathlib.Path, sources: list[Path]) pathlib.Path | None#
Write one kind’s merged table to output_dir, with a sidecar naming its inputs.
Returns the path, or None when there was nothing to merge.
- nirspipe.pipeline.hyper.wtc_aggregate.write_all_aggregates(output_dir: pathlib.Path) list[Path]#
Every merge the tree supports, one table per kind. The paths written.