nirspipe.qc.hyper.hyper_usable#

The dyad’s shared usable time, as the numbers a cohort reads rather than as a carpet.

A cell is one channel pair in one window, and it is usable only while the pair is passing in both members at that moment. That intersection is what dyad_status() computes; this reduces it to what a cohort report can carry: a handful of scalars for the record, and one row per (pair, condition) for the panels.

Two layers on purpose. The record holds one number per dyad, the way every other quality record does, and a vector as long as the montage goes beside it in a table, the way the per-channel SCI scores already do.

Module Contents#

Functions#

usable_scalars

The dyad-level numbers a cohort table and its outlier rule read.

usable_table

One row per (pair, condition): the three shares inside that block.

write_usable_table

Write the usable-time table with its sidecar. None when there is nothing to write.

Data#

API#

nirspipe.qc.hyper.hyper_usable.logger = 'get_logger(...)'#
nirspipe.qc.hyper.hyper_usable.usable_scalars(grid: dict, subject_ids: list[str]) → dict#

The dyad-level numbers a cohort table and its outlier rule read.

-> {"n_long_pairs": 14, "usable_pairs_mean": 11.8, "usable_window_frac": 0.82,
    "one_member_frac": 0.11, "neither_frac": 0.07, "usable_stretch_s": 170.0,
    "n_windows": 120}

The three fractions sum to 1 and are the split no subject-level record can make. one_member_frac is an asymmetric loss, one cap or one electrode, and neither_frac a shared one, both members out at the same moment; two dyads with the same usable share and different middles are two different problems.

usable_stretch_s is the median over pairs of that pair’s longest unbroken usable run, which the fractions cannot show: a coherence window needs contiguous data.

nirspipe.qc.hyper.hyper_usable.usable_table(grid: dict, subject_ids: list[str], conditions: dict[str, tuple[float, float]] | None = None) → pandas.DataFrame#

One row per (pair, condition): the three shares inside that block.

Columns: pair, condition, usable_frac, one_member_frac, neither_frac, n_windows. A dyad with no annotated blocks gets one row per pair under the condition whole_run, so the table has the same shape either way and a cohort panel does not have to know which it is reading.

The windows are on the dyad’s aligned clock, passing_grid() having already put every member on it; a condition span measured on a member’s own clock would select the wrong columns here by that member’s crop offset.

nirspipe.qc.hyper.hyper_usable.write_usable_table(path: pathlib.Path, grid: dict, subject_ids: list[str], conditions: dict[str, tuple[float, float]] | None, sources: list[str] | None = None, **params) → Path | None#

Write the usable-time table with its sidecar. None when there is nothing to write.