nirspipe.qc.rating.export#

Turn the rating viewers’ files into tables the pipeline reads.

Module Contents#

Functions#

raters

Every rater whose files the trees hold, "" for files saved without --rater.

channel_rows

One --bad-channels row per rated run, and the pairs rated both ways for one recording.

verdict_rows

Every FINAL verdict a rating file holds, one row per page and key, for reading.

span_rows

One --bad-spans row per marked stretch, and whether any span file was found.

export_spans

Write the marked stretches as a --bad-spans table, or nothing where none were ever marked.

export_ratings

Write the channel table and the verdict list into out_dir; return both paths and any conflicts.

Data#

API#

nirspipe.qc.rating.export.logger = 'get_logger(...)'#
nirspipe.qc.rating.export.CHANNELS_NAME = 'desc-ratedchannels_qc.tsv'#
nirspipe.qc.rating.export.VERDICTS_NAME = 'desc-ratedpages_qc.tsv'#
nirspipe.qc.rating.export.SPANS_NAME = 'desc-ratedspans_qc.tsv'#
nirspipe.qc.rating.export.HYPER_KEY = '_hyper'#
nirspipe.qc.rating.export.raters(trees: list[pathlib.Path]) → list[str]#

Every rater whose files the trees hold, "" for files saved without --rater.

nirspipe.qc.rating.export.channel_rows(trees: list[pathlib.Path], rater: str | None = None) → tuple[list[dict], list[str]]#

One --bad-channels row per rated run, and the pairs rated both ways for one recording.

sub-01_task-rest_desc-rawdecision_qc.json:
{"sub-01_task-rest_run-01": {"S1_D1 hbo": "bad", "S2_D2 hbo": "good"}}
-> {"participant_id": "sub-01", "session": "", "task": "rest", "acq": "", "run": "01",
    "rater": "", "bad_channels": "S1_D1", "keep_channels": "S2_D2"}

A _hyper entry leaves acq and run blank, so it holds for every run of that task and session. rater is the file’s rater- entity, blank without one.

nirspipe.qc.rating.export.verdict_rows(trees: list[pathlib.Path], rater: str | None = None) → list[dict]#

Every FINAL verdict a rating file holds, one row per page and key, for reading.

nirspipe.qc.rating.export.span_rows(trees: list[pathlib.Path], rater: str | None = None) → tuple[list[dict], bool]#

One --bad-spans row per marked stretch, and whether any span file was found.

{"sub-01_task-rest_run-01": [[12.0, 15.5]]} in sub-01_task-rest_desc-rawspans_qc.json
    -> {"participant_id": "sub-01", "session": "", "task": "rest", "acq": "", "run": "01",
        "rater": "", "onset": 12.0, "duration": 3.5}
nirspipe.qc.rating.export.export_spans(trees: list[pathlib.Path], out_dir: pathlib.Path, rater: str | None = None) → Path | None#

Write the marked stretches as a --bad-spans table, or nothing where none were ever marked.

nirspipe.qc.rating.export.export_ratings(trees: list[pathlib.Path], out_dir: pathlib.Path, rater: str | None = None) → tuple[pathlib.Path, pathlib.Path, list[str]]#

Write the channel table and the verdict list into out_dir; return both paths and any conflicts.