nirspipe.io.groups#

The pairs CSV: which recordings make up each hyperscanning group.

Module Contents#

Classes#

Functions#

parse_group_csv

Parse group CSV into {(group_id, task, session): [GroupEntry, …]}.

member_snirfs

The one raw SNIRF each member’s CSV row names, {subject_id: path}.

API#

class nirspipe.io.groups.GroupEntry#
group_id: str = None#
subject_id: str = None#
task: str = None#
session: str | None = None#
run: str | None = None#
role: str | None = None#
nirspipe.io.groups.parse_group_csv(csv_path: pathlib.Path) → dict[tuple[str, str, str | None], list[GroupEntry]]#

Parse group CSV into {(group_id, task, session): [GroupEntry, …]}.

session is None for a row without one, so a CSV with no session column keys every group as before; one group recorded in two sessions is two groups, never four members.

An occasion column names the sitting when members carry different session labels for it; the key’s third element is then the occasion (a blank one falls back to the row’s session), while each entry keeps its own session to find its file:

G1,sub-A,chat,3,1  +  G1,sub-B,chat,1,1  ->  {("G1", "chat", "1"): [A ses 3, B ses 1]}

A role column names each member’s part, on every row or on none; members keep the rows’ order either way.

nirspipe.io.groups.member_snirfs(bids_dir: pathlib.Path, group: list[nirspipe.io.groups.GroupEntry], validate: bool = False) → dict[str, pathlib.Path]#

The one raw SNIRF each member’s CSV row names, {subject_id: path}.

One lookup for everything that follows a member’s recording: loading it, writing its aligned copy under the same stem, and naming the session its channel decisions sit in. Separate lookups that dropped the session could, on a two-session tree, give the aligned copy its name and sidecars from the other session.